import{t as Qe,c as _,e as qe,u as ae}from"./useConfig.7e9a03f4.js";import{h as en,c as d,d as D,f as k,p as nn,bC as tn,aI as p,bB as x,g as an,w as Oe,o as _e,b as we,z as rn,n as on,bx as ln,bn as re,bo as cn,bD as sn,bE as un}from"./arco.446db797.js";import{z as Se,Q as fn,S as vn,T as dn,U as mn,V as gn,J as pn,W as hn,X as yn,Y as bn,Z as Cn,$ as On,a0 as _n,A as Ee,w as oe,K as W,y as K,G as wn}from"./index.25cd9d44.js";import{_ as Pe,a as Sn,b as En,u as Pn}from"./index.80de110f.js";import{B as U}from"./index.79f252de.js";function F(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function le(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,a)}return t}function ie(n){for(var e=1;e(a[Bn(r)]=n.attrs[r],a),{});return en(n.tag,ie(ie({},t),e),(n.children||[]).map(a=>N(a,{})))}var kn="t",jn="zh-CN",Dn={classPrefix:kn,locale:jn};const Fn=Dn;function Nn(){var{classPrefix:n}=Fn;return{SIZE:{default:"",xs:"".concat(n,"-size-xs"),small:"".concat(n,"-size-s"),medium:"".concat(n,"-size-m"),large:"".concat(n,"-size-l"),xl:"".concat(n,"-size-xl"),block:"".concat(n,"-size-full-width")},STATUS:{loading:"".concat(n,"-is-loading"),disabled:"".concat(n,"-is-disabled"),focused:"".concat(n,"-is-focused"),success:"".concat(n,"-is-success"),error:"".concat(n,"-is-error"),warning:"".concat(n,"-is-warning"),selected:"".concat(n,"-is-selected"),active:"".concat(n,"-is-active"),checked:"".concat(n,"-is-checked"),current:"".concat(n,"-is-current"),hidden:"".concat(n,"-is-hidden"),visible:"".concat(n,"-is-visible"),expanded:"".concat(n,"-is-expanded"),indeterminate:"".concat(n,"-is-indeterminate")}}}function A(n){var e=Nn().SIZE,t=d(()=>n.value in e?e[n.value]:""),a=d(()=>n.value===void 0||n.value in e?{}:{fontSize:n.value});return{style:a,className:t}}function ce(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,a)}return t}function se(n){for(var e=1;en.size),{className:r,style:i}=A(a),m=d(()=>["t-icon","t-icon-check-circle-filled",r.value]),u=d(()=>se(se({},i.value),t.style)),f=d(()=>({class:m.value,style:u.value,onClick:c=>{var o;return(o=n.onClick)===null||o===void 0?void 0:o.call(n,{e:c})}}));return()=>N(Ln,f.value)}});const An=xn;function ue(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,a)}return t}function fe(n){for(var e=1;en.size),{className:r,style:i}=A(a),m=d(()=>["t-icon","t-icon-close",r.value]),u=d(()=>fe(fe({},i.value),t.style)),f=d(()=>({class:m.value,style:u.value,onClick:c=>{var o;return(o=n.onClick)===null||o===void 0?void 0:o.call(n,{e:c})}}));return()=>N(Mn,f.value)}});const Tn=In;function ve(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,a)}return t}function de(n){for(var e=1;en.size),{className:r,style:i}=A(a),m=d(()=>["t-icon","t-icon-error-circle-filled",r.value]),u=d(()=>de(de({},i.value),t.style)),f=d(()=>({class:m.value,style:u.value,onClick:c=>{var o;return(o=n.onClick)===null||o===void 0?void 0:o.call(n,{e:c})}}));return()=>N($n,f.value)}});const Wn=zn;function me(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);e&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,a)}return t}function ge(n){for(var e=1;en.size),{className:r,style:i}=A(a),m=d(()=>["t-icon","t-icon-info-circle-filled",r.value]),u=d(()=>ge(ge({},i.value),t.style)),f=d(()=>({class:m.value,style:u.value,onClick:c=>{var o;return(o=n.onClick)===null||o===void 0?void 0:o.call(n,{e:c})}}));return()=>N(Kn,f.value)}});const Hn=Un;/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */function Gn(n){var e=Se("icon"),t=e.globalConfig,a={};return Object.keys(n).forEach(function(r){var i;a[r]=((i=t.value)===null||i===void 0?void 0:i[r])||n[r]}),a}/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */var Xn="t-display-none-element-refresh";function Rn(){var n=k(0);nn(Xn,n),tn(function(){n.value+=1})}/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */function Zn(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}var Vn=Zn;/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */var pe=fn,Yn=gn,Jn=pn,he=pe?pe.isConcatSpreadable:void 0;function Qn(n){return Jn(n)||Yn(n)||!!(he&&n&&n[he])}var qn=Qn,et=mn,nt=qn;function Be(n,e,t,a,r){var i=-1,m=n.length;for(t||(t=nt),r||(r=[]);++i0&&t(u)?e>1?Be(u,e-1,t,a,r):et(r,u):a||(r[r.length]=u)}return r}var tt=Be,at=tt;function rt(n){var e=n==null?0:n.length;return e?at(n,1):[]}var ot=rt,lt=ot,it=vn,ct=dn;function st(n){return ct(it(n,void 0,lt),n+"")}var ut=st;/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */var ft=En,vt=On;function dt(n,e){return e.length<2?n:ft(n,vt(e,0,-1))}var mt=dt,gt=Pe,pt=Vn,ht=mt,yt=Sn;function bt(n,e){return e=gt(e,n),n=ht(n,e),n==null||delete n[yt(pt(e))]}var Ct=bt,Ot=_n;function _t(n){return Ot(n)?void 0:n}var wt=_t,St=hn,Et=Cn,Pt=Ct,Bt=Pe,kt=yn,jt=wt,Dt=ut,Ft=bn,Nt=1,Lt=2,xt=4,At=Dt(function(n,e){var t={};if(n==null)return t;var a=!1;e=St(e,function(i){return i=Bt(i,n),a||(a=i.length>1),i}),kt(n,Ft(n),t),a&&(t=Et(t,Nt|Lt|xt,jt));for(var r=e.length;r--;)Pt(t,e[r]);return t}),Mt=At;/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */function It(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function ye(n,e){for(var t=0;t"u"||!navigator||/(Chrome|Safari)/i.test(navigator.userAgent))return n;var e=document.createElement("div");e.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(e);var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),/Firefox/.test(navigator.userAgent)&&(t-=4),qe()<=11&&(t=12),t}function Kt(){var n=document.createElement("div");n.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(n);var e=n.offsetWidth-n.clientWidth;return document.body.removeChild(n),e}/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */var Ut=1e3,Ht=5e3,Gt=1,Xt=Tt(function n(){var e=this;It(this,n),_(this,"popupStack",{popup:new Set,dialog:new Set,message:new Set}),_(this,"getNextZIndex",function(t){var a=t==="message"?Array.from(e.popupStack.message).pop()||Ht:Array.from(e.popupStack.popup).pop()||Ut;return a+Gt}),_(this,"add",function(t){var a=e.getNextZIndex(t);return e.popupStack[t].add(a),t==="dialog"&&e.popupStack.popup.add(a),a}),_(this,"delete",function(t,a){e.popupStack[a].delete(t),a==="dialog"&&e.popupStack.popup.delete(t)}),_(this,"isLastDialog",function(t){return e.popupStack.dialog.size>1?t===Array.from(e.popupStack.dialog).pop():!0})}),H=new Xt;function Rt(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.visible,a=e.runOnMounted,r=k(0),i=function(){r.value=H.add(n)},m=function(){H.delete(r.value,n)},u=function(){return n==="dialog"?H.isLastDialog(r.value):!1};return Oe(function(){return t==null?void 0:t.value},function(f){f?i():m()},{immediate:!0}),a&&(_e(function(){i()}),we(function(){m()})),{zIndex:rn(r),open:i,close:m,isLastDialog:u}}/** * tdesign v1.9.4 * (c) 2024 tdesign * @license MIT */function Ce(n){return Number.isNaN(Number(n))?n:"".concat(Number(n),"px")}var j,Zt=function(e){j={x:e.clientX,y:e.clientY},setTimeout(function(){j=null},100)};typeof window<"u"&&window.document&&window.document.documentElement&&document.documentElement.addEventListener("click",Zt,!0);function Vt(n){var e=n,t=window.innerWidth||document.documentElement.clientWidth,a=window.innerHeight||document.documentElement.clientHeight;e.addEventListener("mousedown",function(r){var i=r.clientX-e.offsetLeft,m=r.clientY-e.offsetTop,u=e.offsetWidth,f=e.offsetHeight;if(u>t||f>a)return;function c(g){var h=g.clientX-i,y=g.clientY-m;h<0&&(h=0),y<0&&(y=0),t-e.offsetWidth-h<0&&(h=t-e.offsetWidth),a-e.offsetHeight-y<0&&(y=a-e.offsetHeight),e.style.position="absolute",e.style.left="".concat(h,"px"),e.style.top="".concat(y,"px")}function o(){document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",o)}document.addEventListener("mousemove",c),document.addEventListener("mouseup",o),document.addEventListener("dragend",o)})}var Yt=1,ra=D({name:"TDialog",directives:{draggable:function(e,t){e&&t&&t.value&&Vt(e)}},inheritAttrs:!1,props:$t,emits:["update:visible"],setup:function(e,t){var a=this,r=ae("dialog"),i=ae(),m=wn(),u=Ee(),f=k(null),c=Se("dialog"),o=c.globalConfig,g=Gn({CloseIcon:Tn,InfoCircleFilledIcon:Hn,CheckCircleFilledIcon:An,ErrorCircleFilledIcon:Wn}),h=g.CloseIcon,y=g.InfoCircleFilledIcon,O=g.CheckCircleFilledIcon,w=g.ErrorCircleFilledIcon,G=function(l){var s;(s=e.onConfirm)===null||s===void 0||s.call(e,{e:l})},M=function(l){var s;(s=e.onCancel)===null||s===void 0||s.call(e,{e:l}),L({e:l,trigger:"cancel"})},X=zt({confirmBtnAction:G,cancelBtnAction:M}),ke=X.getConfirmBtn,je=X.getCancelBtn,De=Pn(function(){return e.attach});Rn();var R=k(),S=k(),Z=d(function(){return e.mode==="modal"}),P=d(function(){return e.mode==="modeless"}),V=d(function(){return e.mode==="normal"}),C=d(function(){return e.mode==="full-screen"}),Fe=d(function(){return e.visible}),Ne=d(function(){return["".concat(r.value,"__mask"),!e.showOverlay&&"".concat(i.value,"-is-hidden")]}),Le=d(function(){return V.value?[]:C.value?["".concat(r.value,"__position_fullscreen")]:["".concat(r.value,"__position"),!!e.top&&"".concat(r.value,"--top"),"".concat(e.placement&&!e.top?"".concat(r.value,"--").concat(e.placement):"")]}),xe=d(function(){return[!V.value&&"".concat(r.value,"__wrap")]}),Ae=d(function(){if(C.value)return{};var v=e.top,l={};if(v!==void 0){var s=Ce(v);l={paddingTop:s}}return l}),Y=d(function(){var v=["".concat(r.value),"".concat(r.value,"__modal-").concat(e.theme),P.value&&e.draggable&&"".concat(r.value,"--draggable")];return C.value?v.push("".concat(r.value,"__fullscreen")):v.push.apply(v,["".concat(r.value,"--default"),"".concat(r.value,"--").concat(e.placement)]),v}),J=d(function(){return C.value?{}:{width:Ce(e.width)}}),Me=Rt("dialog",{visible:Fe}),Q=Me.isLastDialog;Oe(function(){return e.visible},function(v){if(v){var l;(Z.value&&!e.showInAttachedElement||C.value)&&(e.preventScrollThrough&&document.body.appendChild(S.value),on(function(){j&&f.value&&(f.value.style.transformOrigin="".concat(j.x-f.value.offsetLeft,"px ").concat(j.y-f.value.offsetTop,"px"))})),(l=document.activeElement)===null||l===void 0||l.blur()}else Ie();ee(v)});function q(){var v,l;(v=S.value.parentNode)===null||v===void 0||(l=v.removeChild)===null||l===void 0||l.call(v,S.value)}function Ie(){clearTimeout(R.value),R.value=setTimeout(function(){q()},150)}var ee=function(l){l?(document.addEventListener("keydown",te),e.confirmOnEnter&&document.addEventListener("keydown",ne)):(document.removeEventListener("keydown",te),e.confirmOnEnter&&document.removeEventListener("keydown",ne))},ne=function(l){var s=l.target;if(s.tagName.toLowerCase()!=="input"){var b=l.code;if((b==="Enter"||b==="NumpadEnter")&&Q()){var B;(B=e.onConfirm)===null||B===void 0||B.call(e,{e:l})}}},te=function(l){if(l.code==="Escape"&&Q()){var s,b;(s=e.onEscKeydown)===null||s===void 0||s.call(e,{e:l}),((b=e.closeOnEscKeydown)!==null&&b!==void 0?b:o.value.closeOnEscKeydown)&&L({e:l,trigger:"esc"})}},Te=function(l){var s;if(e.showOverlay&&((s=e.closeOnOverlayClick)!==null&&s!==void 0?s:o.value.closeOnOverlayClick)){var b;(b=e.onOverlayClick)===null||b===void 0||b.call(e,{e:l}),L({e:l,trigger:"overlay"})}},I=Wt(Te),$e=I.onClick,ze=I.onMousedown,We=I.onMouseup,Ke=function(l){var s;(s=e.onCloseBtnClick)===null||s===void 0||s.call(e,{e:l}),L({trigger:"close-btn",e:l})},Ue=function(){var l;(l=e.onOpened)===null||l===void 0||l.call(e)},He=function(){var l;P.value&&e.draggable&&f.value&&(f.value.style.position="relative",f.value.style.left="unset",f.value.style.top="unset"),(l=e.onClosed)===null||l===void 0||l.call(e)},L=function(l){var s;(s=e.onClose)===null||s===void 0||s.call(e,l),t.emit("update:visible",!1)},Ge=function(l){var s,b=(s=a._events)===null||s===void 0?void 0:s[l];return!!(b!=null&&b.length)},Xe=function(){var l={info:p(y,{class:"".concat(i.value,"-is-info")},null),warning:p(w,{class:"".concat(i.value,"-is-warning")},null),danger:p(w,{class:"".concat(i.value,"-is-error")},null),success:p(O,{class:"".concat(i.value,"-is-success")},null)};return l[e.theme]},Re=function(){var l=p("h5",{class:"title"},null),s=p(h,null,null),b=m("default","body"),B=p("div",null,[je({cancelBtn:e.cancelBtn,globalCancel:o.value.cancel,className:"".concat(r.value,"__cancel")}),ke({theme:e.theme,confirmBtn:e.confirmBtn,globalConfirm:o.value.confirm,globalConfirmBtnTheme:o.value.confirmBtnTheme,className:"".concat(r.value,"__confirm"),confirmLoading:e.confirmLoading})]),Ze=C.value?["".concat(r.value,"__header"),"".concat(r.value,"__header--fullscreen")]:"".concat(r.value,"__header"),Ve=C.value?["".concat(r.value,"__close"),"".concat(r.value,"__close--fullscreen")]:"".concat(r.value,"__close"),T=e.theme==="default"?["".concat(r.value,"__body")]:["".concat(r.value,"__body__icon")],$=u("footer",B);C.value&&$?T.push("".concat(r.value,"__body--fullscreen")):C.value&&T.push("".concat(r.value,"__body--fullscreen--without-footer"));var Ye=C.value?["".concat(r.value,"__footer"),"".concat(r.value,"__footer--fullscreen")]:"".concat(r.value,"__footer"),z=function(Je){P.value&&e.draggable&&Je.stopPropagation()};return p("div",{class:xe.value},[p("div",{class:Le.value,style:Ae.value,onClick:$e,onMousedown:ze,onMouseup:We},[re(p("div",{key:"dialog",class:Y.value,style:J.value,ref:f},[p("div",{class:Ze,onMousedown:z},[p("div",{class:"".concat(r.value,"__header-content")},[Xe(),u("header",l)]),e.closeBtn?p("span",{class:Ve,onClick:Ke},[u("closeBtn",s)]):null]),p("div",{class:T,onMousedown:z},[b]),$&&p("div",{class:Ye,onMousedown:z},[$])]),[[un("draggable"),P.value&&e.draggable]])])])};return _e(function(){var v=document.documentElement.scrollHeight>document.documentElement.clientHeight,l=v?Kt():0;S.value=document.createElement("style"),S.value.dataset.id="td_dialog_".concat(+new Date,"_").concat(Yt+=1),S.value.innerHTML=` html body { overflow-y: hidden; width: calc(100% - `.concat(l,`px); } `)}),we(function(){ee(!1),q()}),{COMPONENT_NAME:r,isModal:Z,isModeLess:P,isFullScreen:C,maskClass:Ne,dialogClass:Y,dialogStyle:J,dialogEle:f,afterEnter:Ue,afterLeave:He,hasEventOn:Ge,renderDialog:Re,teleportElement:De}},render:function(){var e=this,t=this.COMPONENT_NAME,a=(this.isModal||this.isFullScreen)&&p("div",{key:"mask",class:this.maskClass},null),r=this.renderDialog(),i=[a,r],m={zIndex:this.zIndex},u=["".concat(t,"__ctx"),_(_(_({},"".concat(t,"__ctx--fixed"),this.isModal||this.isFullScreen),"".concat(t,"__ctx--absolute"),this.isModal&&this.showInAttachedElement),"".concat(t,"__ctx--modeless"),this.isModeLess)];return p(sn,{disabled:!this.attach||!this.teleportElement,to:this.teleportElement},{default:function(){return[p(ln,{duration:300,name:"".concat(t,"-zoom__vue"),onAfterEnter:e.afterEnter,onAfterLeave:e.afterLeave},{default:function(){return[(!e.destroyOnClose||e.visible)&&re(p("div",x({class:u,style:m},e.$attrs),[i]),[[cn,e.visible]])]}})]}})}});export{An as C,Wn as E,F as _,Gn as a,ra as b,tt as c,Tt as d,It as e,ut as f,aa as g,Tn as h,Rt as i,zt as j,Kt as k,Vn as l,Mt as o,N as r,A as u};