(function(t,l){typeof exports=="object"&&typeof module<"u"?module.exports=l():typeof define=="function"&&define.amd?define(l):(t=typeof globalThis<"u"?globalThis:t||self,t.index=l())})(this,function(){"use strict";const t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],l=(()=>{const e=t[0],r={};for(const n of t)if((n==null?void 0:n[1])in document){for(const[g,w]of n.entries())r[e[g]]=w;return r}})(),a="fullscreenchange",b="fullscreenerror",h=27,k=122;function c(e,r,n=!1){document.addEventListener(e,r,n)}function i(){return!!document[l.fullscreenEnabled]}function s(){return!!document[l.fullscreenElement]}function f(){return document[l.fullscreenElement]||document.documentElement}function o(e,r){const n=e||document.documentElement;try{return n[l.requestFullscreen](r)}catch(F){console.error("请求全屏失败",F)}}function u(e){const r=e||document.documentElement;try{return r[l.requestFullscreen]()}catch(n){console.error("退出全屏失败",n)}}function E(e){return c(a,e)}function d(e){return c(b,e)}const m={request:o,requestFullscreen:o,exit:u,exitFullscreen:u,onChange:E,fullscreenchange:E,fullscreenEnabled:i,isFullscreen:s,fullscreenElement:f,onError:d,fullscreenerror:d};Object.defineProperties(m,{isEnabled:{enumerable:!0,get:i},isFull:{get:s},fullElement:{enumerable:!0,get:f}});function S(e){e.keyCode===k&&(e.stopPropagation(),e.preventDefault(),s()?u():o()),e.keyCode===h&&u()}return c("keydown",S),m});