"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),_=require("../../_util/KeyCode.js"),U=require("../../_util/classNames.js"),W=require("../../_util/omit.js"),j=require("./IDrawerPropTypes.js"),N=require("./utils.js"),F=e.defineComponent({compatConfig:{MODE:3},inheritAttrs:!1,props:j.drawerChildProps(),emits:["close","handleClick","change"],setup(t,{emit:h,slots:i}){const g=e.shallowRef(),d=e.shallowRef(),S=e.shallowRef(),b=e.shallowRef(),m=e.shallowRef();let u=[];`${Number((Date.now()+Math.random()).toString().replace(".",Math.round(Math.random()*9).toString())).toString(16)}`,e.onMounted(()=>{e.nextTick(()=>{const{open:o,getContainer:s,showMask:l,autofocus:n}=t,r=s?.();p(t),o&&(r&&(r.parentNode,document.body),e.nextTick(()=>{n&&w()}),l&&t.scrollLocker?.lock())})}),e.watch(()=>t.level,()=>{p(t)},{flush:"post"}),e.watch(()=>t.open,()=>{const{open:o,getContainer:s,scrollLocker:l,showMask:n,autofocus:r}=t,a=s?.();a&&(a.parentNode,document.body),o?(r&&w(),n&&l?.lock()):l?.unLock()},{flush:"post"}),e.onUnmounted(()=>{const{open:o}=t;o&&(document.body.style.touchAction=""),t.scrollLocker?.unLock()}),e.watch(()=>t.placement,o=>{o&&(m.value=null)});const w=()=>{d.value?.focus?.()},k=o=>{h("close",o)},D=o=>{o.keyCode===_.default.ESC&&(o.stopPropagation(),k(o))},C=()=>{const{open:o,afterVisibleChange:s}=t;s&&s(!!o)},p=({level:o,getContainer:s})=>{if(N.windowIsUndefined)return;const l=s?.(),n=l?l.parentNode:null;u=[],o==="all"?(n?Array.prototype.slice.call(n.children):[]).forEach(a=>{a.nodeName!=="SCRIPT"&&a.nodeName!=="STYLE"&&a.nodeName!=="LINK"&&a!==l&&u.push(a)}):o&&N.dataToArray(o).forEach(r=>{document.querySelectorAll(r).forEach(a=>{u.push(a)})})},M=o=>{h("handleClick",o)},y=e.shallowRef(!1);return e.watch(d,()=>{e.nextTick(()=>{y.value=!0})}),()=>{const{width:o,height:s,open:l,prefixCls:n,placement:r,level:a,levelMove:H,ease:Y,duration:z,getContainer:B,onChange:G,afterVisibleChange:J,showMask:v,maskClosable:L,maskStyle:T,keyboard:V,getOpenCount:Q,scrollLocker:X,contentWrapperStyle:$,style:A,class:q,rootClassName:E,rootStyle:P,maskMotion:R,motion:f,inline:x,...I}=t,c=l&&y.value,K=U.default(n,{[`${n}-${r}`]:!0,[`${n}-open`]:c,[`${n}-inline`]:x,"no-mask":!v,[E]:!0}),O=typeof f=="function"?f(r):f;return e.createVNode("div",{...W.default(I,["autofocus"]),tabindex:-1,class:K,style:P,ref:d,onKeydown:c&&V?D:void 0},[e.createVNode(e.Transition,R,{default:()=>[v&&e.withDirectives(e.createVNode("div",{class:`${n}-mask`,onClick:L?k:void 0,style:T,ref:S},null),[[e.vShow,c]])]}),e.createVNode(e.Transition,{...O,onAfterEnter:C,onAfterLeave:C},{default:()=>[e.withDirectives(e.createVNode("div",{class:`${n}-content-wrapper`,style:[$],ref:g},[e.createVNode("div",{class:[`${n}-content`,q],style:A,ref:m},[i.default?.()]),i.handler?e.createVNode("div",{onClick:M,ref:b},[i.handler?.()]):null]),[[e.vShow,c]])]})])}}});exports.default=F;
