"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),x=require("@vueuse/core");require("../config-provider/index.js");require("../hooks/index.js");require("../portal/index.js");const g=require("./style/index.js"),q=require("../hooks/useFullScreen.js"),k=require("../config-provider/hooks/use-namespace.js"),S=require("../portal/index.vue.js"),h=e.defineComponent({name:"FullScreen",__name:"index",props:{wrapperElementName:{default:"div"},zIndex:{default:2147483647},to:{default:"body"}},setup(o,{expose:p}){const{target:c,full:v,enter:w,exit:m}=q.useFullScreen(),{b:f,bm:b,be:_}=k.useNamespace("full-screen"),y=g.default("full-screen"),r=e.ref(!1),l=e.ref(),i=x.useScrollLock(document.body),s=e.ref();e.watch(()=>e.unref(v),t=>{t||(r.value=!1,l.value=void 0)});async function a(t,u=!1){await n(),r.value=!0,l.value=t,t==="browser"?w(u):i.value=!0}async function n(t=!1){r.value=!1,l.value==="browser"?await m(t):i.value=!1,l.value=void 0}async function d(t,u=!1){r.value?l.value!==t?await a(t,u):await n(u):await a(t,u)}return p({target:e.computed(()=>e.unref(c)),portalRoot:e.computed(()=>e.unref(s)),full:e.computed(()=>e.unref(r)),mode:e.computed(()=>e.unref(l)),enter:a,exit:n,toggle:d}),(t,u)=>(e.openBlock(),e.createBlock(e.unref(S.default),{to:o.to,disabled:l.value!=="window"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.wrapperElementName),e.mergeProps({ref_key:"target",ref:c},t.$attrs,{class:[e.unref(f)(),e.unref(f)("wrapper"),r.value&&l.value==="window"?e.unref(b)("wrapper","full"):null,e.unref(y)],style:{zIndex:r.value&&l.value==="window"?o.zIndex:"unset"}}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{full:r.value,enter:a,exit:n,toggle:d,mode:l.value,portalRoot:s.value}),e.createElementVNode("div",{ref_key:"portalRootRef",ref:s,class:e.normalizeClass(e.unref(_)("wrapper","portal-root"))},null,2)]),_:3},16,["class","style"]))]),_:3},8,["to","disabled"]))}});exports.default=h;
