@a2simcode/dui 0.0.16 → 0.0.17
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.es.js +21 -8
- package/dist/dui.umd.js +1 -1
- package/package.json +1 -1
package/dist/dui.umd.js
CHANGED
|
@@ -25,4 +25,4 @@ Target: ${n}`,EDGE_ORPHANED:t=>`Edge was orphaned (suddenly missing source or ta
|
|
|
25
25
|
Edge: ${t}`,EDGE_NOT_FOUND:t=>`Edge not found
|
|
26
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 ?
|
|
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};return u.active&&i.type==="j-collapse"&&(f.active=u.active),{config:f,children:d}});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 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"}})}));
|