@a2simcode/dui 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dui.umd.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(ze,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(ze=typeof globalThis<"u"?globalThis:ze||self,a(ze.DuiUI={},ze.Vue))})(this,(function(ze,a){"use strict";const Gt=(t,e)=>(t.install=n=>{n.component(t.name,t),e&&e.forEach(o=>{n.component(o.name,o)})},t),jt=(t="")=>{const e=Date.now(),n=Math.floor(Math.random()*1e9);return t===""?String(n)+String(e):t+"_"+n+String(e)},mi=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(mi);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=mi(t[n]));return e},wc=t=>{if(Array.isArray(t))t.length=0;else if(t&&typeof t=="object")for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&delete t[e]},yi={},_c=(t,e,n)=>{n[t]=n[t]||{};const o=jt();return n[t][o]=e,o},xc=(t,e,n)=>{const o=[],i=n[t]||{};return Object.keys(i).forEach(r=>{const s=i[r];try{s&&o.push(s(e))}catch(l){console.error(l)}}),o},Ec=(t,e,n)=>{if(e){const o=n[t];o&&delete o[e]}else delete n[t]},Lr=(t,e)=>_c(t,e,yi),Se=(t,e)=>xc(t,e,yi),Cc=(t,e)=>{Ec(t,e,yi)},Vr=(t,e,n,o,i,r)=>{const s=e.id,l=e.level,{getDesignLocals:u,selectComponent:c,getComponent:d,isMyChildComponent:f,addComponent:h,deleteComponent:p,getParentComponents:y,removeComponentFromContainer:m,addComponentToContainer:v,copyComponent:N,activedComponent:_,top:g}=a.inject("d-drag-design-provide",{}),x=[],z=a.ref(!1),$=a.ref(!1),F=a.ref(!1),X=a.ref(!1),Y=a.ref(!1),S={id:"",type:""},I=a.ref(!1),C=a.ref(!1);let H="",w=null;const k=q=>{if(H===q)return w;H=q;const{top:ee,left:re,width:oe,height:ce}=t.value.getBoundingClientRect();return w=[{x:re,y:ee},{x:re+oe,y:ee},{x:re+oe,y:ee+ce},{x:re,y:ee+ce}],w},b=(q,ee,re)=>{let oe=ee-re[0].y;oe<0&&(oe=-oe);let ce=ee-re[3].y;ce<0&&(ce=-ce);let ie=q-re[0].x;ie<0&&(ie=-ie);let ae=q-re[1].x;return ae<0&&(ae=-ae),{ly:oe>ce?ce:oe,typey:oe>ce?"bottom":"top",lx:ie>ae?ae:ie,lallx:ie+ae}},E=(q,ee,re)=>q>=re[0].x&&q<=re[1].x&&ee>=re[0].y&&ee<=re[3].y,T=()=>{if(i){Se("dragClick",{id:s});return}if(!$.value){if(c(s),l!==0){const q=t.value.getBoundingClientRect(),ee=u();q.top-ee.top<22?X.value=!0:X.value=!1}$.value=!0,Se("dragClick",{id:s})}},O=q=>{const ee=p(q);ee&&a.nextTick(()=>{Se("dragClick",{id:ee})})},R=()=>{S.id="",S.type="",l===0&&(Y.value=!1)},B=()=>{Se("mouseEnterOrLeave",{id:s,type:"enter"})},P=()=>{Se("mouseEnterOrLeave",{id:s,type:"leave"})},V=q=>{Se("dragClick",{id:q})},W={mouseEnterOrLeave:({id:q,type:ee})=>{ee==="enter"?x.push(q):x.length>0&&x.splice(x.length-1,1);const re=x.length;re>0&&s===x[re-1]?z.value=!0:z.value=!1},dragAciveChild:({type:q,id:ee})=>{ee===s?q==="top"?(I.value=!0,C.value=!1):(C.value=!0,I.value=!1):(C.value=!1,I.value=!1)},dragClick({id:q,isAgain:ee}){console.log("dragClick",q,s),q!==s?$.value=!1:(ee&&($.value=!1),T())}};W[`dragGetChildDistance_${s}`]=({dragX:q,dragY:ee,moveId:re})=>{const oe=k(re);return b(q,ee,oe)};const Z={isInContainer({x:q,y:ee,id:re,moveId:oe}){if(s===re||f(re,s))return F.value=!1,{isIn:!1,level:l,id:s,groupId:r};const ce=k(oe);if(E(q,ee,ce))return l===0&&(Y.value=!0),{isIn:!0,level:l,id:s,groupId:r};if(l===0){const{ly:ie,lx:ae}=b(q,ee,ce);if(ie<20&&ae<20)return Y.value=!0,{isIn:!0,level:l,id:s,groupId:r};Y.value=!1}return F.value=!1,{isIn:!1,level:l,id:s,groupId:r}},dragActiveContainer:({containerId:q,containerGroupId:ee,dragX:re,dragY:oe,moveId:ce})=>{if(q===s&&ee===r)if(F.value=!0,o&&o.value.length>0){let ie={ly:9999999,lx:0,lallx:0,id:"",typey:""};o?.value.forEach(ae=>{if(r&&ae.groupId!==r)return;const A=Se(`dragGetChildDistance_${ae.id}`,{dragX:re,dragY:oe,moveId:ce})[0];A&&(ie.ly>A.ly||ie.ly===A.ly&&(ie.lx>A.lx||ie.lx===A.lx&&ie.lallx>A.lallx))&&(ie=A,ie.id=ae.id)}),S.id=ie.id,S.type=ie.typey,Se("dragAciveChild",{id:ie.id,type:ie.typey})}else Se("dragAciveChild",{id:""});else F.value=!1},dragAdd:q=>{if(F.value){let ee=o?.value.length||0;S.id!==""&&S.id!==void 0&&(ee=o?.value.findIndex(re=>re.id===S.id)||0,S.type==="bottom"&&(ee+=1)),h(q,s,ee,r),F.value=!1}R()},dragAddByClick:q=>{if(!_.value&&s===g.id||_.value?.id===s||_.value?.containerId===s&&_.value?.dragType!=="container"){const ee=o?.value.length||0,re=h(q,s,ee,r,!0);re&&q.config&&Object.keys(q.config).forEach(oe=>{re.config[oe]=q.config[oe]})}},dragUpdate(q){if(F.value){const ee=d(q);if(ee.level=l+1,S.id!==ee.id){m(ee.containerId,q);let re=o?.value.findIndex(oe=>oe.id===S.id)||0;S.type==="bottom"&&(re+=1),v(ee,s,re,r)}F.value=!1,a.nextTick(()=>{Se("dragClick",{id:ee.id,isAgain:!0})})}R()}},Q={};return a.onMounted(()=>{(!i||n!=="container")&&Object.keys(W).forEach(q=>{Q[q]=Lr(q,W[q])}),n==="container"&&Object.keys(Z).forEach(q=>{Q[q]=Lr(q,Z[q])}),e.isNewAdd&&a.nextTick(()=>{T(),delete e.isNewAdd})}),a.onUnmounted(()=>{Object.keys(Q).forEach(q=>{Cc(q,Q[q])})}),{onMouseenter:B,onMouseleave:P,activeComponent:T,handleComponentClick:V,deleteComponentByClick:O,copyComponent:N,getParentComponents:y,isBottomToolBar:X,isHover:z,isSelect:$,isToContainer:F,isMoveingInTopLevel:Y,isTopActive:I,isBottomActive:C}},Fr=(t,e)=>{const n={x:0,y:0,clientX:0,clientY:0,dragElement:null,dragElementId:"jcode-darg-move-id",toContainerLevel:-1,toContainerId:"",groupId:"",id:""};let o=!1;const i=(p,y)=>{o!==!0&&(o=!0,setTimeout(()=>{p(),o=!1},y))},r=a.ref(!1),s=(p,y,m)=>{const v=document.createElement("div");return v.id=n.dragElementId,v.innerText=p,v.className="d-drag-move",v.style.top=`${y}px`,v.style.left=`${m}px`,document.body.appendChild(v),v},l=()=>{document.onmousemove=null,document.onmouseup=null,r.value=!1,Se("dragAciveChild",{id:""})},u=()=>{l(),n.dragElement&&(n.dragElement.remove(),n.dragElement=null,e?Se("dragAdd",t):Se("dragUpdate",t.id))},c=p=>{const{clientY:y,clientX:m}=p;if(!n.dragElement){const v=Math.abs(n.x-m),N=Math.abs(n.y-y);if(v<=1&&N<=1)return;r.value=!0,n.dragElement=s(t.name,y-11,m-32)}n.dragElement.style.top=`${y-11}px`,n.dragElement.style.left=`${m-32}px`,n.clientX=m,n.clientY=y,i(()=>{if(!r.value)return;const v=Se("isInContainer",{x:m,y,id:t.id,moveId:n.id});n.toContainerLevel=-1,n.toContainerId="",n.groupId="",v.forEach(({level:N,id:_,isIn:g,groupId:x})=>{g&&n.toContainerLevel<N&&(n.toContainerLevel=N,n.toContainerId=_,n.groupId=x)}),n.toContainerId!==""?Se("dragActiveContainer",{containerId:n.toContainerId,containerGroupId:n.groupId,dragX:m,dragY:y,moveId:n.id}):Se("dragAciveChild",{id:""})},100)};return{onContextmenu:()=>{l()},onMousedown:p=>{n.x=p.clientX,n.y=p.clientY,n.id=jt(),document.onmouseup=u,document.onmousemove=c},onClick:()=>{Se("dragAddByClick",t)},moveActive:r}},Sc=t=>(t.install=e=>{e.component(t.name,t)},t),Xn=t=>!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&Object.keys(t).length===0),Wr=/^[a-z0-9]+(-[a-z0-9]+)*$/,qn=(t,e,n,o="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;o=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const l=i.pop(),u=i.pop(),c={provider:i.length>0?i[0]:o,prefix:u,name:l};return e&&!Kn(c)?null:c}const r=i[0],s=r.split("-");if(s.length>1){const l={provider:o,prefix:s.shift(),name:s.join("-")};return e&&!Kn(l)?null:l}if(n&&o===""){const l={provider:o,prefix:"",name:r};return e&&!Kn(l,n)?null:l}return null},Kn=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1,Gr=Object.freeze({left:0,top:0,width:16,height:16}),Zn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),un=Object.freeze({...Gr,...Zn}),vi=Object.freeze({...un,body:"",hidden:!1});function Nc(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const o=((t.rotate||0)+(e.rotate||0))%4;return o&&(n.rotate=o),n}function jr(t,e){const n=Nc(t,e);for(const o in vi)o in Zn?o in t&&!(o in n)&&(n[o]=Zn[o]):o in e?n[o]=e[o]:o in t&&(n[o]=t[o]);return n}function kc(t,e){const n=t.icons,o=t.aliases||Object.create(null),i=Object.create(null);function r(s){if(n[s])return i[s]=[];if(!(s in i)){i[s]=null;const l=o[s]&&o[s].parent,u=l&&r(l);u&&(i[s]=[l].concat(u))}return i[s]}return Object.keys(n).concat(Object.keys(o)).forEach(r),i}function Dc(t,e,n){const o=t.icons,i=t.aliases||Object.create(null);let r={};function s(l){r=jr(o[l]||i[l],r)}return s(e),n.forEach(s),jr(t,r)}function Yr(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(i=>{e(i,null),n.push(i)});const o=kc(t);for(const i in o){const r=o[i];r&&(e(i,Dc(t,i,r)),n.push(i))}return n}const Tc={provider:"",aliases:{},not_found:{},...Gr};function bi(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function Ur(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!bi(t,Tc))return null;const n=e.icons;for(const i in n){const r=n[i];if(!i||typeof r.body!="string"||!bi(r,vi))return null}const o=e.aliases||Object.create(null);for(const i in o){const r=o[i],s=r.parent;if(!i||typeof s!="string"||!n[s]&&!o[s]||!bi(r,vi))return null}return e}const Xr=Object.create(null);function Mc(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function Yt(t,e){const n=Xr[t]||(Xr[t]=Object.create(null));return n[e]||(n[e]=Mc(t,e))}function qr(t,e){return Ur(e)?Yr(e,(n,o)=>{o?t.icons[n]=o:t.missing.add(n)}):[]}function Ic(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}let fn=!1;function Kr(t){return typeof t=="boolean"&&(fn=t),fn}function Zr(t){const e=typeof t=="string"?qn(t,!0,fn):t;if(e){const n=Yt(e.provider,e.prefix),o=e.name;return n.icons[o]||(n.missing.has(o)?null:void 0)}}function Bc(t,e){const n=qn(t,!0,fn);if(!n)return!1;const o=Yt(n.provider,n.prefix);return e?Ic(o,n.name,e):(o.missing.add(n.name),!0)}function $c(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),fn&&!e&&!t.prefix){let i=!1;return Ur(t)&&(t.prefix="",Yr(t,(r,s)=>{Bc(r,s)&&(i=!0)})),i}const n=t.prefix;if(!Kn({prefix:n,name:"a"}))return!1;const o=Yt(e,n);return!!qr(o,t)}function Jr(t){const e=Zr(t);return e&&{...un,...e}}const Qr=Object.freeze({width:null,height:null}),es=Object.freeze({...Qr,...Zn}),zc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ac=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ts(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const o=t.split(zc);if(o===null||!o.length)return t;const i=[];let r=o.shift(),s=Ac.test(r);for(;;){if(s){const l=parseFloat(r);isNaN(l)?i.push(r):i.push(Math.ceil(l*e*n)/n)}else i.push(r);if(r=o.shift(),r===void 0)return i.join("");s=!s}}function Pc(t,e="defs"){let n="";const o=t.indexOf("<"+e);for(;o>=0;){const i=t.indexOf(">",o),r=t.indexOf("</"+e);if(i===-1||r===-1)break;const s=t.indexOf(">",r);if(s===-1)break;n+=t.slice(i+1,r).trim(),t=t.slice(0,o).trim()+t.slice(s+1)}return{defs:n,content:t}}function Oc(t,e){return t?"<defs>"+t+"</defs>"+e:e}function Rc(t,e,n){const o=Pc(t);return Oc(o.defs,e+o.content+n)}const Hc=t=>t==="unset"||t==="undefined"||t==="none";function Lc(t,e){const n={...un,...t},o={...es,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let r=n.body;[n,o].forEach(m=>{const v=[],N=m.hFlip,_=m.vFlip;let g=m.rotate;N?_?g+=2:(v.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),v.push("scale(-1 1)"),i.top=i.left=0):_&&(v.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),v.push("scale(1 -1)"),i.top=i.left=0);let x;switch(g<0&&(g-=Math.floor(g/4)*4),g=g%4,g){case 1:x=i.height/2+i.top,v.unshift("rotate(90 "+x.toString()+" "+x.toString()+")");break;case 2:v.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:x=i.width/2+i.left,v.unshift("rotate(-90 "+x.toString()+" "+x.toString()+")");break}g%2===1&&(i.left!==i.top&&(x=i.left,i.left=i.top,i.top=x),i.width!==i.height&&(x=i.width,i.width=i.height,i.height=x)),v.length&&(r=Rc(r,'<g transform="'+v.join(" ")+'">',"</g>"))});const s=o.width,l=o.height,u=i.width,c=i.height;let d,f;s===null?(f=l===null?"1em":l==="auto"?c:l,d=ts(f,u/c)):(d=s==="auto"?u:s,f=l===null?ts(d,c/u):l==="auto"?c:l);const h={},p=(m,v)=>{Hc(v)||(h[m]=v.toString())};p("width",d),p("height",f);const y=[i.left,i.top,u,c];return h.viewBox=y.join(" "),{attributes:h,viewBox:y,body:r}}const Vc=/\sid="(\S+)"/g,Fc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Wc=0;function Gc(t,e=Fc){const n=[];let o;for(;o=Vc.exec(t);)n.push(o[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(r=>{const s=typeof e=="function"?e(r):e+(Wc++).toString(),l=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+s+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}const wi=Object.create(null);function jc(t,e){wi[t]=e}function _i(t){return wi[t]||wi[""]}function xi(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const Ei=Object.create(null),hn=["https://api.simplesvg.com","https://api.unisvg.com"],Jn=[];for(;hn.length>0;)hn.length===1||Math.random()>.5?Jn.push(hn.shift()):Jn.push(hn.pop());Ei[""]=xi({resources:["https://api.iconify.design"].concat(Jn)});function Yc(t,e){const n=xi(e);return n===null?!1:(Ei[t]=n,!0)}function Ci(t){return Ei[t]}let ns=(()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}})();function Uc(t,e){const n=Ci(t);if(!n)return 0;let o;if(!n.maxURL)o=0;else{let i=0;n.resources.forEach(s=>{i=Math.max(i,s.length)});const r=e+".json?icons=";o=n.maxURL-i-n.path.length-r.length}return o}function Xc(t){return t===404}const qc=(t,e,n)=>{const o=[],i=Uc(t,e),r="icons";let s={type:r,provider:t,prefix:e,icons:[]},l=0;return n.forEach((u,c)=>{l+=u.length+1,l>=i&&c>0&&(o.push(s),s={type:r,provider:t,prefix:e,icons:[]},l=u.length),s.icons.push(u)}),o.push(s),o};function Kc(t){if(typeof t=="string"){const e=Ci(t);if(e)return e.path}return"/"}const Zc={prepare:qc,send:(t,e,n)=>{if(!ns){n("abort",424);return}let o=Kc(e.provider);switch(e.type){case"icons":{const r=e.prefix,l=e.icons.join(","),u=new URLSearchParams({icons:l});o+=r+".json?"+u.toString();break}case"custom":{const r=e.uri;o+=r.slice(0,1)==="/"?r.slice(1):r;break}default:n("abort",400);return}let i=503;ns(t+o).then(r=>{const s=r.status;if(s!==200){setTimeout(()=>{n(Xc(s)?"abort":"next",s)});return}return i=501,r.json()}).then(r=>{if(typeof r!="object"||r===null){setTimeout(()=>{r===404?n("abort",r):n("next",i)});return}setTimeout(()=>{n("success",r)})}).catch(()=>{n("next",i)})}};function Jc(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((i,r)=>i.provider!==r.provider?i.provider.localeCompare(r.provider):i.prefix!==r.prefix?i.prefix.localeCompare(r.prefix):i.name.localeCompare(r.name));let o={provider:"",prefix:"",name:""};return t.forEach(i=>{if(o.name===i.name&&o.prefix===i.prefix&&o.provider===i.provider)return;o=i;const r=i.provider,s=i.prefix,l=i.name,u=n[r]||(n[r]=Object.create(null)),c=u[s]||(u[s]=Yt(r,s));let d;l in c.icons?d=e.loaded:s===""||c.missing.has(l)?d=e.missing:d=e.pending;const f={provider:r,prefix:s,name:l};d.push(f)}),e}function os(t,e){t.forEach(n=>{const o=n.loaderCallbacks;o&&(n.loaderCallbacks=o.filter(i=>i.id!==e))})}function Qc(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const o=t.provider,i=t.prefix;e.forEach(r=>{const s=r.icons,l=s.pending.length;s.pending=s.pending.filter(u=>{if(u.prefix!==i)return!0;const c=u.name;if(t.icons[c])s.loaded.push({provider:o,prefix:i,name:c});else if(t.missing.has(c))s.missing.push({provider:o,prefix:i,name:c});else return n=!0,!0;return!1}),s.pending.length!==l&&(n||os([t],r.id),r.callback(s.loaded.slice(0),s.missing.slice(0),s.pending.slice(0),r.abort))})}))}let ed=0;function td(t,e,n){const o=ed++,i=os.bind(null,n,o);if(!e.pending.length)return i;const r={id:o,icons:e,callback:t,abort:i};return n.forEach(s=>{(s.loaderCallbacks||(s.loaderCallbacks=[])).push(r)}),i}function nd(t,e=!0,n=!1){const o=[];return t.forEach(i=>{const r=typeof i=="string"?qn(i,e,n):i;r&&o.push(r)}),o}var od={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function id(t,e,n,o){const i=t.resources.length,r=t.random?Math.floor(Math.random()*i):t.index;let s;if(t.random){let $=t.resources.slice(0);for(s=[];$.length>1;){const F=Math.floor(Math.random()*$.length);s.push($[F]),$=$.slice(0,F).concat($.slice(F+1))}s=s.concat($)}else s=t.resources.slice(r).concat(t.resources.slice(0,r));const l=Date.now();let u="pending",c=0,d,f=null,h=[],p=[];typeof o=="function"&&p.push(o);function y(){f&&(clearTimeout(f),f=null)}function m(){u==="pending"&&(u="aborted"),y(),h.forEach($=>{$.status==="pending"&&($.status="aborted")}),h=[]}function v($,F){F&&(p=[]),typeof $=="function"&&p.push($)}function N(){return{startTime:l,payload:e,status:u,queriesSent:c,queriesPending:h.length,subscribe:v,abort:m}}function _(){u="failed",p.forEach($=>{$(void 0,d)})}function g(){h.forEach($=>{$.status==="pending"&&($.status="aborted")}),h=[]}function x($,F,X){const Y=F!=="success";switch(h=h.filter(S=>S!==$),u){case"pending":break;case"failed":if(Y||!t.dataAfterTimeout)return;break;default:return}if(F==="abort"){d=X,_();return}if(Y){d=X,h.length||(s.length?z():_());return}if(y(),g(),!t.random){const S=t.resources.indexOf($.resource);S!==-1&&S!==t.index&&(t.index=S)}u="completed",p.forEach(S=>{S(X)})}function z(){if(u!=="pending")return;y();const $=s.shift();if($===void 0){if(h.length){f=setTimeout(()=>{y(),u==="pending"&&(g(),_())},t.timeout);return}_();return}const F={status:"pending",resource:$,callback:(X,Y)=>{x(F,X,Y)}};h.push(F),c++,f=setTimeout(z,t.rotate),n($,e,F.callback)}return setTimeout(z),N}function is(t){const e={...od,...t};let n=[];function o(){n=n.filter(l=>l().status==="pending")}function i(l,u,c){const d=id(e,l,u,(f,h)=>{o(),c&&c(f,h)});return n.push(d),d}function r(l){return n.find(u=>l(u))||null}return{query:i,find:r,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:o}}function rs(){}const Si=Object.create(null);function rd(t){if(!Si[t]){const e=Ci(t);if(!e)return;const n=is(e),o={config:e,redundancy:n};Si[t]=o}return Si[t]}function sd(t,e,n){let o,i;if(typeof t=="string"){const r=_i(t);if(!r)return n(void 0,424),rs;i=r.send;const s=rd(t);s&&(o=s.redundancy)}else{const r=xi(t);if(r){o=is(r);const s=t.resources?t.resources[0]:"",l=_i(s);l&&(i=l.send)}}return!o||!i?(n(void 0,424),rs):o.query(e,i,n)().abort}function ss(){}function ad(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,Qc(t)}))}function ld(t){const e=[],n=[];return t.forEach(o=>{(o.match(Wr)?e:n).push(o)}),{valid:e,invalid:n}}function pn(t,e,n){function o(){const i=t.pendingIcons;e.forEach(r=>{i&&i.delete(r),t.icons[r]||t.missing.add(r)})}if(n&&typeof n=="object")try{if(!qr(t,n).length){o();return}}catch(i){console.error(i)}o(),ad(t)}function as(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function cd(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:o}=t,i=t.iconsToLoad;if(delete t.iconsToLoad,!i||!i.length)return;const r=t.loadIcon;if(t.loadIcons&&(i.length>1||!r)){as(t.loadIcons(i,o,n),d=>{pn(t,i,d)});return}if(r){i.forEach(d=>{const f=r(d,o,n);as(f,h=>{const p=h?{prefix:o,icons:{[d]:h}}:null;pn(t,[d],p)})});return}const{valid:s,invalid:l}=ld(i);if(l.length&&pn(t,l,null),!s.length)return;const u=o.match(Wr)?_i(n):null;if(!u){pn(t,s,null);return}u.prepare(n,o,s).forEach(d=>{sd(n,d,f=>{pn(t,d.icons,f)})})}))}const dd=(t,e)=>{const n=nd(t,!0,Kr()),o=Jc(n);if(!o.pending.length){let u=!0;return e&&setTimeout(()=>{u&&e(o.loaded,o.missing,o.pending,ss)}),()=>{u=!1}}const i=Object.create(null),r=[];let s,l;return o.pending.forEach(u=>{const{provider:c,prefix:d}=u;if(d===l&&c===s)return;s=c,l=d,r.push(Yt(c,d));const f=i[c]||(i[c]=Object.create(null));f[d]||(f[d]=[])}),o.pending.forEach(u=>{const{provider:c,prefix:d,name:f}=u,h=Yt(c,d),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),i[c][d].push(f))}),r.forEach(u=>{const c=i[u.provider][u.prefix];c.length&&cd(u,c)}),e?td(e,o,r):ss};function ud(t,e){const n={...t};for(const o in e){const i=e[o],r=typeof i;o in Qr?(i===null||i&&(r==="string"||r==="number"))&&(n[o]=i):r===typeof n[o]&&(n[o]=o==="rotate"?i%4:i)}return n}const fd=/[\s,]+/;function hd(t,e){e.split(fd).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function pd(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function o(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:o(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let r=parseFloat(t.slice(0,t.length-n.length));return isNaN(r)?0:(r=r/i,r%1===0?o(r):0)}}return e}function gd(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const o in e)n+=" "+o+'="'+e[o]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function md(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function yd(t){return"data:image/svg+xml,"+md(t)}function vd(t){return'url("'+yd(t)+'")'}const ls={...es,inline:!1},bd={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},wd={display:"inline-block"},Ni={backgroundColor:"currentColor"},cs={backgroundColor:"transparent"},ds={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},us={webkitMask:Ni,mask:Ni,background:cs};for(const t in us){const e=us[t];for(const n in ds)e[t+n]=ds[n]}const Qn={};["horizontal","vertical"].forEach(t=>{const e=t.slice(0,1)+"Flip";Qn[t+"-flip"]=e,Qn[t.slice(0,1)+"-flip"]=e,Qn[t+"Flip"]=e});function fs(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const hs=(t,e)=>{const n=ud(ls,e),o={...bd},i=e.mode||"svg",r={},s=e.style,l=typeof s=="object"&&!(s instanceof Array)?s:{};for(let m in e){const v=e[m];if(v!==void 0)switch(m){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":n[m]=v===!0||v==="true"||v===1;break;case"flip":typeof v=="string"&&hd(n,v);break;case"color":r.color=v;break;case"rotate":typeof v=="string"?n[m]=pd(v):typeof v=="number"&&(n[m]=v);break;case"ariaHidden":case"aria-hidden":v!==!0&&v!=="true"&&delete o["aria-hidden"];break;default:{const N=Qn[m];N?(v===!0||v==="true"||v===1)&&(n[N]=!0):ls[m]===void 0&&(o[m]=v)}}}const u=Lc(t,n),c=u.attributes;if(n.inline&&(r.verticalAlign="-0.125em"),i==="svg"){o.style={...r,...l},Object.assign(o,c);let m=0,v=e.id;return typeof v=="string"&&(v=v.replace(/-/g,"_")),o.innerHTML=Gc(u.body,v?()=>v+"ID"+m++:"iconifyVue"),a.h("svg",o)}const{body:d,width:f,height:h}=t,p=i==="mask"||(i==="bg"?!1:d.indexOf("currentColor")!==-1),y=gd(d,{...c,width:f+"",height:h+""});return o.style={...r,"--svg":vd(y),width:fs(c.width),height:fs(c.height),...wd,...p?Ni:cs,...l},a.h("span",o)};if(Kr(!0),jc("",Zc),typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(o=>{try{(typeof o!="object"||o===null||o instanceof Array||typeof o.icons!="object"||typeof o.prefix!="string"||!$c(o))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const o="IconifyProviders["+n+"] is invalid.";try{const i=e[n];if(typeof i!="object"||!i||i.resources===void 0)continue;Yc(n,i)||console.error(o)}catch{console.error(o)}}}}const _d={...un,body:""},ps=a.defineComponent((t,{emit:e})=>{const n=a.ref(null);function o(){n.value&&(n.value.abort?.(),n.value=null)}const i=a.ref(!!t.ssr),r=a.ref(""),s=a.shallowRef(null);function l(){const c=t.icon;if(typeof c=="object"&&c!==null&&typeof c.body=="string")return r.value="",{data:c};let d;if(typeof c!="string"||(d=qn(c,!1,!0))===null)return null;let f=Zr(d);if(!f){const y=n.value;return(!y||y.name!==c)&&(f===null?n.value={name:c}:n.value={name:c,abort:dd([d],u)}),null}o(),r.value!==c&&(r.value=c,a.nextTick(()=>{e("load",c)}));const h=t.customise;if(h){f=Object.assign({},f);const y=h(f.body,d.name,d.prefix,d.provider);typeof y=="string"&&(f.body=y)}const p=["iconify"];return d.prefix!==""&&p.push("iconify--"+d.prefix),d.provider!==""&&p.push("iconify--"+d.provider),{data:f,classes:p}}function u(){const c=l();c?c.data!==s.value?.data&&(s.value=c):s.value=null}return i.value?u():a.onMounted(()=>{i.value=!0,u()}),a.watch(()=>t.icon,u),a.onUnmounted(o),()=>{const c=s.value;if(!c)return hs(_d,t);let d=t;return c.classes&&(d={...t,class:c.classes.join(" ")}),hs({...un,...c.data},d)}},{props:["icon","mode","ssr","width","height","style","color","inline","rotate","hFlip","horizontalFlip","vFlip","verticalFlip","flip","id","ariaHidden","customise","title"],emits:["load"]}),gn=a.defineComponent({name:"JIcon",inheritAttrs:!1,__name:"icon",props:{icon:{},size:{default:16},color:{default:void 0},rotate:{default:void 0},isDiv:{type:Boolean,default:!0}},setup(t){const e=t,n=a.computed(()=>{const i=e.icon;if(i.indexOf(":")===-1)return Jr(`jcode:${e.icon}`)==null,`jcode:${e.icon}`;const s=`jcode:${i.split(":")[1]}`;return Jr(s)!=null?s:i}),o=a.computed(()=>({size:e.size,color:e.color,icon:n.value}));return(i,r)=>t.isDiv?(a.openBlock(),a.createElementBlock("div",a.mergeProps({key:0},i.$attrs,{class:"j-icon jicon",style:{height:`${t.size}px`}}),[a.createVNode(a.unref(ps),a.mergeProps(o.value,{height:`${t.size}px`,width:`${t.size}px`,mode:"svg",style:`transform:rotate(${t.rotate||0}deg)`}),null,16,["height","width","style"])],16)):(a.openBlock(),a.createElementBlock("span",a.mergeProps({key:1},i.$attrs,{class:"jicon"}),[a.createVNode(a.unref(ps),a.mergeProps(o.value,{height:`${t.size}px`,width:`${t.size}px`,mode:"svg",style:`transform:rotate(${t.rotate||0}deg)`}),null,16,["height","width","style"])],16))}}),xd=["disabled"],Ed={key:2},Ut=Sc(a.defineComponent({name:"JButton",__name:"button",props:{type:{default:"default"},size:{default:"default"},shape:{default:"default"},ghost:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},danger:{type:Boolean,default:!1},block:{type:Boolean,default:!1},loading:{type:[Boolean,Object],default:!1},icon:{default:""},href:{default:""},target:{default:"_self"},label:{default:""},notLabel:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},lastCompactItem:{type:Boolean,default:!1},firstCompactItem:{type:Boolean,default:!1}},emits:["click"],setup(t,{expose:e,emit:n}){const o=t,i=n,r=h=>{!d.value&&!o.disabled&&(i("click",h),o.href&&window.open(o.href,o.target?o.target:"_self"))},s=a.shallowRef(null),l=()=>{s.value?.focus()},u=()=>{s.value?.blur()},c=a.computed(()=>o.notLabel||!o.label),d=a.ref(!1);a.watch(()=>o.loading,h=>{if(typeof h=="boolean")d.value=h;else if(Xn(h?.delay))d.value=!1;else{const p=setTimeout(()=>{d.value=!0},h.delay);return()=>clearTimeout(p)}},{immediate:!0});const f=a.computed(()=>o.label||"");return e({focus:l,blur:u}),(h,p)=>(a.openBlock(),a.createElementBlock("button",{ref_key:"buttonNodeRef",ref:s,type:"button",class:a.normalizeClass(["j-button",{"j-button-primary":t.type=="primary","j-button-default":t.type=="default","j-button-dashed":t.type=="dashed","j-button-link":t.type=="link","j-button-text":t.type=="text","j-button-ghost":t.ghost==!0,"j-button-danger":t.danger==!0,"j-button-lg":t.size=="large","j-button-sm":t.size=="small","j-button-circle":t.shape=="circle","j-button-round":t.shape=="round","j-button-block":t.block==!0,"j-button-loading":d.value==!0,"j-button-icon-only":c.value==!0,"j-button-compact":t.compact==!0,"j-button-last-compact-item":t.lastCompactItem==!0,"j-button-first-compact-item":t.firstCompactItem==!0}]),disabled:t.disabled,onClick:a.withModifiers(r,["stop"])},[d.value?(a.openBlock(),a.createBlock(gn,{key:0,icon:"mdi:loading",size:t.size=="large"?14:12,class:"loading-spin j-button-loading-icon"},null,8,["size"])):a.createCommentVNode("",!0),t.icon?(a.openBlock(),a.createBlock(gn,{key:1,icon:t.icon},null,8,["icon"])):a.createCommentVNode("",!0),t.notLabel?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",Ed,a.toDisplayString(f.value),1)),a.renderSlot(h.$slots,"iconAfter")],10,xd))}})),Cd={class:"d-drag-btns-pname"},Sd={key:0,class:"d-drag-mask"},ki=a.defineComponent({name:"DDrag",__name:"drag",props:{componentData:{default:()=>({})},isContainer:{type:Boolean,default:!1}},setup(t){const e=t,n=a.ref(),{onMouseenter:o,onMouseleave:i,activeComponent:r,handleComponentClick:s,deleteComponentByClick:l,copyComponent:u,getParentComponents:c,isHover:d,isSelect:f,isTopActive:h,isBottomActive:p,isBottomToolBar:y}=Vr(n,e.componentData,"component"),{onContextmenu:m,onMousedown:v,moveActive:N}=Fr(e.componentData,!1);return(_,g)=>{const x=a.resolveComponent("el-space");return a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["d-drag-component",{selected:a.unref(f),hovered:a.unref(d),isBottomToolBar:a.unref(y),active:a.unref(N),isTopActive:a.unref(h),isBottomActive:a.unref(p)}])},[g[11]||(g[11]=a.createElementVNode("div",{class:"d-drag-line"},null,-1)),a.createElementVNode("div",{class:"d-drag-btns",onMouseenter:g[4]||(g[4]=(...z)=>a.unref(o)&&a.unref(o)(...z)),onMouseleave:g[5]||(g[5]=(...z)=>a.unref(i)&&a.unref(i)(...z))},[a.createVNode(x,{size:4},{default:a.withCtx(()=>[a.createElementVNode("div",{class:"d-drag-btns-names",onClick:a.withModifiers(()=>{},["stop"])},[a.createVNode(a.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"]),a.createElementVNode("div",Cd,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(c)(t.componentData.containerId),z=>(a.openBlock(),a.createElementBlock("div",{key:z.id},[a.createVNode(a.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",label:z.name,onClick:$=>a.unref(s)(z.id)},null,8,["label","onClick"])]))),128))])]),a.createVNode(a.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:content-copy",onClick:g[0]||(g[0]=a.withModifiers(z=>a.unref(u)(t.componentData.id),["stop"]))}),a.createElementVNode("div",{onContextmenu:g[1]||(g[1]=a.withModifiers((...z)=>a.unref(m)&&a.unref(m)(...z),["stop"])),onMousedown:g[2]||(g[2]=a.withModifiers((...z)=>a.unref(v)&&a.unref(v)(...z),["stop"])),style:{display:"flex"}},[a.createVNode(a.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:drag"})],32),a.createVNode(a.unref(Ut),{class:"d-drag-btn",danger:"",type:"primary",size:"small",icon:"mdi:delete",onClick:g[3]||(g[3]=a.withModifiers(z=>a.unref(l)(t.componentData.id),["stop"]))})]),_:1})],32),a.createElementVNode("div",{ref_key:"refDrag",ref:n,class:"d-drag-body",onClick:g[6]||(g[6]=a.withModifiers((...z)=>a.unref(r)&&a.unref(r)(...z),["stop"])),onContextmenu:g[7]||(g[7]=a.withModifiers((...z)=>a.unref(m)&&a.unref(m)(...z),["stop"])),onMousedown:g[8]||(g[8]=a.withModifiers((...z)=>a.unref(v)&&a.unref(v)(...z),["stop"])),onMouseenter:g[9]||(g[9]=(...z)=>a.unref(o)&&a.unref(o)(...z)),onMouseleave:g[10]||(g[10]=(...z)=>a.unref(i)&&a.unref(i)(...z))},[a.renderSlot(_.$slots,"default"),t.isContainer?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",Sd))],544)],2)}}}),Di=a.defineComponent({name:"DDragTool",__name:"tool",props:{config:{}},setup(t){const e=t,{onContextmenu:n,onMousedown:o,onClick:i}=Fr(e.config??{name:"",id:""},!0);return(r,s)=>(a.openBlock(),a.createElementBlock("div",{class:"d-drag-tool",onClick:s[0]||(s[0]=a.withModifiers((...l)=>a.unref(i)&&a.unref(i)(...l),["stop"])),onContextmenu:s[1]||(s[1]=a.withModifiers((...l)=>a.unref(n)&&a.unref(n)(...l),["stop"])),onMousedown:s[2]||(s[2]=a.withModifiers((...l)=>a.unref(o)&&a.unref(o)(...l),["stop"]))},[a.renderSlot(r.$slots,"default")],32))}}),Nd={key:0,class:"d-drag-line"},kd={key:1,class:"d-drag-btns"},Ti=a.defineComponent({name:"DDragContainer",__name:"container",props:{componentData:{default:()=>({})},isComponentContainer:{type:Boolean,default:!0},groupId:{default:void 0}},setup(t){const e=t,n=a.ref(),o=a.computed(()=>e.componentData?.children||[]),{onMouseenter:i,onMouseleave:r,activeComponent:s,isHover:l,isSelect:u,isToContainer:c,isMoveingInTopLevel:d,isTopActive:f,isBottomActive:h}=Vr(n,e.componentData,"container",o,e.isComponentContainer,e.groupId),p=a.computed(()=>!!(o.value.findIndex(y=>y.groupId===e.groupId)===-1&&c.value));return(y,m)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"refDrag",ref:n,class:a.normalizeClass(["d-drag-container",{selected:a.unref(u)&&!t.isComponentContainer,hovered:a.unref(l)&&!t.isComponentContainer,isTopLevel:t.componentData.level===0,active:p.value,isMoveingInTopLevel:a.unref(d),isTopActive:a.unref(f),isBottomActive:a.unref(h)}])},[t.isComponentContainer?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",Nd)),t.isComponentContainer?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",kd,[a.createElementVNode("div",{class:"d-drag-btns-names",onClick:a.withModifiers(()=>{},["stop"])},[a.createVNode(a.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"])])])),a.createElementVNode("div",{class:"d-drag-body",onClick:m[0]||(m[0]=a.withModifiers((...v)=>a.unref(s)&&a.unref(s)(...v),["stop"])),onMouseenter:m[1]||(m[1]=(...v)=>a.unref(i)&&a.unref(i)(...v)),onMouseleave:m[2]||(m[2]=(...v)=>a.unref(r)&&a.unref(r)(...v))},[a.renderSlot(y.$slots,"default")],32)],2))}}),Mi=a.defineComponent({name:"DDragFormList",__name:"dragFormList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=a.inject("dui-design-provide",{});return(n,o)=>{const i=a.resolveComponent("el-col");return a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.componentList,r=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:r.id},[r.type!="pkey"?(a.openBlock(),a.createBlock(i,{key:0,span:r.config.span||24},{default:a.withCtx(()=>[a.createVNode(ki,{"is-container":r.dragType!=="component","component-data":r},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(e)),{"component-data":r,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["is-container","component-data"])]),_:2},1032,["span"])):a.createCommentVNode("",!0)],64))),128)}}}),Ii=a.defineComponent({name:"DDragIndexList",__name:"dragIndexList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=a.inject("dui-design-provide",{}),n=o=>{if(o.flexWidth)return{width:o.flexWidth+"%"}};return(o,i)=>(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.componentList,r=>(a.openBlock(),a.createBlock(ki,{key:r.id,style:a.normalizeStyle(n(r.config)),"is-container":r.dragType!=="component","component-data":r},{default:a.withCtx(()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(e)),{"component-data":r,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["style","is-container","component-data"]))),128))}}),gs=Gt(ki,[Di,Ti,Mi,Ii]);function mn(t){return a.getCurrentScope()?(a.onScopeDispose(t),!0):!1}function ut(t){return typeof t=="function"?t():a.unref(t)}const Dd=typeof window<"u"&&typeof document<"u",Td=t=>typeof t<"u",Md=Object.prototype.toString,Id=t=>Md.call(t)==="[object Object]",Bd=()=>{};function $d(t,e){function n(...o){return new Promise((i,r)=>{Promise.resolve(t(()=>e.apply(this,o),{fn:e,thisArg:this,args:o})).then(i).catch(r)})}return n}const ms=t=>t();function zd(t=ms){const e=a.ref(!0);function n(){e.value=!1}function o(){e.value=!0}const i=(...r)=>{e.value&&t(...r)};return{isActive:a.readonly(e),pause:n,resume:o,eventFilter:i}}function ys(t,e=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(e?()=>i(n):o,t)})}function Ad(t,e,n={}){const{eventFilter:o=ms,...i}=n;return a.watch(t,$d(o,e),i)}function Xt(t,e,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:s,resume:l,isActive:u}=zd(o);return{stop:Ad(t,e,{...i,eventFilter:r}),pause:s,resume:l,isActive:u}}function Pd(t,e={}){if(!a.isRef(t))return a.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const o in t.value)n[o]=a.customRef(()=>({get(){return t.value[o]},set(i){var r;if((r=ut(e.replaceRef))!=null?r:!0)if(Array.isArray(t.value)){const l=[...t.value];l[o]=i,t.value=l}else{const l={...t.value,[o]:i};Object.setPrototypeOf(l,Object.getPrototypeOf(t.value)),t.value=l}else t.value[o]=i}}));return n}function Bi(t,e=!1){function n(f,{flush:h="sync",deep:p=!1,timeout:y,throwOnTimeout:m}={}){let v=null;const _=[new Promise(g=>{v=a.watch(t,x=>{f(x)!==e&&(v?.(),g(x))},{flush:h,deep:p,immediate:!0})})];return y!=null&&_.push(ys(y,m).then(()=>ut(t)).finally(()=>v?.())),Promise.race(_)}function o(f,h){if(!a.isRef(f))return n(x=>x===f,h);const{flush:p="sync",deep:y=!1,timeout:m,throwOnTimeout:v}=h??{};let N=null;const g=[new Promise(x=>{N=a.watch([t,f],([z,$])=>{e!==(z===$)&&(N?.(),x(z))},{flush:p,deep:y,immediate:!0})})];return m!=null&&g.push(ys(m,v).then(()=>ut(t)).finally(()=>(N?.(),ut(t)))),Promise.race(g)}function i(f){return n(h=>!!h,f)}function r(f){return o(null,f)}function s(f){return o(void 0,f)}function l(f){return n(Number.isNaN,f)}function u(f,h){return n(p=>{const y=Array.from(p);return y.includes(f)||y.includes(ut(f))},h)}function c(f){return d(1,f)}function d(f=1,h){let p=-1;return n(()=>(p+=1,p>=f),h)}return Array.isArray(ut(t))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Bi(t,!e)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:l,toBeUndefined:s,changed:c,changedTimes:d,get not(){return Bi(t,!e)}}}function $i(t){return Bi(t)}function Od(t){var e;const n=ut(t);return(e=n?.$el)!=null?e:n}const vs=Dd?window:void 0;function bs(...t){let e,n,o,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,o,i]=t,e=vs):[e,n,o,i]=t,!e)return Bd;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],s=()=>{r.forEach(d=>d()),r.length=0},l=(d,f,h,p)=>(d.addEventListener(f,h,p),()=>d.removeEventListener(f,h,p)),u=a.watch(()=>[Od(e),ut(i)],([d,f])=>{if(s(),!d)return;const h=Id(f)?{...f}:f;r.push(...n.flatMap(p=>o.map(y=>l(d,p,y,h))))},{immediate:!0,flush:"post"}),c=()=>{u(),s()};return mn(c),c}function Rd(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function ws(...t){let e,n,o={};t.length===3?(e=t[0],n=t[1],o=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],o=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=vs,eventName:r="keydown",passive:s=!1,dedupe:l=!1}=o,u=Rd(e);return bs(i,r,d=>{d.repeat&&ut(l)||u(d)&&n(d)},s)}function Hd(t){return JSON.parse(JSON.stringify(t))}function zi(t,e,n,o={}){var i,r,s;const{clone:l=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f,shouldEmit:h}=o,p=a.getCurrentInstance(),y=n||p?.emit||((i=p?.$emit)==null?void 0:i.bind(p))||((s=(r=p?.proxy)==null?void 0:r.$emit)==null?void 0:s.bind(p?.proxy));let m=c;e||(e="modelValue"),m=m||`update:${e.toString()}`;const v=g=>l?typeof l=="function"?l(g):Hd(g):g,N=()=>Td(t[e])?v(t[e]):f,_=g=>{h?h(g)&&y(m,g):y(m,g)};if(u){const g=N(),x=a.ref(g);let z=!1;return a.watch(()=>t[e],$=>{z||(z=!0,x.value=v($),a.nextTick(()=>z=!1))}),a.watch(x,$=>{!z&&($!==t[e]||d)&&_($)},{deep:d}),x}else return a.computed({get(){return N()},set(g){_(g)}})}var Ld={value:()=>{}};function eo(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new to(n)}function to(t){this._=t}function Vd(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}to.prototype=eo.prototype={constructor:to,on:function(t,e){var n=this._,o=Vd(t+"",n),i,r=-1,s=o.length;if(arguments.length<2){for(;++r<s;)if((i=(t=o[r]).type)&&(i=Fd(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++r<s;)if(i=(t=o[r]).type)n[i]=_s(n[i],t.name,e);else if(e==null)for(i in n)n[i]=_s(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new to(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,r;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)}};function Fd(t,e){for(var n=0,o=t.length,i;n<o;++n)if((i=t[n]).name===e)return i.value}function _s(t,e,n){for(var o=0,i=t.length;o<i;++o)if(t[o].name===e){t[o]=Ld,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var Ai="http://www.w3.org/1999/xhtml";const xs={svg:"http://www.w3.org/2000/svg",xhtml:Ai,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function no(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),xs.hasOwnProperty(e)?{space:xs[e],local:t}:t}function Wd(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ai&&e.documentElement.namespaceURI===Ai?e.createElement(t):e.createElementNS(n,t)}}function Gd(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Es(t){var e=no(t);return(e.local?Gd:Wd)(e)}function jd(){}function Pi(t){return t==null?jd:function(){return this.querySelector(t)}}function Yd(t){typeof t!="function"&&(t=Pi(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var r=e[i],s=r.length,l=o[i]=new Array(s),u,c,d=0;d<s;++d)(u=r[d])&&(c=t.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),l[d]=c);return new We(o,this._parents)}function Ud(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Xd(){return[]}function Cs(t){return t==null?Xd:function(){return this.querySelectorAll(t)}}function qd(t){return function(){return Ud(t.apply(this,arguments))}}function Kd(t){typeof t=="function"?t=qd(t):t=Cs(t);for(var e=this._groups,n=e.length,o=[],i=[],r=0;r<n;++r)for(var s=e[r],l=s.length,u,c=0;c<l;++c)(u=s[c])&&(o.push(t.call(u,u.__data__,c,s)),i.push(u));return new We(o,i)}function Ss(t){return function(){return this.matches(t)}}function Ns(t){return function(e){return e.matches(t)}}var Zd=Array.prototype.find;function Jd(t){return function(){return Zd.call(this.children,t)}}function Qd(){return this.firstElementChild}function eu(t){return this.select(t==null?Qd:Jd(typeof t=="function"?t:Ns(t)))}var tu=Array.prototype.filter;function nu(){return Array.from(this.children)}function ou(t){return function(){return tu.call(this.children,t)}}function iu(t){return this.selectAll(t==null?nu:ou(typeof t=="function"?t:Ns(t)))}function ru(t){typeof t!="function"&&(t=Ss(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var r=e[i],s=r.length,l=o[i]=[],u,c=0;c<s;++c)(u=r[c])&&t.call(u,u.__data__,c,r)&&l.push(u);return new We(o,this._parents)}function ks(t){return new Array(t.length)}function su(){return new We(this._enter||this._groups.map(ks),this._parents)}function oo(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}oo.prototype={constructor:oo,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function au(t){return function(){return t}}function lu(t,e,n,o,i,r){for(var s=0,l,u=e.length,c=r.length;s<c;++s)(l=e[s])?(l.__data__=r[s],o[s]=l):n[s]=new oo(t,r[s]);for(;s<u;++s)(l=e[s])&&(i[s]=l)}function cu(t,e,n,o,i,r,s){var l,u,c=new Map,d=e.length,f=r.length,h=new Array(d),p;for(l=0;l<d;++l)(u=e[l])&&(h[l]=p=s.call(u,u.__data__,l,e)+"",c.has(p)?i[l]=u:c.set(p,u));for(l=0;l<f;++l)p=s.call(t,r[l],l,r)+"",(u=c.get(p))?(o[l]=u,u.__data__=r[l],c.delete(p)):n[l]=new oo(t,r[l]);for(l=0;l<d;++l)(u=e[l])&&c.get(h[l])===u&&(i[l]=u)}function du(t){return t.__data__}function uu(t,e){if(!arguments.length)return Array.from(this,du);var n=e?cu:lu,o=this._parents,i=this._groups;typeof t!="function"&&(t=au(t));for(var r=i.length,s=new Array(r),l=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],f=i[c],h=f.length,p=fu(t.call(d,d&&d.__data__,c,o)),y=p.length,m=l[c]=new Array(y),v=s[c]=new Array(y),N=u[c]=new Array(h);n(d,f,m,v,N,p,e);for(var _=0,g=0,x,z;_<y;++_)if(x=m[_]){for(_>=g&&(g=_+1);!(z=v[g])&&++g<y;);x._next=z||null}}return s=new We(s,o),s._enter=l,s._exit=u,s}function fu(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function hu(){return new We(this._exit||this._groups.map(ks),this._parents)}function pu(t,e,n){var o=this.enter(),i=this,r=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?r.remove():n(r),o&&i?o.merge(i).order():i}function gu(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,i=n.length,r=o.length,s=Math.min(i,r),l=new Array(i),u=0;u<s;++u)for(var c=n[u],d=o[u],f=c.length,h=l[u]=new Array(f),p,y=0;y<f;++y)(p=c[y]||d[y])&&(h[y]=p);for(;u<i;++u)l[u]=n[u];return new We(l,this._parents)}function mu(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],i=o.length-1,r=o[i],s;--i>=0;)(s=o[i])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function yu(t){t||(t=vu);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var s=n[r],l=s.length,u=i[r]=new Array(l),c,d=0;d<l;++d)(c=s[d])&&(u[d]=c);u.sort(e)}return new We(i,this._parents).order()}function vu(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function bu(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function wu(){return Array.from(this)}function _u(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,r=o.length;i<r;++i){var s=o[i];if(s)return s}return null}function xu(){let t=0;for(const e of this)++t;return t}function Eu(){return!this.node()}function Cu(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],r=0,s=i.length,l;r<s;++r)(l=i[r])&&t.call(l,l.__data__,r,i);return this}function Su(t){return function(){this.removeAttribute(t)}}function Nu(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ku(t,e){return function(){this.setAttribute(t,e)}}function Du(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Tu(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Mu(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Iu(t,e){var n=no(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?Nu:Su:typeof e=="function"?n.local?Mu:Tu:n.local?Du:ku)(n,e))}function Ds(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Bu(t){return function(){this.style.removeProperty(t)}}function $u(t,e,n){return function(){this.style.setProperty(t,e,n)}}function zu(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Au(t,e,n){return arguments.length>1?this.each((e==null?Bu:typeof e=="function"?zu:$u)(t,e,n??"")):qt(this.node(),t)}function qt(t,e){return t.style.getPropertyValue(e)||Ds(t).getComputedStyle(t,null).getPropertyValue(e)}function Pu(t){return function(){delete this[t]}}function Ou(t,e){return function(){this[t]=e}}function Ru(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Hu(t,e){return arguments.length>1?this.each((e==null?Pu:typeof e=="function"?Ru:Ou)(t,e)):this.node()[t]}function Ts(t){return t.trim().split(/^|\s+/)}function Oi(t){return t.classList||new Ms(t)}function Ms(t){this._node=t,this._names=Ts(t.getAttribute("class")||"")}Ms.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Is(t,e){for(var n=Oi(t),o=-1,i=e.length;++o<i;)n.add(e[o])}function Bs(t,e){for(var n=Oi(t),o=-1,i=e.length;++o<i;)n.remove(e[o])}function Lu(t){return function(){Is(this,t)}}function Vu(t){return function(){Bs(this,t)}}function Fu(t,e){return function(){(e.apply(this,arguments)?Is:Bs)(this,t)}}function Wu(t,e){var n=Ts(t+"");if(arguments.length<2){for(var o=Oi(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Fu:e?Lu:Vu)(n,e))}function Gu(){this.textContent=""}function ju(t){return function(){this.textContent=t}}function Yu(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Uu(t){return arguments.length?this.each(t==null?Gu:(typeof t=="function"?Yu:ju)(t)):this.node().textContent}function Xu(){this.innerHTML=""}function qu(t){return function(){this.innerHTML=t}}function Ku(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Zu(t){return arguments.length?this.each(t==null?Xu:(typeof t=="function"?Ku:qu)(t)):this.node().innerHTML}function Ju(){this.nextSibling&&this.parentNode.appendChild(this)}function Qu(){return this.each(Ju)}function ef(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tf(){return this.each(ef)}function nf(t){var e=typeof t=="function"?t:Es(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function of(){return null}function rf(t,e){var n=typeof t=="function"?t:Es(t),o=e==null?of:typeof e=="function"?e:Pi(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function sf(){var t=this.parentNode;t&&t.removeChild(this)}function af(){return this.each(sf)}function lf(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function cf(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function df(t){return this.select(t?cf:lf)}function uf(t){return arguments.length?this.property("__data__",t):this.node().__data__}function ff(t){return function(e){t.call(this,e,this.__data__)}}function hf(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function pf(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,i=e.length,r;n<i;++n)r=e[n],(!t.type||r.type===t.type)&&r.name===t.name?this.removeEventListener(r.type,r.listener,r.options):e[++o]=r;++o?e.length=o:delete this.__on}}}function gf(t,e,n){return function(){var o=this.__on,i,r=ff(e);if(o){for(var s=0,l=o.length;s<l;++s)if((i=o[s]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=e;return}}this.addEventListener(t.type,r,n),i={type:t.type,name:t.name,value:e,listener:r,options:n},o?o.push(i):this.__on=[i]}}function mf(t,e,n){var o=hf(t+""),i,r=o.length,s;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,c=l.length,d;u<c;++u)for(i=0,d=l[u];i<r;++i)if((s=o[i]).type===d.type&&s.name===d.name)return d.value}return}for(l=e?gf:pf,i=0;i<r;++i)this.each(l(o[i],e,n));return this}function $s(t,e,n){var o=Ds(t),i=o.CustomEvent;typeof i=="function"?i=new i(e,n):(i=o.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function yf(t,e){return function(){return $s(this,t,e)}}function vf(t,e){return function(){return $s(this,t,e.apply(this,arguments))}}function bf(t,e){return this.each((typeof e=="function"?vf:yf)(t,e))}function*wf(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,r=o.length,s;i<r;++i)(s=o[i])&&(yield s)}var zs=[null];function We(t,e){this._groups=t,this._parents=e}function yn(){return new We([[document.documentElement]],zs)}function _f(){return this}We.prototype=yn.prototype={constructor:We,select:Yd,selectAll:Kd,selectChild:eu,selectChildren:iu,filter:ru,data:uu,enter:su,exit:hu,join:pu,merge:gu,selection:_f,order:mu,sort:yu,call:bu,nodes:wu,node:_u,size:xu,empty:Eu,each:Cu,attr:Iu,style:Au,property:Hu,classed:Wu,text:Uu,html:Zu,raise:Qu,lower:tf,append:nf,insert:rf,remove:af,clone:df,datum:uf,on:mf,dispatch:bf,[Symbol.iterator]:wf};function Je(t){return typeof t=="string"?new We([[document.querySelector(t)]],[document.documentElement]):new We([[t]],zs)}function xf(t){let e;for(;e=t.sourceEvent;)t=e;return t}function it(t,e){if(t=xf(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const Ef={passive:!1},vn={capture:!0,passive:!1};function Ri(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function As(t){var e=t.document.documentElement,n=Je(t).on("dragstart.drag",Kt,vn);"onselectstart"in e?n.on("selectstart.drag",Kt,vn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ps(t,e){var n=t.document.documentElement,o=Je(t).on("dragstart.drag",null);e&&(o.on("click.drag",Kt,vn),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const io=t=>()=>t;function Hi(t,{sourceEvent:e,subject:n,target:o,identifier:i,active:r,x:s,y:l,dx:u,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}Hi.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Cf(t){return!t.ctrlKey&&!t.button}function Sf(){return this.parentNode}function Nf(t,e){return e??{x:t.x,y:t.y}}function kf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Df(){var t=Cf,e=Sf,n=Nf,o=kf,i={},r=eo("start","drag","end"),s=0,l,u,c,d,f=0;function h(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",v).on("touchmove.drag",N,Ef).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,z){if(!(d||!t.call(this,x,z))){var $=g(this,e.call(this,x,z),x,z,"mouse");$&&(Je(x.view).on("mousemove.drag",y,vn).on("mouseup.drag",m,vn),As(x.view),Ri(x),c=!1,l=x.clientX,u=x.clientY,$("start",x))}}function y(x){if(Kt(x),!c){var z=x.clientX-l,$=x.clientY-u;c=z*z+$*$>f}i.mouse("drag",x)}function m(x){Je(x.view).on("mousemove.drag mouseup.drag",null),Ps(x.view,c),Kt(x),i.mouse("end",x)}function v(x,z){if(t.call(this,x,z)){var $=x.changedTouches,F=e.call(this,x,z),X=$.length,Y,S;for(Y=0;Y<X;++Y)(S=g(this,F,x,z,$[Y].identifier,$[Y]))&&(Ri(x),S("start",x,$[Y]))}}function N(x){var z=x.changedTouches,$=z.length,F,X;for(F=0;F<$;++F)(X=i[z[F].identifier])&&(Kt(x),X("drag",x,z[F]))}function _(x){var z=x.changedTouches,$=z.length,F,X;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),F=0;F<$;++F)(X=i[z[F].identifier])&&(Ri(x),X("end",x,z[F]))}function g(x,z,$,F,X,Y){var S=r.copy(),I=it(Y||$,z),C,H,w;if((w=n.call(x,new Hi("beforestart",{sourceEvent:$,target:h,identifier:X,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:S}),F))!=null)return C=w.x-I[0]||0,H=w.y-I[1]||0,function k(b,E,T){var O=I,R;switch(b){case"start":i[X]=k,R=s++;break;case"end":delete i[X],--s;case"drag":I=it(T||E,z),R=s;break}S.call(b,x,new Hi(b,{sourceEvent:E,subject:w,target:h,identifier:X,active:R,x:I[0]+C,y:I[1]+H,dx:I[0]-O[0],dy:I[1]-O[1],dispatch:S}),F)}}return h.filter=function(x){return arguments.length?(t=typeof x=="function"?x:io(!!x),h):t},h.container=function(x){return arguments.length?(e=typeof x=="function"?x:io(x),h):e},h.subject=function(x){return arguments.length?(n=typeof x=="function"?x:io(x),h):n},h.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:io(!!x),h):o},h.on=function(){var x=r.on.apply(r,arguments);return x===r?h:x},h.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,h):Math.sqrt(f)},h}function Li(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Os(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function bn(){}var wn=.7,ro=1/wn,Zt="\\s*([+-]?\\d+)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Tf=/^#([0-9a-f]{3,8})$/,Mf=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),If=new RegExp(`^rgb\\(${rt},${rt},${rt}\\)$`),Bf=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${_n}\\)$`),$f=new RegExp(`^rgba\\(${rt},${rt},${rt},${_n}\\)$`),zf=new RegExp(`^hsl\\(${_n},${rt},${rt}\\)$`),Af=new RegExp(`^hsla\\(${_n},${rt},${rt},${_n}\\)$`),Rs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Li(bn,$t,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Hs,formatHex:Hs,formatHex8:Pf,formatHsl:Of,formatRgb:Ls,toString:Ls});function Hs(){return this.rgb().formatHex()}function Pf(){return this.rgb().formatHex8()}function Of(){return js(this).formatHsl()}function Ls(){return this.rgb().formatRgb()}function $t(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Tf.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Vs(e):n===3?new He(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?so(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?so(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Mf.exec(t))?new He(e[1],e[2],e[3],1):(e=If.exec(t))?new He(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Bf.exec(t))?so(e[1],e[2],e[3],e[4]):(e=$f.exec(t))?so(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=zf.exec(t))?Gs(e[1],e[2]/100,e[3]/100,1):(e=Af.exec(t))?Gs(e[1],e[2]/100,e[3]/100,e[4]):Rs.hasOwnProperty(t)?Vs(Rs[t]):t==="transparent"?new He(NaN,NaN,NaN,0):null}function Vs(t){return new He(t>>16&255,t>>8&255,t&255,1)}function so(t,e,n,o){return o<=0&&(t=e=n=NaN),new He(t,e,n,o)}function Rf(t){return t instanceof bn||(t=$t(t)),t?(t=t.rgb(),new He(t.r,t.g,t.b,t.opacity)):new He}function Vi(t,e,n,o){return arguments.length===1?Rf(t):new He(t,e,n,o??1)}function He(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}Li(He,Vi,Os(bn,{brighter(t){return t=t==null?ro:Math.pow(ro,t),new He(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?wn:Math.pow(wn,t),new He(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new He(zt(this.r),zt(this.g),zt(this.b),ao(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fs,formatHex:Fs,formatHex8:Hf,formatRgb:Ws,toString:Ws}));function Fs(){return`#${At(this.r)}${At(this.g)}${At(this.b)}`}function Hf(){return`#${At(this.r)}${At(this.g)}${At(this.b)}${At((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ws(){const t=ao(this.opacity);return`${t===1?"rgb(":"rgba("}${zt(this.r)}, ${zt(this.g)}, ${zt(this.b)}${t===1?")":`, ${t})`}`}function ao(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function zt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function At(t){return t=zt(t),(t<16?"0":"")+t.toString(16)}function Gs(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Qe(t,e,n,o)}function js(t){if(t instanceof Qe)return new Qe(t.h,t.s,t.l,t.opacity);if(t instanceof bn||(t=$t(t)),!t)return new Qe;if(t instanceof Qe)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,i=Math.min(e,n,o),r=Math.max(e,n,o),s=NaN,l=r-i,u=(r+i)/2;return l?(e===r?s=(n-o)/l+(n<o)*6:n===r?s=(o-e)/l+2:s=(e-n)/l+4,l/=u<.5?r+i:2-r-i,s*=60):l=u>0&&u<1?0:s,new Qe(s,l,u,t.opacity)}function Lf(t,e,n,o){return arguments.length===1?js(t):new Qe(t,e,n,o??1)}function Qe(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}Li(Qe,Lf,Os(bn,{brighter(t){return t=t==null?ro:Math.pow(ro,t),new Qe(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?wn:Math.pow(wn,t),new Qe(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,i=2*n-o;return new He(Fi(t>=240?t-240:t+120,i,o),Fi(t,i,o),Fi(t<120?t+240:t-120,i,o),this.opacity)},clamp(){return new Qe(Ys(this.h),lo(this.s),lo(this.l),ao(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ao(this.opacity);return`${t===1?"hsl(":"hsla("}${Ys(this.h)}, ${lo(this.s)*100}%, ${lo(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Ys(t){return t=(t||0)%360,t<0?t+360:t}function lo(t){return Math.max(0,Math.min(1,t||0))}function Fi(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Wi=t=>()=>t;function Vf(t,e){return function(n){return t+n*e}}function Ff(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function Wf(t){return(t=+t)==1?Us:function(e,n){return n-e?Ff(e,n,t):Wi(isNaN(e)?n:e)}}function Us(t,e){var n=e-t;return n?Vf(t,n):Wi(isNaN(t)?e:t)}const co=(function t(e){var n=Wf(e);function o(i,r){var s=n((i=Vi(i)).r,(r=Vi(r)).r),l=n(i.g,r.g),u=n(i.b,r.b),c=Us(i.opacity,r.opacity);return function(d){return i.r=s(d),i.g=l(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=t,o})(1);function Gf(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),i;return function(r){for(i=0;i<n;++i)o[i]=t[i]*(1-r)+e[i]*r;return o}}function jf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Yf(t,e){var n=e?e.length:0,o=t?Math.min(n,t.length):0,i=new Array(o),r=new Array(n),s;for(s=0;s<o;++s)i[s]=xn(t[s],e[s]);for(;s<n;++s)r[s]=e[s];return function(l){for(s=0;s<o;++s)r[s]=i[s](l);return r}}function Uf(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function st(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Xf(t,e){var n={},o={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=xn(t[i],e[i]):o[i]=e[i];return function(r){for(i in n)o[i]=n[i](r);return o}}var Gi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ji=new RegExp(Gi.source,"g");function qf(t){return function(){return t}}function Kf(t){return function(e){return t(e)+""}}function Xs(t,e){var n=Gi.lastIndex=ji.lastIndex=0,o,i,r,s=-1,l=[],u=[];for(t=t+"",e=e+"";(o=Gi.exec(t))&&(i=ji.exec(e));)(r=i.index)>n&&(r=e.slice(n,r),l[s]?l[s]+=r:l[++s]=r),(o=o[0])===(i=i[0])?l[s]?l[s]+=i:l[++s]=i:(l[++s]=null,u.push({i:s,x:st(o,i)})),n=ji.lastIndex;return n<e.length&&(r=e.slice(n),l[s]?l[s]+=r:l[++s]=r),l.length<2?u[0]?Kf(u[0].x):qf(e):(e=u.length,function(c){for(var d=0,f;d<e;++d)l[(f=u[d]).i]=f.x(c);return l.join("")})}function xn(t,e){var n=typeof e,o;return e==null||n==="boolean"?Wi(e):(n==="number"?st:n==="string"?(o=$t(e))?(e=o,co):Xs:e instanceof $t?co:e instanceof Date?Uf:jf(e)?Gf:Array.isArray(e)?Yf:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Xf:st)(t,e)}var qs=180/Math.PI,Yi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ks(t,e,n,o,i,r){var s,l,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*o)&&(n-=t*u,o-=e*u),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,u/=l),t*o<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:i,translateY:r,rotate:Math.atan2(e,t)*qs,skewX:Math.atan(u)*qs,scaleX:s,scaleY:l}}var uo;function Zf(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Yi:Ks(e.a,e.b,e.c,e.d,e.e,e.f)}function Jf(t){return t==null||(uo||(uo=document.createElementNS("http://www.w3.org/2000/svg","g")),uo.setAttribute("transform",t),!(t=uo.transform.baseVal.consolidate()))?Yi:(t=t.matrix,Ks(t.a,t.b,t.c,t.d,t.e,t.f))}function Zs(t,e,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,f,h,p,y){if(c!==f||d!==h){var m=p.push("translate(",null,e,null,n);y.push({i:m-4,x:st(c,f)},{i:m-2,x:st(d,h)})}else(f||h)&&p.push("translate("+f+e+h+n)}function s(c,d,f,h){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:st(c,d)})):d&&f.push(i(f)+"rotate("+d+o)}function l(c,d,f,h){c!==d?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:st(c,d)}):d&&f.push(i(f)+"skewX("+d+o)}function u(c,d,f,h,p,y){if(c!==f||d!==h){var m=p.push(i(p)+"scale(",null,",",null,")");y.push({i:m-4,x:st(c,f)},{i:m-2,x:st(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(c,d){var f=[],h=[];return c=t(c),d=t(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,h),s(c.rotate,d.rotate,f,h),l(c.skewX,d.skewX,f,h),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,h),c=d=null,function(p){for(var y=-1,m=h.length,v;++y<m;)f[(v=h[y]).i]=v.x(p);return f.join("")}}}var Qf=Zs(Zf,"px, ","px)","deg)"),eh=Zs(Jf,", ",")",")"),th=1e-12;function Js(t){return((t=Math.exp(t))+1/t)/2}function nh(t){return((t=Math.exp(t))-1/t)/2}function oh(t){return((t=Math.exp(2*t))-1)/(t+1)}const fo=(function t(e,n,o){function i(r,s){var l=r[0],u=r[1],c=r[2],d=s[0],f=s[1],h=s[2],p=d-l,y=f-u,m=p*p+y*y,v,N;if(m<th)N=Math.log(h/c)/e,v=function(F){return[l+F*p,u+F*y,c*Math.exp(e*F*N)]};else{var _=Math.sqrt(m),g=(h*h-c*c+o*m)/(2*c*n*_),x=(h*h-c*c-o*m)/(2*h*n*_),z=Math.log(Math.sqrt(g*g+1)-g),$=Math.log(Math.sqrt(x*x+1)-x);N=($-z)/e,v=function(F){var X=F*N,Y=Js(z),S=c/(n*_)*(Y*oh(e*X+z)-nh(z));return[l+S*p,u+S*y,c*Y/Js(e*X+z)]}}return v.duration=N*1e3*e/Math.SQRT2,v}return i.rho=function(r){var s=Math.max(.001,+r),l=s*s,u=l*l;return t(s,l,u)},i})(Math.SQRT2,2,4);var Jt=0,En=0,Cn=0,Qs=1e3,ho,Sn,po=0,Pt=0,go=0,Nn=typeof performance=="object"&&performance.now?performance:Date,ea=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ui(){return Pt||(ea(ih),Pt=Nn.now()+go)}function ih(){Pt=0}function mo(){this._call=this._time=this._next=null}mo.prototype=ta.prototype={constructor:mo,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ui():+n)+(e==null?0:+e),!this._next&&Sn!==this&&(Sn?Sn._next=this:ho=this,Sn=this),this._call=t,this._time=n,Xi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xi())}};function ta(t,e,n){var o=new mo;return o.restart(t,e,n),o}function rh(){Ui(),++Jt;for(var t=ho,e;t;)(e=Pt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Jt}function na(){Pt=(po=Nn.now())+go,Jt=En=0;try{rh()}finally{Jt=0,ah(),Pt=0}}function sh(){var t=Nn.now(),e=t-po;e>Qs&&(go-=e,po=t)}function ah(){for(var t,e=ho,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:ho=n);Sn=t,Xi(o)}function Xi(t){if(!Jt){En&&(En=clearTimeout(En));var e=t-Pt;e>24?(t<1/0&&(En=setTimeout(na,t-Nn.now()-go)),Cn&&(Cn=clearInterval(Cn))):(Cn||(po=Nn.now(),Cn=setInterval(sh,Qs)),Jt=1,ea(na))}}function oa(t,e,n){var o=new mo;return e=e==null?0:+e,o.restart(i=>{o.stop(),t(i+e)},e,n),o}var lh=eo("start","end","cancel","interrupt"),ch=[],ia=0,ra=1,qi=2,yo=3,sa=4,Ki=5,vo=6;function bo(t,e,n,o,i,r){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;dh(t,n,{name:e,index:o,group:i,on:lh,tween:ch,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:ia})}function Zi(t,e){var n=et(t,e);if(n.state>ia)throw new Error("too late; already scheduled");return n}function at(t,e){var n=et(t,e);if(n.state>yo)throw new Error("too late; already running");return n}function et(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function dh(t,e,n){var o=t.__transition,i;o[e]=n,n.timer=ta(r,0,n.time);function r(c){n.state=ra,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var d,f,h,p;if(n.state!==ra)return u();for(d in o)if(p=o[d],p.name===n.name){if(p.state===yo)return oa(s);p.state===sa?(p.state=vo,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete o[d]):+d<e&&(p.state=vo,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete o[d])}if(oa(function(){n.state===yo&&(n.state=sa,n.timer.restart(l,n.delay,n.time),l(c))}),n.state=qi,n.on.call("start",t,t.__data__,n.index,n.group),n.state===qi){for(n.state=yo,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function l(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=Ki,1),f=-1,h=i.length;++f<h;)i[f].call(t,d);n.state===Ki&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){n.state=vo,n.timer.stop(),delete o[e];for(var c in o)return;delete t.__transition}}function wo(t,e){var n=t.__transition,o,i,r=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){r=!1;continue}i=o.state>qi&&o.state<Ki,o.state=vo,o.timer.stop(),o.on.call(i?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}r&&delete t.__transition}}function uh(t){return this.each(function(){wo(this,t)})}function fh(t,e){var n,o;return function(){var i=at(this,t),r=i.tween;if(r!==n){o=n=r;for(var s=0,l=o.length;s<l;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}i.tween=o}}function hh(t,e,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=at(this,t),s=r.tween;if(s!==o){i=(o=s).slice();for(var l={name:e,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===e){i[u]=l;break}u===c&&i.push(l)}r.tween=i}}function ph(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=et(this.node(),n).tween,i=0,r=o.length,s;i<r;++i)if((s=o[i]).name===t)return s.value;return null}return this.each((e==null?fh:hh)(n,t,e))}function Ji(t,e,n){var o=t._id;return t.each(function(){var i=at(this,o);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return et(i,o).value[e]}}function aa(t,e){var n;return(typeof e=="number"?st:e instanceof $t?co:(n=$t(e))?(e=n,co):Xs)(t,e)}function gh(t){return function(){this.removeAttribute(t)}}function mh(t){return function(){this.removeAttributeNS(t.space,t.local)}}function yh(t,e,n){var o,i=n+"",r;return function(){var s=this.getAttribute(t);return s===i?null:s===o?r:r=e(o=s,n)}}function vh(t,e,n){var o,i=n+"",r;return function(){var s=this.getAttributeNS(t.space,t.local);return s===i?null:s===o?r:r=e(o=s,n)}}function bh(t,e,n){var o,i,r;return function(){var s,l=n(this),u;return l==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=l+"",s===u?null:s===o&&u===i?r:(i=u,r=e(o=s,l)))}}function wh(t,e,n){var o,i,r;return function(){var s,l=n(this),u;return l==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=l+"",s===u?null:s===o&&u===i?r:(i=u,r=e(o=s,l)))}}function _h(t,e){var n=no(t),o=n==="transform"?eh:aa;return this.attrTween(t,typeof e=="function"?(n.local?wh:bh)(n,o,Ji(this,"attr."+t,e)):e==null?(n.local?mh:gh)(n):(n.local?vh:yh)(n,o,e))}function xh(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Eh(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Ch(t,e){var n,o;function i(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&Eh(t,r)),n}return i._value=e,i}function Sh(t,e){var n,o;function i(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&xh(t,r)),n}return i._value=e,i}function Nh(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=no(t);return this.tween(n,(o.local?Ch:Sh)(o,e))}function kh(t,e){return function(){Zi(this,t).delay=+e.apply(this,arguments)}}function Dh(t,e){return e=+e,function(){Zi(this,t).delay=e}}function Th(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?kh:Dh)(e,t)):et(this.node(),e).delay}function Mh(t,e){return function(){at(this,t).duration=+e.apply(this,arguments)}}function Ih(t,e){return e=+e,function(){at(this,t).duration=e}}function Bh(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Mh:Ih)(e,t)):et(this.node(),e).duration}function $h(t,e){if(typeof e!="function")throw new Error;return function(){at(this,t).ease=e}}function zh(t){var e=this._id;return arguments.length?this.each($h(e,t)):et(this.node(),e).ease}function Ah(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;at(this,t).ease=n}}function Ph(t){if(typeof t!="function")throw new Error;return this.each(Ah(this._id,t))}function Oh(t){typeof t!="function"&&(t=Ss(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var r=e[i],s=r.length,l=o[i]=[],u,c=0;c<s;++c)(u=r[c])&&t.call(u,u.__data__,c,r)&&l.push(u);return new ft(o,this._parents,this._name,this._id)}function Rh(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,i=n.length,r=Math.min(o,i),s=new Array(o),l=0;l<r;++l)for(var u=e[l],c=n[l],d=u.length,f=s[l]=new Array(d),h,p=0;p<d;++p)(h=u[p]||c[p])&&(f[p]=h);for(;l<o;++l)s[l]=e[l];return new ft(s,this._parents,this._name,this._id)}function Hh(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Lh(t,e,n){var o,i,r=Hh(e)?Zi:at;return function(){var s=r(this,t),l=s.on;l!==o&&(i=(o=l).copy()).on(e,n),s.on=i}}function Vh(t,e){var n=this._id;return arguments.length<2?et(this.node(),n).on.on(t):this.each(Lh(n,t,e))}function Fh(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Wh(){return this.on("end.remove",Fh(this._id))}function Gh(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Pi(t));for(var o=this._groups,i=o.length,r=new Array(i),s=0;s<i;++s)for(var l=o[s],u=l.length,c=r[s]=new Array(u),d,f,h=0;h<u;++h)(d=l[h])&&(f=t.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),c[h]=f,bo(c[h],e,n,h,c,et(d,n)));return new ft(r,this._parents,e,n)}function jh(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Cs(t));for(var o=this._groups,i=o.length,r=[],s=[],l=0;l<i;++l)for(var u=o[l],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var h=t.call(d,d.__data__,f,u),p,y=et(d,n),m=0,v=h.length;m<v;++m)(p=h[m])&&bo(p,e,n,m,h,y);r.push(h),s.push(d)}return new ft(r,s,e,n)}var Yh=yn.prototype.constructor;function Uh(){return new Yh(this._groups,this._parents)}function Xh(t,e){var n,o,i;return function(){var r=qt(this,t),s=(this.style.removeProperty(t),qt(this,t));return r===s?null:r===n&&s===o?i:i=e(n=r,o=s)}}function la(t){return function(){this.style.removeProperty(t)}}function qh(t,e,n){var o,i=n+"",r;return function(){var s=qt(this,t);return s===i?null:s===o?r:r=e(o=s,n)}}function Kh(t,e,n){var o,i,r;return function(){var s=qt(this,t),l=n(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(t),qt(this,t))),s===u?null:s===o&&u===i?r:(i=u,r=e(o=s,l))}}function Zh(t,e){var n,o,i,r="style."+e,s="end."+r,l;return function(){var u=at(this,t),c=u.on,d=u.value[r]==null?l||(l=la(e)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(s,i=d),u.on=o}}function Jh(t,e,n){var o=(t+="")=="transform"?Qf:aa;return e==null?this.styleTween(t,Xh(t,o)).on("end.style."+t,la(t)):typeof e=="function"?this.styleTween(t,Kh(t,o,Ji(this,"style."+t,e))).each(Zh(this._id,t)):this.styleTween(t,qh(t,o,e),n).on("end.style."+t,null)}function Qh(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function ep(t,e,n){var o,i;function r(){var s=e.apply(this,arguments);return s!==i&&(o=(i=s)&&Qh(t,s,n)),o}return r._value=e,r}function tp(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,ep(t,e,n??""))}function np(t){return function(){this.textContent=t}}function op(t){return function(){var e=t(this);this.textContent=e??""}}function ip(t){return this.tween("text",typeof t=="function"?op(Ji(this,"text",t)):np(t==null?"":t+""))}function rp(t){return function(e){this.textContent=t.call(this,e)}}function sp(t){var e,n;function o(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&rp(i)),e}return o._value=t,o}function ap(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,sp(t))}function lp(){for(var t=this._name,e=this._id,n=ca(),o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],l=s.length,u,c=0;c<l;++c)if(u=s[c]){var d=et(u,e);bo(u,t,n,c,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ft(o,this._parents,t,n)}function cp(){var t,e,n=this,o=n._id,i=n.size();return new Promise(function(r,s){var l={value:s},u={value:function(){--i===0&&r()}};n.each(function(){var c=at(this,o),d=c.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(u)),c.on=e}),i===0&&r()})}var dp=0;function ft(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function ca(){return++dp}var ht=yn.prototype;ft.prototype={constructor:ft,select:Gh,selectAll:jh,selectChild:ht.selectChild,selectChildren:ht.selectChildren,filter:Oh,merge:Rh,selection:Uh,transition:lp,call:ht.call,nodes:ht.nodes,node:ht.node,size:ht.size,empty:ht.empty,each:ht.each,on:Vh,attr:_h,attrTween:Nh,style:Jh,styleTween:tp,text:ip,textTween:ap,remove:Wh,tween:ph,delay:Th,duration:Bh,ease:zh,easeVarying:Ph,end:cp,[Symbol.iterator]:ht[Symbol.iterator]};function up(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var fp={time:null,delay:0,duration:250,ease:up};function hp(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function pp(t){var e,n;t instanceof ft?(e=t._id,t=t._name):(e=ca(),(n=fp).time=Ui(),t=t==null?null:t+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],l=s.length,u,c=0;c<l;++c)(u=s[c])&&bo(u,t,e,c,s,n||hp(u,e));return new ft(o,this._parents,t,e)}yn.prototype.interrupt=uh,yn.prototype.transition=pp;const _o=t=>()=>t;function gp(t,{sourceEvent:e,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function pt(t,e,n){this.k=t,this.x=e,this.y=n}pt.prototype={constructor:pt,scale:function(t){return t===1?this:new pt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new pt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qt=new pt(1,0,0);pt.prototype;function Qi(t){t.stopImmediatePropagation()}function kn(t){t.preventDefault(),t.stopImmediatePropagation()}function mp(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function yp(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function da(){return this.__zoom||Qt}function vp(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function bp(){return navigator.maxTouchPoints||"ontouchstart"in this}function wp(t,e,n){var o=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],r=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}function _p(){var t=mp,e=yp,n=wp,o=vp,i=bp,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,u=fo,c=eo("start","zoom","end"),d,f,h,p=500,y=150,m=0,v=10;function N(w){w.property("__zoom",da).on("wheel.zoom",X,{passive:!1}).on("mousedown.zoom",Y).on("dblclick.zoom",S).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(w,k,b,E){var T=w.selection?w.selection():w;T.property("__zoom",da),w!==T?z(w,k,b,E):T.interrupt().each(function(){$(this,arguments).event(E).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},N.scaleBy=function(w,k,b,E){N.scaleTo(w,function(){var T=this.__zoom.k,O=typeof k=="function"?k.apply(this,arguments):k;return T*O},b,E)},N.scaleTo=function(w,k,b,E){N.transform(w,function(){var T=e.apply(this,arguments),O=this.__zoom,R=b==null?x(T):typeof b=="function"?b.apply(this,arguments):b,B=O.invert(R),P=typeof k=="function"?k.apply(this,arguments):k;return n(g(_(O,P),R,B),T,s)},b,E)},N.translateBy=function(w,k,b,E){N.transform(w,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof b=="function"?b.apply(this,arguments):b),e.apply(this,arguments),s)},null,E)},N.translateTo=function(w,k,b,E,T){N.transform(w,function(){var O=e.apply(this,arguments),R=this.__zoom,B=E==null?x(O):typeof E=="function"?E.apply(this,arguments):E;return n(Qt.translate(B[0],B[1]).scale(R.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof b=="function"?-b.apply(this,arguments):-b),O,s)},E,T)};function _(w,k){return k=Math.max(r[0],Math.min(r[1],k)),k===w.k?w:new pt(k,w.x,w.y)}function g(w,k,b){var E=k[0]-b[0]*w.k,T=k[1]-b[1]*w.k;return E===w.x&&T===w.y?w:new pt(w.k,E,T)}function x(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function z(w,k,b,E){w.on("start.zoom",function(){$(this,arguments).event(E).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(E).end()}).tween("zoom",function(){var T=this,O=arguments,R=$(T,O).event(E),B=e.apply(T,O),P=b==null?x(B):typeof b=="function"?b.apply(T,O):b,V=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),W=T.__zoom,Z=typeof k=="function"?k.apply(T,O):k,Q=u(W.invert(P).concat(V/W.k),Z.invert(P).concat(V/Z.k));return function(q){if(q===1)q=Z;else{var ee=Q(q),re=V/ee[2];q=new pt(re,P[0]-ee[0]*re,P[1]-ee[1]*re)}R.zoom(null,q)}})}function $(w,k,b){return!b&&w.__zooming||new F(w,k)}function F(w,k){this.that=w,this.args=k,this.active=0,this.sourceEvent=null,this.extent=e.apply(w,k),this.taps=0}F.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,k){return this.mouse&&w!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var k=Je(this.that).datum();c.call(w,this.that,new gp(w,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:c}),k)}};function X(w,...k){if(!t.apply(this,arguments))return;var b=$(this,k).event(w),E=this.__zoom,T=Math.max(r[0],Math.min(r[1],E.k*Math.pow(2,o.apply(this,arguments)))),O=it(w);if(b.wheel)(b.mouse[0][0]!==O[0]||b.mouse[0][1]!==O[1])&&(b.mouse[1]=E.invert(b.mouse[0]=O)),clearTimeout(b.wheel);else{if(E.k===T)return;b.mouse=[O,E.invert(O)],wo(this),b.start()}kn(w),b.wheel=setTimeout(R,y),b.zoom("mouse",n(g(_(E,T),b.mouse[0],b.mouse[1]),b.extent,s));function R(){b.wheel=null,b.end()}}function Y(w,...k){if(h||!t.apply(this,arguments))return;var b=w.currentTarget,E=$(this,k,!0).event(w),T=Je(w.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",V,!0),O=it(w,b),R=w.clientX,B=w.clientY;As(w.view),Qi(w),E.mouse=[O,this.__zoom.invert(O)],wo(this),E.start();function P(W){if(kn(W),!E.moved){var Z=W.clientX-R,Q=W.clientY-B;E.moved=Z*Z+Q*Q>m}E.event(W).zoom("mouse",n(g(E.that.__zoom,E.mouse[0]=it(W,b),E.mouse[1]),E.extent,s))}function V(W){T.on("mousemove.zoom mouseup.zoom",null),Ps(W.view,E.moved),kn(W),E.event(W).end()}}function S(w,...k){if(t.apply(this,arguments)){var b=this.__zoom,E=it(w.changedTouches?w.changedTouches[0]:w,this),T=b.invert(E),O=b.k*(w.shiftKey?.5:2),R=n(g(_(b,O),E,T),e.apply(this,k),s);kn(w),l>0?Je(this).transition().duration(l).call(z,R,E,w):Je(this).call(N.transform,R,E,w)}}function I(w,...k){if(t.apply(this,arguments)){var b=w.touches,E=b.length,T=$(this,k,w.changedTouches.length===E).event(w),O,R,B,P;for(Qi(w),R=0;R<E;++R)B=b[R],P=it(B,this),P=[P,this.__zoom.invert(P),B.identifier],T.touch0?!T.touch1&&T.touch0[2]!==P[2]&&(T.touch1=P,T.taps=0):(T.touch0=P,O=!0,T.taps=1+!!d);d&&(d=clearTimeout(d)),O&&(T.taps<2&&(f=P[0],d=setTimeout(function(){d=null},p)),wo(this),T.start())}}function C(w,...k){if(this.__zooming){var b=$(this,k).event(w),E=w.changedTouches,T=E.length,O,R,B,P;for(kn(w),O=0;O<T;++O)R=E[O],B=it(R,this),b.touch0&&b.touch0[2]===R.identifier?b.touch0[0]=B:b.touch1&&b.touch1[2]===R.identifier&&(b.touch1[0]=B);if(R=b.that.__zoom,b.touch1){var V=b.touch0[0],W=b.touch0[1],Z=b.touch1[0],Q=b.touch1[1],q=(q=Z[0]-V[0])*q+(q=Z[1]-V[1])*q,ee=(ee=Q[0]-W[0])*ee+(ee=Q[1]-W[1])*ee;R=_(R,Math.sqrt(q/ee)),B=[(V[0]+Z[0])/2,(V[1]+Z[1])/2],P=[(W[0]+Q[0])/2,(W[1]+Q[1])/2]}else if(b.touch0)B=b.touch0[0],P=b.touch0[1];else return;b.zoom("touch",n(g(R,B,P),b.extent,s))}}function H(w,...k){if(this.__zooming){var b=$(this,k).event(w),E=w.changedTouches,T=E.length,O,R;for(Qi(w),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),O=0;O<T;++O)R=E[O],b.touch0&&b.touch0[2]===R.identifier?delete b.touch0:b.touch1&&b.touch1[2]===R.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&(R=it(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<v)){var B=Je(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return N.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:_o(+w),N):o},N.filter=function(w){return arguments.length?(t=typeof w=="function"?w:_o(!!w),N):t},N.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:_o(!!w),N):i},N.extent=function(w){return arguments.length?(e=typeof w=="function"?w:_o([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),N):e},N.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],N):[r[0],r[1]]},N.translateExtent=function(w){return arguments.length?(s[0][0]=+w[0][0],s[1][0]=+w[1][0],s[0][1]=+w[0][1],s[1][1]=+w[1][1],N):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},N.constrain=function(w){return arguments.length?(n=w,N):n},N.duration=function(w){return arguments.length?(l=+w,N):l},N.interpolate=function(w){return arguments.length?(u=w,N):u},N.on=function(){var w=c.on.apply(c,arguments);return w===c?N:w},N.clickDistance=function(w){return arguments.length?(m=(w=+w)*w,N):Math.sqrt(m)},N.tapDistance=function(w){return arguments.length?(v=+w,N):v},N}var de=(t=>(t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom",t))(de||{}),er=(t=>(t.Partial="partial",t.Full="full",t))(er||{}),Ot=(t=>(t.Bezier="default",t.SimpleBezier="simple-bezier",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t))(Ot||{}),gt=(t=>(t.Strict="strict",t.Loose="loose",t))(gt||{}),mt=(t=>(t.Arrow="arrow",t.ArrowClosed="arrowclosed",t))(mt||{}),Dn=(t=>(t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal",t))(Dn||{}),ua=(t=>(t.TopLeft="top-left",t.TopCenter="top-center",t.TopRight="top-right",t.BottomLeft="bottom-left",t.BottomCenter="bottom-center",t.BottomRight="bottom-right",t))(ua||{});const xp=["INPUT","SELECT","TEXTAREA"],Ep=typeof document<"u"?document:null;function tr(t){var e,n;const o=((n=(e=t.composedPath)==null?void 0:e.call(t))==null?void 0:n[0])||t.target,i=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,r=typeof o?.closest=="function"?o.closest(".nokey"):null;return xp.includes(o?.nodeName)||i||!!r}function Cp(t){return t.ctrlKey||t.metaKey||t.shiftKey||t.altKey}function fa(t,e,n,o){const i=e.replace("+",`
1
+ (function($e,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):($e=typeof globalThis<"u"?globalThis:$e||self,s($e.DuiUI={},$e.Vue))})(this,(function($e,s){"use strict";const $t=(t,e)=>(t.install=n=>{n.component(t.name,t),e&&e.forEach(o=>{n.component(o.name,o)})},t),Wt=(t="")=>{const e=Date.now(),n=Math.floor(Math.random()*1e9);return t===""?String(n)+String(e):t+"_"+n+String(e)},mi=t=>{if(t===null||typeof t!="object")return t;if(Array.isArray(t))return t.map(mi);const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=mi(t[n]));return e},Sc=t=>{if(Array.isArray(t))t.length=0;else if(t&&typeof t=="object")for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&delete t[e]},yi={},Nc=(t,e,n)=>{n[t]=n[t]||{};const o=Wt();return n[t][o]=e,o},kc=(t,e,n)=>{const o=[],i=n[t]||{};return Object.keys(i).forEach(r=>{const a=i[r];try{a&&o.push(a(e))}catch(l){console.error(l)}}),o},Dc=(t,e,n)=>{if(e){const o=n[t];o&&delete o[e]}else delete n[t]},Lr=(t,e)=>Nc(t,e,yi),Se=(t,e)=>kc(t,e,yi),Tc=(t,e)=>{Dc(t,e,yi)},Fr=(t,e,n,o,i,r)=>{const a=e.id,l=e.level,{getDesignLocals:u,selectComponent:c,getComponent:d,isMyChildComponent:f,addComponent:h,deleteComponent:p,getParentComponents:y,removeComponentFromContainer:m,addComponentToContainer:b,copyComponent:N,activedComponent:_,top:g}=s.inject("d-drag-design-provide",{}),x=[],A=s.ref(!1),$=s.ref(!1),F=s.ref(!1),U=s.ref(!1),G=s.ref(!1),S={id:"",type:""},T=s.ref(!1),E=s.ref(!1);let H="",w=null;const D=q=>{if(H===q)return w;H=q;const{top:ee,left:re,width:ie,height:ce}=t.value.getBoundingClientRect();return w=[{x:re,y:ee},{x:re+ie,y:ee},{x:re+ie,y:ee+ce},{x:re,y:ee+ce}],w},v=(q,ee,re)=>{let ie=ee-re[0].y;ie<0&&(ie=-ie);let ce=ee-re[3].y;ce<0&&(ce=-ce);let oe=q-re[0].x;oe<0&&(oe=-oe);let ae=q-re[1].x;return ae<0&&(ae=-ae),{ly:ie>ce?ce:ie,typey:ie>ce?"bottom":"top",lx:oe>ae?ae:oe,lallx:oe+ae}},C=(q,ee,re)=>q>=re[0].x&&q<=re[1].x&&ee>=re[0].y&&ee<=re[3].y,k=()=>{if(i){Se("dragClick",{id:a});return}if(!$.value){if(c(a),l!==0){const q=t.value.getBoundingClientRect(),ee=u();q.top-ee.top<22?U.value=!0:U.value=!1}$.value=!0,Se("dragClick",{id:a})}},O=q=>{const ee=p(q);ee&&s.nextTick(()=>{Se("dragClick",{id:ee})})},R=()=>{S.id="",S.type="",l===0&&(G.value=!1)},B=()=>{Se("mouseEnterOrLeave",{id:a,type:"enter"})},P=()=>{Se("mouseEnterOrLeave",{id:a,type:"leave"})},L=q=>{Se("dragClick",{id:q})},j={mouseEnterOrLeave:({id:q,type:ee})=>{ee==="enter"?x.push(q):x.length>0&&x.splice(x.length-1,1);const re=x.length;re>0&&a===x[re-1]?A.value=!0:A.value=!1},dragAciveChild:({type:q,id:ee})=>{ee===a?q==="top"?(T.value=!0,E.value=!1):(E.value=!0,T.value=!1):(E.value=!1,T.value=!1)},dragClick({id:q,isAgain:ee}){console.log("dragClick",q,a),q!==a?$.value=!1:(ee&&($.value=!1),k())}};j[`dragGetChildDistance_${a}`]=({dragX:q,dragY:ee,moveId:re})=>{const ie=D(re);return v(q,ee,ie)};const Z={isInContainer({x:q,y:ee,id:re,moveId:ie}){if(a===re||f(re,a))return F.value=!1,{isIn:!1,level:l,id:a,groupId:r};const ce=D(ie);if(C(q,ee,ce))return l===0&&(G.value=!0),{isIn:!0,level:l,id:a,groupId:r};if(l===0){const{ly:oe,lx:ae}=v(q,ee,ce);if(oe<20&&ae<20)return G.value=!0,{isIn:!0,level:l,id:a,groupId:r};G.value=!1}return F.value=!1,{isIn:!1,level:l,id:a,groupId:r}},dragActiveContainer:({containerId:q,containerGroupId:ee,dragX:re,dragY:ie,moveId:ce})=>{if(q===a&&ee===r)if(F.value=!0,o&&o.value.length>0){let oe={ly:9999999,lx:0,lallx:0,id:"",typey:""};o?.value.forEach(ae=>{if(r&&ae.groupId!==r)return;const z=Se(`dragGetChildDistance_${ae.id}`,{dragX:re,dragY:ie,moveId:ce})[0];z&&(oe.ly>z.ly||oe.ly===z.ly&&(oe.lx>z.lx||oe.lx===z.lx&&oe.lallx>z.lallx))&&(oe=z,oe.id=ae.id)}),S.id=oe.id,S.type=oe.typey,Se("dragAciveChild",{id:oe.id,type:oe.typey})}else Se("dragAciveChild",{id:""});else F.value=!1},dragAdd:q=>{if(F.value){let ee=o?.value.length||0;S.id!==""&&S.id!==void 0&&(ee=o?.value.findIndex(re=>re.id===S.id)||0,S.type==="bottom"&&(ee+=1)),h(q,a,ee,r),F.value=!1}R()},dragAddByClick:q=>{if(!_.value&&a===g.id||_.value?.id===a||_.value?.containerId===a&&_.value?.dragType!=="container"){const ee=o?.value.length||0,re=h(q,a,ee,r,!0);re&&q.config&&Object.keys(q.config).forEach(ie=>{re.config[ie]=q.config[ie]})}},dragUpdate(q){if(F.value){const ee=d(q);if(ee.level=l+1,S.id!==ee.id){m(ee.containerId,q);let re=o?.value.findIndex(ie=>ie.id===S.id)||0;S.type==="bottom"&&(re+=1),b(ee,a,re,r)}F.value=!1,s.nextTick(()=>{Se("dragClick",{id:ee.id,isAgain:!0})})}R()}},Q={};return s.onMounted(()=>{(!i||n!=="container")&&Object.keys(j).forEach(q=>{Q[q]=Lr(q,j[q])}),n==="container"&&Object.keys(Z).forEach(q=>{Q[q]=Lr(q,Z[q])}),e.isNewAdd&&s.nextTick(()=>{k(),delete e.isNewAdd})}),s.onUnmounted(()=>{Object.keys(Q).forEach(q=>{Tc(q,Q[q])})}),{onMouseenter:B,onMouseleave:P,activeComponent:k,handleComponentClick:L,deleteComponentByClick:O,copyComponent:N,getParentComponents:y,isBottomToolBar:U,isHover:A,isSelect:$,isToContainer:F,isMoveingInTopLevel:G,isTopActive:T,isBottomActive:E}},jr=(t,e)=>{const n={x:0,y:0,clientX:0,clientY:0,dragElement:null,dragElementId:"jcode-darg-move-id",toContainerLevel:-1,toContainerId:"",groupId:"",id:""};let o=!1;const i=(p,y)=>{o!==!0&&(o=!0,setTimeout(()=>{p(),o=!1},y))},r=s.ref(!1),a=(p,y,m)=>{const b=document.createElement("div");return b.id=n.dragElementId,b.innerText=p,b.className="d-drag-move",b.style.top=`${y}px`,b.style.left=`${m}px`,document.body.appendChild(b),b},l=()=>{document.onmousemove=null,document.onmouseup=null,r.value=!1,Se("dragAciveChild",{id:""})},u=()=>{l(),n.dragElement&&(n.dragElement.remove(),n.dragElement=null,e?Se("dragAdd",t):Se("dragUpdate",t.id))},c=p=>{const{clientY:y,clientX:m}=p;if(!n.dragElement){const b=Math.abs(n.x-m),N=Math.abs(n.y-y);if(b<=1&&N<=1)return;r.value=!0,n.dragElement=a(t.name,y-11,m-32)}n.dragElement.style.top=`${y-11}px`,n.dragElement.style.left=`${m-32}px`,n.clientX=m,n.clientY=y,i(()=>{if(!r.value)return;const b=Se("isInContainer",{x:m,y,id:t.id,moveId:n.id});n.toContainerLevel=-1,n.toContainerId="",n.groupId="",b.forEach(({level:N,id:_,isIn:g,groupId:x})=>{g&&n.toContainerLevel<N&&(n.toContainerLevel=N,n.toContainerId=_,n.groupId=x)}),n.toContainerId!==""?Se("dragActiveContainer",{containerId:n.toContainerId,containerGroupId:n.groupId,dragX:m,dragY:y,moveId:n.id}):Se("dragAciveChild",{id:""})},100)};return{onContextmenu:()=>{l()},onMousedown:p=>{n.x=p.clientX,n.y=p.clientY,n.id=Wt(),document.onmouseup=u,document.onmousemove=c},onClick:()=>{Se("dragAddByClick",t)},moveActive:r}},Ic=t=>(t.install=e=>{e.component(t.name,t)},t),Xn=t=>!!(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0||typeof t=="object"&&Object.keys(t).length===0),Gr=/^[a-z0-9]+(-[a-z0-9]+)*$/,qn=(t,e,n,o="")=>{const i=t.split(":");if(t.slice(0,1)==="@"){if(i.length<2||i.length>3)return null;o=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){const l=i.pop(),u=i.pop(),c={provider:i.length>0?i[0]:o,prefix:u,name:l};return e&&!Kn(c)?null:c}const r=i[0],a=r.split("-");if(a.length>1){const l={provider:o,prefix:a.shift(),name:a.join("-")};return e&&!Kn(l)?null:l}if(n&&o===""){const l={provider:o,prefix:"",name:r};return e&&!Kn(l,n)?null:l}return null},Kn=(t,e)=>t?!!((e&&t.prefix===""||t.prefix)&&t.name):!1,Wr=Object.freeze({left:0,top:0,width:16,height:16}),Zn=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),un=Object.freeze({...Wr,...Zn}),vi=Object.freeze({...un,body:"",hidden:!1});function Mc(t,e){const n={};!t.hFlip!=!e.hFlip&&(n.hFlip=!0),!t.vFlip!=!e.vFlip&&(n.vFlip=!0);const o=((t.rotate||0)+(e.rotate||0))%4;return o&&(n.rotate=o),n}function Yr(t,e){const n=Mc(t,e);for(const o in vi)o in Zn?o in t&&!(o in n)&&(n[o]=Zn[o]):o in e?n[o]=e[o]:o in t&&(n[o]=t[o]);return n}function Bc(t,e){const n=t.icons,o=t.aliases||Object.create(null),i=Object.create(null);function r(a){if(n[a])return i[a]=[];if(!(a in i)){i[a]=null;const l=o[a]&&o[a].parent,u=l&&r(l);u&&(i[a]=[l].concat(u))}return i[a]}return Object.keys(n).concat(Object.keys(o)).forEach(r),i}function $c(t,e,n){const o=t.icons,i=t.aliases||Object.create(null);let r={};function a(l){r=Yr(o[l]||i[l],r)}return a(e),n.forEach(a),Yr(t,r)}function Ur(t,e){const n=[];if(typeof t!="object"||typeof t.icons!="object")return n;t.not_found instanceof Array&&t.not_found.forEach(i=>{e(i,null),n.push(i)});const o=Bc(t);for(const i in o){const r=o[i];r&&(e(i,$c(t,i,r)),n.push(i))}return n}const zc={provider:"",aliases:{},not_found:{},...Wr};function bi(t,e){for(const n in e)if(n in t&&typeof t[n]!=typeof e[n])return!1;return!0}function Xr(t){if(typeof t!="object"||t===null)return null;const e=t;if(typeof e.prefix!="string"||!t.icons||typeof t.icons!="object"||!bi(t,zc))return null;const n=e.icons;for(const i in n){const r=n[i];if(!i||typeof r.body!="string"||!bi(r,vi))return null}const o=e.aliases||Object.create(null);for(const i in o){const r=o[i],a=r.parent;if(!i||typeof a!="string"||!n[a]&&!o[a]||!bi(r,vi))return null}return e}const qr=Object.create(null);function Ac(t,e){return{provider:t,prefix:e,icons:Object.create(null),missing:new Set}}function Yt(t,e){const n=qr[t]||(qr[t]=Object.create(null));return n[e]||(n[e]=Ac(t,e))}function Kr(t,e){return Xr(e)?Ur(e,(n,o)=>{o?t.icons[n]=o:t.missing.add(n)}):[]}function Pc(t,e,n){try{if(typeof n.body=="string")return t.icons[e]={...n},!0}catch{}return!1}let fn=!1;function Zr(t){return typeof t=="boolean"&&(fn=t),fn}function Jr(t){const e=typeof t=="string"?qn(t,!0,fn):t;if(e){const n=Yt(e.provider,e.prefix),o=e.name;return n.icons[o]||(n.missing.has(o)?null:void 0)}}function Oc(t,e){const n=qn(t,!0,fn);if(!n)return!1;const o=Yt(n.provider,n.prefix);return e?Pc(o,n.name,e):(o.missing.add(n.name),!0)}function Rc(t,e){if(typeof t!="object")return!1;if(typeof e!="string"&&(e=t.provider||""),fn&&!e&&!t.prefix){let i=!1;return Xr(t)&&(t.prefix="",Ur(t,(r,a)=>{Oc(r,a)&&(i=!0)})),i}const n=t.prefix;if(!Kn({prefix:n,name:"a"}))return!1;const o=Yt(e,n);return!!Kr(o,t)}function Qr(t){const e=Jr(t);return e&&{...un,...e}}const es=Object.freeze({width:null,height:null}),ts=Object.freeze({...es,...Zn}),Hc=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Vc=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ns(t,e,n){if(e===1)return t;if(n=n||100,typeof t=="number")return Math.ceil(t*e*n)/n;if(typeof t!="string")return t;const o=t.split(Hc);if(o===null||!o.length)return t;const i=[];let r=o.shift(),a=Vc.test(r);for(;;){if(a){const l=parseFloat(r);isNaN(l)?i.push(r):i.push(Math.ceil(l*e*n)/n)}else i.push(r);if(r=o.shift(),r===void 0)return i.join("");a=!a}}function Lc(t,e="defs"){let n="";const o=t.indexOf("<"+e);for(;o>=0;){const i=t.indexOf(">",o),r=t.indexOf("</"+e);if(i===-1||r===-1)break;const a=t.indexOf(">",r);if(a===-1)break;n+=t.slice(i+1,r).trim(),t=t.slice(0,o).trim()+t.slice(a+1)}return{defs:n,content:t}}function Fc(t,e){return t?"<defs>"+t+"</defs>"+e:e}function jc(t,e,n){const o=Lc(t);return Fc(o.defs,e+o.content+n)}const Gc=t=>t==="unset"||t==="undefined"||t==="none";function Wc(t,e){const n={...un,...t},o={...ts,...e},i={left:n.left,top:n.top,width:n.width,height:n.height};let r=n.body;[n,o].forEach(m=>{const b=[],N=m.hFlip,_=m.vFlip;let g=m.rotate;N?_?g+=2:(b.push("translate("+(i.width+i.left).toString()+" "+(0-i.top).toString()+")"),b.push("scale(-1 1)"),i.top=i.left=0):_&&(b.push("translate("+(0-i.left).toString()+" "+(i.height+i.top).toString()+")"),b.push("scale(1 -1)"),i.top=i.left=0);let x;switch(g<0&&(g-=Math.floor(g/4)*4),g=g%4,g){case 1:x=i.height/2+i.top,b.unshift("rotate(90 "+x.toString()+" "+x.toString()+")");break;case 2:b.unshift("rotate(180 "+(i.width/2+i.left).toString()+" "+(i.height/2+i.top).toString()+")");break;case 3:x=i.width/2+i.left,b.unshift("rotate(-90 "+x.toString()+" "+x.toString()+")");break}g%2===1&&(i.left!==i.top&&(x=i.left,i.left=i.top,i.top=x),i.width!==i.height&&(x=i.width,i.width=i.height,i.height=x)),b.length&&(r=jc(r,'<g transform="'+b.join(" ")+'">',"</g>"))});const a=o.width,l=o.height,u=i.width,c=i.height;let d,f;a===null?(f=l===null?"1em":l==="auto"?c:l,d=ns(f,u/c)):(d=a==="auto"?u:a,f=l===null?ns(d,c/u):l==="auto"?c:l);const h={},p=(m,b)=>{Gc(b)||(h[m]=b.toString())};p("width",d),p("height",f);const y=[i.left,i.top,u,c];return h.viewBox=y.join(" "),{attributes:h,viewBox:y,body:r}}const Yc=/\sid="(\S+)"/g,Uc="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Xc=0;function qc(t,e=Uc){const n=[];let o;for(;o=Yc.exec(t);)n.push(o[1]);if(!n.length)return t;const i="suffix"+(Math.random()*16777216|Date.now()).toString(16);return n.forEach(r=>{const a=typeof e=="function"?e(r):e+(Xc++).toString(),l=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+l+')([")]|\\.[a-z])',"g"),"$1"+a+i+"$3")}),t=t.replace(new RegExp(i,"g"),""),t}const wi=Object.create(null);function Kc(t,e){wi[t]=e}function _i(t){return wi[t]||wi[""]}function xi(t){let e;if(typeof t.resources=="string")e=[t.resources];else if(e=t.resources,!(e instanceof Array)||!e.length)return null;return{resources:e,path:t.path||"/",maxURL:t.maxURL||500,rotate:t.rotate||750,timeout:t.timeout||5e3,random:t.random===!0,index:t.index||0,dataAfterTimeout:t.dataAfterTimeout!==!1}}const Ci=Object.create(null),hn=["https://api.simplesvg.com","https://api.unisvg.com"],Jn=[];for(;hn.length>0;)hn.length===1||Math.random()>.5?Jn.push(hn.shift()):Jn.push(hn.pop());Ci[""]=xi({resources:["https://api.iconify.design"].concat(Jn)});function Zc(t,e){const n=xi(e);return n===null?!1:(Ci[t]=n,!0)}function Ei(t){return Ci[t]}let os=(()=>{let t;try{if(t=fetch,typeof t=="function")return t}catch{}})();function Jc(t,e){const n=Ei(t);if(!n)return 0;let o;if(!n.maxURL)o=0;else{let i=0;n.resources.forEach(a=>{i=Math.max(i,a.length)});const r=e+".json?icons=";o=n.maxURL-i-n.path.length-r.length}return o}function Qc(t){return t===404}const ed=(t,e,n)=>{const o=[],i=Jc(t,e),r="icons";let a={type:r,provider:t,prefix:e,icons:[]},l=0;return n.forEach((u,c)=>{l+=u.length+1,l>=i&&c>0&&(o.push(a),a={type:r,provider:t,prefix:e,icons:[]},l=u.length),a.icons.push(u)}),o.push(a),o};function td(t){if(typeof t=="string"){const e=Ei(t);if(e)return e.path}return"/"}const nd={prepare:ed,send:(t,e,n)=>{if(!os){n("abort",424);return}let o=td(e.provider);switch(e.type){case"icons":{const r=e.prefix,l=e.icons.join(","),u=new URLSearchParams({icons:l});o+=r+".json?"+u.toString();break}case"custom":{const r=e.uri;o+=r.slice(0,1)==="/"?r.slice(1):r;break}default:n("abort",400);return}let i=503;os(t+o).then(r=>{const a=r.status;if(a!==200){setTimeout(()=>{n(Qc(a)?"abort":"next",a)});return}return i=501,r.json()}).then(r=>{if(typeof r!="object"||r===null){setTimeout(()=>{r===404?n("abort",r):n("next",i)});return}setTimeout(()=>{n("success",r)})}).catch(()=>{n("next",i)})}};function od(t){const e={loaded:[],missing:[],pending:[]},n=Object.create(null);t.sort((i,r)=>i.provider!==r.provider?i.provider.localeCompare(r.provider):i.prefix!==r.prefix?i.prefix.localeCompare(r.prefix):i.name.localeCompare(r.name));let o={provider:"",prefix:"",name:""};return t.forEach(i=>{if(o.name===i.name&&o.prefix===i.prefix&&o.provider===i.provider)return;o=i;const r=i.provider,a=i.prefix,l=i.name,u=n[r]||(n[r]=Object.create(null)),c=u[a]||(u[a]=Yt(r,a));let d;l in c.icons?d=e.loaded:a===""||c.missing.has(l)?d=e.missing:d=e.pending;const f={provider:r,prefix:a,name:l};d.push(f)}),e}function is(t,e){t.forEach(n=>{const o=n.loaderCallbacks;o&&(n.loaderCallbacks=o.filter(i=>i.id!==e))})}function id(t){t.pendingCallbacksFlag||(t.pendingCallbacksFlag=!0,setTimeout(()=>{t.pendingCallbacksFlag=!1;const e=t.loaderCallbacks?t.loaderCallbacks.slice(0):[];if(!e.length)return;let n=!1;const o=t.provider,i=t.prefix;e.forEach(r=>{const a=r.icons,l=a.pending.length;a.pending=a.pending.filter(u=>{if(u.prefix!==i)return!0;const c=u.name;if(t.icons[c])a.loaded.push({provider:o,prefix:i,name:c});else if(t.missing.has(c))a.missing.push({provider:o,prefix:i,name:c});else return n=!0,!0;return!1}),a.pending.length!==l&&(n||is([t],r.id),r.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),r.abort))})}))}let rd=0;function sd(t,e,n){const o=rd++,i=is.bind(null,n,o);if(!e.pending.length)return i;const r={id:o,icons:e,callback:t,abort:i};return n.forEach(a=>{(a.loaderCallbacks||(a.loaderCallbacks=[])).push(r)}),i}function ad(t,e=!0,n=!1){const o=[];return t.forEach(i=>{const r=typeof i=="string"?qn(i,e,n):i;r&&o.push(r)}),o}var ld={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function cd(t,e,n,o){const i=t.resources.length,r=t.random?Math.floor(Math.random()*i):t.index;let a;if(t.random){let $=t.resources.slice(0);for(a=[];$.length>1;){const F=Math.floor(Math.random()*$.length);a.push($[F]),$=$.slice(0,F).concat($.slice(F+1))}a=a.concat($)}else a=t.resources.slice(r).concat(t.resources.slice(0,r));const l=Date.now();let u="pending",c=0,d,f=null,h=[],p=[];typeof o=="function"&&p.push(o);function y(){f&&(clearTimeout(f),f=null)}function m(){u==="pending"&&(u="aborted"),y(),h.forEach($=>{$.status==="pending"&&($.status="aborted")}),h=[]}function b($,F){F&&(p=[]),typeof $=="function"&&p.push($)}function N(){return{startTime:l,payload:e,status:u,queriesSent:c,queriesPending:h.length,subscribe:b,abort:m}}function _(){u="failed",p.forEach($=>{$(void 0,d)})}function g(){h.forEach($=>{$.status==="pending"&&($.status="aborted")}),h=[]}function x($,F,U){const G=F!=="success";switch(h=h.filter(S=>S!==$),u){case"pending":break;case"failed":if(G||!t.dataAfterTimeout)return;break;default:return}if(F==="abort"){d=U,_();return}if(G){d=U,h.length||(a.length?A():_());return}if(y(),g(),!t.random){const S=t.resources.indexOf($.resource);S!==-1&&S!==t.index&&(t.index=S)}u="completed",p.forEach(S=>{S(U)})}function A(){if(u!=="pending")return;y();const $=a.shift();if($===void 0){if(h.length){f=setTimeout(()=>{y(),u==="pending"&&(g(),_())},t.timeout);return}_();return}const F={status:"pending",resource:$,callback:(U,G)=>{x(F,U,G)}};h.push(F),c++,f=setTimeout(A,t.rotate),n($,e,F.callback)}return setTimeout(A),N}function rs(t){const e={...ld,...t};let n=[];function o(){n=n.filter(l=>l().status==="pending")}function i(l,u,c){const d=cd(e,l,u,(f,h)=>{o(),c&&c(f,h)});return n.push(d),d}function r(l){return n.find(u=>l(u))||null}return{query:i,find:r,setIndex:l=>{e.index=l},getIndex:()=>e.index,cleanup:o}}function ss(){}const Si=Object.create(null);function dd(t){if(!Si[t]){const e=Ei(t);if(!e)return;const n=rs(e),o={config:e,redundancy:n};Si[t]=o}return Si[t]}function ud(t,e,n){let o,i;if(typeof t=="string"){const r=_i(t);if(!r)return n(void 0,424),ss;i=r.send;const a=dd(t);a&&(o=a.redundancy)}else{const r=xi(t);if(r){o=rs(r);const a=t.resources?t.resources[0]:"",l=_i(a);l&&(i=l.send)}}return!o||!i?(n(void 0,424),ss):o.query(e,i,n)().abort}function as(){}function fd(t){t.iconsLoaderFlag||(t.iconsLoaderFlag=!0,setTimeout(()=>{t.iconsLoaderFlag=!1,id(t)}))}function hd(t){const e=[],n=[];return t.forEach(o=>{(o.match(Gr)?e:n).push(o)}),{valid:e,invalid:n}}function pn(t,e,n){function o(){const i=t.pendingIcons;e.forEach(r=>{i&&i.delete(r),t.icons[r]||t.missing.add(r)})}if(n&&typeof n=="object")try{if(!Kr(t,n).length){o();return}}catch(i){console.error(i)}o(),fd(t)}function ls(t,e){t instanceof Promise?t.then(n=>{e(n)}).catch(()=>{e(null)}):e(t)}function pd(t,e){t.iconsToLoad?t.iconsToLoad=t.iconsToLoad.concat(e).sort():t.iconsToLoad=e,t.iconsQueueFlag||(t.iconsQueueFlag=!0,setTimeout(()=>{t.iconsQueueFlag=!1;const{provider:n,prefix:o}=t,i=t.iconsToLoad;if(delete t.iconsToLoad,!i||!i.length)return;const r=t.loadIcon;if(t.loadIcons&&(i.length>1||!r)){ls(t.loadIcons(i,o,n),d=>{pn(t,i,d)});return}if(r){i.forEach(d=>{const f=r(d,o,n);ls(f,h=>{const p=h?{prefix:o,icons:{[d]:h}}:null;pn(t,[d],p)})});return}const{valid:a,invalid:l}=hd(i);if(l.length&&pn(t,l,null),!a.length)return;const u=o.match(Gr)?_i(n):null;if(!u){pn(t,a,null);return}u.prepare(n,o,a).forEach(d=>{ud(n,d,f=>{pn(t,d.icons,f)})})}))}const gd=(t,e)=>{const n=ad(t,!0,Zr()),o=od(n);if(!o.pending.length){let u=!0;return e&&setTimeout(()=>{u&&e(o.loaded,o.missing,o.pending,as)}),()=>{u=!1}}const i=Object.create(null),r=[];let a,l;return o.pending.forEach(u=>{const{provider:c,prefix:d}=u;if(d===l&&c===a)return;a=c,l=d,r.push(Yt(c,d));const f=i[c]||(i[c]=Object.create(null));f[d]||(f[d]=[])}),o.pending.forEach(u=>{const{provider:c,prefix:d,name:f}=u,h=Yt(c,d),p=h.pendingIcons||(h.pendingIcons=new Set);p.has(f)||(p.add(f),i[c][d].push(f))}),r.forEach(u=>{const c=i[u.provider][u.prefix];c.length&&pd(u,c)}),e?sd(e,o,r):as};function md(t,e){const n={...t};for(const o in e){const i=e[o],r=typeof i;o in es?(i===null||i&&(r==="string"||r==="number"))&&(n[o]=i):r===typeof n[o]&&(n[o]=o==="rotate"?i%4:i)}return n}const yd=/[\s,]+/;function vd(t,e){e.split(yd).forEach(n=>{switch(n.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function bd(t,e=0){const n=t.replace(/^-?[0-9.]*/,"");function o(i){for(;i<0;)i+=4;return i%4}if(n===""){const i=parseInt(t);return isNaN(i)?0:o(i)}else if(n!==t){let i=0;switch(n){case"%":i=25;break;case"deg":i=90}if(i){let r=parseFloat(t.slice(0,t.length-n.length));return isNaN(r)?0:(r=r/i,r%1===0?o(r):0)}}return e}function wd(t,e){let n=t.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const o in e)n+=" "+o+'="'+e[o]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+n+">"+t+"</svg>"}function _d(t){return t.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function xd(t){return"data:image/svg+xml,"+_d(t)}function Cd(t){return'url("'+xd(t)+'")'}const cs={...ts,inline:!1},Ed={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},Sd={display:"inline-block"},Ni={backgroundColor:"currentColor"},ds={backgroundColor:"transparent"},us={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},fs={webkitMask:Ni,mask:Ni,background:ds};for(const t in fs){const e=fs[t];for(const n in us)e[t+n]=us[n]}const Qn={};["horizontal","vertical"].forEach(t=>{const e=t.slice(0,1)+"Flip";Qn[t+"-flip"]=e,Qn[t.slice(0,1)+"-flip"]=e,Qn[t+"Flip"]=e});function hs(t){return t+(t.match(/^[-0-9.]+$/)?"px":"")}const ps=(t,e)=>{const n=md(cs,e),o={...Ed},i=e.mode||"svg",r={},a=e.style,l=typeof a=="object"&&!(a instanceof Array)?a:{};for(let m in e){const b=e[m];if(b!==void 0)switch(m){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":n[m]=b===!0||b==="true"||b===1;break;case"flip":typeof b=="string"&&vd(n,b);break;case"color":r.color=b;break;case"rotate":typeof b=="string"?n[m]=bd(b):typeof b=="number"&&(n[m]=b);break;case"ariaHidden":case"aria-hidden":b!==!0&&b!=="true"&&delete o["aria-hidden"];break;default:{const N=Qn[m];N?(b===!0||b==="true"||b===1)&&(n[N]=!0):cs[m]===void 0&&(o[m]=b)}}}const u=Wc(t,n),c=u.attributes;if(n.inline&&(r.verticalAlign="-0.125em"),i==="svg"){o.style={...r,...l},Object.assign(o,c);let m=0,b=e.id;return typeof b=="string"&&(b=b.replace(/-/g,"_")),o.innerHTML=qc(u.body,b?()=>b+"ID"+m++:"iconifyVue"),s.h("svg",o)}const{body:d,width:f,height:h}=t,p=i==="mask"||(i==="bg"?!1:d.indexOf("currentColor")!==-1),y=wd(d,{...c,width:f+"",height:h+""});return o.style={...r,"--svg":Cd(y),width:hs(c.width),height:hs(c.height),...Sd,...p?Ni:ds,...l},s.h("span",o)};if(Zr(!0),Kc("",nd),typeof document<"u"&&typeof window<"u"){const t=window;if(t.IconifyPreload!==void 0){const e=t.IconifyPreload,n="Invalid IconifyPreload syntax.";typeof e=="object"&&e!==null&&(e instanceof Array?e:[e]).forEach(o=>{try{(typeof o!="object"||o===null||o instanceof Array||typeof o.icons!="object"||typeof o.prefix!="string"||!Rc(o))&&console.error(n)}catch{console.error(n)}})}if(t.IconifyProviders!==void 0){const e=t.IconifyProviders;if(typeof e=="object"&&e!==null)for(let n in e){const o="IconifyProviders["+n+"] is invalid.";try{const i=e[n];if(typeof i!="object"||!i||i.resources===void 0)continue;Zc(n,i)||console.error(o)}catch{console.error(o)}}}}const Nd={...un,body:""},gs=s.defineComponent((t,{emit:e})=>{const n=s.ref(null);function o(){n.value&&(n.value.abort?.(),n.value=null)}const i=s.ref(!!t.ssr),r=s.ref(""),a=s.shallowRef(null);function l(){const c=t.icon;if(typeof c=="object"&&c!==null&&typeof c.body=="string")return r.value="",{data:c};let d;if(typeof c!="string"||(d=qn(c,!1,!0))===null)return null;let f=Jr(d);if(!f){const y=n.value;return(!y||y.name!==c)&&(f===null?n.value={name:c}:n.value={name:c,abort:gd([d],u)}),null}o(),r.value!==c&&(r.value=c,s.nextTick(()=>{e("load",c)}));const h=t.customise;if(h){f=Object.assign({},f);const y=h(f.body,d.name,d.prefix,d.provider);typeof y=="string"&&(f.body=y)}const p=["iconify"];return d.prefix!==""&&p.push("iconify--"+d.prefix),d.provider!==""&&p.push("iconify--"+d.provider),{data:f,classes:p}}function u(){const c=l();c?c.data!==a.value?.data&&(a.value=c):a.value=null}return i.value?u():s.onMounted(()=>{i.value=!0,u()}),s.watch(()=>t.icon,u),s.onUnmounted(o),()=>{const c=a.value;if(!c)return ps(Nd,t);let d=t;return c.classes&&(d={...t,class:c.classes.join(" ")}),ps({...un,...c.data},d)}},{props:["icon","mode","ssr","width","height","style","color","inline","rotate","hFlip","horizontalFlip","vFlip","verticalFlip","flip","id","ariaHidden","customise","title"],emits:["load"]}),gn=s.defineComponent({name:"JIcon",inheritAttrs:!1,__name:"icon",props:{icon:{},size:{default:16},color:{default:void 0},rotate:{default:void 0},isDiv:{type:Boolean,default:!0}},setup(t){const e=t,n=s.computed(()=>{const i=e.icon;if(i.indexOf(":")===-1)return Qr(`jcode:${e.icon}`)==null,`jcode:${e.icon}`;const a=`jcode:${i.split(":")[1]}`;return Qr(a)!=null?a:i}),o=s.computed(()=>({size:e.size,color:e.color,icon:n.value}));return(i,r)=>t.isDiv?(s.openBlock(),s.createElementBlock("div",s.mergeProps({key:0},i.$attrs,{class:"j-icon jicon",style:{height:`${t.size}px`}}),[s.createVNode(s.unref(gs),s.mergeProps(o.value,{height:`${t.size}px`,width:`${t.size}px`,mode:"svg",style:`transform:rotate(${t.rotate||0}deg)`}),null,16,["height","width","style"])],16)):(s.openBlock(),s.createElementBlock("span",s.mergeProps({key:1},i.$attrs,{class:"jicon"}),[s.createVNode(s.unref(gs),s.mergeProps(o.value,{height:`${t.size}px`,width:`${t.size}px`,mode:"svg",style:`transform:rotate(${t.rotate||0}deg)`}),null,16,["height","width","style"])],16))}}),kd=["disabled"],Dd={key:2},Ut=Ic(s.defineComponent({name:"JButton",__name:"button",props:{type:{default:"default"},size:{default:"default"},shape:{default:"default"},ghost:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},danger:{type:Boolean,default:!1},block:{type:Boolean,default:!1},loading:{type:[Boolean,Object],default:!1},icon:{default:""},href:{default:""},target:{default:"_self"},label:{default:""},notLabel:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},lastCompactItem:{type:Boolean,default:!1},firstCompactItem:{type:Boolean,default:!1}},emits:["click"],setup(t,{expose:e,emit:n}){const o=t,i=n,r=h=>{!d.value&&!o.disabled&&(i("click",h),o.href&&window.open(o.href,o.target?o.target:"_self"))},a=s.shallowRef(null),l=()=>{a.value?.focus()},u=()=>{a.value?.blur()},c=s.computed(()=>o.notLabel||!o.label),d=s.ref(!1);s.watch(()=>o.loading,h=>{if(typeof h=="boolean")d.value=h;else if(Xn(h?.delay))d.value=!1;else{const p=setTimeout(()=>{d.value=!0},h.delay);return()=>clearTimeout(p)}},{immediate:!0});const f=s.computed(()=>o.label||"");return e({focus:l,blur:u}),(h,p)=>(s.openBlock(),s.createElementBlock("button",{ref_key:"buttonNodeRef",ref:a,type:"button",class:s.normalizeClass(["j-button",{"j-button-primary":t.type=="primary","j-button-default":t.type=="default","j-button-dashed":t.type=="dashed","j-button-link":t.type=="link","j-button-text":t.type=="text","j-button-ghost":t.ghost==!0,"j-button-danger":t.danger==!0,"j-button-lg":t.size=="large","j-button-sm":t.size=="small","j-button-circle":t.shape=="circle","j-button-round":t.shape=="round","j-button-block":t.block==!0,"j-button-loading":d.value==!0,"j-button-icon-only":c.value==!0,"j-button-compact":t.compact==!0,"j-button-last-compact-item":t.lastCompactItem==!0,"j-button-first-compact-item":t.firstCompactItem==!0}]),disabled:t.disabled,onClick:s.withModifiers(r,["stop"])},[d.value?(s.openBlock(),s.createBlock(gn,{key:0,icon:"mdi:loading",size:t.size=="large"?14:12,class:"loading-spin j-button-loading-icon"},null,8,["size"])):s.createCommentVNode("",!0),t.icon?(s.openBlock(),s.createBlock(gn,{key:1,icon:t.icon},null,8,["icon"])):s.createCommentVNode("",!0),t.notLabel?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",Dd,s.toDisplayString(f.value),1)),s.renderSlot(h.$slots,"iconAfter")],10,kd))}})),Td={class:"d-drag-btns-pname"},Id={key:0,class:"d-drag-mask"},ki=s.defineComponent({name:"DDrag",__name:"drag",props:{componentData:{default:()=>({})},isContainer:{type:Boolean,default:!1}},setup(t){const e=t,n=s.ref(),{onMouseenter:o,onMouseleave:i,activeComponent:r,handleComponentClick:a,deleteComponentByClick:l,copyComponent:u,getParentComponents:c,isHover:d,isSelect:f,isTopActive:h,isBottomActive:p,isBottomToolBar:y}=Fr(n,e.componentData,"component"),{onContextmenu:m,onMousedown:b,moveActive:N}=jr(e.componentData,!1);return(_,g)=>{const x=s.resolveComponent("el-space");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["d-drag-component",{selected:s.unref(f),hovered:s.unref(d),isBottomToolBar:s.unref(y),active:s.unref(N),isTopActive:s.unref(h),isBottomActive:s.unref(p)}])},[g[11]||(g[11]=s.createElementVNode("div",{class:"d-drag-line"},null,-1)),s.createElementVNode("div",{class:"d-drag-btns",onMouseenter:g[4]||(g[4]=(...A)=>s.unref(o)&&s.unref(o)(...A)),onMouseleave:g[5]||(g[5]=(...A)=>s.unref(i)&&s.unref(i)(...A))},[s.createVNode(x,{size:4},{default:s.withCtx(()=>[s.createElementVNode("div",{class:"d-drag-btns-names",onClick:s.withModifiers(()=>{},["stop"])},[s.createVNode(s.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"]),s.createElementVNode("div",Td,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(c)(t.componentData.containerId),A=>(s.openBlock(),s.createElementBlock("div",{key:A.id},[s.createVNode(s.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",label:A.name,onClick:$=>s.unref(a)(A.id)},null,8,["label","onClick"])]))),128))])]),s.createVNode(s.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:content-copy",onClick:g[0]||(g[0]=s.withModifiers(A=>s.unref(u)(t.componentData.id),["stop"]))}),s.createElementVNode("div",{onContextmenu:g[1]||(g[1]=s.withModifiers((...A)=>s.unref(m)&&s.unref(m)(...A),["stop"])),onMousedown:g[2]||(g[2]=s.withModifiers((...A)=>s.unref(b)&&s.unref(b)(...A),["stop"])),style:{display:"flex"}},[s.createVNode(s.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",icon:"mdi:drag"})],32),s.createVNode(s.unref(Ut),{class:"d-drag-btn",danger:"",type:"primary",size:"small",icon:"mdi:delete",onClick:g[3]||(g[3]=s.withModifiers(A=>s.unref(l)(t.componentData.id),["stop"]))})]),_:1})],32),s.createElementVNode("div",{ref_key:"refDrag",ref:n,class:"d-drag-body",onClick:g[6]||(g[6]=s.withModifiers((...A)=>s.unref(r)&&s.unref(r)(...A),["stop"])),onContextmenu:g[7]||(g[7]=s.withModifiers((...A)=>s.unref(m)&&s.unref(m)(...A),["stop"])),onMousedown:g[8]||(g[8]=s.withModifiers((...A)=>s.unref(b)&&s.unref(b)(...A),["stop"])),onMouseenter:g[9]||(g[9]=(...A)=>s.unref(o)&&s.unref(o)(...A)),onMouseleave:g[10]||(g[10]=(...A)=>s.unref(i)&&s.unref(i)(...A))},[s.renderSlot(_.$slots,"default"),t.isContainer?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",Id))],544)],2)}}}),Di=s.defineComponent({name:"DDragTool",__name:"tool",props:{config:{}},setup(t){const e=t,{onContextmenu:n,onMousedown:o,onClick:i}=jr(e.config??{name:"",id:""},!0);return(r,a)=>(s.openBlock(),s.createElementBlock("div",{class:"d-drag-tool",onClick:a[0]||(a[0]=s.withModifiers((...l)=>s.unref(i)&&s.unref(i)(...l),["stop"])),onContextmenu:a[1]||(a[1]=s.withModifiers((...l)=>s.unref(n)&&s.unref(n)(...l),["stop"])),onMousedown:a[2]||(a[2]=s.withModifiers((...l)=>s.unref(o)&&s.unref(o)(...l),["stop"]))},[s.renderSlot(r.$slots,"default")],32))}}),Md={key:0,class:"d-drag-line"},Bd={key:1,class:"d-drag-btns"},Ti=s.defineComponent({name:"DDragContainer",__name:"container",props:{componentData:{default:()=>({})},isComponentContainer:{type:Boolean,default:!0},groupId:{default:void 0}},setup(t){const e=t,n=s.ref(),o=s.computed(()=>e.componentData?.children||[]),{onMouseenter:i,onMouseleave:r,activeComponent:a,isHover:l,isSelect:u,isToContainer:c,isMoveingInTopLevel:d,isTopActive:f,isBottomActive:h}=Fr(n,e.componentData,"container",o,e.isComponentContainer,e.groupId),p=s.computed(()=>!!(o.value.findIndex(y=>y.groupId===e.groupId)===-1&&c.value));return(y,m)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"refDrag",ref:n,class:s.normalizeClass(["d-drag-container",{selected:s.unref(u)&&!t.isComponentContainer,hovered:s.unref(l)&&!t.isComponentContainer,isTopLevel:t.componentData.level===0,active:p.value,isMoveingInTopLevel:s.unref(d),isTopActive:s.unref(f),isBottomActive:s.unref(h)}])},[t.isComponentContainer?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",Md)),t.isComponentContainer?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",Bd,[s.createElementVNode("div",{class:"d-drag-btns-names",onClick:s.withModifiers(()=>{},["stop"])},[s.createVNode(s.unref(Ut),{class:"d-drag-btn",type:"primary",size:"small",label:t.componentData.name},null,8,["label"])])])),s.createElementVNode("div",{class:"d-drag-body",onClick:m[0]||(m[0]=s.withModifiers((...b)=>s.unref(a)&&s.unref(a)(...b),["stop"])),onMouseenter:m[1]||(m[1]=(...b)=>s.unref(i)&&s.unref(i)(...b)),onMouseleave:m[2]||(m[2]=(...b)=>s.unref(r)&&s.unref(r)(...b))},[s.renderSlot(y.$slots,"default")],32)],2))}}),Ii=s.defineComponent({name:"DDragFormList",__name:"dragFormList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=s.inject("dui-design-provide",{});return(n,o)=>{const i=s.resolveComponent("el-col");return s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.componentList,r=>(s.openBlock(),s.createElementBlock(s.Fragment,{key:r.id},[r.type!="pkey"?(s.openBlock(),s.createBlock(i,{key:0,span:r.config.span||24},{default:s.withCtx(()=>[s.createVNode(ki,{"is-container":r.dragType!=="component","component-data":r},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(e)),{"component-data":r,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["is-container","component-data"])]),_:2},1032,["span"])):s.createCommentVNode("",!0)],64))),128)}}}),Mi=s.defineComponent({name:"DDragIndexList",__name:"dragIndexList",props:{componentList:{default:()=>[]},globalConfig:{default:()=>({})}},setup(t){const{designItemName:e}=s.inject("dui-design-provide",{}),n=o=>{if(o.flexWidth)return{width:o.flexWidth+"%"}};return(o,i)=>(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.componentList,r=>(s.openBlock(),s.createBlock(ki,{key:r.id,style:s.normalizeStyle(n(r.config)),"is-container":r.dragType!=="component","component-data":r},{default:s.withCtx(()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(e)),{"component-data":r,"global-config":t.globalConfig},null,8,["component-data","global-config"]))]),_:2},1032,["style","is-container","component-data"]))),128))}}),ms=$t(ki,[Di,Ti,Ii,Mi]);function mn(t){return s.getCurrentScope()?(s.onScopeDispose(t),!0):!1}function ut(t){return typeof t=="function"?t():s.unref(t)}const $d=typeof window<"u"&&typeof document<"u",zd=t=>typeof t<"u",Ad=Object.prototype.toString,Pd=t=>Ad.call(t)==="[object Object]",Od=()=>{};function Rd(t,e){function n(...o){return new Promise((i,r)=>{Promise.resolve(t(()=>e.apply(this,o),{fn:e,thisArg:this,args:o})).then(i).catch(r)})}return n}const ys=t=>t();function Hd(t=ys){const e=s.ref(!0);function n(){e.value=!1}function o(){e.value=!0}const i=(...r)=>{e.value&&t(...r)};return{isActive:s.readonly(e),pause:n,resume:o,eventFilter:i}}function vs(t,e=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(e?()=>i(n):o,t)})}function Vd(t,e,n={}){const{eventFilter:o=ys,...i}=n;return s.watch(t,Rd(o,e),i)}function Xt(t,e,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:a,resume:l,isActive:u}=Hd(o);return{stop:Vd(t,e,{...i,eventFilter:r}),pause:a,resume:l,isActive:u}}function Ld(t,e={}){if(!s.isRef(t))return s.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const o in t.value)n[o]=s.customRef(()=>({get(){return t.value[o]},set(i){var r;if((r=ut(e.replaceRef))!=null?r:!0)if(Array.isArray(t.value)){const l=[...t.value];l[o]=i,t.value=l}else{const l={...t.value,[o]:i};Object.setPrototypeOf(l,Object.getPrototypeOf(t.value)),t.value=l}else t.value[o]=i}}));return n}function Bi(t,e=!1){function n(f,{flush:h="sync",deep:p=!1,timeout:y,throwOnTimeout:m}={}){let b=null;const _=[new Promise(g=>{b=s.watch(t,x=>{f(x)!==e&&(b?.(),g(x))},{flush:h,deep:p,immediate:!0})})];return y!=null&&_.push(vs(y,m).then(()=>ut(t)).finally(()=>b?.())),Promise.race(_)}function o(f,h){if(!s.isRef(f))return n(x=>x===f,h);const{flush:p="sync",deep:y=!1,timeout:m,throwOnTimeout:b}=h??{};let N=null;const g=[new Promise(x=>{N=s.watch([t,f],([A,$])=>{e!==(A===$)&&(N?.(),x(A))},{flush:p,deep:y,immediate:!0})})];return m!=null&&g.push(vs(m,b).then(()=>ut(t)).finally(()=>(N?.(),ut(t)))),Promise.race(g)}function i(f){return n(h=>!!h,f)}function r(f){return o(null,f)}function a(f){return o(void 0,f)}function l(f){return n(Number.isNaN,f)}function u(f,h){return n(p=>{const y=Array.from(p);return y.includes(f)||y.includes(ut(f))},h)}function c(f){return d(1,f)}function d(f=1,h){let p=-1;return n(()=>(p+=1,p>=f),h)}return Array.isArray(ut(t))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Bi(t,!e)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:l,toBeUndefined:a,changed:c,changedTimes:d,get not(){return Bi(t,!e)}}}function $i(t){return Bi(t)}function Fd(t){var e;const n=ut(t);return(e=n?.$el)!=null?e:n}const bs=$d?window:void 0;function ws(...t){let e,n,o,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,o,i]=t,e=bs):[e,n,o,i]=t,!e)return Od;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],a=()=>{r.forEach(d=>d()),r.length=0},l=(d,f,h,p)=>(d.addEventListener(f,h,p),()=>d.removeEventListener(f,h,p)),u=s.watch(()=>[Fd(e),ut(i)],([d,f])=>{if(a(),!d)return;const h=Pd(f)?{...f}:f;r.push(...n.flatMap(p=>o.map(y=>l(d,p,y,h))))},{immediate:!0,flush:"post"}),c=()=>{u(),a()};return mn(c),c}function jd(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function _s(...t){let e,n,o={};t.length===3?(e=t[0],n=t[1],o=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],o=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=bs,eventName:r="keydown",passive:a=!1,dedupe:l=!1}=o,u=jd(e);return ws(i,r,d=>{d.repeat&&ut(l)||u(d)&&n(d)},a)}function Gd(t){return JSON.parse(JSON.stringify(t))}function zi(t,e,n,o={}){var i,r,a;const{clone:l=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f,shouldEmit:h}=o,p=s.getCurrentInstance(),y=n||p?.emit||((i=p?.$emit)==null?void 0:i.bind(p))||((a=(r=p?.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(p?.proxy));let m=c;e||(e="modelValue"),m=m||`update:${e.toString()}`;const b=g=>l?typeof l=="function"?l(g):Gd(g):g,N=()=>zd(t[e])?b(t[e]):f,_=g=>{h?h(g)&&y(m,g):y(m,g)};if(u){const g=N(),x=s.ref(g);let A=!1;return s.watch(()=>t[e],$=>{A||(A=!0,x.value=b($),s.nextTick(()=>A=!1))}),s.watch(x,$=>{!A&&($!==t[e]||d)&&_($)},{deep:d}),x}else return s.computed({get(){return N()},set(g){_(g)}})}var Wd={value:()=>{}};function eo(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new to(n)}function to(t){this._=t}function Yd(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}to.prototype=eo.prototype={constructor:to,on:function(t,e){var n=this._,o=Yd(t+"",n),i,r=-1,a=o.length;if(arguments.length<2){for(;++r<a;)if((i=(t=o[r]).type)&&(i=Ud(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++r<a;)if(i=(t=o[r]).type)n[i]=xs(n[i],t.name,e);else if(e==null)for(i in n)n[i]=xs(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new to(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,r;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)}};function Ud(t,e){for(var n=0,o=t.length,i;n<o;++n)if((i=t[n]).name===e)return i.value}function xs(t,e,n){for(var o=0,i=t.length;o<i;++o)if(t[o].name===e){t[o]=Wd,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var Ai="http://www.w3.org/1999/xhtml";const Cs={svg:"http://www.w3.org/2000/svg",xhtml:Ai,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function no(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Cs.hasOwnProperty(e)?{space:Cs[e],local:t}:t}function Xd(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Ai&&e.documentElement.namespaceURI===Ai?e.createElement(t):e.createElementNS(n,t)}}function qd(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Es(t){var e=no(t);return(e.local?qd:Xd)(e)}function Kd(){}function Pi(t){return t==null?Kd:function(){return this.querySelector(t)}}function Zd(t){typeof t!="function"&&(t=Pi(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var r=e[i],a=r.length,l=o[i]=new Array(a),u,c,d=0;d<a;++d)(u=r[d])&&(c=t.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),l[d]=c);return new je(o,this._parents)}function Jd(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Qd(){return[]}function Ss(t){return t==null?Qd:function(){return this.querySelectorAll(t)}}function eu(t){return function(){return Jd(t.apply(this,arguments))}}function tu(t){typeof t=="function"?t=eu(t):t=Ss(t);for(var e=this._groups,n=e.length,o=[],i=[],r=0;r<n;++r)for(var a=e[r],l=a.length,u,c=0;c<l;++c)(u=a[c])&&(o.push(t.call(u,u.__data__,c,a)),i.push(u));return new je(o,i)}function Ns(t){return function(){return this.matches(t)}}function ks(t){return function(e){return e.matches(t)}}var nu=Array.prototype.find;function ou(t){return function(){return nu.call(this.children,t)}}function iu(){return this.firstElementChild}function ru(t){return this.select(t==null?iu:ou(typeof t=="function"?t:ks(t)))}var su=Array.prototype.filter;function au(){return Array.from(this.children)}function lu(t){return function(){return su.call(this.children,t)}}function cu(t){return this.selectAll(t==null?au:lu(typeof t=="function"?t:ks(t)))}function du(t){typeof t!="function"&&(t=Ns(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var r=e[i],a=r.length,l=o[i]=[],u,c=0;c<a;++c)(u=r[c])&&t.call(u,u.__data__,c,r)&&l.push(u);return new je(o,this._parents)}function Ds(t){return new Array(t.length)}function uu(){return new je(this._enter||this._groups.map(Ds),this._parents)}function oo(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}oo.prototype={constructor:oo,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function fu(t){return function(){return t}}function hu(t,e,n,o,i,r){for(var a=0,l,u=e.length,c=r.length;a<c;++a)(l=e[a])?(l.__data__=r[a],o[a]=l):n[a]=new oo(t,r[a]);for(;a<u;++a)(l=e[a])&&(i[a]=l)}function pu(t,e,n,o,i,r,a){var l,u,c=new Map,d=e.length,f=r.length,h=new Array(d),p;for(l=0;l<d;++l)(u=e[l])&&(h[l]=p=a.call(u,u.__data__,l,e)+"",c.has(p)?i[l]=u:c.set(p,u));for(l=0;l<f;++l)p=a.call(t,r[l],l,r)+"",(u=c.get(p))?(o[l]=u,u.__data__=r[l],c.delete(p)):n[l]=new oo(t,r[l]);for(l=0;l<d;++l)(u=e[l])&&c.get(h[l])===u&&(i[l]=u)}function gu(t){return t.__data__}function mu(t,e){if(!arguments.length)return Array.from(this,gu);var n=e?pu:hu,o=this._parents,i=this._groups;typeof t!="function"&&(t=fu(t));for(var r=i.length,a=new Array(r),l=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],f=i[c],h=f.length,p=yu(t.call(d,d&&d.__data__,c,o)),y=p.length,m=l[c]=new Array(y),b=a[c]=new Array(y),N=u[c]=new Array(h);n(d,f,m,b,N,p,e);for(var _=0,g=0,x,A;_<y;++_)if(x=m[_]){for(_>=g&&(g=_+1);!(A=b[g])&&++g<y;);x._next=A||null}}return a=new je(a,o),a._enter=l,a._exit=u,a}function yu(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function vu(){return new je(this._exit||this._groups.map(Ds),this._parents)}function bu(t,e,n){var o=this.enter(),i=this,r=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?r.remove():n(r),o&&i?o.merge(i).order():i}function wu(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,i=n.length,r=o.length,a=Math.min(i,r),l=new Array(i),u=0;u<a;++u)for(var c=n[u],d=o[u],f=c.length,h=l[u]=new Array(f),p,y=0;y<f;++y)(p=c[y]||d[y])&&(h[y]=p);for(;u<i;++u)l[u]=n[u];return new je(l,this._parents)}function _u(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],i=o.length-1,r=o[i],a;--i>=0;)(a=o[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function xu(t){t||(t=Cu);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var a=n[r],l=a.length,u=i[r]=new Array(l),c,d=0;d<l;++d)(c=a[d])&&(u[d]=c);u.sort(e)}return new je(i,this._parents).order()}function Cu(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Eu(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function Su(){return Array.from(this)}function Nu(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,r=o.length;i<r;++i){var a=o[i];if(a)return a}return null}function ku(){let t=0;for(const e of this)++t;return t}function Du(){return!this.node()}function Tu(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var i=e[n],r=0,a=i.length,l;r<a;++r)(l=i[r])&&t.call(l,l.__data__,r,i);return this}function Iu(t){return function(){this.removeAttribute(t)}}function Mu(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Bu(t,e){return function(){this.setAttribute(t,e)}}function $u(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function zu(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Au(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Pu(t,e){var n=no(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?Mu:Iu:typeof e=="function"?n.local?Au:zu:n.local?$u:Bu)(n,e))}function Ts(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Ou(t){return function(){this.style.removeProperty(t)}}function Ru(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Hu(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Vu(t,e,n){return arguments.length>1?this.each((e==null?Ou:typeof e=="function"?Hu:Ru)(t,e,n??"")):qt(this.node(),t)}function qt(t,e){return t.style.getPropertyValue(e)||Ts(t).getComputedStyle(t,null).getPropertyValue(e)}function Lu(t){return function(){delete this[t]}}function Fu(t,e){return function(){this[t]=e}}function ju(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Gu(t,e){return arguments.length>1?this.each((e==null?Lu:typeof e=="function"?ju:Fu)(t,e)):this.node()[t]}function Is(t){return t.trim().split(/^|\s+/)}function Oi(t){return t.classList||new Ms(t)}function Ms(t){this._node=t,this._names=Is(t.getAttribute("class")||"")}Ms.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Bs(t,e){for(var n=Oi(t),o=-1,i=e.length;++o<i;)n.add(e[o])}function $s(t,e){for(var n=Oi(t),o=-1,i=e.length;++o<i;)n.remove(e[o])}function Wu(t){return function(){Bs(this,t)}}function Yu(t){return function(){$s(this,t)}}function Uu(t,e){return function(){(e.apply(this,arguments)?Bs:$s)(this,t)}}function Xu(t,e){var n=Is(t+"");if(arguments.length<2){for(var o=Oi(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Uu:e?Wu:Yu)(n,e))}function qu(){this.textContent=""}function Ku(t){return function(){this.textContent=t}}function Zu(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ju(t){return arguments.length?this.each(t==null?qu:(typeof t=="function"?Zu:Ku)(t)):this.node().textContent}function Qu(){this.innerHTML=""}function ef(t){return function(){this.innerHTML=t}}function tf(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function nf(t){return arguments.length?this.each(t==null?Qu:(typeof t=="function"?tf:ef)(t)):this.node().innerHTML}function of(){this.nextSibling&&this.parentNode.appendChild(this)}function rf(){return this.each(of)}function sf(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function af(){return this.each(sf)}function lf(t){var e=typeof t=="function"?t:Es(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function cf(){return null}function df(t,e){var n=typeof t=="function"?t:Es(t),o=e==null?cf:typeof e=="function"?e:Pi(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function uf(){var t=this.parentNode;t&&t.removeChild(this)}function ff(){return this.each(uf)}function hf(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function pf(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function gf(t){return this.select(t?pf:hf)}function mf(t){return arguments.length?this.property("__data__",t):this.node().__data__}function yf(t){return function(e){t.call(this,e,this.__data__)}}function vf(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function bf(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,i=e.length,r;n<i;++n)r=e[n],(!t.type||r.type===t.type)&&r.name===t.name?this.removeEventListener(r.type,r.listener,r.options):e[++o]=r;++o?e.length=o:delete this.__on}}}function wf(t,e,n){return function(){var o=this.__on,i,r=yf(e);if(o){for(var a=0,l=o.length;a<l;++a)if((i=o[a]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=e;return}}this.addEventListener(t.type,r,n),i={type:t.type,name:t.name,value:e,listener:r,options:n},o?o.push(i):this.__on=[i]}}function _f(t,e,n){var o=vf(t+""),i,r=o.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var u=0,c=l.length,d;u<c;++u)for(i=0,d=l[u];i<r;++i)if((a=o[i]).type===d.type&&a.name===d.name)return d.value}return}for(l=e?wf:bf,i=0;i<r;++i)this.each(l(o[i],e,n));return this}function zs(t,e,n){var o=Ts(t),i=o.CustomEvent;typeof i=="function"?i=new i(e,n):(i=o.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function xf(t,e){return function(){return zs(this,t,e)}}function Cf(t,e){return function(){return zs(this,t,e.apply(this,arguments))}}function Ef(t,e){return this.each((typeof e=="function"?Cf:xf)(t,e))}function*Sf(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],i=0,r=o.length,a;i<r;++i)(a=o[i])&&(yield a)}var As=[null];function je(t,e){this._groups=t,this._parents=e}function yn(){return new je([[document.documentElement]],As)}function Nf(){return this}je.prototype=yn.prototype={constructor:je,select:Zd,selectAll:tu,selectChild:ru,selectChildren:cu,filter:du,data:mu,enter:uu,exit:vu,join:bu,merge:wu,selection:Nf,order:_u,sort:xu,call:Eu,nodes:Su,node:Nu,size:ku,empty:Du,each:Tu,attr:Pu,style:Vu,property:Gu,classed:Xu,text:Ju,html:nf,raise:rf,lower:af,append:lf,insert:df,remove:ff,clone:gf,datum:mf,on:_f,dispatch:Ef,[Symbol.iterator]:Sf};function Je(t){return typeof t=="string"?new je([[document.querySelector(t)]],[document.documentElement]):new je([[t]],As)}function kf(t){let e;for(;e=t.sourceEvent;)t=e;return t}function it(t,e){if(t=kf(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}const Df={passive:!1},vn={capture:!0,passive:!1};function Ri(t){t.stopImmediatePropagation()}function Kt(t){t.preventDefault(),t.stopImmediatePropagation()}function Ps(t){var e=t.document.documentElement,n=Je(t).on("dragstart.drag",Kt,vn);"onselectstart"in e?n.on("selectstart.drag",Kt,vn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Os(t,e){var n=t.document.documentElement,o=Je(t).on("dragstart.drag",null);e&&(o.on("click.drag",Kt,vn),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const io=t=>()=>t;function Hi(t,{sourceEvent:e,subject:n,target:o,identifier:i,active:r,x:a,y:l,dx:u,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}Hi.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Tf(t){return!t.ctrlKey&&!t.button}function If(){return this.parentNode}function Mf(t,e){return e??{x:t.x,y:t.y}}function Bf(){return navigator.maxTouchPoints||"ontouchstart"in this}function $f(){var t=Tf,e=If,n=Mf,o=Bf,i={},r=eo("start","drag","end"),a=0,l,u,c,d,f=0;function h(x){x.on("mousedown.drag",p).filter(o).on("touchstart.drag",b).on("touchmove.drag",N,Df).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(x,A){if(!(d||!t.call(this,x,A))){var $=g(this,e.call(this,x,A),x,A,"mouse");$&&(Je(x.view).on("mousemove.drag",y,vn).on("mouseup.drag",m,vn),Ps(x.view),Ri(x),c=!1,l=x.clientX,u=x.clientY,$("start",x))}}function y(x){if(Kt(x),!c){var A=x.clientX-l,$=x.clientY-u;c=A*A+$*$>f}i.mouse("drag",x)}function m(x){Je(x.view).on("mousemove.drag mouseup.drag",null),Os(x.view,c),Kt(x),i.mouse("end",x)}function b(x,A){if(t.call(this,x,A)){var $=x.changedTouches,F=e.call(this,x,A),U=$.length,G,S;for(G=0;G<U;++G)(S=g(this,F,x,A,$[G].identifier,$[G]))&&(Ri(x),S("start",x,$[G]))}}function N(x){var A=x.changedTouches,$=A.length,F,U;for(F=0;F<$;++F)(U=i[A[F].identifier])&&(Kt(x),U("drag",x,A[F]))}function _(x){var A=x.changedTouches,$=A.length,F,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),F=0;F<$;++F)(U=i[A[F].identifier])&&(Ri(x),U("end",x,A[F]))}function g(x,A,$,F,U,G){var S=r.copy(),T=it(G||$,A),E,H,w;if((w=n.call(x,new Hi("beforestart",{sourceEvent:$,target:h,identifier:U,active:a,x:T[0],y:T[1],dx:0,dy:0,dispatch:S}),F))!=null)return E=w.x-T[0]||0,H=w.y-T[1]||0,function D(v,C,k){var O=T,R;switch(v){case"start":i[U]=D,R=a++;break;case"end":delete i[U],--a;case"drag":T=it(k||C,A),R=a;break}S.call(v,x,new Hi(v,{sourceEvent:C,subject:w,target:h,identifier:U,active:R,x:T[0]+E,y:T[1]+H,dx:T[0]-O[0],dy:T[1]-O[1],dispatch:S}),F)}}return h.filter=function(x){return arguments.length?(t=typeof x=="function"?x:io(!!x),h):t},h.container=function(x){return arguments.length?(e=typeof x=="function"?x:io(x),h):e},h.subject=function(x){return arguments.length?(n=typeof x=="function"?x:io(x),h):n},h.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:io(!!x),h):o},h.on=function(){var x=r.on.apply(r,arguments);return x===r?h:x},h.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,h):Math.sqrt(f)},h}function Vi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Rs(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function bn(){}var wn=.7,ro=1/wn,Zt="\\s*([+-]?\\d+)\\s*",_n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",rt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zf=/^#([0-9a-f]{3,8})$/,Af=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),Pf=new RegExp(`^rgb\\(${rt},${rt},${rt}\\)$`),Of=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${_n}\\)$`),Rf=new RegExp(`^rgba\\(${rt},${rt},${rt},${_n}\\)$`),Hf=new RegExp(`^hsl\\(${_n},${rt},${rt}\\)$`),Vf=new RegExp(`^hsla\\(${_n},${rt},${rt},${_n}\\)$`),Hs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vi(bn,zt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Vs,formatHex:Vs,formatHex8:Lf,formatHsl:Ff,formatRgb:Ls,toString:Ls});function Vs(){return this.rgb().formatHex()}function Lf(){return this.rgb().formatHex8()}function Ff(){return Ys(this).formatHsl()}function Ls(){return this.rgb().formatRgb()}function zt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=zf.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Fs(e):n===3?new He(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?so(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?so(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Af.exec(t))?new He(e[1],e[2],e[3],1):(e=Pf.exec(t))?new He(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Of.exec(t))?so(e[1],e[2],e[3],e[4]):(e=Rf.exec(t))?so(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Hf.exec(t))?Ws(e[1],e[2]/100,e[3]/100,1):(e=Vf.exec(t))?Ws(e[1],e[2]/100,e[3]/100,e[4]):Hs.hasOwnProperty(t)?Fs(Hs[t]):t==="transparent"?new He(NaN,NaN,NaN,0):null}function Fs(t){return new He(t>>16&255,t>>8&255,t&255,1)}function so(t,e,n,o){return o<=0&&(t=e=n=NaN),new He(t,e,n,o)}function jf(t){return t instanceof bn||(t=zt(t)),t?(t=t.rgb(),new He(t.r,t.g,t.b,t.opacity)):new He}function Li(t,e,n,o){return arguments.length===1?jf(t):new He(t,e,n,o??1)}function He(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}Vi(He,Li,Rs(bn,{brighter(t){return t=t==null?ro:Math.pow(ro,t),new He(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?wn:Math.pow(wn,t),new He(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new He(At(this.r),At(this.g),At(this.b),ao(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:js,formatHex:js,formatHex8:Gf,formatRgb:Gs,toString:Gs}));function js(){return`#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}`}function Gf(){return`#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}${Pt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Gs(){const t=ao(this.opacity);return`${t===1?"rgb(":"rgba("}${At(this.r)}, ${At(this.g)}, ${At(this.b)}${t===1?")":`, ${t})`}`}function ao(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function At(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Pt(t){return t=At(t),(t<16?"0":"")+t.toString(16)}function Ws(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Qe(t,e,n,o)}function Ys(t){if(t instanceof Qe)return new Qe(t.h,t.s,t.l,t.opacity);if(t instanceof bn||(t=zt(t)),!t)return new Qe;if(t instanceof Qe)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,i=Math.min(e,n,o),r=Math.max(e,n,o),a=NaN,l=r-i,u=(r+i)/2;return l?(e===r?a=(n-o)/l+(n<o)*6:n===r?a=(o-e)/l+2:a=(e-n)/l+4,l/=u<.5?r+i:2-r-i,a*=60):l=u>0&&u<1?0:a,new Qe(a,l,u,t.opacity)}function Wf(t,e,n,o){return arguments.length===1?Ys(t):new Qe(t,e,n,o??1)}function Qe(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}Vi(Qe,Wf,Rs(bn,{brighter(t){return t=t==null?ro:Math.pow(ro,t),new Qe(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?wn:Math.pow(wn,t),new Qe(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,i=2*n-o;return new He(Fi(t>=240?t-240:t+120,i,o),Fi(t,i,o),Fi(t<120?t+240:t-120,i,o),this.opacity)},clamp(){return new Qe(Us(this.h),lo(this.s),lo(this.l),ao(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ao(this.opacity);return`${t===1?"hsl(":"hsla("}${Us(this.h)}, ${lo(this.s)*100}%, ${lo(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Us(t){return t=(t||0)%360,t<0?t+360:t}function lo(t){return Math.max(0,Math.min(1,t||0))}function Fi(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const ji=t=>()=>t;function Yf(t,e){return function(n){return t+n*e}}function Uf(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function Xf(t){return(t=+t)==1?Xs:function(e,n){return n-e?Uf(e,n,t):ji(isNaN(e)?n:e)}}function Xs(t,e){var n=e-t;return n?Yf(t,n):ji(isNaN(t)?e:t)}const co=(function t(e){var n=Xf(e);function o(i,r){var a=n((i=Li(i)).r,(r=Li(r)).r),l=n(i.g,r.g),u=n(i.b,r.b),c=Xs(i.opacity,r.opacity);return function(d){return i.r=a(d),i.g=l(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=t,o})(1);function qf(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),i;return function(r){for(i=0;i<n;++i)o[i]=t[i]*(1-r)+e[i]*r;return o}}function Kf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Zf(t,e){var n=e?e.length:0,o=t?Math.min(n,t.length):0,i=new Array(o),r=new Array(n),a;for(a=0;a<o;++a)i[a]=xn(t[a],e[a]);for(;a<n;++a)r[a]=e[a];return function(l){for(a=0;a<o;++a)r[a]=i[a](l);return r}}function Jf(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function st(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Qf(t,e){var n={},o={},i;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(i in e)i in t?n[i]=xn(t[i],e[i]):o[i]=e[i];return function(r){for(i in n)o[i]=n[i](r);return o}}var Gi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wi=new RegExp(Gi.source,"g");function eh(t){return function(){return t}}function th(t){return function(e){return t(e)+""}}function qs(t,e){var n=Gi.lastIndex=Wi.lastIndex=0,o,i,r,a=-1,l=[],u=[];for(t=t+"",e=e+"";(o=Gi.exec(t))&&(i=Wi.exec(e));)(r=i.index)>n&&(r=e.slice(n,r),l[a]?l[a]+=r:l[++a]=r),(o=o[0])===(i=i[0])?l[a]?l[a]+=i:l[++a]=i:(l[++a]=null,u.push({i:a,x:st(o,i)})),n=Wi.lastIndex;return n<e.length&&(r=e.slice(n),l[a]?l[a]+=r:l[++a]=r),l.length<2?u[0]?th(u[0].x):eh(e):(e=u.length,function(c){for(var d=0,f;d<e;++d)l[(f=u[d]).i]=f.x(c);return l.join("")})}function xn(t,e){var n=typeof e,o;return e==null||n==="boolean"?ji(e):(n==="number"?st:n==="string"?(o=zt(e))?(e=o,co):qs:e instanceof zt?co:e instanceof Date?Jf:Kf(e)?qf:Array.isArray(e)?Zf:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Qf:st)(t,e)}var Ks=180/Math.PI,Yi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zs(t,e,n,o,i,r){var a,l,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*o)&&(n-=t*u,o-=e*u),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,u/=l),t*o<e*n&&(t=-t,e=-e,u=-u,a=-a),{translateX:i,translateY:r,rotate:Math.atan2(e,t)*Ks,skewX:Math.atan(u)*Ks,scaleX:a,scaleY:l}}var uo;function nh(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Yi:Zs(e.a,e.b,e.c,e.d,e.e,e.f)}function oh(t){return t==null||(uo||(uo=document.createElementNS("http://www.w3.org/2000/svg","g")),uo.setAttribute("transform",t),!(t=uo.transform.baseVal.consolidate()))?Yi:(t=t.matrix,Zs(t.a,t.b,t.c,t.d,t.e,t.f))}function Js(t,e,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,f,h,p,y){if(c!==f||d!==h){var m=p.push("translate(",null,e,null,n);y.push({i:m-4,x:st(c,f)},{i:m-2,x:st(d,h)})}else(f||h)&&p.push("translate("+f+e+h+n)}function a(c,d,f,h){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:st(c,d)})):d&&f.push(i(f)+"rotate("+d+o)}function l(c,d,f,h){c!==d?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:st(c,d)}):d&&f.push(i(f)+"skewX("+d+o)}function u(c,d,f,h,p,y){if(c!==f||d!==h){var m=p.push(i(p)+"scale(",null,",",null,")");y.push({i:m-4,x:st(c,f)},{i:m-2,x:st(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(c,d){var f=[],h=[];return c=t(c),d=t(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,h),a(c.rotate,d.rotate,f,h),l(c.skewX,d.skewX,f,h),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,h),c=d=null,function(p){for(var y=-1,m=h.length,b;++y<m;)f[(b=h[y]).i]=b.x(p);return f.join("")}}}var ih=Js(nh,"px, ","px)","deg)"),rh=Js(oh,", ",")",")"),sh=1e-12;function Qs(t){return((t=Math.exp(t))+1/t)/2}function ah(t){return((t=Math.exp(t))-1/t)/2}function lh(t){return((t=Math.exp(2*t))-1)/(t+1)}const fo=(function t(e,n,o){function i(r,a){var l=r[0],u=r[1],c=r[2],d=a[0],f=a[1],h=a[2],p=d-l,y=f-u,m=p*p+y*y,b,N;if(m<sh)N=Math.log(h/c)/e,b=function(F){return[l+F*p,u+F*y,c*Math.exp(e*F*N)]};else{var _=Math.sqrt(m),g=(h*h-c*c+o*m)/(2*c*n*_),x=(h*h-c*c-o*m)/(2*h*n*_),A=Math.log(Math.sqrt(g*g+1)-g),$=Math.log(Math.sqrt(x*x+1)-x);N=($-A)/e,b=function(F){var U=F*N,G=Qs(A),S=c/(n*_)*(G*lh(e*U+A)-ah(A));return[l+S*p,u+S*y,c*G/Qs(e*U+A)]}}return b.duration=N*1e3*e/Math.SQRT2,b}return i.rho=function(r){var a=Math.max(.001,+r),l=a*a,u=l*l;return t(a,l,u)},i})(Math.SQRT2,2,4);var Jt=0,Cn=0,En=0,ea=1e3,ho,Sn,po=0,Ot=0,go=0,Nn=typeof performance=="object"&&performance.now?performance:Date,ta=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ui(){return Ot||(ta(ch),Ot=Nn.now()+go)}function ch(){Ot=0}function mo(){this._call=this._time=this._next=null}mo.prototype=na.prototype={constructor:mo,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ui():+n)+(e==null?0:+e),!this._next&&Sn!==this&&(Sn?Sn._next=this:ho=this,Sn=this),this._call=t,this._time=n,Xi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xi())}};function na(t,e,n){var o=new mo;return o.restart(t,e,n),o}function dh(){Ui(),++Jt;for(var t=ho,e;t;)(e=Ot-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Jt}function oa(){Ot=(po=Nn.now())+go,Jt=Cn=0;try{dh()}finally{Jt=0,fh(),Ot=0}}function uh(){var t=Nn.now(),e=t-po;e>ea&&(go-=e,po=t)}function fh(){for(var t,e=ho,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:ho=n);Sn=t,Xi(o)}function Xi(t){if(!Jt){Cn&&(Cn=clearTimeout(Cn));var e=t-Ot;e>24?(t<1/0&&(Cn=setTimeout(oa,t-Nn.now()-go)),En&&(En=clearInterval(En))):(En||(po=Nn.now(),En=setInterval(uh,ea)),Jt=1,ta(oa))}}function ia(t,e,n){var o=new mo;return e=e==null?0:+e,o.restart(i=>{o.stop(),t(i+e)},e,n),o}var hh=eo("start","end","cancel","interrupt"),ph=[],ra=0,sa=1,qi=2,yo=3,aa=4,Ki=5,vo=6;function bo(t,e,n,o,i,r){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;gh(t,n,{name:e,index:o,group:i,on:hh,tween:ph,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:ra})}function Zi(t,e){var n=et(t,e);if(n.state>ra)throw new Error("too late; already scheduled");return n}function at(t,e){var n=et(t,e);if(n.state>yo)throw new Error("too late; already running");return n}function et(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function gh(t,e,n){var o=t.__transition,i;o[e]=n,n.timer=na(r,0,n.time);function r(c){n.state=sa,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var d,f,h,p;if(n.state!==sa)return u();for(d in o)if(p=o[d],p.name===n.name){if(p.state===yo)return ia(a);p.state===aa?(p.state=vo,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete o[d]):+d<e&&(p.state=vo,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete o[d])}if(ia(function(){n.state===yo&&(n.state=aa,n.timer.restart(l,n.delay,n.time),l(c))}),n.state=qi,n.on.call("start",t,t.__data__,n.index,n.group),n.state===qi){for(n.state=yo,i=new Array(h=n.tween.length),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function l(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=Ki,1),f=-1,h=i.length;++f<h;)i[f].call(t,d);n.state===Ki&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){n.state=vo,n.timer.stop(),delete o[e];for(var c in o)return;delete t.__transition}}function wo(t,e){var n=t.__transition,o,i,r=!0,a;if(n){e=e==null?null:e+"";for(a in n){if((o=n[a]).name!==e){r=!1;continue}i=o.state>qi&&o.state<Ki,o.state=vo,o.timer.stop(),o.on.call(i?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[a]}r&&delete t.__transition}}function mh(t){return this.each(function(){wo(this,t)})}function yh(t,e){var n,o;return function(){var i=at(this,t),r=i.tween;if(r!==n){o=n=r;for(var a=0,l=o.length;a<l;++a)if(o[a].name===e){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function vh(t,e,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=at(this,t),a=r.tween;if(a!==o){i=(o=a).slice();for(var l={name:e,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===e){i[u]=l;break}u===c&&i.push(l)}r.tween=i}}function bh(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=et(this.node(),n).tween,i=0,r=o.length,a;i<r;++i)if((a=o[i]).name===t)return a.value;return null}return this.each((e==null?yh:vh)(n,t,e))}function Ji(t,e,n){var o=t._id;return t.each(function(){var i=at(this,o);(i.value||(i.value={}))[e]=n.apply(this,arguments)}),function(i){return et(i,o).value[e]}}function la(t,e){var n;return(typeof e=="number"?st:e instanceof zt?co:(n=zt(e))?(e=n,co):qs)(t,e)}function wh(t){return function(){this.removeAttribute(t)}}function _h(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xh(t,e,n){var o,i=n+"",r;return function(){var a=this.getAttribute(t);return a===i?null:a===o?r:r=e(o=a,n)}}function Ch(t,e,n){var o,i=n+"",r;return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===o?r:r=e(o=a,n)}}function Eh(t,e,n){var o,i,r;return function(){var a,l=n(this),u;return l==null?void this.removeAttribute(t):(a=this.getAttribute(t),u=l+"",a===u?null:a===o&&u===i?r:(i=u,r=e(o=a,l)))}}function Sh(t,e,n){var o,i,r;return function(){var a,l=n(this),u;return l==null?void this.removeAttributeNS(t.space,t.local):(a=this.getAttributeNS(t.space,t.local),u=l+"",a===u?null:a===o&&u===i?r:(i=u,r=e(o=a,l)))}}function Nh(t,e){var n=no(t),o=n==="transform"?rh:la;return this.attrTween(t,typeof e=="function"?(n.local?Sh:Eh)(n,o,Ji(this,"attr."+t,e)):e==null?(n.local?_h:wh)(n):(n.local?Ch:xh)(n,o,e))}function kh(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Dh(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Th(t,e){var n,o;function i(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&Dh(t,r)),n}return i._value=e,i}function Ih(t,e){var n,o;function i(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&kh(t,r)),n}return i._value=e,i}function Mh(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=no(t);return this.tween(n,(o.local?Th:Ih)(o,e))}function Bh(t,e){return function(){Zi(this,t).delay=+e.apply(this,arguments)}}function $h(t,e){return e=+e,function(){Zi(this,t).delay=e}}function zh(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Bh:$h)(e,t)):et(this.node(),e).delay}function Ah(t,e){return function(){at(this,t).duration=+e.apply(this,arguments)}}function Ph(t,e){return e=+e,function(){at(this,t).duration=e}}function Oh(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Ah:Ph)(e,t)):et(this.node(),e).duration}function Rh(t,e){if(typeof e!="function")throw new Error;return function(){at(this,t).ease=e}}function Hh(t){var e=this._id;return arguments.length?this.each(Rh(e,t)):et(this.node(),e).ease}function Vh(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;at(this,t).ease=n}}function Lh(t){if(typeof t!="function")throw new Error;return this.each(Vh(this._id,t))}function Fh(t){typeof t!="function"&&(t=Ns(t));for(var e=this._groups,n=e.length,o=new Array(n),i=0;i<n;++i)for(var r=e[i],a=r.length,l=o[i]=[],u,c=0;c<a;++c)(u=r[c])&&t.call(u,u.__data__,c,r)&&l.push(u);return new ft(o,this._parents,this._name,this._id)}function jh(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,i=n.length,r=Math.min(o,i),a=new Array(o),l=0;l<r;++l)for(var u=e[l],c=n[l],d=u.length,f=a[l]=new Array(d),h,p=0;p<d;++p)(h=u[p]||c[p])&&(f[p]=h);for(;l<o;++l)a[l]=e[l];return new ft(a,this._parents,this._name,this._id)}function Gh(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Wh(t,e,n){var o,i,r=Gh(e)?Zi:at;return function(){var a=r(this,t),l=a.on;l!==o&&(i=(o=l).copy()).on(e,n),a.on=i}}function Yh(t,e){var n=this._id;return arguments.length<2?et(this.node(),n).on.on(t):this.each(Wh(n,t,e))}function Uh(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Xh(){return this.on("end.remove",Uh(this._id))}function qh(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Pi(t));for(var o=this._groups,i=o.length,r=new Array(i),a=0;a<i;++a)for(var l=o[a],u=l.length,c=r[a]=new Array(u),d,f,h=0;h<u;++h)(d=l[h])&&(f=t.call(d,d.__data__,h,l))&&("__data__"in d&&(f.__data__=d.__data__),c[h]=f,bo(c[h],e,n,h,c,et(d,n)));return new ft(r,this._parents,e,n)}function Kh(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ss(t));for(var o=this._groups,i=o.length,r=[],a=[],l=0;l<i;++l)for(var u=o[l],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var h=t.call(d,d.__data__,f,u),p,y=et(d,n),m=0,b=h.length;m<b;++m)(p=h[m])&&bo(p,e,n,m,h,y);r.push(h),a.push(d)}return new ft(r,a,e,n)}var Zh=yn.prototype.constructor;function Jh(){return new Zh(this._groups,this._parents)}function Qh(t,e){var n,o,i;return function(){var r=qt(this,t),a=(this.style.removeProperty(t),qt(this,t));return r===a?null:r===n&&a===o?i:i=e(n=r,o=a)}}function ca(t){return function(){this.style.removeProperty(t)}}function ep(t,e,n){var o,i=n+"",r;return function(){var a=qt(this,t);return a===i?null:a===o?r:r=e(o=a,n)}}function tp(t,e,n){var o,i,r;return function(){var a=qt(this,t),l=n(this),u=l+"";return l==null&&(u=l=(this.style.removeProperty(t),qt(this,t))),a===u?null:a===o&&u===i?r:(i=u,r=e(o=a,l))}}function np(t,e){var n,o,i,r="style."+e,a="end."+r,l;return function(){var u=at(this,t),c=u.on,d=u.value[r]==null?l||(l=ca(e)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(a,i=d),u.on=o}}function op(t,e,n){var o=(t+="")=="transform"?ih:la;return e==null?this.styleTween(t,Qh(t,o)).on("end.style."+t,ca(t)):typeof e=="function"?this.styleTween(t,tp(t,o,Ji(this,"style."+t,e))).each(np(this._id,t)):this.styleTween(t,ep(t,o,e),n).on("end.style."+t,null)}function ip(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function rp(t,e,n){var o,i;function r(){var a=e.apply(this,arguments);return a!==i&&(o=(i=a)&&ip(t,a,n)),o}return r._value=e,r}function sp(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,rp(t,e,n??""))}function ap(t){return function(){this.textContent=t}}function lp(t){return function(){var e=t(this);this.textContent=e??""}}function cp(t){return this.tween("text",typeof t=="function"?lp(Ji(this,"text",t)):ap(t==null?"":t+""))}function dp(t){return function(e){this.textContent=t.call(this,e)}}function up(t){var e,n;function o(){var i=t.apply(this,arguments);return i!==n&&(e=(n=i)&&dp(i)),e}return o._value=t,o}function fp(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,up(t))}function hp(){for(var t=this._name,e=this._id,n=da(),o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],l=a.length,u,c=0;c<l;++c)if(u=a[c]){var d=et(u,e);bo(u,t,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new ft(o,this._parents,t,n)}function pp(){var t,e,n=this,o=n._id,i=n.size();return new Promise(function(r,a){var l={value:a},u={value:function(){--i===0&&r()}};n.each(function(){var c=at(this,o),d=c.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(u)),c.on=e}),i===0&&r()})}var gp=0;function ft(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function da(){return++gp}var ht=yn.prototype;ft.prototype={constructor:ft,select:qh,selectAll:Kh,selectChild:ht.selectChild,selectChildren:ht.selectChildren,filter:Fh,merge:jh,selection:Jh,transition:hp,call:ht.call,nodes:ht.nodes,node:ht.node,size:ht.size,empty:ht.empty,each:ht.each,on:Yh,attr:Nh,attrTween:Mh,style:op,styleTween:sp,text:cp,textTween:fp,remove:Xh,tween:bh,delay:zh,duration:Oh,ease:Hh,easeVarying:Lh,end:pp,[Symbol.iterator]:ht[Symbol.iterator]};function mp(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var yp={time:null,delay:0,duration:250,ease:mp};function vp(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function bp(t){var e,n;t instanceof ft?(e=t._id,t=t._name):(e=da(),(n=yp).time=Ui(),t=t==null?null:t+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],l=a.length,u,c=0;c<l;++c)(u=a[c])&&bo(u,t,e,c,a,n||vp(u,e));return new ft(o,this._parents,t,e)}yn.prototype.interrupt=mh,yn.prototype.transition=bp;const _o=t=>()=>t;function wp(t,{sourceEvent:e,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function pt(t,e,n){this.k=t,this.x=e,this.y=n}pt.prototype={constructor:pt,scale:function(t){return t===1?this:new pt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new pt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qt=new pt(1,0,0);pt.prototype;function Qi(t){t.stopImmediatePropagation()}function kn(t){t.preventDefault(),t.stopImmediatePropagation()}function _p(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function xp(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function ua(){return this.__zoom||Qt}function Cp(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ep(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sp(t,e,n){var o=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],r=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function Np(){var t=_p,e=xp,n=Sp,o=Cp,i=Ep,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,u=fo,c=eo("start","zoom","end"),d,f,h,p=500,y=150,m=0,b=10;function N(w){w.property("__zoom",ua).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",G).on("dblclick.zoom",S).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(w,D,v,C){var k=w.selection?w.selection():w;k.property("__zoom",ua),w!==k?A(w,D,v,C):k.interrupt().each(function(){$(this,arguments).event(C).start().zoom(null,typeof D=="function"?D.apply(this,arguments):D).end()})},N.scaleBy=function(w,D,v,C){N.scaleTo(w,function(){var k=this.__zoom.k,O=typeof D=="function"?D.apply(this,arguments):D;return k*O},v,C)},N.scaleTo=function(w,D,v,C){N.transform(w,function(){var k=e.apply(this,arguments),O=this.__zoom,R=v==null?x(k):typeof v=="function"?v.apply(this,arguments):v,B=O.invert(R),P=typeof D=="function"?D.apply(this,arguments):D;return n(g(_(O,P),R,B),k,a)},v,C)},N.translateBy=function(w,D,v,C){N.transform(w,function(){return n(this.__zoom.translate(typeof D=="function"?D.apply(this,arguments):D,typeof v=="function"?v.apply(this,arguments):v),e.apply(this,arguments),a)},null,C)},N.translateTo=function(w,D,v,C,k){N.transform(w,function(){var O=e.apply(this,arguments),R=this.__zoom,B=C==null?x(O):typeof C=="function"?C.apply(this,arguments):C;return n(Qt.translate(B[0],B[1]).scale(R.k).translate(typeof D=="function"?-D.apply(this,arguments):-D,typeof v=="function"?-v.apply(this,arguments):-v),O,a)},C,k)};function _(w,D){return D=Math.max(r[0],Math.min(r[1],D)),D===w.k?w:new pt(D,w.x,w.y)}function g(w,D,v){var C=D[0]-v[0]*w.k,k=D[1]-v[1]*w.k;return C===w.x&&k===w.y?w:new pt(w.k,C,k)}function x(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function A(w,D,v,C){w.on("start.zoom",function(){$(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){$(this,arguments).event(C).end()}).tween("zoom",function(){var k=this,O=arguments,R=$(k,O).event(C),B=e.apply(k,O),P=v==null?x(B):typeof v=="function"?v.apply(k,O):v,L=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),j=k.__zoom,Z=typeof D=="function"?D.apply(k,O):D,Q=u(j.invert(P).concat(L/j.k),Z.invert(P).concat(L/Z.k));return function(q){if(q===1)q=Z;else{var ee=Q(q),re=L/ee[2];q=new pt(re,P[0]-ee[0]*re,P[1]-ee[1]*re)}R.zoom(null,q)}})}function $(w,D,v){return!v&&w.__zooming||new F(w,D)}function F(w,D){this.that=w,this.args=D,this.active=0,this.sourceEvent=null,this.extent=e.apply(w,D),this.taps=0}F.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,D){return this.mouse&&w!=="mouse"&&(this.mouse[1]=D.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=D.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=D.invert(this.touch1[0])),this.that.__zoom=D,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var D=Je(this.that).datum();c.call(w,this.that,new wp(w,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:c}),D)}};function U(w,...D){if(!t.apply(this,arguments))return;var v=$(this,D).event(w),C=this.__zoom,k=Math.max(r[0],Math.min(r[1],C.k*Math.pow(2,o.apply(this,arguments)))),O=it(w);if(v.wheel)(v.mouse[0][0]!==O[0]||v.mouse[0][1]!==O[1])&&(v.mouse[1]=C.invert(v.mouse[0]=O)),clearTimeout(v.wheel);else{if(C.k===k)return;v.mouse=[O,C.invert(O)],wo(this),v.start()}kn(w),v.wheel=setTimeout(R,y),v.zoom("mouse",n(g(_(C,k),v.mouse[0],v.mouse[1]),v.extent,a));function R(){v.wheel=null,v.end()}}function G(w,...D){if(h||!t.apply(this,arguments))return;var v=w.currentTarget,C=$(this,D,!0).event(w),k=Je(w.view).on("mousemove.zoom",P,!0).on("mouseup.zoom",L,!0),O=it(w,v),R=w.clientX,B=w.clientY;Ps(w.view),Qi(w),C.mouse=[O,this.__zoom.invert(O)],wo(this),C.start();function P(j){if(kn(j),!C.moved){var Z=j.clientX-R,Q=j.clientY-B;C.moved=Z*Z+Q*Q>m}C.event(j).zoom("mouse",n(g(C.that.__zoom,C.mouse[0]=it(j,v),C.mouse[1]),C.extent,a))}function L(j){k.on("mousemove.zoom mouseup.zoom",null),Os(j.view,C.moved),kn(j),C.event(j).end()}}function S(w,...D){if(t.apply(this,arguments)){var v=this.__zoom,C=it(w.changedTouches?w.changedTouches[0]:w,this),k=v.invert(C),O=v.k*(w.shiftKey?.5:2),R=n(g(_(v,O),C,k),e.apply(this,D),a);kn(w),l>0?Je(this).transition().duration(l).call(A,R,C,w):Je(this).call(N.transform,R,C,w)}}function T(w,...D){if(t.apply(this,arguments)){var v=w.touches,C=v.length,k=$(this,D,w.changedTouches.length===C).event(w),O,R,B,P;for(Qi(w),R=0;R<C;++R)B=v[R],P=it(B,this),P=[P,this.__zoom.invert(P),B.identifier],k.touch0?!k.touch1&&k.touch0[2]!==P[2]&&(k.touch1=P,k.taps=0):(k.touch0=P,O=!0,k.taps=1+!!d);d&&(d=clearTimeout(d)),O&&(k.taps<2&&(f=P[0],d=setTimeout(function(){d=null},p)),wo(this),k.start())}}function E(w,...D){if(this.__zooming){var v=$(this,D).event(w),C=w.changedTouches,k=C.length,O,R,B,P;for(kn(w),O=0;O<k;++O)R=C[O],B=it(R,this),v.touch0&&v.touch0[2]===R.identifier?v.touch0[0]=B:v.touch1&&v.touch1[2]===R.identifier&&(v.touch1[0]=B);if(R=v.that.__zoom,v.touch1){var L=v.touch0[0],j=v.touch0[1],Z=v.touch1[0],Q=v.touch1[1],q=(q=Z[0]-L[0])*q+(q=Z[1]-L[1])*q,ee=(ee=Q[0]-j[0])*ee+(ee=Q[1]-j[1])*ee;R=_(R,Math.sqrt(q/ee)),B=[(L[0]+Z[0])/2,(L[1]+Z[1])/2],P=[(j[0]+Q[0])/2,(j[1]+Q[1])/2]}else if(v.touch0)B=v.touch0[0],P=v.touch0[1];else return;v.zoom("touch",n(g(R,B,P),v.extent,a))}}function H(w,...D){if(this.__zooming){var v=$(this,D).event(w),C=w.changedTouches,k=C.length,O,R;for(Qi(w),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),O=0;O<k;++O)R=C[O],v.touch0&&v.touch0[2]===R.identifier?delete v.touch0:v.touch1&&v.touch1[2]===R.identifier&&delete v.touch1;if(v.touch1&&!v.touch0&&(v.touch0=v.touch1,delete v.touch1),v.touch0)v.touch0[1]=this.__zoom.invert(v.touch0[0]);else if(v.end(),v.taps===2&&(R=it(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<b)){var B=Je(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return N.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:_o(+w),N):o},N.filter=function(w){return arguments.length?(t=typeof w=="function"?w:_o(!!w),N):t},N.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:_o(!!w),N):i},N.extent=function(w){return arguments.length?(e=typeof w=="function"?w:_o([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),N):e},N.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],N):[r[0],r[1]]},N.translateExtent=function(w){return arguments.length?(a[0][0]=+w[0][0],a[1][0]=+w[1][0],a[0][1]=+w[0][1],a[1][1]=+w[1][1],N):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},N.constrain=function(w){return arguments.length?(n=w,N):n},N.duration=function(w){return arguments.length?(l=+w,N):l},N.interpolate=function(w){return arguments.length?(u=w,N):u},N.on=function(){var w=c.on.apply(c,arguments);return w===c?N:w},N.clickDistance=function(w){return arguments.length?(m=(w=+w)*w,N):Math.sqrt(m)},N.tapDistance=function(w){return arguments.length?(b=+w,N):b},N}var de=(t=>(t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom",t))(de||{}),er=(t=>(t.Partial="partial",t.Full="full",t))(er||{}),Rt=(t=>(t.Bezier="default",t.SimpleBezier="simple-bezier",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t))(Rt||{}),gt=(t=>(t.Strict="strict",t.Loose="loose",t))(gt||{}),mt=(t=>(t.Arrow="arrow",t.ArrowClosed="arrowclosed",t))(mt||{}),Dn=(t=>(t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal",t))(Dn||{}),fa=(t=>(t.TopLeft="top-left",t.TopCenter="top-center",t.TopRight="top-right",t.BottomLeft="bottom-left",t.BottomCenter="bottom-center",t.BottomRight="bottom-right",t))(fa||{});const kp=["INPUT","SELECT","TEXTAREA"],Dp=typeof document<"u"?document:null;function tr(t){var e,n;const o=((n=(e=t.composedPath)==null?void 0:e.call(t))==null?void 0:n[0])||t.target,i=typeof o?.hasAttribute=="function"?o.hasAttribute("contenteditable"):!1,r=typeof o?.closest=="function"?o.closest(".nokey"):null;return kp.includes(o?.nodeName)||i||!!r}function Tp(t){return t.ctrlKey||t.metaKey||t.shiftKey||t.altKey}function ha(t,e,n,o){const i=e.replace("+",`
2
2
  `).replace(`
3
3
 
4
4
  `,`
5
5
  +`).split(`
6
- `).map(s=>s.trim().toLowerCase());if(i.length===1)return t.toLowerCase()===e.toLowerCase();o||n.add(t.toLowerCase());const r=i.every((s,l)=>n.has(s)&&Array.from(n.values())[l]===i[l]);return o&&n.delete(t.toLowerCase()),r}function Sp(t,e){return n=>{if(!n.code&&!n.key)return!1;const o=Np(n.code,t);return Array.isArray(t)?t.some(i=>fa(n[o],i,e,n.type==="keyup")):fa(n[o],t,e,n.type==="keyup")}}function Np(t,e){return e.includes(t)?"code":"key"}function Tn(t,e){const n=a.computed(()=>a.toValue(e?.target)??Ep),o=a.shallowRef(a.toValue(t)===!0);let i=!1;const r=new Set;let s=u(a.toValue(t));a.watch(()=>a.toValue(t),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&l(),s=u(c)},{immediate:!0}),bs(["blur","contextmenu"],l),ws((...c)=>s(...c),c=>{var d,f;const h=a.toValue(e?.actInsideInputWithModifier)??!0,p=a.toValue(e?.preventDefault)??!1;if(i=Cp(c),(!i||i&&!h)&&tr(c))return;const m=((f=(d=c.composedPath)==null?void 0:d.call(c))==null?void 0:f[0])||c.target,v=m?.nodeName==="BUTTON"||m?.nodeName==="A";!p&&(i||!v)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),ws((...c)=>s(...c),c=>{const d=a.toValue(e?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!d)&&tr(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function l(){i=!1,r.clear(),o.value=a.toValue(t)===!0}function u(c){return c===null?(l(),()=>!1):typeof c=="boolean"?(l(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Sp(c,r):c}return o}const ha="vue-flow__node-desc",pa="vue-flow__edge-desc",kp="vue-flow__aria-live",ga=["Enter"," ","Escape"],en={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function xo(t){return{...t.computedPosition||{x:0,y:0},width:t.dimensions.width||0,height:t.dimensions.height||0}}function Eo(t,e){const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)}function Co(t){return{width:t.offsetWidth,height:t.offsetHeight}}function Rt(t,e=0,n=1){return Math.min(Math.max(t,e),n)}function ma(t,e){return{x:Rt(t.x,e[0][0],e[1][0]),y:Rt(t.y,e[0][1],e[1][1])}}function ya(t){const e=t.getRootNode();return"elementFromPoint"in e?e:window.document}function St(t){return t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t}function Ht(t){return t&&typeof t=="object"&&"id"in t&&"position"in t&&!St(t)}function Mn(t){return Ht(t)&&"computedPosition"in t}function So(t){return!Number.isNaN(t)&&Number.isFinite(t)}function Dp(t){return So(t.width)&&So(t.height)&&So(t.x)&&So(t.y)}function Tp(t,e,n){const o={id:t.id.toString(),type:t.type??"default",dimensions:a.markRaw({width:0,height:0}),computedPosition:a.markRaw({z:0,...t.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ke(t.data)?t.data:{},events:a.markRaw(ke(t.events)?t.events:{})};return Object.assign(e??o,t,{id:t.id.toString(),parentNode:n})}function va(t,e,n){var o,i;const r={id:t.id.toString(),type:t.type??e?.type??"default",source:t.source.toString(),target:t.target.toString(),sourceHandle:(o=t.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=t.targetHandle)==null?void 0:i.toString(),updatable:t.updatable??n?.updatable,selectable:t.selectable??n?.selectable,focusable:t.focusable??n?.focusable,data:ke(t.data)?t.data:{},events:a.markRaw(ke(t.events)?t.events:{}),label:t.label??"",interactionWidth:t.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(e??r,t,{id:t.id.toString()})}function ba(t,e,n,o){const i=typeof t=="string"?t:t.id,r=new Set,s=o==="source"?"target":"source";for(const l of n)l[s]===i&&r.add(l[o]);return e.filter(l=>r.has(l.id))}function Mp(...t){if(t.length===3){const[r,s,l]=t;return ba(r,s,l,"target")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(r=>St(r)&&r.source===o).map(r=>n.find(s=>Ht(s)&&s.id===r.target))}function Ip(...t){if(t.length===3){const[r,s,l]=t;return ba(r,s,l,"source")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(r=>St(r)&&r.target===o).map(r=>n.find(s=>Ht(s)&&s.id===r.source))}function wa({source:t,sourceHandle:e,target:n,targetHandle:o}){return`vueflow__edge-${t}${e??""}-${n}${o??""}`}function Bp(t,e){return e.some(n=>St(n)&&n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle))}function In({x:t,y:e},{x:n,y:o,zoom:i}){return{x:t*i+n,y:e*i+o}}function Bn({x:t,y:e},{x:n,y:o,zoom:i},r=!1,s=[1,1]){const l={x:(t-n)/i,y:(e-o)/i};return r?ko(l,s):l}function $p(t,e){return{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}}function _a({x:t,y:e,width:n,height:o}){return{x:t,y:e,x2:t+n,y2:e+o}}function zp({x:t,y:e,x2:n,y2:o}){return{x:t,y:e,width:n-t,height:o-e}}function xa(t){let e={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<t.length;n++){const o=t[n];e=$p(e,_a({...o.computedPosition,...o.dimensions}))}return zp(e)}function Ea(t,e,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...Bn(e,n),width:e.width/n.zoom,height:e.height/n.zoom},s=[];for(const l of t){const{dimensions:u,selectable:c=!0,hidden:d=!1}=l,f=u.width??l.width??null,h=u.height??l.height??null;if(i&&!c||d)continue;const p=Eo(r,xo(l)),y=f===null||h===null,m=o&&p>0,v=(f??0)*(h??0);(y||m||p>=v||l.dragging)&&s.push(l)}return s}function Ca(t,e){const n=new Set;if(typeof t=="string")n.add(t);else if(t.length>=1)for(const o of t)n.add(o.id);return e.filter(o=>n.has(o.source)||n.has(o.target))}function tn(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return zn(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ap(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=tn(t,n),i=tn(t,e);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof t=="object"){const o=tn(t.top??t.y??0,n),i=tn(t.bottom??t.y??0,n),r=tn(t.left??t.x??0,e),s=tn(t.right??t.x??0,e);return{top:o,right:s,bottom:i,left:r,x:r+s,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Pp(t,e,n,o,i,r){const{x:s,y:l}=In(t,{x:e,y:n,zoom:o}),{x:u,y:c}=In({x:t.x+t.width,y:t.y+t.height},{x:e,y:n,zoom:o}),d=i-u,f=r-c;return{left:Math.floor(s),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}function Sa(t,e,n,o,i,r=.1){const s=Ap(r,e,n),l=(e-s.x)/t.width,u=(n-s.y)/t.height,c=Math.min(l,u),d=Rt(c,o,i),f=t.x+t.width/2,h=t.y+t.height/2,p=e/2-f*d,y=n/2-h*d,m=Pp(t,p,y,d,e,n),v={left:Math.min(m.left-s.left,0),top:Math.min(m.top-s.top,0),right:Math.min(m.right-s.right,0),bottom:Math.min(m.bottom-s.bottom,0)};return{x:p-v.left+v.right,y:y-v.top+v.bottom,zoom:d}}function Op(t,e){return{x:e.x+t.x,y:e.y+t.y,z:(t.z>e.z?t.z:e.z)+1}}function Na(t,e){if(!t.parentNode)return!1;const n=e.get(t.parentNode);return n?n.selected?!0:Na(n,e):!1}function $n(t,e){return typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`}function ka(t){const e=t.ctrlKey&&No()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e}function Da(t,e,n){return t<e?Rt(Math.abs(t-e),1,e)/e:t>n?-Rt(Math.abs(t-n),1,e)/e:0}function Ta(t,e,n=15,o=40){const i=Da(t.x,o,e.width-o)*n,r=Da(t.y,o,e.height-o)*n;return[i,r]}function nr(t,e){if(e){const n=t.position.x+t.dimensions.width-e.dimensions.width,o=t.position.y+t.dimensions.height-e.dimensions.height;if(n>0||o>0||t.position.x<0||t.position.y<0){let i={};if(typeof e.style=="function"?i={...e.style(e)}:e.style&&(i={...e.style}),i.width=i.width??`${e.dimensions.width}px`,i.height=i.height??`${e.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(t.position.x<0){const r=Math.abs(t.position.x);if(e.position.x=e.position.x-r,typeof i.width=="string"){const s=Number(i.width.replace("px",""));i.width=`${s+r}px`}else i.width+=r;t.position.x=0}if(t.position.y<0){const r=Math.abs(t.position.y);if(e.position.y=e.position.y-r,typeof i.height=="string"){const s=Number(i.height.replace("px",""));i.height=`${s+r}px`}else i.height+=r;t.position.y=0}e.dimensions.width=Number(i.width.toString().replace("px","")),e.dimensions.height=Number(i.height.toString().replace("px","")),typeof e.style=="function"?e.style=r=>{const s=e.style;return{...s(r),...i}}:e.style={...e.style,...i}}}}function Ma(t,e){var n,o;const i=t.filter(s=>s.type==="add"||s.type==="remove");for(const s of i)if(s.type==="add")e.findIndex(u=>u.id===s.item.id)===-1&&e.push(s.item);else if(s.type==="remove"){const l=e.findIndex(u=>u.id===s.id);l!==-1&&e.splice(l,1)}const r=e.map(s=>s.id);for(const s of e)for(const l of t)if(l.id===s.id)switch(l.type){case"select":s.selected=l.selected;break;case"position":if(Mn(s)&&(typeof l.position<"u"&&(s.position=l.position),typeof l.dragging<"u"&&(s.dragging=l.dragging),s.expandParent&&s.parentNode)){const u=e[r.indexOf(s.parentNode)];u&&Mn(u)&&nr(s,u)}break;case"dimensions":if(Mn(s)&&(typeof l.dimensions<"u"&&(s.dimensions=l.dimensions),typeof l.updateStyle<"u"&&l.updateStyle&&(s.style={...s.style||{},width:`${(n=l.dimensions)==null?void 0:n.width}px`,height:`${(o=l.dimensions)==null?void 0:o.height}px`}),typeof l.resizing<"u"&&(s.resizing=l.resizing),s.expandParent&&s.parentNode)){const u=e[r.indexOf(s.parentNode)];u&&Mn(u)&&(!!u.dimensions.width&&!!u.dimensions.height?nr(s,u):a.nextTick(()=>{nr(s,u)}))}break}return e}function Nt(t,e){return{id:t,type:"select",selected:e}}function Ia(t){return{item:t,type:"add"}}function Ba(t){return{id:t,type:"remove"}}function $a(t,e,n,o,i){return{id:t,source:e,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function kt(t,e=new Set,n=!1){const o=[];for(const[i,r]of t){const s=e.has(i);!(r.selected===void 0&&!s)&&r.selected!==s&&(n&&(r.selected=s),o.push(Nt(r.id,s)))}return o}const za=()=>{};function le(t){const e=new Set;let n=za,o=()=>!1;const i=()=>e.size>0||o(),r=h=>{n=h},s=()=>{n=za},l=h=>{o=h},u=()=>{o=()=>!1},c=h=>{e.delete(h)};return{on:h=>{e.add(h);const p=()=>c(h);return mn(p),{off:p}},off:c,trigger:h=>{const p=[n];return i()?p.push(...e):t&&p.push(t),Promise.allSettled(p.map(y=>y(h)))},hasListeners:i,listeners:e,setEmitter:r,removeEmitter:s,setHasEmitListeners:l,removeHasEmitListeners:u}}function Aa(t,e,n){let o=t;do{if(o&&o.matches(e))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function Rp(t,e,n,o){var i,r;const s=new Map;for(const[l,u]of t)(u.selected||u.id===o)&&(!u.parentNode||!Na(u,t))&&(u.draggable||e&&typeof u.draggable>"u")&&t.get(l)&&s.set(l,{id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((i=u.computedPosition)==null?void 0:i.x)||0,y:n.y-((r=u.computedPosition)==null?void 0:r.y)||0},from:{x:u.computedPosition.x,y:u.computedPosition.y},extent:u.extent,parentNode:u.parentNode,dimensions:{...u.dimensions},expandParent:u.expandParent});return Array.from(s.values())}function or({id:t,dragItems:e,findNode:n}){const o=[];for(const i of e){const r=n(i.id);r&&o.push(r)}return[t?o.find(i=>i.id===t):o[0],o]}function Pa(t){if(Array.isArray(t))switch(t.length){case 1:return[t[0],t[0],t[0],t[0]];case 2:return[t[0],t[1],t[0],t[1]];case 3:return[t[0],t[1],t[2],t[1]];case 4:return t;default:return[0,0,0,0]}return[t,t,t,t]}function Hp(t,e,n){const[o,i,r,s]=typeof t!="string"?Pa(t.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+s,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Lp(t,e,n,o){let i=t.extent||n;if((i==="parent"||!Array.isArray(i)&&i?.range==="parent")&&!t.expandParent)if(t.parentNode&&o&&t.dimensions.width&&t.dimensions.height){const r=Hp(i,t,o);r&&(i=r)}else e(new Be(Ne.NODE_EXTENT_INVALID,t.id)),i=n;else if(Array.isArray(i)){const r=o?.computedPosition.x||0,s=o?.computedPosition.y||0;i=[[i[0][0]+r,i[0][1]+s],[i[1][0]+r,i[1][1]+s]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[r,s,l,u]=Pa(i.padding),c=o?.computedPosition.x||0,d=o?.computedPosition.y||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-s,i.range[1][1]+d-l]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Vp({width:t,height:e},n){return[n[0],[n[1][0]-(t||0),n[1][1]-(e||0)]]}function ir(t,e,n,o,i){const r=Vp(t.dimensions,Lp(t,n,o,i)),s=ma(e,r);return{position:{x:s.x-(i?.computedPosition.x||0),y:s.y-(i?.computedPosition.y||0)},computedPosition:s}}function nn(t,e,n=de.Left,o=!1){const i=(e?.x??0)+t.computedPosition.x,r=(e?.y??0)+t.computedPosition.y,{width:s,height:l}=e??jp(t);if(o)return{x:i+s/2,y:r+l/2};switch(e?.position??n){case de.Top:return{x:i+s/2,y:r};case de.Right:return{x:i+s,y:r+l/2};case de.Bottom:return{x:i+s/2,y:r+l};case de.Left:return{x:i,y:r+l/2}}}function Oa(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Fp({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:s,height:l,viewport:u}){const c={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+i),y2:Math.max(t.y+o,e.y+r)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=_a({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:s/u.zoom,height:l/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*h)>0}function Wp(t,e,n=!1){const o=typeof t.zIndex=="number";let i=o?t.zIndex:0;const r=e(t.source),s=e(t.target);return!r||!s?0:(n&&(i=o?t.zIndex:Math.max(r.computedPosition.z||0,s.computedPosition.z||0)),i)}var Ne=(t=>(t.MISSING_STYLES="MISSING_STYLES",t.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",t.NODE_INVALID="NODE_INVALID",t.NODE_NOT_FOUND="NODE_NOT_FOUND",t.NODE_MISSING_PARENT="NODE_MISSING_PARENT",t.NODE_TYPE_MISSING="NODE_TYPE_MISSING",t.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",t.EDGE_INVALID="EDGE_INVALID",t.EDGE_NOT_FOUND="EDGE_NOT_FOUND",t.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",t.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",t.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",t.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",t.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",t.EDGE_ORPHANED="EDGE_ORPHANED",t.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",t))(Ne||{});const Ra={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:t=>`Node is invalid
6
+ `).map(a=>a.trim().toLowerCase());if(i.length===1)return t.toLowerCase()===e.toLowerCase();o||n.add(t.toLowerCase());const r=i.every((a,l)=>n.has(a)&&Array.from(n.values())[l]===i[l]);return o&&n.delete(t.toLowerCase()),r}function Ip(t,e){return n=>{if(!n.code&&!n.key)return!1;const o=Mp(n.code,t);return Array.isArray(t)?t.some(i=>ha(n[o],i,e,n.type==="keyup")):ha(n[o],t,e,n.type==="keyup")}}function Mp(t,e){return e.includes(t)?"code":"key"}function Tn(t,e){const n=s.computed(()=>s.toValue(e?.target)??Dp),o=s.shallowRef(s.toValue(t)===!0);let i=!1;const r=new Set;let a=u(s.toValue(t));s.watch(()=>s.toValue(t),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&l(),a=u(c)},{immediate:!0}),ws(["blur","contextmenu"],l),_s((...c)=>a(...c),c=>{var d,f;const h=s.toValue(e?.actInsideInputWithModifier)??!0,p=s.toValue(e?.preventDefault)??!1;if(i=Tp(c),(!i||i&&!h)&&tr(c))return;const m=((f=(d=c.composedPath)==null?void 0:d.call(c))==null?void 0:f[0])||c.target,b=m?.nodeName==="BUTTON"||m?.nodeName==="A";!p&&(i||!b)&&c.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),_s((...c)=>a(...c),c=>{const d=s.toValue(e?.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!d)&&tr(c))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function l(){i=!1,r.clear(),o.value=s.toValue(t)===!0}function u(c){return c===null?(l(),()=>!1):typeof c=="boolean"?(l(),o.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Ip(c,r):c}return o}const pa="vue-flow__node-desc",ga="vue-flow__edge-desc",Bp="vue-flow__aria-live",ma=["Enter"," ","Escape"],en={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function xo(t){return{...t.computedPosition||{x:0,y:0},width:t.dimensions.width||0,height:t.dimensions.height||0}}function Co(t,e){const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)}function Eo(t){return{width:t.offsetWidth,height:t.offsetHeight}}function Ht(t,e=0,n=1){return Math.min(Math.max(t,e),n)}function ya(t,e){return{x:Ht(t.x,e[0][0],e[1][0]),y:Ht(t.y,e[0][1],e[1][1])}}function va(t){const e=t.getRootNode();return"elementFromPoint"in e?e:window.document}function St(t){return t&&typeof t=="object"&&"id"in t&&"source"in t&&"target"in t}function Vt(t){return t&&typeof t=="object"&&"id"in t&&"position"in t&&!St(t)}function In(t){return Vt(t)&&"computedPosition"in t}function So(t){return!Number.isNaN(t)&&Number.isFinite(t)}function $p(t){return So(t.width)&&So(t.height)&&So(t.x)&&So(t.y)}function zp(t,e,n){const o={id:t.id.toString(),type:t.type??"default",dimensions:s.markRaw({width:0,height:0}),computedPosition:s.markRaw({z:0,...t.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:ke(t.data)?t.data:{},events:s.markRaw(ke(t.events)?t.events:{})};return Object.assign(e??o,t,{id:t.id.toString(),parentNode:n})}function ba(t,e,n){var o,i;const r={id:t.id.toString(),type:t.type??e?.type??"default",source:t.source.toString(),target:t.target.toString(),sourceHandle:(o=t.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=t.targetHandle)==null?void 0:i.toString(),updatable:t.updatable??n?.updatable,selectable:t.selectable??n?.selectable,focusable:t.focusable??n?.focusable,data:ke(t.data)?t.data:{},events:s.markRaw(ke(t.events)?t.events:{}),label:t.label??"",interactionWidth:t.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(e??r,t,{id:t.id.toString()})}function wa(t,e,n,o){const i=typeof t=="string"?t:t.id,r=new Set,a=o==="source"?"target":"source";for(const l of n)l[a]===i&&r.add(l[o]);return e.filter(l=>r.has(l.id))}function Ap(...t){if(t.length===3){const[r,a,l]=t;return wa(r,a,l,"target")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(r=>St(r)&&r.source===o).map(r=>n.find(a=>Vt(a)&&a.id===r.target))}function Pp(...t){if(t.length===3){const[r,a,l]=t;return wa(r,a,l,"source")}const[e,n]=t,o=typeof e=="string"?e:e.id;return n.filter(r=>St(r)&&r.target===o).map(r=>n.find(a=>Vt(a)&&a.id===r.source))}function _a({source:t,sourceHandle:e,target:n,targetHandle:o}){return`vueflow__edge-${t}${e??""}-${n}${o??""}`}function Op(t,e){return e.some(n=>St(n)&&n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle))}function Mn({x:t,y:e},{x:n,y:o,zoom:i}){return{x:t*i+n,y:e*i+o}}function Bn({x:t,y:e},{x:n,y:o,zoom:i},r=!1,a=[1,1]){const l={x:(t-n)/i,y:(e-o)/i};return r?ko(l,a):l}function Rp(t,e){return{x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}}function xa({x:t,y:e,width:n,height:o}){return{x:t,y:e,x2:t+n,y2:e+o}}function Hp({x:t,y:e,x2:n,y2:o}){return{x:t,y:e,width:n-t,height:o-e}}function Ca(t){let e={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<t.length;n++){const o=t[n];e=Rp(e,xa({...o.computedPosition,...o.dimensions}))}return Hp(e)}function Ea(t,e,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...Bn(e,n),width:e.width/n.zoom,height:e.height/n.zoom},a=[];for(const l of t){const{dimensions:u,selectable:c=!0,hidden:d=!1}=l,f=u.width??l.width??null,h=u.height??l.height??null;if(i&&!c||d)continue;const p=Co(r,xo(l)),y=f===null||h===null,m=o&&p>0,b=(f??0)*(h??0);(y||m||p>=b||l.dragging)&&a.push(l)}return a}function Sa(t,e){const n=new Set;if(typeof t=="string")n.add(t);else if(t.length>=1)for(const o of t)n.add(o.id);return e.filter(o=>n.has(o.source)||n.has(o.target))}function tn(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=Number.parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return zn(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vp(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=tn(t,n),i=tn(t,e);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof t=="object"){const o=tn(t.top??t.y??0,n),i=tn(t.bottom??t.y??0,n),r=tn(t.left??t.x??0,e),a=tn(t.right??t.x??0,e);return{top:o,right:a,bottom:i,left:r,x:r+a,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Lp(t,e,n,o,i,r){const{x:a,y:l}=Mn(t,{x:e,y:n,zoom:o}),{x:u,y:c}=Mn({x:t.x+t.width,y:t.y+t.height},{x:e,y:n,zoom:o}),d=i-u,f=r-c;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}function Na(t,e,n,o,i,r=.1){const a=Vp(r,e,n),l=(e-a.x)/t.width,u=(n-a.y)/t.height,c=Math.min(l,u),d=Ht(c,o,i),f=t.x+t.width/2,h=t.y+t.height/2,p=e/2-f*d,y=n/2-h*d,m=Lp(t,p,y,d,e,n),b={left:Math.min(m.left-a.left,0),top:Math.min(m.top-a.top,0),right:Math.min(m.right-a.right,0),bottom:Math.min(m.bottom-a.bottom,0)};return{x:p-b.left+b.right,y:y-b.top+b.bottom,zoom:d}}function Fp(t,e){return{x:e.x+t.x,y:e.y+t.y,z:(t.z>e.z?t.z:e.z)+1}}function ka(t,e){if(!t.parentNode)return!1;const n=e.get(t.parentNode);return n?n.selected?!0:ka(n,e):!1}function $n(t,e){return typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`}function Da(t){const e=t.ctrlKey&&No()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e}function Ta(t,e,n){return t<e?Ht(Math.abs(t-e),1,e)/e:t>n?-Ht(Math.abs(t-n),1,e)/e:0}function Ia(t,e,n=15,o=40){const i=Ta(t.x,o,e.width-o)*n,r=Ta(t.y,o,e.height-o)*n;return[i,r]}function nr(t,e){if(e){const n=t.position.x+t.dimensions.width-e.dimensions.width,o=t.position.y+t.dimensions.height-e.dimensions.height;if(n>0||o>0||t.position.x<0||t.position.y<0){let i={};if(typeof e.style=="function"?i={...e.style(e)}:e.style&&(i={...e.style}),i.width=i.width??`${e.dimensions.width}px`,i.height=i.height??`${e.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(t.position.x<0){const r=Math.abs(t.position.x);if(e.position.x=e.position.x-r,typeof i.width=="string"){const a=Number(i.width.replace("px",""));i.width=`${a+r}px`}else i.width+=r;t.position.x=0}if(t.position.y<0){const r=Math.abs(t.position.y);if(e.position.y=e.position.y-r,typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+r}px`}else i.height+=r;t.position.y=0}e.dimensions.width=Number(i.width.toString().replace("px","")),e.dimensions.height=Number(i.height.toString().replace("px","")),typeof e.style=="function"?e.style=r=>{const a=e.style;return{...a(r),...i}}:e.style={...e.style,...i}}}}function Ma(t,e){var n,o;const i=t.filter(a=>a.type==="add"||a.type==="remove");for(const a of i)if(a.type==="add")e.findIndex(u=>u.id===a.item.id)===-1&&e.push(a.item);else if(a.type==="remove"){const l=e.findIndex(u=>u.id===a.id);l!==-1&&e.splice(l,1)}const r=e.map(a=>a.id);for(const a of e)for(const l of t)if(l.id===a.id)switch(l.type){case"select":a.selected=l.selected;break;case"position":if(In(a)&&(typeof l.position<"u"&&(a.position=l.position),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&a.parentNode)){const u=e[r.indexOf(a.parentNode)];u&&In(u)&&nr(a,u)}break;case"dimensions":if(In(a)&&(typeof l.dimensions<"u"&&(a.dimensions=l.dimensions),typeof l.updateStyle<"u"&&l.updateStyle&&(a.style={...a.style||{},width:`${(n=l.dimensions)==null?void 0:n.width}px`,height:`${(o=l.dimensions)==null?void 0:o.height}px`}),typeof l.resizing<"u"&&(a.resizing=l.resizing),a.expandParent&&a.parentNode)){const u=e[r.indexOf(a.parentNode)];u&&In(u)&&(!!u.dimensions.width&&!!u.dimensions.height?nr(a,u):s.nextTick(()=>{nr(a,u)}))}break}return e}function Nt(t,e){return{id:t,type:"select",selected:e}}function Ba(t){return{item:t,type:"add"}}function $a(t){return{id:t,type:"remove"}}function za(t,e,n,o,i){return{id:t,source:e,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function kt(t,e=new Set,n=!1){const o=[];for(const[i,r]of t){const a=e.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),o.push(Nt(r.id,a)))}return o}const Aa=()=>{};function le(t){const e=new Set;let n=Aa,o=()=>!1;const i=()=>e.size>0||o(),r=h=>{n=h},a=()=>{n=Aa},l=h=>{o=h},u=()=>{o=()=>!1},c=h=>{e.delete(h)};return{on:h=>{e.add(h);const p=()=>c(h);return mn(p),{off:p}},off:c,trigger:h=>{const p=[n];return i()?p.push(...e):t&&p.push(t),Promise.allSettled(p.map(y=>y(h)))},hasListeners:i,listeners:e,setEmitter:r,removeEmitter:a,setHasEmitListeners:l,removeHasEmitListeners:u}}function Pa(t,e,n){let o=t;do{if(o&&o.matches(e))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function jp(t,e,n,o){var i,r;const a=new Map;for(const[l,u]of t)(u.selected||u.id===o)&&(!u.parentNode||!ka(u,t))&&(u.draggable||e&&typeof u.draggable>"u")&&t.get(l)&&a.set(l,{id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((i=u.computedPosition)==null?void 0:i.x)||0,y:n.y-((r=u.computedPosition)==null?void 0:r.y)||0},from:{x:u.computedPosition.x,y:u.computedPosition.y},extent:u.extent,parentNode:u.parentNode,dimensions:{...u.dimensions},expandParent:u.expandParent});return Array.from(a.values())}function or({id:t,dragItems:e,findNode:n}){const o=[];for(const i of e){const r=n(i.id);r&&o.push(r)}return[t?o.find(i=>i.id===t):o[0],o]}function Oa(t){if(Array.isArray(t))switch(t.length){case 1:return[t[0],t[0],t[0],t[0]];case 2:return[t[0],t[1],t[0],t[1]];case 3:return[t[0],t[1],t[2],t[1]];case 4:return t;default:return[0,0,0,0]}return[t,t,t,t]}function Gp(t,e,n){const[o,i,r,a]=typeof t!="string"?Oa(t.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+a,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Wp(t,e,n,o){let i=t.extent||n;if((i==="parent"||!Array.isArray(i)&&i?.range==="parent")&&!t.expandParent)if(t.parentNode&&o&&t.dimensions.width&&t.dimensions.height){const r=Gp(i,t,o);r&&(i=r)}else e(new Be(Ne.NODE_EXTENT_INVALID,t.id)),i=n;else if(Array.isArray(i)){const r=o?.computedPosition.x||0,a=o?.computedPosition.y||0;i=[[i[0][0]+r,i[0][1]+a],[i[1][0]+r,i[1][1]+a]]}else if(i!=="parent"&&i?.range&&Array.isArray(i.range)){const[r,a,l,u]=Oa(i.padding),c=o?.computedPosition.x||0,d=o?.computedPosition.y||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-a,i.range[1][1]+d-l]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Yp({width:t,height:e},n){return[n[0],[n[1][0]-(t||0),n[1][1]-(e||0)]]}function ir(t,e,n,o,i){const r=Yp(t.dimensions,Wp(t,n,o,i)),a=ya(e,r);return{position:{x:a.x-(i?.computedPosition.x||0),y:a.y-(i?.computedPosition.y||0)},computedPosition:a}}function nn(t,e,n=de.Left,o=!1){const i=(e?.x??0)+t.computedPosition.x,r=(e?.y??0)+t.computedPosition.y,{width:a,height:l}=e??Kp(t);if(o)return{x:i+a/2,y:r+l/2};switch(e?.position??n){case de.Top:return{x:i+a/2,y:r};case de.Right:return{x:i+a,y:r+l/2};case de.Bottom:return{x:i+a/2,y:r+l};case de.Left:return{x:i,y:r+l/2}}}function Ra(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Up({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:a,height:l,viewport:u}){const c={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+i),y2:Math.max(t.y+o,e.y+r)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=xa({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:a/u.zoom,height:l/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*h)>0}function Xp(t,e,n=!1){const o=typeof t.zIndex=="number";let i=o?t.zIndex:0;const r=e(t.source),a=e(t.target);return!r||!a?0:(n&&(i=o?t.zIndex:Math.max(r.computedPosition.z||0,a.computedPosition.z||0)),i)}var Ne=(t=>(t.MISSING_STYLES="MISSING_STYLES",t.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",t.NODE_INVALID="NODE_INVALID",t.NODE_NOT_FOUND="NODE_NOT_FOUND",t.NODE_MISSING_PARENT="NODE_MISSING_PARENT",t.NODE_TYPE_MISSING="NODE_TYPE_MISSING",t.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",t.EDGE_INVALID="EDGE_INVALID",t.EDGE_NOT_FOUND="EDGE_NOT_FOUND",t.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",t.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",t.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",t.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",t.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",t.EDGE_ORPHANED="EDGE_ORPHANED",t.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",t))(Ne||{});const Ha={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:t=>`Node is invalid
7
7
  Node: ${t}`,NODE_NOT_FOUND:t=>`Node not found
8
8
  Node: ${t}`,NODE_MISSING_PARENT:(t,e)=>`Node is missing a parent
9
9
  Node: ${t}
@@ -23,6 +23,6 @@ Edge: ${t}
23
23
  Source: ${e}
24
24
  Target: ${n}`,EDGE_ORPHANED:t=>`Edge was orphaned (suddenly missing source or target) and has been removed
25
25
  Edge: ${t}`,EDGE_NOT_FOUND:t=>`Edge not found
26
- Edge: ${t}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Be extends Error{constructor(e,...n){var o;super((o=Ra[e])==null?void 0:o.call(Ra,...n)),this.name="VueFlowError",this.code=e,this.args=n}}function rr(t){return"clientX"in t}function Gp(t){return"sourceEvent"in t}function lt(t,e){const n=rr(t);let o,i;return n?(o=t.clientX,i=t.clientY):"touches"in t&&t.touches.length>0?(o=t.touches[0].clientX,i=t.touches[0].clientY):"changedTouches"in t&&t.changedTouches.length>0?(o=t.changedTouches[0].clientX,i=t.changedTouches[0].clientY):(o=0,i=0),{x:o-(e?.left??0),y:i-(e?.top??0)}}const No=()=>{var t;return typeof navigator<"u"&&((t=navigator?.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function jp(t){var e,n;return{width:((e=t.dimensions)==null?void 0:e.width)??t.width??0,height:((n=t.dimensions)==null?void 0:n.height)??t.height??0}}function ko(t,e=[1,1]){return{x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}}const Yp=()=>!0;function sr(t){t?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Up(t,e,n){const o=[],i={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const r of e.values())Eo(i,xo(r))>0&&o.push(r);return o}const Xp=250;function qp(t,e,n,o){var i,r;let s=[],l=Number.POSITIVE_INFINITY;const u=Up(t,n,e+Xp);for(const c of u){const d=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((r=c.handleBounds)==null?void 0:r.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:h,y:p}=nn(c,f,f.position,!0),y=Math.sqrt((h-t.x)**2+(p-t.y)**2);y>e||(y<l?(s=[{...f,x:h,y:p}],l=y):y===l&&s.push({...f,x:h,y:p}))}}if(!s.length)return null;if(s.length>1){const c=o.type==="source"?"target":"source";return s.find(d=>d.type===c)??s[0]}return s[0]}function Ha(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:s,lib:l,flowId:u,isValidConnection:c=Yp},d,f,h,p){const y=r==="target",m=e?s.querySelector(`.${l}-flow__handle[data-id="${u}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:v,y:N}=lt(t),_=s.elementFromPoint(v,N),g=_?.classList.contains(`${l}-flow__handle`)?_:m,x={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const z=La(void 0,g),$=g.getAttribute("data-nodeid"),F=g.getAttribute("data-handleid"),X=g.classList.contains("connectable"),Y=g.classList.contains("connectableend");if(!$||!z)return x;const S={source:y?$:o,sourceHandle:y?F:i,target:y?o:$,targetHandle:y?i:F};x.connection=S;const C=X&&Y&&(n===gt.Strict?y&&z==="source"||!y&&z==="target":$!==o||F!==i);x.isValid=C&&c(S,{nodes:f,edges:d,sourceNode:h(S.source),targetNode:h(S.target)}),x.toHandle=Va($,z,F,p,n,!0)}return x}function La(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function Kp(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function Zp(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}function Va(t,e,n,o,i,r=!1){var s,l,u;const c=o.get(t);if(!c)return null;const d=i===gt.Strict?(s=c.handleBounds)==null?void 0:s[e]:[...((l=c.handleBounds)==null?void 0:l.source)??[],...((u=c.handleBounds)==null?void 0:u.target)??[]],f=(n?d?.find(h=>h.id===n):d?.[0])??null;return f&&r?{...f,...nn(c,f,f.position,!0)}:f}const ar={[de.Left]:de.Right,[de.Right]:de.Left,[de.Top]:de.Bottom,[de.Bottom]:de.Top},Jp=["production","prod"];function zn(t,...e){Fa()&&console.warn(`[Vue Flow]: ${t}`,...e)}function Fa(){return!Jp.includes(process.env.NODE_ENV||"")}function Wa(t,e,n,o,i){const r=e.querySelectorAll(`.vue-flow__handle.${t}`);return r?.length?Array.from(r).map(s=>{const l=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:i,position:s.getAttribute("data-handlepos"),x:(l.left-n.left)/o,y:(l.top-n.top)/o,...Co(s)}}):null}function lr(t,e,n,o,i,r=!1,s){i.value=!1,t.selected?(r||t.selected&&e)&&(o([t]),a.nextTick(()=>{s.blur()})):n([t])}function ke(t){return typeof a.unref(t)<"u"}function Qp(t,e,n,o){if(!t||!t.source||!t.target)return n(new Be(Ne.EDGE_INVALID,t?.id??"[ID UNKNOWN]")),!1;let i;return St(t)?i=t:i={...t,id:wa(t)},i=va(i,void 0,o),Bp(i,e)?!1:i}function eg(t,e,n,o,i){if(!e.source||!e.target)return i(new Be(Ne.EDGE_INVALID,t.id)),!1;if(!n)return i(new Be(Ne.EDGE_NOT_FOUND,t.id)),!1;const{id:r,...s}=t;return{...s,id:o?wa(e):r,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle}}function Ga(t,e,n){const o={},i=[];for(let r=0;r<t.length;++r){const s=t[r];if(!Ht(s)){n(new Be(Ne.NODE_INVALID,s?.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const l=Tp(s,e(s.id),s.parentNode);s.parentNode&&(o[s.parentNode]=!0),i[r]=l}for(const r of i){const s=e(r.parentNode)||i.find(l=>l.id===r.parentNode);r.parentNode&&!s&&n(new Be(Ne.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),s&&(s.isParent=!0))}return i}function ja(t,e,n,o,i,r){let s=i;const l=o.get(s)||new Map;o.set(s,l.set(n,e)),s=`${i}-${t}`;const u=o.get(s)||new Map;if(o.set(s,u.set(n,e)),r){s=`${i}-${t}-${r}`;const c=o.get(s)||new Map;o.set(s,c.set(n,e))}}function cr(t,e,n){t.clear();for(const o of n){const{source:i,target:r,sourceHandle:s=null,targetHandle:l=null}=o,u={edgeId:o.id,source:i,target:r,sourceHandle:s,targetHandle:l},c=`${i}-${s}--${r}-${l}`,d=`${r}-${l}--${i}-${s}`;ja("source",u,d,t,i,s),ja("target",u,c,t,r,l)}}function Ya(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function dr(t,e,n,o,i,r,s,l){const u=[];for(const c of t){const d=St(c)?c:Qp(c,l,i,r);if(!d)continue;const f=n(d.source),h=n(d.target);if(!f||!h){i(new Be(Ne.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new Be(Ne.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!h){i(new Be(Ne.EDGE_TARGET_MISSING,d.id,d.target));continue}if(e&&!e(d,{edges:l,nodes:s,sourceNode:f,targetNode:h})){i(new Be(Ne.EDGE_INVALID,d.id));continue}const p=o(d.id);u.push({...va(d,p,r),sourceNode:f,targetNode:h})}return u}const Ua=Symbol("vueFlow"),Xa=Symbol("nodeId"),qa=Symbol("nodeRef"),tg=Symbol("edgeId"),ng=Symbol("edgeRef"),Do=Symbol("slots");function Ka(t){const{vueFlowRef:e,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:r,nodeExtent:s,nodeDragThreshold:l,viewport:u,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:y,nodesSelectionActive:m,selectNodesOnDrag:v,removeSelectedElements:N,addSelectedNodes:_,updateNodePositions:g,emits:x}=we(),{onStart:z,onDrag:$,onStop:F,onClick:X,el:Y,disabled:S,id:I,selectable:C,dragHandle:H}=t,w=a.shallowRef(!1);let k=[],b,E=null,T={x:void 0,y:void 0},O={x:0,y:0},R=null,B=!1,P=!1,V=0,W=!1;const Z=rg(),Q=({x:ie,y:ae})=>{T={x:ie,y:ae};let A=!1;if(k=k.map(M=>{const L={x:ie-M.distance.x,y:ae-M.distance.y},{computedPosition:U}=ir(M,n.value?ko(L,o.value):L,x.error,s.value,M.parentNode?p(M.parentNode):void 0);return A=A||M.position.x!==U.x||M.position.y!==U.y,M.position=U,M}),P=P||A,!!A&&(g(k,!0,!0),w.value=!0,R)){const[M,L]=or({id:I,dragItems:k,findNode:p});$({event:R,node:M,nodes:L})}},q=()=>{if(!E)return;const[ie,ae]=Ta(O,E,d.value);if(ie!==0||ae!==0){const A={x:(T.x??0)-ie/u.value.zoom,y:(T.y??0)-ae/u.value.zoom};h({x:ie,y:ae})&&Q(A)}V=requestAnimationFrame(q)},ee=(ie,ae)=>{B=!0;const A=p(I);!v.value&&!y.value&&A&&(A.selected||N()),A&&a.toValue(C)&&v.value&&lr(A,y.value,_,N,m,!1,ae);const M=Z(ie.sourceEvent);if(T=M,k=Rp(r.value,f.value,M,I),k.length){const[L,U]=or({id:I,dragItems:k,findNode:p});z({event:ie.sourceEvent,node:L,nodes:U})}},re=(ie,ae)=>{var A;ie.sourceEvent.type==="touchmove"&&ie.sourceEvent.touches.length>1||(P=!1,l.value===0&&ee(ie,ae),T=Z(ie.sourceEvent),E=((A=e.value)==null?void 0:A.getBoundingClientRect())||null,O=lt(ie.sourceEvent,E))},oe=(ie,ae)=>{const A=Z(ie.sourceEvent);if(!W&&B&&c.value&&(W=!0,q()),!B){const M=A.xSnapped-(T.x??0),L=A.ySnapped-(T.y??0);Math.sqrt(M*M+L*L)>l.value&&ee(ie,ae)}(T.x!==A.xSnapped||T.y!==A.ySnapped)&&k.length&&B&&(R=ie.sourceEvent,O=lt(ie.sourceEvent,E),Q(A))},ce=ie=>{let ae=!1;if(!B&&!w.value&&!y.value){const A=ie.sourceEvent,M=Z(A),L=M.xSnapped-(T.x??0),U=M.ySnapped-(T.y??0),D=Math.sqrt(L*L+U*U);D!==0&&D<=l.value&&(X?.(A),ae=!0)}if(k.length&&!ae){P&&(g(k,!1,!1),P=!1);const[A,M]=or({id:I,dragItems:k,findNode:p});F({event:ie.sourceEvent,node:A,nodes:M})}k=[],w.value=!1,W=!1,B=!1,T={x:void 0,y:void 0},cancelAnimationFrame(V)};return a.watch([()=>a.toValue(S),Y],([ie,ae],A,M)=>{if(ae){const L=Je(ae);ie||(b=Df().on("start",U=>re(U,ae)).on("drag",U=>oe(U,ae)).on("end",U=>ce(U)).filter(U=>{const D=U.target,j=a.toValue(H);return!U.button&&(!i.value||!Aa(D,`.${i.value}`,ae)&&(!j||Aa(D,j,ae)))}),L.call(b)),M(()=>{L.on(".drag",null),b&&(b.on("start",null),b.on("drag",null),b.on("end",null))})}}),w}function og(){return{doubleClick:le(),click:le(),mouseEnter:le(),mouseMove:le(),mouseLeave:le(),contextMenu:le(),updateStart:le(),update:le(),updateEnd:le()}}function ig(t,e){const n=og();return n.doubleClick.on(o=>{var i,r;e.edgeDoubleClick(o),(r=(i=t.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;e.edgeClick(o),(r=(i=t.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;e.edgeMouseEnter(o),(r=(i=t.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;e.edgeMouseMove(o),(r=(i=t.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;e.edgeMouseLeave(o),(r=(i=t.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;e.edgeContextMenu(o),(r=(i=t.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.updateStart.on(o=>{var i,r;e.edgeUpdateStart(o),(r=(i=t.events)==null?void 0:i.updateStart)==null||r.call(i,o)}),n.update.on(o=>{var i,r;e.edgeUpdate(o),(r=(i=t.events)==null?void 0:i.update)==null||r.call(i,o)}),n.updateEnd.on(o=>{var i,r;e.edgeUpdateEnd(o),(r=(i=t.events)==null?void 0:i.updateEnd)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function rg(){const{viewport:t,snapGrid:e,snapToGrid:n,vueFlowRef:o}=we();return i=>{var r;const s=((r=o.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},l=Gp(i)?i.sourceEvent:i,{x:u,y:c}=lt(l,s),d=Bn({x:u,y:c},t.value),{x:f,y:h}=n.value?ko(d,e.value):d;return{xSnapped:f,ySnapped:h,...d}}}function To(){return!0}function Za({handleId:t,nodeId:e,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:s}){const{id:l,vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:m,findNode:v,panBy:N,startConnection:_,updateConnection:g,endConnection:x,emits:z,viewport:$,edges:F,nodes:X,isValidConnection:Y,nodeLookup:S}=we();let I=null,C=!1,H=null;function w(b){var E;const T=a.toValue(n)==="target",O=rr(b),R=ya(b.target),B=b.currentTarget;if(B&&(O&&b.button===0||!O)){let P=function(ne){A=lt(ne,ce),Q=qp(Bn(A,$.value,!1,[1,1]),d.value,S.value,U),M||(L(),M=!0);const te=Ha(ne,{handle:Q,connectionMode:c.value,fromNodeId:a.toValue(e),fromHandleId:a.toValue(t),fromType:T?"target":"source",isValidConnection:Z,doc:R,lib:"vue",flowId:l,nodeLookup:S.value},F.value,X.value,v,S.value);H=te.handleDomNode,I=te.connection,C=Zp(!!Q,te.isValid);const fe={...K,isValid:C,to:te.toHandle&&C?In({x:te.toHandle.x,y:te.toHandle.y},$.value):A,toHandle:te.toHandle,toPosition:C&&te.toHandle?te.toHandle.position:ar[U.position],toNode:te.toHandle?S.value.get(te.toHandle.nodeId):null};if(C&&Q&&K?.toHandle&&fe.toHandle&&K.toHandle.type===fe.toHandle.type&&K.toHandle.nodeId===fe.toHandle.nodeId&&K.toHandle.id===fe.toHandle.id&&K.to.x===fe.to.x&&K.to.y===fe.to.y)return;const ge=Q??te.toHandle;if(g(ge&&C?In({x:ge.x,y:ge.y},$.value):A,ge,Kp(!!ge,C)),K=fe,!Q&&!C&&!H)return sr(ae);I&&I.source!==I.target&&H&&(sr(ae),ae=H,H.classList.add("connecting","vue-flow__handle-connecting"),H.classList.toggle("valid",!!C),H.classList.toggle("vue-flow__handle-valid",!!C))},V=function(ne){"touches"in ne&&ne.touches.length>0||((Q||H)&&I&&C&&(r?r(ne,I):z.connect(I)),z.connectEnd(ne),i&&s?.(ne),sr(ae),cancelAnimationFrame(q),x(ne),M=!1,C=!1,I=null,H=null,R.removeEventListener("mousemove",P),R.removeEventListener("mouseup",V),R.removeEventListener("touchmove",P),R.removeEventListener("touchend",V))};const W=v(a.toValue(e));let Z=a.toValue(o)||Y.value||To;!Z&&W&&(Z=(T?W.isValidSourcePos:W.isValidTargetPos)||To);let Q,q=0;const{x:ee,y:re}=lt(b),oe=La(a.toValue(i),B),ce=(E=u.value)==null?void 0:E.getBoundingClientRect();if(!ce||!oe)return;const ie=Va(a.toValue(e),oe,a.toValue(t),S.value,c.value);if(!ie)return;let ae,A=lt(b,ce),M=!1;const L=()=>{if(!y.value)return;const[ne,te]=Ta(A,ce,m.value);N({x:ne,y:te}),q=requestAnimationFrame(L)},U={...ie,nodeId:a.toValue(e),type:oe,position:ie.position},D=S.value.get(a.toValue(e)),G={inProgress:!0,isValid:null,from:nn(D,U,de.Left,!0),fromHandle:U,fromPosition:U.position,fromNode:D,to:A,toHandle:null,toPosition:ar[U.position],toNode:null};_({nodeId:a.toValue(e),id:a.toValue(t),type:oe,position:B?.getAttribute("data-handlepos")||de.Top,...A},{x:ee-ce.left,y:re-ce.top}),z.connectStart({event:b,nodeId:a.toValue(e),handleId:a.toValue(t),handleType:oe});let K=G;R.addEventListener("mousemove",P),R.addEventListener("mouseup",V),R.addEventListener("touchmove",P),R.addEventListener("touchend",V)}}function k(b){var E,T;if(!f.value)return;const O=a.toValue(n)==="target";if(!h.value){z.clickConnectStart({event:b,nodeId:a.toValue(e),handleId:a.toValue(t)}),_({nodeId:a.toValue(e),type:a.toValue(n),id:a.toValue(t),position:de.Top,...lt(b)},void 0,!0);return}let R=a.toValue(o)||Y.value||To;const B=v(a.toValue(e));if(!R&&B&&(R=(O?B.isValidSourcePos:B.isValidTargetPos)||To),B&&(typeof B.connectable>"u"?p.value:B.connectable)===!1)return;const P=ya(b.target),V=Ha(b,{handle:{nodeId:a.toValue(e),id:a.toValue(t),type:a.toValue(n),position:de.Top,...lt(b)},connectionMode:c.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:R,doc:P,lib:"vue",flowId:l,nodeLookup:S.value},F.value,X.value,v,S.value),W=((E=V.connection)==null?void 0:E.source)===((T=V.connection)==null?void 0:T.target);V.isValid&&V.connection&&!W&&z.connect(V.connection),z.clickConnectEnd(b),x(b,!0)}return{handlePointerDown:w,handleClick:k}}function sg(){return a.inject(Xa,"")}function Ja(t){const e=t??sg()??"",n=a.inject(qa,a.ref(null)),{findNode:o,edges:i,emits:r}=we(),s=o(e);return s||r.error(new Be(Ne.NODE_NOT_FOUND,e)),{id:e,nodeEl:n,node:s,parentNode:a.computed(()=>o(s.parentNode)),connectedEdges:a.computed(()=>Ca([s],i.value))}}function ag(){return{doubleClick:le(),click:le(),mouseEnter:le(),mouseMove:le(),mouseLeave:le(),contextMenu:le(),dragStart:le(),drag:le(),dragStop:le()}}function lg(t,e){const n=ag();return n.doubleClick.on(o=>{var i,r;e.nodeDoubleClick(o),(r=(i=t.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;e.nodeClick(o),(r=(i=t.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;e.nodeMouseEnter(o),(r=(i=t.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;e.nodeMouseMove(o),(r=(i=t.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;e.nodeMouseLeave(o),(r=(i=t.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;e.nodeContextMenu(o),(r=(i=t.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.dragStart.on(o=>{var i,r;e.nodeDragStart(o),(r=(i=t.events)==null?void 0:i.dragStart)==null||r.call(i,o)}),n.drag.on(o=>{var i,r;e.nodeDrag(o),(r=(i=t.events)==null?void 0:i.drag)==null||r.call(i,o)}),n.dragStop.on(o=>{var i,r;e.nodeDragStop(o),(r=(i=t.events)==null?void 0:i.dragStop)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function Qa(){const{getSelectedNodes:t,nodeExtent:e,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:s,emits:l}=we();return(u,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=c?4:1,p=u.x*d*h,y=u.y*f*h,m=[];for(const v of t.value)if(v.draggable||s&&typeof v.draggable>"u"){const N={x:v.computedPosition.x+p,y:v.computedPosition.y+y},{position:_}=ir(v,N,l.error,e.value,v.parentNode?o(v.parentNode):void 0);m.push({id:v.id,position:_,from:v.position,distance:{x:u.x,y:u.y},dimensions:v.dimensions})}n(m,!0,!1)}}const Mo=.1,cg=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2;function Dt(){return zn("Viewport not initialized yet."),Promise.resolve(!1)}const dg={zoomIn:Dt,zoomOut:Dt,zoomTo:Dt,fitView:Dt,setCenter:Dt,fitBounds:Dt,project:t=>t,screenToFlowCoordinate:t=>t,flowToScreenCoordinate:t=>t,setViewport:Dt,setTransform:Dt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function ug(t){function e(o,i){return new Promise(r=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(i?.interpolate==="linear"?xn:fo).scaleBy(ur(t.d3Selection,i?.duration,i?.ease,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,s){return new Promise(l=>{var u;const{x:c,y:d}=ma({x:-o,y:-i},t.translateExtent),f=Qt.translate(-c,-d).scale(r);t.d3Selection&&t.d3Zoom?(u=t.d3Zoom)==null||u.interpolate(s?.interpolate==="linear"?xn:fo).transform(ur(t.d3Selection,s?.duration,s?.ease,()=>{l(!0)}),f):l(!1)})}return a.computed(()=>t.d3Zoom&&t.d3Selection&&t.dimensions.width&&t.dimensions.height?{viewportInitialized:!0,zoomIn:i=>e(1.2,i),zoomOut:i=>e(1/1.2,i),zoomTo:(i,r)=>new Promise(s=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(r?.interpolate==="linear"?xn:fo).scaleTo(ur(t.d3Selection,r?.duration,r?.ease,()=>{s(!0)}),i):s(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r),getViewport:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),getTransform:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),fitView:(i={padding:Mo,includeHiddenNodes:!1,duration:0})=>{var r,s;const l=[];for(const h of t.nodes)h.dimensions.width&&h.dimensions.height&&(i?.includeHiddenNodes||!h.hidden)&&(!((r=i.nodes)!=null&&r.length)||(s=i.nodes)!=null&&s.length&&i.nodes.includes(h.id))&&l.push(h);if(!l.length)return Promise.resolve(!1);const u=xa(l),{x:c,y:d,zoom:f}=Sa(u,t.dimensions.width,t.dimensions.height,i.minZoom??t.minZoom,i.maxZoom??t.maxZoom,i.padding??Mo);return n(c,d,f,i)},setCenter:(i,r,s)=>{const l=typeof s?.zoom<"u"?s.zoom:t.maxZoom,u=t.dimensions.width/2-i*l,c=t.dimensions.height/2-r*l;return n(u,c,l,s)},fitBounds:(i,r={padding:Mo})=>{const{x:s,y:l,zoom:u}=Sa(i,t.dimensions.width,t.dimensions.height,t.minZoom,t.maxZoom,r.padding??Mo);return n(s,l,u,r)},project:i=>Bn(i,t.viewport,t.snapToGrid,t.snapGrid),screenToFlowCoordinate:i=>{if(t.vueFlowRef){const{x:r,y:s}=t.vueFlowRef.getBoundingClientRect(),l={x:i.x-r,y:i.y-s};return Bn(l,t.viewport,t.snapToGrid,t.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(t.vueFlowRef){const{x:r,y:s}=t.vueFlowRef.getBoundingClientRect(),l={x:i.x+r,y:i.y+s};return In(l,t.viewport)}return{x:0,y:0}}}:dg)}function ur(t,e=0,n=cg,o=()=>{}){const i=typeof e=="number"&&e>0;return i||o(),i?t.transition().duration(e).ease(n).on("end",o):t}function fg(t,e,n){const o=a.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let m,v,N=!!(n.nodes.value.length||n.edges.value.length);m=Xt([t.modelValue,()=>{var _,g;return(g=(_=t.modelValue)==null?void 0:_.value)==null?void 0:g.length}],([_])=>{_&&Array.isArray(_)&&(v?.pause(),n.setElements(_),!v&&!N&&_.length?N=!0:v?.resume())}),v=Xt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([_,g])=>{var x;(x=t.modelValue)!=null&&x.value&&Array.isArray(t.modelValue.value)&&(m?.pause(),t.modelValue.value=[..._,...g],a.nextTick(()=>{m?.resume()}))},{immediate:N}),a.onScopeDispose(()=>{m?.stop(),v?.stop()})})},r=()=>{o.run(()=>{let m,v,N=!!n.nodes.value.length;m=Xt([t.nodes,()=>{var _,g;return(g=(_=t.nodes)==null?void 0:_.value)==null?void 0:g.length}],([_])=>{_&&Array.isArray(_)&&(v?.pause(),n.setNodes(_),!v&&!N&&_.length?N=!0:v?.resume())}),v=Xt([n.nodes,()=>n.nodes.value.length],([_])=>{var g;(g=t.nodes)!=null&&g.value&&Array.isArray(t.nodes.value)&&(m?.pause(),t.nodes.value=[..._],a.nextTick(()=>{m?.resume()}))},{immediate:N}),a.onScopeDispose(()=>{m?.stop(),v?.stop()})})},s=()=>{o.run(()=>{let m,v,N=!!n.edges.value.length;m=Xt([t.edges,()=>{var _,g;return(g=(_=t.edges)==null?void 0:_.value)==null?void 0:g.length}],([_])=>{_&&Array.isArray(_)&&(v?.pause(),n.setEdges(_),!v&&!N&&_.length?N=!0:v?.resume())}),v=Xt([n.edges,()=>n.edges.value.length],([_])=>{var g;(g=t.edges)!=null&&g.value&&Array.isArray(t.edges.value)&&(m?.pause(),t.edges.value=[..._],a.nextTick(()=>{m?.resume()}))},{immediate:N}),a.onScopeDispose(()=>{m?.stop(),v?.stop()})})},l=()=>{o.run(()=>{a.watch(()=>e.maxZoom,()=>{e.maxZoom&&ke(e.maxZoom)&&n.setMaxZoom(e.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{a.watch(()=>e.minZoom,()=>{e.minZoom&&ke(e.minZoom)&&n.setMinZoom(e.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{a.watch(()=>e.translateExtent,()=>{e.translateExtent&&ke(e.translateExtent)&&n.setTranslateExtent(e.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{a.watch(()=>e.nodeExtent,()=>{e.nodeExtent&&ke(e.nodeExtent)&&n.setNodeExtent(e.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{a.watch(()=>e.applyDefault,()=>{ke(e.applyDefault)&&(n.applyDefault.value=e.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const m=async v=>{let N=v;typeof e.autoConnect=="function"&&(N=await e.autoConnect(v)),N!==!1&&n.addEdges([N])};a.watch(()=>e.autoConnect,()=>{ke(e.autoConnect)&&(n.autoConnect.value=e.autoConnect)},{immediate:!0}),a.watch(n.autoConnect,(v,N,_)=>{v?n.onConnect(m):n.hooks.value.connect.off(m),_(()=>{n.hooks.value.connect.off(m)})},{immediate:!0})})},p=()=>{const m=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const v of Object.keys(e)){const N=v;if(!m.includes(N)){const _=a.toRef(()=>e[N]),g=n[N];a.isRef(g)&&o.run(()=>{a.watch(_,x=>{ke(x)&&(g.value=x)},{immediate:!0})})}}};i(),r(),s(),u(),l(),c(),d(),f(),h(),p()}),()=>o.stop()}function hg(){return{edgesChange:le(),nodesChange:le(),nodeDoubleClick:le(),nodeClick:le(),nodeMouseEnter:le(),nodeMouseMove:le(),nodeMouseLeave:le(),nodeContextMenu:le(),nodeDragStart:le(),nodeDrag:le(),nodeDragStop:le(),nodesInitialized:le(),miniMapNodeClick:le(),miniMapNodeDoubleClick:le(),miniMapNodeMouseEnter:le(),miniMapNodeMouseMove:le(),miniMapNodeMouseLeave:le(),connect:le(),connectStart:le(),connectEnd:le(),clickConnectStart:le(),clickConnectEnd:le(),paneReady:le(),init:le(),move:le(),moveStart:le(),moveEnd:le(),selectionDragStart:le(),selectionDrag:le(),selectionDragStop:le(),selectionContextMenu:le(),selectionStart:le(),selectionEnd:le(),viewportChangeStart:le(),viewportChange:le(),viewportChangeEnd:le(),paneScroll:le(),paneClick:le(),paneContextMenu:le(),paneMouseEnter:le(),paneMouseMove:le(),paneMouseLeave:le(),edgeContextMenu:le(),edgeMouseEnter:le(),edgeMouseMove:le(),edgeMouseLeave:le(),edgeDoubleClick:le(),edgeClick:le(),edgeUpdateStart:le(),edgeUpdate:le(),edgeUpdateEnd:le(),updateNodeInternals:le(),error:le(t=>zn(t.message))}}function pg(t,e){const n=a.getCurrentInstance();a.onBeforeMount(()=>{for(const[i,r]of Object.entries(e.value)){const s=l=>{t(i,l)};r.setEmitter(s),mn(r.removeEmitter),r.setHasEmitListeners(()=>o(i)),mn(r.removeHasEmitListeners)}});function o(i){var r;const s=gg(i);return!!((r=n?.vnode.props)==null?void 0:r[s])}}function gg(t){const[e,...n]=t.split(":");return`on${e.replace(/(?:^|-)(\w)/g,(i,r)=>r.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function el(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:er.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Dn.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Ot.Bezier,style:{}},connectionMode:gt.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:No()?"Meta":"Control",zoomActivationKeyCode:No()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:hg(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const mg=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function yg(t,e,n){const o=ug(t),i=A=>{const M=A??[];t.hooks.updateNodeInternals.trigger(M)},r=A=>Ip(A,t.nodes,t.edges),s=A=>Mp(A,t.nodes,t.edges),l=A=>Ca(A,t.edges),u=({id:A,type:M,nodeId:L})=>{var U;const D=A?`-${M}-${A}`:`-${M}`;return Array.from(((U=t.connectionLookup.get(`${L}${D}`))==null?void 0:U.values())??[])},c=A=>{if(A)return e.value.get(A)},d=A=>{if(A)return n.value.get(A)},f=(A,M,L)=>{var U,D;const j=[];for(const G of A){const K={id:G.id,type:"position",dragging:L,from:G.from};if(M&&(K.position=G.position,G.parentNode)){const ne=c(G.parentNode);K.position={x:K.position.x-(((U=ne?.computedPosition)==null?void 0:U.x)??0),y:K.position.y-(((D=ne?.computedPosition)==null?void 0:D.y)??0)}}j.push(K)}j?.length&&t.hooks.nodesChange.trigger(j)},h=A=>{if(!t.vueFlowRef)return;const M=t.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!M)return;const L=window.getComputedStyle(M),{m22:U}=new window.DOMMatrixReadOnly(L.transform),D=[];for(const j of A){const G=j,K=c(G.id);if(K){const ne=Co(G.nodeElement);if(!!(ne.width&&ne.height&&(K.dimensions.width!==ne.width||K.dimensions.height!==ne.height||G.forceUpdate))){const fe=G.nodeElement.getBoundingClientRect();K.dimensions=ne,K.handleBounds.source=Wa("source",G.nodeElement,fe,U,K.id),K.handleBounds.target=Wa("target",G.nodeElement,fe,U,K.id),D.push({id:K.id,type:"dimensions",dimensions:ne})}}}!t.fitViewOnInitDone&&t.fitViewOnInit&&o.value.fitView().then(()=>{t.fitViewOnInitDone=!0}),D.length&&t.hooks.nodesChange.trigger(D)},p=(A,M)=>{const L=new Set,U=new Set;for(const G of A)Ht(G)?L.add(G.id):St(G)&&U.add(G.id);const D=kt(e.value,L,!0),j=kt(n.value,U);if(t.multiSelectionActive){for(const G of L)D.push(Nt(G,M));for(const G of U)j.push(Nt(G,M))}D.length&&t.hooks.nodesChange.trigger(D),j.length&&t.hooks.edgesChange.trigger(j)},y=A=>{if(t.multiSelectionActive){const M=A.map(L=>Nt(L.id,!0));t.hooks.nodesChange.trigger(M);return}t.hooks.nodesChange.trigger(kt(e.value,new Set(A.map(M=>M.id)),!0)),t.hooks.edgesChange.trigger(kt(n.value))},m=A=>{if(t.multiSelectionActive){const M=A.map(L=>Nt(L.id,!0));t.hooks.edgesChange.trigger(M);return}t.hooks.edgesChange.trigger(kt(n.value,new Set(A.map(M=>M.id)))),t.hooks.nodesChange.trigger(kt(e.value,new Set,!0))},v=A=>{p(A,!0)},N=A=>{const L=(A||t.nodes).map(U=>(U.selected=!1,Nt(U.id,!1)));t.hooks.nodesChange.trigger(L)},_=A=>{const L=(A||t.edges).map(U=>(U.selected=!1,Nt(U.id,!1)));t.hooks.edgesChange.trigger(L)},g=A=>{if(!A||!A.length)return p([],!1);const M=A.reduce((L,U)=>{const D=Nt(U.id,!1);return Ht(U)?L.nodes.push(D):L.edges.push(D),L},{nodes:[],edges:[]});M.nodes.length&&t.hooks.nodesChange.trigger(M.nodes),M.edges.length&&t.hooks.edgesChange.trigger(M.edges)},x=A=>{var M;(M=t.d3Zoom)==null||M.scaleExtent([A,t.maxZoom]),t.minZoom=A},z=A=>{var M;(M=t.d3Zoom)==null||M.scaleExtent([t.minZoom,A]),t.maxZoom=A},$=A=>{var M;(M=t.d3Zoom)==null||M.translateExtent(A),t.translateExtent=A},F=A=>{t.nodeExtent=A,i()},X=A=>{var M;(M=t.d3Zoom)==null||M.clickDistance(A)},Y=A=>{t.nodesDraggable=A,t.nodesConnectable=A,t.elementsSelectable=A},S=A=>{const M=A instanceof Function?A(t.nodes):A;!t.initialized&&!M.length||(t.nodes=Ga(M,c,t.hooks.error.trigger))},I=A=>{const M=A instanceof Function?A(t.edges):A;if(!t.initialized&&!M.length)return;const L=dr(M,t.isValidConnection,c,d,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);cr(t.connectionLookup,n.value,L),t.edges=L},C=A=>{const M=A instanceof Function?A([...t.nodes,...t.edges]):A;!t.initialized&&!M.length||(S(M.filter(Ht)),I(M.filter(St)))},H=A=>{let M=A instanceof Function?A(t.nodes):A;M=Array.isArray(M)?M:[M];const L=Ga(M,c,t.hooks.error.trigger),U=[];for(const D of L)U.push(Ia(D));U.length&&t.hooks.nodesChange.trigger(U)},w=A=>{let M=A instanceof Function?A(t.edges):A;M=Array.isArray(M)?M:[M];const L=dr(M,t.isValidConnection,c,d,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges),U=[];for(const D of L)U.push(Ia(D));U.length&&t.hooks.edgesChange.trigger(U)},k=(A,M=!0,L=!1)=>{const U=A instanceof Function?A(t.nodes):A,D=Array.isArray(U)?U:[U],j=[],G=[];function K(te){const fe=l(te);for(const ge of fe)(!ke(ge.deletable)||ge.deletable)&&G.push($a(ge.id,ge.source,ge.target,ge.sourceHandle,ge.targetHandle))}function ne(te){const fe=[];for(const ge of t.nodes)ge.parentNode===te&&fe.push(ge);if(fe.length){for(const ge of fe)j.push(Ba(ge.id));M&&K(fe);for(const ge of fe)ne(ge.id)}}for(const te of D){const fe=typeof te=="string"?c(te):te;fe&&(ke(fe.deletable)&&!fe.deletable||(j.push(Ba(fe.id)),M&&K([fe]),L&&ne(fe.id)))}G.length&&t.hooks.edgesChange.trigger(G),j.length&&t.hooks.nodesChange.trigger(j)},b=A=>{const M=A instanceof Function?A(t.edges):A,L=Array.isArray(M)?M:[M],U=[];for(const D of L){const j=typeof D=="string"?d(D):D;j&&(ke(j.deletable)&&!j.deletable||U.push($a(typeof D=="string"?D:D.id,j.source,j.target,j.sourceHandle,j.targetHandle)))}t.hooks.edgesChange.trigger(U)},E=(A,M,L=!0)=>{const U=d(A.id);if(!U)return!1;const D=t.edges.indexOf(U),j=eg(A,M,U,L,t.hooks.error.trigger);if(j){const[G]=dr([j],t.isValidConnection,c,d,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);return t.edges=t.edges.map((K,ne)=>ne===D?G:K),cr(t.connectionLookup,n.value,[G]),G}return!1},T=(A,M,L={replace:!1})=>{const U=d(A);if(!U)return;const D=typeof M=="function"?M(U):M;U.data=L.replace?D:{...U.data,...D}},O=A=>Ma(A,t.nodes),R=A=>{const M=Ma(A,t.edges);return cr(t.connectionLookup,n.value,M),M},B=(A,M,L={replace:!1})=>{const U=c(A);if(!U)return;const D=typeof M=="function"?M(U):M;L.replace?t.nodes.splice(t.nodes.indexOf(U),1,D):Object.assign(U,D)},P=(A,M,L={replace:!1})=>{const U=c(A);if(!U)return;const D=typeof M=="function"?M(U):M;U.data=L.replace?D:{...U.data,...D}},V=(A,M,L=!1)=>{L?t.connectionClickStartHandle=A:t.connectionStartHandle=A,t.connectionEndHandle=null,t.connectionStatus=null,M&&(t.connectionPosition=M)},W=(A,M=null,L=null)=>{t.connectionStartHandle&&(t.connectionPosition=A,t.connectionEndHandle=M,t.connectionStatus=L)},Z=(A,M)=>{t.connectionPosition={x:Number.NaN,y:Number.NaN},t.connectionEndHandle=null,t.connectionStatus=null,M?t.connectionClickStartHandle=null:t.connectionStartHandle=null},Q=A=>{const M=Dp(A),L=M?null:Mn(A)?A:c(A.id);return!M&&!L?[null,null,M]:[M?A:xo(L),L,M]},q=(A,M=!0,L=t.nodes)=>{const[U,D,j]=Q(A);if(!U)return[];const G=[];for(const K of L||t.nodes){if(!j&&(K.id===D.id||!K.computedPosition))continue;const ne=xo(K),te=Eo(ne,U);(M&&te>0||te>=ne.width*ne.height||te>=Number(U.width)*Number(U.height))&&G.push(K)}return G},ee=(A,M,L=!0)=>{const[U]=Q(A);if(!U)return!1;const D=Eo(U,M);return L&&D>0||D>=Number(U.width)*Number(U.height)},re=A=>{const{viewport:M,dimensions:L,d3Zoom:U,d3Selection:D,translateExtent:j}=t;if(!U||!D||!A.x&&!A.y)return!1;const G=Qt.translate(M.x+A.x,M.y+A.y).scale(M.zoom),K=[[0,0],[L.width,L.height]],ne=U.constrain()(G,K,j),te=t.viewport.x!==ne.x||t.viewport.y!==ne.y||t.viewport.zoom!==ne.k;return U.transform(D,ne),te},oe=A=>{const M=A instanceof Function?A(t):A,L=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ke(M.defaultEdgeOptions)&&(t.defaultEdgeOptions=M.defaultEdgeOptions);const U=M.modelValue||M.nodes||M.edges?[]:void 0;U&&(M.modelValue&&U.push(...M.modelValue),M.nodes&&U.push(...M.nodes),M.edges&&U.push(...M.edges),C(U));const D=()=>{ke(M.maxZoom)&&z(M.maxZoom),ke(M.minZoom)&&x(M.minZoom),ke(M.translateExtent)&&$(M.translateExtent)};for(const j of Object.keys(M)){const G=j,K=M[G];![...mg,...L].includes(G)&&ke(K)&&(t[G]=K)}$i(()=>t.d3Zoom).not.toBeNull().then(D),t.initialized||(t.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:C,setNodes:S,setEdges:I,addNodes:H,addEdges:w,removeNodes:k,removeEdges:b,findNode:c,findEdge:d,updateEdge:E,updateEdgeData:T,updateNode:B,updateNodeData:P,applyEdgeChanges:R,applyNodeChanges:O,addSelectedElements:v,addSelectedNodes:y,addSelectedEdges:m,setMinZoom:x,setMaxZoom:z,setTranslateExtent:$,setNodeExtent:F,setPaneClickDistance:X,removeSelectedElements:g,removeSelectedNodes:N,removeSelectedEdges:_,startConnection:V,updateConnection:W,endConnection:Z,setInteractive:Y,setState:oe,getIntersectingNodes:q,getIncomers:r,getOutgoers:s,getConnectedEdges:l,getHandleConnections:u,isNodeIntersecting:ee,panBy:re,fitView:A=>o.value.fitView(A),zoomIn:A=>o.value.zoomIn(A),zoomOut:A=>o.value.zoomOut(A),zoomTo:(A,M)=>o.value.zoomTo(A,M),setViewport:(A,M)=>o.value.setViewport(A,M),setTransform:(A,M)=>o.value.setTransform(A,M),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(A,M,L)=>o.value.setCenter(A,M,L),fitBounds:(A,M)=>o.value.fitBounds(A,M),project:A=>o.value.project(A),screenToFlowCoordinate:A=>o.value.screenToFlowCoordinate(A),flowToScreenCoordinate:A=>o.value.flowToScreenCoordinate(A),toObject:()=>{const A=[],M=[];for(const L of t.nodes){const{computedPosition:U,handleBounds:D,selected:j,dimensions:G,isParent:K,resizing:ne,dragging:te,events:fe,...ge}=L;A.push(ge)}for(const L of t.edges){const{selected:U,sourceNode:D,targetNode:j,events:G,...K}=L;M.push(K)}return JSON.parse(JSON.stringify({nodes:A,edges:M,position:[t.viewport.x,t.viewport.y],zoom:t.viewport.zoom,viewport:t.viewport}))},fromObject:A=>new Promise(M=>{const{nodes:L,edges:U,position:D,zoom:j,viewport:G}=A;L&&S(L),U&&I(U);const[K,ne]=G?.x&&G?.y?[G.x,G.y]:D??[null,null];if(K&&ne){const te=G?.zoom||j||t.viewport.zoom;return $i(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:K,y:ne,zoom:te}).then(()=>{M(!0)})})}else M(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const A=el();if(t.edges=[],t.nodes=[],t.d3Zoom&&t.d3Selection){const M=Qt.translate(A.defaultViewport.x??0,A.defaultViewport.y??0).scale(Rt(A.defaultViewport.zoom??1,A.minZoom,A.maxZoom)),L=t.viewportRef.getBoundingClientRect(),U=[[0,0],[L.width,L.height]],D=t.d3Zoom.constrain()(M,U,A.translateExtent);t.d3Zoom.transform(t.d3Selection,D)}oe(A)},$destroy:()=>{}}}const vg=["data-id","data-handleid","data-nodeid","data-handlepos"],bg={name:"Handle",compatConfig:{MODE:3}},on=a.defineComponent({...bg,props:{id:{default:null},type:{},position:{default:()=>de.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(t,{expose:e}){const n=a.createPropsRestProxy(t,["position","connectable","connectableStart","connectableEnd","id"]),o=a.toRef(()=>n.type??"source"),i=a.toRef(()=>n.isValidConnection??null),{id:r,connectionStartHandle:s,connectionClickStartHandle:l,connectionEndHandle:u,vueFlowRef:c,nodesConnectable:d,noDragClassName:f,noPanClassName:h}=we(),{id:p,node:y,nodeEl:m,connectedEdges:v}=Ja(),N=a.ref(),_=a.toRef(()=>typeof t.connectableStart<"u"?t.connectableStart:!0),g=a.toRef(()=>typeof t.connectableEnd<"u"?t.connectableEnd:!0),x=a.toRef(()=>{var I,C,H,w,k,b;return((I=s.value)==null?void 0:I.nodeId)===p&&((C=s.value)==null?void 0:C.id)===t.id&&((H=s.value)==null?void 0:H.type)===o.value||((w=u.value)==null?void 0:w.nodeId)===p&&((k=u.value)==null?void 0:k.id)===t.id&&((b=u.value)==null?void 0:b.type)===o.value}),z=a.toRef(()=>{var I,C,H;return((I=l.value)==null?void 0:I.nodeId)===p&&((C=l.value)==null?void 0:C.id)===t.id&&((H=l.value)==null?void 0:H.type)===o.value}),{handlePointerDown:$,handleClick:F}=Za({nodeId:p,handleId:t.id,isValidConnection:i,type:o}),X=a.computed(()=>typeof t.connectable=="string"&&t.connectable==="single"?!v.value.some(I=>{const C=I[`${o.value}Handle`];return I[o.value]!==p?!1:C?C===t.id:!0}):typeof t.connectable=="number"?v.value.filter(I=>{const C=I[`${o.value}Handle`];return I[o.value]!==p?!1:C?C===t.id:!0}).length<t.connectable:typeof t.connectable=="function"?t.connectable(y,v.value):ke(t.connectable)?t.connectable:d.value);a.onMounted(()=>{var I;if(!y.dimensions.width||!y.dimensions.height)return;const C=(I=y.handleBounds[o.value])==null?void 0:I.find(O=>O.id===t.id);if(!c.value||C)return;const H=c.value.querySelector(".vue-flow__transformationpane");if(!m.value||!N.value||!H||!t.id)return;const w=m.value.getBoundingClientRect(),k=N.value.getBoundingClientRect(),b=window.getComputedStyle(H),{m22:E}=new window.DOMMatrixReadOnly(b.transform),T={id:t.id,position:t.position,x:(k.left-w.left)/E,y:(k.top-w.top)/E,type:o.value,nodeId:p,...Co(N.value)};y.handleBounds[o.value]=[...y.handleBounds[o.value]??[],T]});function Y(I){const C=rr(I);X.value&&_.value&&(C&&I.button===0||!C)&&$(I)}function S(I){!p||!l.value&&!_.value||X.value&&F(I)}return e({handleClick:F,handlePointerDown:$,onClick:S,onPointerDown:Y}),(I,C)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"handle",ref:N,"data-id":`${a.unref(r)}-${a.unref(p)}-${t.id}-${o.value}`,"data-handleid":t.id,"data-nodeid":a.unref(p),"data-handlepos":I.position,class:a.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${I.position}`,`vue-flow__handle-${t.id}`,a.unref(f),a.unref(h),o.value,{connectable:X.value,connecting:z.value,connectablestart:_.value,connectableend:g.value,connectionindicator:X.value&&(_.value&&!x.value||g.value&&x.value)}]]),onMousedown:Y,onTouchstartPassive:Y,onClick:S},[a.renderSlot(I.$slots,"default",{id:I.id})],42,vg))}}),Io=function({sourcePosition:t=de.Bottom,targetPosition:e=de.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:s}){const l=s.label??n;return[a.h(on,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?a.h(l):a.h(a.Fragment,[l]),a.h(on,{type:"source",position:t,connectable:o,isValidConnection:r})]};Io.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Io.inheritAttrs=!1,Io.compatConfig={MODE:3};const wg=Io,Bo=function({targetPosition:t=de.Top,label:e,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??e;return[a.h(on,{type:"target",position:t,connectable:n,isValidConnection:o}),typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r])]};Bo.props=["targetPosition","label","isValidTargetPos","connectable","data"],Bo.inheritAttrs=!1,Bo.compatConfig={MODE:3};const _g=Bo,$o=function({sourcePosition:t=de.Bottom,label:e,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??e;return[typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r]),a.h(on,{type:"source",position:t,connectable:n,isValidConnection:o})]};$o.props=["sourcePosition","label","isValidSourcePos","connectable","data"],$o.inheritAttrs=!1,$o.compatConfig={MODE:3};const xg=$o,Eg=["transform"],Cg=["width","height","x","y","rx","ry"],Sg=["y"],Ng={name:"EdgeText",compatConfig:{MODE:3}},kg=a.defineComponent({...Ng,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(t){const e=a.ref({x:0,y:0,width:0,height:0}),n=a.ref(null),o=a.computed(()=>`translate(${t.x-e.value.width/2} ${t.y-e.value.height/2})`);a.onMounted(i),a.watch([()=>t.x,()=>t.y,n,()=>t.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==e.value.width||r.height!==e.value.height)&&(e.value=r)}return(r,s)=>(a.openBlock(),a.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(a.openBlock(),a.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${e.value.width+2*r.labelBgPadding[0]}px`,height:`${e.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:a.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Cg)):a.createCommentVNode("",!0),a.createElementVNode("text",a.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:e.value.height/2,dy:"0.3em",style:r.labelStyle}),[a.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.label),{key:0})):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(r.label),1)],64))])],16,Sg)],8,Eg))}}),Dg=["id","d","marker-end","marker-start"],Tg=["d","stroke-width"],Mg={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},An=a.defineComponent({...Mg,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(t,{expose:e}){const n=a.ref(null),o=a.ref(null),i=a.ref(null),r=a.useAttrs();return e({pathEl:n,interactionEl:o,labelEl:i}),(s,l)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",a.mergeProps(a.unref(r),{id:s.id,ref_key:"pathEl",ref:n,d:s.path,class:"vue-flow__edge-path","marker-end":s.markerEnd,"marker-start":s.markerStart}),null,16,Dg),s.interactionWidth?(a.openBlock(),a.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:s.path,"stroke-width":s.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Tg)):a.createCommentVNode("",!0),s.label&&s.labelX&&s.labelY?(a.openBlock(),a.createBlock(kg,{key:1,ref_key:"labelEl",ref:i,x:s.labelX,y:s.labelY,label:s.label,"label-show-bg":s.labelShowBg,"label-bg-style":s.labelBgStyle,"label-bg-padding":s.labelBgPadding,"label-bg-border-radius":s.labelBgBorderRadius,"label-style":s.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):a.createCommentVNode("",!0)],64))}});function tl({sourceX:t,sourceY:e,targetX:n,targetY:o}){const i=Math.abs(n-t)/2,r=n<t?n+i:n-i,s=Math.abs(o-e)/2,l=o<e?o+s:o-s;return[r,l,i,s]}function nl({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:s,targetControlY:l}){const u=t*.125+i*.375+s*.375+n*.125,c=e*.125+r*.375+l*.375+o*.125,d=Math.abs(u-t),f=Math.abs(c-e);return[u,c,d,f]}function zo(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function ol({pos:t,x1:e,y1:n,x2:o,y2:i,c:r}){let s,l;switch(t){case de.Left:s=e-zo(e-o,r),l=n;break;case de.Right:s=e+zo(o-e,r),l=n;break;case de.Top:s=e,l=n-zo(n-i,r);break;case de.Bottom:s=e,l=n+zo(i-n,r);break}return[s,l]}function fr(t){const{sourceX:e,sourceY:n,sourcePosition:o=de.Bottom,targetX:i,targetY:r,targetPosition:s=de.Top,curvature:l=.25}=t,[u,c]=ol({pos:o,x1:e,y1:n,x2:i,y2:r,c:l}),[d,f]=ol({pos:s,x1:i,y1:r,x2:e,y2:n,c:l}),[h,p,y,m]=nl({sourceX:e,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${n} C${u},${c} ${d},${f} ${i},${r}`,h,p,y,m]}function il({pos:t,x1:e,y1:n,x2:o,y2:i}){let r,s;switch(t){case de.Left:case de.Right:r=.5*(e+o),s=n;break;case de.Top:case de.Bottom:r=e,s=.5*(n+i);break}return[r,s]}function rl(t){const{sourceX:e,sourceY:n,sourcePosition:o=de.Bottom,targetX:i,targetY:r,targetPosition:s=de.Top}=t,[l,u]=il({pos:o,x1:e,y1:n,x2:i,y2:r}),[c,d]=il({pos:s,x1:i,y1:r,x2:e,y2:n}),[f,h,p,y]=nl({sourceX:e,sourceY:n,targetX:i,targetY:r,sourceControlX:l,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${e},${n} C${l},${u} ${c},${d} ${i},${r}`,f,h,p,y]}const sl={[de.Left]:{x:-1,y:0},[de.Right]:{x:1,y:0},[de.Top]:{x:0,y:-1},[de.Bottom]:{x:0,y:1}};function Ig({source:t,sourcePosition:e=de.Bottom,target:n}){return e===de.Left||e===de.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1}}function al(t,e){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Bg({source:t,sourcePosition:e=de.Bottom,target:n,targetPosition:o=de.Top,center:i,offset:r}){const s=sl[e],l=sl[o],u={x:t.x+s.x*r,y:t.y+s.y*r},c={x:n.x+l.x*r,y:n.y+l.y*r},d=Ig({source:u,sourcePosition:e,target:c}),f=d.x!==0?"x":"y",h=d[f];let p,y,m;const v={x:0,y:0},N={x:0,y:0},[_,g,x,z]=tl({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(s[f]*l[f]===-1){y=i.x??_,m=i.y??g;const F=[{x:y,y:u.y},{x:y,y:c.y}],X=[{x:u.x,y:m},{x:c.x,y:m}];s[f]===h?p=f==="x"?F:X:p=f==="x"?X:F}else{const F=[{x:u.x,y:c.y}],X=[{x:c.x,y:u.y}];if(f==="x"?p=s.x===h?X:F:p=s.y===h?F:X,e===o){const H=Math.abs(t[f]-n[f]);if(H<=r){const w=Math.min(r-1,r-H);s[f]===h?v[f]=(u[f]>t[f]?-1:1)*w:N[f]=(c[f]>n[f]?-1:1)*w}}if(e!==o){const H=f==="x"?"y":"x",w=s[f]===l[H],k=u[H]>c[H],b=u[H]<c[H];(s[f]===1&&(!w&&k||w&&b)||s[f]!==1&&(!w&&b||w&&k))&&(p=f==="x"?F:X)}const Y={x:u.x+v.x,y:u.y+v.y},S={x:c.x+N.x,y:c.y+N.y},I=Math.max(Math.abs(Y.x-p[0].x),Math.abs(S.x-p[0].x)),C=Math.max(Math.abs(Y.y-p[0].y),Math.abs(S.y-p[0].y));I>=C?(y=(Y.x+S.x)/2,m=p[0].y):(y=p[0].x,m=(Y.y+S.y)/2)}return[[t,{x:u.x+v.x,y:u.y+v.y},...p,{x:c.x+N.x,y:c.y+N.y},n],y,m,x,z]}function $g(t,e,n,o){const i=Math.min(al(t,e)/2,al(e,n)/2,o),{x:r,y:s}=e;if(t.x===r&&r===n.x||t.y===s&&s===n.y)return`L${r} ${s}`;if(t.y===s){const c=t.x<n.x?-1:1,d=t.y<n.y?1:-1;return`L ${r+i*c},${s}Q ${r},${s} ${r},${s+i*d}`}const l=t.x<n.x?1:-1,u=t.y<n.y?-1:1;return`L ${r},${s+i*u}Q ${r},${s} ${r+i*l},${s}`}function hr(t){const{sourceX:e,sourceY:n,sourcePosition:o=de.Bottom,targetX:i,targetY:r,targetPosition:s=de.Top,borderRadius:l=5,centerX:u,centerY:c,offset:d=20}=t,[f,h,p,y,m]=Bg({source:{x:e,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:s,center:{x:u,y:c},offset:d});return[f.reduce((N,_,g)=>{let x;return g>0&&g<f.length-1?x=$g(f[g-1],_,f[g+1],l):x=`${g===0?"M":"L"}${_.x} ${_.y}`,N+=x,N},""),h,p,y,m]}function zg(t){const{sourceX:e,sourceY:n,targetX:o,targetY:i}=t,[r,s,l,u]=tl({sourceX:e,sourceY:n,targetX:o,targetY:i});return[`M ${e},${n}L ${o},${i}`,r,s,l,u]}const Ag=a.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=zg(t);return a.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),ll=a.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=hr({...t,sourcePosition:t.sourcePosition??de.Bottom,targetPosition:t.targetPosition??de.Top});return a.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),Pg=a.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(t,{attrs:e}){return()=>a.h(ll,{...t,...e,borderRadius:0})}}),Og=a.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=fr({...t,sourcePosition:t.sourcePosition??de.Bottom,targetPosition:t.targetPosition??de.Top});return a.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),Rg=a.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=rl({...t,sourcePosition:t.sourcePosition??de.Bottom,targetPosition:t.targetPosition??de.Top});return a.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),Hg={input:xg,default:wg,output:_g},Lg={default:Og,straight:Ag,step:Pg,smoothstep:ll,simplebezier:Rg};function Vg(t,e,n){const o=a.computed(()=>m=>e.value.get(m)),i=a.computed(()=>m=>n.value.get(m)),r=a.computed(()=>{const m={...Lg,...t.edgeTypes},v=Object.keys(m);for(const N of t.edges)N.type&&!v.includes(N.type)&&(m[N.type]=N.type);return m}),s=a.computed(()=>{const m={...Hg,...t.nodeTypes},v=Object.keys(m);for(const N of t.nodes)N.type&&!v.includes(N.type)&&(m[N.type]=N.type);return m}),l=a.computed(()=>t.onlyRenderVisibleElements?Ea(t.nodes,{x:0,y:0,width:t.dimensions.width,height:t.dimensions.height},t.viewport,!0):t.nodes),u=a.computed(()=>{if(t.onlyRenderVisibleElements){const m=[];for(const v of t.edges){const N=e.value.get(v.source),_=e.value.get(v.target);Fp({sourcePos:N.computedPosition||{x:0,y:0},targetPos:_.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:_.dimensions.width,targetHeight:_.dimensions.height,width:t.dimensions.width,height:t.dimensions.height,viewport:t.viewport})&&m.push(v)}return m}return t.edges}),c=a.computed(()=>[...l.value,...u.value]),d=a.computed(()=>{const m=[];for(const v of t.nodes)v.selected&&m.push(v);return m}),f=a.computed(()=>{const m=[];for(const v of t.edges)v.selected&&m.push(v);return m}),h=a.computed(()=>[...d.value,...f.value]),p=a.computed(()=>{const m=[];for(const v of t.nodes)v.dimensions.width&&v.dimensions.height&&v.handleBounds!==void 0&&m.push(v);return m}),y=a.computed(()=>l.value.length>0&&p.value.length===l.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:s,getEdges:u,getNodes:l,getSelectedElements:h,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:y}}class Lt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var e;const n=(e=a.getCurrentInstance())==null?void 0:e.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??Lt.instance;return Lt.instance=o??new Lt,n&&(n.config.globalProperties.$vueFlowStorage=Lt.instance),Lt.instance}set(e,n){return this.flows.set(e,n)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,n){const o=el(),i=a.reactive(o),r={};for(const[h,p]of Object.entries(i.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=p.on}const s={};for(const[h,p]of Object.entries(i.hooks))s[h]=p.trigger;const l=a.computed(()=>{const h=new Map;for(const p of i.nodes)h.set(p.id,p);return h}),u=a.computed(()=>{const h=new Map;for(const p of i.edges)h.set(p.id,p);return h}),c=Vg(i,l,u),d=yg(i,l,u);d.setState({...i,...n});const f={...r,...c,...d,...Pd(i),nodeLookup:l,edgeLookup:u,emits:s,id:e,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(e)}};return this.set(e,f),f}getId(){return`vue-flow-${this.currentId++}`}}function we(t){const e=Lt.getInstance(),n=a.getCurrentScope(),o=typeof t=="object",i=o?t:{id:t},r=i.id,s=r??n?.vueFlowId;let l;if(n){const u=a.inject(Ua,null);typeof u<"u"&&u!==null&&(!s||u.id===s)&&(l=u)}if(l||s&&(l=e.get(s)),!l||s&&l.id!==s){const u=r??e.getId(),c=e.create(u,i);l=c,(n??a.effectScope(!0)).run(()=>{a.watch(c.applyDefault,(f,h,p)=>{const y=v=>{c.applyNodeChanges(v)},m=v=>{c.applyEdgeChanges(v)};f?(c.onNodesChange(y),c.onEdgesChange(m)):(c.hooks.value.nodesChange.off(y),c.hooks.value.edgesChange.off(m)),p(()=>{c.hooks.value.nodesChange.off(y),c.hooks.value.edgesChange.off(m)})},{immediate:!0}),mn(()=>{if(l){const f=e.get(l.id);f?f.$destroy():zn(`No store instance found for id ${l.id} in storage.`)}})})}else o&&l.setState(i);if(n&&(a.provide(Ua,l),n.vueFlowId=l.id),o){const u=a.getCurrentInstance();u?.type.name!=="VueFlow"&&l.emits.error(new Be(Ne.USEVUEFLOW_OPTIONS))}return l}function Fg(t){const{emits:e,dimensions:n}=we();let o;a.onMounted(()=>{const i=()=>{var r,s;if(!t.value||!(((s=(r=t.value).checkVisibility)==null?void 0:s.call(r))??!0))return;const l=Co(t.value);(l.width===0||l.height===0)&&e.error(new Be(Ne.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};i(),window.addEventListener("resize",i),t.value&&(o=new ResizeObserver(()=>i()),o.observe(t.value)),a.onBeforeUnmount(()=>{window.removeEventListener("resize",i),o&&t.value&&o.unobserve(t.value)})})}const Wg={name:"UserSelection",compatConfig:{MODE:3}},Gg=a.defineComponent({...Wg,props:{userSelectionRect:{}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:a.normalizeStyle({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),jg=["tabIndex"],Yg={name:"NodesSelection",compatConfig:{MODE:3}},Ug=a.defineComponent({...Yg,setup(t){const{emits:e,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:s}=we(),l=Qa(),u=a.ref(null),c=Ka({el:u,onStart(y){e.selectionDragStart(y),e.nodeDragStart(y)},onDrag(y){e.selectionDrag(y),e.nodeDrag(y)},onStop(y){e.selectionDragStop(y),e.nodeDragStop(y)}});a.onMounted(()=>{var y;r.value||(y=u.value)==null||y.focus({preventScroll:!0})});const d=a.computed(()=>xa(o.value)),f=a.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function h(y){e.selectionContextMenu({event:y,nodes:o.value})}function p(y){r.value||en[y.key]&&(y.preventDefault(),l({x:en[y.key].x,y:en[y.key].y},y.shiftKey))}return(y,m)=>!a.unref(s)&&d.value.width&&d.value.height?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["vue-flow__nodesselection vue-flow__container",a.unref(i)]),style:a.normalizeStyle({transform:`translate(${a.unref(n).x}px,${a.unref(n).y}px) scale(${a.unref(n).zoom})`})},[a.createElementVNode("div",{ref_key:"el",ref:u,class:a.normalizeClass([{dragging:a.unref(c)},"vue-flow__nodesselection-rect"]),style:a.normalizeStyle(f.value),tabIndex:a.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,jg)],6)):a.createCommentVNode("",!0)}});function Xg(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}const qg={name:"Pane",compatConfig:{MODE:3}},Kg=a.defineComponent({...qg,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(t){const{vueFlowRef:e,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:s,userSelectionRect:l,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:h,removeEdges:p,selectionMode:y,deleteKeyCode:m,multiSelectionKeyCode:v,multiSelectionActive:N,edgeLookup:_,nodeLookup:g,connectionLookup:x,defaultEdgeOptions:z,connectionStartHandle:$,panOnDrag:F}=we(),X=a.shallowRef(null),Y=a.shallowRef(new Set),S=a.shallowRef(new Set),I=a.shallowRef(null),C=a.toRef(()=>u.value&&(t.isSelecting||r.value)),H=a.toRef(()=>$.value!==null);let w=!1,k=!1;const b=Tn(m,{actInsideInputWithModifier:!1}),E=Tn(v);a.watch(b,Z=>{Z&&(h(f.value),p(d.value),c.value=!1)}),a.watch(E,Z=>{N.value=Z});function T(Z,Q){return q=>{q.target===Q&&Z?.(q)}}function O(Z){if(w||H.value){w=!1;return}i.paneClick(Z),s(),c.value=!1}function R(Z){var Q;if(Array.isArray(F.value)&&((Q=F.value)!=null&&Q.includes(2))){Z.preventDefault();return}i.paneContextMenu(Z)}function B(Z){i.paneScroll(Z)}function P(Z){var Q,q,ee;if(I.value=((Q=e.value)==null?void 0:Q.getBoundingClientRect())??null,!u.value||!t.isSelecting||Z.button!==0||Z.target!==X.value||!I.value)return;(ee=(q=Z.target)==null?void 0:q.setPointerCapture)==null||ee.call(q,Z.pointerId);const{x:re,y:oe}=Xg(Z,I.value);k=!0,w=!1,s(),l.value={width:0,height:0,startX:re,startY:oe,x:re,y:oe},i.selectionStart(Z)}function V(Z){var Q;if(!I.value||!l.value)return;w=!0;const{x:q,y:ee}=lt(Z,I.value),{startX:re=0,startY:oe=0}=l.value,ce={startX:re,startY:oe,x:q<re?q:re,y:ee<oe?ee:oe,width:Math.abs(q-re),height:Math.abs(ee-oe)},ie=Y.value,ae=S.value;Y.value=new Set(Ea(n.value,ce,o.value,y.value===er.Partial,!0).map(M=>M.id)),S.value=new Set;const A=((Q=z.value)==null?void 0:Q.selectable)??!0;for(const M of Y.value){const L=x.value.get(M);if(L)for(const{edgeId:U}of L.values()){const D=_.value.get(U);D&&(D.selectable??A)&&S.value.add(U)}}if(!Ya(ie,Y.value)){const M=kt(g.value,Y.value,!0);i.nodesChange(M)}if(!Ya(ae,S.value)){const M=kt(_.value,S.value);i.edgesChange(M)}l.value=ce,r.value=!0,c.value=!1}function W(Z){var Q;Z.button!==0||!k||((Q=Z.target)==null||Q.releasePointerCapture(Z.pointerId),!r.value&&l.value&&Z.target===X.value&&O(Z),r.value=!1,l.value=null,c.value=Y.value.size>0,i.selectionEnd(Z),t.selectionKeyPressed&&(w=!1),k=!1)}return(Z,Q)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"container",ref:X,class:a.normalizeClass(["vue-flow__pane vue-flow__container",{selection:Z.isSelecting}]),onClick:Q[0]||(Q[0]=q=>C.value?void 0:T(O,X.value)(q)),onContextmenu:Q[1]||(Q[1]=q=>T(R,X.value)(q)),onWheelPassive:Q[2]||(Q[2]=q=>T(B,X.value)(q)),onPointerenter:Q[3]||(Q[3]=q=>C.value?void 0:a.unref(i).paneMouseEnter(q)),onPointerdown:Q[4]||(Q[4]=q=>C.value?P(q):a.unref(i).paneMouseMove(q)),onPointermove:Q[5]||(Q[5]=q=>C.value?V(q):a.unref(i).paneMouseMove(q)),onPointerup:Q[6]||(Q[6]=q=>C.value?W(q):void 0),onPointerleave:Q[7]||(Q[7]=q=>a.unref(i).paneMouseLeave(q))},[a.renderSlot(Z.$slots,"default"),a.unref(r)&&a.unref(l)?(a.openBlock(),a.createBlock(Gg,{key:0,"user-selection-rect":a.unref(l)},null,8,["user-selection-rect"])):a.createCommentVNode("",!0),a.unref(c)&&a.unref(f).length?(a.openBlock(),a.createBlock(Ug,{key:1})):a.createCommentVNode("",!0)],34))}}),Zg={name:"Transform",compatConfig:{MODE:3}},Jg=a.defineComponent({...Zg,setup(t){const{viewport:e,fitViewOnInit:n,fitViewOnInitDone:o}=we(),i=a.computed(()=>n.value?!o.value:!1),r=a.computed(()=>`translate(${e.value.x}px,${e.value.y}px) scale(${e.value.zoom})`);return(s,l)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:a.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[a.renderSlot(s.$slots,"default")],4))}}),Qg={name:"Viewport",compatConfig:{MODE:3}},em=a.defineComponent({...Qg,setup(t){const{minZoom:e,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:s,panActivationKeyCode:l,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:m,noWheelClassName:v,noPanClassName:N,emits:_,connectionStartHandle:g,userSelectionActive:x,paneDragging:z,d3Zoom:$,d3Selection:F,d3ZoomHandler:X,viewport:Y,viewportRef:S,paneClickDistance:I}=we();Fg(S);const C=a.shallowRef(!1),H=a.shallowRef(!1);let w=null,k=!1,b=0,E={x:0,y:0,zoom:0};const T=Tn(l),O=Tn(s),R=Tn(r),B=a.toRef(()=>(!O.value||O.value&&s.value===!0)&&(T.value||f.value)),P=a.toRef(()=>T.value||u.value),V=a.toRef(()=>s.value===!0&&B.value!==!0),W=a.toRef(()=>O.value&&s.value!==!0||x.value||V.value),Z=a.toRef(()=>g.value!==null);a.onMounted(()=>{if(!S.value){zn("Viewport element is missing");return}const oe=S.value,ce=oe.getBoundingClientRect(),ie=_p().clickDistance(I.value).scaleExtent([e.value,n.value]).translateExtent(i.value),ae=Je(oe).call(ie),A=ae.on("wheel.zoom"),M=Qt.translate(o.value.x??0,o.value.y??0).scale(Rt(o.value.zoom??1,e.value,n.value)),L=[[0,0],[ce.width,ce.height]],U=ie.constrain()(M,L,i.value);ie.transform(ae,U),ie.wheelDelta(ka),$.value=ie,F.value=ae,X.value=A,Y.value={x:U.x,y:U.y,zoom:U.k},ie.on("start",D=>{var j;if(!D.sourceEvent)return null;b=D.sourceEvent.button,C.value=!0;const G=ee(D.transform);((j=D.sourceEvent)==null?void 0:j.type)==="mousedown"&&(z.value=!0),E=G,_.viewportChangeStart(G),_.moveStart({event:D,flowTransform:G})}),ie.on("end",D=>{if(!D.sourceEvent)return null;if(C.value=!1,z.value=!1,Q(B.value,b??0)&&!k&&_.paneContextMenu(D.sourceEvent),k=!1,q(E,D.transform)){const j=ee(D.transform);E=j,_.viewportChangeEnd(j),_.moveEnd({event:D,flowTransform:j})}}),ie.filter(D=>{var j;const G=R.value||y.value,K=p.value&&D.ctrlKey,ne=D.button,te=D.type==="wheel";if(ne===1&&D.type==="mousedown"&&(re(D,"vue-flow__node")||re(D,"vue-flow__edge")))return!0;if(!B.value&&!G&&!P.value&&!h.value&&!p.value||x.value||Z.value&&!te||!h.value&&D.type==="dblclick"||re(D,v.value)&&te||re(D,N.value)&&(!te||P.value&&te&&!R.value)||!p.value&&D.ctrlKey&&te||!G&&!P.value&&!K&&te)return!1;if(!p&&D.type==="touchstart"&&((j=D.touches)==null?void 0:j.length)>1)return D.preventDefault(),!1;if(!B.value&&(D.type==="mousedown"||D.type==="touchstart")||V.value&&Array.isArray(f.value)&&f.value.includes(0)&&ne===0||Array.isArray(f.value)&&!f.value.includes(ne)&&(D.type==="mousedown"||D.type==="touchstart"))return!1;const fe=Array.isArray(f.value)&&f.value.includes(ne)||s.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!ne||ne<=1;return(!D.ctrlKey||T.value||te)&&fe}),a.watch([x,B],()=>{x.value&&!C.value?ie.on("zoom",null):x.value||ie.on("zoom",D=>{Y.value={x:D.transform.x,y:D.transform.y,zoom:D.transform.k};const j=ee(D.transform);k=Q(B.value,b??0),_.viewportChange(j),_.move({event:D,flowTransform:j})})},{immediate:!0}),a.watch([x,P,c,R,p,m,v],()=>{P.value&&!R.value&&!x.value?ae.on("wheel.zoom",D=>{if(re(D,v.value))return!1;const j=R.value||y.value,G=p.value&&D.ctrlKey;if(!(!m.value||P.value||j||G))return!1;D.preventDefault(),D.stopImmediatePropagation();const ne=ae.property("__zoom").k||1,te=No();if(!T.value&&D.ctrlKey&&p.value&&te){const Ze=it(D),_e=ka(D),xt=ne*2**_e;ie.scaleTo(ae,xt,Ze,D);return}const fe=D.deltaMode===1?20:1;let ge=c.value===Dn.Vertical?0:D.deltaX*fe,Me=c.value===Dn.Horizontal?0:D.deltaY*fe;!te&&D.shiftKey&&c.value!==Dn.Vertical&&!ge&&Me&&(ge=Me,Me=0),ie.translateBy(ae,-(ge/ne)*d.value,-(Me/ne)*d.value);const Ie=ee(ae.property("__zoom"));w&&clearTimeout(w),H.value?(_.move({event:D,flowTransform:Ie}),_.viewportChange(Ie),w=setTimeout(()=>{_.moveEnd({event:D,flowTransform:Ie}),_.viewportChangeEnd(Ie),H.value=!1},150)):(H.value=!0,_.moveStart({event:D,flowTransform:Ie}),_.viewportChangeStart(Ie))},{passive:!1}):typeof A<"u"&&ae.on("wheel.zoom",function(D,j){const G=!m.value&&D.type==="wheel"&&!D.ctrlKey,K=R.value||y.value,ne=p.value&&D.ctrlKey;if(!K&&!u.value&&!ne&&D.type==="wheel"||G||re(D,v.value))return null;D.preventDefault(),A.call(this,D,j)},{passive:!1})},{immediate:!0})});function Q(oe,ce){return ce===2&&Array.isArray(oe)&&oe.includes(2)}function q(oe,ce){return oe.x!==ce.x&&!Number.isNaN(ce.x)||oe.y!==ce.y&&!Number.isNaN(ce.y)||oe.zoom!==ce.k&&!Number.isNaN(ce.k)}function ee(oe){return{x:oe.x,y:oe.y,zoom:oe.k}}function re(oe,ce){return oe.target.closest(`.${ce}`)}return(oe,ce)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"viewportRef",ref:S,class:"vue-flow__viewport vue-flow__container"},[a.createVNode(Kg,{"is-selecting":W.value,"selection-key-pressed":a.unref(O),class:a.normalizeClass({connecting:Z.value,dragging:a.unref(z),draggable:a.unref(f)===!0||Array.isArray(a.unref(f))&&a.unref(f).includes(0)})},{default:a.withCtx(()=>[a.createVNode(Jg,null,{default:a.withCtx(()=>[a.renderSlot(oe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),tm=["id"],nm=["id"],om=["id"],im={name:"A11yDescriptions",compatConfig:{MODE:3}},rm=a.defineComponent({...im,setup(t){const{id:e,disableKeyboardA11y:n,ariaLiveMessage:o}=we();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{id:`${a.unref(ha)}-${a.unref(e)}`,style:{display:"none"}}," Press enter or space to select a node. "+a.toDisplayString(a.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,tm),a.createElementVNode("div",{id:`${a.unref(pa)}-${a.unref(e)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,nm),a.unref(n)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,id:`${a.unref(kp)}-${a.unref(e)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},a.toDisplayString(a.unref(o)),9,om))],64))}});function sm(){const t=we();a.watch(()=>t.viewportHelper.value.viewportInitialized,e=>{e&&setTimeout(()=>{t.emits.init(t),t.emits.paneReady(t)},1)})}function am(t,e,n){return n===de.Left?t-e:n===de.Right?t+e:t}function lm(t,e,n){return n===de.Top?t-e:n===de.Bottom?t+e:t}const pr=function({radius:t=10,centerX:e=0,centerY:n=0,position:o=de.Top,type:i}){return a.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:am(e,t,o),cy:lm(n,t,o),r:t,stroke:"transparent",fill:"transparent"})};pr.props=["radius","centerX","centerY","position","type"],pr.compatConfig={MODE:3};const cl=pr,cm=a.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(t){const{id:e,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:s,noPanClassName:l,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:m,edgesUpdatable:v,edgesFocusable:N,hooks:_}=we(),g=a.computed(()=>d(t.id)),{emit:x,on:z}=ig(g.value,r),$=a.inject(Do),F=a.getCurrentInstance(),X=a.ref(!1),Y=a.ref(!1),S=a.ref(""),I=a.ref(null),C=a.ref("source"),H=a.ref(null),w=a.toRef(()=>typeof g.value.selectable>"u"?m.value:g.value.selectable),k=a.toRef(()=>typeof g.value.updatable>"u"?v.value:g.value.updatable),b=a.toRef(()=>typeof g.value.focusable>"u"?N.value:g.value.focusable);a.provide(tg,t.id),a.provide(ng,H);const E=a.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),T=a.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),O=a.computed(()=>{const M=g.value.type||"default",L=$?.[`edge-${M}`];if(L)return L;let U=g.value.template??u.value[M];if(typeof U=="string"&&F){const D=Object.keys(F.appContext.components);D&&D.includes(M)&&(U=a.resolveComponent(M,!1))}return U&&typeof U!="string"?U:(r.error(new Be(Ne.EDGE_TYPE_MISSING,U)),!1)}),{handlePointerDown:R}=Za({nodeId:S,handleId:I,type:C,isValidConnection:h,edgeUpdaterType:C,onEdgeUpdate:V,onEdgeUpdateEnd:W});return()=>{const M=f(g.value.source),L=f(g.value.target),U="pathOptions"in g.value?g.value.pathOptions:{};if(!M&&!L)return r.error(new Be(Ne.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!M)return r.error(new Be(Ne.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!L)return r.error(new Be(Ne.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||M.hidden||L.hidden)return null;let D;o.value===gt.Strict?D=M.handleBounds.source:D=[...M.handleBounds.source||[],...M.handleBounds.target||[]];const j=Oa(D,g.value.sourceHandle);let G;o.value===gt.Strict?G=L.handleBounds.target:G=[...L.handleBounds.target||[],...L.handleBounds.source||[]];const K=Oa(G,g.value.targetHandle),ne=j?.position||de.Bottom,te=K?.position||de.Top,{x:fe,y:ge}=nn(M,j,ne),{x:Me,y:Ie}=nn(L,K,te);return g.value.sourceX=fe,g.value.sourceY=ge,g.value.targetX=Me,g.value.targetY=Ie,a.h("g",{ref:H,key:t.id,"data-id":t.id,class:["vue-flow__edge",`vue-flow__edge-${O.value===!1?"default":g.value.type||"default"}`,l.value,E.value,{updating:X.value,selected:g.value.selected,animated:g.value.animated,inactive:!w.value&&!_.value.edgeClick.hasListeners()}],tabIndex:b.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel??`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":b.value?`${pa}-${e}`:void 0,"aria-roledescription":"edge",role:b.value?"group":"img",...g.value.domAttributes,onClick:Q,onContextmenu:q,onDblclick:ee,onMouseenter:re,onMousemove:oe,onMouseleave:ce,onKeyDown:b.value?A:void 0},[Y.value?null:a.h(O.value===!1?u.value.default:O.value,{id:t.id,sourceNode:M,targetNode:L,source:g.value.source,target:g.value.target,type:g.value.type,updatable:k.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...z},style:T.value,markerStart:`url('#${$n(g.value.markerStart,e)}')`,markerEnd:`url('#${$n(g.value.markerEnd,e)}')`,sourcePosition:ne,targetPosition:te,sourceX:fe,sourceY:ge,targetX:Me,targetY:Ie,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...U}),[k.value==="source"||k.value===!0?[a.h("g",{onMousedown:ie,onMouseenter:B,onMouseout:P},a.h(cl,{position:ne,centerX:fe,centerY:ge,radius:i.value,type:"source","data-type":"source"}))]:null,k.value==="target"||k.value===!0?[a.h("g",{onMousedown:ae,onMouseenter:B,onMouseout:P},a.h(cl,{position:te,centerX:Me,centerY:Ie,radius:i.value,type:"target","data-type":"target"}))]:null]])};function B(){X.value=!0}function P(){X.value=!1}function V(M,L){x.update({event:M,edge:g.value,connection:L})}function W(M){x.updateEnd({event:M,edge:g.value}),Y.value=!1}function Z(M,L){M.button===0&&(Y.value=!0,S.value=L?g.value.target:g.value.source,I.value=(L?g.value.targetHandle:g.value.sourceHandle)??null,C.value=L?"target":"source",x.updateStart({event:M,edge:g.value}),R(M))}function Q(M){var L;const U={event:M,edge:g.value};w.value&&(s.value=!1,g.value.selected&&p.value?(c([g.value]),(L=H.value)==null||L.blur()):n([g.value])),x.click(U)}function q(M){x.contextMenu({event:M,edge:g.value})}function ee(M){x.doubleClick({event:M,edge:g.value})}function re(M){x.mouseEnter({event:M,edge:g.value})}function oe(M){x.mouseMove({event:M,edge:g.value})}function ce(M){x.mouseLeave({event:M,edge:g.value})}function ie(M){Z(M,!0)}function ae(M){Z(M,!1)}function A(M){var L;!y.value&&ga.includes(M.key)&&w.value&&(M.key==="Escape"?((L=H.value)==null||L.blur(),c([d(t.id)])):n([d(t.id)]))}}}),dm=a.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var t;const{id:e,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:s,connectionLineStyle:l,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:f}=we(),h=(t=a.inject(Do))==null?void 0:t["connection-line"],p=a.computed(()=>{var _;return f((_=o.value)==null?void 0:_.nodeId)}),y=a.computed(()=>{var _;return f((_=i.value)==null?void 0:_.nodeId)??null}),m=a.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),v=a.computed(()=>u.value.markerStart?`url(#${$n(u.value.markerStart,e)})`:""),N=a.computed(()=>u.value.markerEnd?`url(#${$n(u.value.markerEnd,e)})`:"");return()=>{var _,g,x;if(!p.value||!o.value)return null;const z=o.value.id,$=o.value.type,F=p.value.handleBounds;let X=F?.[$]??[];if(n.value===gt.Loose){const T=F?.[$==="source"?"target":"source"]??[];X=[...X,...T]}if(!X)return null;const Y=(z?X.find(T=>T.id===z):X[0])??null,S=Y?.position??de.Top,{x:I,y:C}=nn(p.value,Y,S);let H=null;y.value&&(n.value===gt.Strict?H=((_=y.value.handleBounds[$==="source"?"target":"source"])==null?void 0:_.find(T=>{var O;return T.id===((O=i.value)==null?void 0:O.id)}))||null:H=((g=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:g.find(T=>{var O;return T.id===((O=i.value)==null?void 0:O.id)}))||null);const w=((x=i.value)==null?void 0:x.position)??(S?ar[S]:null);if(!S||!w)return null;const k=s.value??u.value.type??Ot.Bezier;let b="";const E={sourceX:I,sourceY:C,sourcePosition:S,targetX:m.value.x,targetY:m.value.y,targetPosition:w};return k===Ot.Bezier?[b]=fr(E):k===Ot.Step?[b]=hr({...E,borderRadius:0}):k===Ot.SmoothStep?[b]=hr(E):k===Ot.SimpleBezier?[b]=rl(E):b=`M${I},${C} ${m.value.x},${m.value.y}`,a.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},a.h("g",{class:"vue-flow__connection"},h?a.h(h,{sourceX:I,sourceY:C,sourcePosition:S,targetX:m.value.x,targetY:m.value.y,targetPosition:w,sourceNode:p.value,sourceHandle:Y,targetNode:y.value,targetHandle:H,markerEnd:N.value,markerStart:v.value,connectionStatus:c.value}):a.h("path",{d:b,class:[u.value.class,c.value,"vue-flow__connection-path"],style:{...l.value,...u.value.style},"marker-end":N.value,"marker-start":v.value})))}}}),um=["id","markerWidth","markerHeight","markerUnits","orient"],fm={name:"MarkerType",compatConfig:{MODE:3}},hm=a.defineComponent({...fm,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(t){return(e,n)=>(a.openBlock(),a.createElementBlock("marker",{id:e.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===a.unref(mt).ArrowClosed?(a.openBlock(),a.createElementBlock("polyline",{key:0,style:a.normalizeStyle({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):a.createCommentVNode("",!0),e.type===a.unref(mt).Arrow?(a.openBlock(),a.createElementBlock("polyline",{key:1,style:a.normalizeStyle({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):a.createCommentVNode("",!0)],8,um))}}),pm={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},gm={name:"MarkerDefinitions",compatConfig:{MODE:3}},mm=a.defineComponent({...gm,setup(t){const{id:e,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=we(),r=a.computed(()=>{const s=new Set,l=[],u=c=>{if(c){const d=$n(c,e);s.has(d)||(typeof c=="object"?l.push({...c,id:d,color:c.color||i.value}):l.push({id:d,color:i.value,type:c}),s.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return l.sort((c,d)=>c.id.localeCompare(d.id))});return(s,l)=>(a.openBlock(),a.createElementBlock("svg",pm,[a.createElementVNode("defs",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,u=>(a.openBlock(),a.createBlock(hm,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),ym={name:"Edges",compatConfig:{MODE:3}},vm=a.defineComponent({...ym,setup(t){const{findNode:e,getEdges:n,elevateEdgesOnSelect:o}=we();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(mm),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(n),s=>(a.openBlock(),a.createElementBlock("svg",{key:s.id,class:"vue-flow__edges vue-flow__container",style:a.normalizeStyle({zIndex:a.unref(Wp)(s,a.unref(e),a.unref(o))})},[a.createVNode(a.unref(cm),{id:s.id},null,8,["id"])],4))),128)),a.createVNode(a.unref(dm))],64))}}),bm=a.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(t){const{id:e,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:s,removeSelectedNodes:l,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:m,snapToGrid:v,snapGrid:N,nodeDragThreshold:_,nodesDraggable:g,elementsSelectable:x,nodesConnectable:z,nodesFocusable:$,hooks:F}=we(),X=a.ref(null);a.provide(qa,X),a.provide(Xa,t.id);const Y=a.inject(Do),S=a.getCurrentInstance(),I=Qa(),{node:C,parentNode:H}=Ja(t.id),{emit:w,on:k}=lg(C,s),b=a.toRef(()=>typeof C.draggable>"u"?g.value:C.draggable),E=a.toRef(()=>typeof C.selectable>"u"?x.value:C.selectable),T=a.toRef(()=>typeof C.connectable>"u"?z.value:C.connectable),O=a.toRef(()=>typeof C.focusable>"u"?$.value:C.focusable),R=a.computed(()=>E.value||b.value||F.value.nodeClick.hasListeners()||F.value.nodeDoubleClick.hasListeners()||F.value.nodeMouseEnter.hasListeners()||F.value.nodeMouseMove.hasListeners()||F.value.nodeMouseLeave.hasListeners()),B=a.toRef(()=>!!C.dimensions.width&&!!C.dimensions.height),P=a.computed(()=>{const L=C.type||"default",U=Y?.[`node-${L}`];if(U)return U;let D=C.template||f.value[L];if(typeof D=="string"&&S){const j=Object.keys(S.appContext.components);j&&j.includes(L)&&(D=a.resolveComponent(L,!1))}return D&&typeof D!="string"?D:(s.error(new Be(Ne.NODE_TYPE_MISSING,D)),!1)}),V=Ka({id:t.id,el:X,disabled:()=>!b.value,selectable:E,dragHandle:()=>C.dragHandle,onStart(L){w.dragStart(L)},onDrag(L){w.drag(L)},onStop(L){w.dragStop(L)},onClick(L){A(L)}}),W=a.computed(()=>C.class instanceof Function?C.class(C):C.class),Z=a.computed(()=>{const L=(C.style instanceof Function?C.style(C):C.style)||{},U=C.width instanceof Function?C.width(C):C.width,D=C.height instanceof Function?C.height(C):C.height;return!L.width&&U&&(L.width=typeof U=="string"?U:`${U}px`),!L.height&&D&&(L.height=typeof D=="string"?D:`${D}px`),L}),Q=a.toRef(()=>Number(C.zIndex??Z.value.zIndex??0));return d(L=>{(L.includes(t.id)||!L.length)&&ee()}),a.onMounted(()=>{a.watch(()=>C.hidden,(L=!1,U,D)=>{!L&&X.value&&(t.resizeObserver.observe(X.value),D(()=>{X.value&&t.resizeObserver.unobserve(X.value)}))},{immediate:!0,flush:"post"})}),a.watch([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{a.nextTick(()=>{c([{id:t.id,nodeElement:X.value,forceUpdate:!0}])})}),a.watch([()=>C.position.x,()=>C.position.y,()=>{var L;return(L=H.value)==null?void 0:L.computedPosition.x},()=>{var L;return(L=H.value)==null?void 0:L.computedPosition.y},()=>{var L;return(L=H.value)==null?void 0:L.computedPosition.z},Q,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var L;return(L=H.value)==null?void 0:L.dimensions.height},()=>{var L;return(L=H.value)==null?void 0:L.dimensions.width}],([L,U,D,j,G,K])=>{const ne={x:L,y:U,z:K+(p.value&&C.selected?1e3:0)};typeof D<"u"&&typeof j<"u"?C.computedPosition=Op({x:D,y:j,z:G},ne):C.computedPosition=ne},{flush:"post",immediate:!0}),a.watch([()=>C.extent,h],([L,U],[D,j])=>{(L!==D||U!==j)&&q()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?$i(()=>B).toBe(!0).then(q):q(),()=>C.hidden?null:a.h("div",{ref:X,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${P.value===!1?"default":C.type||"default"}`,{[n.value]:b.value,dragging:V?.value,draggable:b.value,selected:C.selected,selectable:E.value,parent:C.isParent},W.value],style:{visibility:B.value?"visible":"hidden",zIndex:C.computedPosition.z??Q.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:R.value?"all":"none",...Z.value},tabIndex:O.value?0:void 0,role:O.value?"group":void 0,"aria-describedby":y.value?void 0:`${ha}-${e}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:re,onMousemove:oe,onMouseleave:ce,onContextmenu:ie,onClick:A,onDblclick:ae,onKeydown:M},[a.h(P.value===!1?f.value.default:P.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...k},selected:C.selected,resizing:C.resizing,dragging:V.value,connectable:T.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??Q.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:ee})]);function q(){const L=C.computedPosition,{computedPosition:U,position:D}=ir(C,v.value?ko(L,N.value):L,s.error,h.value,H.value);(C.computedPosition.x!==U.x||C.computedPosition.y!==U.y)&&(C.computedPosition={...C.computedPosition,...U}),(C.position.x!==D.x||C.position.y!==D.y)&&(C.position=D)}function ee(){X.value&&c([{id:t.id,nodeElement:X.value,forceUpdate:!0}])}function re(L){V?.value||w.mouseEnter({event:L,node:C})}function oe(L){V?.value||w.mouseMove({event:L,node:C})}function ce(L){V?.value||w.mouseLeave({event:L,node:C})}function ie(L){return w.contextMenu({event:L,node:C})}function ae(L){return w.doubleClick({event:L,node:C})}function A(L){E.value&&(!o.value||!b.value||_.value>0)&&lr(C,r.value,u,l,i,!1,X.value),w.click({event:L,node:C})}function M(L){if(!(tr(L)||y.value))if(ga.includes(L.key)&&E.value){const U=L.key==="Escape";lr(C,r.value,u,l,i,U,X.value)}else b.value&&C.selected&&en[L.key]&&(L.preventDefault(),m.value=`Moved selected node ${L.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,I({x:en[L.key].x,y:en[L.key].y},L.shiftKey))}}}),wm={height:"0",width:"0"},_m={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},xm=a.defineComponent({..._m,setup(t){const{viewportRef:e}=we(),n=a.toRef(()=>{var o;return(o=e.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(a.openBlock(),a.createElementBlock("svg",null,[(a.openBlock(),a.createElementBlock("foreignObject",wm,[(a.openBlock(),a.createBlock(a.Teleport,{to:n.value,disabled:!n.value},[a.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Em(t={includeHiddenNodes:!1}){const{nodes:e}=we();return a.computed(()=>{if(e.value.length===0)return!1;for(const n of e.value)if((t.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Cm={class:"vue-flow__nodes vue-flow__container"},Sm={name:"Nodes",compatConfig:{MODE:3}},Nm=a.defineComponent({...Sm,setup(t){const{getNodes:e,updateNodeDimensions:n,emits:o}=we(),i=Em(),r=a.ref();return a.watch(i,s=>{s&&a.nextTick(()=>{o.nodesInitialized(e.value)})},{immediate:!0}),a.onMounted(()=>{r.value=new ResizeObserver(s=>{const l=s.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));a.nextTick(()=>n(l))})}),a.onBeforeUnmount(()=>{var s;return(s=r.value)==null?void 0:s.disconnect()}),(s,l)=>(a.openBlock(),a.createElementBlock("div",Cm,[r.value?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(e),(u,c,d,f)=>{const h=[u.id];if(f&&f.key===u.id&&a.isMemoSame(f,h))return f;const p=(a.openBlock(),a.createBlock(a.unref(bm),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},l,0),128)):a.createCommentVNode("",!0)]))}});function km(){const{emits:t}=we();a.onMounted(()=>{if(Fa()){const e=document.querySelector(".vue-flow__pane");e&&window.getComputedStyle(e).zIndex!=="1"&&t.error(new Be(Ne.MISSING_STYLES))}})}const Dm=a.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Tm={name:"VueFlow",compatConfig:{MODE:3}},Mm=a.defineComponent({...Tm,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(t,{expose:e,emit:n}){const o=t,i=a.useSlots(),r=zi(o,"modelValue",n),s=zi(o,"nodes",n),l=zi(o,"edges",n),u=we(o),c=fg({modelValue:r,nodes:s,edges:l},o,u);return pg(n,u.hooks),sm(),km(),a.provide(Do,i),a.onUnmounted(c),e(u),(d,f)=>(a.openBlock(),a.createElementBlock("div",{ref:a.unref(u).vueFlowRef,class:"vue-flow"},[a.createVNode(em,null,{default:a.withCtx(()=>[a.createVNode(vm),Dm,a.createVNode(Nm),a.renderSlot(d.$slots,"zoom-pane")]),_:3}),a.renderSlot(d.$slots,"default"),a.createVNode(rm)],512))}}),Im={name:"Panel",compatConfig:{MODE:3}},Bm=a.defineComponent({...Im,props:{position:{}},setup(t){const e=t,{userSelectionActive:n}=we(),o=a.computed(()=>`${e.position}`.split("-"));return(i,r)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["vue-flow__panel",o.value]),style:a.normalizeStyle({pointerEvents:a.unref(n)?"none":"all"})},[a.renderSlot(i.$slots,"default")],6))}});var yt=(t=>(t.Lines="lines",t.Dots="dots",t))(yt||{});const dl=function({dimensions:t,size:e,color:n}){return a.h("path",{stroke:n,"stroke-width":e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})},ul=function({radius:t,color:e}){return a.h("circle",{cx:t,cy:t,r:t,fill:e})};yt.Lines+"",yt.Dots+"";const $m={[yt.Dots]:"#81818a",[yt.Lines]:"#eee"},zm=["id","x","y","width","height","patternTransform"],Am={key:2,height:"100",width:"100"},Pm=["fill"],Om=["x","y","fill"],Rm={name:"Background",compatConfig:{MODE:3}},Hm=a.defineComponent({...Rm,props:{id:{},variant:{default:()=>yt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(t){const{id:e,viewport:n}=we(),o=a.computed(()=>{const s=n.value.zoom,[l,u]=Array.isArray(t.gap)?t.gap:[t.gap,t.gap],c=[l*s||1,u*s||1],d=t.size*s,[f,h]=Array.isArray(t.offset)?t.offset:[t.offset,t.offset],p=[f*s||1+c[0]/2,h*s||1+c[1]/2];return{scaledGap:c,offset:p,size:d}}),i=a.toRef(()=>`pattern-${e}${t.id?`-${t.id}`:""}`),r=a.toRef(()=>t.color||t.patternColor||$m[t.variant||yt.Dots]);return(s,l)=>(a.openBlock(),a.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:a.normalizeStyle({height:`${s.height>100?100:s.height}%`,width:`${s.width>100?100:s.width}%`})},[a.renderSlot(s.$slots,"pattern-container",{id:i.value},()=>[a.createElementVNode("pattern",{id:i.value,x:a.unref(n).x%o.value.scaledGap[0],y:a.unref(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[a.renderSlot(s.$slots,"pattern",{},()=>[s.variant===a.unref(yt).Lines?(a.openBlock(),a.createBlock(a.unref(dl),{key:0,size:s.lineWidth,color:r.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):s.variant===a.unref(yt).Dots?(a.openBlock(),a.createBlock(a.unref(ul),{key:1,color:r.value,radius:o.value.size/2},null,8,["color","radius"])):a.createCommentVNode("",!0),s.bgColor?(a.openBlock(),a.createElementBlock("svg",Am,[a.createElementVNode("rect",{width:"100%",height:"100%",fill:s.bgColor},null,8,Pm)])):a.createCommentVNode("",!0)])],8,zm)]),a.createElementVNode("rect",{x:s.x,y:s.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,Om),a.renderSlot(s.$slots,"default",{id:i.value})],4))}}),Lm={name:"ControlButton",compatConfig:{MODE:3}},Vm=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n},Fm={type:"button",class:"vue-flow__controls-button"};function Wm(t,e,n,o,i,r){return a.openBlock(),a.createElementBlock("button",Fm,[a.renderSlot(t.$slots,"default")])}const Ao=Vm(Lm,[["render",Wm]]),Gm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},jm=[a.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Ym(t,e){return a.openBlock(),a.createElementBlock("svg",Gm,jm)}const Um={render:Ym},Xm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},qm=[a.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function Km(t,e){return a.openBlock(),a.createElementBlock("svg",Xm,qm)}const Zm={render:Km},Jm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Qm=[a.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function ey(t,e){return a.openBlock(),a.createElementBlock("svg",Jm,Qm)}const ty={render:ey},ny={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},oy=[a.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function iy(t,e){return a.openBlock(),a.createElementBlock("svg",ny,oy)}const ry={render:iy},sy={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ay=[a.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function ly(t,e){return a.openBlock(),a.createElementBlock("svg",sy,ay)}const cy={render:ly},dy={name:"Controls",compatConfig:{MODE:3}},uy=a.defineComponent({...dy,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>ua.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(t,{emit:e}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:r,zoomIn:s,zoomOut:l,fitView:u,viewport:c,minZoom:d,maxZoom:f}=we(),h=a.toRef(()=>n.value||o.value||i.value),p=a.toRef(()=>c.value.zoom<=d.value),y=a.toRef(()=>c.value.zoom>=f.value);function m(){s(),e("zoomIn")}function v(){l(),e("zoomOut")}function N(){u(t.fitViewParams),e("fitView")}function _(){r(!h.value),e("interactionChange",!h.value)}return(g,x)=>(a.openBlock(),a.createBlock(a.unref(Bm),{class:"vue-flow__controls",position:g.position},{default:a.withCtx(()=>[a.renderSlot(g.$slots,"top"),g.showZoom?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.renderSlot(g.$slots,"control-zoom-in",{},()=>[a.createVNode(Ao,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:m},{default:a.withCtx(()=>[a.renderSlot(g.$slots,"icon-zoom-in",{},()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Um))))])]),_:3},8,["disabled"])]),a.renderSlot(g.$slots,"control-zoom-out",{},()=>[a.createVNode(Ao,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:v},{default:a.withCtx(()=>[a.renderSlot(g.$slots,"icon-zoom-out",{},()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(Zm))))])]),_:3},8,["disabled"])])],64)):a.createCommentVNode("",!0),g.showFitView?a.renderSlot(g.$slots,"control-fit-view",{key:1},()=>[a.createVNode(Ao,{class:"vue-flow__controls-fitview",onClick:N},{default:a.withCtx(()=>[a.renderSlot(g.$slots,"icon-fit-view",{},()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(ty))))])]),_:3})]):a.createCommentVNode("",!0),g.showInteractive?a.renderSlot(g.$slots,"control-interactive",{key:2},()=>[g.showInteractive?(a.openBlock(),a.createBlock(Ao,{key:0,class:"vue-flow__controls-interactive",onClick:_},{default:a.withCtx(()=>[h.value?a.renderSlot(g.$slots,"icon-unlock",{key:0},()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(cy))))]):a.createCommentVNode("",!0),h.value?a.createCommentVNode("",!0):a.renderSlot(g.$slots,"icon-lock",{key:1},()=>[(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(ry))))])]),_:3})):a.createCommentVNode("",!0)]):a.createCommentVNode("",!0),a.renderSlot(g.$slots,"default")]),_:3},8,["position"]))}}),fy=["onClick"],hy={class:"d-flow-node-menus-item-name"},gr=a.defineComponent({name:"DNodeMenus",__name:"nodeMenus",props:{fromNodeId:{},handleId:{}},emits:["addNode"],setup(t,{emit:e}){const n=t,o=e,i=a.inject("d_flow_design_provide",{}),r=i.getFlowComponents?.()||[],s=l=>{o("addNode",l.type),a.nextTick(()=>{n.handleId==="line"?i.addNodeByLine?.(l.type,n.fromNodeId||""):i.addNode?.(l.type,n.fromNodeId||"",n.handleId||"")})};return(l,u)=>{const c=a.resolveComponent("j-icon");return a.openBlock(),a.createElementBlock("div",{class:"d-flow-node-menus",onClick:a.withModifiers(()=>{},["stop"])},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(r),(d,f)=>(a.openBlock(),a.createElementBlock("div",{key:f,class:"d-flow-node-menus-item",onClick:h=>s(d)},[a.createElementVNode("div",{class:"d-flow-node-menus-item-icon",style:a.normalizeStyle({backgroundColor:d.iconColor||"var(--j-color-primary)"})},[a.createVNode(c,{icon:d.icon||"mdi:source-branch"},null,8,["icon"])],4),a.createElementVNode("div",hy,a.toDisplayString(d.name),1)],8,fy))),128))])}}}),py={class:"d-flow-step-name"},gy={key:0,style:{color:"var(--j-color-text-2)"}},my={style:{color:"var(--j-color-text)"}},yy=a.defineComponent({name:"DStepNode",__name:"stepNode",props:{id:{},data:{}},setup(t){const e=t,{onNodeClick:n,onEdgeClick:o,onMoveStart:i,onConnectStart:r,onNodeDragStart:s,removeNodes:l,getEdges:u,getNodes:c,onNodesChange:d}=we(),f=a.inject("d_flow_design_provide",{}),h=a.computed(()=>f.getFlowComponentMap?.value?.[e.data.type]||{}),p=()=>{l(e.id),f.onRemoveNode?.(e.id)},y=a.ref({});d(H=>{if(e.data.isInit&&H.findIndex(w=>w.type==="select"&&w.id===e.id&&w.id==="start"&&w.selected)!==-1){const w=c.value.find(k=>k.id==="start");w&&(w.data.isInit=!1),y.value.s1=!0}});const m=a.ref(!1),v=H=>{H.indexOf("t")!==-1&&!N.value||(m.value=!0,y.value[H]=!0)},N=a.computed(()=>u.value.findIndex(H=>H.target===e.id)===-1),_=a.ref(!1),g=()=>{_.value=!0},x=(H,w)=>{if(u.value.find(E=>E.source===w&&E.target===H))return!0;const b=u.value.filter(E=>E.target===H);for(let E=0;E<b.length;E++)if(x(b[E].source,w))return!0;return!1},z=H=>_.value?(_.value=!1,!1):x(H.source,H.target)?!1:H.source!==H.target&&H.sourceHandle!==H.targetHandle&&H.sourceHandle.indexOf("s")!==-1&&H.targetHandle.indexOf("t")!==-1,$=()=>{I(),Object.keys(y.value).forEach(H=>{y.value[H]=!1})},F=()=>{$()};n(()=>{console.log("onNodeClick"),m.value?m.value=!1:$()}),o(()=>{$()}),i(()=>{$()}),r(()=>{$()}),s(()=>{$()});const X=a.ref(),Y=a.ref({top:0,left:0,bottom:0,right:0}),S=a.ref({getBoundingClientRect:()=>Y.value}),I=()=>{X.value?.handleClose()},C=H=>{const{clientX:w,clientY:k}=H;Y.value=DOMRect.fromRect({x:w,y:k}),H.preventDefault(),X.value?.handleOpen()};return(H,w)=>{const k=a.resolveComponent("el-popover"),b=a.resolveComponent("el-tooltip"),E=a.resolveComponent("el-dropdown-item"),T=a.resolveComponent("el-dropdown-menu"),O=a.resolveComponent("el-dropdown");return a.openBlock(),a.createElementBlock("div",{class:"d-flow-step",onContextmenu:a.withModifiers(C,["stop"])},[a.createElementVNode("div",{class:"d-flow-step-icon",style:a.normalizeStyle({backgroundColor:h.value.iconColor||"var(--j-color-primary)"})},[a.createVNode(gn,{icon:h.value.icon||"mdi:source-branch"},null,8,["icon"])],4),a.createElementVNode("div",py,a.toDisplayString(h.value.name),1),t.data.type!=="start"?(a.openBlock(),a.createBlock(b,{key:0,placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:a.withCtx(()=>[N.value?(a.openBlock(),a.createElementBlock("div",gy,[...w[4]||(w[4]=[a.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击",-1),a.createTextVNode("添加节点 ",-1)])])):a.createCommentVNode("",!0),w[5]||(w[5]=a.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[a.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),a.createTextVNode("连接节点 ")],-1))]),default:a.withCtx(()=>[a.createVNode(a.unref(on),{onClick:w[1]||(w[1]=R=>v("t1")),onMousedown:g,id:"t1",class:a.normalizeClass(["d-flow-step-target-handle",{"d-flow-step-target-handle-notadd":!N.value}]),type:"target",position:a.unref(de).Left,"is-valid-connection":z},{default:a.withCtx(()=>[N.value?(a.openBlock(),a.createBlock(k,{key:0,visible:y.value.t1,"onUpdate:visible":w[0]||(w[0]=R=>y.value.t1=R),placement:"left","popper-class":"d-flow-step-popper",trigger:"click","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:a.withCtx(()=>[a.createVNode(gn,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:a.withCtx(()=>[a.createVNode(gr,{"handle-id":"t1","from-node-id":t.id,onAddNode:F},null,8,["from-node-id"])]),_:1},8,["visible"])):a.createCommentVNode("",!0)]),_:1},8,["class","position"])]),_:1})):a.createCommentVNode("",!0),a.createVNode(b,{placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:a.withCtx(()=>[...w[6]||(w[6]=[a.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[a.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击"),a.createTextVNode("添加节点 ")],-1),a.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[a.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),a.createTextVNode("连接节点 ")],-1)])]),default:a.withCtx(()=>[a.createVNode(a.unref(on),{onClick:w[3]||(w[3]=R=>v("s1")),onMousedown:g,id:"s1",class:"d-flow-step-source-handle",type:"source",position:a.unref(de).Right,"is-valid-connection":z},{default:a.withCtx(()=>[a.createVNode(k,{visible:y.value.s1,"onUpdate:visible":w[2]||(w[2]=R=>y.value.s1=R),placement:"right",trigger:"click","popper-class":"d-flow-step-popper","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:a.withCtx(()=>[a.createVNode(gn,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:a.withCtx(()=>[a.createVNode(gr,{"handle-id":"s1","from-node-id":t.id,onAddNode:F},null,8,["from-node-id"])]),_:1},8,["visible"])]),_:1},8,["position"])]),_:1}),a.createVNode(O,{ref_key:"dropdownRef",ref:X,"popper-class":"d-flow-step-dropdown","virtual-ref":S.value,"show-arrow":!1,"popper-options":{modifiers:[{name:"offset",options:{offset:[0,0]}}]},"virtual-triggering":"",trigger:"contextmenu",placement:"bottom-start"},{dropdown:a.withCtx(()=>[a.createVNode(T,null,{default:a.withCtx(()=>[t.data.type!="start"?(a.openBlock(),a.createBlock(E,{key:0,onClick:p},{default:a.withCtx(()=>[...w[7]||(w[7]=[a.createTextVNode("删除",-1)])]),_:1})):a.createCommentVNode("",!0),h.value.des?(a.openBlock(),a.createElementBlock("div",{key:1,style:a.normalizeStyle({width:"160px",padding:"4px 16px 0 16px","font-size":"12px","border-top":t.data.type!="start"?"1px solid var(--j-color-border)":void 0,"margin-top":t.data.type!="start"?"4px":void 0})},[w[8]||(w[8]=a.createElementVNode("div",{style:{"margin-bottom":"4px",color:"var(--j-color-text-2)"}},"关于",-1)),a.createElementVNode("div",my,a.toDisplayString(h.value.des),1)],4)):a.createCommentVNode("",!0)]),_:1})]),_:1},8,["virtual-ref"])],32)}}}),vy=a.defineComponent({name:"DEdgeWithButton",__name:"edgeWithButton",props:{id:{},sourceX:{},sourceY:{},targetX:{},targetY:{},sourcePosition:{},targetPosition:{},markerEnd:{},style:{}},setup(t){const e=t,{onEdgeMouseEnter:n,onEdgeMouseLeave:o,onNodeClick:i,onEdgeClick:r,onMoveStart:s,onConnectStart:l,onNodeDragStart:u}=we(),c=a.computed(()=>fr(e)),d=a.ref(!1),f=a.ref(!1);n(({edge:v})=>{v.id===e.id&&(d.value=!0)}),o(()=>{d.value=!1});const h=a.ref(!1),p=()=>{h.value=!1,a.nextTick(()=>{f.value=!1})},y=()=>{f.value=!0,h.value=!0},m=()=>{p()};return i(()=>{p()}),r(()=>{p()}),s(()=>{p()}),l(()=>{p()}),u(()=>{p()}),(v,N)=>{const _=a.resolveComponent("j-icon"),g=a.resolveComponent("el-popover");return a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(a.unref(An),{id:t.id,style:a.normalizeStyle(t.style),path:c.value[0],"marker-end":t.markerEnd},null,8,["id","style","path","marker-end"]),a.createVNode(a.unref(xm),null,{default:a.withCtx(()=>[a.createElementVNode("div",{style:a.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${c.value[1]}px,${c.value[2]}px)`}),class:"nodrag nopan"},[a.createVNode(g,{visible:h.value,"show-arrow":!1,placement:"right","popper-class":"d-flow-step-popper"},{reference:a.withCtx(()=>[a.withDirectives(a.createElementVNode("div",{onClick:a.withModifiers(y,["stop"]),class:"d-flow-edge-button"},[a.createVNode(_,{icon:"mdi:plus-circle"})],512),[[a.vShow,d.value||f.value]])]),default:a.withCtx(()=>[a.createVNode(gr,{"handle-id":"line","from-node-id":t.id,onAddNode:m},null,8,["from-node-id"])]),_:1},8,["visible"])],4)]),_:1})],64)}}}),by=a.defineComponent({name:"DFlow",__name:"flow",props:{nodes:{default:()=>[]},edges:{default:()=>[]}},setup(t){return(e,n)=>(a.openBlock(),a.createBlock(a.unref(Mm),{"min-zoom":.2,"max-zoom":4,"default-viewport":{zoom:1},"connection-mode":a.unref(gt).Strict,nodes:t.nodes,edges:t.edges},{"edge-button":a.withCtx(o=>[a.createVNode(vy,{id:o.id,"source-x":o.sourceX,"source-y":o.sourceY,"target-x":o.targetX,"target-y":o.targetY,"source-position":o.sourcePosition,"target-position":o.targetPosition,"marker-end":o.markerEnd,style:a.normalizeStyle(o.style)},null,8,["id","source-x","source-y","target-x","target-y","source-position","target-position","marker-end","style"])]),"node-step":a.withCtx(o=>[a.createVNode(yy,a.normalizeProps(a.guardReactiveProps(o)),null,16)]),default:a.withCtx(()=>[a.createVNode(a.unref(uy),{position:"bottom-left"}),a.createVNode(a.unref(Hm))]),_:1},8,["connection-mode","nodes","edges"]))}}),wy={class:"d-flow-design"},_y={class:"d-flow-design-canvas"},xy={class:"d-flow-design-right"},Ey={class:"d-flow-design-title"},Cy={class:"d-flow-design-title-name"},Sy={class:"d-flow-design-panel"},fl=Gt(a.defineComponent({name:"DFlowDesign",__name:"flowDesign",props:{components:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["nodeClick","edgeClick","paneClick","connect"],setup(t,{expose:e,emit:n}){const o=t,i=n,{addNodes:r,addEdges:s,removeEdges:l,addSelectedNodes:u,removeSelectedNodes:c,onConnect:d,onNodeClick:f,onPaneClick:h,onEdgeClick:p,getNodes:y,getEdges:m}=we(),v=a.computed(()=>{const O={};return o.components.forEach(R=>{O[R.type]=R}),O.start={name:"开始",type:"start",icon:"ant-design:play-circle-outlined",des:"执行开始节点"},O}),N={id:"start",type:"step",data:{type:"start",isInit:!1},position:{x:80,y:160}},_=a.ref([N]),g=a.ref([]),x=(O,R)=>{if(R.indexOf("t")===-1){const B=m.value.filter(P=>P.source===O.id);if(B.length>0){let P=-1e6,V=0;return B.forEach(W=>{P=Math.max(P,W.targetNode.position.y+W.targetNode.dimensions.height+32),V=W.targetNode.position.x||0}),{x:V,y:P}}return{x:O.position.x+O.dimensions.width+100,y:O.position.y}}return{x:O.position.x-100-O.dimensions.width,y:O.position.y}},z=(O,R,B)=>{const P=y.value.find(W=>W.id===R);if(!P)return;const V={id:jt(),type:"step",data:{type:O},position:x(P,B)};if(o.flowInit){const W=o.flowInit(V.data.type);W&&Object.keys(W).forEach(Z=>{V.data[Z]=W[Z]})}r(V),B.indexOf("t")===-1?s({id:`${R}-${V.id}`,source:R,target:V.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}):s({id:`${R}-${V.id}`,source:V.id,target:R,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}),C(V.id)},$=O=>{const R=y.value.find(B=>B.id===O);R&&(R.position.x+=100+R.dimensions.width,m.value.filter(P=>P.source===O).forEach(P=>{$(P.target)}))},F=(O,R)=>{const B=m.value.find(V=>V.id===R);if(!B)return;const P={id:jt(),type:"step",data:{type:O},position:{x:B.targetNode.position.x,y:B.targetNode.position.y}};if(o.flowInit){const V=o.flowInit(P.data.type);V&&Object.keys(V).forEach(W=>{P.data[W]=V[W]})}r(P),s({id:`${B.sourceNode.id}-${P.id}`,source:B.sourceNode.id,target:P.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}),s({id:`${P.id}-${B.targetNode.id}`,source:P.id,target:B.targetNode.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}),l(R),$(B.target),C(P.id)};d(O=>{console.log("onConnect",O),O.type="button",O.markerEnd=mt.Arrow,s(O),i("connect",O)});const X=()=>o.components||[],Y=a.ref(),S=a.computed(()=>Y.value?v.value[Y.value.data.type]:void 0);f(O=>{Y.value?.id!==O.node.id&&(Y.value=O.node,k()),i("nodeClick",O.node)}),h(()=>{Y.value=void 0,i("paneClick")}),p(O=>{Y.value=void 0,i("edgeClick",O.edge)});const I=O=>{Y.value?.id===O&&(Y.value=void 0)},C=O=>{Y.value&&c([Y.value]),Y.value=y.value.find(R=>R.id===O),Y.value&&(k(),setTimeout(()=>{Y.value&&u([Y.value])},100))},H=a.ref(),w={};Object.keys(o.flowComponentConfigs).forEach(O=>{const R={type:"j-collapse",config:{defaultValue:[]},children:[]};o.flowComponentConfigs[O].forEach((B,P)=>{const V=`_collapse${P}`;R.config?.defaultValue.push(V),R.children?.push(B)}),w[O]=[R]});const k=()=>{const O=w[Y.value?.data.type||""];O&&H.value?(H.value.init&&H.value.init(O,Y.value?.data),o.flowComponentConfigInit&&o.flowComponentConfigInit({configRef:H,inputParams:o.inputParams,components:y.value,configData:Y.value?.data})):H.value&&H.value.init&&H.value.init([])},b=(O,R)=>{Y.value&&o.flowComponentConfigChange&&o.flowComponentConfigChange(Y.value.data.type,{configRef:H,component:O,configData:Y.value.data,...R,isFlowNode:!0})};return a.provide("d_flow_design_provide",{getFlowComponents:X,addNode:z,addNodeByLine:F,onRemoveNode:I,getFlowComponentMap:v}),e({getData:()=>{const O=[];return y.value.forEach(R=>{O.push({config:R.data,id:R.id,position:R.position,type:R.type})}),m.value.forEach(R=>{O.push({id:R.id,source:R.source,target:R.target,sourceHandle:R.sourceHandle,targetHandle:R.targetHandle,type:"line",config:{},position:{x:0,y:0}})}),O},setData:O=>{if(!O||O.length===0)N.data.isInit=!0,_.value=[N],C(N.id);else{N.data.isInit=!1;const R=[],B=[];O.forEach(P=>{if(P.type==="line")P.type="button",P.markerEnd=mt.Arrow,B.push(P);else{const V={id:P.id,type:P.type,data:P.config,position:P.position};R.push(V)}}),_.value=R,g.value=B}}}),(O,R)=>{const B=a.resolveComponent("j-icon"),P=a.resolveComponent("j-form");return a.openBlock(),a.createElementBlock("div",wy,[a.createElementVNode("div",_y,[a.createVNode(by,{nodes:_.value,edges:g.value},null,8,["nodes","edges"])]),a.withDirectives(a.createElementVNode("div",xy,[a.createElementVNode("div",Ey,[a.createElementVNode("div",{class:"d-flow-design-title-icon",style:a.normalizeStyle({backgroundColor:S.value?.iconColor||"var(--j-color-primary)"})},[a.createVNode(B,{icon:S.value?.icon||"mdi:source-branch"},null,8,["icon"])],4),a.createElementVNode("div",Cy,a.toDisplayString(S.value?.name||""),1)]),a.createElementVNode("div",Sy,[a.createVNode(P,{config:{labelPosition:"top"},style:{padding:"0"},ref_key:"configRef",ref:H,onChange:b},null,512)])],512),[[a.vShow,Y.value&&w[Y.value.data.type]]])])}}})),Ny={class:"d-input-flow j-block"},hl=Gt(a.defineComponent({name:"DInputFlow",__name:"inputFlow",props:{modelValue:{},type:{},btnText:{default:"事件"},title:{},size:{default:"default"},width:{default:1200},height:{default:800},beforeClose:{},flowComponents:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["update:modelValue","change"],setup(t,{emit:e}){const n=t,o=e,i=a.ref(),r=a.computed({get(){return n.modelValue},set(f){o("update:modelValue",f)}}),s=a.computed(()=>(n.modelValue?.trim(),n.btnText)),l=f=>{const h=typeof f=="string"?f:void 0;try{i.value?.setData(JSON.parse(h||"[]"))}catch{i.value?.setData([])}},u=async()=>{const f=i.value?.getData();return f?JSON.stringify(f):void 0},c=f=>{if(n.beforeClose){const h=typeof f=="string"?f:void 0;return n.beforeClose(h)}return!0},d=f=>{const h=f.value;o("change",{value:typeof h=="string"?h:void 0})};return(f,h)=>{const p=a.resolveComponent("d-flow-design"),y=a.resolveComponent("j-input-button");return a.openBlock(),a.createBlock(y,a.mergeProps(f.$attrs,{type:t.type,"btn-text":s.value,title:t.title,size:t.size,width:t.width,height:t.height,"before-close":c,ok:u,open:l,"destroy-on-close":"",modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=m=>r.value=m),onChange:d}),{default:a.withCtx(()=>[a.createElementVNode("div",Ny,[a.createVNode(p,{ref_key:"flowRef",ref:i,components:t.flowComponents,"flow-init":t.flowInit,"flow-component-config-init":t.flowComponentConfigInit,"flow-component-configs":t.flowComponentConfigs,"flow-component-config-change":t.flowComponentConfigChange,"input-params":t.inputParams},null,8,["components","flow-init","flow-component-config-init","flow-component-configs","flow-component-config-change","input-params"])])]),_:1},16,["type","btn-text","title","size","width","height","modelValue"])}}}));class J{static getElements(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(o&&!isNaN(+e[0])){const r=o.getElementById(e);return r?[r]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const r=n.querySelector(`[gs-id="${e}"]`);return r?[r]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(!e.length)return null;if(o&&e[0]==="#")return o.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(o&&!isNaN(+e[0]))return o.getElementById(e);let i=n.querySelector(e);return o&&!i&&(i=o.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,n){const o=document.createElement("div");return e.forEach(i=>{i&&o.classList.add(i)}),n?.appendChild(o),o}static shouldSizeToContent(e,n=!1){return e?.grid&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return J.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const o=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=o)return 0;const r=e.y>n.y?e.y:n.y,s=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return s<=r?0:(i-o)*(s-r)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,r)=>{const s=n*((i.y??1e4)-(r.y??1e4));return s===0?n*((i.x??1e4)-(r.x??1e4)):s})}static find(e,n){return n?e.find(o=>o.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,o="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);o=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:o}}static defaults(e,...n){return n.forEach(o=>{for(const i in o){if(!o.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=o[i]:typeof o[i]=="object"&&typeof e[i]=="object"&&J.defaults(e[i],o[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const o in e)if(e[o]!==n[o])return!1;return!0}static copyPos(e,n,o=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),o&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let o in e){const i=e[o],r=n[o];o[0]==="_"||i===r?delete e[o]:i&&typeof i=="object"&&r!==void 0&&(J.removeInternalAndSame(i,r),Object.keys(i).length||delete e[o])}}static removeInternalForSave(e,n=!0){for(let o in e)(o[0]==="_"||e[o]===null||e[o]===void 0)&&delete e[o];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let o=!1;return(...i)=>{o||(o=!0,setTimeout(()=>{e(...i),o=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e);return/(auto|scroll)/.test(n.overflow+n.overflowY)?e:J.getScrollElement(e.parentElement)}static updateScrollPosition(e,n,o){const i=J.getScrollElement(e);if(!i)return;const r=e.getBoundingClientRect(),s=i.getBoundingClientRect(),l=window.innerHeight||document.documentElement.clientHeight,u=r.bottom-Math.min(s.bottom,l),c=r.top-Math.max(s.top,0),d=i.scrollTop;c<0&&o<0?e.offsetHeight>s.height?i.scrollTop+=o:i.scrollTop+=Math.abs(c)>Math.abs(o)?o:c:u>0&&o>0&&(e.offsetHeight>s.height?i.scrollTop+=o:i.scrollTop+=u>o?o:u),n.top+=i.scrollTop-d}static updateScrollResize(e,n,o){const i=J.getScrollElement(n),r=i.clientHeight,s=i===J.getScrollElement()?0:i.getBoundingClientRect().top,l=e.clientY-s,u=l<o,c=l>r-o;u?i.scrollBy({behavior:"smooth",top:l-o}):c&&i.scrollBy({behavior:"smooth",top:o-(r-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],o=J.clone(e);for(const i in o)o.hasOwnProperty(i)&&typeof o[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(r=>r===i)&&(o[i]=J.cloneDeep(e[i]));return o}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let o;typeof n=="string"?o=J.getElement(n):o=n,o&&o.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const o in n)n.hasOwnProperty(o)&&(Array.isArray(n[o])?n[o].forEach(i=>{e.style[o]=i}):e.style[o]=n[o])}static initEvent(e,n){const o={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(r=>o[r]=e[r]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(r=>o[r]=e[r]),{...o,...i}}static simulateMouseEvent(e,n,o){const i=e,r=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(o||e.target).dispatchEvent(r)}static getValuesFromTransformedElement(e){const n=document.createElement("div");J.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const o=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/o.width,yScale:1/o.height,xOffset:o.left,yOffset:o.top}}static swap(e,n,o){if(!e)return;const i=e[n];e[n]=e[o],e[o]=i}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class vt{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,o,i={}){if(this.sortNodes(-1),o=o||this.collide(e,n),!o)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,o))return!0;let r=n;!this._loading&&this._useEntireRowArea(e,n)&&(r={x:0,w:this.column,y:n.y,h:n.h},o=this.collide(e,r,i.skip));let s=!1;const l={nested:!0,pack:!1};let u=0;for(;o=o||this.collide(e,r,i.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(o.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(o,{...o,y:e.y},e)||!this.collide(o,{...o,y:n.y-o.h},e))){e._skipDown=e._skipDown||n.y>e.y;const d={...n,y:o.y+o.h,...l};c=this._loading&&J.samePos(e,d)?!0:this.moveNode(e,d),(o.locked||this._loading)&&c?J.copyPos(n,e):!o.locked&&c&&i.pack&&(this._packNodes(),n.y=o.y+o.h,J.copyPos(e,n)),s=s||c}else c=this.moveNode(o,{...o,y:n.y+n.h,skip:e,...l});if(!c)return s;o=void 0}return s}collide(e,n=e,o){const i=e._id,r=o?._id;return this.nodes.find(s=>s._id!==i&&s._id!==r&&J.isIntercepted(s,n))}collideAll(e,n=e,o){const i=e._id,r=o?._id;return this.nodes.filter(s=>s._id!==i&&s._id!==r&&J.isIntercepted(s,n))}directionCollideCoverage(e,n,o){if(!n.rect||!e._rect)return;const i=e._rect,r={...n.rect};r.y>i.y?(r.h+=r.y-i.y,r.y=i.y):r.h+=i.y-r.y,r.x>i.x?(r.w+=r.x-i.x,r.x=i.x):r.w+=i.x-r.x;let s,l=.5;for(let u of o){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,f=Number.MAX_VALUE;i.y<c.y?d=(r.y+r.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(d=(c.y+c.h-r.y)/c.h),i.x<c.x?f=(r.x+r.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(f=(c.x+c.w-r.x)/c.w);const h=Math.min(f,d);h>l&&(l=h,s=u)}return n.collide=s,s}cacheRects(e,n,o,i,r,s){return this.nodes.forEach(l=>l._rect={y:l.y*n+o,x:l.x*e+s,w:l.w*e-s-i,h:l.h*n-o-r}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function o(){const r=n.x,s=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=r,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=s):(e.x=r,e.y=s),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=J.isTouching(e,n)))return o();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=J.isTouching(e,n)))){if(n.y<e.y){const r=e;e=n,n=r}return o()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=J.isTouching(e,n)))){if(n.x<e.x){const r=e;e=n,n=r}return o()}return!1}}}isAreaEmpty(e,n,o,i){const r={x:e||0,y:n||0,w:o||1,h:i||1};return!this.collide(r)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const o=this.batchMode;o||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const r=this.nodes;return this.nodes=[],r.forEach((s,l,u)=>{let c;s.locked||(s.autoPosition=!0,e==="list"&&l&&(c=u[l-1])),this.addNode(s,!1,c)}),i||delete this._inColumnResize,o||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=J.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const o=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:o,w:e.w,h:e.h})))break;e._dirty=e.y!==o,e.y=o}}),this)}prepareNode(e,n){e._id=e._id??vt._idSeq++;const o=e.id;if(o){let r=1;for(;this.nodes.find(s=>s.id===e.id&&s!==e);)e.id=o+"_"+r++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return J.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,J.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const o=e._orig||J.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const r={...e};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),J.samePos(e,o)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!J.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=J.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||J.samePos(e,e._orig)||(J.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,o=this.column,i){const r=i?i.y*o+(i.x+i.w):0;let s=!1;for(let l=r;!s;++l){const u=l%o,c=Math.floor(l/o);if(u+e.w>o)continue;const d={x:u,y:c,w:e.w,h:e.h};n.find(f=>J.isIntercepted(d,f))||((e.x!==u||e.y!==c)&&(e._dirty=!0),e.x=u,e.y=c,delete e.autoPosition,s=!0)}return s}addNode(e,n=!1,o){const i=this.nodes.find(s=>s._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,o)&&(delete e.autoPosition,r=!0),this.nodes.push(e),n&&this.addedNodes.push(e),r||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,o=!1){return this.nodes.find(i=>i._id===e._id)?(o&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const o=this.nodes;return this.removedNodes=n?o:[],this.nodes=[],this._notify(o)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let o;const i=new vt({column:this.column,float:this.float,nodes:this.nodes.map(s=>s._id===e._id?(o={...s},o):{...s})});if(!o)return!1;const r=i.moveNode(o,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!n.resizing&&n.collide){const s=n.collide.el.gridstackNode;if(this.swap(e,s))return this._notify(),!0}return r?(i.nodes.filter(s=>s._dirty).forEach(s=>{const l=this.nodes.find(u=>u._id===s._id);l&&(J.copyPos(l,s),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new vt({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),o={...e};return this.cleanupNode(o),delete o.el,delete o._id,delete o.content,delete o.grid,n.addNode(o),n.getRow()<=this.maxRow?(e._willFitPos=J.copyPos({},o),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){if(!e||!n)return!1;let o;n.pack===void 0&&!this.batchMode&&(o=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,r=J.copyPos({},e,!0);if(J.copyPos(r,n),this.nodeBoundFix(r,i),J.copyPos(n,r),!n.forceCollide&&J.samePos(e,n))return!1;const s=J.copyPos({},e),l=this.collideAll(e,r,n.skip);let u=!0;if(l.length){const c=e._moving&&!n.nested;let d=c?this.directionCollideCoverage(e,n,l):l[0];if(c&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const f=J.areaIntercept(n.rect,d._rect),h=J.area(n.rect),p=J.area(d._rect);f/(h<p?h:p)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?u=!this._fixCollisions(e,r,d,n):(u=!1,o&&delete n.pack)}return u&&!J.samePos(e,r)&&(e._dirty=!0,J.copyPos(e,r)),n.pack&&this._packNodes()._notify(),!J.samePos(e,s)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,o){const i=this._layouts?.length||0;let r;i&&(o?o!==this.column&&(r=this._layouts[o]):this.column!==i-1&&(r=this._layouts[i-1]));const s=[];return this.sortNodes(),this.nodes.forEach(l=>{const u=r?.find(d=>d._id===l._id),c={...l,...u||{}};J.removeInternalForSave(c,!e),n&&n(l,c),s.push(c)}),s}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,o)=>{if(!n||o===this.column)return this;if(o<this.column)this._layouts[o]=void 0;else{const i=o/this.column;e.forEach(r=>{if(!r._orig)return;const s=n.find(l=>l._id===r._id);s&&(s.y>=0&&r.y!==r._orig.y&&(s.y+=r.y-r._orig.y,s.y<0&&(s.y=0)),r.x!==r._orig.x&&(s.x=Math.round(r.x*i),s.x<0&&(s.x=0)),r.w!==r._orig.w&&(s.w=Math.round(r.w*i),s.w<1&&(s.w=1)))})}}),this)}columnChanged(e,n,o="moveScale"){if(!this.nodes.length||!n||e===n)return this;const i=o==="compact"||o==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let r=[],s=i?this.nodes:J.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],u=this._layouts.length-1;!l.length&&e!==u&&this._layouts[u]?.length&&(e=u,this._layouts[u].forEach(c=>{const d=s.find(f=>f._id===c._id);d&&(!i&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=!0))})),l.forEach(c=>{const d=s.findIndex(f=>f._id===c._id);if(d!==-1){const f=s[d];if(i){f.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,r),c.autoPosition||(f.x=c.x??f.x,f.y=c.y??f.y,f.w=c.w??f.w,r.push(f)),s.splice(d,1)}})}if(i)this.compact(o,!1);else{if(s.length)if(typeof o=="function")o(n,e,r,s);else{const l=i||o==="none"?1:n/e,u=o==="move"||o==="moveScale",c=o==="scale"||o==="moveScale";s.forEach(d=>{d.x=n===1?0:u?Math.round(d.x*l):Math.min(d.x,n-1),d.w=n===1||e===1?1:c?Math.round(d.w*l)||1:Math.min(d.w,n),r.push(d)}),s=[]}r=J.sort(r,-1),this._inColumnResize=!0,this.nodes=[],r.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,o=!1){const i=[];return e.forEach((r,s)=>{if(r._id===void 0){const l=r.id?this.nodes.find(u=>u.id===r.id):void 0;r._id=l?._id??vt._idSeq++}i[s]={x:r.x,y:r.y,w:r.w,_id:r._id}}),this._layouts=o?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??vt._idSeq++;const o={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete o.x,delete o.y,e.autoPosition&&(o.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(o):this._layouts[n][i]=o,this}findCacheLayout(e,n){return this._layouts?.[n]?.findIndex(o=>o._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const o=this.findCacheLayout(e,n);o!==-1&&this._layouts[n].splice(o,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}}vt._idSeq=0;const Ge={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class he{}const tt=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class je{}function Po(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),J.simulateMouseEvent(t.changedTouches[0],e))}function pl(t,e){t.cancelable&&t.preventDefault(),J.simulateMouseEvent(t,e)}function Oo(t){je.touchHandled||(je.touchHandled=!0,Po(t,"mousedown"))}function Ro(t){je.touchHandled&&Po(t,"mousemove")}function Ho(t){if(!je.touchHandled)return;je.pointerLeaveTimeout&&(window.clearTimeout(je.pointerLeaveTimeout),delete je.pointerLeaveTimeout);const e=!!he.dragElement;Po(t,"mouseup"),e||Po(t,"click"),je.touchHandled=!1}function Lo(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function gl(t){he.dragElement&&t.pointerType!=="mouse"&&pl(t,"mouseenter")}function ml(t){he.dragElement&&t.pointerType!=="mouse"&&(je.pointerLeaveTimeout=window.setTimeout(()=>{delete je.pointerLeaveTimeout,pl(t,"mouseleave")},10))}class Vo{constructor(e,n,o){this.host=e,this.dir=n,this.option=o,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Vo.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),tt&&(this.el.addEventListener("touchstart",Oo),this.el.addEventListener("pointerdown",Lo)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),tt&&(this.el.removeEventListener("touchstart",Oo),this.el.removeEventListener("pointerdown",Lo)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),tt&&(this.el.addEventListener("touchmove",Ro),this.el.addEventListener("touchend",Ho)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),tt&&(this.el.removeEventListener("touchmove",Ro),this.el.removeEventListener("touchend",Ho)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,n){return this.option[e]&&this.option[e](n),this}}Vo.prefix="ui-resizable-";class mr{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,n){this._eventRegister[e]=n}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,n){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](n)}}class Pn extends mr{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const i=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},s=this.temporalRect||r;return{position:{left:(s.left-i.left)*this.rectScale.x,top:(s.top-i.top)*this.rectScale.y},size:{width:s.width*this.rectScale.x,height:s.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,o=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),o&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),he.overResizeElement===this&&delete he.overResizeElement),this}_mouseOver(e){he.overResizeElement||he.dragElement||(he.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){he.overResizeElement===this&&(delete he.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Vo(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=J.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=J.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=J.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const o=J.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(o,this._ui()),this.triggerEvent("resize",o),this}_resizeStop(e){const n=J.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Pn._originStyleProp.map(o=>this.el.style[o]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=J.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Pn._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const o=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},r=e.clientX-o.clientX,s=this.sizeToContent?0:e.clientY-o.clientY;let l,u;n.indexOf("e")>-1?i.width+=r:n.indexOf("w")>-1&&(i.width-=r,i.left+=r,l=!0),n.indexOf("s")>-1?i.height+=s:n.indexOf("n")>-1&&(i.height-=s,i.top+=s,u=!0);const c=this._constrainSize(i.width,i.height,l,u);return Math.round(i.width)!==Math.round(c.width)&&(n.indexOf("w")>-1&&(i.left+=i.width-c.width),i.width=c.width),Math.round(i.height)!==Math.round(c.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-c.height),i.height=c.height),i}_constrainSize(e,n,o,i){const r=this.option,s=(o?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,l=r.minWidth/this.rectScale.x||e,u=(i?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,c=r.minHeight/this.rectScale.y||n,d=Math.min(s,Math.max(l,e)),f=Math.min(u,Math.max(c,n));return{width:d,height:f}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const n=this.el.parentElement,{left:o,top:i}=n.getBoundingClientRect();e={left:o,top:i,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(n=>{const o=this.temporalRect[n],i=n==="width"||n==="left"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;this.el.style[n]=(o-e[n])*i+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}Pn._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const ky='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class On extends mr{constructor(e,n={}){super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const o=n?.handle?.substring(1),i=e.gridstackNode;this.dragEls=!o||e.classList.contains(o)?[e]:i?.subGrid?[e.querySelector(n.handle)||e]:Array.from(e.querySelectorAll(n.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),tt&&(e.addEventListener("touchstart",Oo),e.addEventListener("pointerdown",Lo))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),tt&&(n.removeEventListener("touchstart",Oo),n.removeEventListener("pointerdown",Lo))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(je.touchHandled&&e.isTrusted&&(je.touchHandled=!1),!he.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(ky)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete he.dragElement,delete he.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),tt&&(e.currentTarget.addEventListener("touchmove",Ro),e.currentTarget.addEventListener("touchend",Ho)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),he.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=J.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),he.pauseDrag){const o=Number.isInteger(he.pauseDrag)?he.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),o)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,he.dragElement=this;const o=this.el.gridstackNode?.grid;o?he.dropElement=o.el.ddElement.ddDroppable:delete he.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=J.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const i=J.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(i,this.ui()),this.triggerEvent("dragstart",i),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),tt&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Ro,!0),e.currentTarget.removeEventListener("touchend",Ho,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),he.dropElement?.el===this.el.parentElement&&delete he.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const n=J.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(n),this.triggerEvent("dragstop",n),he.dropElement&&he.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete he.dragElement,delete he.dropElement,delete he.mouseHandled,e.preventDefault()}_keyEvent(e){const n=this.el.gridstackNode,o=n?.grid||he.dropElement?.el?.gridstack;if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),o?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&o&&(e.key==="r"||e.key==="R")){if(!J.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,o.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",J.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=J.cloneNode(this.el)),e.parentElement||J.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=On.originStyleProp.map(n=>this.el.style[n]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const n=this.helper.style;return n.pointerEvents="none",n.width=this.dragOffset.width+"px",n.height=this.dragOffset.height+"px",n.willChange="left, top",n.position="fixed",this._dragFollow(e),n.transition="none",setTimeout(()=>{this.helper&&(n.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const n=this.helper,o=this.dragElementOriginStyle.transition||null;n.style.transition=this.dragElementOriginStyle.transition="none",On.originStyleProp.forEach(i=>n.style[i]=this.dragElementOriginStyle[i]||null),setTimeout(()=>n.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n={left:0,top:0},o=this.helper.style,i=this.dragOffset;o.left=(e.clientX+i.offsetLeft-n.left)*this.dragTransform.xScale+"px",o.top=(e.clientY+i.offsetTop-n.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,o){let i=0,r=0;o&&(i=this.dragTransform.xOffset,r=this.dragTransform.yOffset);const s=n.getBoundingClientRect();return{left:s.left,top:s.top,offsetLeft:-e.clientX+s.left-i,offsetTop:-e.clientY+s.top-r,width:s.width*this.dragTransform.xScale,height:s.height*this.dragTransform.yScale}}ui(){const n=this.el.parentElement.getBoundingClientRect(),o=this.helper.getBoundingClientRect();return{position:{top:(o.top-n.top)*this.dragTransform.yScale,left:(o.left-n.left)*this.dragTransform.xScale}}}}On.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class Dy extends mr{constructor(e,n={}){super(),this.el=e,this.option=n,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),tt&&(this.el.addEventListener("pointerenter",gl),this.el.addEventListener("pointerleave",ml)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),tt&&(this.el.removeEventListener("pointerenter",gl),this.el.removeEventListener("pointerleave",ml)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this._setupAccept(),this}_mouseEnter(e){if(!he.dragElement||je.touchHandled&&e.isTrusted||!this._canDrop(he.dragElement.el))return;e.preventDefault(),e.stopPropagation(),he.dropElement&&he.dropElement!==this&&he.dropElement._mouseLeave(e,!0),he.dropElement=this;const n=J.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(he.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){if(!he.dragElement||he.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const o=J.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(o,this._ui(he.dragElement)),this.triggerEvent("dropout",o),he.dropElement===this&&(delete he.dropElement,!n)){let i,r=this.el.parentElement;for(;!i&&r;)i=r.ddElement?.ddDroppable,r=r.parentElement;i&&i._mouseEnter(e)}}drop(e){e.preventDefault();const n=J.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(he.dragElement)),this.triggerEvent("drop",n)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class yr{static init(e){return e.ddElement||(e.ddElement=new yr(e)),e.ddElement}constructor(e){this.el=e}on(e,n){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,n):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,n):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,n),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new On(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new Pn(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Dy(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class Ty{resizable(e,n,o,i){return this._getDDElements(e,n).forEach(r=>{if(n==="disable"||n==="enable")r.ddResizable&&r.ddResizable[n]();else if(n==="destroy")r.ddResizable&&r.cleanResizable();else if(n==="option")r.setupResizable({[o]:i});else{const l=r.el.gridstackNode.grid;let u=r.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;r.setupResizable({...l.opts.resizable,handles:u,autoHide:c,start:n.start,stop:n.stop,resize:n.resize})}}),this}draggable(e,n,o,i){return this._getDDElements(e,n).forEach(r=>{if(n==="disable"||n==="enable")r.ddDraggable&&r.ddDraggable[n]();else if(n==="destroy")r.ddDraggable&&r.cleanDraggable();else if(n==="option")r.setupDraggable({[o]:i});else{const s=r.el.gridstackNode.grid;r.setupDraggable({...s.opts.draggable,start:n.start,stop:n.stop,drag:n.drag})}}),this}dragIn(e,n){return this._getDDElements(e).forEach(o=>o.setupDraggable(n)),this}droppable(e,n,o,i){return typeof n.accept=="function"&&!n._accept&&(n._accept=n.accept,n.accept=r=>n._accept(r)),this._getDDElements(e,n).forEach(r=>{n==="disable"||n==="enable"?r.ddDroppable&&r.ddDroppable[n]():n==="destroy"?r.ddDroppable&&r.cleanDroppable():n==="option"?r.setupDroppable({[o]:i}):r.setupDroppable(n)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,n,o){return this._getDDElements(e).forEach(i=>i.on(n,r=>{o(r,he.dragElement?he.dragElement.el:r.target,he.dragElement?he.dragElement.helper:null)})),this}off(e,n){return this._getDDElements(e).forEach(o=>o.off(n)),this}_getDDElements(e,n){const o=e.gridstack||n!=="destroy"&&n!=="disable",i=J.getElements(e);return i.length?i.map(s=>s.ddElement||(o?yr.init(s):null)).filter(s=>s):[]}}const Oe=new Ty;class ue{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const o=ue.getGridElement(n);return o?(o.gridstack||(o.gridstack=new ue(o,J.cloneDeep(e))),o.gridstack):(console.error(typeof n=="string"?'GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
26
+ Edge: ${t}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Be extends Error{constructor(e,...n){var o;super((o=Ha[e])==null?void 0:o.call(Ha,...n)),this.name="VueFlowError",this.code=e,this.args=n}}function rr(t){return"clientX"in t}function qp(t){return"sourceEvent"in t}function lt(t,e){const n=rr(t);let o,i;return n?(o=t.clientX,i=t.clientY):"touches"in t&&t.touches.length>0?(o=t.touches[0].clientX,i=t.touches[0].clientY):"changedTouches"in t&&t.changedTouches.length>0?(o=t.changedTouches[0].clientX,i=t.changedTouches[0].clientY):(o=0,i=0),{x:o-(e?.left??0),y:i-(e?.top??0)}}const No=()=>{var t;return typeof navigator<"u"&&((t=navigator?.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Kp(t){var e,n;return{width:((e=t.dimensions)==null?void 0:e.width)??t.width??0,height:((n=t.dimensions)==null?void 0:n.height)??t.height??0}}function ko(t,e=[1,1]){return{x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}}const Zp=()=>!0;function sr(t){t?.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Jp(t,e,n){const o=[],i={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const r of e.values())Co(i,xo(r))>0&&o.push(r);return o}const Qp=250;function eg(t,e,n,o){var i,r;let a=[],l=Number.POSITIVE_INFINITY;const u=Jp(t,n,e+Qp);for(const c of u){const d=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((r=c.handleBounds)==null?void 0:r.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:h,y:p}=nn(c,f,f.position,!0),y=Math.sqrt((h-t.x)**2+(p-t.y)**2);y>e||(y<l?(a=[{...f,x:h,y:p}],l=y):y===l&&a.push({...f,x:h,y:p}))}}if(!a.length)return null;if(a.length>1){const c=o.type==="source"?"target":"source";return a.find(d=>d.type===c)??a[0]}return a[0]}function Va(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:a,lib:l,flowId:u,isValidConnection:c=Zp},d,f,h,p){const y=r==="target",m=e?a.querySelector(`.${l}-flow__handle[data-id="${u}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:b,y:N}=lt(t),_=a.elementFromPoint(b,N),g=_?.classList.contains(`${l}-flow__handle`)?_:m,x={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){const A=La(void 0,g),$=g.getAttribute("data-nodeid"),F=g.getAttribute("data-handleid"),U=g.classList.contains("connectable"),G=g.classList.contains("connectableend");if(!$||!A)return x;const S={source:y?$:o,sourceHandle:y?F:i,target:y?o:$,targetHandle:y?i:F};x.connection=S;const E=U&&G&&(n===gt.Strict?y&&A==="source"||!y&&A==="target":$!==o||F!==i);x.isValid=E&&c(S,{nodes:f,edges:d,sourceNode:h(S.source),targetNode:h(S.target)}),x.toHandle=Fa($,A,F,p,n,!0)}return x}function La(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function tg(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function ng(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}function Fa(t,e,n,o,i,r=!1){var a,l,u;const c=o.get(t);if(!c)return null;const d=i===gt.Strict?(a=c.handleBounds)==null?void 0:a[e]:[...((l=c.handleBounds)==null?void 0:l.source)??[],...((u=c.handleBounds)==null?void 0:u.target)??[]],f=(n?d?.find(h=>h.id===n):d?.[0])??null;return f&&r?{...f,...nn(c,f,f.position,!0)}:f}const ar={[de.Left]:de.Right,[de.Right]:de.Left,[de.Top]:de.Bottom,[de.Bottom]:de.Top},og=["production","prod"];function zn(t,...e){ja()&&console.warn(`[Vue Flow]: ${t}`,...e)}function ja(){return!og.includes(process.env.NODE_ENV||"")}function Ga(t,e,n,o,i){const r=e.querySelectorAll(`.vue-flow__handle.${t}`);return r?.length?Array.from(r).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:t,nodeId:i,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/o,y:(l.top-n.top)/o,...Eo(a)}}):null}function lr(t,e,n,o,i,r=!1,a){i.value=!1,t.selected?(r||t.selected&&e)&&(o([t]),s.nextTick(()=>{a.blur()})):n([t])}function ke(t){return typeof s.unref(t)<"u"}function ig(t,e,n,o){if(!t||!t.source||!t.target)return n(new Be(Ne.EDGE_INVALID,t?.id??"[ID UNKNOWN]")),!1;let i;return St(t)?i=t:i={...t,id:_a(t)},i=ba(i,void 0,o),Op(i,e)?!1:i}function rg(t,e,n,o,i){if(!e.source||!e.target)return i(new Be(Ne.EDGE_INVALID,t.id)),!1;if(!n)return i(new Be(Ne.EDGE_NOT_FOUND,t.id)),!1;const{id:r,...a}=t;return{...a,id:o?_a(e):r,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle}}function Wa(t,e,n){const o={},i=[];for(let r=0;r<t.length;++r){const a=t[r];if(!Vt(a)){n(new Be(Ne.NODE_INVALID,a?.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const l=zp(a,e(a.id),a.parentNode);a.parentNode&&(o[a.parentNode]=!0),i[r]=l}for(const r of i){const a=e(r.parentNode)||i.find(l=>l.id===r.parentNode);r.parentNode&&!a&&n(new Be(Ne.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),a&&(a.isParent=!0))}return i}function Ya(t,e,n,o,i,r){let a=i;const l=o.get(a)||new Map;o.set(a,l.set(n,e)),a=`${i}-${t}`;const u=o.get(a)||new Map;if(o.set(a,u.set(n,e)),r){a=`${i}-${t}-${r}`;const c=o.get(a)||new Map;o.set(a,c.set(n,e))}}function cr(t,e,n){t.clear();for(const o of n){const{source:i,target:r,sourceHandle:a=null,targetHandle:l=null}=o,u={edgeId:o.id,source:i,target:r,sourceHandle:a,targetHandle:l},c=`${i}-${a}--${r}-${l}`,d=`${r}-${l}--${i}-${a}`;Ya("source",u,d,t,i,a),Ya("target",u,c,t,r,l)}}function Ua(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function dr(t,e,n,o,i,r,a,l){const u=[];for(const c of t){const d=St(c)?c:ig(c,l,i,r);if(!d)continue;const f=n(d.source),h=n(d.target);if(!f||!h){i(new Be(Ne.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new Be(Ne.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!h){i(new Be(Ne.EDGE_TARGET_MISSING,d.id,d.target));continue}if(e&&!e(d,{edges:l,nodes:a,sourceNode:f,targetNode:h})){i(new Be(Ne.EDGE_INVALID,d.id));continue}const p=o(d.id);u.push({...ba(d,p,r),sourceNode:f,targetNode:h})}return u}const Xa=Symbol("vueFlow"),qa=Symbol("nodeId"),Ka=Symbol("nodeRef"),sg=Symbol("edgeId"),ag=Symbol("edgeRef"),Do=Symbol("slots");function Za(t){const{vueFlowRef:e,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:r,nodeExtent:a,nodeDragThreshold:l,viewport:u,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:y,nodesSelectionActive:m,selectNodesOnDrag:b,removeSelectedElements:N,addSelectedNodes:_,updateNodePositions:g,emits:x}=we(),{onStart:A,onDrag:$,onStop:F,onClick:U,el:G,disabled:S,id:T,selectable:E,dragHandle:H}=t,w=s.shallowRef(!1);let D=[],v,C=null,k={x:void 0,y:void 0},O={x:0,y:0},R=null,B=!1,P=!1,L=0,j=!1;const Z=dg(),Q=({x:oe,y:ae})=>{k={x:oe,y:ae};let z=!1;if(D=D.map(M=>{const V={x:oe-M.distance.x,y:ae-M.distance.y},{computedPosition:X}=ir(M,n.value?ko(V,o.value):V,x.error,a.value,M.parentNode?p(M.parentNode):void 0);return z=z||M.position.x!==X.x||M.position.y!==X.y,M.position=X,M}),P=P||z,!!z&&(g(D,!0,!0),w.value=!0,R)){const[M,V]=or({id:T,dragItems:D,findNode:p});$({event:R,node:M,nodes:V})}},q=()=>{if(!C)return;const[oe,ae]=Ia(O,C,d.value);if(oe!==0||ae!==0){const z={x:(k.x??0)-oe/u.value.zoom,y:(k.y??0)-ae/u.value.zoom};h({x:oe,y:ae})&&Q(z)}L=requestAnimationFrame(q)},ee=(oe,ae)=>{B=!0;const z=p(T);!b.value&&!y.value&&z&&(z.selected||N()),z&&s.toValue(E)&&b.value&&lr(z,y.value,_,N,m,!1,ae);const M=Z(oe.sourceEvent);if(k=M,D=jp(r.value,f.value,M,T),D.length){const[V,X]=or({id:T,dragItems:D,findNode:p});A({event:oe.sourceEvent,node:V,nodes:X})}},re=(oe,ae)=>{var z;oe.sourceEvent.type==="touchmove"&&oe.sourceEvent.touches.length>1||(P=!1,l.value===0&&ee(oe,ae),k=Z(oe.sourceEvent),C=((z=e.value)==null?void 0:z.getBoundingClientRect())||null,O=lt(oe.sourceEvent,C))},ie=(oe,ae)=>{const z=Z(oe.sourceEvent);if(!j&&B&&c.value&&(j=!0,q()),!B){const M=z.xSnapped-(k.x??0),V=z.ySnapped-(k.y??0);Math.sqrt(M*M+V*V)>l.value&&ee(oe,ae)}(k.x!==z.xSnapped||k.y!==z.ySnapped)&&D.length&&B&&(R=oe.sourceEvent,O=lt(oe.sourceEvent,C),Q(z))},ce=oe=>{let ae=!1;if(!B&&!w.value&&!y.value){const z=oe.sourceEvent,M=Z(z),V=M.xSnapped-(k.x??0),X=M.ySnapped-(k.y??0),I=Math.sqrt(V*V+X*X);I!==0&&I<=l.value&&(U?.(z),ae=!0)}if(D.length&&!ae){P&&(g(D,!1,!1),P=!1);const[z,M]=or({id:T,dragItems:D,findNode:p});F({event:oe.sourceEvent,node:z,nodes:M})}D=[],w.value=!1,j=!1,B=!1,k={x:void 0,y:void 0},cancelAnimationFrame(L)};return s.watch([()=>s.toValue(S),G],([oe,ae],z,M)=>{if(ae){const V=Je(ae);oe||(v=$f().on("start",X=>re(X,ae)).on("drag",X=>ie(X,ae)).on("end",X=>ce(X)).filter(X=>{const I=X.target,Y=s.toValue(H);return!X.button&&(!i.value||!Pa(I,`.${i.value}`,ae)&&(!Y||Pa(I,Y,ae)))}),V.call(v)),M(()=>{V.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),w}function lg(){return{doubleClick:le(),click:le(),mouseEnter:le(),mouseMove:le(),mouseLeave:le(),contextMenu:le(),updateStart:le(),update:le(),updateEnd:le()}}function cg(t,e){const n=lg();return n.doubleClick.on(o=>{var i,r;e.edgeDoubleClick(o),(r=(i=t.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;e.edgeClick(o),(r=(i=t.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;e.edgeMouseEnter(o),(r=(i=t.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;e.edgeMouseMove(o),(r=(i=t.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;e.edgeMouseLeave(o),(r=(i=t.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;e.edgeContextMenu(o),(r=(i=t.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.updateStart.on(o=>{var i,r;e.edgeUpdateStart(o),(r=(i=t.events)==null?void 0:i.updateStart)==null||r.call(i,o)}),n.update.on(o=>{var i,r;e.edgeUpdate(o),(r=(i=t.events)==null?void 0:i.update)==null||r.call(i,o)}),n.updateEnd.on(o=>{var i,r;e.edgeUpdateEnd(o),(r=(i=t.events)==null?void 0:i.updateEnd)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function dg(){const{viewport:t,snapGrid:e,snapToGrid:n,vueFlowRef:o}=we();return i=>{var r;const a=((r=o.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},l=qp(i)?i.sourceEvent:i,{x:u,y:c}=lt(l,a),d=Bn({x:u,y:c},t.value),{x:f,y:h}=n.value?ko(d,e.value):d;return{xSnapped:f,ySnapped:h,...d}}}function To(){return!0}function Ja({handleId:t,nodeId:e,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:a}){const{id:l,vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:y,autoPanSpeed:m,findNode:b,panBy:N,startConnection:_,updateConnection:g,endConnection:x,emits:A,viewport:$,edges:F,nodes:U,isValidConnection:G,nodeLookup:S}=we();let T=null,E=!1,H=null;function w(v){var C;const k=s.toValue(n)==="target",O=rr(v),R=va(v.target),B=v.currentTarget;if(B&&(O&&v.button===0||!O)){let P=function(ne){z=lt(ne,ce),Q=eg(Bn(z,$.value,!1,[1,1]),d.value,S.value,X),M||(V(),M=!0);const te=Va(ne,{handle:Q,connectionMode:c.value,fromNodeId:s.toValue(e),fromHandleId:s.toValue(t),fromType:k?"target":"source",isValidConnection:Z,doc:R,lib:"vue",flowId:l,nodeLookup:S.value},F.value,U.value,b,S.value);H=te.handleDomNode,T=te.connection,E=ng(!!Q,te.isValid);const fe={...K,isValid:E,to:te.toHandle&&E?Mn({x:te.toHandle.x,y:te.toHandle.y},$.value):z,toHandle:te.toHandle,toPosition:E&&te.toHandle?te.toHandle.position:ar[X.position],toNode:te.toHandle?S.value.get(te.toHandle.nodeId):null};if(E&&Q&&K?.toHandle&&fe.toHandle&&K.toHandle.type===fe.toHandle.type&&K.toHandle.nodeId===fe.toHandle.nodeId&&K.toHandle.id===fe.toHandle.id&&K.to.x===fe.to.x&&K.to.y===fe.to.y)return;const ge=Q??te.toHandle;if(g(ge&&E?Mn({x:ge.x,y:ge.y},$.value):z,ge,tg(!!ge,E)),K=fe,!Q&&!E&&!H)return sr(ae);T&&T.source!==T.target&&H&&(sr(ae),ae=H,H.classList.add("connecting","vue-flow__handle-connecting"),H.classList.toggle("valid",!!E),H.classList.toggle("vue-flow__handle-valid",!!E))},L=function(ne){"touches"in ne&&ne.touches.length>0||((Q||H)&&T&&E&&(r?r(ne,T):A.connect(T)),A.connectEnd(ne),i&&a?.(ne),sr(ae),cancelAnimationFrame(q),x(ne),M=!1,E=!1,T=null,H=null,R.removeEventListener("mousemove",P),R.removeEventListener("mouseup",L),R.removeEventListener("touchmove",P),R.removeEventListener("touchend",L))};const j=b(s.toValue(e));let Z=s.toValue(o)||G.value||To;!Z&&j&&(Z=(k?j.isValidSourcePos:j.isValidTargetPos)||To);let Q,q=0;const{x:ee,y:re}=lt(v),ie=La(s.toValue(i),B),ce=(C=u.value)==null?void 0:C.getBoundingClientRect();if(!ce||!ie)return;const oe=Fa(s.toValue(e),ie,s.toValue(t),S.value,c.value);if(!oe)return;let ae,z=lt(v,ce),M=!1;const V=()=>{if(!y.value)return;const[ne,te]=Ia(z,ce,m.value);N({x:ne,y:te}),q=requestAnimationFrame(V)},X={...oe,nodeId:s.toValue(e),type:ie,position:oe.position},I=S.value.get(s.toValue(e)),W={inProgress:!0,isValid:null,from:nn(I,X,de.Left,!0),fromHandle:X,fromPosition:X.position,fromNode:I,to:z,toHandle:null,toPosition:ar[X.position],toNode:null};_({nodeId:s.toValue(e),id:s.toValue(t),type:ie,position:B?.getAttribute("data-handlepos")||de.Top,...z},{x:ee-ce.left,y:re-ce.top}),A.connectStart({event:v,nodeId:s.toValue(e),handleId:s.toValue(t),handleType:ie});let K=W;R.addEventListener("mousemove",P),R.addEventListener("mouseup",L),R.addEventListener("touchmove",P),R.addEventListener("touchend",L)}}function D(v){var C,k;if(!f.value)return;const O=s.toValue(n)==="target";if(!h.value){A.clickConnectStart({event:v,nodeId:s.toValue(e),handleId:s.toValue(t)}),_({nodeId:s.toValue(e),type:s.toValue(n),id:s.toValue(t),position:de.Top,...lt(v)},void 0,!0);return}let R=s.toValue(o)||G.value||To;const B=b(s.toValue(e));if(!R&&B&&(R=(O?B.isValidSourcePos:B.isValidTargetPos)||To),B&&(typeof B.connectable>"u"?p.value:B.connectable)===!1)return;const P=va(v.target),L=Va(v,{handle:{nodeId:s.toValue(e),id:s.toValue(t),type:s.toValue(n),position:de.Top,...lt(v)},connectionMode:c.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:R,doc:P,lib:"vue",flowId:l,nodeLookup:S.value},F.value,U.value,b,S.value),j=((C=L.connection)==null?void 0:C.source)===((k=L.connection)==null?void 0:k.target);L.isValid&&L.connection&&!j&&A.connect(L.connection),A.clickConnectEnd(v),x(v,!0)}return{handlePointerDown:w,handleClick:D}}function ug(){return s.inject(qa,"")}function Qa(t){const e=t??ug()??"",n=s.inject(Ka,s.ref(null)),{findNode:o,edges:i,emits:r}=we(),a=o(e);return a||r.error(new Be(Ne.NODE_NOT_FOUND,e)),{id:e,nodeEl:n,node:a,parentNode:s.computed(()=>o(a.parentNode)),connectedEdges:s.computed(()=>Sa([a],i.value))}}function fg(){return{doubleClick:le(),click:le(),mouseEnter:le(),mouseMove:le(),mouseLeave:le(),contextMenu:le(),dragStart:le(),drag:le(),dragStop:le()}}function hg(t,e){const n=fg();return n.doubleClick.on(o=>{var i,r;e.nodeDoubleClick(o),(r=(i=t.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;e.nodeClick(o),(r=(i=t.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;e.nodeMouseEnter(o),(r=(i=t.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;e.nodeMouseMove(o),(r=(i=t.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;e.nodeMouseLeave(o),(r=(i=t.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;e.nodeContextMenu(o),(r=(i=t.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.dragStart.on(o=>{var i,r;e.nodeDragStart(o),(r=(i=t.events)==null?void 0:i.dragStart)==null||r.call(i,o)}),n.drag.on(o=>{var i,r;e.nodeDrag(o),(r=(i=t.events)==null?void 0:i.drag)==null||r.call(i,o)}),n.dragStop.on(o=>{var i,r;e.nodeDragStop(o),(r=(i=t.events)==null?void 0:i.dragStop)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function el(){const{getSelectedNodes:t,nodeExtent:e,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:a,emits:l}=we();return(u,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=c?4:1,p=u.x*d*h,y=u.y*f*h,m=[];for(const b of t.value)if(b.draggable||a&&typeof b.draggable>"u"){const N={x:b.computedPosition.x+p,y:b.computedPosition.y+y},{position:_}=ir(b,N,l.error,e.value,b.parentNode?o(b.parentNode):void 0);m.push({id:b.id,position:_,from:b.position,distance:{x:u.x,y:u.y},dimensions:b.dimensions})}n(m,!0,!1)}}const Io=.1,pg=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2;function Dt(){return zn("Viewport not initialized yet."),Promise.resolve(!1)}const gg={zoomIn:Dt,zoomOut:Dt,zoomTo:Dt,fitView:Dt,setCenter:Dt,fitBounds:Dt,project:t=>t,screenToFlowCoordinate:t=>t,flowToScreenCoordinate:t=>t,setViewport:Dt,setTransform:Dt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function mg(t){function e(o,i){return new Promise(r=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(i?.interpolate==="linear"?xn:fo).scaleBy(ur(t.d3Selection,i?.duration,i?.ease,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,a){return new Promise(l=>{var u;const{x:c,y:d}=ya({x:-o,y:-i},t.translateExtent),f=Qt.translate(-c,-d).scale(r);t.d3Selection&&t.d3Zoom?(u=t.d3Zoom)==null||u.interpolate(a?.interpolate==="linear"?xn:fo).transform(ur(t.d3Selection,a?.duration,a?.ease,()=>{l(!0)}),f):l(!1)})}return s.computed(()=>t.d3Zoom&&t.d3Selection&&t.dimensions.width&&t.dimensions.height?{viewportInitialized:!0,zoomIn:i=>e(1.2,i),zoomOut:i=>e(1/1.2,i),zoomTo:(i,r)=>new Promise(a=>{t.d3Selection&&t.d3Zoom?t.d3Zoom.interpolate(r?.interpolate==="linear"?xn:fo).scaleTo(ur(t.d3Selection,r?.duration,r?.ease,()=>{a(!0)}),i):a(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r),getViewport:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),getTransform:()=>({x:t.viewport.x,y:t.viewport.y,zoom:t.viewport.zoom}),fitView:(i={padding:Io,includeHiddenNodes:!1,duration:0})=>{var r,a;const l=[];for(const h of t.nodes)h.dimensions.width&&h.dimensions.height&&(i?.includeHiddenNodes||!h.hidden)&&(!((r=i.nodes)!=null&&r.length)||(a=i.nodes)!=null&&a.length&&i.nodes.includes(h.id))&&l.push(h);if(!l.length)return Promise.resolve(!1);const u=Ca(l),{x:c,y:d,zoom:f}=Na(u,t.dimensions.width,t.dimensions.height,i.minZoom??t.minZoom,i.maxZoom??t.maxZoom,i.padding??Io);return n(c,d,f,i)},setCenter:(i,r,a)=>{const l=typeof a?.zoom<"u"?a.zoom:t.maxZoom,u=t.dimensions.width/2-i*l,c=t.dimensions.height/2-r*l;return n(u,c,l,a)},fitBounds:(i,r={padding:Io})=>{const{x:a,y:l,zoom:u}=Na(i,t.dimensions.width,t.dimensions.height,t.minZoom,t.maxZoom,r.padding??Io);return n(a,l,u,r)},project:i=>Bn(i,t.viewport,t.snapToGrid,t.snapGrid),screenToFlowCoordinate:i=>{if(t.vueFlowRef){const{x:r,y:a}=t.vueFlowRef.getBoundingClientRect(),l={x:i.x-r,y:i.y-a};return Bn(l,t.viewport,t.snapToGrid,t.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(t.vueFlowRef){const{x:r,y:a}=t.vueFlowRef.getBoundingClientRect(),l={x:i.x+r,y:i.y+a};return Mn(l,t.viewport)}return{x:0,y:0}}}:gg)}function ur(t,e=0,n=pg,o=()=>{}){const i=typeof e=="number"&&e>0;return i||o(),i?t.transition().duration(e).ease(n).on("end",o):t}function yg(t,e,n){const o=s.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let m,b,N=!!(n.nodes.value.length||n.edges.value.length);m=Xt([t.modelValue,()=>{var _,g;return(g=(_=t.modelValue)==null?void 0:_.value)==null?void 0:g.length}],([_])=>{_&&Array.isArray(_)&&(b?.pause(),n.setElements(_),!b&&!N&&_.length?N=!0:b?.resume())}),b=Xt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([_,g])=>{var x;(x=t.modelValue)!=null&&x.value&&Array.isArray(t.modelValue.value)&&(m?.pause(),t.modelValue.value=[..._,...g],s.nextTick(()=>{m?.resume()}))},{immediate:N}),s.onScopeDispose(()=>{m?.stop(),b?.stop()})})},r=()=>{o.run(()=>{let m,b,N=!!n.nodes.value.length;m=Xt([t.nodes,()=>{var _,g;return(g=(_=t.nodes)==null?void 0:_.value)==null?void 0:g.length}],([_])=>{_&&Array.isArray(_)&&(b?.pause(),n.setNodes(_),!b&&!N&&_.length?N=!0:b?.resume())}),b=Xt([n.nodes,()=>n.nodes.value.length],([_])=>{var g;(g=t.nodes)!=null&&g.value&&Array.isArray(t.nodes.value)&&(m?.pause(),t.nodes.value=[..._],s.nextTick(()=>{m?.resume()}))},{immediate:N}),s.onScopeDispose(()=>{m?.stop(),b?.stop()})})},a=()=>{o.run(()=>{let m,b,N=!!n.edges.value.length;m=Xt([t.edges,()=>{var _,g;return(g=(_=t.edges)==null?void 0:_.value)==null?void 0:g.length}],([_])=>{_&&Array.isArray(_)&&(b?.pause(),n.setEdges(_),!b&&!N&&_.length?N=!0:b?.resume())}),b=Xt([n.edges,()=>n.edges.value.length],([_])=>{var g;(g=t.edges)!=null&&g.value&&Array.isArray(t.edges.value)&&(m?.pause(),t.edges.value=[..._],s.nextTick(()=>{m?.resume()}))},{immediate:N}),s.onScopeDispose(()=>{m?.stop(),b?.stop()})})},l=()=>{o.run(()=>{s.watch(()=>e.maxZoom,()=>{e.maxZoom&&ke(e.maxZoom)&&n.setMaxZoom(e.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{s.watch(()=>e.minZoom,()=>{e.minZoom&&ke(e.minZoom)&&n.setMinZoom(e.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{s.watch(()=>e.translateExtent,()=>{e.translateExtent&&ke(e.translateExtent)&&n.setTranslateExtent(e.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{s.watch(()=>e.nodeExtent,()=>{e.nodeExtent&&ke(e.nodeExtent)&&n.setNodeExtent(e.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{s.watch(()=>e.applyDefault,()=>{ke(e.applyDefault)&&(n.applyDefault.value=e.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const m=async b=>{let N=b;typeof e.autoConnect=="function"&&(N=await e.autoConnect(b)),N!==!1&&n.addEdges([N])};s.watch(()=>e.autoConnect,()=>{ke(e.autoConnect)&&(n.autoConnect.value=e.autoConnect)},{immediate:!0}),s.watch(n.autoConnect,(b,N,_)=>{b?n.onConnect(m):n.hooks.value.connect.off(m),_(()=>{n.hooks.value.connect.off(m)})},{immediate:!0})})},p=()=>{const m=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const b of Object.keys(e)){const N=b;if(!m.includes(N)){const _=s.toRef(()=>e[N]),g=n[N];s.isRef(g)&&o.run(()=>{s.watch(_,x=>{ke(x)&&(g.value=x)},{immediate:!0})})}}};i(),r(),a(),u(),l(),c(),d(),f(),h(),p()}),()=>o.stop()}function vg(){return{edgesChange:le(),nodesChange:le(),nodeDoubleClick:le(),nodeClick:le(),nodeMouseEnter:le(),nodeMouseMove:le(),nodeMouseLeave:le(),nodeContextMenu:le(),nodeDragStart:le(),nodeDrag:le(),nodeDragStop:le(),nodesInitialized:le(),miniMapNodeClick:le(),miniMapNodeDoubleClick:le(),miniMapNodeMouseEnter:le(),miniMapNodeMouseMove:le(),miniMapNodeMouseLeave:le(),connect:le(),connectStart:le(),connectEnd:le(),clickConnectStart:le(),clickConnectEnd:le(),paneReady:le(),init:le(),move:le(),moveStart:le(),moveEnd:le(),selectionDragStart:le(),selectionDrag:le(),selectionDragStop:le(),selectionContextMenu:le(),selectionStart:le(),selectionEnd:le(),viewportChangeStart:le(),viewportChange:le(),viewportChangeEnd:le(),paneScroll:le(),paneClick:le(),paneContextMenu:le(),paneMouseEnter:le(),paneMouseMove:le(),paneMouseLeave:le(),edgeContextMenu:le(),edgeMouseEnter:le(),edgeMouseMove:le(),edgeMouseLeave:le(),edgeDoubleClick:le(),edgeClick:le(),edgeUpdateStart:le(),edgeUpdate:le(),edgeUpdateEnd:le(),updateNodeInternals:le(),error:le(t=>zn(t.message))}}function bg(t,e){const n=s.getCurrentInstance();s.onBeforeMount(()=>{for(const[i,r]of Object.entries(e.value)){const a=l=>{t(i,l)};r.setEmitter(a),mn(r.removeEmitter),r.setHasEmitListeners(()=>o(i)),mn(r.removeHasEmitListeners)}});function o(i){var r;const a=wg(i);return!!((r=n?.vnode.props)==null?void 0:r[a])}}function wg(t){const[e,...n]=t.split(":");return`on${e.replace(/(?:^|-)(\w)/g,(i,r)=>r.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function tl(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:er.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Dn.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Rt.Bezier,style:{}},connectionMode:gt.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:No()?"Meta":"Control",zoomActivationKeyCode:No()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:vg(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const _g=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function xg(t,e,n){const o=mg(t),i=z=>{const M=z??[];t.hooks.updateNodeInternals.trigger(M)},r=z=>Pp(z,t.nodes,t.edges),a=z=>Ap(z,t.nodes,t.edges),l=z=>Sa(z,t.edges),u=({id:z,type:M,nodeId:V})=>{var X;const I=z?`-${M}-${z}`:`-${M}`;return Array.from(((X=t.connectionLookup.get(`${V}${I}`))==null?void 0:X.values())??[])},c=z=>{if(z)return e.value.get(z)},d=z=>{if(z)return n.value.get(z)},f=(z,M,V)=>{var X,I;const Y=[];for(const W of z){const K={id:W.id,type:"position",dragging:V,from:W.from};if(M&&(K.position=W.position,W.parentNode)){const ne=c(W.parentNode);K.position={x:K.position.x-(((X=ne?.computedPosition)==null?void 0:X.x)??0),y:K.position.y-(((I=ne?.computedPosition)==null?void 0:I.y)??0)}}Y.push(K)}Y?.length&&t.hooks.nodesChange.trigger(Y)},h=z=>{if(!t.vueFlowRef)return;const M=t.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!M)return;const V=window.getComputedStyle(M),{m22:X}=new window.DOMMatrixReadOnly(V.transform),I=[];for(const Y of z){const W=Y,K=c(W.id);if(K){const ne=Eo(W.nodeElement);if(!!(ne.width&&ne.height&&(K.dimensions.width!==ne.width||K.dimensions.height!==ne.height||W.forceUpdate))){const fe=W.nodeElement.getBoundingClientRect();K.dimensions=ne,K.handleBounds.source=Ga("source",W.nodeElement,fe,X,K.id),K.handleBounds.target=Ga("target",W.nodeElement,fe,X,K.id),I.push({id:K.id,type:"dimensions",dimensions:ne})}}}!t.fitViewOnInitDone&&t.fitViewOnInit&&o.value.fitView().then(()=>{t.fitViewOnInitDone=!0}),I.length&&t.hooks.nodesChange.trigger(I)},p=(z,M)=>{const V=new Set,X=new Set;for(const W of z)Vt(W)?V.add(W.id):St(W)&&X.add(W.id);const I=kt(e.value,V,!0),Y=kt(n.value,X);if(t.multiSelectionActive){for(const W of V)I.push(Nt(W,M));for(const W of X)Y.push(Nt(W,M))}I.length&&t.hooks.nodesChange.trigger(I),Y.length&&t.hooks.edgesChange.trigger(Y)},y=z=>{if(t.multiSelectionActive){const M=z.map(V=>Nt(V.id,!0));t.hooks.nodesChange.trigger(M);return}t.hooks.nodesChange.trigger(kt(e.value,new Set(z.map(M=>M.id)),!0)),t.hooks.edgesChange.trigger(kt(n.value))},m=z=>{if(t.multiSelectionActive){const M=z.map(V=>Nt(V.id,!0));t.hooks.edgesChange.trigger(M);return}t.hooks.edgesChange.trigger(kt(n.value,new Set(z.map(M=>M.id)))),t.hooks.nodesChange.trigger(kt(e.value,new Set,!0))},b=z=>{p(z,!0)},N=z=>{const V=(z||t.nodes).map(X=>(X.selected=!1,Nt(X.id,!1)));t.hooks.nodesChange.trigger(V)},_=z=>{const V=(z||t.edges).map(X=>(X.selected=!1,Nt(X.id,!1)));t.hooks.edgesChange.trigger(V)},g=z=>{if(!z||!z.length)return p([],!1);const M=z.reduce((V,X)=>{const I=Nt(X.id,!1);return Vt(X)?V.nodes.push(I):V.edges.push(I),V},{nodes:[],edges:[]});M.nodes.length&&t.hooks.nodesChange.trigger(M.nodes),M.edges.length&&t.hooks.edgesChange.trigger(M.edges)},x=z=>{var M;(M=t.d3Zoom)==null||M.scaleExtent([z,t.maxZoom]),t.minZoom=z},A=z=>{var M;(M=t.d3Zoom)==null||M.scaleExtent([t.minZoom,z]),t.maxZoom=z},$=z=>{var M;(M=t.d3Zoom)==null||M.translateExtent(z),t.translateExtent=z},F=z=>{t.nodeExtent=z,i()},U=z=>{var M;(M=t.d3Zoom)==null||M.clickDistance(z)},G=z=>{t.nodesDraggable=z,t.nodesConnectable=z,t.elementsSelectable=z},S=z=>{const M=z instanceof Function?z(t.nodes):z;!t.initialized&&!M.length||(t.nodes=Wa(M,c,t.hooks.error.trigger))},T=z=>{const M=z instanceof Function?z(t.edges):z;if(!t.initialized&&!M.length)return;const V=dr(M,t.isValidConnection,c,d,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);cr(t.connectionLookup,n.value,V),t.edges=V},E=z=>{const M=z instanceof Function?z([...t.nodes,...t.edges]):z;!t.initialized&&!M.length||(S(M.filter(Vt)),T(M.filter(St)))},H=z=>{let M=z instanceof Function?z(t.nodes):z;M=Array.isArray(M)?M:[M];const V=Wa(M,c,t.hooks.error.trigger),X=[];for(const I of V)X.push(Ba(I));X.length&&t.hooks.nodesChange.trigger(X)},w=z=>{let M=z instanceof Function?z(t.edges):z;M=Array.isArray(M)?M:[M];const V=dr(M,t.isValidConnection,c,d,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges),X=[];for(const I of V)X.push(Ba(I));X.length&&t.hooks.edgesChange.trigger(X)},D=(z,M=!0,V=!1)=>{const X=z instanceof Function?z(t.nodes):z,I=Array.isArray(X)?X:[X],Y=[],W=[];function K(te){const fe=l(te);for(const ge of fe)(!ke(ge.deletable)||ge.deletable)&&W.push(za(ge.id,ge.source,ge.target,ge.sourceHandle,ge.targetHandle))}function ne(te){const fe=[];for(const ge of t.nodes)ge.parentNode===te&&fe.push(ge);if(fe.length){for(const ge of fe)Y.push($a(ge.id));M&&K(fe);for(const ge of fe)ne(ge.id)}}for(const te of I){const fe=typeof te=="string"?c(te):te;fe&&(ke(fe.deletable)&&!fe.deletable||(Y.push($a(fe.id)),M&&K([fe]),V&&ne(fe.id)))}W.length&&t.hooks.edgesChange.trigger(W),Y.length&&t.hooks.nodesChange.trigger(Y)},v=z=>{const M=z instanceof Function?z(t.edges):z,V=Array.isArray(M)?M:[M],X=[];for(const I of V){const Y=typeof I=="string"?d(I):I;Y&&(ke(Y.deletable)&&!Y.deletable||X.push(za(typeof I=="string"?I:I.id,Y.source,Y.target,Y.sourceHandle,Y.targetHandle)))}t.hooks.edgesChange.trigger(X)},C=(z,M,V=!0)=>{const X=d(z.id);if(!X)return!1;const I=t.edges.indexOf(X),Y=rg(z,M,X,V,t.hooks.error.trigger);if(Y){const[W]=dr([Y],t.isValidConnection,c,d,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);return t.edges=t.edges.map((K,ne)=>ne===I?W:K),cr(t.connectionLookup,n.value,[W]),W}return!1},k=(z,M,V={replace:!1})=>{const X=d(z);if(!X)return;const I=typeof M=="function"?M(X):M;X.data=V.replace?I:{...X.data,...I}},O=z=>Ma(z,t.nodes),R=z=>{const M=Ma(z,t.edges);return cr(t.connectionLookup,n.value,M),M},B=(z,M,V={replace:!1})=>{const X=c(z);if(!X)return;const I=typeof M=="function"?M(X):M;V.replace?t.nodes.splice(t.nodes.indexOf(X),1,I):Object.assign(X,I)},P=(z,M,V={replace:!1})=>{const X=c(z);if(!X)return;const I=typeof M=="function"?M(X):M;X.data=V.replace?I:{...X.data,...I}},L=(z,M,V=!1)=>{V?t.connectionClickStartHandle=z:t.connectionStartHandle=z,t.connectionEndHandle=null,t.connectionStatus=null,M&&(t.connectionPosition=M)},j=(z,M=null,V=null)=>{t.connectionStartHandle&&(t.connectionPosition=z,t.connectionEndHandle=M,t.connectionStatus=V)},Z=(z,M)=>{t.connectionPosition={x:Number.NaN,y:Number.NaN},t.connectionEndHandle=null,t.connectionStatus=null,M?t.connectionClickStartHandle=null:t.connectionStartHandle=null},Q=z=>{const M=$p(z),V=M?null:In(z)?z:c(z.id);return!M&&!V?[null,null,M]:[M?z:xo(V),V,M]},q=(z,M=!0,V=t.nodes)=>{const[X,I,Y]=Q(z);if(!X)return[];const W=[];for(const K of V||t.nodes){if(!Y&&(K.id===I.id||!K.computedPosition))continue;const ne=xo(K),te=Co(ne,X);(M&&te>0||te>=ne.width*ne.height||te>=Number(X.width)*Number(X.height))&&W.push(K)}return W},ee=(z,M,V=!0)=>{const[X]=Q(z);if(!X)return!1;const I=Co(X,M);return V&&I>0||I>=Number(X.width)*Number(X.height)},re=z=>{const{viewport:M,dimensions:V,d3Zoom:X,d3Selection:I,translateExtent:Y}=t;if(!X||!I||!z.x&&!z.y)return!1;const W=Qt.translate(M.x+z.x,M.y+z.y).scale(M.zoom),K=[[0,0],[V.width,V.height]],ne=X.constrain()(W,K,Y),te=t.viewport.x!==ne.x||t.viewport.y!==ne.y||t.viewport.zoom!==ne.k;return X.transform(I,ne),te},ie=z=>{const M=z instanceof Function?z(t):z,V=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];ke(M.defaultEdgeOptions)&&(t.defaultEdgeOptions=M.defaultEdgeOptions);const X=M.modelValue||M.nodes||M.edges?[]:void 0;X&&(M.modelValue&&X.push(...M.modelValue),M.nodes&&X.push(...M.nodes),M.edges&&X.push(...M.edges),E(X));const I=()=>{ke(M.maxZoom)&&A(M.maxZoom),ke(M.minZoom)&&x(M.minZoom),ke(M.translateExtent)&&$(M.translateExtent)};for(const Y of Object.keys(M)){const W=Y,K=M[W];![..._g,...V].includes(W)&&ke(K)&&(t[W]=K)}$i(()=>t.d3Zoom).not.toBeNull().then(I),t.initialized||(t.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:E,setNodes:S,setEdges:T,addNodes:H,addEdges:w,removeNodes:D,removeEdges:v,findNode:c,findEdge:d,updateEdge:C,updateEdgeData:k,updateNode:B,updateNodeData:P,applyEdgeChanges:R,applyNodeChanges:O,addSelectedElements:b,addSelectedNodes:y,addSelectedEdges:m,setMinZoom:x,setMaxZoom:A,setTranslateExtent:$,setNodeExtent:F,setPaneClickDistance:U,removeSelectedElements:g,removeSelectedNodes:N,removeSelectedEdges:_,startConnection:L,updateConnection:j,endConnection:Z,setInteractive:G,setState:ie,getIntersectingNodes:q,getIncomers:r,getOutgoers:a,getConnectedEdges:l,getHandleConnections:u,isNodeIntersecting:ee,panBy:re,fitView:z=>o.value.fitView(z),zoomIn:z=>o.value.zoomIn(z),zoomOut:z=>o.value.zoomOut(z),zoomTo:(z,M)=>o.value.zoomTo(z,M),setViewport:(z,M)=>o.value.setViewport(z,M),setTransform:(z,M)=>o.value.setTransform(z,M),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(z,M,V)=>o.value.setCenter(z,M,V),fitBounds:(z,M)=>o.value.fitBounds(z,M),project:z=>o.value.project(z),screenToFlowCoordinate:z=>o.value.screenToFlowCoordinate(z),flowToScreenCoordinate:z=>o.value.flowToScreenCoordinate(z),toObject:()=>{const z=[],M=[];for(const V of t.nodes){const{computedPosition:X,handleBounds:I,selected:Y,dimensions:W,isParent:K,resizing:ne,dragging:te,events:fe,...ge}=V;z.push(ge)}for(const V of t.edges){const{selected:X,sourceNode:I,targetNode:Y,events:W,...K}=V;M.push(K)}return JSON.parse(JSON.stringify({nodes:z,edges:M,position:[t.viewport.x,t.viewport.y],zoom:t.viewport.zoom,viewport:t.viewport}))},fromObject:z=>new Promise(M=>{const{nodes:V,edges:X,position:I,zoom:Y,viewport:W}=z;V&&S(V),X&&T(X);const[K,ne]=W?.x&&W?.y?[W.x,W.y]:I??[null,null];if(K&&ne){const te=W?.zoom||Y||t.viewport.zoom;return $i(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:K,y:ne,zoom:te}).then(()=>{M(!0)})})}else M(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const z=tl();if(t.edges=[],t.nodes=[],t.d3Zoom&&t.d3Selection){const M=Qt.translate(z.defaultViewport.x??0,z.defaultViewport.y??0).scale(Ht(z.defaultViewport.zoom??1,z.minZoom,z.maxZoom)),V=t.viewportRef.getBoundingClientRect(),X=[[0,0],[V.width,V.height]],I=t.d3Zoom.constrain()(M,X,z.translateExtent);t.d3Zoom.transform(t.d3Selection,I)}ie(z)},$destroy:()=>{}}}const Cg=["data-id","data-handleid","data-nodeid","data-handlepos"],Eg={name:"Handle",compatConfig:{MODE:3}},on=s.defineComponent({...Eg,props:{id:{default:null},type:{},position:{default:()=>de.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(t,{expose:e}){const n=s.createPropsRestProxy(t,["position","connectable","connectableStart","connectableEnd","id"]),o=s.toRef(()=>n.type??"source"),i=s.toRef(()=>n.isValidConnection??null),{id:r,connectionStartHandle:a,connectionClickStartHandle:l,connectionEndHandle:u,vueFlowRef:c,nodesConnectable:d,noDragClassName:f,noPanClassName:h}=we(),{id:p,node:y,nodeEl:m,connectedEdges:b}=Qa(),N=s.ref(),_=s.toRef(()=>typeof t.connectableStart<"u"?t.connectableStart:!0),g=s.toRef(()=>typeof t.connectableEnd<"u"?t.connectableEnd:!0),x=s.toRef(()=>{var T,E,H,w,D,v;return((T=a.value)==null?void 0:T.nodeId)===p&&((E=a.value)==null?void 0:E.id)===t.id&&((H=a.value)==null?void 0:H.type)===o.value||((w=u.value)==null?void 0:w.nodeId)===p&&((D=u.value)==null?void 0:D.id)===t.id&&((v=u.value)==null?void 0:v.type)===o.value}),A=s.toRef(()=>{var T,E,H;return((T=l.value)==null?void 0:T.nodeId)===p&&((E=l.value)==null?void 0:E.id)===t.id&&((H=l.value)==null?void 0:H.type)===o.value}),{handlePointerDown:$,handleClick:F}=Ja({nodeId:p,handleId:t.id,isValidConnection:i,type:o}),U=s.computed(()=>typeof t.connectable=="string"&&t.connectable==="single"?!b.value.some(T=>{const E=T[`${o.value}Handle`];return T[o.value]!==p?!1:E?E===t.id:!0}):typeof t.connectable=="number"?b.value.filter(T=>{const E=T[`${o.value}Handle`];return T[o.value]!==p?!1:E?E===t.id:!0}).length<t.connectable:typeof t.connectable=="function"?t.connectable(y,b.value):ke(t.connectable)?t.connectable:d.value);s.onMounted(()=>{var T;if(!y.dimensions.width||!y.dimensions.height)return;const E=(T=y.handleBounds[o.value])==null?void 0:T.find(O=>O.id===t.id);if(!c.value||E)return;const H=c.value.querySelector(".vue-flow__transformationpane");if(!m.value||!N.value||!H||!t.id)return;const w=m.value.getBoundingClientRect(),D=N.value.getBoundingClientRect(),v=window.getComputedStyle(H),{m22:C}=new window.DOMMatrixReadOnly(v.transform),k={id:t.id,position:t.position,x:(D.left-w.left)/C,y:(D.top-w.top)/C,type:o.value,nodeId:p,...Eo(N.value)};y.handleBounds[o.value]=[...y.handleBounds[o.value]??[],k]});function G(T){const E=rr(T);U.value&&_.value&&(E&&T.button===0||!E)&&$(T)}function S(T){!p||!l.value&&!_.value||U.value&&F(T)}return e({handleClick:F,handlePointerDown:$,onClick:S,onPointerDown:G}),(T,E)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"handle",ref:N,"data-id":`${s.unref(r)}-${s.unref(p)}-${t.id}-${o.value}`,"data-handleid":t.id,"data-nodeid":s.unref(p),"data-handlepos":T.position,class:s.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${T.position}`,`vue-flow__handle-${t.id}`,s.unref(f),s.unref(h),o.value,{connectable:U.value,connecting:A.value,connectablestart:_.value,connectableend:g.value,connectionindicator:U.value&&(_.value&&!x.value||g.value&&x.value)}]]),onMousedown:G,onTouchstartPassive:G,onClick:S},[s.renderSlot(T.$slots,"default",{id:T.id})],42,Cg))}}),Mo=function({sourcePosition:t=de.Bottom,targetPosition:e=de.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:a}){const l=a.label??n;return[s.h(on,{type:"target",position:e,connectable:o,isValidConnection:i}),typeof l!="string"&&l?s.h(l):s.h(s.Fragment,[l]),s.h(on,{type:"source",position:t,connectable:o,isValidConnection:r})]};Mo.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Mo.inheritAttrs=!1,Mo.compatConfig={MODE:3};const Sg=Mo,Bo=function({targetPosition:t=de.Top,label:e,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??e;return[s.h(on,{type:"target",position:t,connectable:n,isValidConnection:o}),typeof r!="string"&&r?s.h(r):s.h(s.Fragment,[r])]};Bo.props=["targetPosition","label","isValidTargetPos","connectable","data"],Bo.inheritAttrs=!1,Bo.compatConfig={MODE:3};const Ng=Bo,$o=function({sourcePosition:t=de.Bottom,label:e,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??e;return[typeof r!="string"&&r?s.h(r):s.h(s.Fragment,[r]),s.h(on,{type:"source",position:t,connectable:n,isValidConnection:o})]};$o.props=["sourcePosition","label","isValidSourcePos","connectable","data"],$o.inheritAttrs=!1,$o.compatConfig={MODE:3};const kg=$o,Dg=["transform"],Tg=["width","height","x","y","rx","ry"],Ig=["y"],Mg={name:"EdgeText",compatConfig:{MODE:3}},Bg=s.defineComponent({...Mg,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(t){const e=s.ref({x:0,y:0,width:0,height:0}),n=s.ref(null),o=s.computed(()=>`translate(${t.x-e.value.width/2} ${t.y-e.value.height/2})`);s.onMounted(i),s.watch([()=>t.x,()=>t.y,n,()=>t.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==e.value.width||r.height!==e.value.height)&&(e.value=r)}return(r,a)=>(s.openBlock(),s.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(s.openBlock(),s.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${e.value.width+2*r.labelBgPadding[0]}px`,height:`${e.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:s.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Tg)):s.createCommentVNode("",!0),s.createElementVNode("text",s.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:e.value.height/2,dy:"0.3em",style:r.labelStyle}),[s.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(r.label),{key:0})):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createTextVNode(s.toDisplayString(r.label),1)],64))])],16,Ig)],8,Dg))}}),$g=["id","d","marker-end","marker-start"],zg=["d","stroke-width"],Ag={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},An=s.defineComponent({...Ag,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(t,{expose:e}){const n=s.ref(null),o=s.ref(null),i=s.ref(null),r=s.useAttrs();return e({pathEl:n,interactionEl:o,labelEl:i}),(a,l)=>(s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createElementVNode("path",s.mergeProps(s.unref(r),{id:a.id,ref_key:"pathEl",ref:n,d:a.path,class:"vue-flow__edge-path","marker-end":a.markerEnd,"marker-start":a.markerStart}),null,16,$g),a.interactionWidth?(s.openBlock(),s.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:a.path,"stroke-width":a.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,zg)):s.createCommentVNode("",!0),a.label&&a.labelX&&a.labelY?(s.openBlock(),s.createBlock(Bg,{key:1,ref_key:"labelEl",ref:i,x:a.labelX,y:a.labelY,label:a.label,"label-show-bg":a.labelShowBg,"label-bg-style":a.labelBgStyle,"label-bg-padding":a.labelBgPadding,"label-bg-border-radius":a.labelBgBorderRadius,"label-style":a.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):s.createCommentVNode("",!0)],64))}});function nl({sourceX:t,sourceY:e,targetX:n,targetY:o}){const i=Math.abs(n-t)/2,r=n<t?n+i:n-i,a=Math.abs(o-e)/2,l=o<e?o+a:o-a;return[r,l,i,a]}function ol({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:l}){const u=t*.125+i*.375+a*.375+n*.125,c=e*.125+r*.375+l*.375+o*.125,d=Math.abs(u-t),f=Math.abs(c-e);return[u,c,d,f]}function zo(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function il({pos:t,x1:e,y1:n,x2:o,y2:i,c:r}){let a,l;switch(t){case de.Left:a=e-zo(e-o,r),l=n;break;case de.Right:a=e+zo(o-e,r),l=n;break;case de.Top:a=e,l=n-zo(n-i,r);break;case de.Bottom:a=e,l=n+zo(i-n,r);break}return[a,l]}function fr(t){const{sourceX:e,sourceY:n,sourcePosition:o=de.Bottom,targetX:i,targetY:r,targetPosition:a=de.Top,curvature:l=.25}=t,[u,c]=il({pos:o,x1:e,y1:n,x2:i,y2:r,c:l}),[d,f]=il({pos:a,x1:i,y1:r,x2:e,y2:n,c:l}),[h,p,y,m]=ol({sourceX:e,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${n} C${u},${c} ${d},${f} ${i},${r}`,h,p,y,m]}function rl({pos:t,x1:e,y1:n,x2:o,y2:i}){let r,a;switch(t){case de.Left:case de.Right:r=.5*(e+o),a=n;break;case de.Top:case de.Bottom:r=e,a=.5*(n+i);break}return[r,a]}function sl(t){const{sourceX:e,sourceY:n,sourcePosition:o=de.Bottom,targetX:i,targetY:r,targetPosition:a=de.Top}=t,[l,u]=rl({pos:o,x1:e,y1:n,x2:i,y2:r}),[c,d]=rl({pos:a,x1:i,y1:r,x2:e,y2:n}),[f,h,p,y]=ol({sourceX:e,sourceY:n,targetX:i,targetY:r,sourceControlX:l,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${e},${n} C${l},${u} ${c},${d} ${i},${r}`,f,h,p,y]}const al={[de.Left]:{x:-1,y:0},[de.Right]:{x:1,y:0},[de.Top]:{x:0,y:-1},[de.Bottom]:{x:0,y:1}};function Pg({source:t,sourcePosition:e=de.Bottom,target:n}){return e===de.Left||e===de.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1}}function ll(t,e){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Og({source:t,sourcePosition:e=de.Bottom,target:n,targetPosition:o=de.Top,center:i,offset:r}){const a=al[e],l=al[o],u={x:t.x+a.x*r,y:t.y+a.y*r},c={x:n.x+l.x*r,y:n.y+l.y*r},d=Pg({source:u,sourcePosition:e,target:c}),f=d.x!==0?"x":"y",h=d[f];let p,y,m;const b={x:0,y:0},N={x:0,y:0},[_,g,x,A]=nl({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){y=i.x??_,m=i.y??g;const F=[{x:y,y:u.y},{x:y,y:c.y}],U=[{x:u.x,y:m},{x:c.x,y:m}];a[f]===h?p=f==="x"?F:U:p=f==="x"?U:F}else{const F=[{x:u.x,y:c.y}],U=[{x:c.x,y:u.y}];if(f==="x"?p=a.x===h?U:F:p=a.y===h?F:U,e===o){const H=Math.abs(t[f]-n[f]);if(H<=r){const w=Math.min(r-1,r-H);a[f]===h?b[f]=(u[f]>t[f]?-1:1)*w:N[f]=(c[f]>n[f]?-1:1)*w}}if(e!==o){const H=f==="x"?"y":"x",w=a[f]===l[H],D=u[H]>c[H],v=u[H]<c[H];(a[f]===1&&(!w&&D||w&&v)||a[f]!==1&&(!w&&v||w&&D))&&(p=f==="x"?F:U)}const G={x:u.x+b.x,y:u.y+b.y},S={x:c.x+N.x,y:c.y+N.y},T=Math.max(Math.abs(G.x-p[0].x),Math.abs(S.x-p[0].x)),E=Math.max(Math.abs(G.y-p[0].y),Math.abs(S.y-p[0].y));T>=E?(y=(G.x+S.x)/2,m=p[0].y):(y=p[0].x,m=(G.y+S.y)/2)}return[[t,{x:u.x+b.x,y:u.y+b.y},...p,{x:c.x+N.x,y:c.y+N.y},n],y,m,x,A]}function Rg(t,e,n,o){const i=Math.min(ll(t,e)/2,ll(e,n)/2,o),{x:r,y:a}=e;if(t.x===r&&r===n.x||t.y===a&&a===n.y)return`L${r} ${a}`;if(t.y===a){const c=t.x<n.x?-1:1,d=t.y<n.y?1:-1;return`L ${r+i*c},${a}Q ${r},${a} ${r},${a+i*d}`}const l=t.x<n.x?1:-1,u=t.y<n.y?-1:1;return`L ${r},${a+i*u}Q ${r},${a} ${r+i*l},${a}`}function hr(t){const{sourceX:e,sourceY:n,sourcePosition:o=de.Bottom,targetX:i,targetY:r,targetPosition:a=de.Top,borderRadius:l=5,centerX:u,centerY:c,offset:d=20}=t,[f,h,p,y,m]=Og({source:{x:e,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:a,center:{x:u,y:c},offset:d});return[f.reduce((N,_,g)=>{let x;return g>0&&g<f.length-1?x=Rg(f[g-1],_,f[g+1],l):x=`${g===0?"M":"L"}${_.x} ${_.y}`,N+=x,N},""),h,p,y,m]}function Hg(t){const{sourceX:e,sourceY:n,targetX:o,targetY:i}=t,[r,a,l,u]=nl({sourceX:e,sourceY:n,targetX:o,targetY:i});return[`M ${e},${n}L ${o},${i}`,r,a,l,u]}const Vg=s.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=Hg(t);return s.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),cl=s.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=hr({...t,sourcePosition:t.sourcePosition??de.Bottom,targetPosition:t.targetPosition??de.Top});return s.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),Lg=s.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(t,{attrs:e}){return()=>s.h(cl,{...t,...e,borderRadius:0})}}),Fg=s.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=fr({...t,sourcePosition:t.sourcePosition??de.Bottom,targetPosition:t.targetPosition??de.Top});return s.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),jg=s.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(t,{attrs:e}){return()=>{const[n,o,i]=sl({...t,sourcePosition:t.sourcePosition??de.Bottom,targetPosition:t.targetPosition??de.Top});return s.h(An,{path:n,labelX:o,labelY:i,...e,...t})}}}),Gg={input:kg,default:Sg,output:Ng},Wg={default:Fg,straight:Vg,step:Lg,smoothstep:cl,simplebezier:jg};function Yg(t,e,n){const o=s.computed(()=>m=>e.value.get(m)),i=s.computed(()=>m=>n.value.get(m)),r=s.computed(()=>{const m={...Wg,...t.edgeTypes},b=Object.keys(m);for(const N of t.edges)N.type&&!b.includes(N.type)&&(m[N.type]=N.type);return m}),a=s.computed(()=>{const m={...Gg,...t.nodeTypes},b=Object.keys(m);for(const N of t.nodes)N.type&&!b.includes(N.type)&&(m[N.type]=N.type);return m}),l=s.computed(()=>t.onlyRenderVisibleElements?Ea(t.nodes,{x:0,y:0,width:t.dimensions.width,height:t.dimensions.height},t.viewport,!0):t.nodes),u=s.computed(()=>{if(t.onlyRenderVisibleElements){const m=[];for(const b of t.edges){const N=e.value.get(b.source),_=e.value.get(b.target);Up({sourcePos:N.computedPosition||{x:0,y:0},targetPos:_.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:_.dimensions.width,targetHeight:_.dimensions.height,width:t.dimensions.width,height:t.dimensions.height,viewport:t.viewport})&&m.push(b)}return m}return t.edges}),c=s.computed(()=>[...l.value,...u.value]),d=s.computed(()=>{const m=[];for(const b of t.nodes)b.selected&&m.push(b);return m}),f=s.computed(()=>{const m=[];for(const b of t.edges)b.selected&&m.push(b);return m}),h=s.computed(()=>[...d.value,...f.value]),p=s.computed(()=>{const m=[];for(const b of t.nodes)b.dimensions.width&&b.dimensions.height&&b.handleBounds!==void 0&&m.push(b);return m}),y=s.computed(()=>l.value.length>0&&p.value.length===l.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:l,getSelectedElements:h,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:y}}class Lt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var e;const n=(e=s.getCurrentInstance())==null?void 0:e.appContext.app,o=n?.config.globalProperties.$vueFlowStorage??Lt.instance;return Lt.instance=o??new Lt,n&&(n.config.globalProperties.$vueFlowStorage=Lt.instance),Lt.instance}set(e,n){return this.flows.set(e,n)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,n){const o=tl(),i=s.reactive(o),r={};for(const[h,p]of Object.entries(i.hooks)){const y=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[y]=p.on}const a={};for(const[h,p]of Object.entries(i.hooks))a[h]=p.trigger;const l=s.computed(()=>{const h=new Map;for(const p of i.nodes)h.set(p.id,p);return h}),u=s.computed(()=>{const h=new Map;for(const p of i.edges)h.set(p.id,p);return h}),c=Yg(i,l,u),d=xg(i,l,u);d.setState({...i,...n});const f={...r,...c,...d,...Ld(i),nodeLookup:l,edgeLookup:u,emits:a,id:e,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(e)}};return this.set(e,f),f}getId(){return`vue-flow-${this.currentId++}`}}function we(t){const e=Lt.getInstance(),n=s.getCurrentScope(),o=typeof t=="object",i=o?t:{id:t},r=i.id,a=r??n?.vueFlowId;let l;if(n){const u=s.inject(Xa,null);typeof u<"u"&&u!==null&&(!a||u.id===a)&&(l=u)}if(l||a&&(l=e.get(a)),!l||a&&l.id!==a){const u=r??e.getId(),c=e.create(u,i);l=c,(n??s.effectScope(!0)).run(()=>{s.watch(c.applyDefault,(f,h,p)=>{const y=b=>{c.applyNodeChanges(b)},m=b=>{c.applyEdgeChanges(b)};f?(c.onNodesChange(y),c.onEdgesChange(m)):(c.hooks.value.nodesChange.off(y),c.hooks.value.edgesChange.off(m)),p(()=>{c.hooks.value.nodesChange.off(y),c.hooks.value.edgesChange.off(m)})},{immediate:!0}),mn(()=>{if(l){const f=e.get(l.id);f?f.$destroy():zn(`No store instance found for id ${l.id} in storage.`)}})})}else o&&l.setState(i);if(n&&(s.provide(Xa,l),n.vueFlowId=l.id),o){const u=s.getCurrentInstance();u?.type.name!=="VueFlow"&&l.emits.error(new Be(Ne.USEVUEFLOW_OPTIONS))}return l}function Ug(t){const{emits:e,dimensions:n}=we();let o;s.onMounted(()=>{const i=()=>{var r,a;if(!t.value||!(((a=(r=t.value).checkVisibility)==null?void 0:a.call(r))??!0))return;const l=Eo(t.value);(l.width===0||l.height===0)&&e.error(new Be(Ne.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};i(),window.addEventListener("resize",i),t.value&&(o=new ResizeObserver(()=>i()),o.observe(t.value)),s.onBeforeUnmount(()=>{window.removeEventListener("resize",i),o&&t.value&&o.unobserve(t.value)})})}const Xg={name:"UserSelection",compatConfig:{MODE:3}},qg=s.defineComponent({...Xg,props:{userSelectionRect:{}},setup(t){return(e,n)=>(s.openBlock(),s.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:s.normalizeStyle({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}}),Kg=["tabIndex"],Zg={name:"NodesSelection",compatConfig:{MODE:3}},Jg=s.defineComponent({...Zg,setup(t){const{emits:e,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:a}=we(),l=el(),u=s.ref(null),c=Za({el:u,onStart(y){e.selectionDragStart(y),e.nodeDragStart(y)},onDrag(y){e.selectionDrag(y),e.nodeDrag(y)},onStop(y){e.selectionDragStop(y),e.nodeDragStop(y)}});s.onMounted(()=>{var y;r.value||(y=u.value)==null||y.focus({preventScroll:!0})});const d=s.computed(()=>Ca(o.value)),f=s.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function h(y){e.selectionContextMenu({event:y,nodes:o.value})}function p(y){r.value||en[y.key]&&(y.preventDefault(),l({x:en[y.key].x,y:en[y.key].y},y.shiftKey))}return(y,m)=>!s.unref(a)&&d.value.width&&d.value.height?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["vue-flow__nodesselection vue-flow__container",s.unref(i)]),style:s.normalizeStyle({transform:`translate(${s.unref(n).x}px,${s.unref(n).y}px) scale(${s.unref(n).zoom})`})},[s.createElementVNode("div",{ref_key:"el",ref:u,class:s.normalizeClass([{dragging:s.unref(c)},"vue-flow__nodesselection-rect"]),style:s.normalizeStyle(f.value),tabIndex:s.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,Kg)],6)):s.createCommentVNode("",!0)}});function Qg(t,e){return{x:t.clientX-e.left,y:t.clientY-e.top}}const em={name:"Pane",compatConfig:{MODE:3}},tm=s.defineComponent({...em,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(t){const{vueFlowRef:e,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:a,userSelectionRect:l,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:h,removeEdges:p,selectionMode:y,deleteKeyCode:m,multiSelectionKeyCode:b,multiSelectionActive:N,edgeLookup:_,nodeLookup:g,connectionLookup:x,defaultEdgeOptions:A,connectionStartHandle:$,panOnDrag:F}=we(),U=s.shallowRef(null),G=s.shallowRef(new Set),S=s.shallowRef(new Set),T=s.shallowRef(null),E=s.toRef(()=>u.value&&(t.isSelecting||r.value)),H=s.toRef(()=>$.value!==null);let w=!1,D=!1;const v=Tn(m,{actInsideInputWithModifier:!1}),C=Tn(b);s.watch(v,Z=>{Z&&(h(f.value),p(d.value),c.value=!1)}),s.watch(C,Z=>{N.value=Z});function k(Z,Q){return q=>{q.target===Q&&Z?.(q)}}function O(Z){if(w||H.value){w=!1;return}i.paneClick(Z),a(),c.value=!1}function R(Z){var Q;if(Array.isArray(F.value)&&((Q=F.value)!=null&&Q.includes(2))){Z.preventDefault();return}i.paneContextMenu(Z)}function B(Z){i.paneScroll(Z)}function P(Z){var Q,q,ee;if(T.value=((Q=e.value)==null?void 0:Q.getBoundingClientRect())??null,!u.value||!t.isSelecting||Z.button!==0||Z.target!==U.value||!T.value)return;(ee=(q=Z.target)==null?void 0:q.setPointerCapture)==null||ee.call(q,Z.pointerId);const{x:re,y:ie}=Qg(Z,T.value);D=!0,w=!1,a(),l.value={width:0,height:0,startX:re,startY:ie,x:re,y:ie},i.selectionStart(Z)}function L(Z){var Q;if(!T.value||!l.value)return;w=!0;const{x:q,y:ee}=lt(Z,T.value),{startX:re=0,startY:ie=0}=l.value,ce={startX:re,startY:ie,x:q<re?q:re,y:ee<ie?ee:ie,width:Math.abs(q-re),height:Math.abs(ee-ie)},oe=G.value,ae=S.value;G.value=new Set(Ea(n.value,ce,o.value,y.value===er.Partial,!0).map(M=>M.id)),S.value=new Set;const z=((Q=A.value)==null?void 0:Q.selectable)??!0;for(const M of G.value){const V=x.value.get(M);if(V)for(const{edgeId:X}of V.values()){const I=_.value.get(X);I&&(I.selectable??z)&&S.value.add(X)}}if(!Ua(oe,G.value)){const M=kt(g.value,G.value,!0);i.nodesChange(M)}if(!Ua(ae,S.value)){const M=kt(_.value,S.value);i.edgesChange(M)}l.value=ce,r.value=!0,c.value=!1}function j(Z){var Q;Z.button!==0||!D||((Q=Z.target)==null||Q.releasePointerCapture(Z.pointerId),!r.value&&l.value&&Z.target===U.value&&O(Z),r.value=!1,l.value=null,c.value=G.value.size>0,i.selectionEnd(Z),t.selectionKeyPressed&&(w=!1),D=!1)}return(Z,Q)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"container",ref:U,class:s.normalizeClass(["vue-flow__pane vue-flow__container",{selection:Z.isSelecting}]),onClick:Q[0]||(Q[0]=q=>E.value?void 0:k(O,U.value)(q)),onContextmenu:Q[1]||(Q[1]=q=>k(R,U.value)(q)),onWheelPassive:Q[2]||(Q[2]=q=>k(B,U.value)(q)),onPointerenter:Q[3]||(Q[3]=q=>E.value?void 0:s.unref(i).paneMouseEnter(q)),onPointerdown:Q[4]||(Q[4]=q=>E.value?P(q):s.unref(i).paneMouseMove(q)),onPointermove:Q[5]||(Q[5]=q=>E.value?L(q):s.unref(i).paneMouseMove(q)),onPointerup:Q[6]||(Q[6]=q=>E.value?j(q):void 0),onPointerleave:Q[7]||(Q[7]=q=>s.unref(i).paneMouseLeave(q))},[s.renderSlot(Z.$slots,"default"),s.unref(r)&&s.unref(l)?(s.openBlock(),s.createBlock(qg,{key:0,"user-selection-rect":s.unref(l)},null,8,["user-selection-rect"])):s.createCommentVNode("",!0),s.unref(c)&&s.unref(f).length?(s.openBlock(),s.createBlock(Jg,{key:1})):s.createCommentVNode("",!0)],34))}}),nm={name:"Transform",compatConfig:{MODE:3}},om=s.defineComponent({...nm,setup(t){const{viewport:e,fitViewOnInit:n,fitViewOnInitDone:o}=we(),i=s.computed(()=>n.value?!o.value:!1),r=s.computed(()=>`translate(${e.value.x}px,${e.value.y}px) scale(${e.value.zoom})`);return(a,l)=>(s.openBlock(),s.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:s.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[s.renderSlot(a.$slots,"default")],4))}}),im={name:"Viewport",compatConfig:{MODE:3}},rm=s.defineComponent({...im,setup(t){const{minZoom:e,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:a,panActivationKeyCode:l,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:y,preventScrolling:m,noWheelClassName:b,noPanClassName:N,emits:_,connectionStartHandle:g,userSelectionActive:x,paneDragging:A,d3Zoom:$,d3Selection:F,d3ZoomHandler:U,viewport:G,viewportRef:S,paneClickDistance:T}=we();Ug(S);const E=s.shallowRef(!1),H=s.shallowRef(!1);let w=null,D=!1,v=0,C={x:0,y:0,zoom:0};const k=Tn(l),O=Tn(a),R=Tn(r),B=s.toRef(()=>(!O.value||O.value&&a.value===!0)&&(k.value||f.value)),P=s.toRef(()=>k.value||u.value),L=s.toRef(()=>a.value===!0&&B.value!==!0),j=s.toRef(()=>O.value&&a.value!==!0||x.value||L.value),Z=s.toRef(()=>g.value!==null);s.onMounted(()=>{if(!S.value){zn("Viewport element is missing");return}const ie=S.value,ce=ie.getBoundingClientRect(),oe=Np().clickDistance(T.value).scaleExtent([e.value,n.value]).translateExtent(i.value),ae=Je(ie).call(oe),z=ae.on("wheel.zoom"),M=Qt.translate(o.value.x??0,o.value.y??0).scale(Ht(o.value.zoom??1,e.value,n.value)),V=[[0,0],[ce.width,ce.height]],X=oe.constrain()(M,V,i.value);oe.transform(ae,X),oe.wheelDelta(Da),$.value=oe,F.value=ae,U.value=z,G.value={x:X.x,y:X.y,zoom:X.k},oe.on("start",I=>{var Y;if(!I.sourceEvent)return null;v=I.sourceEvent.button,E.value=!0;const W=ee(I.transform);((Y=I.sourceEvent)==null?void 0:Y.type)==="mousedown"&&(A.value=!0),C=W,_.viewportChangeStart(W),_.moveStart({event:I,flowTransform:W})}),oe.on("end",I=>{if(!I.sourceEvent)return null;if(E.value=!1,A.value=!1,Q(B.value,v??0)&&!D&&_.paneContextMenu(I.sourceEvent),D=!1,q(C,I.transform)){const Y=ee(I.transform);C=Y,_.viewportChangeEnd(Y),_.moveEnd({event:I,flowTransform:Y})}}),oe.filter(I=>{var Y;const W=R.value||y.value,K=p.value&&I.ctrlKey,ne=I.button,te=I.type==="wheel";if(ne===1&&I.type==="mousedown"&&(re(I,"vue-flow__node")||re(I,"vue-flow__edge")))return!0;if(!B.value&&!W&&!P.value&&!h.value&&!p.value||x.value||Z.value&&!te||!h.value&&I.type==="dblclick"||re(I,b.value)&&te||re(I,N.value)&&(!te||P.value&&te&&!R.value)||!p.value&&I.ctrlKey&&te||!W&&!P.value&&!K&&te)return!1;if(!p&&I.type==="touchstart"&&((Y=I.touches)==null?void 0:Y.length)>1)return I.preventDefault(),!1;if(!B.value&&(I.type==="mousedown"||I.type==="touchstart")||L.value&&Array.isArray(f.value)&&f.value.includes(0)&&ne===0||Array.isArray(f.value)&&!f.value.includes(ne)&&(I.type==="mousedown"||I.type==="touchstart"))return!1;const fe=Array.isArray(f.value)&&f.value.includes(ne)||a.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!ne||ne<=1;return(!I.ctrlKey||k.value||te)&&fe}),s.watch([x,B],()=>{x.value&&!E.value?oe.on("zoom",null):x.value||oe.on("zoom",I=>{G.value={x:I.transform.x,y:I.transform.y,zoom:I.transform.k};const Y=ee(I.transform);D=Q(B.value,v??0),_.viewportChange(Y),_.move({event:I,flowTransform:Y})})},{immediate:!0}),s.watch([x,P,c,R,p,m,b],()=>{P.value&&!R.value&&!x.value?ae.on("wheel.zoom",I=>{if(re(I,b.value))return!1;const Y=R.value||y.value,W=p.value&&I.ctrlKey;if(!(!m.value||P.value||Y||W))return!1;I.preventDefault(),I.stopImmediatePropagation();const ne=ae.property("__zoom").k||1,te=No();if(!k.value&&I.ctrlKey&&p.value&&te){const Ze=it(I),_e=Da(I),xt=ne*2**_e;oe.scaleTo(ae,xt,Ze,I);return}const fe=I.deltaMode===1?20:1;let ge=c.value===Dn.Vertical?0:I.deltaX*fe,Ie=c.value===Dn.Horizontal?0:I.deltaY*fe;!te&&I.shiftKey&&c.value!==Dn.Vertical&&!ge&&Ie&&(ge=Ie,Ie=0),oe.translateBy(ae,-(ge/ne)*d.value,-(Ie/ne)*d.value);const Me=ee(ae.property("__zoom"));w&&clearTimeout(w),H.value?(_.move({event:I,flowTransform:Me}),_.viewportChange(Me),w=setTimeout(()=>{_.moveEnd({event:I,flowTransform:Me}),_.viewportChangeEnd(Me),H.value=!1},150)):(H.value=!0,_.moveStart({event:I,flowTransform:Me}),_.viewportChangeStart(Me))},{passive:!1}):typeof z<"u"&&ae.on("wheel.zoom",function(I,Y){const W=!m.value&&I.type==="wheel"&&!I.ctrlKey,K=R.value||y.value,ne=p.value&&I.ctrlKey;if(!K&&!u.value&&!ne&&I.type==="wheel"||W||re(I,b.value))return null;I.preventDefault(),z.call(this,I,Y)},{passive:!1})},{immediate:!0})});function Q(ie,ce){return ce===2&&Array.isArray(ie)&&ie.includes(2)}function q(ie,ce){return ie.x!==ce.x&&!Number.isNaN(ce.x)||ie.y!==ce.y&&!Number.isNaN(ce.y)||ie.zoom!==ce.k&&!Number.isNaN(ce.k)}function ee(ie){return{x:ie.x,y:ie.y,zoom:ie.k}}function re(ie,ce){return ie.target.closest(`.${ce}`)}return(ie,ce)=>(s.openBlock(),s.createElementBlock("div",{ref_key:"viewportRef",ref:S,class:"vue-flow__viewport vue-flow__container"},[s.createVNode(tm,{"is-selecting":j.value,"selection-key-pressed":s.unref(O),class:s.normalizeClass({connecting:Z.value,dragging:s.unref(A),draggable:s.unref(f)===!0||Array.isArray(s.unref(f))&&s.unref(f).includes(0)})},{default:s.withCtx(()=>[s.createVNode(om,null,{default:s.withCtx(()=>[s.renderSlot(ie.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),sm=["id"],am=["id"],lm=["id"],cm={name:"A11yDescriptions",compatConfig:{MODE:3}},dm=s.defineComponent({...cm,setup(t){const{id:e,disableKeyboardA11y:n,ariaLiveMessage:o}=we();return(i,r)=>(s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createElementVNode("div",{id:`${s.unref(pa)}-${s.unref(e)}`,style:{display:"none"}}," Press enter or space to select a node. "+s.toDisplayString(s.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,sm),s.createElementVNode("div",{id:`${s.unref(ga)}-${s.unref(e)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,am),s.unref(n)?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",{key:0,id:`${s.unref(Bp)}-${s.unref(e)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},s.toDisplayString(s.unref(o)),9,lm))],64))}});function um(){const t=we();s.watch(()=>t.viewportHelper.value.viewportInitialized,e=>{e&&setTimeout(()=>{t.emits.init(t),t.emits.paneReady(t)},1)})}function fm(t,e,n){return n===de.Left?t-e:n===de.Right?t+e:t}function hm(t,e,n){return n===de.Top?t-e:n===de.Bottom?t+e:t}const pr=function({radius:t=10,centerX:e=0,centerY:n=0,position:o=de.Top,type:i}){return s.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:fm(e,t,o),cy:hm(n,t,o),r:t,stroke:"transparent",fill:"transparent"})};pr.props=["radius","centerX","centerY","position","type"],pr.compatConfig={MODE:3};const dl=pr,pm=s.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(t){const{id:e,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:a,noPanClassName:l,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:y,elementsSelectable:m,edgesUpdatable:b,edgesFocusable:N,hooks:_}=we(),g=s.computed(()=>d(t.id)),{emit:x,on:A}=cg(g.value,r),$=s.inject(Do),F=s.getCurrentInstance(),U=s.ref(!1),G=s.ref(!1),S=s.ref(""),T=s.ref(null),E=s.ref("source"),H=s.ref(null),w=s.toRef(()=>typeof g.value.selectable>"u"?m.value:g.value.selectable),D=s.toRef(()=>typeof g.value.updatable>"u"?b.value:g.value.updatable),v=s.toRef(()=>typeof g.value.focusable>"u"?N.value:g.value.focusable);s.provide(sg,t.id),s.provide(ag,H);const C=s.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),k=s.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),O=s.computed(()=>{const M=g.value.type||"default",V=$?.[`edge-${M}`];if(V)return V;let X=g.value.template??u.value[M];if(typeof X=="string"&&F){const I=Object.keys(F.appContext.components);I&&I.includes(M)&&(X=s.resolveComponent(M,!1))}return X&&typeof X!="string"?X:(r.error(new Be(Ne.EDGE_TYPE_MISSING,X)),!1)}),{handlePointerDown:R}=Ja({nodeId:S,handleId:T,type:E,isValidConnection:h,edgeUpdaterType:E,onEdgeUpdate:L,onEdgeUpdateEnd:j});return()=>{const M=f(g.value.source),V=f(g.value.target),X="pathOptions"in g.value?g.value.pathOptions:{};if(!M&&!V)return r.error(new Be(Ne.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!M)return r.error(new Be(Ne.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!V)return r.error(new Be(Ne.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||M.hidden||V.hidden)return null;let I;o.value===gt.Strict?I=M.handleBounds.source:I=[...M.handleBounds.source||[],...M.handleBounds.target||[]];const Y=Ra(I,g.value.sourceHandle);let W;o.value===gt.Strict?W=V.handleBounds.target:W=[...V.handleBounds.target||[],...V.handleBounds.source||[]];const K=Ra(W,g.value.targetHandle),ne=Y?.position||de.Bottom,te=K?.position||de.Top,{x:fe,y:ge}=nn(M,Y,ne),{x:Ie,y:Me}=nn(V,K,te);return g.value.sourceX=fe,g.value.sourceY=ge,g.value.targetX=Ie,g.value.targetY=Me,s.h("g",{ref:H,key:t.id,"data-id":t.id,class:["vue-flow__edge",`vue-flow__edge-${O.value===!1?"default":g.value.type||"default"}`,l.value,C.value,{updating:U.value,selected:g.value.selected,animated:g.value.animated,inactive:!w.value&&!_.value.edgeClick.hasListeners()}],tabIndex:v.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel??`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":v.value?`${ga}-${e}`:void 0,"aria-roledescription":"edge",role:v.value?"group":"img",...g.value.domAttributes,onClick:Q,onContextmenu:q,onDblclick:ee,onMouseenter:re,onMousemove:ie,onMouseleave:ce,onKeyDown:v.value?z:void 0},[G.value?null:s.h(O.value===!1?u.value.default:O.value,{id:t.id,sourceNode:M,targetNode:V,source:g.value.source,target:g.value.target,type:g.value.type,updatable:D.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...A},style:k.value,markerStart:`url('#${$n(g.value.markerStart,e)}')`,markerEnd:`url('#${$n(g.value.markerEnd,e)}')`,sourcePosition:ne,targetPosition:te,sourceX:fe,sourceY:ge,targetX:Ie,targetY:Me,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...X}),[D.value==="source"||D.value===!0?[s.h("g",{onMousedown:oe,onMouseenter:B,onMouseout:P},s.h(dl,{position:ne,centerX:fe,centerY:ge,radius:i.value,type:"source","data-type":"source"}))]:null,D.value==="target"||D.value===!0?[s.h("g",{onMousedown:ae,onMouseenter:B,onMouseout:P},s.h(dl,{position:te,centerX:Ie,centerY:Me,radius:i.value,type:"target","data-type":"target"}))]:null]])};function B(){U.value=!0}function P(){U.value=!1}function L(M,V){x.update({event:M,edge:g.value,connection:V})}function j(M){x.updateEnd({event:M,edge:g.value}),G.value=!1}function Z(M,V){M.button===0&&(G.value=!0,S.value=V?g.value.target:g.value.source,T.value=(V?g.value.targetHandle:g.value.sourceHandle)??null,E.value=V?"target":"source",x.updateStart({event:M,edge:g.value}),R(M))}function Q(M){var V;const X={event:M,edge:g.value};w.value&&(a.value=!1,g.value.selected&&p.value?(c([g.value]),(V=H.value)==null||V.blur()):n([g.value])),x.click(X)}function q(M){x.contextMenu({event:M,edge:g.value})}function ee(M){x.doubleClick({event:M,edge:g.value})}function re(M){x.mouseEnter({event:M,edge:g.value})}function ie(M){x.mouseMove({event:M,edge:g.value})}function ce(M){x.mouseLeave({event:M,edge:g.value})}function oe(M){Z(M,!0)}function ae(M){Z(M,!1)}function z(M){var V;!y.value&&ma.includes(M.key)&&w.value&&(M.key==="Escape"?((V=H.value)==null||V.blur(),c([d(t.id)])):n([d(t.id)]))}}}),gm=s.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var t;const{id:e,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:a,connectionLineStyle:l,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:f}=we(),h=(t=s.inject(Do))==null?void 0:t["connection-line"],p=s.computed(()=>{var _;return f((_=o.value)==null?void 0:_.nodeId)}),y=s.computed(()=>{var _;return f((_=i.value)==null?void 0:_.nodeId)??null}),m=s.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),b=s.computed(()=>u.value.markerStart?`url(#${$n(u.value.markerStart,e)})`:""),N=s.computed(()=>u.value.markerEnd?`url(#${$n(u.value.markerEnd,e)})`:"");return()=>{var _,g,x;if(!p.value||!o.value)return null;const A=o.value.id,$=o.value.type,F=p.value.handleBounds;let U=F?.[$]??[];if(n.value===gt.Loose){const k=F?.[$==="source"?"target":"source"]??[];U=[...U,...k]}if(!U)return null;const G=(A?U.find(k=>k.id===A):U[0])??null,S=G?.position??de.Top,{x:T,y:E}=nn(p.value,G,S);let H=null;y.value&&(n.value===gt.Strict?H=((_=y.value.handleBounds[$==="source"?"target":"source"])==null?void 0:_.find(k=>{var O;return k.id===((O=i.value)==null?void 0:O.id)}))||null:H=((g=[...y.value.handleBounds.source??[],...y.value.handleBounds.target??[]])==null?void 0:g.find(k=>{var O;return k.id===((O=i.value)==null?void 0:O.id)}))||null);const w=((x=i.value)==null?void 0:x.position)??(S?ar[S]:null);if(!S||!w)return null;const D=a.value??u.value.type??Rt.Bezier;let v="";const C={sourceX:T,sourceY:E,sourcePosition:S,targetX:m.value.x,targetY:m.value.y,targetPosition:w};return D===Rt.Bezier?[v]=fr(C):D===Rt.Step?[v]=hr({...C,borderRadius:0}):D===Rt.SmoothStep?[v]=hr(C):D===Rt.SimpleBezier?[v]=sl(C):v=`M${T},${E} ${m.value.x},${m.value.y}`,s.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},s.h("g",{class:"vue-flow__connection"},h?s.h(h,{sourceX:T,sourceY:E,sourcePosition:S,targetX:m.value.x,targetY:m.value.y,targetPosition:w,sourceNode:p.value,sourceHandle:G,targetNode:y.value,targetHandle:H,markerEnd:N.value,markerStart:b.value,connectionStatus:c.value}):s.h("path",{d:v,class:[u.value.class,c.value,"vue-flow__connection-path"],style:{...l.value,...u.value.style},"marker-end":N.value,"marker-start":b.value})))}}}),mm=["id","markerWidth","markerHeight","markerUnits","orient"],ym={name:"MarkerType",compatConfig:{MODE:3}},vm=s.defineComponent({...ym,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(t){return(e,n)=>(s.openBlock(),s.createElementBlock("marker",{id:e.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===s.unref(mt).ArrowClosed?(s.openBlock(),s.createElementBlock("polyline",{key:0,style:s.normalizeStyle({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):s.createCommentVNode("",!0),e.type===s.unref(mt).Arrow?(s.openBlock(),s.createElementBlock("polyline",{key:1,style:s.normalizeStyle({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):s.createCommentVNode("",!0)],8,mm))}}),bm={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},wm={name:"MarkerDefinitions",compatConfig:{MODE:3}},_m=s.defineComponent({...wm,setup(t){const{id:e,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=we(),r=s.computed(()=>{const a=new Set,l=[],u=c=>{if(c){const d=$n(c,e);a.has(d)||(typeof c=="object"?l.push({...c,id:d,color:c.color||i.value}):l.push({id:d,color:i.value,type:c}),a.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return l.sort((c,d)=>c.id.localeCompare(d.id))});return(a,l)=>(s.openBlock(),s.createElementBlock("svg",bm,[s.createElementVNode("defs",null,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.value,u=>(s.openBlock(),s.createBlock(vm,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),xm={name:"Edges",compatConfig:{MODE:3}},Cm=s.defineComponent({...xm,setup(t){const{findNode:e,getEdges:n,elevateEdgesOnSelect:o}=we();return(i,r)=>(s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createVNode(_m),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(n),a=>(s.openBlock(),s.createElementBlock("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:s.normalizeStyle({zIndex:s.unref(Xp)(a,s.unref(e),s.unref(o))})},[s.createVNode(s.unref(pm),{id:a.id},null,8,["id"])],4))),128)),s.createVNode(s.unref(gm))],64))}}),Em=s.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(t){const{id:e,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:a,removeSelectedNodes:l,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:y,ariaLiveMessage:m,snapToGrid:b,snapGrid:N,nodeDragThreshold:_,nodesDraggable:g,elementsSelectable:x,nodesConnectable:A,nodesFocusable:$,hooks:F}=we(),U=s.ref(null);s.provide(Ka,U),s.provide(qa,t.id);const G=s.inject(Do),S=s.getCurrentInstance(),T=el(),{node:E,parentNode:H}=Qa(t.id),{emit:w,on:D}=hg(E,a),v=s.toRef(()=>typeof E.draggable>"u"?g.value:E.draggable),C=s.toRef(()=>typeof E.selectable>"u"?x.value:E.selectable),k=s.toRef(()=>typeof E.connectable>"u"?A.value:E.connectable),O=s.toRef(()=>typeof E.focusable>"u"?$.value:E.focusable),R=s.computed(()=>C.value||v.value||F.value.nodeClick.hasListeners()||F.value.nodeDoubleClick.hasListeners()||F.value.nodeMouseEnter.hasListeners()||F.value.nodeMouseMove.hasListeners()||F.value.nodeMouseLeave.hasListeners()),B=s.toRef(()=>!!E.dimensions.width&&!!E.dimensions.height),P=s.computed(()=>{const V=E.type||"default",X=G?.[`node-${V}`];if(X)return X;let I=E.template||f.value[V];if(typeof I=="string"&&S){const Y=Object.keys(S.appContext.components);Y&&Y.includes(V)&&(I=s.resolveComponent(V,!1))}return I&&typeof I!="string"?I:(a.error(new Be(Ne.NODE_TYPE_MISSING,I)),!1)}),L=Za({id:t.id,el:U,disabled:()=>!v.value,selectable:C,dragHandle:()=>E.dragHandle,onStart(V){w.dragStart(V)},onDrag(V){w.drag(V)},onStop(V){w.dragStop(V)},onClick(V){z(V)}}),j=s.computed(()=>E.class instanceof Function?E.class(E):E.class),Z=s.computed(()=>{const V=(E.style instanceof Function?E.style(E):E.style)||{},X=E.width instanceof Function?E.width(E):E.width,I=E.height instanceof Function?E.height(E):E.height;return!V.width&&X&&(V.width=typeof X=="string"?X:`${X}px`),!V.height&&I&&(V.height=typeof I=="string"?I:`${I}px`),V}),Q=s.toRef(()=>Number(E.zIndex??Z.value.zIndex??0));return d(V=>{(V.includes(t.id)||!V.length)&&ee()}),s.onMounted(()=>{s.watch(()=>E.hidden,(V=!1,X,I)=>{!V&&U.value&&(t.resizeObserver.observe(U.value),I(()=>{U.value&&t.resizeObserver.unobserve(U.value)}))},{immediate:!0,flush:"post"})}),s.watch([()=>E.type,()=>E.sourcePosition,()=>E.targetPosition],()=>{s.nextTick(()=>{c([{id:t.id,nodeElement:U.value,forceUpdate:!0}])})}),s.watch([()=>E.position.x,()=>E.position.y,()=>{var V;return(V=H.value)==null?void 0:V.computedPosition.x},()=>{var V;return(V=H.value)==null?void 0:V.computedPosition.y},()=>{var V;return(V=H.value)==null?void 0:V.computedPosition.z},Q,()=>E.selected,()=>E.dimensions.height,()=>E.dimensions.width,()=>{var V;return(V=H.value)==null?void 0:V.dimensions.height},()=>{var V;return(V=H.value)==null?void 0:V.dimensions.width}],([V,X,I,Y,W,K])=>{const ne={x:V,y:X,z:K+(p.value&&E.selected?1e3:0)};typeof I<"u"&&typeof Y<"u"?E.computedPosition=Fp({x:I,y:Y,z:W},ne):E.computedPosition=ne},{flush:"post",immediate:!0}),s.watch([()=>E.extent,h],([V,X],[I,Y])=>{(V!==I||X!==Y)&&q()}),E.extent==="parent"||typeof E.extent=="object"&&"range"in E.extent&&E.extent.range==="parent"?$i(()=>B).toBe(!0).then(q):q(),()=>E.hidden?null:s.h("div",{ref:U,"data-id":E.id,class:["vue-flow__node",`vue-flow__node-${P.value===!1?"default":E.type||"default"}`,{[n.value]:v.value,dragging:L?.value,draggable:v.value,selected:E.selected,selectable:C.value,parent:E.isParent},j.value],style:{visibility:B.value?"visible":"hidden",zIndex:E.computedPosition.z??Q.value,transform:`translate(${E.computedPosition.x}px,${E.computedPosition.y}px)`,pointerEvents:R.value?"all":"none",...Z.value},tabIndex:O.value?0:void 0,role:O.value?"group":void 0,"aria-describedby":y.value?void 0:`${pa}-${e}`,"aria-label":E.ariaLabel,"aria-roledescription":"node",...E.domAttributes,onMouseenter:re,onMousemove:ie,onMouseleave:ce,onContextmenu:oe,onClick:z,onDblclick:ae,onKeydown:M},[s.h(P.value===!1?f.value.default:P.value,{id:E.id,type:E.type,data:E.data,events:{...E.events,...D},selected:E.selected,resizing:E.resizing,dragging:L.value,connectable:k.value,position:E.computedPosition,dimensions:E.dimensions,isValidTargetPos:E.isValidTargetPos,isValidSourcePos:E.isValidSourcePos,parent:E.parentNode,parentNodeId:E.parentNode,zIndex:E.computedPosition.z??Q.value,targetPosition:E.targetPosition,sourcePosition:E.sourcePosition,label:E.label,dragHandle:E.dragHandle,onUpdateNodeInternals:ee})]);function q(){const V=E.computedPosition,{computedPosition:X,position:I}=ir(E,b.value?ko(V,N.value):V,a.error,h.value,H.value);(E.computedPosition.x!==X.x||E.computedPosition.y!==X.y)&&(E.computedPosition={...E.computedPosition,...X}),(E.position.x!==I.x||E.position.y!==I.y)&&(E.position=I)}function ee(){U.value&&c([{id:t.id,nodeElement:U.value,forceUpdate:!0}])}function re(V){L?.value||w.mouseEnter({event:V,node:E})}function ie(V){L?.value||w.mouseMove({event:V,node:E})}function ce(V){L?.value||w.mouseLeave({event:V,node:E})}function oe(V){return w.contextMenu({event:V,node:E})}function ae(V){return w.doubleClick({event:V,node:E})}function z(V){C.value&&(!o.value||!v.value||_.value>0)&&lr(E,r.value,u,l,i,!1,U.value),w.click({event:V,node:E})}function M(V){if(!(tr(V)||y.value))if(ma.includes(V.key)&&C.value){const X=V.key==="Escape";lr(E,r.value,u,l,i,X,U.value)}else v.value&&E.selected&&en[V.key]&&(V.preventDefault(),m.value=`Moved selected node ${V.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~E.position.x}, y: ${~~E.position.y}`,T({x:en[V.key].x,y:en[V.key].y},V.shiftKey))}}}),Sm={height:"0",width:"0"},Nm={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},km=s.defineComponent({...Nm,setup(t){const{viewportRef:e}=we(),n=s.toRef(()=>{var o;return(o=e.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(s.openBlock(),s.createElementBlock("svg",null,[(s.openBlock(),s.createElementBlock("foreignObject",Sm,[(s.openBlock(),s.createBlock(s.Teleport,{to:n.value,disabled:!n.value},[s.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function Dm(t={includeHiddenNodes:!1}){const{nodes:e}=we();return s.computed(()=>{if(e.value.length===0)return!1;for(const n of e.value)if((t.includeHiddenNodes||!n.hidden)&&(n?.handleBounds===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Tm={class:"vue-flow__nodes vue-flow__container"},Im={name:"Nodes",compatConfig:{MODE:3}},Mm=s.defineComponent({...Im,setup(t){const{getNodes:e,updateNodeDimensions:n,emits:o}=we(),i=Dm(),r=s.ref();return s.watch(i,a=>{a&&s.nextTick(()=>{o.nodesInitialized(e.value)})},{immediate:!0}),s.onMounted(()=>{r.value=new ResizeObserver(a=>{const l=a.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));s.nextTick(()=>n(l))})}),s.onBeforeUnmount(()=>{var a;return(a=r.value)==null?void 0:a.disconnect()}),(a,l)=>(s.openBlock(),s.createElementBlock("div",Tm,[r.value?(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:0},s.renderList(s.unref(e),(u,c,d,f)=>{const h=[u.id];if(f&&f.key===u.id&&s.isMemoSame(f,h))return f;const p=(s.openBlock(),s.createBlock(s.unref(Em),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},l,0),128)):s.createCommentVNode("",!0)]))}});function Bm(){const{emits:t}=we();s.onMounted(()=>{if(ja()){const e=document.querySelector(".vue-flow__pane");e&&window.getComputedStyle(e).zIndex!=="1"&&t.error(new Be(Ne.MISSING_STYLES))}})}const $m=s.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),zm={name:"VueFlow",compatConfig:{MODE:3}},Am=s.defineComponent({...zm,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(t,{expose:e,emit:n}){const o=t,i=s.useSlots(),r=zi(o,"modelValue",n),a=zi(o,"nodes",n),l=zi(o,"edges",n),u=we(o),c=yg({modelValue:r,nodes:a,edges:l},o,u);return bg(n,u.hooks),um(),Bm(),s.provide(Do,i),s.onUnmounted(c),e(u),(d,f)=>(s.openBlock(),s.createElementBlock("div",{ref:s.unref(u).vueFlowRef,class:"vue-flow"},[s.createVNode(rm,null,{default:s.withCtx(()=>[s.createVNode(Cm),$m,s.createVNode(Mm),s.renderSlot(d.$slots,"zoom-pane")]),_:3}),s.renderSlot(d.$slots,"default"),s.createVNode(dm)],512))}}),Pm={name:"Panel",compatConfig:{MODE:3}},Om=s.defineComponent({...Pm,props:{position:{}},setup(t){const e=t,{userSelectionActive:n}=we(),o=s.computed(()=>`${e.position}`.split("-"));return(i,r)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["vue-flow__panel",o.value]),style:s.normalizeStyle({pointerEvents:s.unref(n)?"none":"all"})},[s.renderSlot(i.$slots,"default")],6))}});var yt=(t=>(t.Lines="lines",t.Dots="dots",t))(yt||{});const ul=function({dimensions:t,size:e,color:n}){return s.h("path",{stroke:n,"stroke-width":e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})},fl=function({radius:t,color:e}){return s.h("circle",{cx:t,cy:t,r:t,fill:e})};yt.Lines+"",yt.Dots+"";const Rm={[yt.Dots]:"#81818a",[yt.Lines]:"#eee"},Hm=["id","x","y","width","height","patternTransform"],Vm={key:2,height:"100",width:"100"},Lm=["fill"],Fm=["x","y","fill"],jm={name:"Background",compatConfig:{MODE:3}},Gm=s.defineComponent({...jm,props:{id:{},variant:{default:()=>yt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(t){const{id:e,viewport:n}=we(),o=s.computed(()=>{const a=n.value.zoom,[l,u]=Array.isArray(t.gap)?t.gap:[t.gap,t.gap],c=[l*a||1,u*a||1],d=t.size*a,[f,h]=Array.isArray(t.offset)?t.offset:[t.offset,t.offset],p=[f*a||1+c[0]/2,h*a||1+c[1]/2];return{scaledGap:c,offset:p,size:d}}),i=s.toRef(()=>`pattern-${e}${t.id?`-${t.id}`:""}`),r=s.toRef(()=>t.color||t.patternColor||Rm[t.variant||yt.Dots]);return(a,l)=>(s.openBlock(),s.createElementBlock("svg",{class:"vue-flow__background vue-flow__container",style:s.normalizeStyle({height:`${a.height>100?100:a.height}%`,width:`${a.width>100?100:a.width}%`})},[s.renderSlot(a.$slots,"pattern-container",{id:i.value},()=>[s.createElementVNode("pattern",{id:i.value,x:s.unref(n).x%o.value.scaledGap[0],y:s.unref(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[s.renderSlot(a.$slots,"pattern",{},()=>[a.variant===s.unref(yt).Lines?(s.openBlock(),s.createBlock(s.unref(ul),{key:0,size:a.lineWidth,color:r.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):a.variant===s.unref(yt).Dots?(s.openBlock(),s.createBlock(s.unref(fl),{key:1,color:r.value,radius:o.value.size/2},null,8,["color","radius"])):s.createCommentVNode("",!0),a.bgColor?(s.openBlock(),s.createElementBlock("svg",Vm,[s.createElementVNode("rect",{width:"100%",height:"100%",fill:a.bgColor},null,8,Lm)])):s.createCommentVNode("",!0)])],8,Hm)]),s.createElementVNode("rect",{x:a.x,y:a.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,Fm),s.renderSlot(a.$slots,"default",{id:i.value})],4))}}),Wm={name:"ControlButton",compatConfig:{MODE:3}},Ym=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n},Um={type:"button",class:"vue-flow__controls-button"};function Xm(t,e,n,o,i,r){return s.openBlock(),s.createElementBlock("button",Um,[s.renderSlot(t.$slots,"default")])}const Ao=Ym(Wm,[["render",Xm]]),qm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},Km=[s.createElementVNode("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];function Zm(t,e){return s.openBlock(),s.createElementBlock("svg",qm,Km)}const Jm={render:Zm},Qm={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ey=[s.createElementVNode("path",{d:"M0 0h32v4.2H0z"},null,-1)];function ty(t,e){return s.openBlock(),s.createElementBlock("svg",Qm,ey)}const ny={render:ty},oy={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},iy=[s.createElementVNode("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];function ry(t,e){return s.openBlock(),s.createElementBlock("svg",oy,iy)}const sy={render:ry},ay={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ly=[s.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1)];function cy(t,e){return s.openBlock(),s.createElementBlock("svg",ay,ly)}const dy={render:cy},uy={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},fy=[s.createElementVNode("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];function hy(t,e){return s.openBlock(),s.createElementBlock("svg",uy,fy)}const py={render:hy},gy={name:"Controls",compatConfig:{MODE:3}},my=s.defineComponent({...gy,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>fa.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(t,{emit:e}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:r,zoomIn:a,zoomOut:l,fitView:u,viewport:c,minZoom:d,maxZoom:f}=we(),h=s.toRef(()=>n.value||o.value||i.value),p=s.toRef(()=>c.value.zoom<=d.value),y=s.toRef(()=>c.value.zoom>=f.value);function m(){a(),e("zoomIn")}function b(){l(),e("zoomOut")}function N(){u(t.fitViewParams),e("fitView")}function _(){r(!h.value),e("interactionChange",!h.value)}return(g,x)=>(s.openBlock(),s.createBlock(s.unref(Om),{class:"vue-flow__controls",position:g.position},{default:s.withCtx(()=>[s.renderSlot(g.$slots,"top"),g.showZoom?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.renderSlot(g.$slots,"control-zoom-in",{},()=>[s.createVNode(Ao,{class:"vue-flow__controls-zoomin",disabled:y.value,onClick:m},{default:s.withCtx(()=>[s.renderSlot(g.$slots,"icon-zoom-in",{},()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(Jm))))])]),_:3},8,["disabled"])]),s.renderSlot(g.$slots,"control-zoom-out",{},()=>[s.createVNode(Ao,{class:"vue-flow__controls-zoomout",disabled:p.value,onClick:b},{default:s.withCtx(()=>[s.renderSlot(g.$slots,"icon-zoom-out",{},()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(ny))))])]),_:3},8,["disabled"])])],64)):s.createCommentVNode("",!0),g.showFitView?s.renderSlot(g.$slots,"control-fit-view",{key:1},()=>[s.createVNode(Ao,{class:"vue-flow__controls-fitview",onClick:N},{default:s.withCtx(()=>[s.renderSlot(g.$slots,"icon-fit-view",{},()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(sy))))])]),_:3})]):s.createCommentVNode("",!0),g.showInteractive?s.renderSlot(g.$slots,"control-interactive",{key:2},()=>[g.showInteractive?(s.openBlock(),s.createBlock(Ao,{key:0,class:"vue-flow__controls-interactive",onClick:_},{default:s.withCtx(()=>[h.value?s.renderSlot(g.$slots,"icon-unlock",{key:0},()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(py))))]):s.createCommentVNode("",!0),h.value?s.createCommentVNode("",!0):s.renderSlot(g.$slots,"icon-lock",{key:1},()=>[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(s.unref(dy))))])]),_:3})):s.createCommentVNode("",!0)]):s.createCommentVNode("",!0),s.renderSlot(g.$slots,"default")]),_:3},8,["position"]))}}),yy=["onClick"],vy={class:"d-flow-node-menus-item-name"},gr=s.defineComponent({name:"DNodeMenus",__name:"nodeMenus",props:{fromNodeId:{},handleId:{}},emits:["addNode"],setup(t,{emit:e}){const n=t,o=e,i=s.inject("d_flow_design_provide",{}),r=i.getFlowComponents?.()||[],a=l=>{o("addNode",l.type),s.nextTick(()=>{n.handleId==="line"?i.addNodeByLine?.(l.type,n.fromNodeId||""):i.addNode?.(l.type,n.fromNodeId||"",n.handleId||"")})};return(l,u)=>{const c=s.resolveComponent("j-icon");return s.openBlock(),s.createElementBlock("div",{class:"d-flow-node-menus",onClick:s.withModifiers(()=>{},["stop"])},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(r),(d,f)=>(s.openBlock(),s.createElementBlock("div",{key:f,class:"d-flow-node-menus-item",onClick:h=>a(d)},[s.createElementVNode("div",{class:"d-flow-node-menus-item-icon",style:s.normalizeStyle({backgroundColor:d.iconColor||"var(--j-color-primary)"})},[s.createVNode(c,{icon:d.icon||"mdi:source-branch"},null,8,["icon"])],4),s.createElementVNode("div",vy,s.toDisplayString(d.name),1)],8,yy))),128))])}}}),by={class:"d-flow-step-name"},wy={key:0,style:{color:"var(--j-color-text-2)"}},_y={style:{color:"var(--j-color-text)"}},xy=s.defineComponent({name:"DStepNode",__name:"stepNode",props:{id:{},data:{}},setup(t){const e=t,{onNodeClick:n,onEdgeClick:o,onMoveStart:i,onConnectStart:r,onNodeDragStart:a,removeNodes:l,getEdges:u,getNodes:c,onNodesChange:d}=we(),f=s.inject("d_flow_design_provide",{}),h=s.computed(()=>f.getFlowComponentMap?.value?.[e.data.type]||{}),p=()=>{l(e.id),f.onRemoveNode?.(e.id)},y=s.ref({});d(H=>{if(e.data.isInit&&H.findIndex(w=>w.type==="select"&&w.id===e.id&&w.id==="start"&&w.selected)!==-1){const w=c.value.find(D=>D.id==="start");w&&(w.data.isInit=!1),y.value.s1=!0}});const m=s.ref(!1),b=H=>{H.indexOf("t")!==-1&&!N.value||(m.value=!0,y.value[H]=!0)},N=s.computed(()=>u.value.findIndex(H=>H.target===e.id)===-1),_=s.ref(!1),g=()=>{_.value=!0},x=(H,w)=>{if(u.value.find(C=>C.source===w&&C.target===H))return!0;const v=u.value.filter(C=>C.target===H);for(let C=0;C<v.length;C++)if(x(v[C].source,w))return!0;return!1},A=H=>_.value?(_.value=!1,!1):x(H.source,H.target)?!1:H.source!==H.target&&H.sourceHandle!==H.targetHandle&&H.sourceHandle.indexOf("s")!==-1&&H.targetHandle.indexOf("t")!==-1,$=()=>{T(),Object.keys(y.value).forEach(H=>{y.value[H]=!1})},F=()=>{$()};n(()=>{console.log("onNodeClick"),m.value?m.value=!1:$()}),o(()=>{$()}),i(()=>{$()}),r(()=>{$()}),a(()=>{$()});const U=s.ref(),G=s.ref({top:0,left:0,bottom:0,right:0}),S=s.ref({getBoundingClientRect:()=>G.value}),T=()=>{U.value?.handleClose()},E=H=>{const{clientX:w,clientY:D}=H;G.value=DOMRect.fromRect({x:w,y:D}),H.preventDefault(),U.value?.handleOpen()};return(H,w)=>{const D=s.resolveComponent("el-popover"),v=s.resolveComponent("el-tooltip"),C=s.resolveComponent("el-dropdown-item"),k=s.resolveComponent("el-dropdown-menu"),O=s.resolveComponent("el-dropdown");return s.openBlock(),s.createElementBlock("div",{class:"d-flow-step",onContextmenu:s.withModifiers(E,["stop"])},[s.createElementVNode("div",{class:"d-flow-step-icon",style:s.normalizeStyle({backgroundColor:h.value.iconColor||"var(--j-color-primary)"})},[s.createVNode(gn,{icon:h.value.icon||"mdi:source-branch"},null,8,["icon"])],4),s.createElementVNode("div",by,s.toDisplayString(h.value.name),1),t.data.type!=="start"?(s.openBlock(),s.createBlock(v,{key:0,placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:s.withCtx(()=>[N.value?(s.openBlock(),s.createElementBlock("div",wy,[...w[4]||(w[4]=[s.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击",-1),s.createTextVNode("添加节点 ",-1)])])):s.createCommentVNode("",!0),w[5]||(w[5]=s.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[s.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),s.createTextVNode("连接节点 ")],-1))]),default:s.withCtx(()=>[s.createVNode(s.unref(on),{onClick:w[1]||(w[1]=R=>b("t1")),onMousedown:g,id:"t1",class:s.normalizeClass(["d-flow-step-target-handle",{"d-flow-step-target-handle-notadd":!N.value}]),type:"target",position:s.unref(de).Left,"is-valid-connection":A},{default:s.withCtx(()=>[N.value?(s.openBlock(),s.createBlock(D,{key:0,visible:y.value.t1,"onUpdate:visible":w[0]||(w[0]=R=>y.value.t1=R),placement:"left","popper-class":"d-flow-step-popper",trigger:"click","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:s.withCtx(()=>[s.createVNode(gn,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:s.withCtx(()=>[s.createVNode(gr,{"handle-id":"t1","from-node-id":t.id,onAddNode:F},null,8,["from-node-id"])]),_:1},8,["visible"])):s.createCommentVNode("",!0)]),_:1},8,["class","position"])]),_:1})):s.createCommentVNode("",!0),s.createVNode(v,{placement:"top","show-arrow":!1,"popper-class":"d-flow-step-tooltip"},{content:s.withCtx(()=>[...w[6]||(w[6]=[s.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[s.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"点击"),s.createTextVNode("添加节点 ")],-1),s.createElementVNode("div",{style:{color:"var(--j-color-text-2)"}},[s.createElementVNode("span",{style:{color:"var(--j-color-text)","font-weight":"bold"}},"拖拽"),s.createTextVNode("连接节点 ")],-1)])]),default:s.withCtx(()=>[s.createVNode(s.unref(on),{onClick:w[3]||(w[3]=R=>b("s1")),onMousedown:g,id:"s1",class:"d-flow-step-source-handle",type:"source",position:s.unref(de).Right,"is-valid-connection":A},{default:s.withCtx(()=>[s.createVNode(D,{visible:y.value.s1,"onUpdate:visible":w[2]||(w[2]=R=>y.value.s1=R),placement:"right",trigger:"click","popper-class":"d-flow-step-popper","show-arrow":!1,"popper-options":{strategy:"fixed"}},{reference:s.withCtx(()=>[s.createVNode(gn,{class:"d-flow-step-handle-plus",icon:"mdi:plus-circle"})]),default:s.withCtx(()=>[s.createVNode(gr,{"handle-id":"s1","from-node-id":t.id,onAddNode:F},null,8,["from-node-id"])]),_:1},8,["visible"])]),_:1},8,["position"])]),_:1}),s.createVNode(O,{ref_key:"dropdownRef",ref:U,"popper-class":"d-flow-step-dropdown","virtual-ref":S.value,"show-arrow":!1,"popper-options":{modifiers:[{name:"offset",options:{offset:[0,0]}}]},"virtual-triggering":"",trigger:"contextmenu",placement:"bottom-start"},{dropdown:s.withCtx(()=>[s.createVNode(k,null,{default:s.withCtx(()=>[t.data.type!="start"?(s.openBlock(),s.createBlock(C,{key:0,onClick:p},{default:s.withCtx(()=>[...w[7]||(w[7]=[s.createTextVNode("删除",-1)])]),_:1})):s.createCommentVNode("",!0),h.value.des?(s.openBlock(),s.createElementBlock("div",{key:1,style:s.normalizeStyle({width:"160px",padding:"4px 16px 0 16px","font-size":"12px","border-top":t.data.type!="start"?"1px solid var(--j-color-border)":void 0,"margin-top":t.data.type!="start"?"4px":void 0})},[w[8]||(w[8]=s.createElementVNode("div",{style:{"margin-bottom":"4px",color:"var(--j-color-text-2)"}},"关于",-1)),s.createElementVNode("div",_y,s.toDisplayString(h.value.des),1)],4)):s.createCommentVNode("",!0)]),_:1})]),_:1},8,["virtual-ref"])],32)}}}),Cy=s.defineComponent({name:"DEdgeWithButton",__name:"edgeWithButton",props:{id:{},sourceX:{},sourceY:{},targetX:{},targetY:{},sourcePosition:{},targetPosition:{},markerEnd:{},style:{}},setup(t){const e=t,{onEdgeMouseEnter:n,onEdgeMouseLeave:o,onNodeClick:i,onEdgeClick:r,onMoveStart:a,onConnectStart:l,onNodeDragStart:u}=we(),c=s.computed(()=>fr(e)),d=s.ref(!1),f=s.ref(!1);n(({edge:b})=>{b.id===e.id&&(d.value=!0)}),o(()=>{d.value=!1});const h=s.ref(!1),p=()=>{h.value=!1,s.nextTick(()=>{f.value=!1})},y=()=>{f.value=!0,h.value=!0},m=()=>{p()};return i(()=>{p()}),r(()=>{p()}),a(()=>{p()}),l(()=>{p()}),u(()=>{p()}),(b,N)=>{const _=s.resolveComponent("j-icon"),g=s.resolveComponent("el-popover");return s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createVNode(s.unref(An),{id:t.id,style:s.normalizeStyle(t.style),path:c.value[0],"marker-end":t.markerEnd},null,8,["id","style","path","marker-end"]),s.createVNode(s.unref(km),null,{default:s.withCtx(()=>[s.createElementVNode("div",{style:s.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${c.value[1]}px,${c.value[2]}px)`}),class:"nodrag nopan"},[s.createVNode(g,{visible:h.value,"show-arrow":!1,placement:"right","popper-class":"d-flow-step-popper"},{reference:s.withCtx(()=>[s.withDirectives(s.createElementVNode("div",{onClick:s.withModifiers(y,["stop"]),class:"d-flow-edge-button"},[s.createVNode(_,{icon:"mdi:plus-circle"})],512),[[s.vShow,d.value||f.value]])]),default:s.withCtx(()=>[s.createVNode(gr,{"handle-id":"line","from-node-id":t.id,onAddNode:m},null,8,["from-node-id"])]),_:1},8,["visible"])],4)]),_:1})],64)}}}),Ey=s.defineComponent({name:"DFlow",__name:"flow",props:{nodes:{default:()=>[]},edges:{default:()=>[]}},setup(t){return(e,n)=>(s.openBlock(),s.createBlock(s.unref(Am),{"min-zoom":.2,"max-zoom":4,"default-viewport":{zoom:1},"connection-mode":s.unref(gt).Strict,nodes:t.nodes,edges:t.edges},{"edge-button":s.withCtx(o=>[s.createVNode(Cy,{id:o.id,"source-x":o.sourceX,"source-y":o.sourceY,"target-x":o.targetX,"target-y":o.targetY,"source-position":o.sourcePosition,"target-position":o.targetPosition,"marker-end":o.markerEnd,style:s.normalizeStyle(o.style)},null,8,["id","source-x","source-y","target-x","target-y","source-position","target-position","marker-end","style"])]),"node-step":s.withCtx(o=>[s.createVNode(xy,s.normalizeProps(s.guardReactiveProps(o)),null,16)]),default:s.withCtx(()=>[s.createVNode(s.unref(my),{position:"bottom-left"}),s.createVNode(s.unref(Gm))]),_:1},8,["connection-mode","nodes","edges"]))}}),Sy={class:"d-flow-design"},Ny={class:"d-flow-design-canvas"},ky={class:"d-flow-design-right"},Dy={class:"d-flow-design-title"},Ty={class:"d-flow-design-title-name"},Iy={class:"d-flow-design-panel"},hl=$t(s.defineComponent({name:"DFlowDesign",__name:"flowDesign",props:{components:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["nodeClick","edgeClick","paneClick","connect"],setup(t,{expose:e,emit:n}){const o=t,i=n,{addNodes:r,addEdges:a,removeEdges:l,addSelectedNodes:u,removeSelectedNodes:c,onConnect:d,onNodeClick:f,onPaneClick:h,onEdgeClick:p,getNodes:y,getEdges:m}=we(),b=s.computed(()=>{const O={};return o.components.forEach(R=>{O[R.type]=R}),O.start={name:"开始",type:"start",icon:"ant-design:play-circle-outlined",des:"执行开始节点"},O}),N={id:"start",type:"step",data:{type:"start",isInit:!1},position:{x:80,y:160}},_=s.ref([N]),g=s.ref([]),x=(O,R)=>{if(R.indexOf("t")===-1){const B=m.value.filter(P=>P.source===O.id);if(B.length>0){let P=-1e6,L=0;return B.forEach(j=>{P=Math.max(P,j.targetNode.position.y+j.targetNode.dimensions.height+32),L=j.targetNode.position.x||0}),{x:L,y:P}}return{x:O.position.x+O.dimensions.width+100,y:O.position.y}}return{x:O.position.x-100-O.dimensions.width,y:O.position.y}},A=(O,R,B)=>{const P=y.value.find(j=>j.id===R);if(!P)return;const L={id:Wt(),type:"step",data:{type:O},position:x(P,B)};if(o.flowInit){const j=o.flowInit(L.data.type);j&&Object.keys(j).forEach(Z=>{L.data[Z]=j[Z]})}r(L),B.indexOf("t")===-1?a({id:`${R}-${L.id}`,source:R,target:L.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}):a({id:`${R}-${L.id}`,source:L.id,target:R,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}),E(L.id)},$=O=>{const R=y.value.find(B=>B.id===O);R&&(R.position.x+=100+R.dimensions.width,m.value.filter(P=>P.source===O).forEach(P=>{$(P.target)}))},F=(O,R)=>{const B=m.value.find(L=>L.id===R);if(!B)return;const P={id:Wt(),type:"step",data:{type:O},position:{x:B.targetNode.position.x,y:B.targetNode.position.y}};if(o.flowInit){const L=o.flowInit(P.data.type);L&&Object.keys(L).forEach(j=>{P.data[j]=L[j]})}r(P),a({id:`${B.sourceNode.id}-${P.id}`,source:B.sourceNode.id,target:P.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}),a({id:`${P.id}-${B.targetNode.id}`,source:P.id,target:B.targetNode.id,sourceHandle:"s1",targetHandle:"t1",type:"button",markerEnd:mt.Arrow}),l(R),$(B.target),E(P.id)};d(O=>{console.log("onConnect",O),O.type="button",O.markerEnd=mt.Arrow,a(O),i("connect",O)});const U=()=>o.components||[],G=s.ref(),S=s.computed(()=>G.value?b.value[G.value.data.type]:void 0);f(O=>{G.value?.id!==O.node.id&&(G.value=O.node,D()),i("nodeClick",O.node)}),h(()=>{G.value=void 0,i("paneClick")}),p(O=>{G.value=void 0,i("edgeClick",O.edge)});const T=O=>{G.value?.id===O&&(G.value=void 0)},E=O=>{G.value&&c([G.value]),G.value=y.value.find(R=>R.id===O),G.value&&(D(),setTimeout(()=>{G.value&&u([G.value])},100))},H=s.ref(),w={};Object.keys(o.flowComponentConfigs).forEach(O=>{const R={type:"j-collapse",config:{defaultValue:[]},children:[]};o.flowComponentConfigs[O].forEach((B,P)=>{const L=`_collapse${P}`;R.config?.defaultValue.push(L),R.children?.push(B)}),w[O]=[R]});const D=()=>{const O=w[G.value?.data.type||""];O&&H.value?(H.value.init&&H.value.init(O,G.value?.data),o.flowComponentConfigInit&&o.flowComponentConfigInit({configRef:H,inputParams:o.inputParams,components:y.value,configData:G.value?.data})):H.value&&H.value.init&&H.value.init([])},v=(O,R)=>{G.value&&o.flowComponentConfigChange&&o.flowComponentConfigChange(G.value.data.type,{configRef:H,component:O,configData:G.value.data,...R,isFlowNode:!0})};return s.provide("d_flow_design_provide",{getFlowComponents:U,addNode:A,addNodeByLine:F,onRemoveNode:T,getFlowComponentMap:b}),e({getData:()=>{const O=[];return y.value.forEach(R=>{O.push({config:R.data,id:R.id,position:R.position,type:R.type})}),m.value.forEach(R=>{O.push({id:R.id,source:R.source,target:R.target,sourceHandle:R.sourceHandle,targetHandle:R.targetHandle,type:"line",config:{},position:{x:0,y:0}})}),O},setData:O=>{if(!O||O.length===0)N.data.isInit=!0,_.value=[N],E(N.id);else{N.data.isInit=!1;const R=[],B=[];O.forEach(P=>{if(P.type==="line")P.type="button",P.markerEnd=mt.Arrow,B.push(P);else{const L={id:P.id,type:P.type,data:P.config,position:P.position};R.push(L)}}),_.value=R,g.value=B}}}),(O,R)=>{const B=s.resolveComponent("j-icon"),P=s.resolveComponent("j-form");return s.openBlock(),s.createElementBlock("div",Sy,[s.createElementVNode("div",Ny,[s.createVNode(Ey,{nodes:_.value,edges:g.value},null,8,["nodes","edges"])]),s.withDirectives(s.createElementVNode("div",ky,[s.createElementVNode("div",Dy,[s.createElementVNode("div",{class:"d-flow-design-title-icon",style:s.normalizeStyle({backgroundColor:S.value?.iconColor||"var(--j-color-primary)"})},[s.createVNode(B,{icon:S.value?.icon||"mdi:source-branch"},null,8,["icon"])],4),s.createElementVNode("div",Ty,s.toDisplayString(S.value?.name||""),1)]),s.createElementVNode("div",Iy,[s.createVNode(P,{config:{labelPosition:"top"},style:{padding:"0"},ref_key:"configRef",ref:H,onChange:v},null,512)])],512),[[s.vShow,G.value&&w[G.value.data.type]]])])}}})),My={class:"d-input-flow j-block"},pl=$t(s.defineComponent({name:"DInputFlow",__name:"inputFlow",props:{modelValue:{},type:{},btnText:{default:"事件"},title:{},size:{default:"default"},width:{default:1200},height:{default:800},beforeClose:{},flowComponents:{default:()=>[]},inputParams:{default:()=>({})},flowInit:{},flowComponentConfigInit:{},flowComponentConfigs:{default:()=>({})},flowComponentConfigChange:{}},emits:["update:modelValue","change"],setup(t,{emit:e}){const n=t,o=e,i=s.ref(),r=s.computed({get(){return n.modelValue},set(f){o("update:modelValue",f)}}),a=s.computed(()=>(n.modelValue?.trim(),n.btnText)),l=f=>{const h=typeof f=="string"?f:void 0;try{i.value?.setData(JSON.parse(h||"[]"))}catch{i.value?.setData([])}},u=async()=>{const f=i.value?.getData();return f?JSON.stringify(f):void 0},c=f=>{if(n.beforeClose){const h=typeof f=="string"?f:void 0;return n.beforeClose(h)}return!0},d=f=>{const h=f.value;o("change",{value:typeof h=="string"?h:void 0})};return(f,h)=>{const p=s.resolveComponent("d-flow-design"),y=s.resolveComponent("j-input-button");return s.openBlock(),s.createBlock(y,s.mergeProps(f.$attrs,{type:t.type,"btn-text":a.value,title:t.title,size:t.size,width:t.width,height:t.height,"before-close":c,ok:u,open:l,"destroy-on-close":"",modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=m=>r.value=m),onChange:d}),{default:s.withCtx(()=>[s.createElementVNode("div",My,[s.createVNode(p,{ref_key:"flowRef",ref:i,components:t.flowComponents,"flow-init":t.flowInit,"flow-component-config-init":t.flowComponentConfigInit,"flow-component-configs":t.flowComponentConfigs,"flow-component-config-change":t.flowComponentConfigChange,"input-params":t.inputParams},null,8,["components","flow-init","flow-component-config-init","flow-component-configs","flow-component-config-change","input-params"])])]),_:1},16,["type","btn-text","title","size","width","height","modelValue"])}}}));class J{static getElements(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(o&&!isNaN(+e[0])){const r=o.getElementById(e);return r?[r]:[]}let i=n.querySelectorAll(e);if(!i.length&&e[0]!=="."&&e[0]!=="#"&&(i=n.querySelectorAll("."+e),i.length||(i=n.querySelectorAll("#"+e)),!i.length)){const r=n.querySelector(`[gs-id="${e}"]`);return r?[r]:[]}return Array.from(i)}return[e]}static getElement(e,n=document){if(typeof e=="string"){const o="getElementById"in n?n:void 0;if(!e.length)return null;if(o&&e[0]==="#")return o.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return n.querySelector(e);if(o&&!isNaN(+e[0]))return o.getElementById(e);let i=n.querySelector(e);return o&&!i&&(i=o.getElementById(e)),i||(i=n.querySelector("."+e)),i}return e}static lazyLoad(e){return e.lazyLoad||e.grid?.opts?.lazyLoad&&e.lazyLoad!==!1}static createDiv(e,n){const o=document.createElement("div");return e.forEach(i=>{i&&o.classList.add(i)}),n?.appendChild(o),o}static shouldSizeToContent(e,n=!1){return e?.grid&&(n?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,n){return!(e.y>=n.y+n.h||e.y+e.h<=n.y||e.x+e.w<=n.x||e.x>=n.x+n.w)}static isTouching(e,n){return J.isIntercepted(e,{x:n.x-.5,y:n.y-.5,w:n.w+1,h:n.h+1})}static areaIntercept(e,n){const o=e.x>n.x?e.x:n.x,i=e.x+e.w<n.x+n.w?e.x+e.w:n.x+n.w;if(i<=o)return 0;const r=e.y>n.y?e.y:n.y,a=e.y+e.h<n.y+n.h?e.y+e.h:n.y+n.h;return a<=r?0:(i-o)*(a-r)}static area(e){return e.w*e.h}static sort(e,n=1){return e.sort((i,r)=>{const a=n*((i.y??1e4)-(r.y??1e4));return a===0?n*((i.x??1e4)-(r.x??1e4)):a})}static find(e,n){return n?e.find(o=>o.id===n):void 0}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let n,o="px";if(typeof e=="string")if(e==="auto"||e==="")n=0;else{const i=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!i)throw new Error(`Invalid height val = ${e}`);o=i[2]||"px",n=parseFloat(i[1])}else n=e;return{h:n,unit:o}}static defaults(e,...n){return n.forEach(o=>{for(const i in o){if(!o.hasOwnProperty(i))return;e[i]===null||e[i]===void 0?e[i]=o[i]:typeof o[i]=="object"&&typeof e[i]=="object"&&J.defaults(e[i],o[i])}}),e}static same(e,n){if(typeof e!="object")return e==n;if(typeof e!=typeof n||Object.keys(e).length!==Object.keys(n).length)return!1;for(const o in e)if(e[o]!==n[o])return!1;return!0}static copyPos(e,n,o=!1){return n.x!==void 0&&(e.x=n.x),n.y!==void 0&&(e.y=n.y),n.w!==void 0&&(e.w=n.w),n.h!==void 0&&(e.h=n.h),o&&(n.minW&&(e.minW=n.minW),n.minH&&(e.minH=n.minH),n.maxW&&(e.maxW=n.maxW),n.maxH&&(e.maxH=n.maxH)),e}static samePos(e,n){return e&&n&&e.x===n.x&&e.y===n.y&&(e.w||1)===(n.w||1)&&(e.h||1)===(n.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,n){if(!(typeof e!="object"||typeof n!="object")&&!(Array.isArray(e)||Array.isArray(n)))for(let o in e){const i=e[o],r=n[o];o[0]==="_"||i===r?delete e[o]:i&&typeof i=="object"&&r!==void 0&&(J.removeInternalAndSame(i,r),Object.keys(i).length||delete e[o])}}static removeInternalForSave(e,n=!0){for(let o in e)(o[0]==="_"||e[o]===null||e[o]===void 0)&&delete e[o];delete e.grid,n&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,n){let o=!1;return(...i)=>{o||(o=!0,setTimeout(()=>{e(...i),o=!1},n))}}static removePositioningStyles(e){const n=e.style;n.position&&n.removeProperty("position"),n.left&&n.removeProperty("left"),n.top&&n.removeProperty("top"),n.width&&n.removeProperty("width"),n.height&&n.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;const n=getComputedStyle(e);return/(auto|scroll)/.test(n.overflow+n.overflowY)?e:J.getScrollElement(e.parentElement)}static updateScrollPosition(e,n,o){const i=J.getScrollElement(e);if(!i)return;const r=e.getBoundingClientRect(),a=i.getBoundingClientRect(),l=window.innerHeight||document.documentElement.clientHeight,u=r.bottom-Math.min(a.bottom,l),c=r.top-Math.max(a.top,0),d=i.scrollTop;c<0&&o<0?e.offsetHeight>a.height?i.scrollTop+=o:i.scrollTop+=Math.abs(c)>Math.abs(o)?o:c:u>0&&o>0&&(e.offsetHeight>a.height?i.scrollTop+=o:i.scrollTop+=u>o?o:u),n.top+=i.scrollTop-d}static updateScrollResize(e,n,o){const i=J.getScrollElement(n),r=i.clientHeight,a=i===J.getScrollElement()?0:i.getBoundingClientRect().top,l=e.clientY-a,u=l<o,c=l>r-o;u?i.scrollBy({behavior:"smooth",top:l-o}):c&&i.scrollBy({behavior:"smooth",top:o-(r-l)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:{...e}}static cloneDeep(e){const n=["parentGrid","el","grid","subGrid","engine"],o=J.clone(e);for(const i in o)o.hasOwnProperty(i)&&typeof o[i]=="object"&&i.substring(0,2)!=="__"&&!n.find(r=>r===i)&&(o[i]=J.cloneDeep(e[i]));return o}static cloneNode(e){const n=e.cloneNode(!0);return n.removeAttribute("id"),n}static appendTo(e,n){let o;typeof n=="string"?o=J.getElement(n):o=n,o&&o.appendChild(e)}static addElStyles(e,n){if(n instanceof Object)for(const o in n)n.hasOwnProperty(o)&&(Array.isArray(n[o])?n[o].forEach(i=>{e.style[o]=i}):e.style[o]=n[o])}static initEvent(e,n){const o={type:n.type},i={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:n.target?n.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(r=>o[r]=e[r]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(r=>o[r]=e[r]),{...o,...i}}static simulateMouseEvent(e,n,o){const i=e,r=new MouseEvent(n,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,ctrlKey:i.ctrlKey??!1,altKey:i.altKey??!1,shiftKey:i.shiftKey??!1,metaKey:i.metaKey??!1,button:0,relatedTarget:e.target});(o||e.target).dispatchEvent(r)}static getValuesFromTransformedElement(e){const n=document.createElement("div");J.addElStyles(n,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(n);const o=n.getBoundingClientRect();return e.removeChild(n),n.remove(),{xScale:1/o.width,yScale:1/o.height,xOffset:o.left,yOffset:o.top}}static swap(e,n,o){if(!e)return;const i=e[n];e[n]=e[o],e[o]=i}static canBeRotated(e){return!(!e||e.w===e.h||e.locked||e.noResize||e.grid?.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}}class vt{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,n=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,n&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,n){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||n.y<=e.y)}_fixCollisions(e,n=e,o,i={}){if(this.sortNodes(-1),o=o||this.collide(e,n),!o)return!1;if(e._moving&&!i.nested&&!this.float&&this.swap(e,o))return!0;let r=n;!this._loading&&this._useEntireRowArea(e,n)&&(r={x:0,w:this.column,y:n.y,h:n.h},o=this.collide(e,r,i.skip));let a=!1;const l={nested:!0,pack:!1};let u=0;for(;o=o||this.collide(e,r,i.skip);){if(u++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(o.locked||this._loading||e._moving&&!e._skipDown&&n.y>e.y&&!this.float&&(!this.collide(o,{...o,y:e.y},e)||!this.collide(o,{...o,y:n.y-o.h},e))){e._skipDown=e._skipDown||n.y>e.y;const d={...n,y:o.y+o.h,...l};c=this._loading&&J.samePos(e,d)?!0:this.moveNode(e,d),(o.locked||this._loading)&&c?J.copyPos(n,e):!o.locked&&c&&i.pack&&(this._packNodes(),n.y=o.y+o.h,J.copyPos(e,n)),a=a||c}else c=this.moveNode(o,{...o,y:n.y+n.h,skip:e,...l});if(!c)return a;o=void 0}return a}collide(e,n=e,o){const i=e._id,r=o?._id;return this.nodes.find(a=>a._id!==i&&a._id!==r&&J.isIntercepted(a,n))}collideAll(e,n=e,o){const i=e._id,r=o?._id;return this.nodes.filter(a=>a._id!==i&&a._id!==r&&J.isIntercepted(a,n))}directionCollideCoverage(e,n,o){if(!n.rect||!e._rect)return;const i=e._rect,r={...n.rect};r.y>i.y?(r.h+=r.y-i.y,r.y=i.y):r.h+=i.y-r.y,r.x>i.x?(r.w+=r.x-i.x,r.x=i.x):r.w+=i.x-r.x;let a,l=.5;for(let u of o){if(u.locked||!u._rect)break;const c=u._rect;let d=Number.MAX_VALUE,f=Number.MAX_VALUE;i.y<c.y?d=(r.y+r.h-c.y)/c.h:i.y+i.h>c.y+c.h&&(d=(c.y+c.h-r.y)/c.h),i.x<c.x?f=(r.x+r.w-c.x)/c.w:i.x+i.w>c.x+c.w&&(f=(c.x+c.w-r.x)/c.w);const h=Math.min(f,d);h>l&&(l=h,a=u)}return n.collide=a,a}cacheRects(e,n,o,i,r,a){return this.nodes.forEach(l=>l._rect={y:l.y*n+o,x:l.x*e+a,w:l.w*e-a-i,h:l.h*n-o-r}),this}swap(e,n){if(!n||n.locked||!e||e.locked)return!1;function o(){const r=n.x,a=n.y;return n.x=e.x,n.y=e.y,e.h!=n.h?(e.x=r,e.y=n.y+n.h):e.w!=n.w?(e.x=n.x+n.w,e.y=a):(e.x=r,e.y=a),e._dirty=n._dirty=!0,!0}let i;if(e.w===n.w&&e.h===n.h&&(e.x===n.x||e.y===n.y)&&(i=J.isTouching(e,n)))return o();if(i!==!1){if(e.w===n.w&&e.x===n.x&&(i||(i=J.isTouching(e,n)))){if(n.y<e.y){const r=e;e=n,n=r}return o()}if(i!==!1){if(e.h===n.h&&e.y===n.y&&(i||(i=J.isTouching(e,n)))){if(n.x<e.x){const r=e;e=n,n=r}return o()}return!1}}}isAreaEmpty(e,n,o,i){const r={x:e||0,y:n||0,w:o||1,h:i||1};return!this.collide(r)}compact(e="compact",n=!0){if(this.nodes.length===0)return this;n&&this.sortNodes();const o=this.batchMode;o||this.batchUpdate();const i=this._inColumnResize;i||(this._inColumnResize=!0);const r=this.nodes;return this.nodes=[],r.forEach((a,l,u)=>{let c;a.locked||(a.autoPosition=!0,e==="list"&&l&&(c=u[l-1])),this.addNode(a,!1,c)}),i||delete this._inColumnResize,o||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=J.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let n=e.y;for(;n>e._orig.y;)--n,this.collide(e,{x:e.x,y:n,w:e.w,h:e.h})||(e._dirty=!0,e.y=n)}):this.nodes.forEach((e,n)=>{if(!e.locked)for(;e.y>0;){const o=n===0?0:e.y-1;if(!(n===0||!this.collide(e,{x:e.x,y:o,w:e.w,h:e.h})))break;e._dirty=e.y!==o,e.y=o}}),this)}prepareNode(e,n){e._id=e._id??vt._idSeq++;const o=e.id;if(o){let r=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=o+"_"+r++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);const i={x:0,y:0,w:1,h:1};return J.defaults(e,i),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,J.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=i.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=i.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=i.w),isNaN(e.h)&&(e.h=i.h),this.nodeBoundFix(e,n),e}nodeBoundFix(e,n){const o=e._orig||J.copyPos({},e);if(e.maxW&&(e.w=Math.min(e.w||1,e.maxW)),e.maxH&&(e.h=Math.min(e.h||1,e.maxH)),e.minW&&(e.w=Math.max(e.w||1,e.minW)),e.minH&&(e.h=Math.max(e.h||1,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.column<this.defaultColumn&&!this._inColumnResize&&!this.skipCacheUpdate&&e._id!=null&&this.findCacheLayout(e,this.defaultColumn)===-1){const r={...e};r.autoPosition||r.x===void 0?(delete r.x,delete r.y):r.x=Math.min(this.defaultColumn-1,r.x),r.w=Math.min(this.defaultColumn,r.w||1),this.cacheOneLayout(r,this.defaultColumn)}return e.w>this.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(n?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(n?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),J.samePos(e,o)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(n=>n._dirty&&!J.samePos(n,n._orig)):this.nodes.filter(n=>n._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;const n=(e||[]).concat(this.getDirtyNodes());return this.onChange(n),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=J.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||J.samePos(e,e._orig)||(J.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,n=this.nodes,o=this.column,i){const r=i?i.y*o+(i.x+i.w):0;let a=!1;for(let l=r;!a;++l){const u=l%o,c=Math.floor(l/o);if(u+e.w>o)continue;const d={x:u,y:c,w:e.w,h:e.h};n.find(f=>J.isIntercepted(d,f))||((e.x!==u||e.y!==c)&&(e._dirty=!0),e.x=u,e.y=c,delete e.autoPosition,a=!0)}return a}addNode(e,n=!1,o){const i=this.nodes.find(a=>a._id===e._id);if(i)return i;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let r;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,o)&&(delete e.autoPosition,r=!0),this.nodes.push(e),n&&this.addedNodes.push(e),r||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,n=!0,o=!1){return this.nodes.find(i=>i._id===e._id)?(o&&this.removedNodes.push(e),n&&(e._removeDOM=!0),this.nodes=this.nodes.filter(i=>i._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,n=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(i=>i._removeDOM=!0);const o=this.nodes;return this.removedNodes=n?o:[],this.nodes=[],this._notify(o)}moveNodeCheck(e,n){if(!this.changedPosConstrain(e,n))return!1;if(n.pack=!0,!this.maxRow)return this.moveNode(e,n);let o;const i=new vt({column:this.column,float:this.float,nodes:this.nodes.map(a=>a._id===e._id?(o={...a},o):{...a})});if(!o)return!1;const r=i.moveNode(o,n)&&i.getRow()<=Math.max(this.getRow(),this.maxRow);if(!r&&!n.resizing&&n.collide){const a=n.collide.el.gridstackNode;if(this.swap(e,a))return this._notify(),!0}return r?(i.nodes.filter(a=>a._dirty).forEach(a=>{const l=this.nodes.find(u=>u._id===a._id);l&&(J.copyPos(l,a),l._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;const n=new vt({column:this.column,float:this.float,nodes:this.nodes.map(i=>({...i}))}),o={...e};return this.cleanupNode(o),delete o.el,delete o._id,delete o.content,delete o.grid,n.addNode(o),n.getRow()<=this.maxRow?(e._willFitPos=J.copyPos({},o),!0):!1}changedPosConstrain(e,n){return n.w=n.w||e.w,n.h=n.h||e.h,e.x!==n.x||e.y!==n.y?!0:(e.maxW&&(n.w=Math.min(n.w,e.maxW)),e.maxH&&(n.h=Math.min(n.h,e.maxH)),e.minW&&(n.w=Math.max(n.w,e.minW)),e.minH&&(n.h=Math.max(n.h,e.minH)),e.w!==n.w||e.h!==n.h)}moveNode(e,n){if(!e||!n)return!1;let o;n.pack===void 0&&!this.batchMode&&(o=n.pack=!0),typeof n.x!="number"&&(n.x=e.x),typeof n.y!="number"&&(n.y=e.y),typeof n.w!="number"&&(n.w=e.w),typeof n.h!="number"&&(n.h=e.h);const i=e.w!==n.w||e.h!==n.h,r=J.copyPos({},e,!0);if(J.copyPos(r,n),this.nodeBoundFix(r,i),J.copyPos(n,r),!n.forceCollide&&J.samePos(e,n))return!1;const a=J.copyPos({},e),l=this.collideAll(e,r,n.skip);let u=!0;if(l.length){const c=e._moving&&!n.nested;let d=c?this.directionCollideCoverage(e,n,l):l[0];if(c&&d&&e.grid?.opts?.subGridDynamic&&!e.grid._isTemp){const f=J.areaIntercept(n.rect,d._rect),h=J.area(n.rect),p=J.area(d._rect);f/(h<p?h:p)>.8&&(d.grid.makeSubGrid(d.el,void 0,e),d=void 0)}d?u=!this._fixCollisions(e,r,d,n):(u=!1,o&&delete n.pack)}return u&&!J.samePos(e,r)&&(e._dirty=!0,J.copyPos(e,r)),n.pack&&this._packNodes()._notify(),!J.samePos(e,a)}getRow(){return this.nodes.reduce((e,n)=>Math.max(e,n.y+n.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){const e=this.nodes.find(n=>n._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,n,o){const i=this._layouts?.length||0;let r;i&&(o?o!==this.column&&(r=this._layouts[o]):this.column!==i-1&&(r=this._layouts[i-1]));const a=[];return this.sortNodes(),this.nodes.forEach(l=>{const u=r?.find(d=>d._id===l._id),c={...l,...u||{}};J.removeInternalForSave(c,!e),n&&n(l,c),a.push(c)}),a}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((n,o)=>{if(!n||o===this.column)return this;if(o<this.column)this._layouts[o]=void 0;else{const i=o/this.column;e.forEach(r=>{if(!r._orig)return;const a=n.find(l=>l._id===r._id);a&&(a.y>=0&&r.y!==r._orig.y&&(a.y+=r.y-r._orig.y,a.y<0&&(a.y=0)),r.x!==r._orig.x&&(a.x=Math.round(r.x*i),a.x<0&&(a.x=0)),r.w!==r._orig.w&&(a.w=Math.round(r.w*i),a.w<1&&(a.w=1)))})}}),this)}columnChanged(e,n,o="moveScale"){if(!this.nodes.length||!n||e===n)return this;const i=o==="compact"||o==="list";i&&this.sortNodes(1),n<e&&this.cacheLayout(this.nodes,e),this.batchUpdate();let r=[],a=i?this.nodes:J.sort(this.nodes,-1);if(n>e&&this._layouts){const l=this._layouts[n]||[],u=this._layouts.length-1;!l.length&&e!==u&&this._layouts[u]?.length&&(e=u,this._layouts[u].forEach(c=>{const d=a.find(f=>f._id===c._id);d&&(!i&&!c.autoPosition&&(d.x=c.x??d.x,d.y=c.y??d.y),d.w=c.w??d.w,(c.x==null||c.y===void 0)&&(d.autoPosition=!0))})),l.forEach(c=>{const d=a.findIndex(f=>f._id===c._id);if(d!==-1){const f=a[d];if(i){f.w=c.w;return}(c.autoPosition||isNaN(c.x)||isNaN(c.y))&&this.findEmptyPosition(c,r),c.autoPosition||(f.x=c.x??f.x,f.y=c.y??f.y,f.w=c.w??f.w,r.push(f)),a.splice(d,1)}})}if(i)this.compact(o,!1);else{if(a.length)if(typeof o=="function")o(n,e,r,a);else{const l=i||o==="none"?1:n/e,u=o==="move"||o==="moveScale",c=o==="scale"||o==="moveScale";a.forEach(d=>{d.x=n===1?0:u?Math.round(d.x*l):Math.min(d.x,n-1),d.w=n===1||e===1?1:c?Math.round(d.w*l)||1:Math.min(d.w,n),r.push(d)}),a=[]}r=J.sort(r,-1),this._inColumnResize=!0,this.nodes=[],r.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!i),delete this._inColumnResize,this}cacheLayout(e,n,o=!1){const i=[];return e.forEach((r,a)=>{if(r._id===void 0){const l=r.id?this.nodes.find(u=>u.id===r.id):void 0;r._id=l?._id??vt._idSeq++}i[a]={x:r.x,y:r.y,w:r.w,_id:r._id}}),this._layouts=o?[]:this._layouts||[],this._layouts[n]=i,this}cacheOneLayout(e,n){e._id=e._id??vt._idSeq++;const o={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete o.x,delete o.y,e.autoPosition&&(o.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[n]=this._layouts[n]||[];const i=this.findCacheLayout(e,n);return i===-1?this._layouts[n].push(o):this._layouts[n][i]=o,this}findCacheLayout(e,n){return this._layouts?.[n]?.findIndex(o=>o._id===e._id)??-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let n=0;n<this._layouts.length;n++){const o=this.findCacheLayout(e,n);o!==-1&&this._layouts[n].splice(o,1)}}cleanupNode(e){for(const n in e)n[0]==="_"&&n!=="_id"&&delete e[n];return this}}vt._idSeq=0;const Ge={alwaysShowResizeHandle:"mobile",animate:!0,auto:!0,cellHeight:"auto",cellHeightThrottle:100,cellHeightUnit:"px",column:12,draggable:{handle:".grid-stack-item-content",appendTo:"body",scroll:!0},handle:".grid-stack-item-content",itemClass:"grid-stack-item",margin:10,marginUnit:"px",maxRow:0,minRow:0,placeholderClass:"grid-stack-placeholder",placeholderText:"",removableOptions:{accept:"grid-stack-item",decline:"grid-stack-non-removable"},resizable:{handles:"se"},rtl:"auto"};class he{}const tt=typeof window<"u"&&typeof document<"u"&&("ontouchstart"in document||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0);class We{}function Po(t,e){t.touches.length>1||(t.cancelable&&t.preventDefault(),J.simulateMouseEvent(t.changedTouches[0],e))}function gl(t,e){t.cancelable&&t.preventDefault(),J.simulateMouseEvent(t,e)}function Oo(t){We.touchHandled||(We.touchHandled=!0,Po(t,"mousedown"))}function Ro(t){We.touchHandled&&Po(t,"mousemove")}function Ho(t){if(!We.touchHandled)return;We.pointerLeaveTimeout&&(window.clearTimeout(We.pointerLeaveTimeout),delete We.pointerLeaveTimeout);const e=!!he.dragElement;Po(t,"mouseup"),e||Po(t,"click"),We.touchHandled=!1}function Vo(t){t.pointerType!=="mouse"&&t.target.releasePointerCapture(t.pointerId)}function ml(t){he.dragElement&&t.pointerType!=="mouse"&&gl(t,"mouseenter")}function yl(t){he.dragElement&&t.pointerType!=="mouse"&&(We.pointerLeaveTimeout=window.setTimeout(()=>{delete We.pointerLeaveTimeout,gl(t,"mouseleave")},10))}class Lo{constructor(e,n,o){this.host=e,this.dir=n,this.option=o,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){if(this.option.element)try{this.el=this.option.element instanceof HTMLElement?this.option.element:this.host.querySelector(this.option.element)}catch(e){this.option.element=void 0,console.error("Query for resizeable handle failed, falling back",e)}return this.el||(this.el=document.createElement("div"),this.host.appendChild(this.el)),this.el.classList.add("ui-resizable-handle"),this.el.classList.add(`${Lo.prefix}${this.dir}`),this.el.style.zIndex="100",this.el.style.userSelect="none",this.el.addEventListener("mousedown",this._mouseDown),tt&&(this.el.addEventListener("touchstart",Oo),this.el.addEventListener("pointerdown",Vo)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),tt&&(this.el.removeEventListener("touchstart",Oo),this.el.removeEventListener("pointerdown",Vo)),this.option.element||this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),tt&&(this.el.addEventListener("touchmove",Ro),this.el.addEventListener("touchend",Ho)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){const n=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),tt&&(this.el.removeEventListener("touchmove",Ro),this.el.removeEventListener("touchend",Ho)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){e.key==="Escape"&&(this.host.gridstackNode?.grid?.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,n){return this.option[e]&&this.option[e](n),this}}Lo.prefix="ui-resizable-";class mr{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,n){this._eventRegister[e]=n}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,n){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](n)}}class Pn extends mr{constructor(e,n={}){super(),this.el=e,this.option=n,this.rectScale={x:1,y:1},this._ui=()=>{const i=this.el.parentElement.getBoundingClientRect(),r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},a=this.temporalRect||r;return{position:{left:(a.left-i.left)*this.rectScale.x,top:(a.top-i.top)*this.rectScale.y},size:{width:a.width*this.rectScale.x,height:a.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){const n=e.handles&&e.handles!==this.option.handles,o=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(i=>this.option[i]=e[i]),n&&(this._removeHandlers(),this._setupHandlers()),o&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),he.overResizeElement===this&&delete he.overResizeElement),this}_mouseOver(e){he.overResizeElement||he.dragElement||(he.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){he.overResizeElement===this&&(delete he.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new Lo(this.el,e,{element:this.option.element,start:n=>this._resizeStart(n),stop:n=>this._resizeStop(n),move:n=>this._resizing(n,e)})),this}_resizeStart(e){this.sizeToContent=J.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=J.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();const n=J.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(n,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",n),this}_resizing(e,n){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,n),this._applyChange();const o=J.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(o,this._ui()),this.triggerEvent("resize",o),this}_resizeStop(e){const n=J.initEvent(e,{type:"resizestop",target:this.el});return this._cleanHelper(),this.option.stop&&this.option.stop(n),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",n),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=Pn._originStyleProp.map(o=>this.el.style[o]),this.parentOriginStylePosition=this.el.parentElement.style.position;const e=this.el.parentElement,n=J.getValuesFromTransformedElement(e);return this.rectScale={x:n.xScale,y:n.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return Pn._originStyleProp.forEach((e,n)=>{this.el.style[e]=this.elOriginStyleVal[n]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,n){const o=this.startEvent,i={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},r=e.clientX-o.clientX,a=this.sizeToContent?0:e.clientY-o.clientY;let l,u;n.indexOf("e")>-1?i.width+=r:n.indexOf("w")>-1&&(i.width-=r,i.left+=r,l=!0),n.indexOf("s")>-1?i.height+=a:n.indexOf("n")>-1&&(i.height-=a,i.top+=a,u=!0);const c=this._constrainSize(i.width,i.height,l,u);return Math.round(i.width)!==Math.round(c.width)&&(n.indexOf("w")>-1&&(i.left+=i.width-c.width),i.width=c.width),Math.round(i.height)!==Math.round(c.height)&&(n.indexOf("n")>-1&&(i.top+=i.height-c.height),i.height=c.height),i}_constrainSize(e,n,o,i){const r=this.option,a=(o?r.maxWidthMoveLeft:r.maxWidth)||Number.MAX_SAFE_INTEGER,l=r.minWidth/this.rectScale.x||e,u=(i?r.maxHeightMoveUp:r.maxHeight)||Number.MAX_SAFE_INTEGER,c=r.minHeight/this.rectScale.y||n,d=Math.min(a,Math.max(l,e)),f=Math.min(u,Math.max(c,n));return{width:d,height:f}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){const n=this.el.parentElement,{left:o,top:i}=n.getBoundingClientRect();e={left:o,top:i,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(n=>{const o=this.temporalRect[n],i=n==="width"||n==="left"?this.rectScale.x:n==="height"||n==="top"?this.rectScale.y:1;this.el.style[n]=(o-e[n])*i+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}}Pn._originStyleProp=["width","height","position","left","top","opacity","zIndex"];const By='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle';class On extends mr{constructor(e,n={}){super(),this.el=e,this.option=n,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};const o=n?.handle?.substring(1),i=e.gridstackNode;this.dragEls=!o||e.classList.contains(o)?[e]:i?.subGrid?[e.querySelector(n.handle)||e]:Array.from(e.querySelectorAll(n.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),tt&&(e.addEventListener("touchstart",Oo),e.addEventListener("pointerdown",Vo))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(n=>{n.removeEventListener("mousedown",this._mouseDown),tt&&(n.removeEventListener("touchstart",Oo),n.removeEventListener("pointerdown",Vo))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this}_mouseDown(e){if(We.touchHandled&&e.isTrusted&&(We.touchHandled=!1),!he.mouseHandled)return e.button!==0||!this.dragEls.find(n=>n===e.target)&&e.target.closest(By)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete he.dragElement,delete he.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),tt&&(e.currentTarget.addEventListener("touchmove",Ro),e.currentTarget.addEventListener("touchend",Ho)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),he.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;const n=J.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(n,this.ui()),this.triggerEvent("drag",n)}_mouseMove(e){const n=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),he.pauseDrag){const o=Number.isInteger(he.pauseDrag)?he.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),o)}else this._callDrag(e);else if(Math.abs(e.x-n.x)+Math.abs(e.y-n.y)>3){this.dragging=!0,he.dragElement=this;const o=this.el.gridstackNode?.grid;o?he.dropElement=o.el.ddElement.ddDroppable:delete he.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=J.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);const i=J.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(i,this.ui()),this.triggerEvent("dragstart",i),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),tt&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",Ro,!0),e.currentTarget.removeEventListener("touchend",Ho,!0)),this.dragging){delete this.dragging,delete this.el.gridstackNode?._origRotate,document.removeEventListener("keydown",this._keyEvent),he.dropElement?.el===this.el.parentElement&&delete he.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();const n=J.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(n),this.triggerEvent("dragstop",n),he.dropElement&&he.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete he.dragElement,delete he.dropElement,delete he.mouseHandled,e.preventDefault()}_keyEvent(e){const n=this.el.gridstackNode,o=n?.grid||he.dropElement?.el?.gridstack;if(e.key==="Escape")n&&n._origRotate&&(n._orig=n._origRotate,delete n._origRotate),o?.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(n&&o&&(e.key==="r"||e.key==="R")){if(!J.canBeRotated(n))return;n._origRotate=n._origRotate||{...n._orig},delete n._moving,o.setAnimation(!1).rotate(n.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),n._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,n.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",J.swap(n._orig,"w","h"),delete n._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=J.cloneNode(this.el)),e.parentElement||J.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=On.originStyleProp.map(n=>this.el.style[n]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.add("grid-stack-dragging");const n=this.helper.style;return n.pointerEvents="none",n.width=this.dragOffset.width+"px",n.height=this.dragOffset.height+"px",n.willChange="left, top",n.position="fixed",this._dragFollow(e),n.transition="none",setTimeout(()=>{this.helper&&(n.transition=null)},0),this}_removeHelperStyle(){if(this.helper.classList.remove("ui-draggable-dragging"),this.el.gridstackNode?.grid?.el.classList.remove("grid-stack-dragging"),!this.helper?.gridstackNode?._isAboutToRemove&&this.dragElementOriginStyle){const n=this.helper,o=this.dragElementOriginStyle.transition||null;n.style.transition=this.dragElementOriginStyle.transition="none",On.originStyleProp.forEach(i=>n.style[i]=this.dragElementOriginStyle[i]||null),setTimeout(()=>n.style.transition=o,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){const n={left:0,top:0},o=this.helper.style,i=this.dragOffset;o.left=(e.clientX+i.offsetLeft-n.left)*this.dragTransform.xScale+"px",o.top=(e.clientY+i.offsetTop-n.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,n,o){let i=0,r=0;o&&(i=this.dragTransform.xOffset,r=this.dragTransform.yOffset);const a=n.getBoundingClientRect();return{left:a.left,top:a.top,offsetLeft:-e.clientX+a.left-i,offsetTop:-e.clientY+a.top-r,width:a.width*this.dragTransform.xScale,height:a.height*this.dragTransform.yScale}}ui(){const n=this.el.parentElement.getBoundingClientRect(),o=this.helper.getBoundingClientRect();return{position:{top:(o.top-n.top)*this.dragTransform.yScale,left:(o.left-n.left)*this.dragTransform.xScale}}}}On.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];class $y extends mr{constructor(e,n={}){super(),this.el=e,this.option=n,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,n){super.on(e,n)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),tt&&(this.el.addEventListener("pointerenter",ml),this.el.addEventListener("pointerleave",yl)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),tt&&(this.el.removeEventListener("pointerenter",ml),this.el.removeEventListener("pointerleave",yl)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(n=>this.option[n]=e[n]),this._setupAccept(),this}_mouseEnter(e){if(!he.dragElement||We.touchHandled&&e.isTrusted||!this._canDrop(he.dragElement.el))return;e.preventDefault(),e.stopPropagation(),he.dropElement&&he.dropElement!==this&&he.dropElement._mouseLeave(e,!0),he.dropElement=this;const n=J.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(n,this._ui(he.dragElement)),this.triggerEvent("dropover",n),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,n=!1){if(!he.dragElement||he.dropElement!==this)return;e.preventDefault(),e.stopPropagation();const o=J.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(o,this._ui(he.dragElement)),this.triggerEvent("dropout",o),he.dropElement===this&&(delete he.dropElement,!n)){let i,r=this.el.parentElement;for(;!i&&r;)i=r.ddElement?.ddDroppable,r=r.parentElement;i&&i._mouseEnter(e)}}drop(e){e.preventDefault();const n=J.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(n,this._ui(he.dragElement)),this.triggerEvent("drop",n)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return{draggable:e.el,...e.ui()}}}class yr{static init(e){return e.ddElement||(e.ddElement=new yr(e)),e.ddElement}constructor(e){this.el=e}on(e,n){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,n):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,n):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,n),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new On(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new Pn(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new $y(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}}class zy{resizable(e,n,o,i){return this._getDDElements(e,n).forEach(r=>{if(n==="disable"||n==="enable")r.ddResizable&&r.ddResizable[n]();else if(n==="destroy")r.ddResizable&&r.cleanResizable();else if(n==="option")r.setupResizable({[o]:i});else{const l=r.el.gridstackNode.grid;let u=r.el.getAttribute("gs-resize-handles")||l.opts.resizable.handles||"e,s,se";u==="all"&&(u="n,e,s,w,se,sw,ne,nw");const c=!l.opts.alwaysShowResizeHandle;r.setupResizable({...l.opts.resizable,handles:u,autoHide:c,start:n.start,stop:n.stop,resize:n.resize})}}),this}draggable(e,n,o,i){return this._getDDElements(e,n).forEach(r=>{if(n==="disable"||n==="enable")r.ddDraggable&&r.ddDraggable[n]();else if(n==="destroy")r.ddDraggable&&r.cleanDraggable();else if(n==="option")r.setupDraggable({[o]:i});else{const a=r.el.gridstackNode.grid;r.setupDraggable({...a.opts.draggable,start:n.start,stop:n.stop,drag:n.drag})}}),this}dragIn(e,n){return this._getDDElements(e).forEach(o=>o.setupDraggable(n)),this}droppable(e,n,o,i){return typeof n.accept=="function"&&!n._accept&&(n._accept=n.accept,n.accept=r=>n._accept(r)),this._getDDElements(e,n).forEach(r=>{n==="disable"||n==="enable"?r.ddDroppable&&r.ddDroppable[n]():n==="destroy"?r.ddDroppable&&r.cleanDroppable():n==="option"?r.setupDroppable({[o]:i}):r.setupDroppable(n)}),this}isDroppable(e){return!!(e?.ddElement?.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){return!!(e?.ddElement?.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){return!!(e?.ddElement?.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,n,o){return this._getDDElements(e).forEach(i=>i.on(n,r=>{o(r,he.dragElement?he.dragElement.el:r.target,he.dragElement?he.dragElement.helper:null)})),this}off(e,n){return this._getDDElements(e).forEach(o=>o.off(n)),this}_getDDElements(e,n){const o=e.gridstack||n!=="destroy"&&n!=="disable",i=J.getElements(e);return i.length?i.map(a=>a.ddElement||(o?yr.init(a):null)).filter(a=>a):[]}}const Oe=new zy;class ue{static init(e={},n=".grid-stack"){if(typeof document>"u")return null;const o=ue.getGridElement(n);return o?(o.gridstack||(o.gridstack=new ue(o,J.cloneDeep(e))),o.gridstack):(console.error(typeof n=="string"?'GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
27
27
  Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},n=".grid-stack"){const o=[];return typeof document>"u"||(ue.getGridElements(n).forEach(i=>{i.gridstack||(i.gridstack=new ue(i,J.cloneDeep(e))),o.push(i.gridstack)}),o.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+n+`" - element missing or wrong selector ?
28
- Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),o}static addGrid(e,n={}){if(!e)return null;let o=e;if(o.gridstack){const s=o.gridstack;return n&&(s.opts={...s.opts,...n}),n.children!==void 0&&s.load(n.children),s}return(!e.classList.contains("grid-stack")||ue.addRemoveCB)&&(ue.addRemoveCB?o=ue.addRemoveCB(e,n,!0,!0):o=J.createDiv(["grid-stack",n.class],e)),ue.init(n,o)}static registerEngine(e){ue.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=J.createDiv([this.opts.placeholderClass,Ge.itemClass,this.opts.itemClass]);const e=J.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,n={}){this.el=e,this.opts=n,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=n=n||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),n.row&&(n.minRow=n.maxRow=n.row,delete n.row);const o=J.toNumber(e.getAttribute("gs-row"));n.column==="auto"&&delete n.column,n.alwaysShowResizeHandle!==void 0&&(n._alwaysShowResizeHandle=n.alwaysShowResizeHandle);const i=n.columnOpts;if(i){const c=i.breakpoints;!i.columnWidth&&!c?.length?delete n.columnOpts:(i.columnMax=i.columnMax||12,c?.length>1&&c.sort((d,f)=>(f.w||0)-(d.w||0)))}const r={...J.cloneDeep(Ge),column:J.toNumber(e.getAttribute("gs-column"))||Ge.column,minRow:o||J.toNumber(e.getAttribute("gs-min-row"))||Ge.minRow,maxRow:o||J.toNumber(e.getAttribute("gs-max-row"))||Ge.maxRow,staticGrid:J.toBool(e.getAttribute("gs-static"))||Ge.staticGrid,sizeToContent:J.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||Ge.draggable.handle},removableOptions:{accept:n.itemClass||Ge.removableOptions.accept,decline:Ge.removableOptions.decline}};e.getAttribute("gs-animate")&&(r.animate=J.toBool(e.getAttribute("gs-animate"))),n=J.defaults(n,r),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(n),n.rtl==="auto"&&(n.rtl=e.style.direction==="rtl"),n.rtl&&this.el.classList.add("grid-stack-rtl");const l=this.el.closest("."+Ge.itemClass)?.gridstackNode;if(l&&(l.subGrid=this,this.parentGridNode=l,this.el.classList.add("grid-stack-nested"),l.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=n.cellHeight==="auto",this._isAutoCellHeight||n.cellHeight==="initial")this.cellHeight(void 0);else{typeof n.cellHeight=="number"&&n.cellHeightUnit&&n.cellHeightUnit!==Ge.cellHeightUnit&&(n.cellHeight=n.cellHeight+n.cellHeightUnit,delete n.cellHeightUnit);const c=n.cellHeight;delete n.cellHeight,this.cellHeight(c)}n.alwaysShowResizeHandle==="mobile"&&(n.alwaysShowResizeHandle=tt),this._setStaticClass();const u=n.engineClass||ue.engineClass||vt;if(this.engine=new u({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:c=>{c.forEach(d=>{const f=d.el;f&&(d._removeDOM?(f&&f.remove(),delete d._removeDOM):this._writePosAttr(f,d))}),this._updateContainerHeight()}}),n.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(c=>this._prepareElement(c)),delete this.engine._loading,this.batchUpdate(!1)),n.children){const c=n.children;delete n.children,c.length&&this.load(c)}this.setAnimation(),n.subGridDynamic&&!he.pauseDrag&&(he.pauseDrag=!0),n.draggable?.pause!==void 0&&(he.pauseDrag=n.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let n,o=e;if(o.grid=this,o.el?n=o.el:ue.addRemoveCB?n=ue.addRemoveCB(this.el,e,!0,!1):n=this.createWidgetDivs(o),!n)return;if(o=n.gridstackNode,o&&n.parentElement===this.el&&this.engine.nodes.find(r=>r._id===o._id))return n;const i=this._readAttr(n);return J.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=J.createDiv(["grid-stack-item",this.opts.itemClass]),o=J.createDiv(["grid-stack-item-content"],n);return J.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{i.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,ue.renderCB(o,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(n))):ue.renderCB(o,e),n}makeSubGrid(e,n,o,i=!0){let r=e.gridstackNode;if(r||(r=this.makeWidget(e).gridstackNode),r.subGrid?.el)return r.subGrid;let s,l=this;for(;l&&!s;)s=l.opts?.subGridOpts,l=l.parentGridNode?.grid;n=J.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...s||{},...n||r.subGridOpts||{}}),r.subGridOpts=n;let u;n.column==="auto"&&(u=!0,n.column=Math.max(r.w||1,o?.w||1),delete n.columnOpts);let c=r.el.querySelector(".grid-stack-item-content"),d,f;if(i&&(this._removeDD(r.el),f={...r,x:0,y:0},J.removeInternalForSave(f),delete f.subGridOpts,r.content&&(f.content=r.content,delete r.content),ue.addRemoveCB?d=ue.addRemoveCB(this.el,f,!0,!1):(d=J.createDiv(["grid-stack-item"]),d.appendChild(c),c=J.createDiv(["grid-stack-item-content"],r.el)),this.prepareDragDrop(r.el)),o){const p=u?n.column:r.w,y=r.h+o.h,m=r.el.style;m.transition="none",this.update(r.el,{w:p,h:y}),setTimeout(()=>m.transition=null)}const h=r.subGrid=ue.addGrid(c,n);return o?._moving&&(h._isTemp=!0),u&&(h._autoColumn=!0),i&&h.makeWidget(d,f),o&&(o._moving?window.setTimeout(()=>J.simulateMouseEvent(o._event,"mouseenter",h.el),0):h.makeWidget(r.el,r)),this.resizeToContentCheck(!1,r),h}removeAsSubGrid(e){const n=this.parentGridNode?.grid;n&&(n.batchUpdate(),n.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,n.makeWidget(o.el,o)}),n.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>J.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,o=ue.saveCB,i){const r=this.engine.save(e,o,i);if(r.forEach(s=>{if(e&&s.el&&!s.subGrid&&!o){const l=s.el.querySelector(".grid-stack-item-content");s.content=l?.innerHTML,s.content||delete s.content}else if(!e&&!o&&delete s.content,s.subGrid?.el){const l=s.w||s.subGrid.getColumn(),u=s.subGrid.save(e,n,o,l);s.subGridOpts=n?u:{children:u},delete s.subGrid}delete s.el}),n){const s=J.cloneDeep(this.opts);s.marginBottom===s.marginTop&&s.marginRight===s.marginLeft&&s.marginTop===s.marginRight&&(s.margin=s.marginTop,delete s.marginTop,delete s.marginRight,delete s.marginBottom,delete s.marginLeft),s.rtl===(this.el.style.direction==="rtl")&&(s.rtl="auto"),this._isAutoCellHeight&&(s.cellHeight="auto"),this._autoColumn&&(s.column="auto");const l=s._alwaysShowResizeHandle;return delete s._alwaysShowResizeHandle,l!==void 0?s.alwaysShowResizeHandle=l:delete s.alwaysShowResizeHandle,J.removeInternalAndSame(s,Ge),s.children=r,s}return r}load(e,n=ue.addRemoveCB||!0){e=J.cloneDeep(e);const o=this.getColumn();e.forEach(d=>{d.w=d.w||d.minW||1,d.h=d.h||d.minH||1}),e=J.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let i=0;e.forEach(d=>{i=Math.max(i,(d.x||0)+d.w)}),i>this.engine.defaultColumn&&(this.engine.defaultColumn=i),i>o&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(i,o,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,i,!0));const r=ue.addRemoveCB;typeof n=="function"&&(ue.addRemoveCB=n);const s=[];this.batchUpdate();const l=!this.engine.nodes.length,u=l&&this.opts.animate;u&&this.setAnimation(!1),!l&&n&&[...this.engine.nodes].forEach(f=>{if(!f.id)return;J.find(e,f.id)||(ue.addRemoveCB&&ue.addRemoveCB(this.el,f,!1,!1),s.push(f),this.removeWidget(f.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(d=>J.find(e,d.id)?(c.push(d),!1):!0),e.forEach(d=>{const f=J.find(c,d.id);if(f){if(J.shouldSizeToContent(f)&&(d.h=f.h),this.engine.nodeBoundFix(d),(d.autoPosition||d.x===void 0||d.y===void 0)&&(d.w=d.w||f.w,d.h=d.h||f.h,this.engine.findEmptyPosition(d)),this.engine.nodes.push(f),J.samePos(f,d)&&this.engine.nodes.length>1&&(this.moveNode(f,{...d,forceCollide:!0}),J.copyPos(d,f)),this.update(f.el,d),d.subGridOpts?.children){const h=f.el.querySelector(".grid-stack");h&&h.gridstack&&h.gridstack.load(d.subGridOpts.children)}}else n&&this.addWidget(d)}),delete this.engine._loading,this.engine.removedNodes=s,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,r?ue.addRemoveCB=r:delete ue.addRemoveCB,u&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const n=this.el.querySelector("."+this.opts.itemClass);if(n){const i=J.toNumber(n.getAttribute("gs-h"))||1;return Math.round(n.offsetHeight/i)}const o=parseInt(this.el.getAttribute("gs-current-row"));return o?Math.round(this.el.getBoundingClientRect().height/o):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+o}const n=J.parseHeight(e);return this.opts.cellHeightUnit===n.unit&&this.opts.cellHeight===n.h?this:(this.opts.cellHeightUnit=n.unit,this.opts.cellHeight=n.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const n=this.getColumn();let o=n;const i=this._widthOrContainer(!0);if(e.columnWidth)o=Math.min(Math.round(i/e.columnWidth)||1,e.columnMax);else{o=e.columnMax;let r=0;for(;r<e.breakpoints.length&&i<=e.breakpoints[r].w;)o=e.breakpoints[r++].c||n}if(o!==n){const r=e.breakpoints?.find(s=>s.c===o);return this.column(o,r?.layout||e.layout),!0}return!1}compact(e="compact",n=!0){return this.engine.compact(e,n),this._triggerChangeEvent(),this}column(e,n="moveScale"){if(!e||e<1||this.opts.column===e)return this;const o=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+o),this._updateColumnVar(),this.engine.columnChanged(o,e,n),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=n,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,n=!1){const o=this.el.getBoundingClientRect();let i;n?i={top:o.top+document.documentElement.scrollTop,left:o.left}:i={top:this.el.offsetTop,left:this.el.offsetLeft};const r=e.left-i.left,s=e.top-i.top,l=o.width/this.getColumn(),u=o.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(r/l),y:Math.floor(s/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,n,o,i){return this.engine.isAreaEmpty(e,n,o,i)}makeWidget(e,n){const o=ue.getElement(e);if(!o||o.gridstackNode)return o;o.parentElement||this.el.appendChild(o),this._prepareElement(o,!0,n);const i=o.gridstackNode;this._updateContainerHeight(),i.subGridOpts&&this.makeSubGrid(o,i.subGridOpts,void 0,!1);let r;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(r=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),r&&delete this._ignoreLayoutsNodeChange,o}on(e,n){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.on(i,n)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=i=>n(i):this._gsEventHandler[e]=i=>{i.detail&&n(i,i.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=n:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(o=>this.off(o)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,n=!0,o=!0){return e?(ue.getElements(e).forEach(i=>{if(i.parentElement&&i.parentElement!==this.el)return;let r=i.gridstackNode;r||(r=this.engine.nodes.find(s=>i===s.el)),r&&(n&&ue.addRemoveCB&&ue.addRemoveCB(this.el,r,!1,!1),delete i.gridstackNode,this._removeDD(i),this.engine.removeNode(r,n,o),n&&i.parentElement&&i.remove())}),o&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,n=!0){return this.engine.nodes.forEach(o=>{e&&ue.addRemoveCB&&ue.addRemoveCB(this.el,o,!1,!1),delete o.el.gridstackNode,this.opts.staticGrid||this._removeDD(o.el)}),this.engine.removeAll(e,n),n&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,n){return n?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,n=!0,o=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&o&&i.subGrid.setStatic(e,n,o)}),n&&this._setStaticClass(),this)}updateOptions(e){const n=this.opts;return e===n?this:(e.acceptWidgets!==void 0&&(n.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==n.class&&(n.class&&this.el.classList.remove(n.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(n.minRow=n.maxRow=n.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(n.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(n.maxRow=e.maxRow)),e.lazyLoad!==void 0&&(n.lazyLoad=e.lazyLoad),e.children?.length&&this.load(e.children),this)}update(e,n){return ue.getElements(e).forEach(o=>{const i=o?.gridstackNode;if(!i)return;const r={...J.copyPos({},i),...J.cloneDeep(n)};this.engine.nodeBoundFix(r),delete r.autoPosition;const s=["x","y","w","h"];let l;if(s.some(d=>r[d]!==void 0&&r[d]!==i[d])&&(l={},s.forEach(d=>{l[d]=r[d]!==void 0?r[d]:i[d],delete r[d]})),!l&&(r.minW||r.minH||r.maxW||r.maxH)&&(l={}),r.content!==void 0){const d=o.querySelector(".grid-stack-item-content");d&&d.textContent!==r.content&&(i.content=r.content,ue.renderCB(d,r),i.subGrid?.el&&(d.appendChild(i.subGrid.el),i.subGrid._updateContainerHeight())),delete r.content}let u=!1,c=!1;for(const d in r)d[0]!=="_"&&i[d]!==r[d]&&(i[d]=r[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(J.sanitizeMinMax(i),l){const d=l.w!==void 0&&l.w!==i.w;this.moveNode(i,l),d&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(d,i),delete i._orig}(l||u)&&this._writeAttr(o,i),c&&this.prepareDragDrop(i.el),ue.updateCB&&ue.updateCB(i)}),this}moveNode(e,n){const o=e._updating;o||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,n),this._updateContainerHeight(),o||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const n=e.gridstackNode;if(!n)return;const o=n.grid;if(!o||e.parentElement!==o.el)return;const i=o.getCellHeight(!0);if(!i)return;let r=n.h?n.h*i:e.clientHeight,s;if(n.resizeToContentParent&&(s=e.querySelector(n.resizeToContentParent)),s||(s=e.querySelector(ue.resizeToContentParent)),!s)return;const l=e.clientHeight-s.clientHeight,u=n.h?n.h*i-l:s.clientHeight;let c;if(n.subGrid){c=n.subGrid.getRow()*n.subGrid.getCellHeight(!0);const h=n.subGrid.el.getBoundingClientRect(),p=e.getBoundingClientRect();c+=h.top-p.top}else{if(n.subGridOpts?.children?.length)return;{const h=s.firstElementChild;if(!h){console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${ue.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=h.getBoundingClientRect().height||u}}if(u===c)return;r+=c-u;let d=Math.ceil(r/i);const f=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;f&&d>f&&(d=f,e.classList.add("size-to-content-max")),n.minH&&d<n.minH?d=n.minH:n.maxH&&d>n.maxH&&(d=n.maxH),d!==n.h&&(o._ignoreLayoutsNodeChange=!0,o.moveNode(n,{h:d}),delete o._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){ue.resizeToContentCB?ue.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return ue.getElements(e).forEach(o=>{const i=o.gridstackNode;if(!J.canBeRotated(i))return;const r={w:i.h,h:i.w,minH:i.minW,minW:i.minH,maxH:i.maxW,maxW:i.maxH};if(n){const l=n.left>0?Math.floor(n.left/this.cellWidth()):0,u=n.top>0?Math.floor(n.top/this.opts.cellHeight):0;r.x=i.x+l-(i.h-(u+1)),r.y=i.y+u-l}Object.keys(r).forEach(l=>{r[l]===void 0&&delete r[l]});const s=i._orig;this.update(o,r),i._orig=s}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const o=J.parseHeight(e);if(this.opts.marginUnit===o.unit&&this.opts.margin===o.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(n=>{delete n._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,n){const o=n?new CustomEvent(e,{bubbles:!1,detail:n}):new Event(e);let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;return i.el.dispatchEvent(o),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let n=this.getRow()+this._extraDragRow;const o=this.opts.cellHeight,i=this.opts.cellHeightUnit;if(!o)return this;if(!e&&!this.opts.minRow){const r=J.parseHeight(getComputedStyle(this.el).minHeight);if(r.h>0&&r.unit===i){const s=Math.floor(r.h/o);n<s&&(n=s)}}return this.el.setAttribute("gs-current-row",String(n)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),n&&(this.el.style[e?"minHeight":"height"]=n*o+i),e&&J.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,n=!1,o){o=o||this._readAttr(e),e.gridstackNode=o,o.el=e,o.grid=this,o=this.engine.addNode(o,n),this._writeAttr(e,o),e.classList.add(Ge.itemClass,this.opts.itemClass);const i=J.shouldSizeToContent(o);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,o),J.lazyLoad(o)||this.prepareDragDrop(o.el),this}_writePosAttr(e,n){return(!n._moving&&!n._resizing||this._placeholder===e)&&(e.style.top=n.y?n.y===1?"var(--gs-cell-height)":`calc(${n.y} * var(--gs-cell-height))`:null,e.style.left=n.x?n.x===1?"var(--gs-column-width)":`calc(${n.x} * var(--gs-column-width))`:null,e.style.width=n.w>1?`calc(${n.w} * var(--gs-column-width))`:null,e.style.height=n.h>1?`calc(${n.h} * var(--gs-cell-height))`:null),e.setAttribute("gs-x",String(n.x)),e.setAttribute("gs-y",String(n.y)),n.w>1?e.setAttribute("gs-w",String(n.w)):e.removeAttribute("gs-w"),n.h>1?e.setAttribute("gs-h",String(n.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,n){if(!n)return this;this._writePosAttr(e,n);const o={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const i in o)n[i]?e.setAttribute(o[i],String(n[i])):e.removeAttribute(o[i]);return this}_readAttr(e,n=!0){const o={};o.x=J.toNumber(e.getAttribute("gs-x")),o.y=J.toNumber(e.getAttribute("gs-y")),o.w=J.toNumber(e.getAttribute("gs-w")),o.h=J.toNumber(e.getAttribute("gs-h")),o.autoPosition=J.toBool(e.getAttribute("gs-auto-position")),o.noResize=J.toBool(e.getAttribute("gs-no-resize")),o.noMove=J.toBool(e.getAttribute("gs-no-move")),o.locked=J.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?o.sizeToContent=J.toBool(i):o.sizeToContent=parseInt(i,10)),o.id=e.getAttribute("gs-id"),o.maxW=J.toNumber(e.getAttribute("gs-max-w")),o.minW=J.toNumber(e.getAttribute("gs-min-w")),o.maxH=J.toNumber(e.getAttribute("gs-max-h")),o.minH=J.toNumber(e.getAttribute("gs-min-h")),n&&(o.w===1&&e.removeAttribute("gs-w"),o.h===1&&e.removeAttribute("gs-h"),o.maxW&&e.removeAttribute("gs-max-w"),o.minW&&e.removeAttribute("gs-min-w"),o.maxH&&e.removeAttribute("gs-max-h"),o.minH&&e.removeAttribute("gs-min-h"));for(const r in o){if(!o.hasOwnProperty(r))return;!o[r]&&o[r]!==0&&r!=="sizeToContent"&&delete o[r]}return o}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let n=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),n=!0):n=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(n),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,n=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,n),this.animationDelay);if(n)J.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(o=>J.shouldSizeToContent(o))){const o=[...this.engine.nodes];this.batchUpdate(),o.forEach(i=>{J.shouldSizeToContent(i)&&this.resizeToContentCBCheck(i.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,n?[n]:this.engine.nodes)}}_updateResizeEvent(e=!1){const n=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(o=>o.sizeToContent));return!e&&n&&!this.resizeObserver?(this._sizeThrottle=J.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!n)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return J.getElement(e)}static getElements(e=".grid-stack-item"){return J.getElements(e)}static getGridElement(e){return ue.getElement(e)}static getGridElements(e){return J.getElements(e)}_initMargin(){let e,n=0,o=[];typeof this.opts.margin=="string"&&(o=this.opts.margin.split(" ")),o.length===2?(this.opts.marginTop=this.opts.marginBottom=o[0],this.opts.marginLeft=this.opts.marginRight=o[1]):o.length===4?(this.opts.marginTop=o[0],this.opts.marginRight=o[1],this.opts.marginBottom=o[2],this.opts.marginLeft=o[3]):(e=J.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,n=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(s=>{this.opts[s]===void 0?this.opts[s]=n:(e=J.parseHeight(this.opts[s]),this.opts[s]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const r=this.el.style;return r.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Oe}static setupDragIn(e,n,o,i=document){n?.pause!==void 0&&(he.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?J.getElements(e,i):e).forEach((s,l)=>{Oe.isDraggable(s)||Oe.dragIn(s,n),o?.[l]&&(s.gridstackNode=o[l])})}movable(e,n){return this.opts.staticGrid?this:(ue.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noMove:i.noMove=!0,this.prepareDragDrop(i.el))}),this)}resizable(e,n){return this.opts.staticGrid?this:(ue.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noResize:i.noResize=!0,this.prepareDragDrop(i.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableMove(e,n)}),this)}enableResize(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableResize(e,n)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&ue._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Oe.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Oe.droppable(this.el,"destroy"),this;let e,n;const o=(i,r,s)=>{s=s||r;const l=s.gridstackNode;if(!l)return;if(!l.grid?.el){s.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const h=s.getBoundingClientRect();s.style.left=h.x+(this.dragTransform.xScale-1)*(i.clientX-h.x)/this.dragTransform.xScale+"px",s.style.top=h.y+(this.dragTransform.yScale-1)*(i.clientY-h.y)/this.dragTransform.yScale+"px",s.style.transformOrigin="0px 0px"}let{top:u,left:c}=s.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;const f={position:{top:u*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/n)),l.y=Math.max(0,Math.round(u/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){Oe.off(r,"drag");return}l._willFitPos&&(J.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(s,i,f,l,n,e)}else this._dragOrResize(s,i,f,l,n,e)};return Oe.droppable(this.el,{accept:i=>{const r=i.gridstackNode||this._readAttr(i,!1);if(r?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let s=!0;if(typeof this.opts.acceptWidgets=="function")s=this.opts.acceptWidgets(i);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;s=i.matches(l)}if(s&&r&&this.opts.maxRow){const l={w:r.w,h:r.h,minW:r.minW,minH:r.minH};s=this.engine.willItFit(l)}return s}}).on(this.el,"dropover",(i,r,s)=>{let l=s?.gridstackNode||r.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(r,s),s=s||r,n=this.cellWidth(),e=this.getCellHeight(!0),!l){const d=s.getAttribute("data-gs-widget")||s.getAttribute("gridstacknode");if(d){try{l=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}s.removeAttribute("data-gs-widget"),s.removeAttribute("gridstacknode")}l||(l=this._readAttr(s)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,s.gridstackNode=l);const u=l.w||Math.round(s.offsetWidth/n)||1,c=l.h||Math.round(s.offsetHeight/e)||1;return l.grid&&l.grid!==this?(r._gridstackNodeOrig||(r._gridstackNodeOrig=l),r.gridstackNode=l={...l,w:u,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=u,l.h=c,l._temporaryRemoved=!0),ue._itemRemoving(l.el,!1),Oe.on(r,"drag",o),o(i,r,s),!1}).on(this.el,"dropout",(i,r,s)=>{const l=s?.gridstackNode||r.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(r,s),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(i,r,s)=>{const l=s?.gridstackNode||r.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const u=!!this.placeholder.parentElement,c=r!==s;this.placeholder.remove(),delete this.placeholder.gridstackNode,u&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const d=r._gridstackNodeOrig;if(delete r._gridstackNodeOrig,u&&d?.grid&&d.grid!==this){const h=d.grid;h.engine.removeNodeFromLayoutCache(d),h.engine.removedNodes.push(d),h._triggerRemoveEvent()._triggerChangeEvent(),h.parentGridNode&&!h.engine.nodes.length&&h.opts.subGridDynamic&&h.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,Oe.off(r,"drag"),s!==r?(s.remove(),r=s):r.remove(),this._removeDD(r),!u))return!1;const f=l.subGrid?.el?.gridstack;return J.copyPos(l,this._readAttr(this.placeholder)),J.removePositioningStyles(r),c&&(l.content||l.subGridOpts||ue.addRemoveCB)?(delete l.el,r=this.addWidget(l)):(this._prepareElement(r,!0,l),this.el.appendChild(r),this.resizeToContentCheck(!1,l),f&&(f.parentGridNode=l),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...i,type:"dropped"},d&&d.grid?d:void 0,l),!1}),this}static _itemRemoving(e,n){if(!e)return;const o=e?e.gridstackNode:void 0;!o?.grid||e.classList.contains(o.grid.opts.removableOptions.decline)||(n?o._isAboutToRemove=!0:delete o._isAboutToRemove,n?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Oe.isDroppable(e)&&Oe.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,o)=>ue._itemRemoving(o,!0)).on(e,"dropout",(n,o)=>ue._itemRemoving(o,!1)),this):this}prepareDragDrop(e,n=!1){const o=e?.gridstackNode;if(!o)return;const i=o.noMove||this.opts.disableDrag,r=o.noResize||this.opts.disableResize,s=this.opts.staticGrid||i&&r;if((n||s)&&(o._initDD&&(this._removeDD(e),delete o._initDD),s&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!n))return this;if(!o._initDD){let l,u;const c=(h,p)=>{this.triggerEvent(h,h.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,h,p,o,l,u)},d=(h,p)=>{this._dragOrResize(e,h,p,o,l,u)},f=h=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete o._moving,delete o._resizing,delete o._event,delete o._lastTried;const p=o.w!==o._orig.w,y=h.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(o.el=y,o._isAboutToRemove){const m=e.gridstackNode.grid;m._gsEventHandler[h.type]&&m._gsEventHandler[h.type](h,y),m.engine.nodes.push(o),m.removeWidget(e,!0,!0)}else J.removePositioningStyles(y),o._temporaryRemoved?(this._writePosAttr(y,o),this.engine.addNode(o)):this._writePosAttr(y,o),this.triggerEvent(h,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),h.type==="resizestop"&&(Number.isInteger(o.sizeToContent)&&(o.sizeToContent=o.h),this.resizeToContentCheck(p,o))}};Oe.draggable(e,{start:c,stop:f,drag:d}).resizable(e,{start:c,stop:f,resize:d}),o._initDD=!0}return Oe.draggable(e,i?"disable":"enable").resizable(e,r?"disable":"enable"),this}_onStartMoving(e,n,o,i,r,s){if(this.engine.cleanNodes().beginUpdate(i),this._writePosAttr(this.placeholder,i),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=i,i.grid?.el)this.dragTransform=J.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=J.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(i.el=this.placeholder,i._lastUiPosition=o.position,i._prevYPix=o.position.top,i._moving=n.type==="dragstart",i._resizing=n.type==="resizestart",delete i._lastTried,n.type==="dropover"&&i._temporaryRemoved&&(this.engine.addNode(i),i._moving=!0),this.engine.cacheRects(r,s,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),n.type==="resizestart"){const l=this.getColumn()-i.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-i.y;Oe.resizable(e,"option","minWidth",r*Math.min(i.minW||1,l)).resizable(e,"option","minHeight",s*Math.min(i.minH||1,u)).resizable(e,"option","maxWidth",r*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",r*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",s*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",s*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,o,i,r,s){const l={...i._orig};let u,c=this.opts.marginLeft,d=this.opts.marginRight,f=this.opts.marginTop,h=this.opts.marginBottom;const p=Math.round(s*.1),y=Math.round(r*.1);if(c=Math.min(c,y),d=Math.min(d,y),f=Math.min(f,p),h=Math.min(h,p),n.type==="drag"){if(i._temporaryRemoved)return;const v=o.position.top-i._prevYPix;i._prevYPix=o.position.top,this.opts.draggable.scroll!==!1&&J.updateScrollPosition(e,o.position,v);const N=o.position.left+(o.position.left>i._lastUiPosition.left?-d:c),_=o.position.top+(o.position.top>i._lastUiPosition.top?-h:f);l.x=Math.round(N/r),l.y=Math.round(_/s);const g=this._extraDragRow;if(this.engine.collide(i,l)){const x=this.getRow();let z=Math.max(0,l.y+i.h-x);this.opts.maxRow&&x+z>this.opts.maxRow&&(z=Math.max(0,this.opts.maxRow-x)),this._extraDragRow=z}else this._extraDragRow=0;if(this._extraDragRow!==g&&this._updateContainerHeight(),i.x===l.x&&i.y===l.y)return}else if(n.type==="resize"){if(l.x<0||(J.updateScrollResize(n,e,s),l.w=Math.round((o.size.width-c)/r),l.h=Math.round((o.size.height-f)/s),i.w===l.w&&i.h===l.h)||i._lastTried&&i._lastTried.w===l.w&&i._lastTried.h===l.h)return;const v=o.position.left+c,N=o.position.top+f;l.x=Math.round(v/r),l.y=Math.round(N/s),u=!0}i._event=n,i._lastTried=l;const m={x:o.position.left+c,y:o.position.top+f,w:(o.size?o.size.width:i.w*r)-c-d,h:(o.size?o.size.height:i.h*s)-f-h};if(this.engine.moveNodeCheck(i,{...l,cellWidth:r,cellHeight:s,rect:m,resizing:u})){i._lastUiPosition=o.position,this.engine.cacheRects(r,s,f,d,h,c),delete i._skipDown,u&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const v=n.target;i._sidebarOrig||this._writePosAttr(v,i),this.triggerEvent(n,v)}}triggerEvent(e,n){let o=this;for(;o.parentGridNode;)o=o.parentGridNode.grid;o._gsEventHandler[e.type]&&o._gsEventHandler[e.type](e,n)}_leave(e,n){n=n||e;const o=n.gridstackNode;if(!o||(n.style.transform=n.style.transformOrigin=null,Oe.off(e,"drag"),o._temporaryRemoved))return;o._temporaryRemoved=!0,this.engine.removeNode(o),o.el=o._isExternal&&n?n:e;const i=o._sidebarOrig;o._isExternal&&this.engine.cleanupNode(o),o._sidebarOrig=i,this.opts.removable===!0&&ue._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):o._isExternal&&this.engine.restoreInitial()}}ue.renderCB=(t,e)=>{t&&e?.content&&(t.textContent=e.content)},ue.resizeToContentParent=".grid-stack-item-content",ue.Utils=J,ue.Engine=vt,ue.GDRev="12.4.2";const My={class:"d-layout"},Iy=["gs-id","gs-x","gs-y","gs-w","gs-h","gs-locked","gs-no-resize","gs-no-move","gs-min-w","gs-min-h","gs-max-w","gs-max-h"],yl=Gt(a.defineComponent({name:"DLayout",__name:"layout",props:{modelValue:{default:()=>[]},column:{default:24},cellHeight:{default:60},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},disable:{type:Boolean,default:!1},animate:{type:Boolean,default:!0},float:{type:Boolean,default:!0},removable:{type:Boolean,default:!1},removableOptions:{}},emits:["update:modelValue","added","removed","changed","dragStart","dragStop","resizeStart","resizeStop"],setup(t,{expose:e,emit:n}){const o=t,i=n,r=a.ref();let s=null;const l=async()=>{r.value&&(await a.nextTick(),s&&s.destroy(!1),s=ue.init({column:o.column,cellHeight:o.cellHeight,disableDrag:!(o.draggable&&!o.disable),disableResize:!(o.resizable&&!o.disable),animate:o.animate,float:o.float,removable:o.removable,removableOptions:o.removableOptions},r.value),s.on("added",(h,p)=>{const y=p[0];if(y){const m=u(y);i("added",m),d()}}),s.on("removed",(h,p)=>{const y=p[0];if(y){const m=u(y);i("removed",m),d()}}),s.on("change",()=>{d();const p=(s?.save()||[]).map(y=>u(y));i("changed",p)}),s.on("dragstart",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("dragStart",h,m)}}),s.on("dragstop",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("dragStop",h,m)}}),s.on("resizestart",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("resizeStart",h,m)}}),s.on("resizestop",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("resizeStop",h,m)}}))},u=h=>({id:h.id||h.el?.getAttribute("gs-id")||"",x:h.x||0,y:h.y||0,w:h.w||1,h:h.h||1,locked:h.locked||!1,noResize:h.noResize||!1,noMove:h.noMove||!1,minW:h.minW,minH:h.minH,maxW:h.maxW,maxH:h.maxH}),c=async()=>{if(!s||!r.value)return;await a.nextTick();const h=s.engine.nodes;new Set(h.map(y=>y.id));const p=new Set(o.modelValue.map(y=>y.id));h.forEach(y=>{if(!p.has(y.id||"")){const m=y.el;m&&s&&s.removeWidget(m,!1)}}),o.modelValue.forEach(y=>{const m=h.find(v=>v.id===y.id);if(m)m.el&&s&&s.update(m.el,{x:y.x,y:y.y,w:y.w,h:y.h,locked:y.locked,noResize:y.noResize,noMove:y.noMove,minW:y.minW,minH:y.minH,maxW:y.maxW,maxH:y.maxH});else{if(!r.value||!s)return;const v=r.value.querySelector(`[gs-id="${y.id}"]`);v&&s.makeWidget(v)}})},d=()=>{if(!s)return;const p=s.save().map(y=>{const m={id:y.id||"",x:y.x||0,y:y.y||0,w:y.w||1,h:y.h||1},v=o.modelValue.find(N=>N.id===m.id);return v&&Object.keys(v).forEach(N=>{["id","x","y","w","h"].includes(N)||(m[N]=v[N])}),m});i("update:modelValue",p)},f=a.computed(()=>o.modelValue);return a.watch(()=>o.modelValue,async()=>{s&&(await a.nextTick(),c())},{deep:!0}),a.watch(()=>[o.column,o.cellHeight,o.draggable,o.resizable,o.disable,o.animate,o.float,o.removable],()=>{l()}),a.onMounted(()=>{l()}),a.onBeforeUnmount(()=>{s&&(s.destroy(!1),s=null)}),e({addItem:async h=>{if(s&&r.value){await a.nextTick();const p=r.value.querySelector(`[gs-id="${h.id}"]`);p&&(s.makeWidget(p),s.update(p,{x:h.x,y:h.y,w:h.w,h:h.h,locked:h.locked,noResize:h.noResize,noMove:h.noMove,minW:h.minW,minH:h.minH,maxW:h.maxW,maxH:h.maxH}))}},removeItem:h=>{if(s&&r.value){const p=r.value.querySelector(`[gs-id="${h}"]`);p&&s.removeWidget(p,!1)}},clear:()=>{s&&s.removeAll(!1)},getGrid:()=>s}),(h,p)=>(a.openBlock(),a.createElementBlock("div",My,[a.createElementVNode("div",{ref_key:"gridContainerRef",ref:r},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.value,y=>(a.openBlock(),a.createElementBlock("div",{key:y.id,"gs-id":y.id,"gs-x":y.x,"gs-y":y.y,"gs-w":y.w,"gs-h":y.h,"gs-locked":y.locked,"gs-no-resize":y.noResize,"gs-no-move":y.noMove,"gs-min-w":y.minW,"gs-min-h":y.minH,"gs-max-w":y.maxW,"gs-max-h":y.maxH,class:"d-layout-item"},[a.renderSlot(h.$slots,"item",{item:y})],8,Iy))),128))],512)]))}})),$e=(t,e="",n=!1)=>n?`${t}pt`:e?`${t}${e}`:`${t}px`,Le=(t,e=0)=>t==null||isNaN(t)?0:Number(Number(t).toFixed(e)),By=t=>t*3/4,$y=t=>t*4/3,zy=["onMousedown"],Ay={key:2,class:"d-draggable__mask"},vl=Gt(a.defineComponent({name:"DDraggable",__name:"draggable",props:{index:{},mask:{type:Boolean,default:!0},scale:{default:1},readonly:{type:Boolean,default:!1},resize:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},step:{default:1},zIndex:{default:1},isActiveBgTransparent:{type:Boolean,default:!1},left:{default:0},top:{default:0},width:{},height:{},activeFlag:{type:Boolean,default:!1},isPt:{type:Boolean,default:!1}},emits:["focus","blur","over","out"],setup(t,{expose:e,emit:n}){const o=t,i=n,r=a.ref(),s=a.ref(),l=a.ref(0),u=a.ref(0),c=a.ref(0),d=a.ref(0),f=a.ref(null),h=a.ref(!1),p=a.ref(!1),y=a.ref(!1),m=a.ref(!1),v=a.ref([{classname:"left"},{classname:"right"},{classname:"top"},{classname:"bottom"},{classname:"top-left"},{classname:"top-right"},{classname:"bottom-left"},{classname:"bottom-right"}]),N=a.computed(()=>o.scale),_=a.computed(()=>({left:$e(N.value,"",o.isPt)})),g=a.computed(()=>({left:$e(-N.value,"",o.isPt)})),x=a.computed(()=>({left:"auto",right:$e(-N.value,"",o.isPt)})),z=a.computed(()=>({top:$e(-N.value,"",o.isPt)})),$=a.computed(()=>({top:"auto",bottom:$e(-N.value,"",o.isPt)})),F=a.computed(()=>{const Z=8*N.value;return{width:$e(Z,"",o.isPt),height:$e(Z,"",o.isPt)}}),X=a.computed(()=>({fontSize:$e(16*N.value,"",o.isPt)})),Y=a.computed(()=>Object.assign((()=>{if(m.value){const Z={zIndex:9999,..._.value};return o.isActiveBgTransparent&&(m.value||p.value)&&!o.readonly&&!o.disabled&&(Z.backgroundColor="color-mix(in srgb, var(--j-color-primary-bg) 60%, transparent)"),Z}return{zIndex:o.zIndex}})(),{top:$e(d.value,"",o.isPt),width:$e(l.value,"",o.isPt),height:$e(u.value,"",o.isPt),padding:$e(8*N.value,"",o.isPt),..._.value,left:$e(c.value,"",o.isPt)}));a.watch(()=>o.width,Z=>{l.value=Le(I(Z))||(f.value?.offsetWidth??0)}),a.watch(()=>o.height,Z=>{u.value=Le(I(Z))||(f.value?.offsetHeight??0)},{deep:!0}),a.watch(()=>o.left,Z=>{c.value=Le(I(Z))}),a.watch(()=>o.top,Z=>{d.value=Le(I(Z))}),a.watch(l,Z=>{r.value&&(r.value.style.width=$e(Z,"",o.isPt),o.resize&&f.value?.style&&(f.value.style.width=$e(Z,"",o.isPt)))}),a.watch(u,Z=>{r.value&&(r.value.style.height=$e(Z,"",o.isPt),o.resize&&f.value?.style&&(f.value.style.height=$e(Z,"",o.isPt)))}),a.watch(()=>o.activeFlag,Z=>{S(Z)});const S=Z=>{m.value=Z},I=Z=>Z===void 0?0:o.isPt?$y(Z):Z,C=()=>{s.value&&s.value.firstChild&&(f.value=s.value.firstChild,l.value=Le(I(o.width))||(f.value?.offsetWidth??0),u.value=Le(I(o.height))||(f.value?.offsetHeight??0),c.value=Le(I(o.left)),d.value=Le(I(o.top)),S(o.activeFlag))},H=Z=>{c.value=Z},w=Z=>{d.value=Z},k=Z=>{const Q=8*N.value/2,q={};return Z.split("-").forEach(re=>{q[re]=$e(-Q,"",o.isPt)}),q},b=Z=>{p.value=Z},E=Z=>o.isPt?By(Z):Z,T=()=>{h.value=!0,i("focus",{index:o.index,width:E(l.value),height:E(u.value),left:E(c.value),top:E(d.value)})},O=()=>{h.value=!1,y.value=!1,i("blur",{index:o.index,width:E(l.value),height:E(u.value),left:E(c.value),top:E(d.value)})},R=()=>{document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,O()}},B=(Z,Q)=>{if(o.disabled||o.readonly)return;let q,ee,re,oe,ce,ie;y.value=!0,T();let ae=Z.clientX,A=Z.clientY;document.onmousemove=M=>{h.value=!0,Q==="right"?(q=!0,ee=!1):Q==="left"?(q=!0,re=!0,ce=!0,ee=!1):Q==="top"?(q=!1,ee=!0,oe=!0,ie=!0):Q==="bottom"?(q=!1,ee=!0):Q==="bottom-right"?(q=!0,ee=!0):Q==="bottom-left"?(q=!0,ee=!0,re=!0,ce=!0):Q==="top-right"?(q=!0,ee=!0,oe=!0,ie=!0):Q==="top-left"&&(q=!0,ee=!0,re=!0,ce=!0,oe=!0,ie=!0);const L=M.clientX-ae,U=M.clientY-A;if(ae=M.clientX,A=M.clientY,q){let D=L*o.step;ce&&(D=-D),re&&(c.value=Le(c.value-D)),l.value=Le(l.value+D)}if(ee){let D=U*o.step;ie&&(D=-D),oe&&(d.value=Le(d.value-D)),u.value=Le(u.value+D)}},R()},P=()=>{p.value=!1,i("out",{index:o.index,width:E(l.value),height:E(u.value),left:E(c.value),top:E(d.value)})},V=()=>{o.disabled||o.readonly||(p.value=!0,i("over",{index:o.index,width:E(l.value),height:E(u.value),left:E(c.value),top:E(d.value)}))},W=Z=>{if(o.disabled||o.readonly)return;m.value=!0,T();let Q=Z.clientX,q=Z.clientY;document.onmousemove=ee=>{const re=ee.clientX-Q,oe=ee.clientY-q;Q=ee.clientX,q=ee.clientY,c.value=Le(c.value+re*o.step),d.value=Le(d.value+oe*o.step)},R()};return a.onMounted(()=>{C()}),e({setActive:S,setLeft:H,setTop:w,setOverActive:b}),(Z,Q)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["d-draggable",{"d-draggable--active":(m.value||p.value)&&!t.readonly&&!t.disabled},{"d-draggable--pt":t.isPt&&!t.readonly&&!t.disabled},{"d-draggable--move":h.value},{"d-draggable--click":t.disabled}]),onMousedown:a.withModifiers(W,["stop"]),onMouseover:a.withModifiers(V,["stop"]),onMouseout:a.withModifiers(P,["stop"]),style:a.normalizeStyle(Y.value)},[a.createElementVNode("div",{class:"d-draggable__wrapper",ref_key:"wrapper",ref:r},[(m.value||p.value||h.value)&&!t.readonly&&!t.disabled?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...z.value}),class:"d-draggable__line d-draggable__line--left"},null,4),a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...g.value}),class:"d-draggable__line d-draggable__line--top"},null,4),t.isPt?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...z.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...g.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4),a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...$.value}),class:"d-draggable__line d-draggable__line--left"},null,4),a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...x.value}),class:"d-draggable__line d-draggable__line--top"},null,4),a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...$.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),a.createElementVNode("div",{style:a.normalizeStyle({..._.value,...x.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4)],64)):(a.openBlock(),a.createElementBlock("div",{key:0,class:"d-draggable__line d-draggable__line--label",style:a.normalizeStyle(X.value)},a.toDisplayString(c.value)+","+a.toDisplayString(d.value),5))],64)):a.createCommentVNode("",!0),!t.readonly&&!t.disabled?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(v.value,(q,ee)=>(a.openBlock(),a.createElementBlock(a.Fragment,{key:ee},[m.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["d-draggable__range",`d-draggable__range--${q.classname}`]),style:a.normalizeStyle([F.value,k(q.classname)]),onMousedown:a.withModifiers(re=>B(re,q.classname),["stop"])},null,46,zy)):a.createCommentVNode("",!0)],64))),128)):a.createCommentVNode("",!0),a.createElementVNode("div",{class:"d-draggable__item",ref_key:"item",ref:s},[a.renderSlot(Z.$slots,"default")],512),!t.disabled&&t.mask?(a.openBlock(),a.createElementBlock("div",Ay)):a.createCommentVNode("",!0)],512)],38))}})),Py=t=>{const e=Ry(t.components);return{formConfig:t.form,componentList:e}},Oy=(t,e)=>{let n={},o=[];const i={};if(t.ver==="V3"){const r=t;n=r.form;const s={};r.components.forEach(l=>{const u=e[l.type];s[l.containerId]=s[l.containerId]||[];const c={id:l.id,name:l.name,type:l.type,dragType:u?.dragType||"component",componentName:u?.componentName||"",runtimeType:u?.runtimeType,groupId:l.groupId,config:l.config,isInput:u?.isInput!==!1,containerId:l.containerId,level:l.level};u?.dragType==="container"&&(c.children=[]),i[c.id]=c,s[l.containerId].push(c)}),Object.keys(s).forEach(l=>{i[l]&&(i[l].children=s[l])}),o=s.form||[]}return{formConfig:n,componentList:o,componentDic:i}},vr=(t,e)=>{const n={ver:"V3",form:{...t},components:[],db:{}};return bl(e||[],n.components),n},bl=(t,e)=>{t.forEach(n=>{if(n.type==="pkey")return;const o={id:n.id,name:n.name,type:n.type,runtimeType:n.runtimeType||n.componentName||n.type,groupId:n.groupId||"",config:n.config,containerId:n.containerId,level:n.level};if(n.dragType==="container"){const i=n.children||[];bl(i,e)}e.push(o)})},Ry=t=>{const e={},n={};return t.forEach(o=>{e[o.containerId]=e[o.containerId]||[];const i={id:o.id,type:o.runtimeType,slot:o.groupId,config:{rule:[]}};o.config&&Object.keys(o.config).forEach(r=>{if(r==="required"){o.config.required&&i.config?.rule?.push({required:!0,message:o.config.requiredMsg||"请输入"});return}if(r==="patterns"){o.config.patterns.forEach(s=>{s.reg&&s.msg&&i.config?.rule?.push({pattern:new RegExp(s.reg),message:`请输入${s.msg||""}`})});return}i.config[r]=o.config[r]}),o.type==="pkey"&&(i.config.isPkey=!0),e[o.containerId].push(i),n[o.id]=i}),Object.keys(e).forEach(o=>{const i=n[o];if(i){const r=e[o];if(["j-tabs","j-collapse"].includes(i.type||"")&&i.config?.groups){const s={};r.forEach(u=>{if(u.slot!==void 0&&u.slot!==null){const c=u.slot.toString();s[c]||(s[c]=[]),delete u.slot,s[c].push(u)}});const l=i.config.groups.map(u=>{const c=u._i,d=s[c]||[],f={label:u.label};u.active&&i.type==="j-collapse"&&(f.active=u.active);let h;if(i.type==="j-tabs"&&i.config?.tabKey&&i.config?.options.length>0){const y=i.config.options.find(m=>m.label===u._i);y&&(h=({formData:m})=>({display:y.value.includes(m[i.config?.tabKey||""])?y.display:!y.display}))}const p={config:f,children:d};return h&&(p.getCompConfig=h),p});i.children=l,delete i.config.groups}else i.children=r}}),e.form};function Hy(t){const{toString:e}=Object.prototype,n={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"};return typeof Element<"u"&&t instanceof Element?"element":n[e.call(t)]}function br(t){const e=Hy(t);let n;if(e==="array")n=[];else if(e==="object")n={};else return t;if(e==="array")for(let o=0,i=t.length;o<i;o++)t[o]=(t[o]===0,t[o]),t[o]&&delete t[o].$parent,n.push(br(t[o]));else e==="object"&&Object.keys(t).forEach(o=>{t&&delete t.$parent,n[o]=br(t[o])});return n}var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Ly(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function o(){var i=!1;try{i=this instanceof o}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var i=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,i.get?i:{enumerable:!0,get:function(){return t[o]}})}),n}var Fo={exports:{}},Vy=Fo.exports,_l;function Fy(){return _l||(_l=1,(function(t,e){(function(n,o){t.exports=o()})(Vy,(function(){var n=1e3,o=6e4,i=36e5,r="millisecond",s="second",l="minute",u="hour",c="day",d="week",f="month",h="quarter",p="year",y="date",m="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(w){var k=["th","st","nd","rd"],b=w%100;return"["+w+(k[(b-20)%10]||k[b]||k[0])+"]"}},g=function(w,k,b){var E=String(w);return!E||E.length>=k?w:""+Array(k+1-E.length).join(b)+w},x={s:g,z:function(w){var k=-w.utcOffset(),b=Math.abs(k),E=Math.floor(b/60),T=b%60;return(k<=0?"+":"-")+g(E,2,"0")+":"+g(T,2,"0")},m:function w(k,b){if(k.date()<b.date())return-w(b,k);var E=12*(b.year()-k.year())+(b.month()-k.month()),T=k.clone().add(E,f),O=b-T<0,R=k.clone().add(E+(O?-1:1),f);return+(-(E+(b-T)/(O?T-R:R-T))||0)},a:function(w){return w<0?Math.ceil(w)||0:Math.floor(w)},p:function(w){return{M:f,y:p,w:d,d:c,D:y,h:u,m:l,s,ms:r,Q:h}[w]||String(w||"").toLowerCase().replace(/s$/,"")},u:function(w){return w===void 0}},z="en",$={};$[z]=_;var F="$isDayjsObject",X=function(w){return w instanceof C||!(!w||!w[F])},Y=function w(k,b,E){var T;if(!k)return z;if(typeof k=="string"){var O=k.toLowerCase();$[O]&&(T=O),b&&($[O]=b,T=O);var R=k.split("-");if(!T&&R.length>1)return w(R[0])}else{var B=k.name;$[B]=k,T=B}return!E&&T&&(z=T),T||!E&&z},S=function(w,k){if(X(w))return w.clone();var b=typeof k=="object"?k:{};return b.date=w,b.args=arguments,new C(b)},I=x;I.l=Y,I.i=X,I.w=function(w,k){return S(w,{locale:k.$L,utc:k.$u,x:k.$x,$offset:k.$offset})};var C=(function(){function w(b){this.$L=Y(b.locale,null,!0),this.parse(b),this.$x=this.$x||b.x||{},this[F]=!0}var k=w.prototype;return k.parse=function(b){this.$d=(function(E){var T=E.date,O=E.utc;if(T===null)return new Date(NaN);if(I.u(T))return new Date;if(T instanceof Date)return new Date(T);if(typeof T=="string"&&!/Z$/i.test(T)){var R=T.match(v);if(R){var B=R[2]-1||0,P=(R[7]||"0").substring(0,3);return O?new Date(Date.UTC(R[1],B,R[3]||1,R[4]||0,R[5]||0,R[6]||0,P)):new Date(R[1],B,R[3]||1,R[4]||0,R[5]||0,R[6]||0,P)}}return new Date(T)})(b),this.init()},k.init=function(){var b=this.$d;this.$y=b.getFullYear(),this.$M=b.getMonth(),this.$D=b.getDate(),this.$W=b.getDay(),this.$H=b.getHours(),this.$m=b.getMinutes(),this.$s=b.getSeconds(),this.$ms=b.getMilliseconds()},k.$utils=function(){return I},k.isValid=function(){return this.$d.toString()!==m},k.isSame=function(b,E){var T=S(b);return this.startOf(E)<=T&&T<=this.endOf(E)},k.isAfter=function(b,E){return S(b)<this.startOf(E)},k.isBefore=function(b,E){return this.endOf(E)<S(b)},k.$g=function(b,E,T){return I.u(b)?this[E]:this.set(T,b)},k.unix=function(){return Math.floor(this.valueOf()/1e3)},k.valueOf=function(){return this.$d.getTime()},k.startOf=function(b,E){var T=this,O=!!I.u(E)||E,R=I.p(b),B=function(re,oe){var ce=I.w(T.$u?Date.UTC(T.$y,oe,re):new Date(T.$y,oe,re),T);return O?ce:ce.endOf(c)},P=function(re,oe){return I.w(T.toDate()[re].apply(T.toDate("s"),(O?[0,0,0,0]:[23,59,59,999]).slice(oe)),T)},V=this.$W,W=this.$M,Z=this.$D,Q="set"+(this.$u?"UTC":"");switch(R){case p:return O?B(1,0):B(31,11);case f:return O?B(1,W):B(0,W+1);case d:var q=this.$locale().weekStart||0,ee=(V<q?V+7:V)-q;return B(O?Z-ee:Z+(6-ee),W);case c:case y:return P(Q+"Hours",0);case u:return P(Q+"Minutes",1);case l:return P(Q+"Seconds",2);case s:return P(Q+"Milliseconds",3);default:return this.clone()}},k.endOf=function(b){return this.startOf(b,!1)},k.$set=function(b,E){var T,O=I.p(b),R="set"+(this.$u?"UTC":""),B=(T={},T[c]=R+"Date",T[y]=R+"Date",T[f]=R+"Month",T[p]=R+"FullYear",T[u]=R+"Hours",T[l]=R+"Minutes",T[s]=R+"Seconds",T[r]=R+"Milliseconds",T)[O],P=O===c?this.$D+(E-this.$W):E;if(O===f||O===p){var V=this.clone().set(y,1);V.$d[B](P),V.init(),this.$d=V.set(y,Math.min(this.$D,V.daysInMonth())).$d}else B&&this.$d[B](P);return this.init(),this},k.set=function(b,E){return this.clone().$set(b,E)},k.get=function(b){return this[I.p(b)]()},k.add=function(b,E){var T,O=this;b=Number(b);var R=I.p(E),B=function(W){var Z=S(O);return I.w(Z.date(Z.date()+Math.round(W*b)),O)};if(R===f)return this.set(f,this.$M+b);if(R===p)return this.set(p,this.$y+b);if(R===c)return B(1);if(R===d)return B(7);var P=(T={},T[l]=o,T[u]=i,T[s]=n,T)[R]||1,V=this.$d.getTime()+b*P;return I.w(V,this)},k.subtract=function(b,E){return this.add(-1*b,E)},k.format=function(b){var E=this,T=this.$locale();if(!this.isValid())return T.invalidDate||m;var O=b||"YYYY-MM-DDTHH:mm:ssZ",R=I.z(this),B=this.$H,P=this.$m,V=this.$M,W=T.weekdays,Z=T.months,Q=T.meridiem,q=function(oe,ce,ie,ae){return oe&&(oe[ce]||oe(E,O))||ie[ce].slice(0,ae)},ee=function(oe){return I.s(B%12||12,oe,"0")},re=Q||function(oe,ce,ie){var ae=oe<12?"AM":"PM";return ie?ae.toLowerCase():ae};return O.replace(N,(function(oe,ce){return ce||(function(ie){switch(ie){case"YY":return String(E.$y).slice(-2);case"YYYY":return I.s(E.$y,4,"0");case"M":return V+1;case"MM":return I.s(V+1,2,"0");case"MMM":return q(T.monthsShort,V,Z,3);case"MMMM":return q(Z,V);case"D":return E.$D;case"DD":return I.s(E.$D,2,"0");case"d":return String(E.$W);case"dd":return q(T.weekdaysMin,E.$W,W,2);case"ddd":return q(T.weekdaysShort,E.$W,W,3);case"dddd":return W[E.$W];case"H":return String(B);case"HH":return I.s(B,2,"0");case"h":return ee(1);case"hh":return ee(2);case"a":return re(B,P,!0);case"A":return re(B,P,!1);case"m":return String(P);case"mm":return I.s(P,2,"0");case"s":return String(E.$s);case"ss":return I.s(E.$s,2,"0");case"SSS":return I.s(E.$ms,3,"0");case"Z":return R}return null})(oe)||R.replace(":","")}))},k.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},k.diff=function(b,E,T){var O,R=this,B=I.p(E),P=S(b),V=(P.utcOffset()-this.utcOffset())*o,W=this-P,Z=function(){return I.m(R,P)};switch(B){case p:O=Z()/12;break;case f:O=Z();break;case h:O=Z()/3;break;case d:O=(W-V)/6048e5;break;case c:O=(W-V)/864e5;break;case u:O=W/i;break;case l:O=W/o;break;case s:O=W/n;break;default:O=W}return T?O:I.a(O)},k.daysInMonth=function(){return this.endOf(f).$D},k.$locale=function(){return $[this.$L]},k.locale=function(b,E){if(!b)return this.$L;var T=this.clone(),O=Y(b,E,!0);return O&&(T.$L=O),T},k.clone=function(){return I.w(this.$d,this)},k.toDate=function(){return new Date(this.valueOf())},k.toJSON=function(){return this.isValid()?this.toISOString():null},k.toISOString=function(){return this.$d.toISOString()},k.toString=function(){return this.$d.toUTCString()},w})(),H=C.prototype;return S.prototype=H,[["$ms",r],["$s",s],["$m",l],["$H",u],["$W",c],["$M",f],["$y",p],["$D",y]].forEach((function(w){H[w[1]]=function(k){return this.$g(k,w[0],w[1])}})),S.extend=function(w,k){return w.$i||(w(k,C,S),w.$i=!0),S},S.locale=Y,S.isDayjs=X,S.unix=function(w){return S(1e3*w)},S.en=$[z],S.Ls=$,S.p={},S}))})(Fo)),Fo.exports}Fy();var Wo={exports:{}};function Wy(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Go={exports:{}};const Gy=Ly(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var jy=Go.exports,xl;function qe(){return xl||(xl=1,(function(t,e){(function(n,o){t.exports=o()})(jy,function(){var n=n||(function(o,i){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof wr<"u"&&wr.crypto&&(r=wr.crypto),!r&&typeof Wy=="function")try{r=Gy}catch{}var s=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||(function(){function _(){}return function(g){var x;return _.prototype=g,x=new _,_.prototype=null,x}})(),u={},c=u.lib={},d=c.Base=(function(){return{extend:function(_){var g=l(this);return _&&g.mixIn(_),(!g.hasOwnProperty("init")||this.init===g.init)&&(g.init=function(){g.$super.init.apply(this,arguments)}),g.init.prototype=g,g.$super=this,g},create:function(){var _=this.extend();return _.init.apply(_,arguments),_},init:function(){},mixIn:function(_){for(var g in _)_.hasOwnProperty(g)&&(this[g]=_[g]);_.hasOwnProperty("toString")&&(this.toString=_.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),f=c.WordArray=d.extend({init:function(_,g){_=this.words=_||[],g!=i?this.sigBytes=g:this.sigBytes=_.length*4},toString:function(_){return(_||p).stringify(this)},concat:function(_){var g=this.words,x=_.words,z=this.sigBytes,$=_.sigBytes;if(this.clamp(),z%4)for(var F=0;F<$;F++){var X=x[F>>>2]>>>24-F%4*8&255;g[z+F>>>2]|=X<<24-(z+F)%4*8}else for(var Y=0;Y<$;Y+=4)g[z+Y>>>2]=x[Y>>>2];return this.sigBytes+=$,this},clamp:function(){var _=this.words,g=this.sigBytes;_[g>>>2]&=4294967295<<32-g%4*8,_.length=o.ceil(g/4)},clone:function(){var _=d.clone.call(this);return _.words=this.words.slice(0),_},random:function(_){for(var g=[],x=0;x<_;x+=4)g.push(s());return new f.init(g,_)}}),h=u.enc={},p=h.Hex={stringify:function(_){for(var g=_.words,x=_.sigBytes,z=[],$=0;$<x;$++){var F=g[$>>>2]>>>24-$%4*8&255;z.push((F>>>4).toString(16)),z.push((F&15).toString(16))}return z.join("")},parse:function(_){for(var g=_.length,x=[],z=0;z<g;z+=2)x[z>>>3]|=parseInt(_.substr(z,2),16)<<24-z%8*4;return new f.init(x,g/2)}},y=h.Latin1={stringify:function(_){for(var g=_.words,x=_.sigBytes,z=[],$=0;$<x;$++){var F=g[$>>>2]>>>24-$%4*8&255;z.push(String.fromCharCode(F))}return z.join("")},parse:function(_){for(var g=_.length,x=[],z=0;z<g;z++)x[z>>>2]|=(_.charCodeAt(z)&255)<<24-z%4*8;return new f.init(x,g)}},m=h.Utf8={stringify:function(_){try{return decodeURIComponent(escape(y.stringify(_)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(_){return y.parse(unescape(encodeURIComponent(_)))}},v=c.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(_){typeof _=="string"&&(_=m.parse(_)),this._data.concat(_),this._nDataBytes+=_.sigBytes},_process:function(_){var g,x=this._data,z=x.words,$=x.sigBytes,F=this.blockSize,X=F*4,Y=$/X;_?Y=o.ceil(Y):Y=o.max((Y|0)-this._minBufferSize,0);var S=Y*F,I=o.min(S*4,$);if(S){for(var C=0;C<S;C+=F)this._doProcessBlock(z,C);g=z.splice(0,S),x.sigBytes-=I}return new f.init(g,I)},clone:function(){var _=d.clone.call(this);return _._data=this._data.clone(),_},_minBufferSize:0});c.Hasher=v.extend({cfg:d.extend(),init:function(_){this.cfg=this.cfg.extend(_),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(_){return this._append(_),this._process(),this},finalize:function(_){_&&this._append(_);var g=this._doFinalize();return g},blockSize:16,_createHelper:function(_){return function(g,x){return new _.init(x).finalize(g)}},_createHmacHelper:function(_){return function(g,x){return new N.HMAC.init(_,x).finalize(g)}}});var N=u.algo={};return u})(Math);return n})})(Go)),Go.exports}var jo={exports:{}},Yy=jo.exports,El;function Cl(){return El||(El=1,(function(t,e){(function(n,o){t.exports=o(qe())})(Yy,function(n){return(function(){var o=n,i=o.lib,r=i.WordArray,s=o.enc;s.Base64={stringify:function(u){var c=u.words,d=u.sigBytes,f=this._map;u.clamp();for(var h=[],p=0;p<d;p+=3)for(var y=c[p>>>2]>>>24-p%4*8&255,m=c[p+1>>>2]>>>24-(p+1)%4*8&255,v=c[p+2>>>2]>>>24-(p+2)%4*8&255,N=y<<16|m<<8|v,_=0;_<4&&p+_*.75<d;_++)h.push(f.charAt(N>>>6*(3-_)&63));var g=f.charAt(64);if(g)for(;h.length%4;)h.push(g);return h.join("")},parse:function(u){var c=u.length,d=this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var h=0;h<d.length;h++)f[d.charCodeAt(h)]=h}var p=d.charAt(64);if(p){var y=u.indexOf(p);y!==-1&&(c=y)}return l(u,c,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function l(u,c,d){for(var f=[],h=0,p=0;p<c;p++)if(p%4){var y=d[u.charCodeAt(p-1)]<<p%4*2,m=d[u.charCodeAt(p)]>>>6-p%4*2,v=y|m;f[h>>>2]|=v<<24-h%4*8,h++}return r.create(f,h)}})(),n.enc.Base64})})(jo)),jo.exports}var Yo={exports:{}},Uy=Yo.exports,Sl;function Nl(){return Sl||(Sl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(Uy,function(n){return(function(o){var i=n,r=i.lib,s=r.WordArray,l=r.Hasher,u=i.algo,c=[];(function(){for(var m=0;m<64;m++)c[m]=o.abs(o.sin(m+1))*4294967296|0})();var d=u.MD5=l.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,v){for(var N=0;N<16;N++){var _=v+N,g=m[_];m[_]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var x=this._hash.words,z=m[v+0],$=m[v+1],F=m[v+2],X=m[v+3],Y=m[v+4],S=m[v+5],I=m[v+6],C=m[v+7],H=m[v+8],w=m[v+9],k=m[v+10],b=m[v+11],E=m[v+12],T=m[v+13],O=m[v+14],R=m[v+15],B=x[0],P=x[1],V=x[2],W=x[3];B=f(B,P,V,W,z,7,c[0]),W=f(W,B,P,V,$,12,c[1]),V=f(V,W,B,P,F,17,c[2]),P=f(P,V,W,B,X,22,c[3]),B=f(B,P,V,W,Y,7,c[4]),W=f(W,B,P,V,S,12,c[5]),V=f(V,W,B,P,I,17,c[6]),P=f(P,V,W,B,C,22,c[7]),B=f(B,P,V,W,H,7,c[8]),W=f(W,B,P,V,w,12,c[9]),V=f(V,W,B,P,k,17,c[10]),P=f(P,V,W,B,b,22,c[11]),B=f(B,P,V,W,E,7,c[12]),W=f(W,B,P,V,T,12,c[13]),V=f(V,W,B,P,O,17,c[14]),P=f(P,V,W,B,R,22,c[15]),B=h(B,P,V,W,$,5,c[16]),W=h(W,B,P,V,I,9,c[17]),V=h(V,W,B,P,b,14,c[18]),P=h(P,V,W,B,z,20,c[19]),B=h(B,P,V,W,S,5,c[20]),W=h(W,B,P,V,k,9,c[21]),V=h(V,W,B,P,R,14,c[22]),P=h(P,V,W,B,Y,20,c[23]),B=h(B,P,V,W,w,5,c[24]),W=h(W,B,P,V,O,9,c[25]),V=h(V,W,B,P,X,14,c[26]),P=h(P,V,W,B,H,20,c[27]),B=h(B,P,V,W,T,5,c[28]),W=h(W,B,P,V,F,9,c[29]),V=h(V,W,B,P,C,14,c[30]),P=h(P,V,W,B,E,20,c[31]),B=p(B,P,V,W,S,4,c[32]),W=p(W,B,P,V,H,11,c[33]),V=p(V,W,B,P,b,16,c[34]),P=p(P,V,W,B,O,23,c[35]),B=p(B,P,V,W,$,4,c[36]),W=p(W,B,P,V,Y,11,c[37]),V=p(V,W,B,P,C,16,c[38]),P=p(P,V,W,B,k,23,c[39]),B=p(B,P,V,W,T,4,c[40]),W=p(W,B,P,V,z,11,c[41]),V=p(V,W,B,P,X,16,c[42]),P=p(P,V,W,B,I,23,c[43]),B=p(B,P,V,W,w,4,c[44]),W=p(W,B,P,V,E,11,c[45]),V=p(V,W,B,P,R,16,c[46]),P=p(P,V,W,B,F,23,c[47]),B=y(B,P,V,W,z,6,c[48]),W=y(W,B,P,V,C,10,c[49]),V=y(V,W,B,P,O,15,c[50]),P=y(P,V,W,B,S,21,c[51]),B=y(B,P,V,W,E,6,c[52]),W=y(W,B,P,V,X,10,c[53]),V=y(V,W,B,P,k,15,c[54]),P=y(P,V,W,B,$,21,c[55]),B=y(B,P,V,W,H,6,c[56]),W=y(W,B,P,V,R,10,c[57]),V=y(V,W,B,P,I,15,c[58]),P=y(P,V,W,B,T,21,c[59]),B=y(B,P,V,W,Y,6,c[60]),W=y(W,B,P,V,b,10,c[61]),V=y(V,W,B,P,F,15,c[62]),P=y(P,V,W,B,w,21,c[63]),x[0]=x[0]+B|0,x[1]=x[1]+P|0,x[2]=x[2]+V|0,x[3]=x[3]+W|0},_doFinalize:function(){var m=this._data,v=m.words,N=this._nDataBytes*8,_=m.sigBytes*8;v[_>>>5]|=128<<24-_%32;var g=o.floor(N/4294967296),x=N;v[(_+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,v[(_+64>>>9<<4)+14]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,m.sigBytes=(v.length+1)*4,this._process();for(var z=this._hash,$=z.words,F=0;F<4;F++){var X=$[F];$[F]=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360}return z},clone:function(){var m=l.clone.call(this);return m._hash=this._hash.clone(),m}});function f(m,v,N,_,g,x,z){var $=m+(v&N|~v&_)+g+z;return($<<x|$>>>32-x)+v}function h(m,v,N,_,g,x,z){var $=m+(v&_|N&~_)+g+z;return($<<x|$>>>32-x)+v}function p(m,v,N,_,g,x,z){var $=m+(v^N^_)+g+z;return($<<x|$>>>32-x)+v}function y(m,v,N,_,g,x,z){var $=m+(N^(v|~_))+g+z;return($<<x|$>>>32-x)+v}i.MD5=l._createHelper(d),i.HmacMD5=l._createHmacHelper(d)})(Math),n.MD5})})(Yo)),Yo.exports}var Uo={exports:{}},Xo={exports:{}},Xy=Xo.exports,kl;function qy(){return kl||(kl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(Xy,function(n){return(function(){var o=n,i=o.lib,r=i.WordArray,s=i.Hasher,l=o.algo,u=[],c=l.SHA1=s.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,f){for(var h=this._hash.words,p=h[0],y=h[1],m=h[2],v=h[3],N=h[4],_=0;_<80;_++){if(_<16)u[_]=d[f+_]|0;else{var g=u[_-3]^u[_-8]^u[_-14]^u[_-16];u[_]=g<<1|g>>>31}var x=(p<<5|p>>>27)+N+u[_];_<20?x+=(y&m|~y&v)+1518500249:_<40?x+=(y^m^v)+1859775393:_<60?x+=(y&m|y&v|m&v)-1894007588:x+=(y^m^v)-899497514,N=v,v=m,m=y<<30|y>>>2,y=p,p=x}h[0]=h[0]+p|0,h[1]=h[1]+y|0,h[2]=h[2]+m|0,h[3]=h[3]+v|0,h[4]=h[4]+N|0},_doFinalize:function(){var d=this._data,f=d.words,h=this._nDataBytes*8,p=d.sigBytes*8;return f[p>>>5]|=128<<24-p%32,f[(p+64>>>9<<4)+14]=Math.floor(h/4294967296),f[(p+64>>>9<<4)+15]=h,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=s.clone.call(this);return d._hash=this._hash.clone(),d}});o.SHA1=s._createHelper(c),o.HmacSHA1=s._createHmacHelper(c)})(),n.SHA1})})(Xo)),Xo.exports}var qo={exports:{}},Ky=qo.exports,Dl;function Zy(){return Dl||(Dl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(Ky,function(n){(function(){var o=n,i=o.lib,r=i.Base,s=o.enc,l=s.Utf8,u=o.algo;u.HMAC=r.extend({init:function(c,d){c=this._hasher=new c.init,typeof d=="string"&&(d=l.parse(d));var f=c.blockSize,h=f*4;d.sigBytes>h&&(d=c.finalize(d)),d.clamp();for(var p=this._oKey=d.clone(),y=this._iKey=d.clone(),m=p.words,v=y.words,N=0;N<f;N++)m[N]^=1549556828,v[N]^=909522486;p.sigBytes=y.sigBytes=h,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var d=this._hasher,f=d.finalize(c);d.reset();var h=d.finalize(this._oKey.clone().concat(f));return h}})})()})})(qo)),qo.exports}var Jy=Uo.exports,Tl;function Ml(){return Tl||(Tl=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),qy(),Zy())})(Jy,function(n){return(function(){var o=n,i=o.lib,r=i.Base,s=i.WordArray,l=o.algo,u=l.MD5,c=l.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:u,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,f){for(var h,p=this.cfg,y=p.hasher.create(),m=s.create(),v=m.words,N=p.keySize,_=p.iterations;v.length<N;){h&&y.update(h),h=y.update(d).finalize(f),y.reset();for(var g=1;g<_;g++)h=y.finalize(h),y.reset();m.concat(h)}return m.sigBytes=N*4,m}});o.EvpKDF=function(d,f,h){return c.create(h).compute(d,f)}})(),n.EvpKDF})})(Uo)),Uo.exports}var Ko={exports:{}},Qy=Ko.exports,Il;function Bl(){return Il||(Il=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),Ml())})(Qy,function(n){n.lib.Cipher||(function(o){var i=n,r=i.lib,s=r.Base,l=r.WordArray,u=r.BufferedBlockAlgorithm,c=i.enc;c.Utf8;var d=c.Base64,f=i.algo,h=f.EvpKDF,p=r.Cipher=u.extend({cfg:s.extend(),createEncryptor:function(S,I){return this.create(this._ENC_XFORM_MODE,S,I)},createDecryptor:function(S,I){return this.create(this._DEC_XFORM_MODE,S,I)},init:function(S,I,C){this.cfg=this.cfg.extend(C),this._xformMode=S,this._key=I,this.reset()},reset:function(){u.reset.call(this),this._doReset()},process:function(S){return this._append(S),this._process()},finalize:function(S){S&&this._append(S);var I=this._doFinalize();return I},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function S(I){return typeof I=="string"?Y:$}return function(I){return{encrypt:function(C,H,w){return S(H).encrypt(I,C,H,w)},decrypt:function(C,H,w){return S(H).decrypt(I,C,H,w)}}}})()});r.StreamCipher=p.extend({_doFinalize:function(){var S=this._process(!0);return S},blockSize:1});var y=i.mode={},m=r.BlockCipherMode=s.extend({createEncryptor:function(S,I){return this.Encryptor.create(S,I)},createDecryptor:function(S,I){return this.Decryptor.create(S,I)},init:function(S,I){this._cipher=S,this._iv=I}}),v=y.CBC=(function(){var S=m.extend();S.Encryptor=S.extend({processBlock:function(C,H){var w=this._cipher,k=w.blockSize;I.call(this,C,H,k),w.encryptBlock(C,H),this._prevBlock=C.slice(H,H+k)}}),S.Decryptor=S.extend({processBlock:function(C,H){var w=this._cipher,k=w.blockSize,b=C.slice(H,H+k);w.decryptBlock(C,H),I.call(this,C,H,k),this._prevBlock=b}});function I(C,H,w){var k,b=this._iv;b?(k=b,this._iv=o):k=this._prevBlock;for(var E=0;E<w;E++)C[H+E]^=k[E]}return S})(),N=i.pad={},_=N.Pkcs7={pad:function(S,I){for(var C=I*4,H=C-S.sigBytes%C,w=H<<24|H<<16|H<<8|H,k=[],b=0;b<H;b+=4)k.push(w);var E=l.create(k,H);S.concat(E)},unpad:function(S){var I=S.words[S.sigBytes-1>>>2]&255;S.sigBytes-=I}};r.BlockCipher=p.extend({cfg:p.cfg.extend({mode:v,padding:_}),reset:function(){var S;p.reset.call(this);var I=this.cfg,C=I.iv,H=I.mode;this._xformMode==this._ENC_XFORM_MODE?S=H.createEncryptor:(S=H.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==S?this._mode.init(this,C&&C.words):(this._mode=S.call(H,this,C&&C.words),this._mode.__creator=S)},_doProcessBlock:function(S,I){this._mode.processBlock(S,I)},_doFinalize:function(){var S,I=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(I.pad(this._data,this.blockSize),S=this._process(!0)):(S=this._process(!0),I.unpad(S)),S},blockSize:128/32});var g=r.CipherParams=s.extend({init:function(S){this.mixIn(S)},toString:function(S){return(S||this.formatter).stringify(this)}}),x=i.format={},z=x.OpenSSL={stringify:function(S){var I,C=S.ciphertext,H=S.salt;return H?I=l.create([1398893684,1701076831]).concat(H).concat(C):I=C,I.toString(d)},parse:function(S){var I,C=d.parse(S),H=C.words;return H[0]==1398893684&&H[1]==1701076831&&(I=l.create(H.slice(2,4)),H.splice(0,4),C.sigBytes-=16),g.create({ciphertext:C,salt:I})}},$=r.SerializableCipher=s.extend({cfg:s.extend({format:z}),encrypt:function(S,I,C,H){H=this.cfg.extend(H);var w=S.createEncryptor(C,H),k=w.finalize(I),b=w.cfg;return g.create({ciphertext:k,key:C,iv:b.iv,algorithm:S,mode:b.mode,padding:b.padding,blockSize:S.blockSize,formatter:H.format})},decrypt:function(S,I,C,H){H=this.cfg.extend(H),I=this._parse(I,H.format);var w=S.createDecryptor(C,H).finalize(I.ciphertext);return w},_parse:function(S,I){return typeof S=="string"?I.parse(S,this):S}}),F=i.kdf={},X=F.OpenSSL={execute:function(S,I,C,H,w){if(H||(H=l.random(64/8)),w)var k=h.create({keySize:I+C,hasher:w}).compute(S,H);else var k=h.create({keySize:I+C}).compute(S,H);var b=l.create(k.words.slice(I),C*4);return k.sigBytes=I*4,g.create({key:k,iv:b,salt:H})}},Y=r.PasswordBasedCipher=$.extend({cfg:$.cfg.extend({kdf:X}),encrypt:function(S,I,C,H){H=this.cfg.extend(H);var w=H.kdf.execute(C,S.keySize,S.ivSize,H.salt,H.hasher);H.iv=w.iv;var k=$.encrypt.call(this,S,I,w.key,H);return k.mixIn(w),k},decrypt:function(S,I,C,H){H=this.cfg.extend(H),I=this._parse(I,H.format);var w=H.kdf.execute(C,S.keySize,S.ivSize,I.salt,H.hasher);H.iv=w.iv;var k=$.decrypt.call(this,S,I,w.key,H);return k}})})()})})(Ko)),Ko.exports}var ev=Wo.exports,$l;function tv(){return $l||($l=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),Cl(),Nl(),Ml(),Bl())})(ev,function(n){return(function(){var o=n,i=o.lib,r=i.BlockCipher,s=o.algo,l=[],u=[],c=[],d=[],f=[],h=[],p=[],y=[],m=[],v=[];(function(){for(var g=[],x=0;x<256;x++)x<128?g[x]=x<<1:g[x]=x<<1^283;for(var z=0,$=0,x=0;x<256;x++){var F=$^$<<1^$<<2^$<<3^$<<4;F=F>>>8^F&255^99,l[z]=F,u[F]=z;var X=g[z],Y=g[X],S=g[Y],I=g[F]*257^F*16843008;c[z]=I<<24|I>>>8,d[z]=I<<16|I>>>16,f[z]=I<<8|I>>>24,h[z]=I;var I=S*16843009^Y*65537^X*257^z*16843008;p[F]=I<<24|I>>>8,y[F]=I<<16|I>>>16,m[F]=I<<8|I>>>24,v[F]=I,z?(z=X^g[g[g[S^X]]],$^=g[g[$]]):z=$=1}})();var N=[0,1,2,4,8,16,32,64,128,27,54],_=s.AES=r.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var x=this._keyPriorReset=this._key,z=x.words,$=x.sigBytes/4,F=this._nRounds=$+6,X=(F+1)*4,Y=this._keySchedule=[],S=0;S<X;S++)S<$?Y[S]=z[S]:(g=Y[S-1],S%$?$>6&&S%$==4&&(g=l[g>>>24]<<24|l[g>>>16&255]<<16|l[g>>>8&255]<<8|l[g&255]):(g=g<<8|g>>>24,g=l[g>>>24]<<24|l[g>>>16&255]<<16|l[g>>>8&255]<<8|l[g&255],g^=N[S/$|0]<<24),Y[S]=Y[S-$]^g);for(var I=this._invKeySchedule=[],C=0;C<X;C++){var S=X-C;if(C%4)var g=Y[S];else var g=Y[S-4];C<4||S<=4?I[C]=g:I[C]=p[l[g>>>24]]^y[l[g>>>16&255]]^m[l[g>>>8&255]]^v[l[g&255]]}}},encryptBlock:function(g,x){this._doCryptBlock(g,x,this._keySchedule,c,d,f,h,l)},decryptBlock:function(g,x){var z=g[x+1];g[x+1]=g[x+3],g[x+3]=z,this._doCryptBlock(g,x,this._invKeySchedule,p,y,m,v,u);var z=g[x+1];g[x+1]=g[x+3],g[x+3]=z},_doCryptBlock:function(g,x,z,$,F,X,Y,S){for(var I=this._nRounds,C=g[x]^z[0],H=g[x+1]^z[1],w=g[x+2]^z[2],k=g[x+3]^z[3],b=4,E=1;E<I;E++){var T=$[C>>>24]^F[H>>>16&255]^X[w>>>8&255]^Y[k&255]^z[b++],O=$[H>>>24]^F[w>>>16&255]^X[k>>>8&255]^Y[C&255]^z[b++],R=$[w>>>24]^F[k>>>16&255]^X[C>>>8&255]^Y[H&255]^z[b++],B=$[k>>>24]^F[C>>>16&255]^X[H>>>8&255]^Y[w&255]^z[b++];C=T,H=O,w=R,k=B}var T=(S[C>>>24]<<24|S[H>>>16&255]<<16|S[w>>>8&255]<<8|S[k&255])^z[b++],O=(S[H>>>24]<<24|S[w>>>16&255]<<16|S[k>>>8&255]<<8|S[C&255])^z[b++],R=(S[w>>>24]<<24|S[k>>>16&255]<<16|S[C>>>8&255]<<8|S[H&255])^z[b++],B=(S[k>>>24]<<24|S[C>>>16&255]<<16|S[H>>>8&255]<<8|S[w&255])^z[b++];g[x]=T,g[x+1]=O,g[x+2]=R,g[x+3]=B},keySize:256/32});o.AES=r._createHelper(_)})(),n.AES})})(Wo)),Wo.exports}var nv=tv();const ov=wl(nv);var Zo={exports:{}},iv=Zo.exports,zl;function rv(){return zl||(zl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(iv,function(n){return n.enc.Utf8})})(Zo)),Zo.exports}var sv=rv();const av=wl(sv);var Jo={exports:{}},lv=Jo.exports,Al;function cv(){return Al||(Al=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),Bl())})(lv,function(n){return n.pad.Pkcs7})})(Jo)),Jo.exports}cv(),Cl(),Nl();var Qo={exports:{}},dv=Qo.exports,Pl;function uv(){return Pl||(Pl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(dv,function(n){return(function(o){var i=n,r=i.lib,s=r.WordArray,l=r.Hasher,u=i.algo,c=[],d=[];(function(){function p(N){for(var _=o.sqrt(N),g=2;g<=_;g++)if(!(N%g))return!1;return!0}function y(N){return(N-(N|0))*4294967296|0}for(var m=2,v=0;v<64;)p(m)&&(v<8&&(c[v]=y(o.pow(m,1/2))),d[v]=y(o.pow(m,1/3)),v++),m++})();var f=[],h=u.SHA256=l.extend({_doReset:function(){this._hash=new s.init(c.slice(0))},_doProcessBlock:function(p,y){for(var m=this._hash.words,v=m[0],N=m[1],_=m[2],g=m[3],x=m[4],z=m[5],$=m[6],F=m[7],X=0;X<64;X++){if(X<16)f[X]=p[y+X]|0;else{var Y=f[X-15],S=(Y<<25|Y>>>7)^(Y<<14|Y>>>18)^Y>>>3,I=f[X-2],C=(I<<15|I>>>17)^(I<<13|I>>>19)^I>>>10;f[X]=S+f[X-7]+C+f[X-16]}var H=x&z^~x&$,w=v&N^v&_^N&_,k=(v<<30|v>>>2)^(v<<19|v>>>13)^(v<<10|v>>>22),b=(x<<26|x>>>6)^(x<<21|x>>>11)^(x<<7|x>>>25),E=F+b+H+d[X]+f[X],T=k+w;F=$,$=z,z=x,x=g+E|0,g=_,_=N,N=v,v=E+T|0}m[0]=m[0]+v|0,m[1]=m[1]+N|0,m[2]=m[2]+_|0,m[3]=m[3]+g|0,m[4]=m[4]+x|0,m[5]=m[5]+z|0,m[6]=m[6]+$|0,m[7]=m[7]+F|0},_doFinalize:function(){var p=this._data,y=p.words,m=this._nDataBytes*8,v=p.sigBytes*8;return y[v>>>5]|=128<<24-v%32,y[(v+64>>>9<<4)+14]=o.floor(m/4294967296),y[(v+64>>>9<<4)+15]=m,p.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var p=l.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=l._createHelper(h),i.HmacSHA256=l._createHmacHelper(h)})(Math),n.SHA256})})(Qo)),Qo.exports}uv();var ei={exports:{}},ti={exports:{}},fv=ti.exports,Ol;function hv(){return Ol||(Ol=1,(function(t,e){(function(n,o){t.exports=o(qe())})(fv,function(n){return(function(o){var i=n,r=i.lib,s=r.Base,l=r.WordArray,u=i.x64={};u.Word=s.extend({init:function(c,d){this.high=c,this.low=d}}),u.WordArray=s.extend({init:function(c,d){c=this.words=c||[],d!=o?this.sigBytes=d:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,d=c.length,f=[],h=0;h<d;h++){var p=c[h];f.push(p.high),f.push(p.low)}return l.create(f,this.sigBytes)},clone:function(){for(var c=s.clone.call(this),d=c.words=this.words.slice(0),f=d.length,h=0;h<f;h++)d[h]=d[h].clone();return c}})})(),n})})(ti)),ti.exports}var pv=ei.exports,Rl;function gv(){return Rl||(Rl=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),hv())})(pv,function(n){return(function(){var o=n,i=o.lib,r=i.Hasher,s=o.x64,l=s.Word,u=s.WordArray,c=o.algo;function d(){return l.create.apply(l,arguments)}var f=[d(1116352408,3609767458),d(1899447441,602891725),d(3049323471,3964484399),d(3921009573,2173295548),d(961987163,4081628472),d(1508970993,3053834265),d(2453635748,2937671579),d(2870763221,3664609560),d(3624381080,2734883394),d(310598401,1164996542),d(607225278,1323610764),d(1426881987,3590304994),d(1925078388,4068182383),d(2162078206,991336113),d(2614888103,633803317),d(3248222580,3479774868),d(3835390401,2666613458),d(4022224774,944711139),d(264347078,2341262773),d(604807628,2007800933),d(770255983,1495990901),d(1249150122,1856431235),d(1555081692,3175218132),d(1996064986,2198950837),d(2554220882,3999719339),d(2821834349,766784016),d(2952996808,2566594879),d(3210313671,3203337956),d(3336571891,1034457026),d(3584528711,2466948901),d(113926993,3758326383),d(338241895,168717936),d(666307205,1188179964),d(773529912,1546045734),d(1294757372,1522805485),d(1396182291,2643833823),d(1695183700,2343527390),d(1986661051,1014477480),d(2177026350,1206759142),d(2456956037,344077627),d(2730485921,1290863460),d(2820302411,3158454273),d(3259730800,3505952657),d(3345764771,106217008),d(3516065817,3606008344),d(3600352804,1432725776),d(4094571909,1467031594),d(275423344,851169720),d(430227734,3100823752),d(506948616,1363258195),d(659060556,3750685593),d(883997877,3785050280),d(958139571,3318307427),d(1322822218,3812723403),d(1537002063,2003034995),d(1747873779,3602036899),d(1955562222,1575990012),d(2024104815,1125592928),d(2227730452,2716904306),d(2361852424,442776044),d(2428436474,593698344),d(2756734187,3733110249),d(3204031479,2999351573),d(3329325298,3815920427),d(3391569614,3928383900),d(3515267271,566280711),d(3940187606,3454069534),d(4118630271,4000239992),d(116418474,1914138554),d(174292421,2731055270),d(289380356,3203993006),d(460393269,320620315),d(685471733,587496836),d(852142971,1086792851),d(1017036298,365543100),d(1126000580,2618297676),d(1288033470,3409855158),d(1501505948,4234509866),d(1607167915,987167468),d(1816402316,1246189591)],h=[];(function(){for(var y=0;y<80;y++)h[y]=d()})();var p=c.SHA512=r.extend({_doReset:function(){this._hash=new u.init([new l.init(1779033703,4089235720),new l.init(3144134277,2227873595),new l.init(1013904242,4271175723),new l.init(2773480762,1595750129),new l.init(1359893119,2917565137),new l.init(2600822924,725511199),new l.init(528734635,4215389547),new l.init(1541459225,327033209)])},_doProcessBlock:function(y,m){for(var v=this._hash.words,N=v[0],_=v[1],g=v[2],x=v[3],z=v[4],$=v[5],F=v[6],X=v[7],Y=N.high,S=N.low,I=_.high,C=_.low,H=g.high,w=g.low,k=x.high,b=x.low,E=z.high,T=z.low,O=$.high,R=$.low,B=F.high,P=F.low,V=X.high,W=X.low,Z=Y,Q=S,q=I,ee=C,re=H,oe=w,ce=k,ie=b,ae=E,A=T,M=O,L=R,U=B,D=P,j=V,G=W,K=0;K<80;K++){var ne,te,fe=h[K];if(K<16)te=fe.high=y[m+K*2]|0,ne=fe.low=y[m+K*2+1]|0;else{var ge=h[K-15],Me=ge.high,Ie=ge.low,Ze=(Me>>>1|Ie<<31)^(Me>>>8|Ie<<24)^Me>>>7,_e=(Ie>>>1|Me<<31)^(Ie>>>8|Me<<24)^(Ie>>>7|Me<<25),xt=h[K-2],Et=xt.high,Ct=xt.low,Hr=(Et>>>19|Ct<<13)^(Et<<3|Ct>>>29)^Et>>>6,uc=(Ct>>>19|Et<<13)^(Ct<<3|Et>>>29)^(Ct>>>6|Et<<26),fc=h[K-7],u0=fc.high,f0=fc.low,hc=h[K-16],h0=hc.high,pc=hc.low;ne=_e+f0,te=Ze+u0+(ne>>>0<_e>>>0?1:0),ne=ne+uc,te=te+Hr+(ne>>>0<uc>>>0?1:0),ne=ne+pc,te=te+h0+(ne>>>0<pc>>>0?1:0),fe.high=te,fe.low=ne}var p0=ae&M^~ae&U,gc=A&L^~A&D,g0=Z&q^Z&re^q&re,m0=Q&ee^Q&oe^ee&oe,y0=(Z>>>28|Q<<4)^(Z<<30|Q>>>2)^(Z<<25|Q>>>7),mc=(Q>>>28|Z<<4)^(Q<<30|Z>>>2)^(Q<<25|Z>>>7),v0=(ae>>>14|A<<18)^(ae>>>18|A<<14)^(ae<<23|A>>>9),b0=(A>>>14|ae<<18)^(A>>>18|ae<<14)^(A<<23|ae>>>9),yc=f[K],w0=yc.high,vc=yc.low,Xe=G+b0,Bt=j+v0+(Xe>>>0<G>>>0?1:0),Xe=Xe+gc,Bt=Bt+p0+(Xe>>>0<gc>>>0?1:0),Xe=Xe+vc,Bt=Bt+w0+(Xe>>>0<vc>>>0?1:0),Xe=Xe+ne,Bt=Bt+te+(Xe>>>0<ne>>>0?1:0),bc=mc+m0,_0=y0+g0+(bc>>>0<mc>>>0?1:0);j=U,G=D,U=M,D=L,M=ae,L=A,A=ie+Xe|0,ae=ce+Bt+(A>>>0<ie>>>0?1:0)|0,ce=re,ie=oe,re=q,oe=ee,q=Z,ee=Q,Q=Xe+bc|0,Z=Bt+_0+(Q>>>0<Xe>>>0?1:0)|0}S=N.low=S+Q,N.high=Y+Z+(S>>>0<Q>>>0?1:0),C=_.low=C+ee,_.high=I+q+(C>>>0<ee>>>0?1:0),w=g.low=w+oe,g.high=H+re+(w>>>0<oe>>>0?1:0),b=x.low=b+ie,x.high=k+ce+(b>>>0<ie>>>0?1:0),T=z.low=T+A,z.high=E+ae+(T>>>0<A>>>0?1:0),R=$.low=R+L,$.high=O+M+(R>>>0<L>>>0?1:0),P=F.low=P+D,F.high=B+U+(P>>>0<D>>>0?1:0),W=X.low=W+G,X.high=V+j+(W>>>0<G>>>0?1:0)},_doFinalize:function(){var y=this._data,m=y.words,v=this._nDataBytes*8,N=y.sigBytes*8;m[N>>>5]|=128<<24-N%32,m[(N+128>>>10<<5)+30]=Math.floor(v/4294967296),m[(N+128>>>10<<5)+31]=v,y.sigBytes=m.length*4,this._process();var _=this._hash.toX32();return _},clone:function(){var y=r.clone.call(this);return y._hash=this._hash.clone(),y},blockSize:1024/32});o.SHA512=r._createHelper(p),o.HmacSHA512=r._createHmacHelper(p)})(),n.SHA512})})(ei)),ei.exports}gv();const{decrypt:G0,encrypt:j0}=ov;av.parse;function mv(t,e,n){return(e=wv(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bt(){return bt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},bt.apply(null,arguments)}function Hl(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function ct(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hl(Object(n),!0).forEach(function(o){mv(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hl(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function yv(t,e){if(t==null)return{};var n,o,i=vv(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function vv(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.indexOf(o)!==-1)continue;n[o]=t[o]}return n}function bv(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wv(t){var e=bv(t,"string");return typeof e=="symbol"?e:e+""}function _r(t){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_r(t)}var _v="1.15.7";function wt(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var _t=wt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Rn=wt(/Edge/i),Ll=wt(/firefox/i),Hn=wt(/safari/i)&&!wt(/chrome/i)&&!wt(/android/i),xr=wt(/iP(ad|od|hone)/i),Vl=wt(/chrome/i)&&wt(/android/i),Fl={capture:!1,passive:!1};function be(t,e,n){t.addEventListener(e,n,!_t&&Fl)}function ve(t,e,n){t.removeEventListener(e,n,!_t&&Fl)}function ni(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function Wl(t){return t.host&&t!==document&&t.host.nodeType&&t.host!==t?t.host:t.parentNode}function nt(t,e,n,o){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&ni(t,e):ni(t,e))||o&&t===n)return t;if(t===n)break}while(t=Wl(t))}return null}var Gl=/\s+/g;function Ye(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Gl," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Gl," ")}}function pe(t,e,n){var o=t&&t.style;if(o){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=n+(typeof n=="string"?"":"px")}}function rn(t,e){var n="";if(typeof t=="string")n=t;else do{var o=pe(t,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function jl(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function dt(){var t=document.scrollingElement;return t||document.documentElement}function De(t,e,n,o,i){if(!(!t.getBoundingClientRect&&t!==window)){var r,s,l,u,c,d,f;if(t!==window&&t.parentNode&&t!==dt()?(r=t.getBoundingClientRect(),s=r.top,l=r.left,u=r.bottom,c=r.right,d=r.height,f=r.width):(s=0,l=0,u=window.innerHeight,c=window.innerWidth,d=window.innerHeight,f=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!_t))do if(i&&i.getBoundingClientRect&&(pe(i,"transform")!=="none"||n&&pe(i,"position")!=="static")){var h=i.getBoundingClientRect();s-=h.top+parseInt(pe(i,"border-top-width")),l-=h.left+parseInt(pe(i,"border-left-width")),u=s+r.height,c=l+r.width;break}while(i=i.parentNode);if(o&&t!==window){var p=rn(i||t),y=p&&p.a,m=p&&p.d;p&&(s/=m,l/=y,f/=y,d/=m,u=s+d,c=l+f)}return{top:s,left:l,bottom:u,right:c,width:f,height:d}}}function Yl(t,e,n){for(var o=Tt(t,!0),i=De(t)[e];o;){var r=De(o)[n],s=void 0;if(s=i>=r,!s)return o;if(o===dt())break;o=Tt(o,!1)}return!1}function sn(t,e,n,o){for(var i=0,r=0,s=t.children;r<s.length;){if(s[r].style.display!=="none"&&s[r]!==me.ghost&&(o||s[r]!==me.dragged)&&nt(s[r],n.draggable,t,!1)){if(i===e)return s[r];i++}r++}return null}function Er(t,e){for(var n=t.lastElementChild;n&&(n===me.ghost||pe(n,"display")==="none"||e&&!ni(n,e));)n=n.previousElementSibling;return n||null}function Ke(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==me.clone&&(!e||ni(t,e))&&n++;return n}function Ul(t){var e=0,n=0,o=dt();if(t)do{var i=rn(t),r=i.a,s=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*s}while(t!==o&&(t=t.parentNode));return[e,n]}function xv(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n)}return-1}function Tt(t,e){if(!t||!t.getBoundingClientRect)return dt();var n=t,o=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=pe(n);if(n.clientWidth<n.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return dt();if(o||e)return n;o=!0}}while(n=n.parentNode);return dt()}function Ev(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Cr(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var Ln;function Xl(t,e){return function(){if(!Ln){var n=arguments,o=this;n.length===1?t.call(o,n[0]):t.apply(o,n),Ln=setTimeout(function(){Ln=void 0},e)}}}function Cv(){clearTimeout(Ln),Ln=void 0}function ql(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function Kl(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function Zl(t,e,n){var o={};return Array.from(t.children).forEach(function(i){var r,s,l,u;if(!(!nt(i,e.draggable,t,!1)||i.animated||i===n)){var c=De(i);o.left=Math.min((r=o.left)!==null&&r!==void 0?r:1/0,c.left),o.top=Math.min((s=o.top)!==null&&s!==void 0?s:1/0,c.top),o.right=Math.max((l=o.right)!==null&&l!==void 0?l:-1/0,c.right),o.bottom=Math.max((u=o.bottom)!==null&&u!==void 0?u:-1/0,c.bottom)}}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var Ve="Sortable"+new Date().getTime();function Sv(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(i){if(!(pe(i,"display")==="none"||i===me.ghost)){t.push({target:i,rect:De(i)});var r=ct({},t[t.length-1].rect);if(i.thisAnimationDuration){var s=rn(i,!0);s&&(r.top-=s.f,r.left-=s.e)}i.fromRect=r}})}},addAnimationState:function(o){t.push(o)},removeAnimationState:function(o){t.splice(xv(t,{target:o}),1)},animateAll:function(o){var i=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var r=!1,s=0;t.forEach(function(l){var u=0,c=l.target,d=c.fromRect,f=De(c),h=c.prevFromRect,p=c.prevToRect,y=l.rect,m=rn(c,!0);m&&(f.top-=m.f,f.left-=m.e),c.toRect=f,c.thisAnimationDuration&&Cr(h,f)&&!Cr(d,f)&&(y.top-f.top)/(y.left-f.left)===(d.top-f.top)/(d.left-f.left)&&(u=kv(y,h,p,i.options)),Cr(f,d)||(c.prevFromRect=d,c.prevToRect=f,u||(u=i.options.animation),i.animate(c,y,f,u)),u&&(r=!0,s=Math.max(s,u),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},u),c.thisAnimationDuration=u)}),clearTimeout(e),r?e=setTimeout(function(){typeof o=="function"&&o()},s):typeof o=="function"&&o(),t=[]},animate:function(o,i,r,s){if(s){pe(o,"transition",""),pe(o,"transform","");var l=rn(this.el),u=l&&l.a,c=l&&l.d,d=(i.left-r.left)/(u||1),f=(i.top-r.top)/(c||1);o.animatingX=!!d,o.animatingY=!!f,pe(o,"transform","translate3d("+d+"px,"+f+"px,0)"),this.forRepaintDummy=Nv(o),pe(o,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:"")),pe(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){pe(o,"transition",""),pe(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},s)}}}}function Nv(t){return t.offsetWidth}function kv(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}var an=[],Sr={initializeByDefault:!0},Vn={mount:function(e){for(var n in Sr)Sr.hasOwnProperty(n)&&!(n in e)&&(e[n]=Sr[n]);an.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),an.push(e)},pluginEvent:function(e,n,o){var i=this;this.eventCanceled=!1,o.cancel=function(){i.eventCanceled=!0};var r=e+"Global";an.forEach(function(s){n[s.pluginName]&&(n[s.pluginName][r]&&n[s.pluginName][r](ct({sortable:n},o)),n.options[s.pluginName]&&n[s.pluginName][e]&&n[s.pluginName][e](ct({sortable:n},o)))})},initializePlugins:function(e,n,o,i){an.forEach(function(l){var u=l.pluginName;if(!(!e.options[u]&&!l.initializeByDefault)){var c=new l(e,n,e.options);c.sortable=e,c.options=e.options,e[u]=c,bt(o,c.defaults)}});for(var r in e.options)if(e.options.hasOwnProperty(r)){var s=this.modifyOption(e,r,e.options[r]);typeof s<"u"&&(e.options[r]=s)}},getEventProperties:function(e,n){var o={};return an.forEach(function(i){typeof i.eventProperties=="function"&&bt(o,i.eventProperties.call(n[i.pluginName],e))}),o},modifyOption:function(e,n,o){var i;return an.forEach(function(r){e[r.pluginName]&&r.optionListeners&&typeof r.optionListeners[n]=="function"&&(i=r.optionListeners[n].call(e[r.pluginName],o))}),i}};function Dv(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,s=t.toEl,l=t.fromEl,u=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,f=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,y=t.extraEventProperties;if(e=e||n&&n[Ve],!!e){var m,v=e.options,N="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!_t&&!Rn?m=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent(o,!0,!0)),m.to=s||n,m.from=l||n,m.item=i||n,m.clone=r,m.oldIndex=u,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=f,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var _=ct(ct({},y),Vn.getEventProperties(o,e));for(var g in _)m[g]=_[g];n&&n.dispatchEvent(m),v[N]&&v[N].call(e,m)}}var Tv=["evt"],Fe=function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.evt,r=yv(o,Tv);Vn.pluginEvent.bind(me)(e,n,ct({dragEl:se,parentEl:Ce,ghostEl:ye,rootEl:xe,nextEl:Vt,lastDownEl:oi,cloneEl:Ee,cloneHidden:Mt,dragStarted:Wn,putSortable:Ae,activeSortable:me.active,originalEvent:i,oldIndex:ln,oldDraggableIndex:Fn,newIndex:Ue,newDraggableIndex:It,hideGhostForTarget:ic,unhideGhostForTarget:rc,cloneNowHidden:function(){Mt=!0},cloneNowShown:function(){Mt=!1},dispatchSortableEvent:function(l){Re({sortable:n,name:l,originalEvent:i})}},r))};function Re(t){Dv(ct({putSortable:Ae,cloneEl:Ee,targetEl:se,rootEl:xe,oldIndex:ln,oldDraggableIndex:Fn,newIndex:Ue,newDraggableIndex:It},t))}var se,Ce,ye,xe,Vt,oi,Ee,Mt,ln,Ue,Fn,It,ii,Ae,cn=!1,ri=!1,si=[],Ft,ot,Nr,kr,Jl,Ql,Wn,dn,Gn,jn=!1,ai=!1,li,Pe,Dr=[],Tr=!1,ci=[],di=typeof document<"u",ui=xr,ec=Rn||_t?"cssFloat":"float",Mv=di&&!Vl&&!xr&&"draggable"in document.createElement("div"),tc=(function(){if(di){if(_t)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}})(),nc=function(e,n){var o=pe(e),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=sn(e,0,n),s=sn(e,1,n),l=r&&pe(r),u=s&&pe(s),c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+De(r).width,d=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+De(s).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&l.float&&l.float!=="none"){var f=l.float==="left"?"left":"right";return s&&(u.clear==="both"||u.clear===f)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||c>=i&&o[ec]==="none"||s&&o[ec]==="none"&&c+d>i)?"vertical":"horizontal"},Iv=function(e,n,o){var i=o?e.left:e.top,r=o?e.right:e.bottom,s=o?e.width:e.height,l=o?n.left:n.top,u=o?n.right:n.bottom,c=o?n.width:n.height;return i===l||r===u||i+s/2===l+c/2},Bv=function(e,n){var o;return si.some(function(i){var r=i[Ve].options.emptyInsertThreshold;if(!(!r||Er(i))){var s=De(i),l=e>=s.left-r&&e<=s.right+r,u=n>=s.top-r&&n<=s.bottom+r;if(l&&u)return o=i}}),o},oc=function(e){function n(r,s){return function(l,u,c,d){var f=l.options.group.name&&u.options.group.name&&l.options.group.name===u.options.group.name;if(r==null&&(s||f))return!0;if(r==null||r===!1)return!1;if(s&&r==="clone")return r;if(typeof r=="function")return n(r(l,u,c,d),s)(l,u,c,d);var h=(s?l:u).options.group.name;return r===!0||typeof r=="string"&&r===h||r.join&&r.indexOf(h)>-1}}var o={},i=e.group;(!i||_r(i)!="object")&&(i={name:i}),o.name=i.name,o.checkPull=n(i.pull,!0),o.checkPut=n(i.put),o.revertClone=i.revertClone,e.group=o},ic=function(){!tc&&ye&&pe(ye,"display","none")},rc=function(){!tc&&ye&&pe(ye,"display","")};di&&!Vl&&document.addEventListener("click",function(t){if(ri)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ri=!1,!1},!0);var Wt=function(e){if(se){e=e.touches?e.touches[0]:e;var n=Bv(e.clientX,e.clientY);if(n){var o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=n,o.preventDefault=void 0,o.stopPropagation=void 0,n[Ve]._onDragOver(o)}}},$v=function(e){se&&se.parentNode[Ve]._isOutsideThisEl(e.target)};function me(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=bt({},e),t[Ve]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return nc(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,l){s.setData("Text",l.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:me.supportPointer!==!1&&"PointerEvent"in window&&(!Hn||xr),emptyInsertThreshold:5};Vn.initializePlugins(this,t,n);for(var o in n)!(o in e)&&(e[o]=n[o]);oc(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:Mv,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?be(t,"pointerdown",this._onTapStart):(be(t,"mousedown",this._onTapStart),be(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(be(t,"dragover",this),be(t,"dragenter",this)),si.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),bt(this,Sv())}me.prototype={constructor:me,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(dn=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,se):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,i=this.options,r=i.preventOnFilter,s=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,u=(l||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,d=i.filter;if(Vv(o),!se&&!(/mousedown|pointerdown/.test(s)&&e.button!==0||i.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Hn&&u&&u.tagName.toUpperCase()==="SELECT")&&(u=nt(u,i.draggable,o,!1),!(u&&u.animated)&&oi!==u)){if(ln=Ke(u),Fn=Ke(u,i.draggable),typeof d=="function"){if(d.call(this,e,u,this)){Re({sortable:n,rootEl:c,name:"filter",targetEl:u,toEl:o,fromEl:o}),Fe("filter",n,{evt:e}),r&&e.preventDefault();return}}else if(d&&(d=d.split(",").some(function(f){if(f=nt(c,f.trim(),o,!1),f)return Re({sortable:n,rootEl:f,name:"filter",targetEl:u,fromEl:o,toEl:o}),Fe("filter",n,{evt:e}),!0}),d)){r&&e.preventDefault();return}i.handle&&!nt(c,i.handle,o,!1)||this._prepareDragStart(e,l,u)}}},_prepareDragStart:function(e,n,o){var i=this,r=i.el,s=i.options,l=r.ownerDocument,u;if(o&&!se&&o.parentNode===r){var c=De(o);if(xe=r,se=o,Ce=se.parentNode,Vt=se.nextSibling,oi=o,ii=s.group,me.dragged=se,Ft={target:se,clientX:(n||e).clientX,clientY:(n||e).clientY},Jl=Ft.clientX-c.left,Ql=Ft.clientY-c.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,se.style["will-change"]="all",u=function(){if(Fe("delayEnded",i,{evt:e}),me.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Ll&&i.nativeDraggable&&(se.draggable=!0),i._triggerDragStart(e,n),Re({sortable:i,name:"choose",originalEvent:e}),Ye(se,s.chosenClass,!0)},s.ignore.split(",").forEach(function(d){jl(se,d.trim(),Mr)}),be(l,"dragover",Wt),be(l,"mousemove",Wt),be(l,"touchmove",Wt),s.supportPointer?(be(l,"pointerup",i._onDrop),!this.nativeDraggable&&be(l,"pointercancel",i._onDrop)):(be(l,"mouseup",i._onDrop),be(l,"touchend",i._onDrop),be(l,"touchcancel",i._onDrop)),Ll&&this.nativeDraggable&&(this.options.touchStartThreshold=4,se.draggable=!0),Fe("delayStart",this,{evt:e}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Rn||_t))){if(me.eventCanceled){this._onDrop();return}s.supportPointer?(be(l,"pointerup",i._disableDelayedDrag),be(l,"pointercancel",i._disableDelayedDrag)):(be(l,"mouseup",i._disableDelayedDrag),be(l,"touchend",i._disableDelayedDrag),be(l,"touchcancel",i._disableDelayedDrag)),be(l,"mousemove",i._delayedDragTouchMoveHandler),be(l,"touchmove",i._delayedDragTouchMoveHandler),s.supportPointer&&be(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(u,s.delay)}else u()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){se&&Mr(se),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;ve(e,"mouseup",this._disableDelayedDrag),ve(e,"touchend",this._disableDelayedDrag),ve(e,"touchcancel",this._disableDelayedDrag),ve(e,"pointerup",this._disableDelayedDrag),ve(e,"pointercancel",this._disableDelayedDrag),ve(e,"mousemove",this._delayedDragTouchMoveHandler),ve(e,"touchmove",this._delayedDragTouchMoveHandler),ve(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?be(document,"pointermove",this._onTouchMove):n?be(document,"touchmove",this._onTouchMove):be(document,"mousemove",this._onTouchMove):(be(se,"dragend",this),be(xe,"dragstart",this._onDragStart));try{document.selection?hi(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,n){if(cn=!1,xe&&se){Fe("dragStarted",this,{evt:n}),this.nativeDraggable&&be(document,"dragover",$v);var o=this.options;!e&&Ye(se,o.dragClass,!1),Ye(se,o.ghostClass,!0),me.active=this,e&&this._appendGhost(),Re({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(ot){this._lastX=ot.clientX,this._lastY=ot.clientY,ic();for(var e=document.elementFromPoint(ot.clientX,ot.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ot.clientX,ot.clientY),e!==n);)n=e;if(se.parentNode[Ve]._isOutsideThisEl(e),n)do{if(n[Ve]){var o=void 0;if(o=n[Ve]._onDragOver({clientX:ot.clientX,clientY:ot.clientY,target:e,rootEl:n}),o&&!this.options.dragoverBubble)break}e=n}while(n=Wl(n));rc()}},_onTouchMove:function(e){if(Ft){var n=this.options,o=n.fallbackTolerance,i=n.fallbackOffset,r=e.touches?e.touches[0]:e,s=ye&&rn(ye,!0),l=ye&&s&&s.a,u=ye&&s&&s.d,c=ui&&Pe&&Ul(Pe),d=(r.clientX-Ft.clientX+i.x)/(l||1)+(c?c[0]-Dr[0]:0)/(l||1),f=(r.clientY-Ft.clientY+i.y)/(u||1)+(c?c[1]-Dr[1]:0)/(u||1);if(!me.active&&!cn){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(ye){s?(s.e+=d-(Nr||0),s.f+=f-(kr||0)):s={a:1,b:0,c:0,d:1,e:d,f};var h="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");pe(ye,"webkitTransform",h),pe(ye,"mozTransform",h),pe(ye,"msTransform",h),pe(ye,"transform",h),Nr=d,kr=f,ot=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!ye){var e=this.options.fallbackOnBody?document.body:xe,n=De(se,!0,ui,!0,e),o=this.options;if(ui){for(Pe=e;pe(Pe,"position")==="static"&&pe(Pe,"transform")==="none"&&Pe!==document;)Pe=Pe.parentNode;Pe!==document.body&&Pe!==document.documentElement?(Pe===document&&(Pe=dt()),n.top+=Pe.scrollTop,n.left+=Pe.scrollLeft):Pe=dt(),Dr=Ul(Pe)}ye=se.cloneNode(!0),Ye(ye,o.ghostClass,!1),Ye(ye,o.fallbackClass,!0),Ye(ye,o.dragClass,!0),pe(ye,"transition",""),pe(ye,"transform",""),pe(ye,"box-sizing","border-box"),pe(ye,"margin",0),pe(ye,"top",n.top),pe(ye,"left",n.left),pe(ye,"width",n.width),pe(ye,"height",n.height),pe(ye,"opacity","0.8"),pe(ye,"position",ui?"absolute":"fixed"),pe(ye,"zIndex","100000"),pe(ye,"pointerEvents","none"),me.ghost=ye,e.appendChild(ye),pe(ye,"transform-origin",Jl/parseInt(ye.style.width)*100+"% "+Ql/parseInt(ye.style.height)*100+"%")}},_onDragStart:function(e,n){var o=this,i=e.dataTransfer,r=o.options;if(Fe("dragStart",this,{evt:e}),me.eventCanceled){this._onDrop();return}Fe("setupClone",this),me.eventCanceled||(Ee=Kl(se),Ee.removeAttribute("id"),Ee.draggable=!1,Ee.style["will-change"]="",this._hideClone(),Ye(Ee,this.options.chosenClass,!1),me.clone=Ee),o.cloneId=hi(function(){Fe("clone",o),!me.eventCanceled&&(o.options.removeCloneOnHide||xe.insertBefore(Ee,se),o._hideClone(),Re({sortable:o,name:"clone"}))}),!n&&Ye(se,r.dragClass,!0),n?(ri=!0,o._loopId=setInterval(o._emulateDragOver,50)):(ve(document,"mouseup",o._onDrop),ve(document,"touchend",o._onDrop),ve(document,"touchcancel",o._onDrop),i&&(i.effectAllowed="move",r.setData&&r.setData.call(o,i,se)),be(document,"drop",o),pe(se,"transform","translateZ(0)")),cn=!0,o._dragStartId=hi(o._dragStarted.bind(o,n,e)),be(document,"selectstart",o),Wn=!0,window.getSelection().removeAllRanges(),Hn&&pe(document.body,"user-select","none")},_onDragOver:function(e){var n=this.el,o=e.target,i,r,s,l=this.options,u=l.group,c=me.active,d=ii===u,f=l.sort,h=Ae||c,p,y=this,m=!1;if(Tr)return;function v(T,O){Fe(T,y,ct({evt:e,isOwner:d,axis:p?"vertical":"horizontal",revert:s,dragRect:i,targetRect:r,canSort:f,fromSortable:h,target:o,completed:_,onMove:function(B,P){return fi(xe,n,se,i,B,De(B),e,P)},changed:g},O))}function N(){v("dragOverAnimationCapture"),y.captureAnimationState(),y!==h&&h.captureAnimationState()}function _(T){return v("dragOverCompleted",{insertion:T}),T&&(d?c._hideClone():c._showClone(y),y!==h&&(Ye(se,Ae?Ae.options.ghostClass:c.options.ghostClass,!1),Ye(se,l.ghostClass,!0)),Ae!==y&&y!==me.active?Ae=y:y===me.active&&Ae&&(Ae=null),h===y&&(y._ignoreWhileAnimating=o),y.animateAll(function(){v("dragOverAnimationComplete"),y._ignoreWhileAnimating=null}),y!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(o===se&&!se.animated||o===n&&!o.animated)&&(dn=null),!l.dragoverBubble&&!e.rootEl&&o!==document&&(se.parentNode[Ve]._isOutsideThisEl(e.target),!T&&Wt(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),m=!0}function g(){Ue=Ke(se),It=Ke(se,l.draggable),Re({sortable:y,name:"change",toEl:n,newIndex:Ue,newDraggableIndex:It,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=nt(o,l.draggable,n,!0),v("dragOver"),me.eventCanceled)return m;if(se.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||y._ignoreWhileAnimating===o)return _(!1);if(ri=!1,c&&!l.disabled&&(d?f||(s=Ce!==xe):Ae===this||(this.lastPutMode=ii.checkPull(this,c,se,e))&&u.checkPut(this,c,se,e))){if(p=this._getDirection(e,o)==="vertical",i=De(se),v("dragOverValid"),me.eventCanceled)return m;if(s)return Ce=xe,N(),this._hideClone(),v("revert"),me.eventCanceled||(Vt?xe.insertBefore(se,Vt):xe.appendChild(se)),_(!0);var x=Er(n,l.draggable);if(!x||Ov(e,p,this)&&!x.animated){if(x===se)return _(!1);if(x&&n===e.target&&(o=x),o&&(r=De(o)),fi(xe,n,se,i,o,r,e,!!o)!==!1)return N(),x&&x.nextSibling?n.insertBefore(se,x.nextSibling):n.appendChild(se),Ce=n,g(),_(!0)}else if(x&&Pv(e,p,this)){var z=sn(n,0,l,!0);if(z===se)return _(!1);if(o=z,r=De(o),fi(xe,n,se,i,o,r,e,!1)!==!1)return N(),n.insertBefore(se,z),Ce=n,g(),_(!0)}else if(o.parentNode===n){r=De(o);var $=0,F,X=se.parentNode!==n,Y=!Iv(se.animated&&se.toRect||i,o.animated&&o.toRect||r,p),S=p?"top":"left",I=Yl(o,"top","top")||Yl(se,"top","top"),C=I?I.scrollTop:void 0;dn!==o&&(F=r[S],jn=!1,ai=!Y&&l.invertSwap||X),$=Rv(e,o,r,p,Y?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,ai,dn===o);var H;if($!==0){var w=Ke(se);do w-=$,H=Ce.children[w];while(H&&(pe(H,"display")==="none"||H===ye))}if($===0||H===o)return _(!1);dn=o,Gn=$;var k=o.nextElementSibling,b=!1;b=$===1;var E=fi(xe,n,se,i,o,r,e,b);if(E!==!1)return(E===1||E===-1)&&(b=E===1),Tr=!0,setTimeout(Av,30),N(),b&&!k?n.appendChild(se):o.parentNode.insertBefore(se,b?k:o),I&&ql(I,0,C-I.scrollTop),Ce=se.parentNode,F!==void 0&&!ai&&(li=Math.abs(F-De(o)[S])),g(),_(!0)}if(n.contains(se))return _(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){ve(document,"mousemove",this._onTouchMove),ve(document,"touchmove",this._onTouchMove),ve(document,"pointermove",this._onTouchMove),ve(document,"dragover",Wt),ve(document,"mousemove",Wt),ve(document,"touchmove",Wt)},_offUpEvents:function(){var e=this.el.ownerDocument;ve(e,"mouseup",this._onDrop),ve(e,"touchend",this._onDrop),ve(e,"pointerup",this._onDrop),ve(e,"pointercancel",this._onDrop),ve(e,"touchcancel",this._onDrop),ve(document,"selectstart",this)},_onDrop:function(e){var n=this.el,o=this.options;if(Ue=Ke(se),It=Ke(se,o.draggable),Fe("drop",this,{evt:e}),Ce=se&&se.parentNode,Ue=Ke(se),It=Ke(se,o.draggable),me.eventCanceled){this._nulling();return}cn=!1,ai=!1,jn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ir(this.cloneId),Ir(this._dragStartId),this.nativeDraggable&&(ve(document,"drop",this),ve(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Hn&&pe(document.body,"user-select",""),pe(se,"transform",""),e&&(Wn&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),ye&&ye.parentNode&&ye.parentNode.removeChild(ye),(xe===Ce||Ae&&Ae.lastPutMode!=="clone")&&Ee&&Ee.parentNode&&Ee.parentNode.removeChild(Ee),se&&(this.nativeDraggable&&ve(se,"dragend",this),Mr(se),se.style["will-change"]="",Wn&&!cn&&Ye(se,Ae?Ae.options.ghostClass:this.options.ghostClass,!1),Ye(se,this.options.chosenClass,!1),Re({sortable:this,name:"unchoose",toEl:Ce,newIndex:null,newDraggableIndex:null,originalEvent:e}),xe!==Ce?(Ue>=0&&(Re({rootEl:Ce,name:"add",toEl:Ce,fromEl:xe,originalEvent:e}),Re({sortable:this,name:"remove",toEl:Ce,originalEvent:e}),Re({rootEl:Ce,name:"sort",toEl:Ce,fromEl:xe,originalEvent:e}),Re({sortable:this,name:"sort",toEl:Ce,originalEvent:e})),Ae&&Ae.save()):Ue!==ln&&Ue>=0&&(Re({sortable:this,name:"update",toEl:Ce,originalEvent:e}),Re({sortable:this,name:"sort",toEl:Ce,originalEvent:e})),me.active&&((Ue==null||Ue===-1)&&(Ue=ln,It=Fn),Re({sortable:this,name:"end",toEl:Ce,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){Fe("nulling",this),xe=se=Ce=ye=Vt=Ee=oi=Mt=Ft=ot=Wn=Ue=It=ln=Fn=dn=Gn=Ae=ii=me.dragged=me.ghost=me.clone=me.active=null;var e=this.el;ci.forEach(function(n){e.contains(n)&&(n.checked=!0)}),ci.length=Nr=kr=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":se&&(this._onDragOver(e),zv(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,o=this.el.children,i=0,r=o.length,s=this.options;i<r;i++)n=o[i],nt(n,s.draggable,this.el,!1)&&e.push(n.getAttribute(s.dataIdAttr)||Lv(n));return e},sort:function(e,n){var o={},i=this.el;this.toArray().forEach(function(r,s){var l=i.children[s];nt(l,this.options.draggable,i,!1)&&(o[r]=l)},this),n&&this.captureAnimationState(),e.forEach(function(r){o[r]&&(i.removeChild(o[r]),i.appendChild(o[r]))}),n&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,n){return nt(e,n||this.options.draggable,this.el,!1)},option:function(e,n){var o=this.options;if(n===void 0)return o[e];var i=Vn.modifyOption(this,e,n);typeof i<"u"?o[e]=i:o[e]=n,e==="group"&&oc(o)},destroy:function(){Fe("destroy",this);var e=this.el;e[Ve]=null,ve(e,"mousedown",this._onTapStart),ve(e,"touchstart",this._onTapStart),ve(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(ve(e,"dragover",this),ve(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),si.splice(si.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Mt){if(Fe("hideClone",this),me.eventCanceled)return;pe(Ee,"display","none"),this.options.removeCloneOnHide&&Ee.parentNode&&Ee.parentNode.removeChild(Ee),Mt=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(Mt){if(Fe("showClone",this),me.eventCanceled)return;se.parentNode==xe&&!this.options.group.revertClone?xe.insertBefore(Ee,se):Vt?xe.insertBefore(Ee,Vt):xe.appendChild(Ee),this.options.group.revertClone&&this.animate(se,Ee),pe(Ee,"display",""),Mt=!1}}};function zv(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function fi(t,e,n,o,i,r,s,l){var u,c=t[Ve],d=c.options.onMove,f;return window.CustomEvent&&!_t&&!Rn?u=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(u=document.createEvent("Event"),u.initEvent("move",!0,!0)),u.to=e,u.from=t,u.dragged=n,u.draggedRect=o,u.related=i||e,u.relatedRect=r||De(e),u.willInsertAfter=l,u.originalEvent=s,t.dispatchEvent(u),d&&(f=d.call(c,u,s)),f}function Mr(t){t.draggable=!1}function Av(){Tr=!1}function Pv(t,e,n){var o=De(sn(n.el,0,n.options,!0)),i=Zl(n.el,n.options,ye),r=10;return e?t.clientX<i.left-r||t.clientY<o.top&&t.clientX<o.right:t.clientY<i.top-r||t.clientY<o.bottom&&t.clientX<o.left}function Ov(t,e,n){var o=De(Er(n.el,n.options.draggable)),i=Zl(n.el,n.options,ye),r=10;return e?t.clientX>i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}function Rv(t,e,n,o,i,r,s,l){var u=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,f=o?n.bottom:n.right,h=!1;if(!s){if(l&&li<c*i){if(!jn&&(Gn===1?u>d+c*r/2:u<f-c*r/2)&&(jn=!0),jn)h=!0;else if(Gn===1?u<d+li:u>f-li)return-Gn}else if(u>d+c*(1-i)/2&&u<f-c*(1-i)/2)return Hv(e)}return h=h||s,h&&(u<d+c*r/2||u>f-c*r/2)?u>d+c/2?1:-1:0}function Hv(t){return Ke(se)<Ke(t)?1:-1}function Lv(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Vv(t){ci.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&ci.push(o)}}function hi(t){return setTimeout(t,0)}function Ir(t){return clearTimeout(t)}di&&be(document,"touchmove",function(t){(me.active||cn)&&t.cancelable&&t.preventDefault()}),me.utils={on:be,off:ve,css:pe,find:jl,is:function(e,n){return!!nt(e,n,e,!1)},extend:Ev,throttle:Xl,closest:nt,toggleClass:Ye,clone:Kl,index:Ke,nextTick:hi,cancelNextTick:Ir,detectDirection:nc,getChild:sn,expando:Ve},me.get=function(t){return t[Ve]},me.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(me.utils=ct(ct({},me.utils),o.utils)),Vn.mount(o)})},me.create=function(t,e){return new me(t,e)},me.version=_v;var Te=[],Yn,Br,$r=!1,zr,Ar,pi,Un;function Fv(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(n){var o=n.originalEvent;this.sortable.nativeDraggable?be(document,"dragover",this._handleAutoScroll):this.options.supportPointer?be(document,"pointermove",this._handleFallbackAutoScroll):o.touches?be(document,"touchmove",this._handleFallbackAutoScroll):be(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var o=n.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?ve(document,"dragover",this._handleAutoScroll):(ve(document,"pointermove",this._handleFallbackAutoScroll),ve(document,"touchmove",this._handleFallbackAutoScroll),ve(document,"mousemove",this._handleFallbackAutoScroll)),sc(),gi(),Cv()},nulling:function(){pi=Br=Yn=$r=Un=zr=Ar=null,Te.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,o){var i=this,r=(n.touches?n.touches[0]:n).clientX,s=(n.touches?n.touches[0]:n).clientY,l=document.elementFromPoint(r,s);if(pi=n,o||this.options.forceAutoScrollFallback||Rn||_t||Hn){Pr(n,this.options,l,o);var u=Tt(l,!0);$r&&(!Un||r!==zr||s!==Ar)&&(Un&&sc(),Un=setInterval(function(){var c=Tt(document.elementFromPoint(r,s),!0);c!==u&&(u=c,gi()),Pr(n,i.options,c,o)},10),zr=r,Ar=s)}else{if(!this.options.bubbleScroll||Tt(l,!0)===dt()){gi();return}Pr(n,this.options,Tt(l,!1),!1)}}},bt(t,{pluginName:"scroll",initializeByDefault:!0})}function gi(){Te.forEach(function(t){clearInterval(t.pid)}),Te=[]}function sc(){clearInterval(Un)}var Pr=Xl(function(t,e,n,o){if(e.scroll){var i=(t.touches?t.touches[0]:t).clientX,r=(t.touches?t.touches[0]:t).clientY,s=e.scrollSensitivity,l=e.scrollSpeed,u=dt(),c=!1,d;Br!==n&&(Br=n,gi(),Yn=e.scroll,d=e.scrollFn,Yn===!0&&(Yn=Tt(n,!0)));var f=0,h=Yn;do{var p=h,y=De(p),m=y.top,v=y.bottom,N=y.left,_=y.right,g=y.width,x=y.height,z=void 0,$=void 0,F=p.scrollWidth,X=p.scrollHeight,Y=pe(p),S=p.scrollLeft,I=p.scrollTop;p===u?(z=g<F&&(Y.overflowX==="auto"||Y.overflowX==="scroll"||Y.overflowX==="visible"),$=x<X&&(Y.overflowY==="auto"||Y.overflowY==="scroll"||Y.overflowY==="visible")):(z=g<F&&(Y.overflowX==="auto"||Y.overflowX==="scroll"),$=x<X&&(Y.overflowY==="auto"||Y.overflowY==="scroll"));var C=z&&(Math.abs(_-i)<=s&&S+g<F)-(Math.abs(N-i)<=s&&!!S),H=$&&(Math.abs(v-r)<=s&&I+x<X)-(Math.abs(m-r)<=s&&!!I);if(!Te[f])for(var w=0;w<=f;w++)Te[w]||(Te[w]={});(Te[f].vx!=C||Te[f].vy!=H||Te[f].el!==p)&&(Te[f].el=p,Te[f].vx=C,Te[f].vy=H,clearInterval(Te[f].pid),(C!=0||H!=0)&&(c=!0,Te[f].pid=setInterval((function(){o&&this.layer===0&&me.active._onTouchMove(pi);var k=Te[this.layer].vy?Te[this.layer].vy*l:0,b=Te[this.layer].vx?Te[this.layer].vx*l:0;typeof d=="function"&&d.call(me.dragged.parentNode[Ve],b,k,t,pi,Te[this.layer].el)!=="continue"||ql(Te[this.layer].el,b,k)}).bind({layer:f}),24))),f++}while(e.bubbleScroll&&h!==u&&(h=Tt(h,!1)));$r=c}},30),ac=function(e){var n=e.originalEvent,o=e.putSortable,i=e.dragEl,r=e.activeSortable,s=e.dispatchSortableEvent,l=e.hideGhostForTarget,u=e.unhideGhostForTarget;if(n){var c=o||r;l();var d=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,f=document.elementFromPoint(d.clientX,d.clientY);u(),c&&!c.el.contains(f)&&(s("spill"),this.onSpill({dragEl:i,putSortable:o}))}};function Or(){}Or.prototype={startIndex:null,dragStart:function(e){var n=e.oldDraggableIndex;this.startIndex=n},onSpill:function(e){var n=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var i=sn(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(n,i):this.sortable.el.appendChild(n),this.sortable.animateAll(),o&&o.animateAll()},drop:ac},bt(Or,{pluginName:"revertOnSpill"});function Rr(){}Rr.prototype={onSpill:function(e){var n=e.dragEl,o=e.putSortable,i=o||this.sortable;i.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),i.animateAll()},drop:ac},bt(Rr,{pluginName:"removeOnSpill"}),me.mount(new Fv),me.mount(Rr,Or);const Wv=(t,e,n,o,i,r,s,l)=>{const u=a.ref(),c=a.reactive({}),d=a.computed(()=>{const b=[];return Object.keys(c).forEach(E=>{const T=c[E];T.dragType==="component"&&T.type!=="pkey"&&b.push(T)}),b}),f=(b=[],E)=>{const T=e?.value?.init;typeof T=="function"&&T(b,E)},h=b=>i?i(b,{componentDic:c,components:d.value,configData:u.value.config}):{},p=(b,E)=>{if(u.value?.id===b)return;const T=c[b]||E;if(T?u.value=T:b===n.id?u.value=n:u.value=null,u.value){const O=r[u.value.type];O?(f(O,u.value.config),h(u.value.type)):f([])}else f([]);E&&Se("dragClick",{id:E.id})},y=()=>t.value.$el.getBoundingClientRect(),m=b=>b===n.id?n:c[b]||{},v=b=>{const E=[];if(b===n.id)E.push({id:b,name:n.name});else{const T=c[b];if(T){E.push({id:b,name:T.name});const O=v(T.containerId);E.push(...O)}}return E},N=(b,E)=>{const T=c[E];if(T===void 0)return!1;const O=T.containerId;return b===O?!0:O===n.id?!1:N(b,O)},_=b=>o?o(b)||{}:{},g=(b,E,T,O)=>{if(l){const R=m(b);return l(T.componentType,{container:R,groupId:E,configData:T},O)}return!1},x=({name:b,type:E,dragType:T,isInput:O,componentName:R,runtimeType:B},P,V,W,Z=!1)=>{const Q=_(E);if(Q.id=jt(),Q.span=24,Q.componentType=E,z(P,Q.componentType))return;g(P,W,Q,!0);const q={id:Q.id,name:b,type:E,runtimeType:B,componentName:R||"",dragType:T||"component",containerId:P,isInput:!!O,level:c[P]?c[P].level+1:1,config:Q,isNewAdd:!Z,groupId:W};return q.dragType==="container"&&(q.children=[]),c[q.id]=q,m(P).children?.splice(V,0,q),q},z=(b,E)=>!!(m(b).config.componentType==="gridtable"&&["divider","label","text","textEditor","viewTable","card","collapse","tabs","qrcode","barcode","tableLayout"].includes(E)),$=(b,E,T=!1)=>{let O=null;const R=m(b).children,B=R?.findIndex(P=>P.id===E)||0;if(T&&R&&R.length>1){let P=B+1;B>0&&(P=B-1),O=R[P]}return R?.splice(B,1),O?.id},F=(b,E,T,O)=>{const R=m(E).children,B=b.containerId!==E;b.containerId=E,b.groupId=O,R?.splice(T,0,b),g(E,O,b.config,B)&&(H(),p(b.id))},X=b=>{let E="";const T=m(b);return T&&(T.children&&T.children.length>0&&T.children.forEach(O=>{X(O.id)}),E=$(T.containerId,b,!0)||"",delete c[b]),u.value&&u.value.id===b&&(u.value=null,e.value.init([])),E},Y=(b,E=[])=>{const T=m(b);if(T&&T.children&&T.children.length>0){const O=[];T.children.forEach(R=>{R.groupId&&E.includes(R.groupId)&&O.push(R.id)}),O.forEach(R=>{X(R),delete c[R]})}},S=(b,E)=>{const T=m(b);T&&(T.children&&T.children.length>0&&T.children.forEach(O=>{O.groupId===E&&X(O.id)}),delete c[b])},I=b=>{const E=mi(m(b));E.id=jt(),E.config.id=E.id,c[E.id]=E;const T=m(E.containerId).children,O=T?.findIndex(R=>R.id===b)||0;T?.splice(O+1,0,E)},C=()=>{n.children=[],wc(c),u.value&&(Se("dragClick",{id:""}),u.value=null,e.value.init([]))},H=()=>{u.value&&(Se("dragClick",{id:""}),u.value=null,e.value.init([]))},w=b=>{const E=u.value,T=m(E.containerId).children,O=T?.findIndex(R=>R.id===E.id)||0;X(E.id),a.nextTick(()=>{const R=s[b],B=_(b);B.id=E.id,B.span=E.config.span,B.componentType=b,B.table=E.config.table,B.field=E.config.field,E.config.isSubTable&&(B.isSubTable=E.config.isSubTable);const P={id:B.id,name:R.name,type:b,runtimeType:R.runtimeType,componentName:R.componentName||"",dragType:E.dragType,groupId:E.groupId,containerId:E.containerId,isInput:E.isInput,level:E.level,config:B,isNewAdd:!0};c[P.id]=P,T?.splice(O,0,P)})},k=b=>{Se("dragAddByClick",b)};return a.provide("d-drag-design-provide",{activedComponent:u,getDesignLocals:y,getComponent:m,getParentComponents:v,isMyChildComponent:N,selectComponent:p,addComponent:x,deleteComponent:X,copyComponent:I,removeComponentFromContainer:$,addComponentToContainer:F,top:n,deleteChildren:S,deleteChildrens:Y}),{activedComponent:u,clearComponents:C,changeComponent:w,schemaComponentDic:c,clearSelect:H,addComponent:x,addComponentByTable:k,designComponentList:d}},Gv=a.defineComponent({__name:"importComponent",props:{componentList:{type:Array,default:()=>[]},tableList:{type:Array,default:()=>[]}},setup(t,{expose:e}){const n=t,o=a.computed(()=>n.tableList.map(c=>({label:c.comment?`${c.name}(${c.comment})`:c.name,value:c.name}))),i=a.ref(),r=[{id:"layout",type:"j-layout",config:{top:48,topMove:!1,autoSize:["default"]},children:[{id:"table",type:"j-select",slot:"top",config:{label:"表名选择",loadOptions:()=>o,allowClear:!1}},{id:"fields",type:"j-table",config:{editConfig:{isAddBtn:!1,isRemoveBtn:!1},height:"100%",isMultiple:!0},children:[{id:"name",type:"span",config:{label:"字段名"}},{id:"type",type:"j-select",config:{label:"组件选择",options:n.componentList,width:200}}]}]}],s=(c,d)=>{if(c.id==="table"){const f=n.tableList.find(h=>h.name===d.value);if(f){const h=f.columns.map(p=>({value:p.name,name:p.coment?`${p.name}(${p.coment})`:p.name,type:"input",label:p.coment||p.name,selected:!p.isPrimary}));i.value.setFormData({fields:h})}}};return a.onMounted(()=>{i.value.init(r)}),e({ok:()=>{const c=i.value.getFormData(!1);return{addList:c.fields.filter(f=>f.selected),table:c.table,containerId:c.containerId,isSubTable:c.isSubTable}},closed:()=>{}}),(c,d)=>{const f=a.resolveComponent("j-form");return a.openBlock(),a.createBlock(f,{ref_key:"formRef",ref:i,"form-config":{labelWidth:"72px"},onChange:s},null,512)}}}),jv={APP_PROVIDE:"jcode_app_provide"};function Yv(t,e){return a.inject(t,e)}function lc(){return Yv(jv.APP_PROVIDE,{t:(t,...e)=>{if(!t)return"";if(typeof t!="string")return t;let n=t||"";return e.length>0&&e.forEach((o,i)=>{n=n.replace(new RegExp(`\\{${i}\\}`,"g"),o)}),n.replace(/\$.\[^\$\$]*\$/,"")},useFile:()=>({}),useData:()=>({getLabel:({value:t,config:e})=>{if(t==null||t==="")return"";if(e?.dataType==="options"){let n=[t];typeof t=="string"&&t.split&&(n=t.split(","));const i=(e.options||[]).filter(r=>n.includes(r[e.valueKey||"value"])).map(r=>r[e.labelKey||"label"]);return String(i)||t}return t},getObjectList:({value:t,config:e})=>{if(t==null||t==="")return[];if(e?.dataType==="options"){let n=[t];return typeof t=="string"&&t.split&&(n=t.split(",")),(e.options||[]).filter(r=>n.includes(r[e.valueKey||"value"]))||[]}return[]}})})}const Uv=a.defineComponent({props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(t){const{t:e}=lc(),n=a.computed(()=>t.componentData.config?.notShowLabel?"0px":t.componentData.config?.labelWidth===void 0&&t.globalConfig.labelWidth!==void 0?`${t.globalConfig.labelWidth}px`:t.componentData.config?.labelWidth?`${t.componentData.config?.labelWidth}px`:void 0),o=a.computed(()=>{const i={...t.componentData?.config};return t.globalConfig.size===void 0&&(i.size=t.globalConfig.size),i.display=!0,i});return{labelWidth:n,inputConfig:o,t:e}}}),Xv=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n};function qv(t,e,n,o,i,r){const s=a.resolveComponent("j-comp"),l=a.resolveComponent("el-form-item");return t.componentData.isInput?(a.openBlock(),a.createBlock(l,{key:0,"label-width":t.labelWidth,label:t.t(t.componentData.config?.notShowLabel?"":t.componentData.config?.label||""),rules:t.componentData.config?.required?[{required:!0,message:""}]:[]},{default:a.withCtx(()=>[a.createVNode(s,{type:t.componentData?.componentName||t.componentData?.type,config:t.inputConfig,modelValue:t.componentData?.config.defaultValue},null,8,["type","config","modelValue"])]),_:1},8,["label-width","label","rules"])):t.componentData?.children?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(t.componentData?.componentName),a.mergeProps({key:1},t.componentData?.config,{"global-config":t.globalConfig,"component-data":t.componentData}),null,16,["global-config","component-data"])):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(t.componentData?.componentName),a.normalizeProps(a.mergeProps({key:2},t.componentData?.config)),null,16))}const cc=Xv(Uv,[["render",qv]]),Kv={class:"d-form-design j-block"},Zv={class:"d-form-design-left"},Jv={class:"d-form-design-component-list"},Qv={class:"j-component-tool"},e0={class:"j-component-tool-name"},t0={class:"d-form-design-center"},n0={class:"d-form-design-toolbar"},o0={class:"d-form-design-container"},i0={key:0,class:"d-form-design-empty"},r0={class:"d-form-design-right"},s0={class:"d-form-design-panel-title"},a0={style:{margin:"0","font-size":"14px"}},l0={class:"d-form-design-panel"},dc=Gt(a.defineComponent({name:"DFormDesign",__name:"formDesign",props:{notBindTable:{type:Boolean,default:!1},components:{default:()=>[]},componentConfigs:{default:()=>({})},componentInit:{type:Function,default:void 0},containerAddComponent:{type:Function,default:void 0},componentConfigInit:{type:Function,default:void 0},componentConfigChange:{type:Function,default:void 0},componentConfigValidate:{type:Function,default:void 0},flowComponents:{default:()=>[]},flowInit:{type:Function,default:void 0},flowComponentConfigInit:{type:Function,default:void 0},flowComponentConfigChange:{type:Function,default:void 0},flowComponentConfigs:{default:()=>({})},actions:{}},setup(t,{expose:e}){const n=t,{t:o,warning:i,error:r}=lc(),s=a.reactive({name:"表单",id:"form",type:"form",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}}),l=a.ref([]),u=n.components.length;for(let D=0;D<u;D++)l.value.push(D);n.componentInit&&(s.config=n.componentInit("form")||{});const c=a.ref([]),d=a.computed(()=>c.value.map(D=>({label:D.comment?`${D.name}(${D.comment})`:D.name,value:D.name}))),f=a.computed(()=>{if($.value){const D=z.value.getFormData(!1);if(D.table){const j=c.value.find(G=>G.name===D.table);if(j)return j.columns.map(G=>({value:G.name,label:G.coment?`${G.name}(${G.coment})`:G.name,coment:G.coment}))}}return[]}),h=D=>{c.value=D},p={},y=[];n.components.forEach(({children:D})=>{D.forEach(j=>{p[j.type]=j,j.dragType=j.dragType||"component",j.isInput!==!1&&(j.isInput=!0,y.push({label:j.name,value:j.type}))})});const m=D=>{D.forEach(j=>{j.type==="d-input-flow"&&(j.config=j.config||{},j.config.flowComponents=n.flowComponents,j.config.flowInit=n.flowInit,j.config.flowComponentConfigInit=G=>{n.flowComponentConfigInit&&(G.designComponents=I.value,G.component=$.value,n.flowComponentConfigInit(G))},j.config.flowComponentConfigs=n.flowComponentConfigs,j.config.flowComponentConfigChange=n.flowComponentConfigChange),j.children&&m(j.children)})},v={};Object.keys(n.componentConfigs||{}).forEach(D=>{const{hasBase:j,isInput:G,hasTwoPlaceholder:K,hasPlaceholder:ne,hasSpan:te,hasLabel:fe,bindTable:ge,labelTitle:Me}=p[D]||{hasBase:!1},Ie=[{id:"id",type:"j-input",config:{label:"ID",readonly:!0}},{id:"componentType",type:"j-select",config:{label:"类型",allowClear:!1,display:G,options:y}},{id:"label",type:"j-input",config:{label:Me||"标题"},getCompConfig:({formData:_e})=>({display:fe!==!1&&!_e.notShowLabel})},{id:"notShowLabel",type:"j-switch",config:{label:"不显示"+(Me||"标题"),activeValue:!0,inactiveValue:!1},getCompConfig:({formData:_e})=>({display:fe!==!1&&!_e.isSubTable})},{id:"labelWidth",type:"j-number",config:{label:"标题宽度"},getCompConfig:({formData:_e})=>({display:G&&!_e.notShowLabel&&!_e.isSubTable})},{id:"placeholder",type:"j-input",config:{display:G&&!K&&ne!==!1,label:"占位提示"}},{id:"startPlaceholder",type:"j-input",config:{display:!!K,label:"开始占位"}},{id:"endPlaceholder",type:"j-input",config:{display:!!K,label:"结束占位"}},{id:"span",type:"j-slider",config:{label:"表单栅栏",min:6,max:24,showTooltip:!0,step:6,showStops:!0,defautValue:24},getCompConfig:({formData:_e})=>({display:te!==!1&&!_e.isSubTable})},{id:"width",type:"j-number",config:{label:"单元格宽度",min:1},getCompConfig:({formData:_e})=>({display:!!_e.isSubTable})},{id:"isNotSave",type:"j-switch",config:{label:"不存表",display:G&&ge!==!1,activeValue:!0,inactiveValue:!1}},{id:"table",type:"j-select",config:{label:"数据表",loadOptions:()=>d},getCompConfig:({formData:_e})=>({display:(G&&ge!==!1||ge===!0)&&(!_e.isSubTable||ge===!0)&&!_e.isNotSave&&!n.notBindTable})},{id:"field",type:"j-select",config:{label:"表字段",loadOptions:()=>f},getCompConfig:({formData:_e})=>({display:G&&ge!==!1&&!_e.isNotSave&&!n.notBindTable})},{id:"csType",type:"j-select",config:{label:"字段类型",allowClear:!1,options:[{label:"短文本",value:"string"},{label:"长文本",value:"text"},{label:"整数",value:"int"},{label:"小数",value:"decimal"},{label:"时间日期",value:"DateTime"}]},getCompConfig:({formData:_e})=>({display:G&&ge!==!1&&!_e.isNotSave&&n.notBindTable})},{id:"fieldLen",type:"j-number",config:{label:"字段长度"},getCompConfig:({formData:_e})=>({display:G&&ge!==!1&&!_e.isNotSave&&n.notBindTable&&_e.csType==="string"})}],Ze={type:"j-collapse",config:{defaultValue:[]},children:[]};j!==!1&&(Ze.children?.push({config:{label:"基础信息"},children:[...Ie]}),Ze.config?.defaultValue.push("_collapse0")),Ze.children?.push(...n.componentConfigs[D]),m(Ze.children||[]),v[D]=[Ze]});const N=(D,j)=>{const{value:G}=j||{};D.id==="componentType"&&X(G),$.value&&n.componentConfigChange&&(D.id==="field"&&j.data?.coment&&($.value.config.label=j.data?.coment),n.componentConfigChange($.value.type,{configRef:z,component:D,configData:$.value.config,...j})),D.id==="table"&&$.value&&$.value.type==="gridtable"&&($.value.children||[]).forEach(K=>{K.isInput&&(K.config.table=G)})},_=(D,j)=>{p[D]?.isInput&&(n.notBindTable&&(j.configData.csType||z.value.setFormData({main:{csType:p[D]?.csType,fieldLen:p[D]?.fieldLen}})),d.value.length===1&&z.value.setFormData({main:{table:d.value[0].value}})),n.componentConfigInit&&n.componentConfigInit(D,{configRef:z,...j,notBindTable:n.notBindTable})},g=(D,j,G)=>{let K=!1;const ne=p[D];return j.container.type==="gridtable"?(!j.configData.isSubTable||G)&&(j.configData.isSubTable=!0,ne.isInput&&(j.configData.table=j.container.config.table,j.configData.field=""),K=!0):j.configData.isSubTable&&(K=!0,j.configData.isSubTable=!1,ne.isInput&&(j.configData.table="")),n.containerAddComponent&&n.containerAddComponent(D,j),K},x=a.ref(),z=a.ref(),{activedComponent:$,clearComponents:F,changeComponent:X,schemaComponentDic:Y,addComponentByTable:S,designComponentList:I}=Wv(x,z,s,n.componentInit,_,v,p,g),C=a.computed(()=>$.value?`【${$.value.name}】`:"");a.provide("dui-design-provide",{designItemName:cc});const H=()=>{F()},w=()=>{n.componentInit&&(s.config=n.componentInit("form")||{}),F()},k=()=>{let D=0;const j=vr(s.config,s.children||[]);if(n.notBindTable){const G={};j.components.forEach(te=>{const{isInput:fe,bindTable:ge}=p[te.type]||{};fe&&ge!==!1?te.config.table&&!G.main&&(G.main={name:te.config.table,comment:"主表",type:"main",pKey:"J_Id"}):ge&&(G[te.id]={name:te.config.table||"t"+new Date().getTime()+D,comment:`子表${te.config.label}`,type:"chlid",field:"J_PId",relationField:"J_Id",pKey:"J_Id"},te.config.table=G[te.id].name,D++)}),G.main||(G.main={name:"t"+new Date().getTime()+D,comment:"主表",type:"main",pKey:"J_Id"},D++);let K=0;j.components.forEach(te=>{const{isInput:fe,bindTable:ge}=p[te.type]||{};!te.config.isNotSave&&fe&&ge!==!1&&(te.config.csType||(te.config.csType=p[te.type]?.csType,te.config.fieldLen=p[te.type]?.fieldLen),te.config.isSubTable?te.config.table=G[te.containerId].name:te.config.table=G.main.name,te.config.field=te.config.field||`f${Math.floor(Date.now()/1e3)}${K}`,K++)});const ne=[];Object.keys(G).forEach(te=>{G[te].type==="chlid"&&(G[te].relationName=G.main.name,G[te].comment+=`,关联主表${G.main.name}`),ne.push(G[te])}),j.db=ne}else{const G={};c.value.forEach(K=>{K.columns.forEach(ne=>{G[`${K.name}_${ne.name}`]=ne.csType})}),j.components.forEach(K=>{K.config.table&&K.config.field&&(K.config.csType=G[`${K.config.table}_${K.config.field}`])})}return n.notBindTable?j.db.forEach(G=>{if(!j.components.find(ne=>ne.config.table===G.name&&ne.config.field==="J_Id")){const ne=j.components.find(te=>te.config.table===G.name&&te.config.field);ne&&j.components.push({id:G.name+"_J_Id",name:G.name+"_J_Id",type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:G.name,field:"J_Id",label:"主键"},containerId:ne.containerId,level:ne.level})}}):c.value.forEach(G=>{G.columns.forEach(K=>{if(K.isPrimary&&!j.components.find(te=>te.config.table===G.name&&te.config.field===K.name)){const te=j.components.find(fe=>fe.config.table===G.name&&fe.config.field);te&&j.components.push({id:G.name+"_"+K.name,name:G.name+"_"+K.name,type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:G.name,field:K.name,label:"主键"+K.name,isIdentity:K.isIdentity},containerId:te.containerId,level:te.level})}})}),j},b=D=>{const j=Oy(D,p);s.config=j.formConfig,s.children?.push(...j.componentList),Object.keys(j.componentDic).forEach(G=>{Y[G]=j.componentDic[G]})},E=()=>{const D=vr(s.config,s.children||[]),j={},G={};return O(D.components,j,G)},T=D=>{const{isInput:j,bindTable:G}=p[D]||{};if(!j&&G)return!0},O=(D,j,G)=>{if(!n.notBindTable)for(const K of D){const{isInput:ne,bindTable:te}=p[K.type]||{};if(!K.config.isNotSave&&K.type!=="pkey"){if(ne&&te!==!1){if(Xn(K.config.table))return r&&r(`请【${K.config.label}】绑定数据表!`),!1;if(!K.config.isSubTable){if(G[K.config.table]&&T(G[K.config.table].type))return r&&r(`【${K.config.label}】和【${G[K.config.table].config.label}】重复绑定【${K.config.table}】表!`),!1;K.config.table&&(G[K.config.table]=K)}}else if(te){if(Xn(K.config.table))return r&&r(`【${K.config.label}】请绑定数据表!`),!1;if(G[K.config.table])return r&&r(`【${K.config.label}】和【${G[K.config.table].config.label}】重复绑定【${K.config.table}】表!`),!1;K.config.table&&(G[K.config.table]=K)}}}for(const K of D){if(!n.notBindTable){const{isInput:ne,bindTable:te}=p[K.type]||{};if(!K.config.isNotSave&&ne&&te!==!1){if(Xn(K.config.field))return r&&r(`请【${K.config.label}】绑定表字段!`),!1;if(j[`${K.config.table}-${K.config.field}`])return r&&r(`【${K.config.label}】和【${j[`${K.config.table}-${K.config.field}`].config.label}】重复绑定【${K.config.field}】字段!`),!1;j[`${K.config.table}-${K.config.field}`]=K}}if(n.componentConfigValidate&&!n.componentConfigValidate(K.type,{configData:K.config,errorTip:r}))return!1}return!0},R=a.ref(),B=a.ref(),P=a.reactive({width:0,height:0,formConfig:{}});let V=0;const W=D=>{if(B.value)V=0,B.value.init(D||[]);else{if(V>600){console.warn("表单组件加载超时");return}V++,setTimeout(()=>{W(D)},100)}},Z=()=>{},Q=()=>{},q=()=>{const D=vr(s.config,s.children||[]);P.width=D.form.width||800,P.height=D.form.height||600,R.value.open("表单预览",D.form.layerType),a.nextTick(()=>{const{formConfig:j,componentList:G}=Py(D);P.formConfig=j,W(G)})},ee=a.ref(),re=a.ref(),oe=()=>{ee.value.open("快速添加组件")},ce=()=>{const{addList:D,table:j}=re.value?.ok()||{addList:[]};if(D.length<=0)i&&i("请选择字段!");else{if($.value?.config.componentType==="gridtable"||$.value?.config.isSubTable)if($.value.config.table){if($.value.config.table!==j){i&&i("请设置相同的表和子表!");return}}else{let G=$.value;$.value.config.isSubTable&&(G=Y[$.value.containerId]),G.config.table=j,(G.children||[]).forEach(K=>{K.isInput&&(K.config.table=j)}),z.value.setFormData({main:{table:j}})}D.forEach(G=>{const K=br(p[G.type]);K.config={table:j,field:G.value,label:G.label},S(K)}),ee.value.close()}},ie=()=>{re.value?.closed()};return e({setTables:D=>{h(D)},getSchema:()=>k(),setSchema:D=>b(D),reset:()=>w(),validate:()=>E()}),(D,j)=>{const G=a.resolveComponent("j-icon"),K=a.resolveComponent("d-drag-tool"),ne=a.resolveComponent("el-collapse-item"),te=a.resolveComponent("el-collapse"),fe=a.resolveComponent("j-button"),ge=a.resolveComponent("d-drag-form-list"),Me=a.resolveComponent("el-row"),Ie=a.resolveComponent("d-drag-container"),Ze=a.resolveComponent("j-form"),_e=a.resolveComponent("j-layer");return a.openBlock(),a.createElementBlock("div",Kv,[a.createElementVNode("div",Zv,[j[1]||(j[1]=a.createElementVNode("div",{class:"d-form-design-panel-title"},"组件库",-1)),a.createElementVNode("div",Jv,[a.createVNode(te,{modelValue:l.value,"onUpdate:modelValue":j[0]||(j[0]=xt=>l.value=xt)},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.components,(xt,Et)=>(a.openBlock(),a.createBlock(ne,{key:Et,title:xt.name,name:Et},{default:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(xt.children,(Ct,Hr)=>(a.openBlock(),a.createBlock(K,{key:Hr,config:Ct},{default:a.withCtx(()=>[a.createElementVNode("div",Qv,[a.createVNode(G,{class:"j-component-tool-icon",icon:Ct.icon,size:14},null,8,["icon"]),a.createElementVNode("div",e0,a.toDisplayString(a.unref(o)(Ct.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),a.createElementVNode("div",t0,[a.createElementVNode("div",n0,[a.withDirectives(a.createVNode(fe,{type:"primary",label:"快速添加组件",onClick:oe},null,512),[[a.vShow,!t.notBindTable]]),a.createVNode(fe,{type:"primary",label:"清空",onClick:H,danger:""}),a.createVNode(fe,{label:"预览",onClick:q})]),a.createElementVNode("div",o0,[a.createVNode(Ie,{ref_key:"dragContainer",ref:x,class:"d-form-design-drag-container","is-component-container":!1,"component-data":s},{default:a.withCtx(()=>[!s.children||s.children.length===0?(a.openBlock(),a.createElementBlock("div",i0,[...j[2]||(j[2]=[a.createElementVNode("div",null,"请从左侧拖拽组件到此处",-1)])])):(a.openBlock(),a.createBlock(Me,{key:1},{default:a.withCtx(()=>[a.createVNode(ge,{"component-list":s.children,"global-config":s.config},null,8,["component-list","global-config"])]),_:1}))]),_:1},8,["component-data"])])]),a.withDirectives(a.createElementVNode("div",r0,[a.createElementVNode("div",s0,[a.createElementVNode("span",a0,a.toDisplayString(`${a.unref(o)("属性配置")}${C.value}`),1)]),a.createElementVNode("div",l0,[a.createVNode(Ze,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:z,onChange:N},null,512)])],512),[[a.vShow,a.unref($)]]),a.createVNode(_e,{ref_key:"previewFormLayerRef",ref:R,width:P.width,height:P.height,onOk:Z,onClosed:Q},{default:a.withCtx(()=>[a.createVNode(Ze,{config:P.formConfig,"is-preview":!0,ref_key:"previewFormRef",ref:B,actions:t.actions},null,8,["config","actions"])]),_:1},8,["width","height"]),a.createVNode(_e,{ref_key:"importFormLayerRef",ref:ee,width:800,height:600,"btn-text":"确认",onOk:ce,onClosed:ie},{default:a.withCtx(()=>[a.createVNode(Gv,{"component-list":y,"table-list":c.value,ref_key:"importComponentRef",ref:re},null,8,["table-list"])]),_:1},512)])}}}),[cc]),c0=[gs,Di,Ti,Mi,Ii,fl,hl,yl,vl,dc],d0={install:t=>{c0.forEach(e=>{t.component(e.name,e)})}};ze.DDrag=gs,ze.DDraggable=vl,ze.DFlowDesign=fl,ze.DFormDesign=dc,ze.DInputFlow=hl,ze.DLayout=yl,ze.default=d0,ze.dragContainer=Ti,ze.dragFormList=Mi,ze.dragIndexList=Ii,ze.dragTool=Di,Object.defineProperties(ze,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
28
+ Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),o}static addGrid(e,n={}){if(!e)return null;let o=e;if(o.gridstack){const a=o.gridstack;return n&&(a.opts={...a.opts,...n}),n.children!==void 0&&a.load(n.children),a}return(!e.classList.contains("grid-stack")||ue.addRemoveCB)&&(ue.addRemoveCB?o=ue.addRemoveCB(e,n,!0,!0):o=J.createDiv(["grid-stack",n.class],e)),ue.init(n,o)}static registerEngine(e){ue.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=J.createDiv([this.opts.placeholderClass,Ge.itemClass,this.opts.itemClass]);const e=J.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,n={}){this.el=e,this.opts=n,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=n=n||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),n.row&&(n.minRow=n.maxRow=n.row,delete n.row);const o=J.toNumber(e.getAttribute("gs-row"));n.column==="auto"&&delete n.column,n.alwaysShowResizeHandle!==void 0&&(n._alwaysShowResizeHandle=n.alwaysShowResizeHandle);const i=n.columnOpts;if(i){const c=i.breakpoints;!i.columnWidth&&!c?.length?delete n.columnOpts:(i.columnMax=i.columnMax||12,c?.length>1&&c.sort((d,f)=>(f.w||0)-(d.w||0)))}const r={...J.cloneDeep(Ge),column:J.toNumber(e.getAttribute("gs-column"))||Ge.column,minRow:o||J.toNumber(e.getAttribute("gs-min-row"))||Ge.minRow,maxRow:o||J.toNumber(e.getAttribute("gs-max-row"))||Ge.maxRow,staticGrid:J.toBool(e.getAttribute("gs-static"))||Ge.staticGrid,sizeToContent:J.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(n.handleClass?"."+n.handleClass:n.handle?n.handle:"")||Ge.draggable.handle},removableOptions:{accept:n.itemClass||Ge.removableOptions.accept,decline:Ge.removableOptions.decline}};e.getAttribute("gs-animate")&&(r.animate=J.toBool(e.getAttribute("gs-animate"))),n=J.defaults(n,r),this._initMargin(),this.checkDynamicColumn(),this._updateColumnVar(n),n.rtl==="auto"&&(n.rtl=e.style.direction==="rtl"),n.rtl&&this.el.classList.add("grid-stack-rtl");const l=this.el.closest("."+Ge.itemClass)?.gridstackNode;if(l&&(l.subGrid=this,this.parentGridNode=l,this.el.classList.add("grid-stack-nested"),l.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=n.cellHeight==="auto",this._isAutoCellHeight||n.cellHeight==="initial")this.cellHeight(void 0);else{typeof n.cellHeight=="number"&&n.cellHeightUnit&&n.cellHeightUnit!==Ge.cellHeightUnit&&(n.cellHeight=n.cellHeight+n.cellHeightUnit,delete n.cellHeightUnit);const c=n.cellHeight;delete n.cellHeight,this.cellHeight(c)}n.alwaysShowResizeHandle==="mobile"&&(n.alwaysShowResizeHandle=tt),this._setStaticClass();const u=n.engineClass||ue.engineClass||vt;if(this.engine=new u({column:this.getColumn(),float:n.float,maxRow:n.maxRow,onChange:c=>{c.forEach(d=>{const f=d.el;f&&(d._removeDOM?(f&&f.remove(),delete d._removeDOM):this._writePosAttr(f,d))}),this._updateContainerHeight()}}),n.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(c=>this._prepareElement(c)),delete this.engine._loading,this.batchUpdate(!1)),n.children){const c=n.children;delete n.children,c.length&&this.load(c)}this.setAnimation(),n.subGridDynamic&&!he.pauseDrag&&(he.pauseDrag=!0),n.draggable?.pause!==void 0&&(he.pauseDrag=n.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}_updateColumnVar(e=this.opts){this.el.classList.add("gs-"+e.column),typeof e.column=="number"&&this.el.style.setProperty("--gs-column-width",`${100/e.column}%`)}addWidget(e){if(!e)return;if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let n,o=e;if(o.grid=this,o.el?n=o.el:ue.addRemoveCB?n=ue.addRemoveCB(this.el,e,!0,!1):n=this.createWidgetDivs(o),!n)return;if(o=n.gridstackNode,o&&n.parentElement===this.el&&this.engine.nodes.find(r=>r._id===o._id))return n;const i=this._readAttr(n);return J.defaults(e,i),this.engine.prepareNode(e),this.el.appendChild(n),this.makeWidget(n,e),n}createWidgetDivs(e){const n=J.createDiv(["grid-stack-item",this.opts.itemClass]),o=J.createDiv(["grid-stack-item-content"],n);return J.lazyLoad(e)?e.visibleObservable||(e.visibleObservable=new IntersectionObserver(([i])=>{i.isIntersecting&&(e.visibleObservable?.disconnect(),delete e.visibleObservable,ue.renderCB(o,e),e.grid?.prepareDragDrop(e.el))}),window.setTimeout(()=>e.visibleObservable?.observe(n))):ue.renderCB(o,e),n}makeSubGrid(e,n,o,i=!0){let r=e.gridstackNode;if(r||(r=this.makeWidget(e).gridstackNode),r.subGrid?.el)return r.subGrid;let a,l=this;for(;l&&!a;)a=l.opts?.subGridOpts,l=l.parentGridNode?.grid;n=J.cloneDeep({...this.opts,id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0,...a||{},...n||r.subGridOpts||{}}),r.subGridOpts=n;let u;n.column==="auto"&&(u=!0,n.column=Math.max(r.w||1,o?.w||1),delete n.columnOpts);let c=r.el.querySelector(".grid-stack-item-content"),d,f;if(i&&(this._removeDD(r.el),f={...r,x:0,y:0},J.removeInternalForSave(f),delete f.subGridOpts,r.content&&(f.content=r.content,delete r.content),ue.addRemoveCB?d=ue.addRemoveCB(this.el,f,!0,!1):(d=J.createDiv(["grid-stack-item"]),d.appendChild(c),c=J.createDiv(["grid-stack-item-content"],r.el)),this.prepareDragDrop(r.el)),o){const p=u?n.column:r.w,y=r.h+o.h,m=r.el.style;m.transition="none",this.update(r.el,{w:p,h:y}),setTimeout(()=>m.transition=null)}const h=r.subGrid=ue.addGrid(c,n);return o?._moving&&(h._isTemp=!0),u&&(h._autoColumn=!0),i&&h.makeWidget(d,f),o&&(o._moving?window.setTimeout(()=>J.simulateMouseEvent(o._event,"mouseenter",h.el),0):h.makeWidget(r.el,r)),this.resizeToContentCheck(!1,r),h}removeAsSubGrid(e){const n=this.parentGridNode?.grid;n&&(n.batchUpdate(),n.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(o=>{o.x+=this.parentGridNode.x,o.y+=this.parentGridNode.y,n.makeWidget(o.el,o)}),n.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>J.simulateMouseEvent(e._event,"mouseenter",n.el),0))}save(e=!0,n=!1,o=ue.saveCB,i){const r=this.engine.save(e,o,i);if(r.forEach(a=>{if(e&&a.el&&!a.subGrid&&!o){const l=a.el.querySelector(".grid-stack-item-content");a.content=l?.innerHTML,a.content||delete a.content}else if(!e&&!o&&delete a.content,a.subGrid?.el){const l=a.w||a.subGrid.getColumn(),u=a.subGrid.save(e,n,o,l);a.subGridOpts=n?u:{children:u},delete a.subGrid}delete a.el}),n){const a=J.cloneDeep(this.opts);a.marginBottom===a.marginTop&&a.marginRight===a.marginLeft&&a.marginTop===a.marginRight&&(a.margin=a.marginTop,delete a.marginTop,delete a.marginRight,delete a.marginBottom,delete a.marginLeft),a.rtl===(this.el.style.direction==="rtl")&&(a.rtl="auto"),this._isAutoCellHeight&&(a.cellHeight="auto"),this._autoColumn&&(a.column="auto");const l=a._alwaysShowResizeHandle;return delete a._alwaysShowResizeHandle,l!==void 0?a.alwaysShowResizeHandle=l:delete a.alwaysShowResizeHandle,J.removeInternalAndSame(a,Ge),a.children=r,a}return r}load(e,n=ue.addRemoveCB||!0){e=J.cloneDeep(e);const o=this.getColumn();e.forEach(d=>{d.w=d.w||d.minW||1,d.h=d.h||d.minH||1}),e=J.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let i=0;e.forEach(d=>{i=Math.max(i,(d.x||0)+d.w)}),i>this.engine.defaultColumn&&(this.engine.defaultColumn=i),i>o&&(this.engine.nodes.length===0&&this.responseLayout?(this.engine.nodes=e,this.engine.columnChanged(i,o,this.responseLayout),e=this.engine.nodes,this.engine.nodes=[],delete this.responseLayout):this.engine.cacheLayout(e,i,!0));const r=ue.addRemoveCB;typeof n=="function"&&(ue.addRemoveCB=n);const a=[];this.batchUpdate();const l=!this.engine.nodes.length,u=l&&this.opts.animate;u&&this.setAnimation(!1),!l&&n&&[...this.engine.nodes].forEach(f=>{if(!f.id)return;J.find(e,f.id)||(ue.addRemoveCB&&ue.addRemoveCB(this.el,f,!1,!1),a.push(f),this.removeWidget(f.el,!0,!1))}),this.engine._loading=!0;const c=[];return this.engine.nodes=this.engine.nodes.filter(d=>J.find(e,d.id)?(c.push(d),!1):!0),e.forEach(d=>{const f=J.find(c,d.id);if(f){if(J.shouldSizeToContent(f)&&(d.h=f.h),this.engine.nodeBoundFix(d),(d.autoPosition||d.x===void 0||d.y===void 0)&&(d.w=d.w||f.w,d.h=d.h||f.h,this.engine.findEmptyPosition(d)),this.engine.nodes.push(f),J.samePos(f,d)&&this.engine.nodes.length>1&&(this.moveNode(f,{...d,forceCollide:!0}),J.copyPos(d,f)),this.update(f.el,d),d.subGridOpts?.children){const h=f.el.querySelector(".grid-stack");h&&h.gridstack&&h.gridstack.load(d.subGridOpts.children)}}else n&&this.addWidget(d)}),delete this.engine._loading,this.engine.removedNodes=a,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,r?ue.addRemoveCB=r:delete ue.addRemoveCB,u&&this.setAnimation(!0,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;const n=this.el.querySelector("."+this.opts.itemClass);if(n){const i=J.toNumber(n.getAttribute("gs-h"))||1;return Math.round(n.offsetHeight/i)}const o=parseInt(this.el.getAttribute("gs-current-row"));return o?Math.round(this.el.getBoundingClientRect().height/o):this.opts.cellHeight}cellHeight(e){if(e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){const o=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+o}const n=J.parseHeight(e);return this.opts.cellHeightUnit===n.unit&&this.opts.cellHeight===n.h?this:(this.opts.cellHeightUnit=n.unit,this.opts.cellHeight=n.h,this.el.style.setProperty("--gs-cell-height",`${this.opts.cellHeight}${this.opts.cellHeightUnit}`),this._updateContainerHeight(),this.resizeToContentCheck(),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){return e&&this.opts.columnOpts?.breakpointForWindow?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){const e=this.opts.columnOpts;if(!e||!e.columnWidth&&!e.breakpoints?.length)return!1;const n=this.getColumn();let o=n;const i=this._widthOrContainer(!0);if(e.columnWidth)o=Math.min(Math.round(i/e.columnWidth)||1,e.columnMax);else{o=e.columnMax;let r=0;for(;r<e.breakpoints.length&&i<=e.breakpoints[r].w;)o=e.breakpoints[r++].c||n}if(o!==n){const r=e.breakpoints?.find(a=>a.c===o);return this.column(o,r?.layout||e.layout),!0}return!1}compact(e="compact",n=!0){return this.engine.compact(e,n),this._triggerChangeEvent(),this}column(e,n="moveScale"){if(!e||e<1||this.opts.column===e)return this;const o=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+o),this._updateColumnVar(),this.engine.columnChanged(o,e,n),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):(this.responseLayout=n,this)}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.removeAttribute("gs-current-row")),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,delete this.opts,delete this._placeholder?.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,n=!1){const o=this.el.getBoundingClientRect();let i;n?i={top:o.top+document.documentElement.scrollTop,left:o.left}:i={top:this.el.offsetTop,left:this.el.offsetLeft};const r=e.left-i.left,a=e.top-i.top,l=o.width/this.getColumn(),u=o.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(r/l),y:Math.floor(a/u)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow||0)}isAreaEmpty(e,n,o,i){return this.engine.isAreaEmpty(e,n,o,i)}makeWidget(e,n){const o=ue.getElement(e);if(!o||o.gridstackNode)return o;o.parentElement||this.el.appendChild(o),this._prepareElement(o,!0,n);const i=o.gridstackNode;this._updateContainerHeight(),i.subGridOpts&&this.makeSubGrid(o,i.subGridOpts,void 0,!1);let r;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(r=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),r&&delete this._ignoreLayoutsNodeChange,o}on(e,n){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.on(i,n)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=i=>n(i):this._gsEventHandler[e]=i=>{i.detail&&n(i,i.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=n:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(o=>this.off(o)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,n=!0,o=!0){return e?(ue.getElements(e).forEach(i=>{if(i.parentElement&&i.parentElement!==this.el)return;let r=i.gridstackNode;r||(r=this.engine.nodes.find(a=>i===a.el)),r&&(n&&ue.addRemoveCB&&ue.addRemoveCB(this.el,r,!1,!1),delete i.gridstackNode,this._removeDD(i),this.engine.removeNode(r,n,o),n&&i.parentElement&&i.remove())}),o&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,n=!0){return this.engine.nodes.forEach(o=>{e&&ue.addRemoveCB&&ue.addRemoveCB(this.el,o,!1,!1),delete o.el.gridstackNode,this.opts.staticGrid||this._removeDD(o.el)}),this.engine.removeAll(e,n),n&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,n){return n?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this.opts.animate=e,this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,n=!0,o=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(i=>{this.prepareDragDrop(i.el),i.subGrid&&o&&i.subGrid.setStatic(e,n,o)}),n&&this._setStaticClass(),this)}updateOptions(e){const n=this.opts;return e===n?this:(e.acceptWidgets!==void 0&&(n.acceptWidgets=e.acceptWidgets,this._setupAcceptWidget()),e.animate!==void 0&&this.setAnimation(e.animate),e.cellHeight&&this.cellHeight(e.cellHeight),e.class!==void 0&&e.class!==n.class&&(n.class&&this.el.classList.remove(n.class),e.class&&this.el.classList.add(e.class)),e.columnOpts?(this.opts.columnOpts=e.columnOpts,this.checkDynamicColumn()):e.columnOpts===null&&this.opts.columnOpts?(delete this.opts.columnOpts,this._updateResizeEvent()):typeof e.column=="number"&&this.column(e.column),e.margin!==void 0&&this.margin(e.margin),e.staticGrid!==void 0&&this.setStatic(e.staticGrid),e.disableDrag!==void 0&&!e.staticGrid&&this.enableMove(!e.disableDrag),e.disableResize!==void 0&&!e.staticGrid&&this.enableResize(!e.disableResize),e.float!==void 0&&this.float(e.float),e.row!==void 0?(n.minRow=n.maxRow=n.row=e.row,this._updateContainerHeight()):(e.minRow!==void 0&&(n.minRow=e.minRow,this._updateContainerHeight()),e.maxRow!==void 0&&(n.maxRow=e.maxRow)),e.lazyLoad!==void 0&&(n.lazyLoad=e.lazyLoad),e.children?.length&&this.load(e.children),this)}update(e,n){return ue.getElements(e).forEach(o=>{const i=o?.gridstackNode;if(!i)return;const r={...J.copyPos({},i),...J.cloneDeep(n)};this.engine.nodeBoundFix(r),delete r.autoPosition;const a=["x","y","w","h"];let l;if(a.some(d=>r[d]!==void 0&&r[d]!==i[d])&&(l={},a.forEach(d=>{l[d]=r[d]!==void 0?r[d]:i[d],delete r[d]})),!l&&(r.minW||r.minH||r.maxW||r.maxH)&&(l={}),r.content!==void 0){const d=o.querySelector(".grid-stack-item-content");d&&d.textContent!==r.content&&(i.content=r.content,ue.renderCB(d,r),i.subGrid?.el&&(d.appendChild(i.subGrid.el),i.subGrid._updateContainerHeight())),delete r.content}let u=!1,c=!1;for(const d in r)d[0]!=="_"&&i[d]!==r[d]&&(i[d]=r[d],u=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(J.sanitizeMinMax(i),l){const d=l.w!==void 0&&l.w!==i.w;this.moveNode(i,l),d&&i.subGrid?i.subGrid.onResize(this.hasAnimationCSS()?i.w:void 0):this.resizeToContentCheck(d,i),delete i._orig}(l||u)&&this._writeAttr(o,i),c&&this.prepareDragDrop(i.el),ue.updateCB&&ue.updateCB(i)}),this}moveNode(e,n){const o=e._updating;o||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,n),this._updateContainerHeight(),o||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;const n=e.gridstackNode;if(!n)return;const o=n.grid;if(!o||e.parentElement!==o.el)return;const i=o.getCellHeight(!0);if(!i)return;let r=n.h?n.h*i:e.clientHeight,a;if(n.resizeToContentParent&&(a=e.querySelector(n.resizeToContentParent)),a||(a=e.querySelector(ue.resizeToContentParent)),!a)return;const l=e.clientHeight-a.clientHeight,u=n.h?n.h*i-l:a.clientHeight;let c;if(n.subGrid){c=n.subGrid.getRow()*n.subGrid.getCellHeight(!0);const h=n.subGrid.el.getBoundingClientRect(),p=e.getBoundingClientRect();c+=h.top-p.top}else{if(n.subGridOpts?.children?.length)return;{const h=a.firstElementChild;if(!h){console.error(`Error: GridStack.resizeToContent() widget id:${n.id} '${ue.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=h.getBoundingClientRect().height||u}}if(u===c)return;r+=c-u;let d=Math.ceil(r/i);const f=Number.isInteger(n.sizeToContent)?n.sizeToContent:0;f&&d>f&&(d=f,e.classList.add("size-to-content-max")),n.minH&&d<n.minH?d=n.minH:n.maxH&&d>n.maxH&&(d=n.maxH),d!==n.h&&(o._ignoreLayoutsNodeChange=!0,o.moveNode(n,{h:d}),delete o._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){ue.resizeToContentCB?ue.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,n){return ue.getElements(e).forEach(o=>{const i=o.gridstackNode;if(!J.canBeRotated(i))return;const r={w:i.h,h:i.w,minH:i.minW,minW:i.minH,maxH:i.maxW,maxW:i.maxH};if(n){const l=n.left>0?Math.floor(n.left/this.cellWidth()):0,u=n.top>0?Math.floor(n.top/this.opts.cellHeight):0;r.x=i.x+l-(i.h-(u+1)),r.y=i.y+u-l}Object.keys(r).forEach(l=>{r[l]===void 0&&delete r[l]});const a=i._orig;this.update(o,r),i._orig=a}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){const o=J.parseHeight(e);if(this.opts.marginUnit===o.unit&&this.opts.margin===o.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this}getMargin(){return this.opts.margin}willItFit(e){return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;const e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){if(this.engine.batchMode)return this;if(this.engine.addedNodes?.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(n=>{delete n._dirty});const e=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",e)}return this}_triggerRemoveEvent(){if(this.engine.batchMode)return this;if(this.engine.removedNodes?.length){const e=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",e)}return this}_triggerEvent(e,n){const o=n?new CustomEvent(e,{bubbles:!1,detail:n}):new Event(e);let i=this;for(;i.parentGridNode;)i=i.parentGridNode.grid;return i.el.dispatchEvent(o),this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;const e=this.parentGridNode;let n=this.getRow()+this._extraDragRow;const o=this.opts.cellHeight,i=this.opts.cellHeightUnit;if(!o)return this;if(!e&&!this.opts.minRow){const r=J.parseHeight(getComputedStyle(this.el).minHeight);if(r.h>0&&r.unit===i){const a=Math.floor(r.h/o);n<a&&(n=a)}}return this.el.setAttribute("gs-current-row",String(n)),this.el.style.removeProperty("min-height"),this.el.style.removeProperty("height"),n&&(this.el.style[e?"minHeight":"height"]=n*o+i),e&&J.shouldSizeToContent(e)&&e.grid.resizeToContentCBCheck(e.el),this}_prepareElement(e,n=!1,o){o=o||this._readAttr(e),e.gridstackNode=o,o.el=e,o.grid=this,o=this.engine.addNode(o,n),this._writeAttr(e,o),e.classList.add(Ge.itemClass,this.opts.itemClass);const i=J.shouldSizeToContent(o);return i?e.classList.add("size-to-content"):e.classList.remove("size-to-content"),i&&this.resizeToContentCheck(!1,o),J.lazyLoad(o)||this.prepareDragDrop(o.el),this}_writePosAttr(e,n){return(!n._moving&&!n._resizing||this._placeholder===e)&&(e.style.top=n.y?n.y===1?"var(--gs-cell-height)":`calc(${n.y} * var(--gs-cell-height))`:null,e.style.left=n.x?n.x===1?"var(--gs-column-width)":`calc(${n.x} * var(--gs-column-width))`:null,e.style.width=n.w>1?`calc(${n.w} * var(--gs-column-width))`:null,e.style.height=n.h>1?`calc(${n.h} * var(--gs-cell-height))`:null),e.setAttribute("gs-x",String(n.x)),e.setAttribute("gs-y",String(n.y)),n.w>1?e.setAttribute("gs-w",String(n.w)):e.removeAttribute("gs-w"),n.h>1?e.setAttribute("gs-h",String(n.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,n){if(!n)return this;this._writePosAttr(e,n);const o={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(const i in o)n[i]?e.setAttribute(o[i],String(n[i])):e.removeAttribute(o[i]);return this}_readAttr(e,n=!0){const o={};o.x=J.toNumber(e.getAttribute("gs-x")),o.y=J.toNumber(e.getAttribute("gs-y")),o.w=J.toNumber(e.getAttribute("gs-w")),o.h=J.toNumber(e.getAttribute("gs-h")),o.autoPosition=J.toBool(e.getAttribute("gs-auto-position")),o.noResize=J.toBool(e.getAttribute("gs-no-resize")),o.noMove=J.toBool(e.getAttribute("gs-no-move")),o.locked=J.toBool(e.getAttribute("gs-locked"));const i=e.getAttribute("gs-size-to-content");i&&(i==="true"||i==="false"?o.sizeToContent=J.toBool(i):o.sizeToContent=parseInt(i,10)),o.id=e.getAttribute("gs-id"),o.maxW=J.toNumber(e.getAttribute("gs-max-w")),o.minW=J.toNumber(e.getAttribute("gs-min-w")),o.maxH=J.toNumber(e.getAttribute("gs-max-h")),o.minH=J.toNumber(e.getAttribute("gs-min-h")),n&&(o.w===1&&e.removeAttribute("gs-w"),o.h===1&&e.removeAttribute("gs-h"),o.maxW&&e.removeAttribute("gs-max-w"),o.minW&&e.removeAttribute("gs-min-w"),o.maxH&&e.removeAttribute("gs-max-h"),o.minH&&e.removeAttribute("gs-min-h"));for(const r in o){if(!o.hasOwnProperty(r))return;!o[r]&&o[r]!==0&&r!=="sizeToContent"&&delete o[r]}return o}_setStaticClass(){const e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=this.el?.clientWidth){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let n=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),n=!0):n=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(o=>{o.subGrid&&o.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(n),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,n=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,n),this.animationDelay);if(n)J.shouldSizeToContent(n)&&this.resizeToContentCBCheck(n.el);else if(this.engine.nodes.some(o=>J.shouldSizeToContent(o))){const o=[...this.engine.nodes];this.batchUpdate(),o.forEach(i=>{J.shouldSizeToContent(i)&&this.resizeToContentCBCheck(i.el)}),this._ignoreLayoutsNodeChange=!0,this.batchUpdate(!1),this._ignoreLayoutsNodeChange=!1}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,n?[n]:this.engine.nodes)}}_updateResizeEvent(e=!1){const n=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(o=>o.sizeToContent));return!e&&n&&!this.resizeObserver?(this._sizeThrottle=J.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!n)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return J.getElement(e)}static getElements(e=".grid-stack-item"){return J.getElements(e)}static getGridElement(e){return ue.getElement(e)}static getGridElements(e){return J.getElements(e)}_initMargin(){let e,n=0,o=[];typeof this.opts.margin=="string"&&(o=this.opts.margin.split(" ")),o.length===2?(this.opts.marginTop=this.opts.marginBottom=o[0],this.opts.marginLeft=this.opts.marginRight=o[1]):o.length===4?(this.opts.marginTop=o[0],this.opts.marginRight=o[1],this.opts.marginBottom=o[2],this.opts.marginLeft=o[3]):(e=J.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,n=this.opts.margin=e.h),["marginTop","marginRight","marginBottom","marginLeft"].forEach(a=>{this.opts[a]===void 0?this.opts[a]=n:(e=J.parseHeight(this.opts[a]),this.opts[a]=e.h,delete this.opts.margin)}),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop);const r=this.el.style;return r.setProperty("--gs-item-margin-top",`${this.opts.marginTop}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-bottom",`${this.opts.marginBottom}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-right",`${this.opts.marginRight}${this.opts.marginUnit}`),r.setProperty("--gs-item-margin-left",`${this.opts.marginLeft}${this.opts.marginUnit}`),this}static getDD(){return Oe}static setupDragIn(e,n,o,i=document){n?.pause!==void 0&&(he.pauseDrag=n.pause),n={appendTo:"body",helper:"clone",...n||{}},(typeof e=="string"?J.getElements(e,i):e).forEach((a,l)=>{Oe.isDraggable(a)||Oe.dragIn(a,n),o?.[l]&&(a.gridstackNode=o[l])})}movable(e,n){return this.opts.staticGrid?this:(ue.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noMove:i.noMove=!0,this.prepareDragDrop(i.el))}),this)}resizable(e,n){return this.opts.staticGrid?this:(ue.getElements(e).forEach(o=>{const i=o.gridstackNode;i&&(n?delete i.noResize:i.noResize=!0,this.prepareDragDrop(i.el))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableMove(e,n)}),this)}enableResize(e,n=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(o=>{this.prepareDragDrop(o.el),o.subGrid&&n&&o.subGrid.enableResize(e,n)}),this)}cancelDrag(){const e=this._placeholder?.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&ue._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Oe.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Oe.droppable(this.el,"destroy"),this;let e,n;const o=(i,r,a)=>{a=a||r;const l=a.gridstackNode;if(!l)return;if(!l.grid?.el){a.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;const h=a.getBoundingClientRect();a.style.left=h.x+(this.dragTransform.xScale-1)*(i.clientX-h.x)/this.dragTransform.xScale+"px",a.style.top=h.y+(this.dragTransform.yScale-1)*(i.clientY-h.y)/this.dragTransform.yScale+"px",a.style.transformOrigin="0px 0px"}let{top:u,left:c}=a.getBoundingClientRect();const d=this.el.getBoundingClientRect();c-=d.left,u-=d.top;const f={position:{top:u*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(l._temporaryRemoved){if(l.x=Math.max(0,Math.round(c/n)),l.y=Math.max(0,Math.round(u/e)),delete l.autoPosition,this.engine.nodeBoundFix(l),!this.engine.willItFit(l)){if(l.autoPosition=!0,!this.engine.willItFit(l)){Oe.off(r,"drag");return}l._willFitPos&&(J.copyPos(l,l._willFitPos),delete l._willFitPos)}this._onStartMoving(a,i,f,l,n,e)}else this._dragOrResize(a,i,f,l,n,e)};return Oe.droppable(this.el,{accept:i=>{const r=i.gridstackNode||this._readAttr(i,!1);if(r?.grid===this)return!0;if(!this.opts.acceptWidgets)return!1;let a=!0;if(typeof this.opts.acceptWidgets=="function")a=this.opts.acceptWidgets(i);else{const l=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;a=i.matches(l)}if(a&&r&&this.opts.maxRow){const l={w:r.w,h:r.h,minW:r.minW,minH:r.minH};a=this.engine.willItFit(l)}return a}}).on(this.el,"dropover",(i,r,a)=>{let l=a?.gridstackNode||r.gridstackNode;if(l?.grid===this&&!l._temporaryRemoved)return!1;if(l?._sidebarOrig&&(l.w=l._sidebarOrig.w,l.h=l._sidebarOrig.h),l?.grid&&l.grid!==this&&!l._temporaryRemoved&&l.grid._leave(r,a),a=a||r,n=this.cellWidth(),e=this.getCellHeight(!0),!l){const d=a.getAttribute("data-gs-widget")||a.getAttribute("gridstacknode");if(d){try{l=JSON.parse(d)}catch{console.error("Gridstack dropover: Bad JSON format: ",d)}a.removeAttribute("data-gs-widget"),a.removeAttribute("gridstacknode")}l||(l=this._readAttr(a)),l._sidebarOrig={w:l.w,h:l.h}}l.grid||(l.el||(l={...l}),l._isExternal=!0,a.gridstackNode=l);const u=l.w||Math.round(a.offsetWidth/n)||1,c=l.h||Math.round(a.offsetHeight/e)||1;return l.grid&&l.grid!==this?(r._gridstackNodeOrig||(r._gridstackNodeOrig=l),r.gridstackNode=l={...l,w:u,h:c,grid:this},delete l.x,delete l.y,this.engine.cleanupNode(l).nodeBoundFix(l),l._initDD=l._isExternal=l._temporaryRemoved=!0):(l.w=u,l.h=c,l._temporaryRemoved=!0),ue._itemRemoving(l.el,!1),Oe.on(r,"drag",o),o(i,r,a),!1}).on(this.el,"dropout",(i,r,a)=>{const l=a?.gridstackNode||r.gridstackNode;return l&&(!l.grid||l.grid===this)&&(this._leave(r,a),this._isTemp&&this.removeAsSubGrid(l)),!1}).on(this.el,"drop",(i,r,a)=>{const l=a?.gridstackNode||r.gridstackNode;if(l?.grid===this&&!l._isExternal)return!1;const u=!!this.placeholder.parentElement,c=r!==a;this.placeholder.remove(),delete this.placeholder.gridstackNode,u&&this.opts.animate&&(this.setAnimation(!1),this.setAnimation(!0,!0));const d=r._gridstackNodeOrig;if(delete r._gridstackNodeOrig,u&&d?.grid&&d.grid!==this){const h=d.grid;h.engine.removeNodeFromLayoutCache(d),h.engine.removedNodes.push(d),h._triggerRemoveEvent()._triggerChangeEvent(),h.parentGridNode&&!h.engine.nodes.length&&h.opts.subGridDynamic&&h.removeAsSubGrid()}if(!l||(u&&(this.engine.cleanupNode(l),l.grid=this),delete l.grid?._isTemp,Oe.off(r,"drag"),a!==r?(a.remove(),r=a):r.remove(),this._removeDD(r),!u))return!1;const f=l.subGrid?.el?.gridstack;return J.copyPos(l,this._readAttr(this.placeholder)),J.removePositioningStyles(r),c&&(l.content||l.subGridOpts||ue.addRemoveCB)?(delete l.el,r=this.addWidget(l)):(this._prepareElement(r,!0,l),this.el.appendChild(r),this.resizeToContentCheck(!1,l),f&&(f.parentGridNode=l),this._updateContainerHeight()),this.engine.addedNodes.push(l),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped({...i,type:"dropped"},d&&d.grid?d:void 0,l),!1}),this}static _itemRemoving(e,n){if(!e)return;const o=e?e.gridstackNode:void 0;!o?.grid||e.classList.contains(o.grid.opts.removableOptions.decline)||(n?o._isAboutToRemove=!0:delete o._isAboutToRemove,n?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;const e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Oe.isDroppable(e)&&Oe.droppable(e,this.opts.removableOptions).on(e,"dropover",(n,o)=>ue._itemRemoving(o,!0)).on(e,"dropout",(n,o)=>ue._itemRemoving(o,!1)),this):this}prepareDragDrop(e,n=!1){const o=e?.gridstackNode;if(!o)return;const i=o.noMove||this.opts.disableDrag,r=o.noResize||this.opts.disableResize,a=this.opts.staticGrid||i&&r;if((n||a)&&(o._initDD&&(this._removeDD(e),delete o._initDD),a&&e.classList.add("ui-draggable-disabled","ui-resizable-disabled"),!n))return this;if(!o._initDD){let l,u;const c=(h,p)=>{this.triggerEvent(h,h.target),l=this.cellWidth(),u=this.getCellHeight(!0),this._onStartMoving(e,h,p,o,l,u)},d=(h,p)=>{this._dragOrResize(e,h,p,o,l,u)},f=h=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete o._moving,delete o._resizing,delete o._event,delete o._lastTried;const p=o.w!==o._orig.w,y=h.target;if(!(!y.gridstackNode||y.gridstackNode.grid!==this)){if(o.el=y,o._isAboutToRemove){const m=e.gridstackNode.grid;m._gsEventHandler[h.type]&&m._gsEventHandler[h.type](h,y),m.engine.nodes.push(o),m.removeWidget(e,!0,!0)}else J.removePositioningStyles(y),o._temporaryRemoved?(this._writePosAttr(y,o),this.engine.addNode(o)):this._writePosAttr(y,o),this.triggerEvent(h,y);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),h.type==="resizestop"&&(Number.isInteger(o.sizeToContent)&&(o.sizeToContent=o.h),this.resizeToContentCheck(p,o))}};Oe.draggable(e,{start:c,stop:f,drag:d}).resizable(e,{start:c,stop:f,resize:d}),o._initDD=!0}return Oe.draggable(e,i?"disable":"enable").resizable(e,r?"disable":"enable"),this}_onStartMoving(e,n,o,i,r,a){if(this.engine.cleanNodes().beginUpdate(i),this._writePosAttr(this.placeholder,i),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=i,i.grid?.el)this.dragTransform=J.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){const l=this.placeholder.closest(".grid-stack");this.dragTransform=J.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(i.el=this.placeholder,i._lastUiPosition=o.position,i._prevYPix=o.position.top,i._moving=n.type==="dragstart",i._resizing=n.type==="resizestart",delete i._lastTried,n.type==="dropover"&&i._temporaryRemoved&&(this.engine.addNode(i),i._moving=!0),this.engine.cacheRects(r,a,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),n.type==="resizestart"){const l=this.getColumn()-i.x,u=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-i.y;Oe.resizable(e,"option","minWidth",r*Math.min(i.minW||1,l)).resizable(e,"option","minHeight",a*Math.min(i.minH||1,u)).resizable(e,"option","maxWidth",r*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",r*Math.min(i.maxW||Number.MAX_SAFE_INTEGER,i.x+i.w)).resizable(e,"option","maxHeight",a*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,u)).resizable(e,"option","maxHeightMoveUp",a*Math.min(i.maxH||Number.MAX_SAFE_INTEGER,i.y+i.h))}}_dragOrResize(e,n,o,i,r,a){const l={...i._orig};let u,c=this.opts.marginLeft,d=this.opts.marginRight,f=this.opts.marginTop,h=this.opts.marginBottom;const p=Math.round(a*.1),y=Math.round(r*.1);if(c=Math.min(c,y),d=Math.min(d,y),f=Math.min(f,p),h=Math.min(h,p),n.type==="drag"){if(i._temporaryRemoved)return;const b=o.position.top-i._prevYPix;i._prevYPix=o.position.top,this.opts.draggable.scroll!==!1&&J.updateScrollPosition(e,o.position,b);const N=o.position.left+(o.position.left>i._lastUiPosition.left?-d:c),_=o.position.top+(o.position.top>i._lastUiPosition.top?-h:f);l.x=Math.round(N/r),l.y=Math.round(_/a);const g=this._extraDragRow;if(this.engine.collide(i,l)){const x=this.getRow();let A=Math.max(0,l.y+i.h-x);this.opts.maxRow&&x+A>this.opts.maxRow&&(A=Math.max(0,this.opts.maxRow-x)),this._extraDragRow=A}else this._extraDragRow=0;if(this._extraDragRow!==g&&this._updateContainerHeight(),i.x===l.x&&i.y===l.y)return}else if(n.type==="resize"){if(l.x<0||(J.updateScrollResize(n,e,a),l.w=Math.round((o.size.width-c)/r),l.h=Math.round((o.size.height-f)/a),i.w===l.w&&i.h===l.h)||i._lastTried&&i._lastTried.w===l.w&&i._lastTried.h===l.h)return;const b=o.position.left+c,N=o.position.top+f;l.x=Math.round(b/r),l.y=Math.round(N/a),u=!0}i._event=n,i._lastTried=l;const m={x:o.position.left+c,y:o.position.top+f,w:(o.size?o.size.width:i.w*r)-c-d,h:(o.size?o.size.height:i.h*a)-f-h};if(this.engine.moveNodeCheck(i,{...l,cellWidth:r,cellHeight:a,rect:m,resizing:u})){i._lastUiPosition=o.position,this.engine.cacheRects(r,a,f,d,h,c),delete i._skipDown,u&&i.subGrid&&i.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();const b=n.target;i._sidebarOrig||this._writePosAttr(b,i),this.triggerEvent(n,b)}}triggerEvent(e,n){let o=this;for(;o.parentGridNode;)o=o.parentGridNode.grid;o._gsEventHandler[e.type]&&o._gsEventHandler[e.type](e,n)}_leave(e,n){n=n||e;const o=n.gridstackNode;if(!o||(n.style.transform=n.style.transformOrigin=null,Oe.off(e,"drag"),o._temporaryRemoved))return;o._temporaryRemoved=!0,this.engine.removeNode(o),o.el=o._isExternal&&n?n:e;const i=o._sidebarOrig;o._isExternal&&this.engine.cleanupNode(o),o._sidebarOrig=i,this.opts.removable===!0&&ue._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):o._isExternal&&this.engine.restoreInitial()}}ue.renderCB=(t,e)=>{t&&e?.content&&(t.textContent=e.content)},ue.resizeToContentParent=".grid-stack-item-content",ue.Utils=J,ue.Engine=vt,ue.GDRev="12.4.2";const Ay={class:"d-layout"},Py=["gs-id","gs-x","gs-y","gs-w","gs-h","gs-locked","gs-no-resize","gs-no-move","gs-min-w","gs-min-h","gs-max-w","gs-max-h"],vl=$t(s.defineComponent({name:"DLayout",__name:"layout",props:{modelValue:{default:()=>[]},column:{default:24},cellHeight:{default:60},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},disable:{type:Boolean,default:!1},animate:{type:Boolean,default:!0},float:{type:Boolean,default:!0},removable:{type:Boolean,default:!1},removableOptions:{}},emits:["update:modelValue","added","removed","changed","dragStart","dragStop","resizeStart","resizeStop"],setup(t,{expose:e,emit:n}){const o=t,i=n,r=s.ref();let a=null;const l=async()=>{r.value&&(await s.nextTick(),a&&a.destroy(!1),a=ue.init({column:o.column,cellHeight:o.cellHeight,disableDrag:!(o.draggable&&!o.disable),disableResize:!(o.resizable&&!o.disable),animate:o.animate,float:o.float,removable:o.removable,removableOptions:o.removableOptions},r.value),a.on("added",(h,p)=>{const y=p[0];if(y){const m=u(y);i("added",m),d()}}),a.on("removed",(h,p)=>{const y=p[0];if(y){const m=u(y);i("removed",m),d()}}),a.on("change",()=>{d();const p=(a?.save()||[]).map(y=>u(y));i("changed",p)}),a.on("dragstart",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("dragStart",h,m)}}),a.on("dragstop",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("dragStop",h,m)}}),a.on("resizestart",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("resizeStart",h,m)}}),a.on("resizestop",(h,p)=>{if(p){const y=p.gridstackNode||p,m=u(y);i("resizeStop",h,m)}}))},u=h=>({id:h.id||h.el?.getAttribute("gs-id")||"",x:h.x||0,y:h.y||0,w:h.w||1,h:h.h||1,locked:h.locked||!1,noResize:h.noResize||!1,noMove:h.noMove||!1,minW:h.minW,minH:h.minH,maxW:h.maxW,maxH:h.maxH}),c=async()=>{if(!a||!r.value)return;await s.nextTick();const h=a.engine.nodes;new Set(h.map(y=>y.id));const p=new Set(o.modelValue.map(y=>y.id));h.forEach(y=>{if(!p.has(y.id||"")){const m=y.el;m&&a&&a.removeWidget(m,!1)}}),o.modelValue.forEach(y=>{const m=h.find(b=>b.id===y.id);if(m)m.el&&a&&a.update(m.el,{x:y.x,y:y.y,w:y.w,h:y.h,locked:y.locked,noResize:y.noResize,noMove:y.noMove,minW:y.minW,minH:y.minH,maxW:y.maxW,maxH:y.maxH});else{if(!r.value||!a)return;const b=r.value.querySelector(`[gs-id="${y.id}"]`);b&&a.makeWidget(b)}})},d=()=>{if(!a)return;const p=a.save().map(y=>{const m={id:y.id||"",x:y.x||0,y:y.y||0,w:y.w||1,h:y.h||1},b=o.modelValue.find(N=>N.id===m.id);return b&&Object.keys(b).forEach(N=>{["id","x","y","w","h"].includes(N)||(m[N]=b[N])}),m});i("update:modelValue",p)},f=s.computed(()=>o.modelValue);return s.watch(()=>o.modelValue,async()=>{a&&(await s.nextTick(),c())},{deep:!0}),s.watch(()=>[o.column,o.cellHeight,o.draggable,o.resizable,o.disable,o.animate,o.float,o.removable],()=>{l()}),s.onMounted(()=>{l()}),s.onBeforeUnmount(()=>{a&&(a.destroy(!1),a=null)}),e({addItem:async h=>{if(a&&r.value){await s.nextTick();const p=r.value.querySelector(`[gs-id="${h.id}"]`);p&&(a.makeWidget(p),a.update(p,{x:h.x,y:h.y,w:h.w,h:h.h,locked:h.locked,noResize:h.noResize,noMove:h.noMove,minW:h.minW,minH:h.minH,maxW:h.maxW,maxH:h.maxH}))}},removeItem:h=>{if(a&&r.value){const p=r.value.querySelector(`[gs-id="${h}"]`);p&&a.removeWidget(p,!1)}},clear:()=>{a&&a.removeAll(!1)},getGrid:()=>a}),(h,p)=>(s.openBlock(),s.createElementBlock("div",Ay,[s.createElementVNode("div",{ref_key:"gridContainerRef",ref:r},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(f.value,y=>(s.openBlock(),s.createElementBlock("div",{key:y.id,"gs-id":y.id,"gs-x":y.x,"gs-y":y.y,"gs-w":y.w,"gs-h":y.h,"gs-locked":y.locked,"gs-no-resize":y.noResize,"gs-no-move":y.noMove,"gs-min-w":y.minW,"gs-min-h":y.minH,"gs-max-w":y.maxW,"gs-max-h":y.maxH,class:"d-layout-item"},[s.renderSlot(h.$slots,"item",{item:y})],8,Py))),128))],512)]))}})),ze=(t,e="",n=!1)=>n?`${t}pt`:e?`${t}${e}`:`${t}px`,Ve=(t,e=0)=>t==null||isNaN(t)?0:Number(Number(t).toFixed(e)),Oy=t=>t*3/4,Ry=t=>t*4/3,Hy=["onMousedown"],Vy={key:2,class:"d-draggable__mask"},bl=$t(s.defineComponent({name:"DDraggable",__name:"draggable",props:{index:{},mask:{type:Boolean,default:!0},scale:{default:1},readonly:{type:Boolean,default:!1},resize:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},step:{default:1},zIndex:{default:1},isActiveBgTransparent:{type:Boolean,default:!1},left:{default:0},top:{default:0},width:{},height:{},activeFlag:{type:Boolean,default:!1},isPt:{type:Boolean,default:!1}},emits:["focus","blur","over","out"],setup(t,{expose:e,emit:n}){const o=t,i=n,r=s.ref(),a=s.ref(),l=s.ref(0),u=s.ref(0),c=s.ref(0),d=s.ref(0),f=s.ref(null),h=s.ref(!1),p=s.ref(!1),y=s.ref(!1),m=s.ref(!1),b=s.ref([{classname:"left"},{classname:"right"},{classname:"top"},{classname:"bottom"},{classname:"top-left"},{classname:"top-right"},{classname:"bottom-left"},{classname:"bottom-right"}]),N=s.computed(()=>o.scale),_=s.computed(()=>({left:ze(N.value,"",o.isPt)})),g=s.computed(()=>({left:ze(-N.value,"",o.isPt)})),x=s.computed(()=>({left:"auto",right:ze(-N.value,"",o.isPt)})),A=s.computed(()=>({top:ze(-N.value,"",o.isPt)})),$=s.computed(()=>({top:"auto",bottom:ze(-N.value,"",o.isPt)})),F=s.computed(()=>{const Z=8*N.value;return{width:ze(Z,"",o.isPt),height:ze(Z,"",o.isPt)}}),U=s.computed(()=>({fontSize:ze(16*N.value,"",o.isPt)})),G=s.computed(()=>Object.assign((()=>{if(m.value){const Z={zIndex:9999,..._.value};return o.isActiveBgTransparent&&(m.value||p.value)&&!o.readonly&&!o.disabled&&(Z.backgroundColor="color-mix(in srgb, var(--j-color-primary-bg) 60%, transparent)"),Z}return{zIndex:o.zIndex}})(),{top:ze(d.value,"",o.isPt),width:ze(l.value,"",o.isPt),height:ze(u.value,"",o.isPt),padding:ze(8*N.value,"",o.isPt),..._.value,left:ze(c.value,"",o.isPt)}));s.watch(()=>o.width,Z=>{l.value=Ve(T(Z))||(f.value?.offsetWidth??0)}),s.watch(()=>o.height,Z=>{u.value=Ve(T(Z))||(f.value?.offsetHeight??0)},{deep:!0}),s.watch(()=>o.left,Z=>{c.value=Ve(T(Z))}),s.watch(()=>o.top,Z=>{d.value=Ve(T(Z))}),s.watch(l,Z=>{r.value&&(r.value.style.width=ze(Z,"",o.isPt),o.resize&&f.value?.style&&(f.value.style.width=ze(Z,"",o.isPt)))}),s.watch(u,Z=>{r.value&&(r.value.style.height=ze(Z,"",o.isPt),o.resize&&f.value?.style&&(f.value.style.height=ze(Z,"",o.isPt)))}),s.watch(()=>o.activeFlag,Z=>{S(Z)});const S=Z=>{m.value=Z},T=Z=>Z===void 0?0:o.isPt?Ry(Z):Z,E=()=>{a.value&&a.value.firstChild&&(f.value=a.value.firstChild,l.value=Ve(T(o.width))||(f.value?.offsetWidth??0),u.value=Ve(T(o.height))||(f.value?.offsetHeight??0),c.value=Ve(T(o.left)),d.value=Ve(T(o.top)),S(o.activeFlag))},H=Z=>{c.value=Z},w=Z=>{d.value=Z},D=Z=>{const Q=8*N.value/2,q={};return Z.split("-").forEach(re=>{q[re]=ze(-Q,"",o.isPt)}),q},v=Z=>{p.value=Z},C=Z=>o.isPt?Oy(Z):Z,k=()=>{h.value=!0,i("focus",{index:o.index,width:C(l.value),height:C(u.value),left:C(c.value),top:C(d.value)})},O=()=>{h.value=!1,y.value=!1,i("blur",{index:o.index,width:C(l.value),height:C(u.value),left:C(c.value),top:C(d.value)})},R=()=>{document.onmouseup=()=>{document.onmousemove=null,document.onmouseup=null,O()}},B=(Z,Q)=>{if(o.disabled||o.readonly)return;let q,ee,re,ie,ce,oe;y.value=!0,k();let ae=Z.clientX,z=Z.clientY;document.onmousemove=M=>{h.value=!0,Q==="right"?(q=!0,ee=!1):Q==="left"?(q=!0,re=!0,ce=!0,ee=!1):Q==="top"?(q=!1,ee=!0,ie=!0,oe=!0):Q==="bottom"?(q=!1,ee=!0):Q==="bottom-right"?(q=!0,ee=!0):Q==="bottom-left"?(q=!0,ee=!0,re=!0,ce=!0):Q==="top-right"?(q=!0,ee=!0,ie=!0,oe=!0):Q==="top-left"&&(q=!0,ee=!0,re=!0,ce=!0,ie=!0,oe=!0);const V=M.clientX-ae,X=M.clientY-z;if(ae=M.clientX,z=M.clientY,q){let I=V*o.step;ce&&(I=-I),re&&(c.value=Ve(c.value-I)),l.value=Ve(l.value+I)}if(ee){let I=X*o.step;oe&&(I=-I),ie&&(d.value=Ve(d.value-I)),u.value=Ve(u.value+I)}},R()},P=()=>{p.value=!1,i("out",{index:o.index,width:C(l.value),height:C(u.value),left:C(c.value),top:C(d.value)})},L=()=>{o.disabled||o.readonly||(p.value=!0,i("over",{index:o.index,width:C(l.value),height:C(u.value),left:C(c.value),top:C(d.value)}))},j=Z=>{if(o.disabled||o.readonly)return;m.value=!0,k();let Q=Z.clientX,q=Z.clientY;document.onmousemove=ee=>{const re=ee.clientX-Q,ie=ee.clientY-q;Q=ee.clientX,q=ee.clientY,c.value=Ve(c.value+re*o.step),d.value=Ve(d.value+ie*o.step)},R()};return s.onMounted(()=>{E()}),e({setActive:S,setLeft:H,setTop:w,setOverActive:v}),(Z,Q)=>(s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["d-draggable",{"d-draggable--active":(m.value||p.value)&&!t.readonly&&!t.disabled},{"d-draggable--pt":t.isPt&&!t.readonly&&!t.disabled},{"d-draggable--move":h.value},{"d-draggable--click":t.disabled}]),onMousedown:s.withModifiers(j,["stop"]),onMouseover:s.withModifiers(L,["stop"]),onMouseout:s.withModifiers(P,["stop"]),style:s.normalizeStyle(G.value)},[s.createElementVNode("div",{class:"d-draggable__wrapper",ref_key:"wrapper",ref:r},[(m.value||p.value||h.value)&&!t.readonly&&!t.disabled?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...A.value}),class:"d-draggable__line d-draggable__line--left"},null,4),s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...g.value}),class:"d-draggable__line d-draggable__line--top"},null,4),t.isPt?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...A.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...g.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4),s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...$.value}),class:"d-draggable__line d-draggable__line--left"},null,4),s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...x.value}),class:"d-draggable__line d-draggable__line--top"},null,4),s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...$.value,transform:"none"}),class:"d-draggable__line d-draggable__line--left"},null,4),s.createElementVNode("div",{style:s.normalizeStyle({..._.value,...x.value,transform:"none"}),class:"d-draggable__line d-draggable__line--top"},null,4)],64)):(s.openBlock(),s.createElementBlock("div",{key:0,class:"d-draggable__line d-draggable__line--label",style:s.normalizeStyle(U.value)},s.toDisplayString(c.value)+","+s.toDisplayString(d.value),5))],64)):s.createCommentVNode("",!0),!t.readonly&&!t.disabled?(s.openBlock(!0),s.createElementBlock(s.Fragment,{key:1},s.renderList(b.value,(q,ee)=>(s.openBlock(),s.createElementBlock(s.Fragment,{key:ee},[m.value?(s.openBlock(),s.createElementBlock("div",{key:0,class:s.normalizeClass(["d-draggable__range",`d-draggable__range--${q.classname}`]),style:s.normalizeStyle([F.value,D(q.classname)]),onMousedown:s.withModifiers(re=>B(re,q.classname),["stop"])},null,46,Hy)):s.createCommentVNode("",!0)],64))),128)):s.createCommentVNode("",!0),s.createElementVNode("div",{class:"d-draggable__item",ref_key:"item",ref:a},[s.renderSlot(Z.$slots,"default")],512),!t.disabled&&t.mask?(s.openBlock(),s.createElementBlock("div",Vy)):s.createCommentVNode("",!0)],512)],38))}})),Ly=t=>{const e=jy(t.components);return{formConfig:t.form,componentList:e}},Fy=(t,e)=>{let n={},o=[];const i={};if(t.ver==="V3"){const r=t;n=r.form;const a={};r.components.forEach(l=>{const u=e[l.type];a[l.containerId]=a[l.containerId]||[];const c={id:l.id,name:l.name,type:l.type,dragType:u?.dragType||"component",componentName:u?.componentName||"",runtimeType:u?.runtimeType,groupId:l.groupId,config:l.config,isInput:u?.isInput!==!1,containerId:l.containerId,level:l.level};u?.dragType==="container"&&(c.children=[]),i[c.id]=c,a[l.containerId].push(c)}),Object.keys(a).forEach(l=>{i[l]&&(i[l].children=a[l])}),o=a.form||[]}return{formConfig:n,componentList:o,componentDic:i}},vr=(t,e)=>{const n={ver:"V3",form:{...t},components:[],db:{}};return wl(e||[],n.components),n},wl=(t,e)=>{t.forEach(n=>{if(n.type==="pkey")return;const o={id:n.id,name:n.name,type:n.type,runtimeType:n.runtimeType||n.componentName||n.type,groupId:n.groupId||"",config:n.config,containerId:n.containerId,level:n.level};if(n.dragType==="container"){const i=n.children||[];wl(i,e)}e.push(o)})},jy=t=>{const e={},n={};return t.forEach(o=>{e[o.containerId]=e[o.containerId]||[];const i={id:o.id,type:o.runtimeType,slot:o.groupId,config:{rule:[]}};o.config&&Object.keys(o.config).forEach(r=>{if(r==="required"){o.config.required&&i.config?.rule?.push({required:!0,message:o.config.requiredMsg||"请输入"});return}if(r==="patterns"){o.config.patterns.forEach(a=>{a.reg&&a.msg&&i.config?.rule?.push({pattern:new RegExp(a.reg),message:`请输入${a.msg||""}`})});return}i.config[r]=o.config[r]}),o.type==="pkey"&&(i.config.isPkey=!0),e[o.containerId].push(i),n[o.id]=i}),Object.keys(e).forEach(o=>{const i=n[o];if(i){const r=e[o];if(["j-tabs","j-collapse"].includes(i.type||"")&&i.config?.groups){const a={};r.forEach(u=>{if(u.slot!==void 0&&u.slot!==null){const c=u.slot.toString();a[c]||(a[c]=[]),delete u.slot,a[c].push(u)}});const l=i.config.groups.map(u=>{const c=u._i,d=a[c]||[],f={label:u.label};u.active&&i.type==="j-collapse"&&(f.active=u.active);let h;if(i.type==="j-tabs"&&i.config?.tabKey&&i.config?.options.length>0){const y=i.config.options.find(m=>m.label===u._i);y&&(h=({formData:m})=>({display:y.value.includes(m[i.config?.tabKey||""])?y.display:!y.display}))}const p={config:f,children:d};return h&&(p.getCompConfig=h),p});i.children=l,delete i.config.groups}else i.children=r}}),e.form};function Gy(t){const{toString:e}=Object.prototype,n={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"};return typeof Element<"u"&&t instanceof Element?"element":n[e.call(t)]}function br(t){const e=Gy(t);let n;if(e==="array")n=[];else if(e==="object")n={};else return t;if(e==="array")for(let o=0,i=t.length;o<i;o++)t[o]=(t[o]===0,t[o]),t[o]&&delete t[o].$parent,n.push(br(t[o]));else e==="object"&&Object.keys(t).forEach(o=>{t&&delete t.$parent,n[o]=br(t[o])});return n}var wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _l(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Wy(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=function o(){var i=!1;try{i=this instanceof o}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(o){var i=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,i.get?i:{enumerable:!0,get:function(){return t[o]}})}),n}var Fo={exports:{}},Yy=Fo.exports,xl;function Uy(){return xl||(xl=1,(function(t,e){(function(n,o){t.exports=o()})(Yy,(function(){var n=1e3,o=6e4,i=36e5,r="millisecond",a="second",l="minute",u="hour",c="day",d="week",f="month",h="quarter",p="year",y="date",m="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,N=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,_={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(w){var D=["th","st","nd","rd"],v=w%100;return"["+w+(D[(v-20)%10]||D[v]||D[0])+"]"}},g=function(w,D,v){var C=String(w);return!C||C.length>=D?w:""+Array(D+1-C.length).join(v)+w},x={s:g,z:function(w){var D=-w.utcOffset(),v=Math.abs(D),C=Math.floor(v/60),k=v%60;return(D<=0?"+":"-")+g(C,2,"0")+":"+g(k,2,"0")},m:function w(D,v){if(D.date()<v.date())return-w(v,D);var C=12*(v.year()-D.year())+(v.month()-D.month()),k=D.clone().add(C,f),O=v-k<0,R=D.clone().add(C+(O?-1:1),f);return+(-(C+(v-k)/(O?k-R:R-k))||0)},a:function(w){return w<0?Math.ceil(w)||0:Math.floor(w)},p:function(w){return{M:f,y:p,w:d,d:c,D:y,h:u,m:l,s:a,ms:r,Q:h}[w]||String(w||"").toLowerCase().replace(/s$/,"")},u:function(w){return w===void 0}},A="en",$={};$[A]=_;var F="$isDayjsObject",U=function(w){return w instanceof E||!(!w||!w[F])},G=function w(D,v,C){var k;if(!D)return A;if(typeof D=="string"){var O=D.toLowerCase();$[O]&&(k=O),v&&($[O]=v,k=O);var R=D.split("-");if(!k&&R.length>1)return w(R[0])}else{var B=D.name;$[B]=D,k=B}return!C&&k&&(A=k),k||!C&&A},S=function(w,D){if(U(w))return w.clone();var v=typeof D=="object"?D:{};return v.date=w,v.args=arguments,new E(v)},T=x;T.l=G,T.i=U,T.w=function(w,D){return S(w,{locale:D.$L,utc:D.$u,x:D.$x,$offset:D.$offset})};var E=(function(){function w(v){this.$L=G(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[F]=!0}var D=w.prototype;return D.parse=function(v){this.$d=(function(C){var k=C.date,O=C.utc;if(k===null)return new Date(NaN);if(T.u(k))return new Date;if(k instanceof Date)return new Date(k);if(typeof k=="string"&&!/Z$/i.test(k)){var R=k.match(b);if(R){var B=R[2]-1||0,P=(R[7]||"0").substring(0,3);return O?new Date(Date.UTC(R[1],B,R[3]||1,R[4]||0,R[5]||0,R[6]||0,P)):new Date(R[1],B,R[3]||1,R[4]||0,R[5]||0,R[6]||0,P)}}return new Date(k)})(v),this.init()},D.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},D.$utils=function(){return T},D.isValid=function(){return this.$d.toString()!==m},D.isSame=function(v,C){var k=S(v);return this.startOf(C)<=k&&k<=this.endOf(C)},D.isAfter=function(v,C){return S(v)<this.startOf(C)},D.isBefore=function(v,C){return this.endOf(C)<S(v)},D.$g=function(v,C,k){return T.u(v)?this[C]:this.set(k,v)},D.unix=function(){return Math.floor(this.valueOf()/1e3)},D.valueOf=function(){return this.$d.getTime()},D.startOf=function(v,C){var k=this,O=!!T.u(C)||C,R=T.p(v),B=function(re,ie){var ce=T.w(k.$u?Date.UTC(k.$y,ie,re):new Date(k.$y,ie,re),k);return O?ce:ce.endOf(c)},P=function(re,ie){return T.w(k.toDate()[re].apply(k.toDate("s"),(O?[0,0,0,0]:[23,59,59,999]).slice(ie)),k)},L=this.$W,j=this.$M,Z=this.$D,Q="set"+(this.$u?"UTC":"");switch(R){case p:return O?B(1,0):B(31,11);case f:return O?B(1,j):B(0,j+1);case d:var q=this.$locale().weekStart||0,ee=(L<q?L+7:L)-q;return B(O?Z-ee:Z+(6-ee),j);case c:case y:return P(Q+"Hours",0);case u:return P(Q+"Minutes",1);case l:return P(Q+"Seconds",2);case a:return P(Q+"Milliseconds",3);default:return this.clone()}},D.endOf=function(v){return this.startOf(v,!1)},D.$set=function(v,C){var k,O=T.p(v),R="set"+(this.$u?"UTC":""),B=(k={},k[c]=R+"Date",k[y]=R+"Date",k[f]=R+"Month",k[p]=R+"FullYear",k[u]=R+"Hours",k[l]=R+"Minutes",k[a]=R+"Seconds",k[r]=R+"Milliseconds",k)[O],P=O===c?this.$D+(C-this.$W):C;if(O===f||O===p){var L=this.clone().set(y,1);L.$d[B](P),L.init(),this.$d=L.set(y,Math.min(this.$D,L.daysInMonth())).$d}else B&&this.$d[B](P);return this.init(),this},D.set=function(v,C){return this.clone().$set(v,C)},D.get=function(v){return this[T.p(v)]()},D.add=function(v,C){var k,O=this;v=Number(v);var R=T.p(C),B=function(j){var Z=S(O);return T.w(Z.date(Z.date()+Math.round(j*v)),O)};if(R===f)return this.set(f,this.$M+v);if(R===p)return this.set(p,this.$y+v);if(R===c)return B(1);if(R===d)return B(7);var P=(k={},k[l]=o,k[u]=i,k[a]=n,k)[R]||1,L=this.$d.getTime()+v*P;return T.w(L,this)},D.subtract=function(v,C){return this.add(-1*v,C)},D.format=function(v){var C=this,k=this.$locale();if(!this.isValid())return k.invalidDate||m;var O=v||"YYYY-MM-DDTHH:mm:ssZ",R=T.z(this),B=this.$H,P=this.$m,L=this.$M,j=k.weekdays,Z=k.months,Q=k.meridiem,q=function(ie,ce,oe,ae){return ie&&(ie[ce]||ie(C,O))||oe[ce].slice(0,ae)},ee=function(ie){return T.s(B%12||12,ie,"0")},re=Q||function(ie,ce,oe){var ae=ie<12?"AM":"PM";return oe?ae.toLowerCase():ae};return O.replace(N,(function(ie,ce){return ce||(function(oe){switch(oe){case"YY":return String(C.$y).slice(-2);case"YYYY":return T.s(C.$y,4,"0");case"M":return L+1;case"MM":return T.s(L+1,2,"0");case"MMM":return q(k.monthsShort,L,Z,3);case"MMMM":return q(Z,L);case"D":return C.$D;case"DD":return T.s(C.$D,2,"0");case"d":return String(C.$W);case"dd":return q(k.weekdaysMin,C.$W,j,2);case"ddd":return q(k.weekdaysShort,C.$W,j,3);case"dddd":return j[C.$W];case"H":return String(B);case"HH":return T.s(B,2,"0");case"h":return ee(1);case"hh":return ee(2);case"a":return re(B,P,!0);case"A":return re(B,P,!1);case"m":return String(P);case"mm":return T.s(P,2,"0");case"s":return String(C.$s);case"ss":return T.s(C.$s,2,"0");case"SSS":return T.s(C.$ms,3,"0");case"Z":return R}return null})(ie)||R.replace(":","")}))},D.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},D.diff=function(v,C,k){var O,R=this,B=T.p(C),P=S(v),L=(P.utcOffset()-this.utcOffset())*o,j=this-P,Z=function(){return T.m(R,P)};switch(B){case p:O=Z()/12;break;case f:O=Z();break;case h:O=Z()/3;break;case d:O=(j-L)/6048e5;break;case c:O=(j-L)/864e5;break;case u:O=j/i;break;case l:O=j/o;break;case a:O=j/n;break;default:O=j}return k?O:T.a(O)},D.daysInMonth=function(){return this.endOf(f).$D},D.$locale=function(){return $[this.$L]},D.locale=function(v,C){if(!v)return this.$L;var k=this.clone(),O=G(v,C,!0);return O&&(k.$L=O),k},D.clone=function(){return T.w(this.$d,this)},D.toDate=function(){return new Date(this.valueOf())},D.toJSON=function(){return this.isValid()?this.toISOString():null},D.toISOString=function(){return this.$d.toISOString()},D.toString=function(){return this.$d.toUTCString()},w})(),H=E.prototype;return S.prototype=H,[["$ms",r],["$s",a],["$m",l],["$H",u],["$W",c],["$M",f],["$y",p],["$D",y]].forEach((function(w){H[w[1]]=function(D){return this.$g(D,w[0],w[1])}})),S.extend=function(w,D){return w.$i||(w(D,E,S),w.$i=!0),S},S.locale=G,S.isDayjs=U,S.unix=function(w){return S(1e3*w)},S.en=$[A],S.Ls=$,S.p={},S}))})(Fo)),Fo.exports}Uy();var jo={exports:{}};function Xy(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Go={exports:{}};const qy=Wy(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ky=Go.exports,Cl;function qe(){return Cl||(Cl=1,(function(t,e){(function(n,o){t.exports=o()})(Ky,function(){var n=n||(function(o,i){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof wr<"u"&&wr.crypto&&(r=wr.crypto),!r&&typeof Xy=="function")try{r=qy}catch{}var a=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||(function(){function _(){}return function(g){var x;return _.prototype=g,x=new _,_.prototype=null,x}})(),u={},c=u.lib={},d=c.Base=(function(){return{extend:function(_){var g=l(this);return _&&g.mixIn(_),(!g.hasOwnProperty("init")||this.init===g.init)&&(g.init=function(){g.$super.init.apply(this,arguments)}),g.init.prototype=g,g.$super=this,g},create:function(){var _=this.extend();return _.init.apply(_,arguments),_},init:function(){},mixIn:function(_){for(var g in _)_.hasOwnProperty(g)&&(this[g]=_[g]);_.hasOwnProperty("toString")&&(this.toString=_.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),f=c.WordArray=d.extend({init:function(_,g){_=this.words=_||[],g!=i?this.sigBytes=g:this.sigBytes=_.length*4},toString:function(_){return(_||p).stringify(this)},concat:function(_){var g=this.words,x=_.words,A=this.sigBytes,$=_.sigBytes;if(this.clamp(),A%4)for(var F=0;F<$;F++){var U=x[F>>>2]>>>24-F%4*8&255;g[A+F>>>2]|=U<<24-(A+F)%4*8}else for(var G=0;G<$;G+=4)g[A+G>>>2]=x[G>>>2];return this.sigBytes+=$,this},clamp:function(){var _=this.words,g=this.sigBytes;_[g>>>2]&=4294967295<<32-g%4*8,_.length=o.ceil(g/4)},clone:function(){var _=d.clone.call(this);return _.words=this.words.slice(0),_},random:function(_){for(var g=[],x=0;x<_;x+=4)g.push(a());return new f.init(g,_)}}),h=u.enc={},p=h.Hex={stringify:function(_){for(var g=_.words,x=_.sigBytes,A=[],$=0;$<x;$++){var F=g[$>>>2]>>>24-$%4*8&255;A.push((F>>>4).toString(16)),A.push((F&15).toString(16))}return A.join("")},parse:function(_){for(var g=_.length,x=[],A=0;A<g;A+=2)x[A>>>3]|=parseInt(_.substr(A,2),16)<<24-A%8*4;return new f.init(x,g/2)}},y=h.Latin1={stringify:function(_){for(var g=_.words,x=_.sigBytes,A=[],$=0;$<x;$++){var F=g[$>>>2]>>>24-$%4*8&255;A.push(String.fromCharCode(F))}return A.join("")},parse:function(_){for(var g=_.length,x=[],A=0;A<g;A++)x[A>>>2]|=(_.charCodeAt(A)&255)<<24-A%4*8;return new f.init(x,g)}},m=h.Utf8={stringify:function(_){try{return decodeURIComponent(escape(y.stringify(_)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(_){return y.parse(unescape(encodeURIComponent(_)))}},b=c.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(_){typeof _=="string"&&(_=m.parse(_)),this._data.concat(_),this._nDataBytes+=_.sigBytes},_process:function(_){var g,x=this._data,A=x.words,$=x.sigBytes,F=this.blockSize,U=F*4,G=$/U;_?G=o.ceil(G):G=o.max((G|0)-this._minBufferSize,0);var S=G*F,T=o.min(S*4,$);if(S){for(var E=0;E<S;E+=F)this._doProcessBlock(A,E);g=A.splice(0,S),x.sigBytes-=T}return new f.init(g,T)},clone:function(){var _=d.clone.call(this);return _._data=this._data.clone(),_},_minBufferSize:0});c.Hasher=b.extend({cfg:d.extend(),init:function(_){this.cfg=this.cfg.extend(_),this.reset()},reset:function(){b.reset.call(this),this._doReset()},update:function(_){return this._append(_),this._process(),this},finalize:function(_){_&&this._append(_);var g=this._doFinalize();return g},blockSize:16,_createHelper:function(_){return function(g,x){return new _.init(x).finalize(g)}},_createHmacHelper:function(_){return function(g,x){return new N.HMAC.init(_,x).finalize(g)}}});var N=u.algo={};return u})(Math);return n})})(Go)),Go.exports}var Wo={exports:{}},Zy=Wo.exports,El;function Sl(){return El||(El=1,(function(t,e){(function(n,o){t.exports=o(qe())})(Zy,function(n){return(function(){var o=n,i=o.lib,r=i.WordArray,a=o.enc;a.Base64={stringify:function(u){var c=u.words,d=u.sigBytes,f=this._map;u.clamp();for(var h=[],p=0;p<d;p+=3)for(var y=c[p>>>2]>>>24-p%4*8&255,m=c[p+1>>>2]>>>24-(p+1)%4*8&255,b=c[p+2>>>2]>>>24-(p+2)%4*8&255,N=y<<16|m<<8|b,_=0;_<4&&p+_*.75<d;_++)h.push(f.charAt(N>>>6*(3-_)&63));var g=f.charAt(64);if(g)for(;h.length%4;)h.push(g);return h.join("")},parse:function(u){var c=u.length,d=this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var h=0;h<d.length;h++)f[d.charCodeAt(h)]=h}var p=d.charAt(64);if(p){var y=u.indexOf(p);y!==-1&&(c=y)}return l(u,c,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function l(u,c,d){for(var f=[],h=0,p=0;p<c;p++)if(p%4){var y=d[u.charCodeAt(p-1)]<<p%4*2,m=d[u.charCodeAt(p)]>>>6-p%4*2,b=y|m;f[h>>>2]|=b<<24-h%4*8,h++}return r.create(f,h)}})(),n.enc.Base64})})(Wo)),Wo.exports}var Yo={exports:{}},Jy=Yo.exports,Nl;function kl(){return Nl||(Nl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(Jy,function(n){return(function(o){var i=n,r=i.lib,a=r.WordArray,l=r.Hasher,u=i.algo,c=[];(function(){for(var m=0;m<64;m++)c[m]=o.abs(o.sin(m+1))*4294967296|0})();var d=u.MD5=l.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,b){for(var N=0;N<16;N++){var _=b+N,g=m[_];m[_]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var x=this._hash.words,A=m[b+0],$=m[b+1],F=m[b+2],U=m[b+3],G=m[b+4],S=m[b+5],T=m[b+6],E=m[b+7],H=m[b+8],w=m[b+9],D=m[b+10],v=m[b+11],C=m[b+12],k=m[b+13],O=m[b+14],R=m[b+15],B=x[0],P=x[1],L=x[2],j=x[3];B=f(B,P,L,j,A,7,c[0]),j=f(j,B,P,L,$,12,c[1]),L=f(L,j,B,P,F,17,c[2]),P=f(P,L,j,B,U,22,c[3]),B=f(B,P,L,j,G,7,c[4]),j=f(j,B,P,L,S,12,c[5]),L=f(L,j,B,P,T,17,c[6]),P=f(P,L,j,B,E,22,c[7]),B=f(B,P,L,j,H,7,c[8]),j=f(j,B,P,L,w,12,c[9]),L=f(L,j,B,P,D,17,c[10]),P=f(P,L,j,B,v,22,c[11]),B=f(B,P,L,j,C,7,c[12]),j=f(j,B,P,L,k,12,c[13]),L=f(L,j,B,P,O,17,c[14]),P=f(P,L,j,B,R,22,c[15]),B=h(B,P,L,j,$,5,c[16]),j=h(j,B,P,L,T,9,c[17]),L=h(L,j,B,P,v,14,c[18]),P=h(P,L,j,B,A,20,c[19]),B=h(B,P,L,j,S,5,c[20]),j=h(j,B,P,L,D,9,c[21]),L=h(L,j,B,P,R,14,c[22]),P=h(P,L,j,B,G,20,c[23]),B=h(B,P,L,j,w,5,c[24]),j=h(j,B,P,L,O,9,c[25]),L=h(L,j,B,P,U,14,c[26]),P=h(P,L,j,B,H,20,c[27]),B=h(B,P,L,j,k,5,c[28]),j=h(j,B,P,L,F,9,c[29]),L=h(L,j,B,P,E,14,c[30]),P=h(P,L,j,B,C,20,c[31]),B=p(B,P,L,j,S,4,c[32]),j=p(j,B,P,L,H,11,c[33]),L=p(L,j,B,P,v,16,c[34]),P=p(P,L,j,B,O,23,c[35]),B=p(B,P,L,j,$,4,c[36]),j=p(j,B,P,L,G,11,c[37]),L=p(L,j,B,P,E,16,c[38]),P=p(P,L,j,B,D,23,c[39]),B=p(B,P,L,j,k,4,c[40]),j=p(j,B,P,L,A,11,c[41]),L=p(L,j,B,P,U,16,c[42]),P=p(P,L,j,B,T,23,c[43]),B=p(B,P,L,j,w,4,c[44]),j=p(j,B,P,L,C,11,c[45]),L=p(L,j,B,P,R,16,c[46]),P=p(P,L,j,B,F,23,c[47]),B=y(B,P,L,j,A,6,c[48]),j=y(j,B,P,L,E,10,c[49]),L=y(L,j,B,P,O,15,c[50]),P=y(P,L,j,B,S,21,c[51]),B=y(B,P,L,j,C,6,c[52]),j=y(j,B,P,L,U,10,c[53]),L=y(L,j,B,P,D,15,c[54]),P=y(P,L,j,B,$,21,c[55]),B=y(B,P,L,j,H,6,c[56]),j=y(j,B,P,L,R,10,c[57]),L=y(L,j,B,P,T,15,c[58]),P=y(P,L,j,B,k,21,c[59]),B=y(B,P,L,j,G,6,c[60]),j=y(j,B,P,L,v,10,c[61]),L=y(L,j,B,P,F,15,c[62]),P=y(P,L,j,B,w,21,c[63]),x[0]=x[0]+B|0,x[1]=x[1]+P|0,x[2]=x[2]+L|0,x[3]=x[3]+j|0},_doFinalize:function(){var m=this._data,b=m.words,N=this._nDataBytes*8,_=m.sigBytes*8;b[_>>>5]|=128<<24-_%32;var g=o.floor(N/4294967296),x=N;b[(_+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,b[(_+64>>>9<<4)+14]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,m.sigBytes=(b.length+1)*4,this._process();for(var A=this._hash,$=A.words,F=0;F<4;F++){var U=$[F];$[F]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360}return A},clone:function(){var m=l.clone.call(this);return m._hash=this._hash.clone(),m}});function f(m,b,N,_,g,x,A){var $=m+(b&N|~b&_)+g+A;return($<<x|$>>>32-x)+b}function h(m,b,N,_,g,x,A){var $=m+(b&_|N&~_)+g+A;return($<<x|$>>>32-x)+b}function p(m,b,N,_,g,x,A){var $=m+(b^N^_)+g+A;return($<<x|$>>>32-x)+b}function y(m,b,N,_,g,x,A){var $=m+(N^(b|~_))+g+A;return($<<x|$>>>32-x)+b}i.MD5=l._createHelper(d),i.HmacMD5=l._createHmacHelper(d)})(Math),n.MD5})})(Yo)),Yo.exports}var Uo={exports:{}},Xo={exports:{}},Qy=Xo.exports,Dl;function ev(){return Dl||(Dl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(Qy,function(n){return(function(){var o=n,i=o.lib,r=i.WordArray,a=i.Hasher,l=o.algo,u=[],c=l.SHA1=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,f){for(var h=this._hash.words,p=h[0],y=h[1],m=h[2],b=h[3],N=h[4],_=0;_<80;_++){if(_<16)u[_]=d[f+_]|0;else{var g=u[_-3]^u[_-8]^u[_-14]^u[_-16];u[_]=g<<1|g>>>31}var x=(p<<5|p>>>27)+N+u[_];_<20?x+=(y&m|~y&b)+1518500249:_<40?x+=(y^m^b)+1859775393:_<60?x+=(y&m|y&b|m&b)-1894007588:x+=(y^m^b)-899497514,N=b,b=m,m=y<<30|y>>>2,y=p,p=x}h[0]=h[0]+p|0,h[1]=h[1]+y|0,h[2]=h[2]+m|0,h[3]=h[3]+b|0,h[4]=h[4]+N|0},_doFinalize:function(){var d=this._data,f=d.words,h=this._nDataBytes*8,p=d.sigBytes*8;return f[p>>>5]|=128<<24-p%32,f[(p+64>>>9<<4)+14]=Math.floor(h/4294967296),f[(p+64>>>9<<4)+15]=h,d.sigBytes=f.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});o.SHA1=a._createHelper(c),o.HmacSHA1=a._createHmacHelper(c)})(),n.SHA1})})(Xo)),Xo.exports}var qo={exports:{}},tv=qo.exports,Tl;function nv(){return Tl||(Tl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(tv,function(n){(function(){var o=n,i=o.lib,r=i.Base,a=o.enc,l=a.Utf8,u=o.algo;u.HMAC=r.extend({init:function(c,d){c=this._hasher=new c.init,typeof d=="string"&&(d=l.parse(d));var f=c.blockSize,h=f*4;d.sigBytes>h&&(d=c.finalize(d)),d.clamp();for(var p=this._oKey=d.clone(),y=this._iKey=d.clone(),m=p.words,b=y.words,N=0;N<f;N++)m[N]^=1549556828,b[N]^=909522486;p.sigBytes=y.sigBytes=h,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var d=this._hasher,f=d.finalize(c);d.reset();var h=d.finalize(this._oKey.clone().concat(f));return h}})})()})})(qo)),qo.exports}var ov=Uo.exports,Il;function Ml(){return Il||(Il=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),ev(),nv())})(ov,function(n){return(function(){var o=n,i=o.lib,r=i.Base,a=i.WordArray,l=o.algo,u=l.MD5,c=l.EvpKDF=r.extend({cfg:r.extend({keySize:128/32,hasher:u,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,f){for(var h,p=this.cfg,y=p.hasher.create(),m=a.create(),b=m.words,N=p.keySize,_=p.iterations;b.length<N;){h&&y.update(h),h=y.update(d).finalize(f),y.reset();for(var g=1;g<_;g++)h=y.finalize(h),y.reset();m.concat(h)}return m.sigBytes=N*4,m}});o.EvpKDF=function(d,f,h){return c.create(h).compute(d,f)}})(),n.EvpKDF})})(Uo)),Uo.exports}var Ko={exports:{}},iv=Ko.exports,Bl;function $l(){return Bl||(Bl=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),Ml())})(iv,function(n){n.lib.Cipher||(function(o){var i=n,r=i.lib,a=r.Base,l=r.WordArray,u=r.BufferedBlockAlgorithm,c=i.enc;c.Utf8;var d=c.Base64,f=i.algo,h=f.EvpKDF,p=r.Cipher=u.extend({cfg:a.extend(),createEncryptor:function(S,T){return this.create(this._ENC_XFORM_MODE,S,T)},createDecryptor:function(S,T){return this.create(this._DEC_XFORM_MODE,S,T)},init:function(S,T,E){this.cfg=this.cfg.extend(E),this._xformMode=S,this._key=T,this.reset()},reset:function(){u.reset.call(this),this._doReset()},process:function(S){return this._append(S),this._process()},finalize:function(S){S&&this._append(S);var T=this._doFinalize();return T},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function S(T){return typeof T=="string"?G:$}return function(T){return{encrypt:function(E,H,w){return S(H).encrypt(T,E,H,w)},decrypt:function(E,H,w){return S(H).decrypt(T,E,H,w)}}}})()});r.StreamCipher=p.extend({_doFinalize:function(){var S=this._process(!0);return S},blockSize:1});var y=i.mode={},m=r.BlockCipherMode=a.extend({createEncryptor:function(S,T){return this.Encryptor.create(S,T)},createDecryptor:function(S,T){return this.Decryptor.create(S,T)},init:function(S,T){this._cipher=S,this._iv=T}}),b=y.CBC=(function(){var S=m.extend();S.Encryptor=S.extend({processBlock:function(E,H){var w=this._cipher,D=w.blockSize;T.call(this,E,H,D),w.encryptBlock(E,H),this._prevBlock=E.slice(H,H+D)}}),S.Decryptor=S.extend({processBlock:function(E,H){var w=this._cipher,D=w.blockSize,v=E.slice(H,H+D);w.decryptBlock(E,H),T.call(this,E,H,D),this._prevBlock=v}});function T(E,H,w){var D,v=this._iv;v?(D=v,this._iv=o):D=this._prevBlock;for(var C=0;C<w;C++)E[H+C]^=D[C]}return S})(),N=i.pad={},_=N.Pkcs7={pad:function(S,T){for(var E=T*4,H=E-S.sigBytes%E,w=H<<24|H<<16|H<<8|H,D=[],v=0;v<H;v+=4)D.push(w);var C=l.create(D,H);S.concat(C)},unpad:function(S){var T=S.words[S.sigBytes-1>>>2]&255;S.sigBytes-=T}};r.BlockCipher=p.extend({cfg:p.cfg.extend({mode:b,padding:_}),reset:function(){var S;p.reset.call(this);var T=this.cfg,E=T.iv,H=T.mode;this._xformMode==this._ENC_XFORM_MODE?S=H.createEncryptor:(S=H.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==S?this._mode.init(this,E&&E.words):(this._mode=S.call(H,this,E&&E.words),this._mode.__creator=S)},_doProcessBlock:function(S,T){this._mode.processBlock(S,T)},_doFinalize:function(){var S,T=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(T.pad(this._data,this.blockSize),S=this._process(!0)):(S=this._process(!0),T.unpad(S)),S},blockSize:128/32});var g=r.CipherParams=a.extend({init:function(S){this.mixIn(S)},toString:function(S){return(S||this.formatter).stringify(this)}}),x=i.format={},A=x.OpenSSL={stringify:function(S){var T,E=S.ciphertext,H=S.salt;return H?T=l.create([1398893684,1701076831]).concat(H).concat(E):T=E,T.toString(d)},parse:function(S){var T,E=d.parse(S),H=E.words;return H[0]==1398893684&&H[1]==1701076831&&(T=l.create(H.slice(2,4)),H.splice(0,4),E.sigBytes-=16),g.create({ciphertext:E,salt:T})}},$=r.SerializableCipher=a.extend({cfg:a.extend({format:A}),encrypt:function(S,T,E,H){H=this.cfg.extend(H);var w=S.createEncryptor(E,H),D=w.finalize(T),v=w.cfg;return g.create({ciphertext:D,key:E,iv:v.iv,algorithm:S,mode:v.mode,padding:v.padding,blockSize:S.blockSize,formatter:H.format})},decrypt:function(S,T,E,H){H=this.cfg.extend(H),T=this._parse(T,H.format);var w=S.createDecryptor(E,H).finalize(T.ciphertext);return w},_parse:function(S,T){return typeof S=="string"?T.parse(S,this):S}}),F=i.kdf={},U=F.OpenSSL={execute:function(S,T,E,H,w){if(H||(H=l.random(64/8)),w)var D=h.create({keySize:T+E,hasher:w}).compute(S,H);else var D=h.create({keySize:T+E}).compute(S,H);var v=l.create(D.words.slice(T),E*4);return D.sigBytes=T*4,g.create({key:D,iv:v,salt:H})}},G=r.PasswordBasedCipher=$.extend({cfg:$.cfg.extend({kdf:U}),encrypt:function(S,T,E,H){H=this.cfg.extend(H);var w=H.kdf.execute(E,S.keySize,S.ivSize,H.salt,H.hasher);H.iv=w.iv;var D=$.encrypt.call(this,S,T,w.key,H);return D.mixIn(w),D},decrypt:function(S,T,E,H){H=this.cfg.extend(H),T=this._parse(T,H.format);var w=H.kdf.execute(E,S.keySize,S.ivSize,T.salt,H.hasher);H.iv=w.iv;var D=$.decrypt.call(this,S,T,w.key,H);return D}})})()})})(Ko)),Ko.exports}var rv=jo.exports,zl;function sv(){return zl||(zl=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),Sl(),kl(),Ml(),$l())})(rv,function(n){return(function(){var o=n,i=o.lib,r=i.BlockCipher,a=o.algo,l=[],u=[],c=[],d=[],f=[],h=[],p=[],y=[],m=[],b=[];(function(){for(var g=[],x=0;x<256;x++)x<128?g[x]=x<<1:g[x]=x<<1^283;for(var A=0,$=0,x=0;x<256;x++){var F=$^$<<1^$<<2^$<<3^$<<4;F=F>>>8^F&255^99,l[A]=F,u[F]=A;var U=g[A],G=g[U],S=g[G],T=g[F]*257^F*16843008;c[A]=T<<24|T>>>8,d[A]=T<<16|T>>>16,f[A]=T<<8|T>>>24,h[A]=T;var T=S*16843009^G*65537^U*257^A*16843008;p[F]=T<<24|T>>>8,y[F]=T<<16|T>>>16,m[F]=T<<8|T>>>24,b[F]=T,A?(A=U^g[g[g[S^U]]],$^=g[g[$]]):A=$=1}})();var N=[0,1,2,4,8,16,32,64,128,27,54],_=a.AES=r.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var x=this._keyPriorReset=this._key,A=x.words,$=x.sigBytes/4,F=this._nRounds=$+6,U=(F+1)*4,G=this._keySchedule=[],S=0;S<U;S++)S<$?G[S]=A[S]:(g=G[S-1],S%$?$>6&&S%$==4&&(g=l[g>>>24]<<24|l[g>>>16&255]<<16|l[g>>>8&255]<<8|l[g&255]):(g=g<<8|g>>>24,g=l[g>>>24]<<24|l[g>>>16&255]<<16|l[g>>>8&255]<<8|l[g&255],g^=N[S/$|0]<<24),G[S]=G[S-$]^g);for(var T=this._invKeySchedule=[],E=0;E<U;E++){var S=U-E;if(E%4)var g=G[S];else var g=G[S-4];E<4||S<=4?T[E]=g:T[E]=p[l[g>>>24]]^y[l[g>>>16&255]]^m[l[g>>>8&255]]^b[l[g&255]]}}},encryptBlock:function(g,x){this._doCryptBlock(g,x,this._keySchedule,c,d,f,h,l)},decryptBlock:function(g,x){var A=g[x+1];g[x+1]=g[x+3],g[x+3]=A,this._doCryptBlock(g,x,this._invKeySchedule,p,y,m,b,u);var A=g[x+1];g[x+1]=g[x+3],g[x+3]=A},_doCryptBlock:function(g,x,A,$,F,U,G,S){for(var T=this._nRounds,E=g[x]^A[0],H=g[x+1]^A[1],w=g[x+2]^A[2],D=g[x+3]^A[3],v=4,C=1;C<T;C++){var k=$[E>>>24]^F[H>>>16&255]^U[w>>>8&255]^G[D&255]^A[v++],O=$[H>>>24]^F[w>>>16&255]^U[D>>>8&255]^G[E&255]^A[v++],R=$[w>>>24]^F[D>>>16&255]^U[E>>>8&255]^G[H&255]^A[v++],B=$[D>>>24]^F[E>>>16&255]^U[H>>>8&255]^G[w&255]^A[v++];E=k,H=O,w=R,D=B}var k=(S[E>>>24]<<24|S[H>>>16&255]<<16|S[w>>>8&255]<<8|S[D&255])^A[v++],O=(S[H>>>24]<<24|S[w>>>16&255]<<16|S[D>>>8&255]<<8|S[E&255])^A[v++],R=(S[w>>>24]<<24|S[D>>>16&255]<<16|S[E>>>8&255]<<8|S[H&255])^A[v++],B=(S[D>>>24]<<24|S[E>>>16&255]<<16|S[H>>>8&255]<<8|S[w&255])^A[v++];g[x]=k,g[x+1]=O,g[x+2]=R,g[x+3]=B},keySize:256/32});o.AES=r._createHelper(_)})(),n.AES})})(jo)),jo.exports}var av=sv();const lv=_l(av);var Zo={exports:{}},cv=Zo.exports,Al;function dv(){return Al||(Al=1,(function(t,e){(function(n,o){t.exports=o(qe())})(cv,function(n){return n.enc.Utf8})})(Zo)),Zo.exports}var uv=dv();const fv=_l(uv);var Jo={exports:{}},hv=Jo.exports,Pl;function pv(){return Pl||(Pl=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),$l())})(hv,function(n){return n.pad.Pkcs7})})(Jo)),Jo.exports}pv(),Sl(),kl();var Qo={exports:{}},gv=Qo.exports,Ol;function mv(){return Ol||(Ol=1,(function(t,e){(function(n,o){t.exports=o(qe())})(gv,function(n){return(function(o){var i=n,r=i.lib,a=r.WordArray,l=r.Hasher,u=i.algo,c=[],d=[];(function(){function p(N){for(var _=o.sqrt(N),g=2;g<=_;g++)if(!(N%g))return!1;return!0}function y(N){return(N-(N|0))*4294967296|0}for(var m=2,b=0;b<64;)p(m)&&(b<8&&(c[b]=y(o.pow(m,1/2))),d[b]=y(o.pow(m,1/3)),b++),m++})();var f=[],h=u.SHA256=l.extend({_doReset:function(){this._hash=new a.init(c.slice(0))},_doProcessBlock:function(p,y){for(var m=this._hash.words,b=m[0],N=m[1],_=m[2],g=m[3],x=m[4],A=m[5],$=m[6],F=m[7],U=0;U<64;U++){if(U<16)f[U]=p[y+U]|0;else{var G=f[U-15],S=(G<<25|G>>>7)^(G<<14|G>>>18)^G>>>3,T=f[U-2],E=(T<<15|T>>>17)^(T<<13|T>>>19)^T>>>10;f[U]=S+f[U-7]+E+f[U-16]}var H=x&A^~x&$,w=b&N^b&_^N&_,D=(b<<30|b>>>2)^(b<<19|b>>>13)^(b<<10|b>>>22),v=(x<<26|x>>>6)^(x<<21|x>>>11)^(x<<7|x>>>25),C=F+v+H+d[U]+f[U],k=D+w;F=$,$=A,A=x,x=g+C|0,g=_,_=N,N=b,b=C+k|0}m[0]=m[0]+b|0,m[1]=m[1]+N|0,m[2]=m[2]+_|0,m[3]=m[3]+g|0,m[4]=m[4]+x|0,m[5]=m[5]+A|0,m[6]=m[6]+$|0,m[7]=m[7]+F|0},_doFinalize:function(){var p=this._data,y=p.words,m=this._nDataBytes*8,b=p.sigBytes*8;return y[b>>>5]|=128<<24-b%32,y[(b+64>>>9<<4)+14]=o.floor(m/4294967296),y[(b+64>>>9<<4)+15]=m,p.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var p=l.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA256=l._createHelper(h),i.HmacSHA256=l._createHmacHelper(h)})(Math),n.SHA256})})(Qo)),Qo.exports}mv();var ei={exports:{}},ti={exports:{}},yv=ti.exports,Rl;function vv(){return Rl||(Rl=1,(function(t,e){(function(n,o){t.exports=o(qe())})(yv,function(n){return(function(o){var i=n,r=i.lib,a=r.Base,l=r.WordArray,u=i.x64={};u.Word=a.extend({init:function(c,d){this.high=c,this.low=d}}),u.WordArray=a.extend({init:function(c,d){c=this.words=c||[],d!=o?this.sigBytes=d:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,d=c.length,f=[],h=0;h<d;h++){var p=c[h];f.push(p.high),f.push(p.low)}return l.create(f,this.sigBytes)},clone:function(){for(var c=a.clone.call(this),d=c.words=this.words.slice(0),f=d.length,h=0;h<f;h++)d[h]=d[h].clone();return c}})})(),n})})(ti)),ti.exports}var bv=ei.exports,Hl;function wv(){return Hl||(Hl=1,(function(t,e){(function(n,o,i){t.exports=o(qe(),vv())})(bv,function(n){return(function(){var o=n,i=o.lib,r=i.Hasher,a=o.x64,l=a.Word,u=a.WordArray,c=o.algo;function d(){return l.create.apply(l,arguments)}var f=[d(1116352408,3609767458),d(1899447441,602891725),d(3049323471,3964484399),d(3921009573,2173295548),d(961987163,4081628472),d(1508970993,3053834265),d(2453635748,2937671579),d(2870763221,3664609560),d(3624381080,2734883394),d(310598401,1164996542),d(607225278,1323610764),d(1426881987,3590304994),d(1925078388,4068182383),d(2162078206,991336113),d(2614888103,633803317),d(3248222580,3479774868),d(3835390401,2666613458),d(4022224774,944711139),d(264347078,2341262773),d(604807628,2007800933),d(770255983,1495990901),d(1249150122,1856431235),d(1555081692,3175218132),d(1996064986,2198950837),d(2554220882,3999719339),d(2821834349,766784016),d(2952996808,2566594879),d(3210313671,3203337956),d(3336571891,1034457026),d(3584528711,2466948901),d(113926993,3758326383),d(338241895,168717936),d(666307205,1188179964),d(773529912,1546045734),d(1294757372,1522805485),d(1396182291,2643833823),d(1695183700,2343527390),d(1986661051,1014477480),d(2177026350,1206759142),d(2456956037,344077627),d(2730485921,1290863460),d(2820302411,3158454273),d(3259730800,3505952657),d(3345764771,106217008),d(3516065817,3606008344),d(3600352804,1432725776),d(4094571909,1467031594),d(275423344,851169720),d(430227734,3100823752),d(506948616,1363258195),d(659060556,3750685593),d(883997877,3785050280),d(958139571,3318307427),d(1322822218,3812723403),d(1537002063,2003034995),d(1747873779,3602036899),d(1955562222,1575990012),d(2024104815,1125592928),d(2227730452,2716904306),d(2361852424,442776044),d(2428436474,593698344),d(2756734187,3733110249),d(3204031479,2999351573),d(3329325298,3815920427),d(3391569614,3928383900),d(3515267271,566280711),d(3940187606,3454069534),d(4118630271,4000239992),d(116418474,1914138554),d(174292421,2731055270),d(289380356,3203993006),d(460393269,320620315),d(685471733,587496836),d(852142971,1086792851),d(1017036298,365543100),d(1126000580,2618297676),d(1288033470,3409855158),d(1501505948,4234509866),d(1607167915,987167468),d(1816402316,1246189591)],h=[];(function(){for(var y=0;y<80;y++)h[y]=d()})();var p=c.SHA512=r.extend({_doReset:function(){this._hash=new u.init([new l.init(1779033703,4089235720),new l.init(3144134277,2227873595),new l.init(1013904242,4271175723),new l.init(2773480762,1595750129),new l.init(1359893119,2917565137),new l.init(2600822924,725511199),new l.init(528734635,4215389547),new l.init(1541459225,327033209)])},_doProcessBlock:function(y,m){for(var b=this._hash.words,N=b[0],_=b[1],g=b[2],x=b[3],A=b[4],$=b[5],F=b[6],U=b[7],G=N.high,S=N.low,T=_.high,E=_.low,H=g.high,w=g.low,D=x.high,v=x.low,C=A.high,k=A.low,O=$.high,R=$.low,B=F.high,P=F.low,L=U.high,j=U.low,Z=G,Q=S,q=T,ee=E,re=H,ie=w,ce=D,oe=v,ae=C,z=k,M=O,V=R,X=B,I=P,Y=L,W=j,K=0;K<80;K++){var ne,te,fe=h[K];if(K<16)te=fe.high=y[m+K*2]|0,ne=fe.low=y[m+K*2+1]|0;else{var ge=h[K-15],Ie=ge.high,Me=ge.low,Ze=(Ie>>>1|Me<<31)^(Ie>>>8|Me<<24)^Ie>>>7,_e=(Me>>>1|Ie<<31)^(Me>>>8|Ie<<24)^(Me>>>7|Ie<<25),xt=h[K-2],Ct=xt.high,Et=xt.low,Vr=(Ct>>>19|Et<<13)^(Ct<<3|Et>>>29)^Ct>>>6,mc=(Et>>>19|Ct<<13)^(Et<<3|Ct>>>29)^(Et>>>6|Ct<<26),yc=h[K-7],M0=yc.high,B0=yc.low,vc=h[K-16],$0=vc.high,bc=vc.low;ne=_e+B0,te=Ze+M0+(ne>>>0<_e>>>0?1:0),ne=ne+mc,te=te+Vr+(ne>>>0<mc>>>0?1:0),ne=ne+bc,te=te+$0+(ne>>>0<bc>>>0?1:0),fe.high=te,fe.low=ne}var z0=ae&M^~ae&X,wc=z&V^~z&I,A0=Z&q^Z&re^q&re,P0=Q&ee^Q&ie^ee&ie,O0=(Z>>>28|Q<<4)^(Z<<30|Q>>>2)^(Z<<25|Q>>>7),_c=(Q>>>28|Z<<4)^(Q<<30|Z>>>2)^(Q<<25|Z>>>7),R0=(ae>>>14|z<<18)^(ae>>>18|z<<14)^(ae<<23|z>>>9),H0=(z>>>14|ae<<18)^(z>>>18|ae<<14)^(z<<23|ae>>>9),xc=f[K],V0=xc.high,Cc=xc.low,Xe=W+H0,Bt=Y+R0+(Xe>>>0<W>>>0?1:0),Xe=Xe+wc,Bt=Bt+z0+(Xe>>>0<wc>>>0?1:0),Xe=Xe+Cc,Bt=Bt+V0+(Xe>>>0<Cc>>>0?1:0),Xe=Xe+ne,Bt=Bt+te+(Xe>>>0<ne>>>0?1:0),Ec=_c+P0,L0=O0+A0+(Ec>>>0<_c>>>0?1:0);Y=X,W=I,X=M,I=V,M=ae,V=z,z=oe+Xe|0,ae=ce+Bt+(z>>>0<oe>>>0?1:0)|0,ce=re,oe=ie,re=q,ie=ee,q=Z,ee=Q,Q=Xe+Ec|0,Z=Bt+L0+(Q>>>0<Xe>>>0?1:0)|0}S=N.low=S+Q,N.high=G+Z+(S>>>0<Q>>>0?1:0),E=_.low=E+ee,_.high=T+q+(E>>>0<ee>>>0?1:0),w=g.low=w+ie,g.high=H+re+(w>>>0<ie>>>0?1:0),v=x.low=v+oe,x.high=D+ce+(v>>>0<oe>>>0?1:0),k=A.low=k+z,A.high=C+ae+(k>>>0<z>>>0?1:0),R=$.low=R+V,$.high=O+M+(R>>>0<V>>>0?1:0),P=F.low=P+I,F.high=B+X+(P>>>0<I>>>0?1:0),j=U.low=j+W,U.high=L+Y+(j>>>0<W>>>0?1:0)},_doFinalize:function(){var y=this._data,m=y.words,b=this._nDataBytes*8,N=y.sigBytes*8;m[N>>>5]|=128<<24-N%32,m[(N+128>>>10<<5)+30]=Math.floor(b/4294967296),m[(N+128>>>10<<5)+31]=b,y.sigBytes=m.length*4,this._process();var _=this._hash.toX32();return _},clone:function(){var y=r.clone.call(this);return y._hash=this._hash.clone(),y},blockSize:1024/32});o.SHA512=r._createHelper(p),o.HmacSHA512=r._createHmacHelper(p)})(),n.SHA512})})(ei)),ei.exports}wv();const{decrypt:db,encrypt:ub}=lv;fv.parse;function _v(t,e,n){return(e=Sv(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function bt(){return bt=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)({}).hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},bt.apply(null,arguments)}function Vl(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,o)}return n}function ct(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Vl(Object(n),!0).forEach(function(o){_v(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Vl(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function xv(t,e){if(t==null)return{};var n,o,i=Cv(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(o=0;o<r.length;o++)n=r[o],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Cv(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.indexOf(o)!==-1)continue;n[o]=t[o]}return n}function Ev(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Sv(t){var e=Ev(t,"string");return typeof e=="symbol"?e:e+""}function _r(t){"@babel/helpers - typeof";return _r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_r(t)}var Nv="1.15.7";function wt(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var _t=wt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Rn=wt(/Edge/i),Ll=wt(/firefox/i),Hn=wt(/safari/i)&&!wt(/chrome/i)&&!wt(/android/i),xr=wt(/iP(ad|od|hone)/i),Fl=wt(/chrome/i)&&wt(/android/i),jl={capture:!1,passive:!1};function be(t,e,n){t.addEventListener(e,n,!_t&&jl)}function ve(t,e,n){t.removeEventListener(e,n,!_t&&jl)}function ni(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function Gl(t){return t.host&&t!==document&&t.host.nodeType&&t.host!==t?t.host:t.parentNode}function nt(t,e,n,o){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&ni(t,e):ni(t,e))||o&&t===n)return t;if(t===n)break}while(t=Gl(t))}return null}var Wl=/\s+/g;function Ye(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var o=(" "+t.className+" ").replace(Wl," ").replace(" "+e+" "," ");t.className=(o+(n?" "+e:"")).replace(Wl," ")}}function pe(t,e,n){var o=t&&t.style;if(o){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in o)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),o[e]=n+(typeof n=="string"?"":"px")}}function rn(t,e){var n="";if(typeof t=="string")n=t;else do{var o=pe(t,"transform");o&&o!=="none"&&(n=o+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function Yl(t,e,n){if(t){var o=t.getElementsByTagName(e),i=0,r=o.length;if(n)for(;i<r;i++)n(o[i],i);return o}return[]}function dt(){var t=document.scrollingElement;return t||document.documentElement}function De(t,e,n,o,i){if(!(!t.getBoundingClientRect&&t!==window)){var r,a,l,u,c,d,f;if(t!==window&&t.parentNode&&t!==dt()?(r=t.getBoundingClientRect(),a=r.top,l=r.left,u=r.bottom,c=r.right,d=r.height,f=r.width):(a=0,l=0,u=window.innerHeight,c=window.innerWidth,d=window.innerHeight,f=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!_t))do if(i&&i.getBoundingClientRect&&(pe(i,"transform")!=="none"||n&&pe(i,"position")!=="static")){var h=i.getBoundingClientRect();a-=h.top+parseInt(pe(i,"border-top-width")),l-=h.left+parseInt(pe(i,"border-left-width")),u=a+r.height,c=l+r.width;break}while(i=i.parentNode);if(o&&t!==window){var p=rn(i||t),y=p&&p.a,m=p&&p.d;p&&(a/=m,l/=y,f/=y,d/=m,u=a+d,c=l+f)}return{top:a,left:l,bottom:u,right:c,width:f,height:d}}}function Ul(t,e,n){for(var o=Tt(t,!0),i=De(t)[e];o;){var r=De(o)[n],a=void 0;if(a=i>=r,!a)return o;if(o===dt())break;o=Tt(o,!1)}return!1}function sn(t,e,n,o){for(var i=0,r=0,a=t.children;r<a.length;){if(a[r].style.display!=="none"&&a[r]!==me.ghost&&(o||a[r]!==me.dragged)&&nt(a[r],n.draggable,t,!1)){if(i===e)return a[r];i++}r++}return null}function Cr(t,e){for(var n=t.lastElementChild;n&&(n===me.ghost||pe(n,"display")==="none"||e&&!ni(n,e));)n=n.previousElementSibling;return n||null}function Ke(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==me.clone&&(!e||ni(t,e))&&n++;return n}function Xl(t){var e=0,n=0,o=dt();if(t)do{var i=rn(t),r=i.a,a=i.d;e+=t.scrollLeft*r,n+=t.scrollTop*a}while(t!==o&&(t=t.parentNode));return[e,n]}function kv(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var o in e)if(e.hasOwnProperty(o)&&e[o]===t[n][o])return Number(n)}return-1}function Tt(t,e){if(!t||!t.getBoundingClientRect)return dt();var n=t,o=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=pe(n);if(n.clientWidth<n.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return dt();if(o||e)return n;o=!0}}while(n=n.parentNode);return dt()}function Dv(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Er(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var Vn;function ql(t,e){return function(){if(!Vn){var n=arguments,o=this;n.length===1?t.call(o,n[0]):t.apply(o,n),Vn=setTimeout(function(){Vn=void 0},e)}}}function Tv(){clearTimeout(Vn),Vn=void 0}function Kl(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function Zl(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}function Jl(t,e,n){var o={};return Array.from(t.children).forEach(function(i){var r,a,l,u;if(!(!nt(i,e.draggable,t,!1)||i.animated||i===n)){var c=De(i);o.left=Math.min((r=o.left)!==null&&r!==void 0?r:1/0,c.left),o.top=Math.min((a=o.top)!==null&&a!==void 0?a:1/0,c.top),o.right=Math.max((l=o.right)!==null&&l!==void 0?l:-1/0,c.right),o.bottom=Math.max((u=o.bottom)!==null&&u!==void 0?u:-1/0,c.bottom)}}),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var Le="Sortable"+new Date().getTime();function Iv(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var o=[].slice.call(this.el.children);o.forEach(function(i){if(!(pe(i,"display")==="none"||i===me.ghost)){t.push({target:i,rect:De(i)});var r=ct({},t[t.length-1].rect);if(i.thisAnimationDuration){var a=rn(i,!0);a&&(r.top-=a.f,r.left-=a.e)}i.fromRect=r}})}},addAnimationState:function(o){t.push(o)},removeAnimationState:function(o){t.splice(kv(t,{target:o}),1)},animateAll:function(o){var i=this;if(!this.options.animation){clearTimeout(e),typeof o=="function"&&o();return}var r=!1,a=0;t.forEach(function(l){var u=0,c=l.target,d=c.fromRect,f=De(c),h=c.prevFromRect,p=c.prevToRect,y=l.rect,m=rn(c,!0);m&&(f.top-=m.f,f.left-=m.e),c.toRect=f,c.thisAnimationDuration&&Er(h,f)&&!Er(d,f)&&(y.top-f.top)/(y.left-f.left)===(d.top-f.top)/(d.left-f.left)&&(u=Bv(y,h,p,i.options)),Er(f,d)||(c.prevFromRect=d,c.prevToRect=f,u||(u=i.options.animation),i.animate(c,y,f,u)),u&&(r=!0,a=Math.max(a,u),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},u),c.thisAnimationDuration=u)}),clearTimeout(e),r?e=setTimeout(function(){typeof o=="function"&&o()},a):typeof o=="function"&&o(),t=[]},animate:function(o,i,r,a){if(a){pe(o,"transition",""),pe(o,"transform","");var l=rn(this.el),u=l&&l.a,c=l&&l.d,d=(i.left-r.left)/(u||1),f=(i.top-r.top)/(c||1);o.animatingX=!!d,o.animatingY=!!f,pe(o,"transform","translate3d("+d+"px,"+f+"px,0)"),this.forRepaintDummy=Mv(o),pe(o,"transition","transform "+a+"ms"+(this.options.easing?" "+this.options.easing:"")),pe(o,"transform","translate3d(0,0,0)"),typeof o.animated=="number"&&clearTimeout(o.animated),o.animated=setTimeout(function(){pe(o,"transition",""),pe(o,"transform",""),o.animated=!1,o.animatingX=!1,o.animatingY=!1},a)}}}}function Mv(t){return t.offsetWidth}function Bv(t,e,n,o){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*o.animation}var an=[],Sr={initializeByDefault:!0},Ln={mount:function(e){for(var n in Sr)Sr.hasOwnProperty(n)&&!(n in e)&&(e[n]=Sr[n]);an.forEach(function(o){if(o.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),an.push(e)},pluginEvent:function(e,n,o){var i=this;this.eventCanceled=!1,o.cancel=function(){i.eventCanceled=!0};var r=e+"Global";an.forEach(function(a){n[a.pluginName]&&(n[a.pluginName][r]&&n[a.pluginName][r](ct({sortable:n},o)),n.options[a.pluginName]&&n[a.pluginName][e]&&n[a.pluginName][e](ct({sortable:n},o)))})},initializePlugins:function(e,n,o,i){an.forEach(function(l){var u=l.pluginName;if(!(!e.options[u]&&!l.initializeByDefault)){var c=new l(e,n,e.options);c.sortable=e,c.options=e.options,e[u]=c,bt(o,c.defaults)}});for(var r in e.options)if(e.options.hasOwnProperty(r)){var a=this.modifyOption(e,r,e.options[r]);typeof a<"u"&&(e.options[r]=a)}},getEventProperties:function(e,n){var o={};return an.forEach(function(i){typeof i.eventProperties=="function"&&bt(o,i.eventProperties.call(n[i.pluginName],e))}),o},modifyOption:function(e,n,o){var i;return an.forEach(function(r){e[r.pluginName]&&r.optionListeners&&typeof r.optionListeners[n]=="function"&&(i=r.optionListeners[n].call(e[r.pluginName],o))}),i}};function $v(t){var e=t.sortable,n=t.rootEl,o=t.name,i=t.targetEl,r=t.cloneEl,a=t.toEl,l=t.fromEl,u=t.oldIndex,c=t.newIndex,d=t.oldDraggableIndex,f=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,y=t.extraEventProperties;if(e=e||n&&n[Le],!!e){var m,b=e.options,N="on"+o.charAt(0).toUpperCase()+o.substr(1);window.CustomEvent&&!_t&&!Rn?m=new CustomEvent(o,{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent(o,!0,!0)),m.to=a||n,m.from=l||n,m.item=i||n,m.clone=r,m.oldIndex=u,m.newIndex=c,m.oldDraggableIndex=d,m.newDraggableIndex=f,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var _=ct(ct({},y),Ln.getEventProperties(o,e));for(var g in _)m[g]=_[g];n&&n.dispatchEvent(m),b[N]&&b[N].call(e,m)}}var zv=["evt"],Fe=function(e,n){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.evt,r=xv(o,zv);Ln.pluginEvent.bind(me)(e,n,ct({dragEl:se,parentEl:Ee,ghostEl:ye,rootEl:xe,nextEl:Ft,lastDownEl:oi,cloneEl:Ce,cloneHidden:It,dragStarted:jn,putSortable:Ae,activeSortable:me.active,originalEvent:i,oldIndex:ln,oldDraggableIndex:Fn,newIndex:Ue,newDraggableIndex:Mt,hideGhostForTarget:rc,unhideGhostForTarget:sc,cloneNowHidden:function(){It=!0},cloneNowShown:function(){It=!1},dispatchSortableEvent:function(l){Re({sortable:n,name:l,originalEvent:i})}},r))};function Re(t){$v(ct({putSortable:Ae,cloneEl:Ce,targetEl:se,rootEl:xe,oldIndex:ln,oldDraggableIndex:Fn,newIndex:Ue,newDraggableIndex:Mt},t))}var se,Ee,ye,xe,Ft,oi,Ce,It,ln,Ue,Fn,Mt,ii,Ae,cn=!1,ri=!1,si=[],jt,ot,Nr,kr,Ql,ec,jn,dn,Gn,Wn=!1,ai=!1,li,Pe,Dr=[],Tr=!1,ci=[],di=typeof document<"u",ui=xr,tc=Rn||_t?"cssFloat":"float",Av=di&&!Fl&&!xr&&"draggable"in document.createElement("div"),nc=(function(){if(di){if(_t)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}})(),oc=function(e,n){var o=pe(e),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),r=sn(e,0,n),a=sn(e,1,n),l=r&&pe(r),u=a&&pe(a),c=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+De(r).width,d=u&&parseInt(u.marginLeft)+parseInt(u.marginRight)+De(a).width;if(o.display==="flex")return o.flexDirection==="column"||o.flexDirection==="column-reverse"?"vertical":"horizontal";if(o.display==="grid")return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(r&&l.float&&l.float!=="none"){var f=l.float==="left"?"left":"right";return a&&(u.clear==="both"||u.clear===f)?"vertical":"horizontal"}return r&&(l.display==="block"||l.display==="flex"||l.display==="table"||l.display==="grid"||c>=i&&o[tc]==="none"||a&&o[tc]==="none"&&c+d>i)?"vertical":"horizontal"},Pv=function(e,n,o){var i=o?e.left:e.top,r=o?e.right:e.bottom,a=o?e.width:e.height,l=o?n.left:n.top,u=o?n.right:n.bottom,c=o?n.width:n.height;return i===l||r===u||i+a/2===l+c/2},Ov=function(e,n){var o;return si.some(function(i){var r=i[Le].options.emptyInsertThreshold;if(!(!r||Cr(i))){var a=De(i),l=e>=a.left-r&&e<=a.right+r,u=n>=a.top-r&&n<=a.bottom+r;if(l&&u)return o=i}}),o},ic=function(e){function n(r,a){return function(l,u,c,d){var f=l.options.group.name&&u.options.group.name&&l.options.group.name===u.options.group.name;if(r==null&&(a||f))return!0;if(r==null||r===!1)return!1;if(a&&r==="clone")return r;if(typeof r=="function")return n(r(l,u,c,d),a)(l,u,c,d);var h=(a?l:u).options.group.name;return r===!0||typeof r=="string"&&r===h||r.join&&r.indexOf(h)>-1}}var o={},i=e.group;(!i||_r(i)!="object")&&(i={name:i}),o.name=i.name,o.checkPull=n(i.pull,!0),o.checkPut=n(i.put),o.revertClone=i.revertClone,e.group=o},rc=function(){!nc&&ye&&pe(ye,"display","none")},sc=function(){!nc&&ye&&pe(ye,"display","")};di&&!Fl&&document.addEventListener("click",function(t){if(ri)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),ri=!1,!1},!0);var Gt=function(e){if(se){e=e.touches?e.touches[0]:e;var n=Ov(e.clientX,e.clientY);if(n){var o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=n,o.preventDefault=void 0,o.stopPropagation=void 0,n[Le]._onDragOver(o)}}},Rv=function(e){se&&se.parentNode[Le]._isOutsideThisEl(e.target)};function me(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=bt({},e),t[Le]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return oc(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(a,l){a.setData("Text",l.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:me.supportPointer!==!1&&"PointerEvent"in window&&(!Hn||xr),emptyInsertThreshold:5};Ln.initializePlugins(this,t,n);for(var o in n)!(o in e)&&(e[o]=n[o]);ic(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:Av,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?be(t,"pointerdown",this._onTapStart):(be(t,"mousedown",this._onTapStart),be(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(be(t,"dragover",this),be(t,"dragenter",this)),si.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),bt(this,Iv())}me.prototype={constructor:me,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(dn=null)},_getDirection:function(e,n){return typeof this.options.direction=="function"?this.options.direction.call(this,e,n,se):this.options.direction},_onTapStart:function(e){if(e.cancelable){var n=this,o=this.el,i=this.options,r=i.preventOnFilter,a=e.type,l=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,u=(l||e).target,c=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||u,d=i.filter;if(Yv(o),!se&&!(/mousedown|pointerdown/.test(a)&&e.button!==0||i.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Hn&&u&&u.tagName.toUpperCase()==="SELECT")&&(u=nt(u,i.draggable,o,!1),!(u&&u.animated)&&oi!==u)){if(ln=Ke(u),Fn=Ke(u,i.draggable),typeof d=="function"){if(d.call(this,e,u,this)){Re({sortable:n,rootEl:c,name:"filter",targetEl:u,toEl:o,fromEl:o}),Fe("filter",n,{evt:e}),r&&e.preventDefault();return}}else if(d&&(d=d.split(",").some(function(f){if(f=nt(c,f.trim(),o,!1),f)return Re({sortable:n,rootEl:f,name:"filter",targetEl:u,fromEl:o,toEl:o}),Fe("filter",n,{evt:e}),!0}),d)){r&&e.preventDefault();return}i.handle&&!nt(c,i.handle,o,!1)||this._prepareDragStart(e,l,u)}}},_prepareDragStart:function(e,n,o){var i=this,r=i.el,a=i.options,l=r.ownerDocument,u;if(o&&!se&&o.parentNode===r){var c=De(o);if(xe=r,se=o,Ee=se.parentNode,Ft=se.nextSibling,oi=o,ii=a.group,me.dragged=se,jt={target:se,clientX:(n||e).clientX,clientY:(n||e).clientY},Ql=jt.clientX-c.left,ec=jt.clientY-c.top,this._lastX=(n||e).clientX,this._lastY=(n||e).clientY,se.style["will-change"]="all",u=function(){if(Fe("delayEnded",i,{evt:e}),me.eventCanceled){i._onDrop();return}i._disableDelayedDragEvents(),!Ll&&i.nativeDraggable&&(se.draggable=!0),i._triggerDragStart(e,n),Re({sortable:i,name:"choose",originalEvent:e}),Ye(se,a.chosenClass,!0)},a.ignore.split(",").forEach(function(d){Yl(se,d.trim(),Ir)}),be(l,"dragover",Gt),be(l,"mousemove",Gt),be(l,"touchmove",Gt),a.supportPointer?(be(l,"pointerup",i._onDrop),!this.nativeDraggable&&be(l,"pointercancel",i._onDrop)):(be(l,"mouseup",i._onDrop),be(l,"touchend",i._onDrop),be(l,"touchcancel",i._onDrop)),Ll&&this.nativeDraggable&&(this.options.touchStartThreshold=4,se.draggable=!0),Fe("delayStart",this,{evt:e}),a.delay&&(!a.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Rn||_t))){if(me.eventCanceled){this._onDrop();return}a.supportPointer?(be(l,"pointerup",i._disableDelayedDrag),be(l,"pointercancel",i._disableDelayedDrag)):(be(l,"mouseup",i._disableDelayedDrag),be(l,"touchend",i._disableDelayedDrag),be(l,"touchcancel",i._disableDelayedDrag)),be(l,"mousemove",i._delayedDragTouchMoveHandler),be(l,"touchmove",i._delayedDragTouchMoveHandler),a.supportPointer&&be(l,"pointermove",i._delayedDragTouchMoveHandler),i._dragStartTimer=setTimeout(u,a.delay)}else u()}},_delayedDragTouchMoveHandler:function(e){var n=e.touches?e.touches[0]:e;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){se&&Ir(se),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;ve(e,"mouseup",this._disableDelayedDrag),ve(e,"touchend",this._disableDelayedDrag),ve(e,"touchcancel",this._disableDelayedDrag),ve(e,"pointerup",this._disableDelayedDrag),ve(e,"pointercancel",this._disableDelayedDrag),ve(e,"mousemove",this._delayedDragTouchMoveHandler),ve(e,"touchmove",this._delayedDragTouchMoveHandler),ve(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,n){n=n||e.pointerType=="touch"&&e,!this.nativeDraggable||n?this.options.supportPointer?be(document,"pointermove",this._onTouchMove):n?be(document,"touchmove",this._onTouchMove):be(document,"mousemove",this._onTouchMove):(be(se,"dragend",this),be(xe,"dragstart",this._onDragStart));try{document.selection?hi(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,n){if(cn=!1,xe&&se){Fe("dragStarted",this,{evt:n}),this.nativeDraggable&&be(document,"dragover",Rv);var o=this.options;!e&&Ye(se,o.dragClass,!1),Ye(se,o.ghostClass,!0),me.active=this,e&&this._appendGhost(),Re({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(ot){this._lastX=ot.clientX,this._lastY=ot.clientY,rc();for(var e=document.elementFromPoint(ot.clientX,ot.clientY),n=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(ot.clientX,ot.clientY),e!==n);)n=e;if(se.parentNode[Le]._isOutsideThisEl(e),n)do{if(n[Le]){var o=void 0;if(o=n[Le]._onDragOver({clientX:ot.clientX,clientY:ot.clientY,target:e,rootEl:n}),o&&!this.options.dragoverBubble)break}e=n}while(n=Gl(n));sc()}},_onTouchMove:function(e){if(jt){var n=this.options,o=n.fallbackTolerance,i=n.fallbackOffset,r=e.touches?e.touches[0]:e,a=ye&&rn(ye,!0),l=ye&&a&&a.a,u=ye&&a&&a.d,c=ui&&Pe&&Xl(Pe),d=(r.clientX-jt.clientX+i.x)/(l||1)+(c?c[0]-Dr[0]:0)/(l||1),f=(r.clientY-jt.clientY+i.y)/(u||1)+(c?c[1]-Dr[1]:0)/(u||1);if(!me.active&&!cn){if(o&&Math.max(Math.abs(r.clientX-this._lastX),Math.abs(r.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(ye){a?(a.e+=d-(Nr||0),a.f+=f-(kr||0)):a={a:1,b:0,c:0,d:1,e:d,f};var h="matrix(".concat(a.a,",").concat(a.b,",").concat(a.c,",").concat(a.d,",").concat(a.e,",").concat(a.f,")");pe(ye,"webkitTransform",h),pe(ye,"mozTransform",h),pe(ye,"msTransform",h),pe(ye,"transform",h),Nr=d,kr=f,ot=r}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!ye){var e=this.options.fallbackOnBody?document.body:xe,n=De(se,!0,ui,!0,e),o=this.options;if(ui){for(Pe=e;pe(Pe,"position")==="static"&&pe(Pe,"transform")==="none"&&Pe!==document;)Pe=Pe.parentNode;Pe!==document.body&&Pe!==document.documentElement?(Pe===document&&(Pe=dt()),n.top+=Pe.scrollTop,n.left+=Pe.scrollLeft):Pe=dt(),Dr=Xl(Pe)}ye=se.cloneNode(!0),Ye(ye,o.ghostClass,!1),Ye(ye,o.fallbackClass,!0),Ye(ye,o.dragClass,!0),pe(ye,"transition",""),pe(ye,"transform",""),pe(ye,"box-sizing","border-box"),pe(ye,"margin",0),pe(ye,"top",n.top),pe(ye,"left",n.left),pe(ye,"width",n.width),pe(ye,"height",n.height),pe(ye,"opacity","0.8"),pe(ye,"position",ui?"absolute":"fixed"),pe(ye,"zIndex","100000"),pe(ye,"pointerEvents","none"),me.ghost=ye,e.appendChild(ye),pe(ye,"transform-origin",Ql/parseInt(ye.style.width)*100+"% "+ec/parseInt(ye.style.height)*100+"%")}},_onDragStart:function(e,n){var o=this,i=e.dataTransfer,r=o.options;if(Fe("dragStart",this,{evt:e}),me.eventCanceled){this._onDrop();return}Fe("setupClone",this),me.eventCanceled||(Ce=Zl(se),Ce.removeAttribute("id"),Ce.draggable=!1,Ce.style["will-change"]="",this._hideClone(),Ye(Ce,this.options.chosenClass,!1),me.clone=Ce),o.cloneId=hi(function(){Fe("clone",o),!me.eventCanceled&&(o.options.removeCloneOnHide||xe.insertBefore(Ce,se),o._hideClone(),Re({sortable:o,name:"clone"}))}),!n&&Ye(se,r.dragClass,!0),n?(ri=!0,o._loopId=setInterval(o._emulateDragOver,50)):(ve(document,"mouseup",o._onDrop),ve(document,"touchend",o._onDrop),ve(document,"touchcancel",o._onDrop),i&&(i.effectAllowed="move",r.setData&&r.setData.call(o,i,se)),be(document,"drop",o),pe(se,"transform","translateZ(0)")),cn=!0,o._dragStartId=hi(o._dragStarted.bind(o,n,e)),be(document,"selectstart",o),jn=!0,window.getSelection().removeAllRanges(),Hn&&pe(document.body,"user-select","none")},_onDragOver:function(e){var n=this.el,o=e.target,i,r,a,l=this.options,u=l.group,c=me.active,d=ii===u,f=l.sort,h=Ae||c,p,y=this,m=!1;if(Tr)return;function b(k,O){Fe(k,y,ct({evt:e,isOwner:d,axis:p?"vertical":"horizontal",revert:a,dragRect:i,targetRect:r,canSort:f,fromSortable:h,target:o,completed:_,onMove:function(B,P){return fi(xe,n,se,i,B,De(B),e,P)},changed:g},O))}function N(){b("dragOverAnimationCapture"),y.captureAnimationState(),y!==h&&h.captureAnimationState()}function _(k){return b("dragOverCompleted",{insertion:k}),k&&(d?c._hideClone():c._showClone(y),y!==h&&(Ye(se,Ae?Ae.options.ghostClass:c.options.ghostClass,!1),Ye(se,l.ghostClass,!0)),Ae!==y&&y!==me.active?Ae=y:y===me.active&&Ae&&(Ae=null),h===y&&(y._ignoreWhileAnimating=o),y.animateAll(function(){b("dragOverAnimationComplete"),y._ignoreWhileAnimating=null}),y!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(o===se&&!se.animated||o===n&&!o.animated)&&(dn=null),!l.dragoverBubble&&!e.rootEl&&o!==document&&(se.parentNode[Le]._isOutsideThisEl(e.target),!k&&Gt(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),m=!0}function g(){Ue=Ke(se),Mt=Ke(se,l.draggable),Re({sortable:y,name:"change",toEl:n,newIndex:Ue,newDraggableIndex:Mt,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),o=nt(o,l.draggable,n,!0),b("dragOver"),me.eventCanceled)return m;if(se.contains(e.target)||o.animated&&o.animatingX&&o.animatingY||y._ignoreWhileAnimating===o)return _(!1);if(ri=!1,c&&!l.disabled&&(d?f||(a=Ee!==xe):Ae===this||(this.lastPutMode=ii.checkPull(this,c,se,e))&&u.checkPut(this,c,se,e))){if(p=this._getDirection(e,o)==="vertical",i=De(se),b("dragOverValid"),me.eventCanceled)return m;if(a)return Ee=xe,N(),this._hideClone(),b("revert"),me.eventCanceled||(Ft?xe.insertBefore(se,Ft):xe.appendChild(se)),_(!0);var x=Cr(n,l.draggable);if(!x||Fv(e,p,this)&&!x.animated){if(x===se)return _(!1);if(x&&n===e.target&&(o=x),o&&(r=De(o)),fi(xe,n,se,i,o,r,e,!!o)!==!1)return N(),x&&x.nextSibling?n.insertBefore(se,x.nextSibling):n.appendChild(se),Ee=n,g(),_(!0)}else if(x&&Lv(e,p,this)){var A=sn(n,0,l,!0);if(A===se)return _(!1);if(o=A,r=De(o),fi(xe,n,se,i,o,r,e,!1)!==!1)return N(),n.insertBefore(se,A),Ee=n,g(),_(!0)}else if(o.parentNode===n){r=De(o);var $=0,F,U=se.parentNode!==n,G=!Pv(se.animated&&se.toRect||i,o.animated&&o.toRect||r,p),S=p?"top":"left",T=Ul(o,"top","top")||Ul(se,"top","top"),E=T?T.scrollTop:void 0;dn!==o&&(F=r[S],Wn=!1,ai=!G&&l.invertSwap||U),$=jv(e,o,r,p,G?1:l.swapThreshold,l.invertedSwapThreshold==null?l.swapThreshold:l.invertedSwapThreshold,ai,dn===o);var H;if($!==0){var w=Ke(se);do w-=$,H=Ee.children[w];while(H&&(pe(H,"display")==="none"||H===ye))}if($===0||H===o)return _(!1);dn=o,Gn=$;var D=o.nextElementSibling,v=!1;v=$===1;var C=fi(xe,n,se,i,o,r,e,v);if(C!==!1)return(C===1||C===-1)&&(v=C===1),Tr=!0,setTimeout(Vv,30),N(),v&&!D?n.appendChild(se):o.parentNode.insertBefore(se,v?D:o),T&&Kl(T,0,E-T.scrollTop),Ee=se.parentNode,F!==void 0&&!ai&&(li=Math.abs(F-De(o)[S])),g(),_(!0)}if(n.contains(se))return _(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){ve(document,"mousemove",this._onTouchMove),ve(document,"touchmove",this._onTouchMove),ve(document,"pointermove",this._onTouchMove),ve(document,"dragover",Gt),ve(document,"mousemove",Gt),ve(document,"touchmove",Gt)},_offUpEvents:function(){var e=this.el.ownerDocument;ve(e,"mouseup",this._onDrop),ve(e,"touchend",this._onDrop),ve(e,"pointerup",this._onDrop),ve(e,"pointercancel",this._onDrop),ve(e,"touchcancel",this._onDrop),ve(document,"selectstart",this)},_onDrop:function(e){var n=this.el,o=this.options;if(Ue=Ke(se),Mt=Ke(se,o.draggable),Fe("drop",this,{evt:e}),Ee=se&&se.parentNode,Ue=Ke(se),Mt=Ke(se,o.draggable),me.eventCanceled){this._nulling();return}cn=!1,ai=!1,Wn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Mr(this.cloneId),Mr(this._dragStartId),this.nativeDraggable&&(ve(document,"drop",this),ve(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Hn&&pe(document.body,"user-select",""),pe(se,"transform",""),e&&(jn&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),ye&&ye.parentNode&&ye.parentNode.removeChild(ye),(xe===Ee||Ae&&Ae.lastPutMode!=="clone")&&Ce&&Ce.parentNode&&Ce.parentNode.removeChild(Ce),se&&(this.nativeDraggable&&ve(se,"dragend",this),Ir(se),se.style["will-change"]="",jn&&!cn&&Ye(se,Ae?Ae.options.ghostClass:this.options.ghostClass,!1),Ye(se,this.options.chosenClass,!1),Re({sortable:this,name:"unchoose",toEl:Ee,newIndex:null,newDraggableIndex:null,originalEvent:e}),xe!==Ee?(Ue>=0&&(Re({rootEl:Ee,name:"add",toEl:Ee,fromEl:xe,originalEvent:e}),Re({sortable:this,name:"remove",toEl:Ee,originalEvent:e}),Re({rootEl:Ee,name:"sort",toEl:Ee,fromEl:xe,originalEvent:e}),Re({sortable:this,name:"sort",toEl:Ee,originalEvent:e})),Ae&&Ae.save()):Ue!==ln&&Ue>=0&&(Re({sortable:this,name:"update",toEl:Ee,originalEvent:e}),Re({sortable:this,name:"sort",toEl:Ee,originalEvent:e})),me.active&&((Ue==null||Ue===-1)&&(Ue=ln,Mt=Fn),Re({sortable:this,name:"end",toEl:Ee,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){Fe("nulling",this),xe=se=Ee=ye=Ft=Ce=oi=It=jt=ot=jn=Ue=Mt=ln=Fn=dn=Gn=Ae=ii=me.dragged=me.ghost=me.clone=me.active=null;var e=this.el;ci.forEach(function(n){e.contains(n)&&(n.checked=!0)}),ci.length=Nr=kr=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":se&&(this._onDragOver(e),Hv(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],n,o=this.el.children,i=0,r=o.length,a=this.options;i<r;i++)n=o[i],nt(n,a.draggable,this.el,!1)&&e.push(n.getAttribute(a.dataIdAttr)||Wv(n));return e},sort:function(e,n){var o={},i=this.el;this.toArray().forEach(function(r,a){var l=i.children[a];nt(l,this.options.draggable,i,!1)&&(o[r]=l)},this),n&&this.captureAnimationState(),e.forEach(function(r){o[r]&&(i.removeChild(o[r]),i.appendChild(o[r]))}),n&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,n){return nt(e,n||this.options.draggable,this.el,!1)},option:function(e,n){var o=this.options;if(n===void 0)return o[e];var i=Ln.modifyOption(this,e,n);typeof i<"u"?o[e]=i:o[e]=n,e==="group"&&ic(o)},destroy:function(){Fe("destroy",this);var e=this.el;e[Le]=null,ve(e,"mousedown",this._onTapStart),ve(e,"touchstart",this._onTapStart),ve(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(ve(e,"dragover",this),ve(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),si.splice(si.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!It){if(Fe("hideClone",this),me.eventCanceled)return;pe(Ce,"display","none"),this.options.removeCloneOnHide&&Ce.parentNode&&Ce.parentNode.removeChild(Ce),It=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(It){if(Fe("showClone",this),me.eventCanceled)return;se.parentNode==xe&&!this.options.group.revertClone?xe.insertBefore(Ce,se):Ft?xe.insertBefore(Ce,Ft):xe.appendChild(Ce),this.options.group.revertClone&&this.animate(se,Ce),pe(Ce,"display",""),It=!1}}};function Hv(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function fi(t,e,n,o,i,r,a,l){var u,c=t[Le],d=c.options.onMove,f;return window.CustomEvent&&!_t&&!Rn?u=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(u=document.createEvent("Event"),u.initEvent("move",!0,!0)),u.to=e,u.from=t,u.dragged=n,u.draggedRect=o,u.related=i||e,u.relatedRect=r||De(e),u.willInsertAfter=l,u.originalEvent=a,t.dispatchEvent(u),d&&(f=d.call(c,u,a)),f}function Ir(t){t.draggable=!1}function Vv(){Tr=!1}function Lv(t,e,n){var o=De(sn(n.el,0,n.options,!0)),i=Jl(n.el,n.options,ye),r=10;return e?t.clientX<i.left-r||t.clientY<o.top&&t.clientX<o.right:t.clientY<i.top-r||t.clientY<o.bottom&&t.clientX<o.left}function Fv(t,e,n){var o=De(Cr(n.el,n.options.draggable)),i=Jl(n.el,n.options,ye),r=10;return e?t.clientX>i.right+r||t.clientY>o.bottom&&t.clientX>o.left:t.clientY>i.bottom+r||t.clientX>o.right&&t.clientY>o.top}function jv(t,e,n,o,i,r,a,l){var u=o?t.clientY:t.clientX,c=o?n.height:n.width,d=o?n.top:n.left,f=o?n.bottom:n.right,h=!1;if(!a){if(l&&li<c*i){if(!Wn&&(Gn===1?u>d+c*r/2:u<f-c*r/2)&&(Wn=!0),Wn)h=!0;else if(Gn===1?u<d+li:u>f-li)return-Gn}else if(u>d+c*(1-i)/2&&u<f-c*(1-i)/2)return Gv(e)}return h=h||a,h&&(u<d+c*r/2||u>f-c*r/2)?u>d+c/2?1:-1:0}function Gv(t){return Ke(se)<Ke(t)?1:-1}function Wv(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,o=0;n--;)o+=e.charCodeAt(n);return o.toString(36)}function Yv(t){ci.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var o=e[n];o.checked&&ci.push(o)}}function hi(t){return setTimeout(t,0)}function Mr(t){return clearTimeout(t)}di&&be(document,"touchmove",function(t){(me.active||cn)&&t.cancelable&&t.preventDefault()}),me.utils={on:be,off:ve,css:pe,find:Yl,is:function(e,n){return!!nt(e,n,e,!1)},extend:Dv,throttle:ql,closest:nt,toggleClass:Ye,clone:Zl,index:Ke,nextTick:hi,cancelNextTick:Mr,detectDirection:oc,getChild:sn,expando:Le},me.get=function(t){return t[Le]},me.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(o){if(!o.prototype||!o.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(o));o.utils&&(me.utils=ct(ct({},me.utils),o.utils)),Ln.mount(o)})},me.create=function(t,e){return new me(t,e)},me.version=Nv;var Te=[],Yn,Br,$r=!1,zr,Ar,pi,Un;function Uv(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(n){var o=n.originalEvent;this.sortable.nativeDraggable?be(document,"dragover",this._handleAutoScroll):this.options.supportPointer?be(document,"pointermove",this._handleFallbackAutoScroll):o.touches?be(document,"touchmove",this._handleFallbackAutoScroll):be(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var o=n.originalEvent;!this.options.dragOverBubble&&!o.rootEl&&this._handleAutoScroll(o)},drop:function(){this.sortable.nativeDraggable?ve(document,"dragover",this._handleAutoScroll):(ve(document,"pointermove",this._handleFallbackAutoScroll),ve(document,"touchmove",this._handleFallbackAutoScroll),ve(document,"mousemove",this._handleFallbackAutoScroll)),ac(),gi(),Tv()},nulling:function(){pi=Br=Yn=$r=Un=zr=Ar=null,Te.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,o){var i=this,r=(n.touches?n.touches[0]:n).clientX,a=(n.touches?n.touches[0]:n).clientY,l=document.elementFromPoint(r,a);if(pi=n,o||this.options.forceAutoScrollFallback||Rn||_t||Hn){Pr(n,this.options,l,o);var u=Tt(l,!0);$r&&(!Un||r!==zr||a!==Ar)&&(Un&&ac(),Un=setInterval(function(){var c=Tt(document.elementFromPoint(r,a),!0);c!==u&&(u=c,gi()),Pr(n,i.options,c,o)},10),zr=r,Ar=a)}else{if(!this.options.bubbleScroll||Tt(l,!0)===dt()){gi();return}Pr(n,this.options,Tt(l,!1),!1)}}},bt(t,{pluginName:"scroll",initializeByDefault:!0})}function gi(){Te.forEach(function(t){clearInterval(t.pid)}),Te=[]}function ac(){clearInterval(Un)}var Pr=ql(function(t,e,n,o){if(e.scroll){var i=(t.touches?t.touches[0]:t).clientX,r=(t.touches?t.touches[0]:t).clientY,a=e.scrollSensitivity,l=e.scrollSpeed,u=dt(),c=!1,d;Br!==n&&(Br=n,gi(),Yn=e.scroll,d=e.scrollFn,Yn===!0&&(Yn=Tt(n,!0)));var f=0,h=Yn;do{var p=h,y=De(p),m=y.top,b=y.bottom,N=y.left,_=y.right,g=y.width,x=y.height,A=void 0,$=void 0,F=p.scrollWidth,U=p.scrollHeight,G=pe(p),S=p.scrollLeft,T=p.scrollTop;p===u?(A=g<F&&(G.overflowX==="auto"||G.overflowX==="scroll"||G.overflowX==="visible"),$=x<U&&(G.overflowY==="auto"||G.overflowY==="scroll"||G.overflowY==="visible")):(A=g<F&&(G.overflowX==="auto"||G.overflowX==="scroll"),$=x<U&&(G.overflowY==="auto"||G.overflowY==="scroll"));var E=A&&(Math.abs(_-i)<=a&&S+g<F)-(Math.abs(N-i)<=a&&!!S),H=$&&(Math.abs(b-r)<=a&&T+x<U)-(Math.abs(m-r)<=a&&!!T);if(!Te[f])for(var w=0;w<=f;w++)Te[w]||(Te[w]={});(Te[f].vx!=E||Te[f].vy!=H||Te[f].el!==p)&&(Te[f].el=p,Te[f].vx=E,Te[f].vy=H,clearInterval(Te[f].pid),(E!=0||H!=0)&&(c=!0,Te[f].pid=setInterval((function(){o&&this.layer===0&&me.active._onTouchMove(pi);var D=Te[this.layer].vy?Te[this.layer].vy*l:0,v=Te[this.layer].vx?Te[this.layer].vx*l:0;typeof d=="function"&&d.call(me.dragged.parentNode[Le],v,D,t,pi,Te[this.layer].el)!=="continue"||Kl(Te[this.layer].el,v,D)}).bind({layer:f}),24))),f++}while(e.bubbleScroll&&h!==u&&(h=Tt(h,!1)));$r=c}},30),lc=function(e){var n=e.originalEvent,o=e.putSortable,i=e.dragEl,r=e.activeSortable,a=e.dispatchSortableEvent,l=e.hideGhostForTarget,u=e.unhideGhostForTarget;if(n){var c=o||r;l();var d=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,f=document.elementFromPoint(d.clientX,d.clientY);u(),c&&!c.el.contains(f)&&(a("spill"),this.onSpill({dragEl:i,putSortable:o}))}};function Or(){}Or.prototype={startIndex:null,dragStart:function(e){var n=e.oldDraggableIndex;this.startIndex=n},onSpill:function(e){var n=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var i=sn(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(n,i):this.sortable.el.appendChild(n),this.sortable.animateAll(),o&&o.animateAll()},drop:lc},bt(Or,{pluginName:"revertOnSpill"});function Rr(){}Rr.prototype={onSpill:function(e){var n=e.dragEl,o=e.putSortable,i=o||this.sortable;i.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),i.animateAll()},drop:lc},bt(Rr,{pluginName:"removeOnSpill"}),me.mount(new Uv),me.mount(Rr,Or);const cc=(t,e,n,o,i,r,a,l)=>{const u=s.ref(),c=s.reactive({}),d=s.computed(()=>{const v=[];return Object.keys(c).forEach(C=>{const k=c[C];k.dragType==="component"&&k.type!=="pkey"&&v.push(k)}),v}),f=(v=[],C)=>{const k=e?.value?.init;typeof k=="function"&&k(v,C)},h=v=>i?i(v,{componentDic:c,components:d.value,configData:u.value.config}):{},p=(v,C)=>{if(u.value?.id===v)return;const k=c[v]||C;if(k?u.value=k:v===n.id?u.value=n:u.value=null,u.value){const O=r[u.value.type];O?(f(O,u.value.config),h(u.value.type)):f([])}else f([]);C&&Se("dragClick",{id:C.id})},y=()=>t.value.$el.getBoundingClientRect(),m=v=>v===n.id?n:c[v]||{},b=v=>{const C=[];if(v===n.id)C.push({id:v,name:n.name});else{const k=c[v];if(k){C.push({id:v,name:k.name});const O=b(k.containerId);C.push(...O)}}return C},N=(v,C)=>{const k=c[C];if(k===void 0)return!1;const O=k.containerId;return v===O?!0:O===n.id?!1:N(v,O)},_=v=>o?o(v)||{}:{},g=(v,C,k,O)=>{if(l){const R=m(v);return l(k.componentType,{container:R,groupId:C,configData:k},O)}return!1},x=({name:v,type:C,dragType:k,isInput:O,componentName:R,runtimeType:B},P,L,j,Z=!1)=>{const Q=_(C);if(Q.id=Wt(),Q.span=24,Q.componentType=C,A(P,Q.componentType))return;g(P,j,Q,!0);const q={id:Q.id,name:v,type:C,runtimeType:B,componentName:R||"",dragType:k||"component",containerId:P,isInput:!!O,level:c[P]?c[P].level+1:1,config:Q,isNewAdd:!Z,groupId:j};return q.dragType==="container"&&(q.children=[]),c[q.id]=q,m(P).children?.splice(L,0,q),q},A=(v,C)=>!!(m(v).config.componentType==="gridtable"&&["divider","label","text","textEditor","viewTable","card","collapse","tabs","qrcode","barcode","tableLayout"].includes(C)),$=(v,C,k=!1)=>{let O=null;const R=m(v).children,B=R?.findIndex(P=>P.id===C)||0;if(k&&R&&R.length>1){let P=B+1;B>0&&(P=B-1),O=R[P]}return R?.splice(B,1),O?.id},F=(v,C,k,O)=>{const R=m(C).children,B=v.containerId!==C;v.containerId=C,v.groupId=O,R?.splice(k,0,v),g(C,O,v.config,B)&&(H(),p(v.id))},U=v=>{let C="";const k=m(v);return k&&(k.children&&k.children.length>0&&k.children.forEach(O=>{U(O.id)}),C=$(k.containerId,v,!0)||"",delete c[v]),u.value&&u.value.id===v&&(u.value=null,e.value.init([])),C},G=(v,C=[])=>{const k=m(v);if(k&&k.children&&k.children.length>0){const O=[];k.children.forEach(R=>{R.groupId&&C.includes(R.groupId)&&O.push(R.id)}),O.forEach(R=>{U(R),delete c[R]})}},S=(v,C)=>{const k=m(v);k&&(k.children&&k.children.length>0&&k.children.forEach(O=>{O.groupId===C&&U(O.id)}),delete c[v])},T=v=>{const C=mi(m(v));C.id=Wt(),C.config.id=C.id,c[C.id]=C;const k=m(C.containerId).children,O=k?.findIndex(R=>R.id===v)||0;k?.splice(O+1,0,C)},E=()=>{n.children=[],Sc(c),u.value&&(Se("dragClick",{id:""}),u.value=null,e.value.init([]))},H=()=>{u.value&&(Se("dragClick",{id:""}),u.value=null,e.value.init([]))},w=v=>{const C=u.value,k=m(C.containerId).children,O=k?.findIndex(R=>R.id===C.id)||0;U(C.id),s.nextTick(()=>{const R=a[v],B=_(v);B.id=C.id,B.span=C.config.span,B.componentType=v,B.table=C.config.table,B.field=C.config.field,C.config.isSubTable&&(B.isSubTable=C.config.isSubTable);const P={id:B.id,name:R.name,type:v,runtimeType:R.runtimeType,componentName:R.componentName||"",dragType:C.dragType,groupId:C.groupId,containerId:C.containerId,isInput:C.isInput,level:C.level,config:B,isNewAdd:!0};c[P.id]=P,k?.splice(O,0,P)})},D=v=>{Se("dragAddByClick",v)};return s.provide("d-drag-design-provide",{activedComponent:u,getDesignLocals:y,getComponent:m,getParentComponents:b,isMyChildComponent:N,selectComponent:p,addComponent:x,deleteComponent:U,copyComponent:T,removeComponentFromContainer:$,addComponentToContainer:F,top:n,deleteChildren:S,deleteChildrens:G}),{activedComponent:u,clearComponents:E,changeComponent:w,schemaComponentDic:c,clearSelect:H,addComponent:x,addComponentByTable:D,designComponentList:d}},Xv=s.defineComponent({__name:"importComponent",props:{componentList:{type:Array,default:()=>[]},tableList:{type:Array,default:()=>[]}},setup(t,{expose:e}){const n=t,o=s.computed(()=>n.tableList.map(c=>({label:c.comment?`${c.name}(${c.comment})`:c.name,value:c.name}))),i=s.ref(),r=[{id:"layout",type:"j-layout",config:{top:48,topMove:!1,autoSize:["default"]},children:[{id:"table",type:"j-select",slot:"top",config:{label:"表名选择",loadOptions:()=>o,allowClear:!1}},{id:"fields",type:"j-table",config:{editConfig:{isAddBtn:!1,isRemoveBtn:!1},height:"100%",isMultiple:!0},children:[{id:"name",type:"span",config:{label:"字段名"}},{id:"type",type:"j-select",config:{label:"组件选择",options:n.componentList,width:200}}]}]}],a=(c,d)=>{if(c.id==="table"){const f=n.tableList.find(h=>h.name===d.value);if(f){const h=f.columns.map(p=>({value:p.name,name:p.coment?`${p.name}(${p.coment})`:p.name,type:"input",label:p.coment||p.name,selected:!p.isPrimary}));i.value.setFormData({fields:h})}}};return s.onMounted(()=>{i.value.init(r)}),e({ok:()=>{const c=i.value.getFormData(!1);return{addList:c.fields.filter(f=>f.selected),table:c.table,containerId:c.containerId,isSubTable:c.isSubTable}},closed:()=>{}}),(c,d)=>{const f=s.resolveComponent("j-form");return s.openBlock(),s.createBlock(f,{ref_key:"formRef",ref:i,"form-config":{labelWidth:"72px"},onChange:a},null,512)}}}),qv={APP_PROVIDE:"jcode_app_provide"};function Kv(t,e){return s.inject(t,e)}function Hr(){return Kv(qv.APP_PROVIDE,{t:(t,...e)=>{if(!t)return"";if(typeof t!="string")return t;let n=t||"";return e.length>0&&e.forEach((o,i)=>{n=n.replace(new RegExp(`\\{${i}\\}`,"g"),o)}),n.replace(/\$.\[^\$\$]*\$/,"")},useFile:()=>({}),useData:()=>({getLabel:({value:t,config:e})=>{if(t==null||t==="")return"";if(e?.dataType==="options"){let n=[t];typeof t=="string"&&t.split&&(n=t.split(","));const i=(e.options||[]).filter(r=>n.includes(r[e.valueKey||"value"])).map(r=>r[e.labelKey||"label"]);return String(i)||t}return t},getObjectList:({value:t,config:e})=>{if(t==null||t==="")return[];if(e?.dataType==="options"){let n=[t];return typeof t=="string"&&t.split&&(n=t.split(",")),(e.options||[]).filter(r=>n.includes(r[e.valueKey||"value"]))||[]}return[]}})})}const Zv=s.defineComponent({props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(t){const{t:e}=Hr(),n=s.computed(()=>t.componentData.config?.notShowLabel?"0px":t.componentData.config?.labelWidth===void 0&&t.globalConfig.labelWidth!==void 0?`${t.globalConfig.labelWidth}px`:t.componentData.config?.labelWidth?`${t.componentData.config?.labelWidth}px`:void 0),o=s.computed(()=>{const i={...t.componentData?.config};return t.globalConfig.size===void 0&&(i.size=t.globalConfig.size),i.display=!0,i});return{labelWidth:n,inputConfig:o,t:e}}}),Jv=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n};function Qv(t,e,n,o,i,r){const a=s.resolveComponent("j-comp"),l=s.resolveComponent("el-form-item");return t.componentData.isInput?(s.openBlock(),s.createBlock(l,{key:0,"label-width":t.labelWidth,label:t.t(t.componentData.config?.notShowLabel?"":t.componentData.config?.label||""),rules:t.componentData.config?.required?[{required:!0,message:""}]:[]},{default:s.withCtx(()=>[s.createVNode(a,{type:t.componentData?.componentName||t.componentData?.type,config:t.inputConfig,modelValue:t.componentData?.config.defaultValue},null,8,["type","config","modelValue"])]),_:1},8,["label-width","label","rules"])):t.componentData?.children?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(t.componentData?.componentName),s.mergeProps({key:1},t.componentData?.config,{"global-config":t.globalConfig,"component-data":t.componentData}),null,16,["global-config","component-data"])):(s.openBlock(),s.createBlock(s.resolveDynamicComponent(t.componentData?.componentName),s.normalizeProps(s.mergeProps({key:2},t.componentData?.config)),null,16))}const dc=Jv(Zv,[["render",Qv]]),e0={class:"d-form-design j-block"},t0={class:"d-form-design-left"},n0={class:"d-form-design-component-list"},o0={class:"j-component-tool"},i0={class:"j-component-tool-name"},r0={class:"d-form-design-center"},s0={class:"d-form-design-toolbar"},a0={class:"d-form-design-container"},l0={key:0,class:"d-form-design-empty"},c0={class:"d-form-design-right"},d0={class:"d-form-design-panel-title"},u0={style:{margin:"0","font-size":"14px"}},f0={class:"d-form-design-panel"},uc=$t(s.defineComponent({name:"DFormDesign",__name:"formDesign",props:{notBindTable:{type:Boolean,default:!1},components:{default:()=>[]},componentConfigs:{default:()=>({})},componentInit:{type:Function,default:void 0},containerAddComponent:{type:Function,default:void 0},componentConfigInit:{type:Function,default:void 0},componentConfigChange:{type:Function,default:void 0},componentConfigValidate:{type:Function,default:void 0},flowComponents:{default:()=>[]},flowInit:{type:Function,default:void 0},flowComponentConfigInit:{type:Function,default:void 0},flowComponentConfigChange:{type:Function,default:void 0},flowComponentConfigs:{default:()=>({})},actions:{}},setup(t,{expose:e}){const n=t,{t:o,warning:i,error:r}=Hr(),a=s.reactive({name:"表单",id:"form",type:"form",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}}),l=s.ref([]),u=n.components.length;for(let I=0;I<u;I++)l.value.push(I);n.componentInit&&(a.config=n.componentInit("form")||{});const c=s.ref([]),d=s.computed(()=>c.value.map(I=>({label:I.comment?`${I.name}(${I.comment})`:I.name,value:I.name}))),f=s.computed(()=>{if($.value){const I=A.value.getFormData(!1);if(I.table){const Y=c.value.find(W=>W.name===I.table);if(Y)return Y.columns.map(W=>({value:W.name,label:W.coment?`${W.name}(${W.coment})`:W.name,coment:W.coment}))}}return[]}),h=I=>{c.value=I},p={},y=[];n.components.forEach(({children:I})=>{I.forEach(Y=>{p[Y.type]=Y,Y.dragType=Y.dragType||"component",Y.isInput!==!1&&(Y.isInput=!0,y.push({label:Y.name,value:Y.type}))})});const m=I=>{I.forEach(Y=>{Y.type==="d-input-flow"&&(Y.config=Y.config||{},Y.config.flowComponents=n.flowComponents,Y.config.flowInit=n.flowInit,Y.config.flowComponentConfigInit=W=>{n.flowComponentConfigInit&&(W.designComponents=T.value,W.component=$.value,n.flowComponentConfigInit(W))},Y.config.flowComponentConfigs=n.flowComponentConfigs,Y.config.flowComponentConfigChange=n.flowComponentConfigChange),Y.children&&m(Y.children)})},b={};Object.keys(n.componentConfigs||{}).forEach(I=>{const{hasBase:Y,isInput:W,hasTwoPlaceholder:K,hasPlaceholder:ne,hasSpan:te,hasLabel:fe,bindTable:ge,labelTitle:Ie}=p[I]||{hasBase:!1},Me=[{id:"id",type:"j-input",config:{label:"ID",readonly:!0}},{id:"componentType",type:"j-select",config:{label:"类型",allowClear:!1,display:W,options:y}},{id:"label",type:"j-input",config:{label:Ie||"标题"},getCompConfig:({formData:_e})=>({display:fe!==!1&&!_e.notShowLabel})},{id:"notShowLabel",type:"j-switch",config:{label:"不显示"+(Ie||"标题"),activeValue:!0,inactiveValue:!1},getCompConfig:({formData:_e})=>({display:fe!==!1&&!_e.isSubTable})},{id:"labelWidth",type:"j-number",config:{label:"标题宽度"},getCompConfig:({formData:_e})=>({display:W&&!_e.notShowLabel&&!_e.isSubTable})},{id:"placeholder",type:"j-input",config:{display:W&&!K&&ne!==!1,label:"占位提示"}},{id:"startPlaceholder",type:"j-input",config:{display:!!K,label:"开始占位"}},{id:"endPlaceholder",type:"j-input",config:{display:!!K,label:"结束占位"}},{id:"span",type:"j-slider",config:{label:"表单栅栏",min:6,max:24,showTooltip:!0,step:6,showStops:!0,defautValue:24},getCompConfig:({formData:_e})=>({display:te!==!1&&!_e.isSubTable})},{id:"width",type:"j-number",config:{label:"单元格宽度",min:1},getCompConfig:({formData:_e})=>({display:!!_e.isSubTable})},{id:"isNotSave",type:"j-switch",config:{label:"不存表",display:W&&ge!==!1,activeValue:!0,inactiveValue:!1}},{id:"table",type:"j-select",config:{label:"数据表",loadOptions:()=>d},getCompConfig:({formData:_e})=>({display:(W&&ge!==!1||ge===!0)&&(!_e.isSubTable||ge===!0)&&!_e.isNotSave&&!n.notBindTable})},{id:"field",type:"j-select",config:{label:"表字段",loadOptions:()=>f},getCompConfig:({formData:_e})=>({display:W&&ge!==!1&&!_e.isNotSave&&!n.notBindTable})},{id:"csType",type:"j-select",config:{label:"字段类型",allowClear:!1,options:[{label:"短文本",value:"string"},{label:"长文本",value:"text"},{label:"整数",value:"int"},{label:"小数",value:"decimal"},{label:"时间日期",value:"DateTime"}]},getCompConfig:({formData:_e})=>({display:W&&ge!==!1&&!_e.isNotSave&&n.notBindTable})},{id:"fieldLen",type:"j-number",config:{label:"字段长度"},getCompConfig:({formData:_e})=>({display:W&&ge!==!1&&!_e.isNotSave&&n.notBindTable&&_e.csType==="string"})}],Ze={type:"j-collapse",config:{defaultValue:[]},children:[]};Y!==!1&&(Ze.children?.push({config:{label:"基础信息"},children:[...Me]}),Ze.config?.defaultValue.push("_collapse0")),Ze.children?.push(...n.componentConfigs[I]),m(Ze.children||[]),b[I]=[Ze]});const N=(I,Y)=>{const{value:W}=Y||{};I.id==="componentType"&&U(W),$.value&&n.componentConfigChange&&(I.id==="field"&&Y.data?.coment&&($.value.config.label=Y.data?.coment),n.componentConfigChange($.value.type,{configRef:A,component:I,configData:$.value.config,...Y})),I.id==="table"&&$.value&&$.value.type==="gridtable"&&($.value.children||[]).forEach(K=>{K.isInput&&(K.config.table=W)})},_=(I,Y)=>{p[I]?.isInput&&(n.notBindTable&&(Y.configData.csType||A.value.setFormData({main:{csType:p[I]?.csType,fieldLen:p[I]?.fieldLen}})),d.value.length===1&&A.value.setFormData({main:{table:d.value[0].value}})),n.componentConfigInit&&n.componentConfigInit(I,{configRef:A,...Y,notBindTable:n.notBindTable})},g=(I,Y,W)=>{let K=!1;const ne=p[I];return Y.container.type==="gridtable"?(!Y.configData.isSubTable||W)&&(Y.configData.isSubTable=!0,ne.isInput&&(Y.configData.table=Y.container.config.table,Y.configData.field=""),K=!0):Y.configData.isSubTable&&(K=!0,Y.configData.isSubTable=!1,ne.isInput&&(Y.configData.table="")),n.containerAddComponent&&n.containerAddComponent(I,Y),K},x=s.ref(),A=s.ref(),{activedComponent:$,clearComponents:F,changeComponent:U,schemaComponentDic:G,addComponentByTable:S,designComponentList:T}=cc(x,A,a,n.componentInit,_,b,p,g),E=s.computed(()=>$.value?`【${$.value.name}】`:"");s.provide("dui-design-provide",{designItemName:dc});const H=()=>{F()},w=()=>{n.componentInit&&(a.config=n.componentInit("form")||{}),F()},D=()=>{let I=0;const Y=vr(a.config,a.children||[]);if(n.notBindTable){const W={};Y.components.forEach(te=>{const{isInput:fe,bindTable:ge}=p[te.type]||{};fe&&ge!==!1?te.config.table&&!W.main&&(W.main={name:te.config.table,comment:"主表",type:"main",pKey:"J_Id"}):ge&&(W[te.id]={name:te.config.table||"t"+new Date().getTime()+I,comment:`子表${te.config.label}`,type:"chlid",field:"J_PId",relationField:"J_Id",pKey:"J_Id"},te.config.table=W[te.id].name,I++)}),W.main||(W.main={name:"t"+new Date().getTime()+I,comment:"主表",type:"main",pKey:"J_Id"},I++);let K=0;Y.components.forEach(te=>{const{isInput:fe,bindTable:ge}=p[te.type]||{};!te.config.isNotSave&&fe&&ge!==!1&&(te.config.csType||(te.config.csType=p[te.type]?.csType,te.config.fieldLen=p[te.type]?.fieldLen),te.config.isSubTable?te.config.table=W[te.containerId].name:te.config.table=W.main.name,te.config.field=te.config.field||`f${Math.floor(Date.now()/1e3)}${K}`,K++)});const ne=[];Object.keys(W).forEach(te=>{W[te].type==="chlid"&&(W[te].relationName=W.main.name,W[te].comment+=`,关联主表${W.main.name}`),ne.push(W[te])}),Y.db=ne}else{const W={};c.value.forEach(K=>{K.columns.forEach(ne=>{W[`${K.name}_${ne.name}`]=ne.csType})}),Y.components.forEach(K=>{K.config.table&&K.config.field&&(K.config.csType=W[`${K.config.table}_${K.config.field}`])})}return n.notBindTable?Y.db.forEach(W=>{if(!Y.components.find(ne=>ne.config.table===W.name&&ne.config.field==="J_Id")){const ne=Y.components.find(te=>te.config.table===W.name&&te.config.field);ne&&Y.components.push({id:W.name+"_J_Id",name:W.name+"_J_Id",type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:W.name,field:"J_Id",label:"主键"},containerId:ne.containerId,level:ne.level})}}):c.value.forEach(W=>{W.columns.forEach(K=>{if(K.isPrimary&&!Y.components.find(te=>te.config.table===W.name&&te.config.field===K.name)){const te=Y.components.find(fe=>fe.config.table===W.name&&fe.config.field);te&&Y.components.push({id:W.name+"_"+K.name,name:W.name+"_"+K.name,type:"pkey",runtimeType:"j-input",groupId:"",config:{display:!1,table:W.name,field:K.name,label:"主键"+K.name,isIdentity:K.isIdentity},containerId:te.containerId,level:te.level})}})}),Y},v=I=>{const Y=Fy(I,p);a.config=Y.formConfig,a.children?.push(...Y.componentList),Object.keys(Y.componentDic).forEach(W=>{G[W]=Y.componentDic[W]})},C=()=>{const I=vr(a.config,a.children||[]),Y={},W={};return O(I.components,Y,W)},k=I=>{const{isInput:Y,bindTable:W}=p[I]||{};if(!Y&&W)return!0},O=(I,Y,W)=>{if(!n.notBindTable)for(const K of I){const{isInput:ne,bindTable:te}=p[K.type]||{};if(!K.config.isNotSave&&K.type!=="pkey"){if(ne&&te!==!1){if(Xn(K.config.table))return r&&r(`请【${K.config.label}】绑定数据表!`),!1;if(!K.config.isSubTable){if(W[K.config.table]&&k(W[K.config.table].type))return r&&r(`【${K.config.label}】和【${W[K.config.table].config.label}】重复绑定【${K.config.table}】表!`),!1;K.config.table&&(W[K.config.table]=K)}}else if(te){if(Xn(K.config.table))return r&&r(`【${K.config.label}】请绑定数据表!`),!1;if(W[K.config.table])return r&&r(`【${K.config.label}】和【${W[K.config.table].config.label}】重复绑定【${K.config.table}】表!`),!1;K.config.table&&(W[K.config.table]=K)}}}for(const K of I){if(!n.notBindTable){const{isInput:ne,bindTable:te}=p[K.type]||{};if(!K.config.isNotSave&&ne&&te!==!1){if(Xn(K.config.field))return r&&r(`请【${K.config.label}】绑定表字段!`),!1;if(Y[`${K.config.table}-${K.config.field}`])return r&&r(`【${K.config.label}】和【${Y[`${K.config.table}-${K.config.field}`].config.label}】重复绑定【${K.config.field}】字段!`),!1;Y[`${K.config.table}-${K.config.field}`]=K}}if(n.componentConfigValidate&&!n.componentConfigValidate(K.type,{configData:K.config,errorTip:r}))return!1}return!0},R=s.ref(),B=s.ref(),P=s.reactive({width:0,height:0,formConfig:{}});let L=0;const j=I=>{if(B.value)L=0,B.value.init(I||[]);else{if(L>600){console.warn("表单组件加载超时");return}L++,setTimeout(()=>{j(I)},100)}},Z=()=>{},Q=()=>{},q=()=>{const I=vr(a.config,a.children||[]);P.width=I.form.width||800,P.height=I.form.height||600,R.value.open("表单预览",I.form.layerType),s.nextTick(()=>{const{formConfig:Y,componentList:W}=Ly(I);P.formConfig=Y,j(W)})},ee=s.ref(),re=s.ref(),ie=()=>{ee.value.open("快速添加组件")},ce=()=>{const{addList:I,table:Y}=re.value?.ok()||{addList:[]};if(I.length<=0)i&&i("请选择字段!");else{if($.value?.config.componentType==="gridtable"||$.value?.config.isSubTable)if($.value.config.table){if($.value.config.table!==Y){i&&i("请设置相同的表和子表!");return}}else{let W=$.value;$.value.config.isSubTable&&(W=G[$.value.containerId]),W.config.table=Y,(W.children||[]).forEach(K=>{K.isInput&&(K.config.table=Y)}),A.value.setFormData({main:{table:Y}})}I.forEach(W=>{const K=br(p[W.type]);K.config={table:Y,field:W.value,label:W.label},S(K)}),ee.value.close()}},oe=()=>{re.value?.closed()};return e({setTables:I=>{h(I)},getSchema:()=>D(),setSchema:I=>v(I),reset:()=>w(),validate:()=>C()}),(I,Y)=>{const W=s.resolveComponent("j-icon"),K=s.resolveComponent("d-drag-tool"),ne=s.resolveComponent("el-collapse-item"),te=s.resolveComponent("el-collapse"),fe=s.resolveComponent("j-button"),ge=s.resolveComponent("d-drag-form-list"),Ie=s.resolveComponent("el-row"),Me=s.resolveComponent("d-drag-container"),Ze=s.resolveComponent("j-form"),_e=s.resolveComponent("j-layer");return s.openBlock(),s.createElementBlock("div",e0,[s.createElementVNode("div",t0,[Y[1]||(Y[1]=s.createElementVNode("div",{class:"d-form-design-panel-title"},"组件库",-1)),s.createElementVNode("div",n0,[s.createVNode(te,{modelValue:l.value,"onUpdate:modelValue":Y[0]||(Y[0]=xt=>l.value=xt)},{default:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.components,(xt,Ct)=>(s.openBlock(),s.createBlock(ne,{key:Ct,title:xt.name,name:Ct},{default:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(xt.children,(Et,Vr)=>(s.openBlock(),s.createBlock(K,{key:Vr,config:Et},{default:s.withCtx(()=>[s.createElementVNode("div",o0,[s.createVNode(W,{class:"j-component-tool-icon",icon:Et.icon,size:14},null,8,["icon"]),s.createElementVNode("div",i0,s.toDisplayString(s.unref(o)(Et.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),s.createElementVNode("div",r0,[s.createElementVNode("div",s0,[s.withDirectives(s.createVNode(fe,{type:"primary",label:"快速添加组件",onClick:ie},null,512),[[s.vShow,!t.notBindTable]]),s.createVNode(fe,{type:"primary",label:"清空",onClick:H,danger:""}),s.createVNode(fe,{label:"预览",onClick:q})]),s.createElementVNode("div",a0,[s.createVNode(Me,{ref_key:"dragContainer",ref:x,class:"d-form-design-drag-container","is-component-container":!1,"component-data":a},{default:s.withCtx(()=>[!a.children||a.children.length===0?(s.openBlock(),s.createElementBlock("div",l0,[...Y[2]||(Y[2]=[s.createElementVNode("div",null,"请从左侧拖拽组件到此处",-1)])])):(s.openBlock(),s.createBlock(Ie,{key:1},{default:s.withCtx(()=>[s.createVNode(ge,{"component-list":a.children,"global-config":a.config},null,8,["component-list","global-config"])]),_:1}))]),_:1},8,["component-data"])])]),s.withDirectives(s.createElementVNode("div",c0,[s.createElementVNode("div",d0,[s.createElementVNode("span",u0,s.toDisplayString(`${s.unref(o)("属性配置")}${E.value}`),1)]),s.createElementVNode("div",f0,[s.createVNode(Ze,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:A,onChange:N},null,512)])],512),[[s.vShow,s.unref($)]]),s.createVNode(_e,{ref_key:"previewFormLayerRef",ref:R,width:P.width,height:P.height,onOk:Z,onClosed:Q},{default:s.withCtx(()=>[s.createVNode(Ze,{config:P.formConfig,"is-preview":!0,ref_key:"previewFormRef",ref:B,actions:t.actions},null,8,["config","actions"])]),_:1},8,["width","height"]),s.createVNode(_e,{ref_key:"importFormLayerRef",ref:ee,width:800,height:600,"btn-text":"确认",onOk:ce,onClosed:oe},{default:s.withCtx(()=>[s.createVNode(Xv,{"component-list":y,"table-list":c.value,ref_key:"importComponentRef",ref:re},null,8,["table-list"])]),_:1},512)])}}}),[dc]),fc=(t,e)=>{const n={ver:"V3",indexPage:{...t},components:[]};return hc(e||[],n.components),n},hc=(t,e)=>{t.forEach(n=>{const o={id:n.id,name:n.name,type:n.type,runtimeType:n.runtimeType||n.componentName||n.type,groupId:n.groupId||"",config:n.config,containerId:n.containerId,level:n.level};if(n.dragType==="container"){const i=n.children||[];hc(i,e)}e.push(o)})},h0=t=>{const e=p0(t.components);return{pageConfig:t.indexPage,componentList:e}},p0=t=>{const e={},n={};return t.forEach(o=>{e[o.containerId]=e[o.containerId]||[];const i={id:o.id,type:o.runtimeType,slot:o.groupId,config:{}};o.config&&Object.keys(o.config).forEach(r=>{i.config[r]=o.config[r]}),e[o.containerId].push(i),n[o.id]=i}),Object.keys(e).forEach(o=>{n[o]&&(n[o].children=e[o])}),e.indexPage||[]},g0=(t,e)=>{let n={},o=[];const i={};if(t.ver==="V3"){const r=t;n=r.indexPage;const a={};r.components.forEach(l=>{const u=e[l.type];if(!u)return;a[l.containerId]=a[l.containerId]||[];const c={id:l.id,name:l.name,type:l.type,dragType:u.dragType||"component",componentName:u.componentName||"",runtimeType:u.runtimeType,groupId:l.groupId,config:l.config,isInput:!1,containerId:l.containerId,level:l.level};i[c.id]=c,a[l.containerId].push(c),c.dragType==="container"&&(c.children=[])}),Object.keys(a).forEach(l=>{i[l]&&(i[l].children=a[l])}),o=a.indexPage||[]}return{pageConfig:n,componentList:o,componentDic:i}},pc=s.defineComponent({name:"DIndexDesignItem",__name:"indexDesignItem",props:{componentData:{type:Object,default:()=>({})},globalConfig:{type:Object,default:()=>({})}},setup(t){return(e,n)=>(s.openBlock(),s.createBlock(s.resolveDynamicComponent(t.componentData?.componentName),s.mergeProps(t.componentData?.config,{"global-config":t.globalConfig,"component-data":t.componentData}),null,16,["global-config","component-data"]))}}),m0={class:"d-index-design j-block"},y0={class:"d-index-design-left"},v0={class:"j-component-list"},b0={class:"j-component-tool"},w0={class:"j-component-tool-name"},_0={class:"d-index-design-center"},x0={class:"design-toolbar"},C0={class:"design-container"},E0={key:0,class:"j-block design-empty"},S0={class:"d-index-design-right"},N0={class:"d-index-design-panel-title"},k0={style:{margin:"0","font-size":"14px"}},D0={class:"d-index-design-panel"},gc=$t(s.defineComponent({name:"DIndexDesign",__name:"indexDesign",props:{components:{type:Array,default:()=>[]},componentConfigs:{type:Object,default:()=>({})},componentInit:Function,containerAddComponent:Function,componentConfigInit:Function,componentConfigChange:Function,flowComponents:{type:Array,default:()=>[]},flowInit:Function,flowComponentConfigInit:Function,flowComponentConfigChange:Function,flowComponentConfigs:{type:Object,default:()=>({})}},setup(t,{expose:e}){const{t:n}=Hr(),o=t,i=v=>{v.forEach(C=>{C.type==="d-input-flow"&&(C.config=C.config||{},C.config.flowComponents=o.flowComponents,C.config.flowInit=o.flowInit,C.config.flowComponentConfigInit=k=>{o.flowComponentConfigInit&&(k.designComponents=b.value,k.component=p.value,o.flowComponentConfigInit(k))},C.config.flowComponentConfigs=o.flowComponentConfigs,C.config.flowComponentConfigChange=o.flowComponentConfigChange),C.children&&i(C.children)})},r=s.reactive({name:"页面",id:"indexPage",type:"indexPage",level:0,children:[],dragType:"container",componentName:"",containerId:"",isInput:!1,config:{}});o.componentInit&&(r.config=o.componentInit("indexPage")||{});const a={},l=[];o.components.forEach(({children:v})=>{v.forEach(C=>{a[C.type]=C,C.dragType=C.dragType||"component",l.push({label:C.name,value:C.type})})});const u={};Object.keys(o.componentConfigs).forEach(v=>{const{hasBase:C}=a[v]||{hasBase:!1},k=[{id:"id",type:"j-input",config:{label:"ID",readonly:!0}},{id:"label",type:"j-input",config:{label:"名称"}}],O={type:"j-collapse",config:{defaultValue:[]},children:[]};C!==!1&&(O.children?.push({config:{label:"基础信息"},children:[...k]}),O.config?.defaultValue.push("_collapse0")),O.children?.push(...o.componentConfigs[v]),i(O.children||[]),u[v]=[O]});const c=(v,C)=>{p.value&&o.componentConfigChange&&o.componentConfigChange(p.value.type,{configRef:h,component:v,configData:p.value.config,...C})},d=(v,C)=>{o.componentConfigInit&&o.componentConfigInit(v,{configRef:h,...C})},f=s.ref(),h=s.ref(),{activedComponent:p,clearComponents:y,schemaComponentDic:m,designComponentList:b}=cc(f,h,r,o.componentInit,d,u,a,o.containerAddComponent),N=s.computed(()=>p.value?`【${p.value.name}】`:""),_=s.ref([]),g=o.components.length;for(let v=0;v<g;v++)_.value.push(v);s.provide("dui-design-provide",{designItemName:pc});const x=()=>{y()},A=()=>{o.componentInit&&(r.config=o.componentInit("indexPage")||{}),y()},$=()=>(console.log("pValidate"),!0),F=()=>fc(r.config,r.children||[]),U=v=>{const C=g0(v,a);r.config=C.pageConfig,r.children?.push(...C.componentList),Object.keys(C.componentDic).forEach(k=>{m[k]=C.componentDic[k]})},G=s.ref(),S=s.ref();s.ref(""),s.reactive({formConfig:{}});let T=0;const E=v=>{if(S.value)T=0,S.value.init(v);else{if(T>600){console.warn("组件加载超时");return}T++,setTimeout(()=>{E(v)},100)}},H=()=>{},w=()=>{},D=()=>{const v=fc(r.config,r.children||[]),{componentList:C}=h0(v);G.value.open("页面预览","full"),s.nextTick(()=>{E(C)})};return e({reset:A,validate:$,getSchema:F,setSchema:U}),(v,C)=>{const k=s.resolveComponent("j-icon"),O=s.resolveComponent("d-drag-tool"),R=s.resolveComponent("el-collapse-item"),B=s.resolveComponent("el-collapse"),P=s.resolveComponent("j-button"),L=s.resolveComponent("el-tooltip"),j=s.resolveComponent("el-divider"),Z=s.resolveComponent("el-empty"),Q=s.resolveComponent("d-drag-index-list"),q=s.resolveComponent("el-row"),ee=s.resolveComponent("d-drag-container"),re=s.resolveComponent("j-form"),ie=s.resolveComponent("j-page"),ce=s.resolveComponent("j-layer");return s.openBlock(),s.createElementBlock("div",m0,[s.createElementVNode("div",y0,[C[1]||(C[1]=s.createElementVNode("div",{class:"d-index-design-panel-title"},"组件库",-1)),s.createElementVNode("div",v0,[s.createVNode(B,{modelValue:_.value,"onUpdate:modelValue":C[0]||(C[0]=oe=>_.value=oe)},{default:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(t.components,(oe,ae)=>(s.openBlock(),s.createBlock(R,{key:ae,title:oe.name,name:ae},{default:s.withCtx(()=>[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(oe.children,(z,M)=>(s.openBlock(),s.createBlock(O,{key:M,config:z},{default:s.withCtx(()=>[s.createElementVNode("div",b0,[s.createVNode(k,{class:"j-component-tool-icon",icon:z.icon,size:14},null,8,["icon"]),s.createElementVNode("div",w0,s.toDisplayString(s.unref(n)(z.name)),1)])]),_:2},1032,["config"]))),128))]),_:2},1032,["title","name"]))),128))]),_:1},8,["modelValue"])])]),s.createElementVNode("div",_0,[s.createElementVNode("div",x0,[C[2]||(C[2]=s.createElementVNode("div",null,null,-1)),s.createElementVNode("div",null,[s.createVNode(L,{content:s.unref(n)("清空")},{default:s.withCtx(()=>[s.createVNode(P,{danger:"",type:"text",onClick:x,icon:"mdi:delete-outline"})]),_:1},8,["content"]),s.createVNode(j,{direction:"vertical"}),s.createVNode(L,{content:s.unref(n)("预览")},{default:s.withCtx(()=>[s.createVNode(P,{type:"text",onClick:D,icon:"mdi:play-circle-outline"})]),_:1},8,["content"])])]),s.createElementVNode("div",C0,[s.createVNode(ee,{ref_key:"dragContainer",ref:f,class:"design-drag-container","is-component-container":!1,"component-data":r},{default:s.withCtx(()=>[!r.children||r.children.length===0?(s.openBlock(),s.createElementBlock("div",E0,[s.createVNode(Z,{description:s.unref(n)("请从左侧拖拽组件到此处"),"image-size":100},null,8,["description"])])):(s.openBlock(),s.createBlock(q,{key:1},{default:s.withCtx(()=>[s.createVNode(Q,{"component-list":r.children,"global-config":r.config},null,8,["component-list","global-config"])]),_:1}))]),_:1},8,["component-data"])])]),s.withDirectives(s.createElementVNode("div",S0,[s.createElementVNode("div",N0,[s.createElementVNode("span",k0,s.toDisplayString(`${s.unref(n)("属性配置")}${N.value}`),1)]),s.createElementVNode("div",D0,[s.createVNode(re,{config:{labelPosition:"top",size:"small"},collapseAnimate:!1,style:{padding:"0"},ref_key:"configRef",ref:h,onChange:c},null,512)])],512),[[s.vShow,s.unref(p)&&u[s.unref(p).type]]]),s.createVNode(ce,{ref_key:"previewLayerRef",ref:G,"has-btns":!1,onOk:H,onClosed:w},{default:s.withCtx(()=>[s.createVNode(ie,{ref_key:"previewRef",ref:S},null,512)]),_:1},512)])}}}),[pc]),T0=[ms,Di,Ti,Ii,Mi,hl,pl,vl,bl,uc,gc],I0={install:t=>{T0.forEach(e=>{t.component(e.name,e)})}};$e.DDrag=ms,$e.DDraggable=bl,$e.DFlowDesign=hl,$e.DFormDesign=uc,$e.DIndexDesign=gc,$e.DInputFlow=pl,$e.DLayout=vl,$e.default=I0,$e.dragContainer=Ti,$e.dragFormList=Ii,$e.dragIndexList=Mi,$e.dragTool=Di,Object.defineProperties($e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));