"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),b=require("@aplus-frontend/antdv"),q=require("lodash-unified"),w=require("../../ap-modal/utils/util.js"),h=require("../../config-provider/config-provider.js");require("../components/ApDrawerClose.vue.js");const y=require("../components/ApDrawerClose.vue2.js"),P=r=>{let t,s;const{destroyOnClose:i=!0}=r;function a(){t&&t(!1),setTimeout(()=>{e.render(null,n),n.parentElement?.removeChild(n)},500)}function C(){t&&t(!0)}function p(){t&&t(!1)}function f(o){s&&s(o)}const g=e.defineComponent({data(){return{open:i,props:r}},created(){t=o=>{this.open=o},s=o=>{this.props={...this.props,...o}}},methods:{async handleClose(){if(this.props?.onClose){const o=this.props?.content?.component?.exposed??void 0;await this.props?.onClose(o)}i?a():p()}},render(){const o=q.omit(this.props,["onClose","extra","footer","visible","onUpdate:visible","afterVisibleChange","onAfterVisibleOChange","open","onUpdate:open","getContainer"]),d=this.props?.content?.component?.exposed??void 0,u=()=>i?a():p(),c=e.createVNode(y.default,{onClose:this.handleClose},null),v=e.createVNode(e.Fragment,null,[c]);return e.createVNode(h.ConfigProvider,h.globalConfigCached.value,{default:()=>[e.createVNode(b.Drawer,e.mergeProps({open:this.open,onClose:this.handleClose,closeIcon:this.props?.closeIcon??null,extra:this.props?.extra?this.props?.extra?.(d,u,{originNode:v,extra:{cancelBtn:c}}):c,footer:this.props?.footer?.(d,u)},o),{default:()=>[this.props?.content]})]})}}),m=r.getContainer||document.body,n=document.createElement("div");m.appendChild(n);const l=e.h(g),x=w.getModalGlobalAppContext();return l.appContext=r.appContext||x||l.appContext,e.render(l,n),{destroy:a,update:f,open:C,close:p}};exports.createDrawer=P;
