(function(u,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("vue"),require("clipboard")):typeof define=="function"&&define.amd?define(["exports","vue","clipboard"],n):(u=typeof globalThis!="undefined"?globalThis:u||self,n(u.index={},u.Vue))})(this,function(u,n){"use strict";const F={modelValue:{type:Boolean,default:!1},mode:{type:String,default:"normal"},zIndex:{type:Number,default:10}},S=27;function v(e,l){const{modelValue:t}=n.toRefs(e),s=c=>{c.keyCode===S&&t&&l.emit("update:modelValue",!1)};n.onMounted(()=>{document.addEventListener("keydown",s)}),n.onUnmounted(()=>{document.removeEventListener("keydown",s)})}function i(e,l,t){let s=e;return l&&(s+=`__${l}`),t&&(s+=`--${t}`),s}function h(e,l=!1){const t=l?`.devui-${e}`:`devui-${e}`;return{b:()=>i(t),e:r=>r?i(t,r):"",m:r=>r?i(t,"",r):"",em:(r,a)=>r&&a?i(t,r,a):""}}const m=h("fullscreen"),p=(e,l)=>{e.classList.add(m.b()),l.zIndex&&e.setAttribute("style",`z-index: ${l.zIndex}`)},b=e=>{e.classList.remove(m.b()),e.style.zIndex=""},w=async e=>{let l=null;return e.requestFullscreen?l=e.requestFullscreen():e.mozRequestFullScreen?l=e.mozRequestFullScreen():e.webkitRequestFullScreen?l=Promise.resolve(e.webkitRequestFullScreen()):e.msRequestFullscreen&&(l=Promise.resolve(e.msRequestFullscreen())),await(l==null?void 0:l.then(()=>!!document.fullscreenElement))},x=async e=>{let l=null;return e.exitFullscreen?l=e.exitFullscreen():e.mozCancelFullScreen?l=e.mozCancelFullScreen():e.webkitCancelFullScreen?l=Promise.resolve(e.webkitCancelFullScreen()):e.msExitFullscreen&&(l=Promise.resolve(e.msExitFullscreen())),await(l==null?void 0:l.then(()=>!!document.fullscreenElement))},q=()=>{document.getElementsByTagName("html")[0].classList.add(m.e("html"))},C=()=>{document.getElementsByTagName("html")[0].classList.remove(m.e("html"))};function z(e,l,t){const{modelValue:s,mode:c}=n.toRefs(e);let d=!1;const y=o=>{o?(p(l.value,e),q()):(b(l.value),C())},r=o=>{o?w(l.value):d||x(document)};n.watch(s,o=>{c.value==="normal"&&y(o),c.value==="immersive"&&r(o)});const a=()=>{document.fullscreenElement?d=!1:(t.emit("update:modelValue",!1),d=!0)};n.onMounted(()=>{document.addEventListener("fullscreenchange",a)}),n.onUnmounted(()=>{document.removeEventListener("fullscreenchange",a)})}var N="",f=n.defineComponent({name:"DFullscreen",props:F,emits:["update:modelValue"],setup(e,l){const t=n.ref();return z(e,t,l),v(e,l),()=>{const s=n.renderSlot(n.useSlots(),"default");return n.createVNode("div",{ref:t},[s])}}}),g={title:"Fullscreen \u5168\u5C4F",category:"\u901A\u7528",status:"100%",install(e){e.component(f.name,f)}};u.Fullscreen=f,u.default=g,u.fullscreenProps=F,Object.defineProperty(u,"__esModule",{value:!0}),u[Symbol.toStringTag]="Module"});
