180?d+=360:d-c>180&&(c+=360),h.push({i:u.push(s(u)+"rotate(",null,i)-2,x:Rh(c,d)})):d&&u.push(s(u)+"rotate("+d+i)}function a(c,d,u,h){c!==d?h.push({i:u.push(s(u)+"skewX(",null,i)-2,x:Rh(c,d)}):d&&u.push(s(u)+"skewX("+d+i)}function l(c,d,u,h,f,g){if(c!==u||d!==h){var p=f.push(s(f)+"scale(",null,",",null,")");g.push({i:p-4,x:Rh(c,u)},{i:p-2,x:Rh(d,h)})}else(u!==1||h!==1)&&f.push(s(f)+"scale("+u+","+h+")")}return function(c,d){var u=[],h=[];return c=n(c),d=n(d),o(c.translateX,c.translateY,d.translateX,d.translateY,u,h),r(c.rotate,d.rotate,u,h),a(c.skewX,d.skewX,u,h),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,h),c=d=null,function(f){for(var g=-1,p=h.length,m;++g=0&&n._call.call(void 0,e),n=n._next;--$S}function lie(){D0=(qA=BE.now())+I3,$S=_k=0;try{wDe()}finally{$S=0,yDe(),D0=0}}function CDe(){var n=BE.now(),e=n-qA;e>Mge&&(I3-=e,qA=n)}function yDe(){for(var n,e=UA,t,i=1/0;e;)e._call?(i>e._time&&(i=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:UA=t);bk=n,sH(i)}function sH(n){if(!$S){_k&&(_k=clearTimeout(_k));var e=n-D0;e>24?(n<1/0&&(_k=setTimeout(lie,n-BE.now()-I3)),kL&&(kL=clearInterval(kL))):(kL||(qA=BE.now(),kL=setInterval(CDe,Mge)),$S=1,Age(lie))}}function cie(n,e,t){var i=new KA;return e=e==null?0:+e,i.restart(s=>{i.stop(),n(s+e)},e,t),i}var SDe=N3("start","end","cancel","interrupt"),xDe=[],Oge=0,die=1,oH=2,CM=3,uie=4,rH=5,yM=6;function D3(n,e,t,i,s,o){var r=n.__transition;if(!r)n.__transition={};else if(t in r)return;LDe(n,t,{name:e,index:i,group:s,on:SDe,tween:xDe,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Oge})}function FY(n,e){var t=Xu(n,e);if(t.state>Oge)throw new Error("too late; already scheduled");return t}function yf(n,e){var t=Xu(n,e);if(t.state>CM)throw new Error("too late; already running");return t}function Xu(n,e){var t=n.__transition;if(!t||!(t=t[e]))throw new Error("transition not found");return t}function LDe(n,e,t){var i=n.__transition,s;i[e]=t,t.timer=Pge(o,0,t.time);function o(c){t.state=die,t.timer.restart(r,t.delay,t.time),t.delay<=c&&r(c-t.delay)}function r(c){var d,u,h,f;if(t.state!==die)return l();for(d in i)if(f=i[d],f.name===t.name){if(f.state===CM)return cie(r);f.state===uie?(f.state=yM,f.timer.stop(),f.on.call("interrupt",n,n.__data__,f.index,f.group),delete i[d]):+doH&&i.state=0&&(e=e.slice(0,t)),!e||e==="start"})}function tTe(n,e,t){var i,s,o=eTe(e)?FY:yf;return function(){var r=o(this,n),a=r.on;a!==i&&(s=(i=a).copy()).on(e,t),r.on=s}}function iTe(n,e){var t=this._id;return arguments.length<2?Xu(this.node(),t).on.on(n):this.each(tTe(t,n,e))}function nTe(n){return function(){var e=this.parentNode;for(var t in this.__transition)if(+t!==n)return;e&&e.removeChild(this)}}function sTe(){return this.on("end.remove",nTe(this._id))}function oTe(n){var e=this._name,t=this._id;typeof n!="function"&&(n=RY(n));for(var i=this._groups,s=i.length,o=new Array(s),r=0;r()=>n;function DTe(n,{sourceEvent:e,target:t,transform:i,dispatch:s}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function Tg(n,e,t){this.k=n,this.x=e,this.y=t}Tg.prototype={constructor:Tg,scale:function(n){return n===1?this:new Tg(this.k*n,this.x,this.y)},translate:function(n,e){return n===0&e===0?this:new Tg(this.k,this.x+this.k*n,this.y+this.k*e)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var T3=new Tg(1,0,0);Hge.prototype=Tg.prototype;function Hge(n){for(;!n.__zoom;)if(!(n=n.parentNode))return T3;return n.__zoom}function f6(n){n.stopImmediatePropagation()}function NL(n){n.preventDefault(),n.stopImmediatePropagation()}function TTe(n){return(!n.ctrlKey||n.type==="wheel")&&!n.button}function RTe(){var n=this;return n instanceof SVGElement?(n=n.ownerSVGElement||n,n.hasAttribute("viewBox")?(n=n.viewBox.baseVal,[[n.x,n.y],[n.x+n.width,n.y+n.height]]):[[0,0],[n.width.baseVal.value,n.height.baseVal.value]]):[[0,0],[n.clientWidth,n.clientHeight]]}function hie(){return this.__zoom||T3}function MTe(n){return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function ATe(){return navigator.maxTouchPoints||"ontouchstart"in this}function PTe(n,e,t){var i=n.invertX(e[0][0])-t[0][0],s=n.invertX(e[1][0])-t[1][0],o=n.invertY(e[0][1])-t[0][1],r=n.invertY(e[1][1])-t[1][1];return n.translate(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r))}function Vge(){var n=TTe,e=RTe,t=PTe,i=MTe,s=ATe,o=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],a=250,l=wM,c=N3("start","zoom","end"),d,u,h,f=500,g=150,p=0,m=10;function b(O){O.property("__zoom",hie).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",T).filter(s).on("touchstart.zoom",M).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(O,A,z,U){var W=O.selection?O.selection():O;W.property("__zoom",hie),O!==W?S(O,A,z,U):W.interrupt().each(function(){x(this,arguments).event(U).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(O,A,z,U){b.scaleTo(O,function(){var W=this.__zoom.k,F=typeof A=="function"?A.apply(this,arguments):A;return W*F},z,U)},b.scaleTo=function(O,A,z,U){b.transform(O,function(){var W=e.apply(this,arguments),F=this.__zoom,q=z==null?y(W):typeof z=="function"?z.apply(this,arguments):z,X=F.invert(q),Q=typeof A=="function"?A.apply(this,arguments):A;return t(C(v(F,Q),q,X),W,r)},z,U)},b.translateBy=function(O,A,z,U){b.transform(O,function(){return t(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof z=="function"?z.apply(this,arguments):z),e.apply(this,arguments),r)},null,U)},b.translateTo=function(O,A,z,U,W){b.transform(O,function(){var F=e.apply(this,arguments),q=this.__zoom,X=U==null?y(F):typeof U=="function"?U.apply(this,arguments):U;return t(T3.translate(X[0],X[1]).scale(q.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof z=="function"?-z.apply(this,arguments):-z),F,r)},U,W)};function v(O,A){return A=Math.max(o[0],Math.min(o[1],A)),A===O.k?O:new Tg(A,O.x,O.y)}function C(O,A,z){var U=A[0]-z[0]*O.k,W=A[1]-z[1]*O.k;return U===O.x&&W===O.y?O:new Tg(O.k,U,W)}function y(O){return[(+O[0][0]+ +O[1][0])/2,(+O[0][1]+ +O[1][1])/2]}function S(O,A,z,U){O.on("start.zoom",function(){x(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(U).end()}).tween("zoom",function(){var W=this,F=arguments,q=x(W,F).event(U),X=e.apply(W,F),Q=z==null?y(X):typeof z=="function"?z.apply(W,F):z,oe=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),ge=W.__zoom,ye=typeof A=="function"?A.apply(W,F):A,$e=l(ge.invert(Q).concat(oe/ge.k),ye.invert(Q).concat(oe/ye.k));return function(Ze){if(Ze===1)Ze=ye;else{var Ee=$e(Ze),Je=oe/Ee[2];Ze=new Tg(Je,Q[0]-Ee[0]*Je,Q[1]-Ee[1]*Je)}q.zoom(null,Ze)}})}function x(O,A,z){return!z&&O.__zooming||new L(O,A)}function L(O,A){this.that=O,this.args=A,this.active=0,this.sourceEvent=null,this.extent=e.apply(O,A),this.taps=0}L.prototype={event:function(O){return O&&(this.sourceEvent=O),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(O,A){return this.mouse&&O!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&O!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&O!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(O){var A=Lc(this.that).datum();c.call(O,this.that,new DTe(O,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:c}),A)}};function k(O,...A){if(!n.apply(this,arguments))return;var z=x(this,A).event(O),U=this.__zoom,W=Math.max(o[0],Math.min(o[1],U.k*Math.pow(2,i.apply(this,arguments)))),F=hu(O);if(z.wheel)(z.mouse[0][0]!==F[0]||z.mouse[0][1]!==F[1])&&(z.mouse[1]=U.invert(z.mouse[0]=F)),clearTimeout(z.wheel);else{if(U.k===W)return;z.mouse=[F,U.invert(F)],SM(this),z.start()}NL(O),z.wheel=setTimeout(q,g),z.zoom("mouse",t(C(v(U,W),z.mouse[0],z.mouse[1]),z.extent,r));function q(){z.wheel=null,z.end()}}function N(O,...A){if(h||!n.apply(this,arguments))return;var z=O.currentTarget,U=x(this,A,!0).event(O),W=Lc(O.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",oe,!0),F=hu(O,z),q=O.clientX,X=O.clientY;xge(O.view),f6(O),U.mouse=[F,this.__zoom.invert(F)],SM(this),U.start();function Q(ge){if(NL(ge),!U.moved){var ye=ge.clientX-q,$e=ge.clientY-X;U.moved=ye*ye+$e*$e>p}U.event(ge).zoom("mouse",t(C(U.that.__zoom,U.mouse[0]=hu(ge,z),U.mouse[1]),U.extent,r))}function oe(ge){W.on("mousemove.zoom mouseup.zoom",null),Lge(ge.view,U.moved),NL(ge),U.event(ge).end()}}function T(O,...A){if(n.apply(this,arguments)){var z=this.__zoom,U=hu(O.changedTouches?O.changedTouches[0]:O,this),W=z.invert(U),F=z.k*(O.shiftKey?.5:2),q=t(C(v(z,F),U,W),e.apply(this,A),r);NL(O),a>0?Lc(this).transition().duration(a).call(S,q,U,O):Lc(this).call(b.transform,q,U,O)}}function M(O,...A){if(n.apply(this,arguments)){var z=O.touches,U=z.length,W=x(this,A,O.changedTouches.length===U).event(O),F,q,X,Q;for(f6(O),q=0;q"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:n=>`Node type "${n}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:n=>`The old edge with id=${n} does not exist.`,error009:n=>`Marker type "${n}" doesn't exist.`,error008:(n,{id:e,sourceHandle:t,targetHandle:i})=>`Couldn't create edge for ${n} handle id: "${n==="source"?t:i}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:n=>`Edge type "${n}" not found. Using fallback type "default".`,error012:n=>`Node with id "${n}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(n="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${n}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},WE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],jge=["Enter"," ","Escape"],zge={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:n,x:e,y:t})=>`Moved selected node ${n}. New position, x: ${e}, y: ${t}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var US;(function(n){n.Strict="strict",n.Loose="loose"})(US||(US={}));var c1;(function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"})(c1||(c1={}));var HE;(function(n){n.Partial="partial",n.Full="full"})(HE||(HE={}));const $ge={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Cg;(function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"})(Cg||(Cg={}));var T0;(function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"})(T0||(T0={}));var Wt;(function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"})(Wt||(Wt={}));const fie={[Wt.Left]:Wt.Right,[Wt.Right]:Wt.Left,[Wt.Top]:Wt.Bottom,[Wt.Bottom]:Wt.Top};function Uge(n){return n===null?null:n?"valid":"invalid"}const qge=n=>"id"in n&&"source"in n&&"target"in n,OTe=n=>"id"in n&&"position"in n&&!("source"in n)&&!("target"in n),WY=n=>"id"in n&&"internals"in n&&!("source"in n)&&!("target"in n),qD=(n,e=[0,0])=>{const{width:t,height:i}=Fp(n),s=n.origin??e,o=t*s[0],r=i*s[1];return{x:n.position.x-o,y:n.position.y-r}},FTe=(n,e={nodeOrigin:[0,0]})=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const t=n.reduce((i,s)=>{const o=typeof s=="string";let r=!e.nodeLookup&&!o?s:void 0;e.nodeLookup&&(r=o?e.nodeLookup.get(s):WY(s)?s:e.nodeLookup.get(s.id));const a=r?GA(r,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return R3(i,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return M3(t)},KD=(n,e={})=>{let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return n.forEach(s=>{(e.filter===void 0||e.filter(s))&&(t=R3(t,GA(s)),i=!0)}),i?M3(t):{x:0,y:0,width:0,height:0}},HY=(n,e,[t,i,s]=[0,0,1],o=!1,r=!1)=>{const a={...YD(e,[t,i,s]),width:e.width/s,height:e.height/s},l=[];for(const c of n.values()){const{measured:d,selectable:u=!0,hidden:h=!1}=c;if(r&&!u||h)continue;const f=d.width??c.width??c.initialWidth??null,g=d.height??c.height??c.initialHeight??null,p=VE(a,KS(c)),m=(f??0)*(g??0),b=o&&p>0;(!c.internals.handleBounds||b||p>=m||c.dragging)&&l.push(c)}return l},BTe=(n,e)=>{const t=new Set;return n.forEach(i=>{t.add(i.id)}),e.filter(i=>t.has(i.source)||t.has(i.target))};function WTe(n,e){const t=new Map,i=e!=null&&e.nodes?new Set(e.nodes.map(s=>s.id)):null;return n.forEach(s=>{s.measured.width&&s.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!s.hidden)&&(!i||i.has(s.id))&&t.set(s.id,s)}),t}async function HTe({nodes:n,width:e,height:t,panZoom:i,minZoom:s,maxZoom:o},r){if(n.size===0)return Promise.resolve(!0);const a=WTe(n,r),l=KD(a),c=VY(l,e,t,(r==null?void 0:r.minZoom)??s,(r==null?void 0:r.maxZoom)??o,(r==null?void 0:r.padding)??.1);return await i.setViewport(c,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)}function Kge({nodeId:n,nextPosition:e,nodeLookup:t,nodeOrigin:i=[0,0],nodeExtent:s,onError:o}){const r=t.get(n),a=r.parentId?t.get(r.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=r.origin??i;let u=r.extent||s;if(r.extent==="parent"&&!r.expandParent)if(!a)o==null||o("005",df.error005());else{const f=a.measured.width,g=a.measured.height;f&&g&&(u=[[l,c],[l+f,c+g]])}else a&&GS(r.extent)&&(u=[[r.extent[0][0]+l,r.extent[0][1]+c],[r.extent[1][0]+l,r.extent[1][1]+c]]);const h=GS(u)?R0(e,u,r.measured):e;return(r.measured.width===void 0||r.measured.height===void 0)&&(o==null||o("015",df.error015())),{position:{x:h.x-l+(r.measured.width??0)*d[0],y:h.y-c+(r.measured.height??0)*d[1]},positionAbsolute:h}}async function VTe({nodesToRemove:n=[],edgesToRemove:e=[],nodes:t,edges:i,onBeforeDelete:s}){const o=new Set(n.map(h=>h.id)),r=[];for(const h of t){if(h.deletable===!1)continue;const f=o.has(h.id),g=!f&&h.parentId&&r.find(p=>p.id===h.parentId);(f||g)&&r.push(h)}const a=new Set(e.map(h=>h.id)),l=i.filter(h=>h.deletable!==!1),d=BTe(r,l);for(const h of l)a.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:r};const u=await s({nodes:r,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:r}:{edges:[],nodes:[]}:u}const qS=(n,e=0,t=1)=>Math.min(Math.max(n,e),t),R0=(n={x:0,y:0},e,t)=>({x:qS(n.x,e[0][0],e[1][0]-((t==null?void 0:t.width)??0)),y:qS(n.y,e[0][1],e[1][1]-((t==null?void 0:t.height)??0))});function Gge(n,e,t){const{width:i,height:s}=Fp(t),{x:o,y:r}=t.internals.positionAbsolute;return R0(n,[[o,r],[o+i,r+s]],e)}const gie=(n,e,t)=>nt?-qS(Math.abs(n-t),1,e)/e:0,Yge=(n,e,t=15,i=40)=>{const s=gie(n.x,i,e.width-i)*t,o=gie(n.y,i,e.height-i)*t;return[s,o]},R3=(n,e)=>({x:Math.min(n.x,e.x),y:Math.min(n.y,e.y),x2:Math.max(n.x2,e.x2),y2:Math.max(n.y2,e.y2)}),aH=({x:n,y:e,width:t,height:i})=>({x:n,y:e,x2:n+t,y2:e+i}),M3=({x:n,y:e,x2:t,y2:i})=>({x:n,y:e,width:t-n,height:i-e}),KS=(n,e=[0,0])=>{var s,o;const{x:t,y:i}=WY(n)?n.internals.positionAbsolute:qD(n,e);return{x:t,y:i,width:((s=n.measured)==null?void 0:s.width)??n.width??n.initialWidth??0,height:((o=n.measured)==null?void 0:o.height)??n.height??n.initialHeight??0}},GA=(n,e=[0,0])=>{var s,o;const{x:t,y:i}=WY(n)?n.internals.positionAbsolute:qD(n,e);return{x:t,y:i,x2:t+(((s=n.measured)==null?void 0:s.width)??n.width??n.initialWidth??0),y2:i+(((o=n.measured)==null?void 0:o.height)??n.height??n.initialHeight??0)}},Zge=(n,e)=>M3(R3(aH(n),aH(e))),VE=(n,e)=>{const t=Math.max(0,Math.min(n.x+n.width,e.x+e.width)-Math.max(n.x,e.x)),i=Math.max(0,Math.min(n.y+n.height,e.y+e.height)-Math.max(n.y,e.y));return Math.ceil(t*i)},pie=n=>ku(n.width)&&ku(n.height)&&ku(n.x)&&ku(n.y),ku=n=>!isNaN(n)&&isFinite(n),jTe=(n,e)=>{},GD=(n,e=[1,1])=>({x:e[0]*Math.round(n.x/e[0]),y:e[1]*Math.round(n.y/e[1])}),YD=({x:n,y:e},[t,i,s],o=!1,r=[1,1])=>{const a={x:(n-t)/s,y:(e-i)/s};return o?GD(a,r):a},YA=({x:n,y:e},[t,i,s])=>({x:n*s+t,y:e*s+i});function $w(n,e){if(typeof n=="number")return Math.floor((e-e/(1+n))*.5);if(typeof n=="string"&&n.endsWith("px")){const t=parseFloat(n);if(!Number.isNaN(t))return Math.floor(t)}if(typeof n=="string"&&n.endsWith("%")){const t=parseFloat(n);if(!Number.isNaN(t))return Math.floor(e*t*.01)}return console.error(`[React Flow] The padding value "${n}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function zTe(n,e,t){if(typeof n=="string"||typeof n=="number"){const i=$w(n,t),s=$w(n,e);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof n=="object"){const i=$w(n.top??n.y??0,t),s=$w(n.bottom??n.y??0,t),o=$w(n.left??n.x??0,e),r=$w(n.right??n.x??0,e);return{top:i,right:r,bottom:s,left:o,x:o+r,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function $Te(n,e,t,i,s,o){const{x:r,y:a}=YA(n,[e,t,i]),{x:l,y:c}=YA({x:n.x+n.width,y:n.y+n.height},[e,t,i]),d=s-l,u=o-c;return{left:Math.floor(r),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const VY=(n,e,t,i,s,o)=>{const r=zTe(o,e,t),a=(e-r.x)/n.width,l=(t-r.y)/n.height,c=Math.min(a,l),d=qS(c,i,s),u=n.x+n.width/2,h=n.y+n.height/2,f=e/2-u*d,g=t/2-h*d,p=$Te(n,f,g,d,e,t),m={left:Math.min(p.left-r.left,0),top:Math.min(p.top-r.top,0),right:Math.min(p.right-r.right,0),bottom:Math.min(p.bottom-r.bottom,0)};return{x:f-m.left+m.right,y:g-m.top+m.bottom,zoom:d}},jE=()=>{var n;return typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)==null?void 0:n.indexOf("Mac"))>=0};function GS(n){return n!=null&&n!=="parent"}function Fp(n){var e,t;return{width:((e=n.measured)==null?void 0:e.width)??n.width??n.initialWidth??0,height:((t=n.measured)==null?void 0:t.height)??n.height??n.initialHeight??0}}function Xge(n){var e,t;return(((e=n.measured)==null?void 0:e.width)??n.width??n.initialWidth)!==void 0&&(((t=n.measured)==null?void 0:t.height)??n.height??n.initialHeight)!==void 0}function Qge(n,e={width:0,height:0},t,i,s){const o={...n},r=i.get(t);if(r){const a=r.origin||s;o.x+=r.internals.positionAbsolute.x-(e.width??0)*a[0],o.y+=r.internals.positionAbsolute.y-(e.height??0)*a[1]}return o}function mie(n,e){if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0}function UTe(){let n,e;return{promise:new Promise((i,s)=>{n=i,e=s}),resolve:n,reject:e}}function qTe(n){return{...zge,...n||{}}}function Jk(n,{snapGrid:e=[0,0],snapToGrid:t=!1,transform:i,containerBounds:s}){const{x:o,y:r}=Nu(n),a=YD({x:o-((s==null?void 0:s.left)??0),y:r-((s==null?void 0:s.top)??0)},i),{x:l,y:c}=t?GD(a,e):a;return{xSnapped:l,ySnapped:c,...a}}const jY=n=>({width:n.offsetWidth,height:n.offsetHeight}),Jge=n=>{var e;return((e=n==null?void 0:n.getRootNode)==null?void 0:e.call(n))||(window==null?void 0:window.document)},KTe=["INPUT","SELECT","TEXTAREA"];function epe(n){var i,s;const e=((s=(i=n.composedPath)==null?void 0:i.call(n))==null?void 0:s[0])||n.target;return(e==null?void 0:e.nodeType)!==1?!1:KTe.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const tpe=n=>"clientX"in n,Nu=(n,e)=>{var o,r;const t=tpe(n),i=t?n.clientX:(o=n.touches)==null?void 0:o[0].clientX,s=t?n.clientY:(r=n.touches)==null?void 0:r[0].clientY;return{x:i-((e==null?void 0:e.left)??0),y:s-((e==null?void 0:e.top)??0)}},_ie=(n,e,t,i,s)=>{const o=e.querySelectorAll(`.${n}`);return!o||!o.length?null:Array.from(o).map(r=>{const a=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:n,nodeId:s,position:r.getAttribute("data-handlepos"),x:(a.left-t.left)/i,y:(a.top-t.top)/i,...jY(r)}})};function ipe({sourceX:n,sourceY:e,targetX:t,targetY:i,sourceControlX:s,sourceControlY:o,targetControlX:r,targetControlY:a}){const l=n*.125+s*.375+r*.375+t*.125,c=e*.125+o*.375+a*.375+i*.125,d=Math.abs(l-n),u=Math.abs(c-e);return[l,c,d,u]}function v2(n,e){return n>=0?.5*n:e*25*Math.sqrt(-n)}function bie({pos:n,x1:e,y1:t,x2:i,y2:s,c:o}){switch(n){case Wt.Left:return[e-v2(e-i,o),t];case Wt.Right:return[e+v2(i-e,o),t];case Wt.Top:return[e,t-v2(t-s,o)];case Wt.Bottom:return[e,t+v2(s-t,o)]}}function npe({sourceX:n,sourceY:e,sourcePosition:t=Wt.Bottom,targetX:i,targetY:s,targetPosition:o=Wt.Top,curvature:r=.25}){const[a,l]=bie({pos:t,x1:n,y1:e,x2:i,y2:s,c:r}),[c,d]=bie({pos:o,x1:i,y1:s,x2:n,y2:e,c:r}),[u,h,f,g]=ipe({sourceX:n,sourceY:e,targetX:i,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${n},${e} C${a},${l} ${c},${d} ${i},${s}`,u,h,f,g]}function spe({sourceX:n,sourceY:e,targetX:t,targetY:i}){const s=Math.abs(t-n)/2,o=t0}const ZTe=({source:n,sourceHandle:e,target:t,targetHandle:i})=>`xy-edge__${n}${e||""}-${t}${i||""}`,XTe=(n,e)=>e.some(t=>t.source===n.source&&t.target===n.target&&(t.sourceHandle===n.sourceHandle||!t.sourceHandle&&!n.sourceHandle)&&(t.targetHandle===n.targetHandle||!t.targetHandle&&!n.targetHandle)),QTe=(n,e,t={})=>{if(!n.source||!n.target)return e;const i=t.getEdgeId||ZTe;let s;return qge(n)?s={...n}:s={...n,id:i(n)},XTe(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function ope({sourceX:n,sourceY:e,targetX:t,targetY:i}){const[s,o,r,a]=spe({sourceX:n,sourceY:e,targetX:t,targetY:i});return[`M ${n},${e}L ${t},${i}`,s,o,r,a]}const vie={[Wt.Left]:{x:-1,y:0},[Wt.Right]:{x:1,y:0},[Wt.Top]:{x:0,y:-1},[Wt.Bottom]:{x:0,y:1}},JTe=({source:n,sourcePosition:e=Wt.Bottom,target:t})=>e===Wt.Left||e===Wt.Right?n.xMath.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2));function e2e({source:n,sourcePosition:e=Wt.Bottom,target:t,targetPosition:i=Wt.Top,center:s,offset:o,stepPosition:r}){const a=vie[e],l=vie[i],c={x:n.x+a.x*o,y:n.y+a.y*o},d={x:t.x+l.x*o,y:t.y+l.y*o},u=JTe({source:c,sourcePosition:e,target:d}),h=u.x!==0?"x":"y",f=u[h];let g=[],p,m;const b={x:0,y:0},v={x:0,y:0},[,,C,y]=spe({sourceX:n.x,sourceY:n.y,targetX:t.x,targetY:t.y});if(a[h]*l[h]===-1){h==="x"?(p=s.x??c.x+(d.x-c.x)*r,m=s.y??(c.y+d.y)/2):(p=s.x??(c.x+d.x)/2,m=s.y??c.y+(d.y-c.y)*r);const k=[{x:p,y:c.y},{x:p,y:d.y}],N=[{x:c.x,y:m},{x:d.x,y:m}];a[h]===f?g=h==="x"?k:N:g=h==="x"?N:k}else{const k=[{x:c.x,y:d.y}],N=[{x:d.x,y:c.y}];if(h==="x"?g=a.x===f?N:k:g=a.y===f?k:N,e===i){const O=Math.abs(n[h]-t[h]);if(O<=o){const A=Math.min(o-1,o-O);a[h]===f?b[h]=(c[h]>n[h]?-1:1)*A:v[h]=(d[h]>t[h]?-1:1)*A}}if(e!==i){const O=h==="x"?"y":"x",A=a[h]===l[O],z=c[O]>d[O],U=c[O]=V?(p=(T.x+M.x)/2,m=g[0].y):(p=g[0].x,m=(T.y+M.y)/2)}const S={x:c.x+b.x,y:c.y+b.y},x={x:d.x+v.x,y:d.y+v.y};return[[n,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...x.x!==g[g.length-1].x||x.y!==g[g.length-1].y?[x]:[],t],p,m,C,y]}function t2e(n,e,t,i){const s=Math.min(wie(n,e)/2,wie(e,t)/2,i),{x:o,y:r}=e;if(n.x===o&&o===t.x||n.y===r&&r===t.y)return`L${o} ${r}`;if(n.y===r){const c=n.xt.id===e):n[0])||null}function cH(n,e){return n?typeof n=="string"?n:`${e?`${e}__`:""}${Object.keys(n).sort().map(i=>`${i}=${n[i]}`).join("&")}`:""}function n2e(n,{id:e,defaultColor:t,defaultMarkerStart:i,defaultMarkerEnd:s}){const o=new Set;return n.reduce((r,a)=>([a.markerStart||i,a.markerEnd||s].forEach(l=>{if(l&&typeof l=="object"){const c=cH(l,e);o.has(c)||(r.push({id:c,color:l.color||t,...l}),o.add(c))}}),r),[]).sort((r,a)=>r.id.localeCompare(a.id))}const rpe=1e3,s2e=10,zY={nodeOrigin:[0,0],nodeExtent:WE,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},o2e={...zY,checkEquality:!0};function $Y(n,e){const t={...n};for(const i in e)e[i]!==void 0&&(t[i]=e[i]);return t}function r2e(n,e,t){const i=$Y(zY,t);for(const s of n.values())if(s.parentId)qY(s,n,e,i);else{const o=qD(s,i.nodeOrigin),r=GS(s.extent)?s.extent:i.nodeExtent,a=R0(o,r,Fp(s));s.internals.positionAbsolute=a}}function a2e(n,e){if(!n.handles)return n.measured?e==null?void 0:e.internals.handleBounds:void 0;const t=[],i=[];for(const s of n.handles){const o={id:s.id,width:s.width??1,height:s.height??1,nodeId:n.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?t.push(o):s.type==="target"&&i.push(o)}return{source:t,target:i}}function UY(n){return n==="manual"}function dH(n,e,t,i={}){var d,u;const s=$Y(o2e,i),o={i:0},r=new Map(e),a=s!=null&&s.elevateNodesOnSelect&&!UY(s.zIndexMode)?rpe:0;let l=n.length>0,c=!1;e.clear(),t.clear();for(const h of n){let f=r.get(h.id);if(s.checkEquality&&h===(f==null?void 0:f.internals.userNode))e.set(h.id,f);else{const g=qD(h,s.nodeOrigin),p=GS(h.extent)?h.extent:s.nodeExtent,m=R0(g,p,Fp(h));f={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(u=h.measured)==null?void 0:u.height},internals:{positionAbsolute:m,handleBounds:a2e(h,f),z:ape(h,a,s.zIndexMode),userNode:h}},e.set(h.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(l=!1),h.parentId&&qY(f,e,t,i,o),c||(c=h.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:c}}function l2e(n,e){if(!n.parentId)return;const t=e.get(n.parentId);t?t.set(n.id,n):e.set(n.parentId,new Map([[n.id,n]]))}function qY(n,e,t,i,s){const{elevateNodesOnSelect:o,nodeOrigin:r,nodeExtent:a,zIndexMode:l}=$Y(zY,i),c=n.parentId,d=e.get(c);if(!d){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}l2e(n,t),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*s2e),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const u=o&&!UY(l)?rpe:0,{x:h,y:f,z:g}=c2e(n,d,r,a,u,l),{positionAbsolute:p}=n.internals,m=h!==p.x||f!==p.y;(m||g!==n.internals.z)&&e.set(n.id,{...n,internals:{...n.internals,positionAbsolute:m?{x:h,y:f}:p,z:g}})}function ape(n,e,t){const i=ku(n.zIndex)?n.zIndex:0;return UY(t)?i:i+(n.selected?e:0)}function c2e(n,e,t,i,s,o){const{x:r,y:a}=e.internals.positionAbsolute,l=Fp(n),c=qD(n,t),d=GS(n.extent)?R0(c,n.extent,l):c;let u=R0({x:r+d.x,y:a+d.y},i,l);n.extent==="parent"&&(u=Gge(u,l,e));const h=ape(n,s,o),f=e.internals.z??0;return{x:u.x,y:u.y,z:f>=h?f+1:h}}function KY(n,e,t,i=[0,0]){var r;const s=[],o=new Map;for(const a of n){const l=e.get(a.parentId);if(!l)continue;const c=((r=o.get(a.parentId))==null?void 0:r.expandedRect)??KS(l),d=Zge(c,a.rect);o.set(a.parentId,{expandedRect:d,parent:l})}return o.size>0&&o.forEach(({expandedRect:a,parent:l},c)=>{var C;const d=l.internals.positionAbsolute,u=Fp(l),h=l.origin??i,f=a.x0||g>0||b||v)&&(s.push({id:c,type:"position",position:{x:l.position.x-f+b,y:l.position.y-g+v}}),(C=t.get(c))==null||C.forEach(y=>{n.some(S=>S.id===y.id)||s.push({id:y.id,type:"position",position:{x:y.position.x+f,y:y.position.y+g}})})),(u.width0){const f=KY(h,e,t,s);c.push(...f)}return{changes:c,updatedInternals:l}}async function u2e({delta:n,panZoom:e,transform:t,translateExtent:i,width:s,height:o}){if(!e||!n.x&&!n.y)return Promise.resolve(!1);const r=await e.setViewportConstrained({x:t[0]+n.x,y:t[1]+n.y,zoom:t[2]},[[0,0],[s,o]],i),a=!!r&&(r.x!==t[0]||r.y!==t[1]||r.k!==t[2]);return Promise.resolve(a)}function xie(n,e,t,i,s,o){let r=s;const a=i.get(r)||new Map;i.set(r,a.set(t,e)),r=`${s}-${n}`;const l=i.get(r)||new Map;if(i.set(r,l.set(t,e)),o){r=`${s}-${n}-${o}`;const c=i.get(r)||new Map;i.set(r,c.set(t,e))}}function lpe(n,e,t){n.clear(),e.clear();for(const i of t){const{source:s,target:o,sourceHandle:r=null,targetHandle:a=null}=i,l={edgeId:i.id,source:s,target:o,sourceHandle:r,targetHandle:a},c=`${s}-${r}--${o}-${a}`,d=`${o}-${a}--${s}-${r}`;xie("source",l,d,n,s,r),xie("target",l,c,n,o,a),e.set(i.id,i)}}function cpe(n,e){if(!n.parentId)return!1;const t=e.get(n.parentId);return t?t.selected?!0:cpe(t,e):!1}function Lie(n,e,t){var s;let i=n;do{if((s=i==null?void 0:i.matches)!=null&&s.call(i,e))return!0;if(i===t)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function h2e(n,e,t,i){const s=new Map;for(const[o,r]of n)if((r.selected||r.id===i)&&(!r.parentId||!cpe(r,n))&&(r.draggable||e&&typeof r.draggable>"u")){const a=n.get(o);a&&s.set(o,{id:o,position:a.position||{x:0,y:0},distance:{x:t.x-a.internals.positionAbsolute.x,y:t.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return s}function g6({nodeId:n,dragItems:e,nodeLookup:t,dragging:i=!0}){var r,a,l;const s=[];for(const[c,d]of e){const u=(r=t.get(c))==null?void 0:r.internals.userNode;u&&s.push({...u,position:d.position,dragging:i})}if(!n)return[s[0],s];const o=(a=t.get(n))==null?void 0:a.internals.userNode;return[o?{...o,position:((l=e.get(n))==null?void 0:l.position)||o.position,dragging:i}:s[0],s]}function f2e({dragItems:n,snapGrid:e,x:t,y:i}){const s=n.values().next().value;if(!s)return null;const o={x:t-s.distance.x,y:i-s.distance.y},r=GD(o,e);return{x:r.x-o.x,y:r.y-o.y}}function g2e({onNodeMouseDown:n,getStoreItems:e,onDragStart:t,onDrag:i,onDragStop:s}){let o={x:null,y:null},r=0,a=new Map,l=!1,c={x:0,y:0},d=null,u=!1,h=null,f=!1,g=!1,p=null;function m({noDragClassName:v,handleSelector:C,domNode:y,isSelectable:S,nodeId:x,nodeClickDistance:L=0}){h=Lc(y);function k({x:P,y:V}){const{nodeLookup:O,nodeExtent:A,snapGrid:z,snapToGrid:U,nodeOrigin:W,onNodeDrag:F,onSelectionDrag:q,onError:X,updateNodePositions:Q}=e();o={x:P,y:V};let oe=!1;const ge=a.size>1,ye=ge&&A?aH(KD(a)):null,$e=ge&&U?f2e({dragItems:a,snapGrid:z,x:P,y:V}):null;for(const[Ze,Ee]of a){if(!O.has(Ze))continue;let Je={x:P-Ee.distance.x,y:V-Ee.distance.y};U&&(Je=$e?{x:Math.round(Je.x+$e.x),y:Math.round(Je.y+$e.y)}:GD(Je,z));let lt=null;if(ge&&A&&!Ee.extent&&ye){const{positionAbsolute:Re}=Ee.internals,gt=Re.x-ye.x+A[0][0],si=Re.x+Ee.measured.width-ye.x2+A[1][0],Ke=Re.y-ye.y+A[0][1],ri=Re.y+Ee.measured.height-ye.y2+A[1][1];lt=[[gt,Ke],[si,ri]]}const{position:Ct,positionAbsolute:Oe}=Kge({nodeId:Ze,nextPosition:Je,nodeLookup:O,nodeExtent:lt||A,nodeOrigin:W,onError:X});oe=oe||Ee.position.x!==Ct.x||Ee.position.y!==Ct.y,Ee.position=Ct,Ee.internals.positionAbsolute=Oe}if(g=g||oe,!!oe&&(Q(a,!0),p&&(i||F||!x&&q))){const[Ze,Ee]=g6({nodeId:x,dragItems:a,nodeLookup:O});i==null||i(p,a,Ze,Ee),F==null||F(p,Ze,Ee),x||q==null||q(p,Ee)}}async function N(){if(!d)return;const{transform:P,panBy:V,autoPanSpeed:O,autoPanOnNodeDrag:A}=e();if(!A){l=!1,cancelAnimationFrame(r);return}const[z,U]=Yge(c,d,O);(z!==0||U!==0)&&(o.x=(o.x??0)-z/P[2],o.y=(o.y??0)-U/P[2],await V({x:z,y:U})&&k(o)),r=requestAnimationFrame(N)}function T(P){var ge;const{nodeLookup:V,multiSelectionActive:O,nodesDraggable:A,transform:z,snapGrid:U,snapToGrid:W,selectNodesOnDrag:F,onNodeDragStart:q,onSelectionDragStart:X,unselectNodesAndEdges:Q}=e();u=!0,(!F||!S)&&!O&&x&&((ge=V.get(x))!=null&&ge.selected||Q()),S&&F&&x&&(n==null||n(x));const oe=Jk(P.sourceEvent,{transform:z,snapGrid:U,snapToGrid:W,containerBounds:d});if(o=oe,a=h2e(V,A,oe,x),a.size>0&&(t||q||!x&&X)){const[ye,$e]=g6({nodeId:x,dragItems:a,nodeLookup:V});t==null||t(P.sourceEvent,a,ye,$e),q==null||q(P.sourceEvent,ye,$e),x||X==null||X(P.sourceEvent,$e)}}const M=kge().clickDistance(L).on("start",P=>{const{domNode:V,nodeDragThreshold:O,transform:A,snapGrid:z,snapToGrid:U}=e();d=(V==null?void 0:V.getBoundingClientRect())||null,f=!1,g=!1,p=P.sourceEvent,O===0&&T(P),o=Jk(P.sourceEvent,{transform:A,snapGrid:z,snapToGrid:U,containerBounds:d}),c=Nu(P.sourceEvent,d)}).on("drag",P=>{const{autoPanOnNodeDrag:V,transform:O,snapGrid:A,snapToGrid:z,nodeDragThreshold:U,nodeLookup:W}=e(),F=Jk(P.sourceEvent,{transform:O,snapGrid:A,snapToGrid:z,containerBounds:d});if(p=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||x&&!W.has(x))&&(f=!0),!f){if(!l&&V&&u&&(l=!0,N()),!u){const q=Nu(P.sourceEvent,d),X=q.x-c.x,Q=q.y-c.y;Math.sqrt(X*X+Q*Q)>U&&T(P)}(o.x!==F.xSnapped||o.y!==F.ySnapped)&&a&&u&&(c=Nu(P.sourceEvent,d),k(F))}}).on("end",P=>{if(!(!u||f)&&(l=!1,u=!1,cancelAnimationFrame(r),a.size>0)){const{nodeLookup:V,updateNodePositions:O,onNodeDragStop:A,onSelectionDragStop:z}=e();if(g&&(O(a,!1),g=!1),s||A||!x&&z){const[U,W]=g6({nodeId:x,dragItems:a,nodeLookup:V,dragging:!1});s==null||s(P.sourceEvent,a,U,W),A==null||A(P.sourceEvent,U,W),x||z==null||z(P.sourceEvent,W)}}}).filter(P=>{const V=P.target;return!P.button&&(!v||!Lie(V,`.${v}`,y))&&(!C||Lie(V,C,y))});h.call(M)}function b(){h==null||h.on(".drag",null)}return{update:m,destroy:b}}function p2e(n,e,t){const i=[],s={x:n.x-t,y:n.y-t,width:t*2,height:t*2};for(const o of e.values())VE(s,KS(o))>0&&i.push(o);return i}const m2e=250;function _2e(n,e,t,i){var a,l;let s=[],o=1/0;const r=p2e(n,t,e+m2e);for(const c of r){const d=[...((a=c.internals.handleBounds)==null?void 0:a.source)??[],...((l=c.internals.handleBounds)==null?void 0:l.target)??[]];for(const u of d){if(i.nodeId===u.nodeId&&i.type===u.type&&i.id===u.id)continue;const{x:h,y:f}=M0(c,u,u.position,!0),g=Math.sqrt(Math.pow(h-n.x,2)+Math.pow(f-n.y,2));g>e||(g1){const c=i.type==="source"?"target":"source";return s.find(d=>d.type===c)??s[0]}return s[0]}function dpe(n,e,t,i,s,o=!1){var c,d,u;const r=i.get(n);if(!r)return null;const a=s==="strict"?(c=r.internals.handleBounds)==null?void 0:c[e]:[...((d=r.internals.handleBounds)==null?void 0:d.source)??[],...((u=r.internals.handleBounds)==null?void 0:u.target)??[]],l=(t?a==null?void 0:a.find(h=>h.id===t):a==null?void 0:a[0])??null;return l&&o?{...l,...M0(r,l,l.position,!0)}:l}function upe(n,e){return n||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function b2e(n,e){let t=null;return e?t=!0:n&&!e&&(t=!1),t}const hpe=()=>!0;function v2e(n,{connectionMode:e,connectionRadius:t,handleId:i,nodeId:s,edgeUpdaterType:o,isTarget:r,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:h,cancelConnection:f,onConnectStart:g,onConnect:p,onConnectEnd:m,isValidConnection:b=hpe,onReconnectEnd:v,updateConnection:C,getTransform:y,getFromHandle:S,autoPanSpeed:x,dragThreshold:L=1,handleDomNode:k}){const N=Jge(n.target);let T=0,M;const{x:P,y:V}=Nu(n),O=upe(o,k),A=a==null?void 0:a.getBoundingClientRect();let z=!1;if(!A||!O)return;const U=dpe(s,O,i,l,e);if(!U)return;let W=Nu(n,A),F=!1,q=null,X=!1,Q=null;function oe(){if(!d||!A)return;const[Ct,Oe]=Yge(W,A,x);h({x:Ct,y:Oe}),T=requestAnimationFrame(oe)}const ge={...U,nodeId:s,type:O,position:U.position},ye=l.get(s);let Ze={inProgress:!0,isValid:null,from:M0(ye,ge,Wt.Left,!0),fromHandle:ge,fromPosition:ge.position,fromNode:ye,to:W,toHandle:null,toPosition:fie[ge.position],toNode:null,pointer:W};function Ee(){z=!0,C(Ze),g==null||g(n,{nodeId:s,handleId:i,handleType:O})}L===0&&Ee();function Je(Ct){if(!z){const{x:ri,y:Di}=Nu(Ct),Nn=ri-P,Ye=Di-V;if(!(Nn*Nn+Ye*Ye>L*L))return;Ee()}if(!S()||!ge){lt(Ct);return}const Oe=y();W=Nu(Ct,A),M=_2e(YD(W,Oe,!1,[1,1]),t,l,ge),F||(oe(),F=!0);const Re=fpe(Ct,{handle:M,connectionMode:e,fromNodeId:s,fromHandleId:i,fromType:r?"target":"source",isValidConnection:b,doc:N,lib:c,flowId:u,nodeLookup:l});Q=Re.handleDomNode,q=Re.connection,X=b2e(!!M,Re.isValid);const gt=l.get(s),si=gt?M0(gt,ge,Wt.Left,!0):Ze.from,Ke={...Ze,from:si,isValid:X,to:Re.toHandle&&X?YA({x:Re.toHandle.x,y:Re.toHandle.y},Oe):W,toHandle:Re.toHandle,toPosition:X&&Re.toHandle?Re.toHandle.position:fie[ge.position],toNode:Re.toHandle?l.get(Re.toHandle.nodeId):null,pointer:W};C(Ke),Ze=Ke}function lt(Ct){if(!("touches"in Ct&&Ct.touches.length>0)){if(z){(M||Q)&&q&&X&&(p==null||p(q));const{inProgress:Oe,...Re}=Ze,gt={...Re,toPosition:Ze.toHandle?Ze.toPosition:null};m==null||m(Ct,gt),o&&(v==null||v(Ct,gt))}f(),cancelAnimationFrame(T),F=!1,X=!1,q=null,Q=null,N.removeEventListener("mousemove",Je),N.removeEventListener("mouseup",lt),N.removeEventListener("touchmove",Je),N.removeEventListener("touchend",lt)}}N.addEventListener("mousemove",Je),N.addEventListener("mouseup",lt),N.addEventListener("touchmove",Je),N.addEventListener("touchend",lt)}function fpe(n,{handle:e,connectionMode:t,fromNodeId:i,fromHandleId:s,fromType:o,doc:r,lib:a,flowId:l,isValidConnection:c=hpe,nodeLookup:d}){const u=o==="target",h=e?r.querySelector(`.${a}-flow__handle[data-id="${l}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:f,y:g}=Nu(n),p=r.elementFromPoint(f,g),m=p!=null&&p.classList.contains(`${a}-flow__handle`)?p:h,b={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const v=upe(void 0,m),C=m.getAttribute("data-nodeid"),y=m.getAttribute("data-handleid"),S=m.classList.contains("connectable"),x=m.classList.contains("connectableend");if(!C||!v)return b;const L={source:u?C:i,sourceHandle:u?y:s,target:u?i:C,targetHandle:u?s:y};b.connection=L;const N=S&&x&&(t===US.Strict?u&&v==="source"||!u&&v==="target":C!==i||y!==s);b.isValid=N&&c(L),b.toHandle=dpe(C,v,y,d,t,!0)}return b}const uH={onPointerDown:v2e,isValid:fpe};function w2e({domNode:n,panZoom:e,getTransform:t,getViewScale:i}){const s=Lc(n);function o({translateExtent:a,width:l,height:c,zoomStep:d=1,pannable:u=!0,zoomable:h=!0,inversePan:f=!1}){const g=C=>{if(C.sourceEvent.type!=="wheel"||!e)return;const y=t(),S=C.sourceEvent.ctrlKey&&jE()?10:1,x=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*d,L=y[2]*Math.pow(2,x*S);e.scaleTo(L)};let p=[0,0];const m=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(p=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},b=C=>{const y=t();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!e)return;const S=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],x=[S[0]-p[0],S[1]-p[1]];p=S;const L=i()*Math.max(y[2],Math.log(y[2]))*(f?-1:1),k={x:y[0]-x[0]*L,y:y[1]-x[1]*L},N=[[0,0],[l,c]];e.setViewportConstrained({x:k.x,y:k.y,zoom:y[2]},N,a)},v=Vge().on("start",m).on("zoom",u?b:null).on("zoom.wheel",h?g:null);s.call(v,{})}function r(){s.on("zoom",null)}return{update:o,destroy:r,pointer:hu}}const A3=n=>({x:n.x,y:n.y,zoom:n.k}),p6=({x:n,y:e,zoom:t})=>T3.translate(n,e).scale(t),$C=(n,e)=>n.target.closest(`.${e}`),gpe=(n,e)=>e===2&&Array.isArray(n)&&n.includes(2),C2e=n=>((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2,m6=(n,e=0,t=C2e,i=()=>{})=>{const s=typeof e=="number"&&e>0;return s||i(),s?n.transition().duration(e).ease(t).on("end",i):n},ppe=n=>{const e=n.ctrlKey&&jE()?10:1;return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*e};function y2e({zoomPanValues:n,noWheelClassName:e,d3Selection:t,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:r,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if($C(d,e))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=t.property("__zoom").k||1;if(d.ctrlKey&&r){const m=hu(d),b=ppe(d),v=u*Math.pow(2,b);i.scaleTo(t,v,m,d);return}const h=d.deltaMode===1?20:1;let f=s===c1.Vertical?0:d.deltaX*h,g=s===c1.Horizontal?0:d.deltaY*h;!jE()&&d.shiftKey&&s!==c1.Vertical&&(f=d.deltaY*h,g=0),i.translateBy(t,-(f/u)*o,-(g/u)*o,{internal:!0});const p=A3(t.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling?(l==null||l(d,p),n.panScrollTimeout=setTimeout(()=>{c==null||c(d,p),n.isPanScrolling=!1},150)):(n.isPanScrolling=!0,a==null||a(d,p))}}function S2e({noWheelClassName:n,preventScrolling:e,d3ZoomHandler:t}){return function(i,s){const o=i.type==="wheel",r=!e&&o&&!i.ctrlKey,a=$C(i,n);if(i.ctrlKey&&o&&a&&i.preventDefault(),r||a)return null;i.preventDefault(),t.call(this,i,s)}}function x2e({zoomPanValues:n,onDraggingChange:e,onPanZoomStart:t}){return i=>{var o,r,a;if((o=i.sourceEvent)!=null&&o.internal)return;const s=A3(i.transform);n.mouseButton=((r=i.sourceEvent)==null?void 0:r.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=s,((a=i.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),t&&(t==null||t(i.sourceEvent,s))}}function L2e({zoomPanValues:n,panOnDrag:e,onPaneContextMenu:t,onTransformChange:i,onPanZoom:s}){return o=>{var r,a;n.usedRightMouseButton=!!(t&&gpe(e,n.mouseButton??0)),(r=o.sourceEvent)!=null&&r.sync||i([o.transform.x,o.transform.y,o.transform.k]),s&&!((a=o.sourceEvent)!=null&&a.internal)&&(s==null||s(o.sourceEvent,A3(o.transform)))}}function k2e({zoomPanValues:n,panOnDrag:e,panOnScroll:t,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:o}){return r=>{var a;if(!((a=r.sourceEvent)!=null&&a.internal)&&(n.isZoomingOrPanning=!1,o&&gpe(e,n.mouseButton??0)&&!n.usedRightMouseButton&&r.sourceEvent&&o(r.sourceEvent),n.usedRightMouseButton=!1,i(!1),s)){const l=A3(r.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout(()=>{s==null||s(r.sourceEvent,l)},t?150:0)}}}function N2e({zoomActivationKeyPressed:n,zoomOnScroll:e,zoomOnPinch:t,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:o,userSelectionActive:r,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:d}){return u=>{var m;const h=n||e,f=t&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&($C(u,`${c}-flow__node`)||$C(u,`${c}-flow__edge`)))return!0;if(!i&&!h&&!s&&!o&&!t||r||d&&!g||$C(u,a)&&g||$C(u,l)&&(!g||s&&g&&!n)||!t&&u.ctrlKey&&g)return!1;if(!t&&u.type==="touchstart"&&((m=u.touches)==null?void 0:m.length)>1)return u.preventDefault(),!1;if(!h&&!s&&!f&&g||!i&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(i)&&!i.includes(u.button)&&u.type==="mousedown")return!1;const p=Array.isArray(i)&&i.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&p}}function E2e({domNode:n,minZoom:e,maxZoom:t,translateExtent:i,viewport:s,onPanZoom:o,onPanZoomStart:r,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=n.getBoundingClientRect(),u=Vge().scaleExtent([e,t]).translateExtent(i),h=Lc(n).call(u);v({x:s.x,y:s.y,zoom:qS(s.zoom,e,t)},[[0,0],[d.width,d.height]],i);const f=h.on("wheel.zoom"),g=h.on("dblclick.zoom");u.wheelDelta(ppe);function p(M,P){return h?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Qk:wM).transform(m6(h,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function m({noWheelClassName:M,noPanClassName:P,onPaneContextMenu:V,userSelectionActive:O,panOnScroll:A,panOnDrag:z,panOnScrollMode:U,panOnScrollSpeed:W,preventScrolling:F,zoomOnPinch:q,zoomOnScroll:X,zoomOnDoubleClick:Q,zoomActivationKeyPressed:oe,lib:ge,onTransformChange:ye,connectionInProgress:$e,paneClickDistance:Ze,selectionOnDrag:Ee}){O&&!c.isZoomingOrPanning&&b();const Je=A&&!oe&&!O;u.clickDistance(Ee?1/0:!ku(Ze)||Ze<0?0:Ze);const lt=Je?y2e({zoomPanValues:c,noWheelClassName:M,d3Selection:h,d3Zoom:u,panOnScrollMode:U,panOnScrollSpeed:W,zoomOnPinch:q,onPanZoomStart:r,onPanZoom:o,onPanZoomEnd:a}):S2e({noWheelClassName:M,preventScrolling:F,d3ZoomHandler:f});if(h.on("wheel.zoom",lt,{passive:!1}),!O){const Oe=x2e({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:r});u.on("start",Oe);const Re=L2e({zoomPanValues:c,panOnDrag:z,onPaneContextMenu:!!V,onPanZoom:o,onTransformChange:ye});u.on("zoom",Re);const gt=k2e({zoomPanValues:c,panOnDrag:z,panOnScroll:A,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:l});u.on("end",gt)}const Ct=N2e({zoomActivationKeyPressed:oe,panOnDrag:z,zoomOnScroll:X,panOnScroll:A,zoomOnDoubleClick:Q,zoomOnPinch:q,userSelectionActive:O,noPanClassName:P,noWheelClassName:M,lib:ge,connectionInProgress:$e});u.filter(Ct),Q?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function b(){u.on("zoom",null)}async function v(M,P,V){const O=p6(M),A=u==null?void 0:u.constrain()(O,P,V);return A&&await p(A),new Promise(z=>z(A))}async function C(M,P){const V=p6(M);return await p(V,P),new Promise(O=>O(V))}function y(M){if(h){const P=p6(M),V=h.property("__zoom");(V.k!==M.zoom||V.x!==M.x||V.y!==M.y)&&(u==null||u.transform(h,P,null,{sync:!0}))}}function S(){const M=h?Hge(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function x(M,P){return h?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Qk:wM).scaleTo(m6(h,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function L(M,P){return h?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Qk:wM).scaleBy(m6(h,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function k(M){u==null||u.scaleExtent(M)}function N(M){u==null||u.translateExtent(M)}function T(M){const P=!ku(M)||M<0?0:M;u==null||u.clickDistance(P)}return{update:m,destroy:b,setViewport:C,setViewportConstrained:v,getViewport:S,scaleTo:x,scaleBy:L,setScaleExtent:k,setTranslateExtent:N,syncViewport:y,setClickDistance:T}}var YS;(function(n){n.Line="line",n.Handle="handle"})(YS||(YS={}));function I2e({width:n,prevWidth:e,height:t,prevHeight:i,affectsX:s,affectsY:o}){const r=n-e,a=t-i,l=[r>0?1:r<0?-1:0,a>0?1:a<0?-1:0];return r&&s&&(l[0]=l[0]*-1),a&&o&&(l[1]=l[1]*-1),l}function kie(n){const e=n.includes("right")||n.includes("left"),t=n.includes("bottom")||n.includes("top"),i=n.includes("left"),s=n.includes("top");return{isHorizontal:e,isVertical:t,affectsX:i,affectsY:s}}function Jp(n,e){return Math.max(0,e-n)}function em(n,e){return Math.max(0,n-e)}function w2(n,e,t){return Math.max(0,e-n,n-t)}function Nie(n,e){return n?!e:e}function D2e(n,e,t,i,s,o,r,a){let{affectsX:l,affectsY:c}=e;const{isHorizontal:d,isVertical:u}=e,h=d&&u,{xSnapped:f,ySnapped:g}=t,{minWidth:p,maxWidth:m,minHeight:b,maxHeight:v}=i,{x:C,y,width:S,height:x,aspectRatio:L}=n;let k=Math.floor(d?f-n.pointerX:0),N=Math.floor(u?g-n.pointerY:0);const T=S+(l?-k:k),M=x+(c?-N:N),P=-o[0]*S,V=-o[1]*x;let O=w2(T,p,m),A=w2(M,b,v);if(r){let W=0,F=0;l&&k<0?W=Jp(C+k+P,r[0][0]):!l&&k>0&&(W=em(C+T+P,r[1][0])),c&&N<0?F=Jp(y+N+V,r[0][1]):!c&&N>0&&(F=em(y+M+V,r[1][1])),O=Math.max(O,W),A=Math.max(A,F)}if(a){let W=0,F=0;l&&k>0?W=em(C+k,a[0][0]):!l&&k<0&&(W=Jp(C+T,a[1][0])),c&&N>0?F=em(y+N,a[0][1]):!c&&N<0&&(F=Jp(y+M,a[1][1])),O=Math.max(O,W),A=Math.max(A,F)}if(s){if(d){const W=w2(T/L,b,v)*L;if(O=Math.max(O,W),r){let F=0;!l&&!c||l&&!c&&h?F=em(y+V+T/L,r[1][1])*L:F=Jp(y+V+(l?k:-k)/L,r[0][1])*L,O=Math.max(O,F)}if(a){let F=0;!l&&!c||l&&!c&&h?F=Jp(y+T/L,a[1][1])*L:F=em(y+(l?k:-k)/L,a[0][1])*L,O=Math.max(O,F)}}if(u){const W=w2(M*L,p,m)/L;if(A=Math.max(A,W),r){let F=0;!l&&!c||c&&!l&&h?F=em(C+M*L+P,r[1][0])/L:F=Jp(C+(c?N:-N)*L+P,r[0][0])/L,A=Math.max(A,F)}if(a){let F=0;!l&&!c||c&&!l&&h?F=Jp(C+M*L,a[1][0])/L:F=em(C+(c?N:-N)*L,a[0][0])/L,A=Math.max(A,F)}}}N=N+(N<0?A:-A),k=k+(k<0?O:-O),s&&(h?T>M*L?N=(Nie(l,c)?-k:k)/L:k=(Nie(l,c)?-N:N)*L:d?(N=k/L,c=l):(k=N*L,l=c));const z=l?C+k:C,U=c?y+N:y;return{width:S+(l?-k:k),height:x+(c?-N:N),x:o[0]*k*(l?-1:1)+z,y:o[1]*N*(c?-1:1)+U}}const mpe={width:0,height:0,x:0,y:0},T2e={...mpe,pointerX:0,pointerY:0,aspectRatio:1};function R2e(n){return[[0,0],[n.measured.width,n.measured.height]]}function M2e(n,e,t){const i=e.position.x+n.position.x,s=e.position.y+n.position.y,o=n.measured.width??0,r=n.measured.height??0,a=t[0]*o,l=t[1]*r;return[[i-a,s-l],[i+o-a,s+r-l]]}function A2e({domNode:n,nodeId:e,getStoreItems:t,onChange:i,onEnd:s}){const o=Lc(n);let r={controlDirection:kie("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:d,keepAspectRatio:u,resizeDirection:h,onResizeStart:f,onResize:g,onResizeEnd:p,shouldResize:m}){let b={...mpe},v={...T2e};r={boundaries:d,resizeDirection:h,keepAspectRatio:u,controlDirection:kie(c)};let C,y=null,S=[],x,L,k,N=!1;const T=kge().on("start",M=>{const{nodeLookup:P,transform:V,snapGrid:O,snapToGrid:A,nodeOrigin:z,paneDomNode:U}=t();if(C=P.get(e),!C)return;y=(U==null?void 0:U.getBoundingClientRect())??null;const{xSnapped:W,ySnapped:F}=Jk(M.sourceEvent,{transform:V,snapGrid:O,snapToGrid:A,containerBounds:y});b={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},v={...b,pointerX:W,pointerY:F,aspectRatio:b.width/b.height},x=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(x=P.get(C.parentId),L=x&&C.extent==="parent"?R2e(x):void 0),S=[],k=void 0;for(const[q,X]of P)if(X.parentId===e&&(S.push({id:q,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const Q=M2e(X,C,X.origin??z);k?k=[[Math.min(Q[0][0],k[0][0]),Math.min(Q[0][1],k[0][1])],[Math.max(Q[1][0],k[1][0]),Math.max(Q[1][1],k[1][1])]]:k=Q}f==null||f(M,{...b})}).on("drag",M=>{const{transform:P,snapGrid:V,snapToGrid:O,nodeOrigin:A}=t(),z=Jk(M.sourceEvent,{transform:P,snapGrid:V,snapToGrid:O,containerBounds:y}),U=[];if(!C)return;const{x:W,y:F,width:q,height:X}=b,Q={},oe=C.origin??A,{width:ge,height:ye,x:$e,y:Ze}=D2e(v,r.controlDirection,z,r.boundaries,r.keepAspectRatio,oe,L,k),Ee=ge!==q,Je=ye!==X,lt=$e!==W&&Ee,Ct=Ze!==F&&Je;if(!lt&&!Ct&&!Ee&&!Je)return;if((lt||Ct||oe[0]===1||oe[1]===1)&&(Q.x=lt?$e:b.x,Q.y=Ct?Ze:b.y,b.x=Q.x,b.y=Q.y,S.length>0)){const si=$e-W,Ke=Ze-F;for(const ri of S)ri.position={x:ri.position.x-si+oe[0]*(ge-q),y:ri.position.y-Ke+oe[1]*(ye-X)},U.push(ri)}if((Ee||Je)&&(Q.width=Ee&&(!r.resizeDirection||r.resizeDirection==="horizontal")?ge:b.width,Q.height=Je&&(!r.resizeDirection||r.resizeDirection==="vertical")?ye:b.height,b.width=Q.width,b.height=Q.height),x&&C.expandParent){const si=oe[0]*(Q.width??0);Q.x&&Q.x{N&&(p==null||p(M,{...b}),s==null||s({...b}),N=!1)});o.call(T)}function l(){o.on(".drag",null)}return{update:a,destroy:l}}var _pe={exports:{}},bpe={},vpe={exports:{}},wpe={};/**
+`+o.stack}return{value:n,source:e,stack:s,digest:null}}function r6(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function WW(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var TNe=typeof WeakMap=="function"?WeakMap:Map;function Bfe(n,e,t){t=Yg(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){FA||(FA=!0,YW=i),WW(n,e)},t}function Wfe(n,e,t){t=Yg(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var s=e.value;t.payload=function(){return i(s)},t.callback=function(){WW(n,e)}}var o=n.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(t.callback=function(){WW(n,e),typeof i!="function"&&(d_===null?d_=new Set([this]):d_.add(this));var r=e.stack;this.componentDidCatch(e.value,{componentStack:r!==null?r:""})}),t}function Dte(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new TNe;var s=new Set;i.set(e,s)}else s=i.get(e),s===void 0&&(s=new Set,i.set(e,s));s.has(t)||(s.add(t),n=UNe.bind(null,n,e,t),e.then(n,n))}function Tte(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function Rte(n,e,t,i,s){return n.mode&1?(n.flags|=65536,n.lanes=s,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Yg(-1,1),e.tag=2,c_(t,e,1))),t.lanes|=1),n)}var RNe=Op.ReactCurrentOwner,$l=!1;function Xa(n,e,t,i){e.child=n===null?gfe(e,null,t,i):WS(e,n.child,t,i)}function Mte(n,e,t,i,s){t=t.render;var o=e.ref;return By(e,s),i=mY(n,e,t,i,o,s),t=_Y(),n!==null&&!$l?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~s,gp(n,e,s)):(Ts&&t&&sY(e),e.flags|=1,Xa(n,e,i,s),e.child)}function Ate(n,e,t,i,s){if(n===null){var o=t.type;return typeof o=="function"&&!NY(o)&&o.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=o,Hfe(n,e,o,i,s)):(n=bM(t.type,null,i,e,e.mode,s),n.ref=e.ref,n.return=e,e.child=n)}if(o=n.child,!(n.lanes&s)){var r=o.memoizedProps;if(t=t.compare,t=t!==null?t:LE,t(r,i)&&n.ref===e.ref)return gp(n,e,s)}return e.flags|=1,n=h_(o,i),n.ref=e.ref,n.return=e,e.child=n}function Hfe(n,e,t,i,s){if(n!==null){var o=n.memoizedProps;if(LE(o,i)&&n.ref===e.ref)if($l=!1,e.pendingProps=i=o,(n.lanes&s)!==0)n.flags&131072&&($l=!0);else return e.lanes=n.lanes,gp(n,e,s)}return HW(n,e,t,i,s)}function Vfe(n,e,t){var i=e.pendingProps,s=i.children,o=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Cs(zC,vc),vc|=t;else{if(!(t&1073741824))return n=o!==null?o.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,Cs(zC,vc),vc|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=o!==null?o.baseLanes:t,Cs(zC,vc),vc|=i}else o!==null?(i=o.baseLanes|t,e.memoizedState=null):i=t,Cs(zC,vc),vc|=i;return Xa(n,e,s,t),e.child}function jfe(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function HW(n,e,t,i,s){var o=Zl(t)?x0:Ta.current;return o=FS(e,o),By(e,s),t=mY(n,e,t,i,o,s),i=_Y(),n!==null&&!$l?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~s,gp(n,e,s)):(Ts&&i&&sY(e),e.flags|=1,Xa(n,e,t,s),e.child)}function Pte(n,e,t,i,s){if(Zl(t)){var o=!0;NA(e)}else o=!1;if(By(e,s),e.stateNode===null)pM(n,e),Ffe(e,t,i),BW(e,t,i,s),i=!0;else if(n===null){var r=e.stateNode,a=e.memoizedProps;r.props=a;var l=r.context,c=t.contextType;typeof c=="object"&&c!==null?c=Pd(c):(c=Zl(t)?x0:Ta.current,c=FS(e,c));var d=t.getDerivedStateFromProps,u=typeof d=="function"||typeof r.getSnapshotBeforeUpdate=="function";u||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(a!==i||l!==c)&&Ite(e,r,i,c),gm=!1;var h=e.memoizedState;r.state=h,RA(e,i,r,s),l=e.memoizedState,a!==i||h!==l||Yl.current||gm?(typeof d=="function"&&(FW(e,t,d,i),l=e.memoizedState),(a=gm||Ete(e,t,a,i,h,l,c))?(u||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount()),typeof r.componentDidMount=="function"&&(e.flags|=4194308)):(typeof r.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),r.props=i,r.state=l,r.context=c,i=a):(typeof r.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{r=e.stateNode,mfe(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:lu(e.type,a),r.props=c,u=e.pendingProps,h=r.context,l=t.contextType,typeof l=="object"&&l!==null?l=Pd(l):(l=Zl(t)?x0:Ta.current,l=FS(e,l));var f=t.getDerivedStateFromProps;(d=typeof f=="function"||typeof r.getSnapshotBeforeUpdate=="function")||typeof r.UNSAFE_componentWillReceiveProps!="function"&&typeof r.componentWillReceiveProps!="function"||(a!==u||h!==l)&&Ite(e,r,i,l),gm=!1,h=e.memoizedState,r.state=h,RA(e,i,r,s);var g=e.memoizedState;a!==u||h!==g||Yl.current||gm?(typeof f=="function"&&(FW(e,t,f,i),g=e.memoizedState),(c=gm||Ete(e,t,c,i,h,g,l)||!1)?(d||typeof r.UNSAFE_componentWillUpdate!="function"&&typeof r.componentWillUpdate!="function"||(typeof r.componentWillUpdate=="function"&&r.componentWillUpdate(i,g,l),typeof r.UNSAFE_componentWillUpdate=="function"&&r.UNSAFE_componentWillUpdate(i,g,l)),typeof r.componentDidUpdate=="function"&&(e.flags|=4),typeof r.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof r.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=g),r.props=i,r.state=g,r.context=l,i=c):(typeof r.componentDidUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=4),typeof r.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&h===n.memoizedState||(e.flags|=1024),i=!1)}return VW(n,e,t,i,o,s)}function VW(n,e,t,i,s,o){jfe(n,e);var r=(e.flags&128)!==0;if(!i&&!r)return s&&wte(e,t,!1),gp(n,e,o);i=e.stateNode,RNe.current=e;var a=r&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&r?(e.child=WS(e,n.child,null,o),e.child=WS(e,null,a,o)):Xa(n,e,a,o),e.memoizedState=i.state,s&&wte(e,t,!0),e.child}function zfe(n){var e=n.stateNode;e.pendingContext?vte(n,e.pendingContext,e.pendingContext!==e.context):e.context&&vte(n,e.context,!1),hY(n,e.containerInfo)}function Ote(n,e,t,i,s){return BS(),rY(s),e.flags|=256,Xa(n,e,t,i),e.child}var jW={dehydrated:null,treeContext:null,retryLane:0};function zW(n){return{baseLanes:n,cachePool:null,transitions:null}}function $fe(n,e,t){var i=e.pendingProps,s=qs.current,o=!1,r=(e.flags&128)!==0,a;if((a=r)||(a=n!==null&&n.memoizedState===null?!1:(s&2)!==0),a?(o=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(s|=1),Cs(qs,s&1),n===null)return PW(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(r=i.children,n=i.fallback,o?(i=e.mode,o=e.child,r={mode:"hidden",children:r},!(i&1)&&o!==null?(o.childLanes=0,o.pendingProps=r):o=C3(r,i,0,null),n=a1(n,i,t,null),o.return=e,n.return=e,o.sibling=n,e.child=o,e.child.memoizedState=zW(t),e.memoizedState=jW,n):wY(e,r));if(s=n.memoizedState,s!==null&&(a=s.dehydrated,a!==null))return MNe(n,e,r,i,a,s,t);if(o){o=i.fallback,r=e.mode,s=n.child,a=s.sibling;var l={mode:"hidden",children:i.children};return!(r&1)&&e.child!==s?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=h_(s,l),i.subtreeFlags=s.subtreeFlags&14680064),a!==null?o=h_(a,o):(o=a1(o,r,t,null),o.flags|=2),o.return=e,i.return=e,i.sibling=o,e.child=i,i=o,o=e.child,r=n.child.memoizedState,r=r===null?zW(t):{baseLanes:r.baseLanes|t,cachePool:null,transitions:r.transitions},o.memoizedState=r,o.childLanes=n.childLanes&~t,e.memoizedState=jW,i}return o=n.child,n=o.sibling,i=h_(o,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function wY(n,e){return e=C3({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function d2(n,e,t,i){return i!==null&&rY(i),WS(e,n.child,null,t),n=wY(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function MNe(n,e,t,i,s,o,r){if(t)return e.flags&256?(e.flags&=-257,i=r6(Error(et(422))),d2(n,e,r,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(o=i.fallback,s=e.mode,i=C3({mode:"visible",children:i.children},s,0,null),o=a1(o,s,r,null),o.flags|=2,i.return=e,o.return=e,i.sibling=o,e.child=i,e.mode&1&&WS(e,n.child,null,r),e.child.memoizedState=zW(r),e.memoizedState=jW,o);if(!(e.mode&1))return d2(n,e,r,null);if(s.data==="$!"){if(i=s.nextSibling&&s.nextSibling.dataset,i)var a=i.dgst;return i=a,o=Error(et(419)),i=r6(o,i,void 0),d2(n,e,r,i)}if(a=(r&n.childLanes)!==0,$l||a){if(i=Mr,i!==null){switch(r&-r){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(i.suspendedLanes|r)?0:s,s!==0&&s!==o.retryLane&&(o.retryLane=s,fp(n,s),Au(i,n,s,-1))}return kY(),i=r6(Error(et(421))),d2(n,e,r,i)}return s.data==="$?"?(e.flags|=128,e.child=n.child,e=qNe.bind(null,n),s._reactRetry=e,null):(n=o.treeContext,Mc=l_(s.nextSibling),Pc=e,Ts=!0,mu=null,n!==null&&(Cd[yd++]=Ig,Cd[yd++]=Dg,Cd[yd++]=L0,Ig=n.id,Dg=n.overflow,L0=e),e=wY(e,i.children),e.flags|=4096,e)}function Fte(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),OW(n.return,e,t)}function a6(n,e,t,i,s){var o=n.memoizedState;o===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:s}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=i,o.tail=t,o.tailMode=s)}function Ufe(n,e,t){var i=e.pendingProps,s=i.revealOrder,o=i.tail;if(Xa(n,e,i.children,t),i=qs.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Fte(n,t,e);else if(n.tag===19)Fte(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(Cs(qs,i),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(t=e.child,s=null;t!==null;)n=t.alternate,n!==null&&MA(n)===null&&(s=t),t=t.sibling;t=s,t===null?(s=e.child,e.child=null):(s=t.sibling,t.sibling=null),a6(e,!1,s,t,o);break;case"backwards":for(t=null,s=e.child,e.child=null;s!==null;){if(n=s.alternate,n!==null&&MA(n)===null){e.child=s;break}n=s.sibling,s.sibling=t,t=s,s=n}a6(e,!0,t,null,o);break;case"together":a6(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function pM(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function gp(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),N0|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(et(153));if(e.child!==null){for(n=e.child,t=h_(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=h_(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function ANe(n,e,t){switch(e.tag){case 3:zfe(e),BS();break;case 5:_fe(e);break;case 1:Zl(e.type)&&NA(e);break;case 4:hY(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,s=e.memoizedProps.value;Cs(DA,i._currentValue),i._currentValue=s;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(Cs(qs,qs.current&1),e.flags|=128,null):t&e.child.childLanes?$fe(n,e,t):(Cs(qs,qs.current&1),n=gp(n,e,t),n!==null?n.sibling:null);Cs(qs,qs.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return Ufe(n,e,t);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Cs(qs,qs.current),i)break;return null;case 22:case 23:return e.lanes=0,Vfe(n,e,t)}return gp(n,e,t)}var qfe,$W,Kfe,Gfe;qfe=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};$W=function(){};Kfe=function(n,e,t,i){var s=n.memoizedProps;if(s!==i){n=e.stateNode,Bv(nf.current);var o=null;switch(t){case"input":s=hW(n,s),i=hW(n,i),o=[];break;case"select":s=to({},s,{value:void 0}),i=to({},i,{value:void 0}),o=[];break;case"textarea":s=pW(n,s),i=pW(n,i),o=[];break;default:typeof s.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=LA)}_W(t,i);var r;t=null;for(c in s)if(!i.hasOwnProperty(c)&&s.hasOwnProperty(c)&&s[c]!=null)if(c==="style"){var a=s[c];for(r in a)a.hasOwnProperty(r)&&(t||(t={}),t[r]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(bE.hasOwnProperty(c)?o||(o=[]):(o=o||[]).push(c,null));for(c in i){var l=i[c];if(a=s!=null?s[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(r in a)!a.hasOwnProperty(r)||l&&l.hasOwnProperty(r)||(t||(t={}),t[r]="");for(r in l)l.hasOwnProperty(r)&&a[r]!==l[r]&&(t||(t={}),t[r]=l[r])}else t||(o||(o=[]),o.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(o=o||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(bE.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&xs("scroll",n),o||a===l||(o=[])):(o=o||[]).push(c,l))}t&&(o=o||[]).push("style",t);var c=o;(e.updateQueue=c)&&(e.flags|=4)}};Gfe=function(n,e,t,i){t!==i&&(e.flags|=4)};function xL(n,e){if(!Ts)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function ba(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var s=n.child;s!==null;)t|=s.lanes|s.childLanes,i|=s.subtreeFlags&14680064,i|=s.flags&14680064,s.return=n,s=s.sibling;else for(s=n.child;s!==null;)t|=s.lanes|s.childLanes,i|=s.subtreeFlags,i|=s.flags,s.return=n,s=s.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function PNe(n,e,t){var i=e.pendingProps;switch(oY(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ba(e),null;case 1:return Zl(e.type)&&kA(),ba(e),null;case 3:return i=e.stateNode,HS(),ks(Yl),ks(Ta),gY(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(l2(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,mu!==null&&(QW(mu),mu=null))),$W(n,e),ba(e),null;case 5:fY(e);var s=Bv(DE.current);if(t=e.type,n!==null&&e.stateNode!=null)Kfe(n,e,t,i,s),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(et(166));return ba(e),null}if(n=Bv(nf.current),l2(e)){i=e.stateNode,t=e.type;var o=e.memoizedProps;switch(i[Wh]=e,i[EE]=o,n=(e.mode&1)!==0,t){case"dialog":xs("cancel",i),xs("close",i);break;case"iframe":case"object":case"embed":xs("load",i);break;case"video":case"audio":for(s=0;s<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=r.createElement(t,{is:i.is}):(n=r.createElement(t),t==="select"&&(r=n,i.multiple?r.multiple=!0:i.size&&(r.size=i.size))):n=r.createElementNS(n,t),n[Wh]=e,n[EE]=i,qfe(n,e,!1,!1),e.stateNode=n;e:{switch(r=bW(t,i),t){case"dialog":xs("cancel",n),xs("close",n),s=i;break;case"iframe":case"object":case"embed":xs("load",n),s=i;break;case"video":case"audio":for(s=0;sjS&&(e.flags|=128,i=!0,xL(o,!1),e.lanes=4194304)}else{if(!i)if(n=MA(r),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),xL(o,!0),o.tail===null&&o.tailMode==="hidden"&&!r.alternate&&!Ts)return ba(e),null}else 2*yo()-o.renderingStartTime>jS&&t!==1073741824&&(e.flags|=128,i=!0,xL(o,!1),e.lanes=4194304);o.isBackwards?(r.sibling=e.child,e.child=r):(t=o.last,t!==null?t.sibling=r:e.child=r,o.last=r)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=yo(),e.sibling=null,t=qs.current,Cs(qs,i?t&1|2:t&1),e):(ba(e),null);case 22:case 23:return LY(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?vc&1073741824&&(ba(e),e.subtreeFlags&6&&(e.flags|=8192)):ba(e),null;case 24:return null;case 25:return null}throw Error(et(156,e.tag))}function ONe(n,e){switch(oY(e),e.tag){case 1:return Zl(e.type)&&kA(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return HS(),ks(Yl),ks(Ta),gY(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return fY(e),null;case 13:if(ks(qs),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(et(340));BS()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return ks(qs),null;case 4:return HS(),null;case 10:return cY(e.type._context),null;case 22:case 23:return LY(),null;case 24:return null;default:return null}}var u2=!1,La=!1,FNe=typeof WeakSet=="function"?WeakSet:Set,kt=null;function jC(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){lo(n,e,i)}else t.current=null}function UW(n,e,t){try{t()}catch(i){lo(n,e,i)}}var Bte=!1;function BNe(n,e){if(EW=yA,n=Jhe(),nY(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var s=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{t.nodeType,o.nodeType}catch{t=null;break e}var r=0,a=-1,l=-1,c=0,d=0,u=n,h=null;t:for(;;){for(var f;u!==t||s!==0&&u.nodeType!==3||(a=r+s),u!==o||i!==0&&u.nodeType!==3||(l=r+i),u.nodeType===3&&(r+=u.nodeValue.length),(f=u.firstChild)!==null;)h=u,u=f;for(;;){if(u===n)break t;if(h===t&&++c===s&&(a=r),h===o&&++d===i&&(l=r),(f=u.nextSibling)!==null)break;u=h,h=u.parentNode}u=f}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(IW={focusedElem:n,selectionRange:t},yA=!1,kt=e;kt!==null;)if(e=kt,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,kt=n;else for(;kt!==null;){e=kt;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var p=g.memoizedProps,_=g.memoizedState,b=e.stateNode,v=b.getSnapshotBeforeUpdate(e.elementType===e.type?p:lu(e.type,p),_);b.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var C=e.stateNode.containerInfo;C.nodeType===1?C.textContent="":C.nodeType===9&&C.documentElement&&C.removeChild(C.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(et(163))}}catch(y){lo(e,e.return,y)}if(n=e.sibling,n!==null){n.return=e.return,kt=n;break}kt=e.return}return g=Bte,Bte=!1,g}function Yk(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var s=i=i.next;do{if((s.tag&n)===n){var o=s.destroy;s.destroy=void 0,o!==void 0&&UW(e,t,o)}s=s.next}while(s!==i)}}function v3(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function qW(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function Yfe(n){var e=n.alternate;e!==null&&(n.alternate=null,Yfe(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Wh],delete e[EE],delete e[RW],delete e[wNe],delete e[CNe])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function Zfe(n){return n.tag===5||n.tag===3||n.tag===4}function Wte(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Zfe(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function KW(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=LA));else if(i!==4&&(n=n.child,n!==null))for(KW(n,e,t),n=n.sibling;n!==null;)KW(n,e,t),n=n.sibling}function GW(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(GW(n,e,t),n=n.sibling;n!==null;)GW(n,e,t),n=n.sibling}var Kr=null,uu=!1;function Qp(n,e,t){for(t=t.child;t!==null;)Xfe(n,e,t),t=t.sibling}function Xfe(n,e,t){if(tf&&typeof tf.onCommitFiberUnmount=="function")try{tf.onCommitFiberUnmount(u3,t)}catch{}switch(t.tag){case 5:La||jC(t,e);case 6:var i=Kr,s=uu;Kr=null,Qp(n,e,t),Kr=i,uu=s,Kr!==null&&(uu?(n=Kr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Kr.removeChild(t.stateNode));break;case 18:Kr!==null&&(uu?(n=Kr,t=t.stateNode,n.nodeType===8?e6(n.parentNode,t):n.nodeType===1&&e6(n,t),SE(n)):e6(Kr,t.stateNode));break;case 4:i=Kr,s=uu,Kr=t.stateNode.containerInfo,uu=!0,Qp(n,e,t),Kr=i,uu=s;break;case 0:case 11:case 14:case 15:if(!La&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){s=i=i.next;do{var o=s,r=o.destroy;o=o.tag,r!==void 0&&(o&2||o&4)&&UW(t,e,r),s=s.next}while(s!==i)}Qp(n,e,t);break;case 1:if(!La&&(jC(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){lo(t,e,a)}Qp(n,e,t);break;case 21:Qp(n,e,t);break;case 22:t.mode&1?(La=(i=La)||t.memoizedState!==null,Qp(n,e,t),La=i):Qp(n,e,t);break;default:Qp(n,e,t)}}function Hte(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new FNe),e.forEach(function(i){var s=KNe.bind(null,n,i);t.has(i)||(t.add(i),i.then(s,s))})}}function Qd(n,e){var t=e.deletions;if(t!==null)for(var i=0;is&&(s=r),i&=~o}if(i=s,i=yo()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*HNe(i/1960))-i,10n?16:n,Bm===null)var i=!1;else{if(n=Bm,Bm=null,BA=0,Cn&6)throw Error(et(331));var s=Cn;for(Cn|=4,kt=n.current;kt!==null;){var o=kt,r=o.child;if(kt.flags&16){var a=o.deletions;if(a!==null){for(var l=0;lyo()-SY?r1(n,0):yY|=t),Xl(n,e)}function oge(n,e){e===0&&(n.mode&1?(e=i2,i2<<=1,!(i2&130023424)&&(i2=4194304)):e=1);var t=rl();n=fp(n,e),n!==null&&(HD(n,e,t),Xl(n,t))}function qNe(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),oge(n,t)}function KNe(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,s=n.memoizedState;s!==null&&(t=s.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(et(314))}i!==null&&i.delete(e),oge(n,t)}var rge;rge=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Yl.current)$l=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return $l=!1,ANe(n,e,t);$l=!!(n.flags&131072)}else $l=!1,Ts&&e.flags&1048576&&dfe(e,IA,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;pM(n,e),n=e.pendingProps;var s=FS(e,Ta.current);By(e,t),s=mY(null,e,i,n,s,t);var o=_Y();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Zl(i)?(o=!0,NA(e)):o=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,uY(e),s.updater=b3,e.stateNode=s,s._reactInternals=e,BW(e,i,n,t),e=VW(null,e,i,!0,o,t)):(e.tag=0,Ts&&o&&sY(e),Xa(null,e,s,t),e=e.child),e;case 16:i=e.elementType;e:{switch(pM(n,e),n=e.pendingProps,s=i._init,i=s(i._payload),e.type=i,s=e.tag=YNe(i),n=lu(i,n),s){case 0:e=HW(null,e,i,n,t);break e;case 1:e=Pte(null,e,i,n,t);break e;case 11:e=Mte(null,e,i,n,t);break e;case 14:e=Ate(null,e,i,lu(i.type,n),t);break e}throw Error(et(306,i,""))}return e;case 0:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:lu(i,s),HW(n,e,i,s,t);case 1:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:lu(i,s),Pte(n,e,i,s,t);case 3:e:{if(zfe(e),n===null)throw Error(et(387));i=e.pendingProps,o=e.memoizedState,s=o.element,mfe(n,e),RA(e,i,null,t);var r=e.memoizedState;if(i=r.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:r.cache,pendingSuspenseBoundaries:r.pendingSuspenseBoundaries,transitions:r.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){s=VS(Error(et(423)),e),e=Ote(n,e,i,t,s);break e}else if(i!==s){s=VS(Error(et(424)),e),e=Ote(n,e,i,t,s);break e}else for(Mc=l_(e.stateNode.containerInfo.firstChild),Pc=e,Ts=!0,mu=null,t=gfe(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(BS(),i===s){e=gp(n,e,t);break e}Xa(n,e,i,t)}e=e.child}return e;case 5:return _fe(e),n===null&&PW(e),i=e.type,s=e.pendingProps,o=n!==null?n.memoizedProps:null,r=s.children,DW(i,s)?r=null:o!==null&&DW(i,o)&&(e.flags|=32),jfe(n,e),Xa(n,e,r,t),e.child;case 6:return n===null&&PW(e),null;case 13:return $fe(n,e,t);case 4:return hY(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=WS(e,null,i,t):Xa(n,e,i,t),e.child;case 11:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:lu(i,s),Mte(n,e,i,s,t);case 7:return Xa(n,e,e.pendingProps,t),e.child;case 8:return Xa(n,e,e.pendingProps.children,t),e.child;case 12:return Xa(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,s=e.pendingProps,o=e.memoizedProps,r=s.value,Cs(DA,i._currentValue),i._currentValue=r,o!==null)if(Hu(o.value,r)){if(o.children===s.children&&!Yl.current){e=gp(n,e,t);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var a=o.dependencies;if(a!==null){r=o.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=Yg(-1,t&-t),l.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}o.lanes|=t,l=o.alternate,l!==null&&(l.lanes|=t),OW(o.return,t,e),a.lanes|=t;break}l=l.next}}else if(o.tag===10)r=o.type===e.type?null:o.child;else if(o.tag===18){if(r=o.return,r===null)throw Error(et(341));r.lanes|=t,a=r.alternate,a!==null&&(a.lanes|=t),OW(r,t,e),r=o.sibling}else r=o.child;if(r!==null)r.return=o;else for(r=o;r!==null;){if(r===e){r=null;break}if(o=r.sibling,o!==null){o.return=r.return,r=o;break}r=r.return}o=r}Xa(n,e,s.children,t),e=e.child}return e;case 9:return s=e.type,i=e.pendingProps.children,By(e,t),s=Pd(s),i=i(s),e.flags|=1,Xa(n,e,i,t),e.child;case 14:return i=e.type,s=lu(i,e.pendingProps),s=lu(i.type,s),Ate(n,e,i,s,t);case 15:return Hfe(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,s=e.pendingProps,s=e.elementType===i?s:lu(i,s),pM(n,e),e.tag=1,Zl(i)?(n=!0,NA(e)):n=!1,By(e,t),Ffe(e,i,s),BW(e,i,s,t),VW(null,e,i,!0,n,t);case 19:return Ufe(n,e,t);case 22:return Vfe(n,e,t)}throw Error(et(156,e.tag))};function age(n,e){return Ahe(n,e)}function GNe(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function kd(n,e,t,i){return new GNe(n,e,t,i)}function NY(n){return n=n.prototype,!(!n||!n.isReactComponent)}function YNe(n){if(typeof n=="function")return NY(n)?1:0;if(n!=null){if(n=n.$$typeof,n===qG)return 11;if(n===KG)return 14}return 2}function h_(n,e){var t=n.alternate;return t===null?(t=kd(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function bM(n,e,t,i,s,o){var r=2;if(i=n,typeof n=="function")NY(n)&&(r=1);else if(typeof n=="string")r=5;else e:switch(n){case MC:return a1(t.children,s,o,e);case UG:r=8,s|=8;break;case lW:return n=kd(12,t,e,s|2),n.elementType=lW,n.lanes=o,n;case cW:return n=kd(13,t,e,s),n.elementType=cW,n.lanes=o,n;case dW:return n=kd(19,t,e,s),n.elementType=dW,n.lanes=o,n;case _he:return C3(t,s,o,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case phe:r=10;break e;case mhe:r=9;break e;case qG:r=11;break e;case KG:r=14;break e;case fm:r=16,i=null;break e}throw Error(et(130,n==null?n:typeof n,""))}return e=kd(r,t,e,s),e.elementType=n,e.type=i,e.lanes=o,e}function a1(n,e,t,i){return n=kd(7,n,i,e),n.lanes=t,n}function C3(n,e,t,i){return n=kd(22,n,i,e),n.elementType=_he,n.lanes=t,n.stateNode={isHidden:!1},n}function l6(n,e,t){return n=kd(6,n,null,e),n.lanes=t,n}function c6(n,e,t){return e=kd(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function ZNe(n,e,t,i,s){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=z7(0),this.expirationTimes=z7(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=z7(0),this.identifierPrefix=i,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function EY(n,e,t,i,s,o,r,a,l){return n=new ZNe(n,e,t,a,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=kd(3,null,null,e),n.current=o,o.stateNode=n,o.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},uY(o),n}function XNe(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uge)}catch(n){console.error(n)}}uge(),uhe.exports=Zc;var k3=uhe.exports,Gte=k3;rW.createRoot=Gte.createRoot,rW.hydrateRoot=Gte.hydrateRoot;const iEe="modulepreload",nEe=function(n){return"/"+n},Yte={},hge=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),a=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));s=Promise.allSettled(t.map(l=>{if(l=nEe(l),l in Yte)return;Yte[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const u=document.createElement("link");if(u.rel=c?"stylesheet":iEe,c||(u.as="script"),u.crossOrigin="",u.href=l,a&&u.setAttribute("nonce",a),document.head.appendChild(u),c)return new Promise((h,f)=>{u.addEventListener("load",h),u.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(r){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r}return s.then(r=>{for(const a of r||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})};function Zo(n){if(typeof n=="string"||typeof n=="number")return""+n;let e="";if(Array.isArray(n))for(let t=0,i;t{}};function N3(){for(var n=0,e=arguments.length,t={},i;n=0&&(i=t.slice(s+1),t=t.slice(0,s)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}})}vM.prototype=N3.prototype={constructor:vM,on:function(n,e){var t=this._,i=oEe(n+"",t),s,o=-1,r=i.length;if(arguments.length<2){for(;++o0)for(var t=new Array(s),i=0,s,o;i=0&&(e=n.slice(0,t))!=="xmlns"&&(n=n.slice(t+1)),Xte.hasOwnProperty(e)?{space:Xte[e],local:n}:n}function aEe(n){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===JW&&e.documentElement.namespaceURI===JW?e.createElement(n):e.createElementNS(t,n)}}function lEe(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function fge(n){var e=E3(n);return(e.local?lEe:aEe)(e)}function cEe(){}function RY(n){return n==null?cEe:function(){return this.querySelector(n)}}function dEe(n){typeof n!="function"&&(n=RY(n));for(var e=this._groups,t=e.length,i=new Array(t),s=0;s=C&&(C=v+1);!(S=_[C])&&++C=0;)(r=i[s])&&(o&&r.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(r,o),o=r);return this}function PEe(n){n||(n=OEe);function e(u,h){return u&&h?n(u.__data__,h.__data__):!u-!h}for(var t=this._groups,i=t.length,s=new Array(i),o=0;oe?1:n>=e?0:NaN}function FEe(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function BEe(){return Array.from(this)}function WEe(){for(var n=this._groups,e=0,t=n.length;e1?this.each((e==null?ZEe:typeof e=="function"?QEe:XEe)(n,e,t??"")):zS(this.node(),n)}function zS(n,e){return n.style.getPropertyValue(e)||bge(n).getComputedStyle(n,null).getPropertyValue(e)}function eIe(n){return function(){delete this[n]}}function tIe(n,e){return function(){this[n]=e}}function iIe(n,e){return function(){var t=e.apply(this,arguments);t==null?delete this[n]:this[n]=t}}function nIe(n,e){return arguments.length>1?this.each((e==null?eIe:typeof e=="function"?iIe:tIe)(n,e)):this.node()[n]}function vge(n){return n.trim().split(/^|\s+/)}function MY(n){return n.classList||new wge(n)}function wge(n){this._node=n,this._names=vge(n.getAttribute("class")||"")}wge.prototype={add:function(n){var e=this._names.indexOf(n);e<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var e=this._names.indexOf(n);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function Cge(n,e){for(var t=MY(n),i=-1,s=e.length;++i=0&&(t=e.slice(i+1),e=e.slice(0,i)),{type:e,name:t}})}function TIe(n){return function(){var e=this.__on;if(e){for(var t=0,i=-1,s=e.length,o;t()=>n;function eH(n,{sourceEvent:e,subject:t,target:i,identifier:s,active:o,x:r,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:r,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}eH.prototype.on=function(){var n=this._.on.apply(this._,arguments);return n===this._?this:n};function VIe(n){return!n.ctrlKey&&!n.button}function jIe(){return this.parentNode}function zIe(n,e){return e??{x:n.x,y:n.y}}function $Ie(){return navigator.maxTouchPoints||"ontouchstart"in this}function Nge(){var n=VIe,e=jIe,t=zIe,i=$Ie,s={},o=N3("start","drag","end"),r=0,a,l,c,d,u=0;function h(y){y.on("mousedown.drag",f).filter(i).on("touchstart.drag",_).on("touchmove.drag",b,HIe).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(y,S){if(!(d||!n.call(this,y,S))){var x=C(this,e.call(this,y,S),y,S,"mouse");x&&(Lc(y.view).on("mousemove.drag",g,PE).on("mouseup.drag",p,PE),Lge(y.view),d6(y),c=!1,a=y.clientX,l=y.clientY,x("start",y))}}function g(y){if(Hy(y),!c){var S=y.clientX-a,x=y.clientY-l;c=S*S+x*x>u}s.mouse("drag",y)}function p(y){Lc(y.view).on("mousemove.drag mouseup.drag",null),kge(y.view,c),Hy(y),s.mouse("end",y)}function _(y,S){if(n.call(this,y,S)){var x=y.changedTouches,L=e.call(this,y,S),k=x.length,N,D;for(N=0;N>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?p2(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?p2(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=qIe.exec(n))?new Ul(e[1],e[2],e[3],1):(e=KIe.exec(n))?new Ul(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=GIe.exec(n))?p2(e[1],e[2],e[3],e[4]):(e=YIe.exec(n))?p2(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=ZIe.exec(n))?sie(e[1],e[2]/100,e[3]/100,1):(e=XIe.exec(n))?sie(e[1],e[2]/100,e[3]/100,e[4]):Qte.hasOwnProperty(n)?tie(Qte[n]):n==="transparent"?new Ul(NaN,NaN,NaN,0):null}function tie(n){return new Ul(n>>16&255,n>>8&255,n&255,1)}function p2(n,e,t,i){return i<=0&&(n=e=t=NaN),new Ul(n,e,t,i)}function eDe(n){return n instanceof UD||(n=I0(n)),n?(n=n.rgb(),new Ul(n.r,n.g,n.b,n.opacity)):new Ul}function tH(n,e,t,i){return arguments.length===1?eDe(n):new Ul(n,e,t,i??1)}function Ul(n,e,t,i){this.r=+n,this.g=+e,this.b=+t,this.opacity=+i}AY(Ul,tH,Ege(UD,{brighter(n){return n=n==null?jA:Math.pow(jA,n),new Ul(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?OE:Math.pow(OE,n),new Ul(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Ul(l1(this.r),l1(this.g),l1(this.b),zA(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:iie,formatHex:iie,formatHex8:tDe,formatRgb:nie,toString:nie}));function iie(){return`#${Wv(this.r)}${Wv(this.g)}${Wv(this.b)}`}function tDe(){return`#${Wv(this.r)}${Wv(this.g)}${Wv(this.b)}${Wv((isNaN(this.opacity)?1:this.opacity)*255)}`}function nie(){const n=zA(this.opacity);return`${n===1?"rgb(":"rgba("}${l1(this.r)}, ${l1(this.g)}, ${l1(this.b)}${n===1?")":`, ${n})`}`}function zA(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function l1(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function Wv(n){return n=l1(n),(n<16?"0":"")+n.toString(16)}function sie(n,e,t,i){return i<=0?n=e=t=NaN:t<=0||t>=1?n=e=NaN:e<=0&&(n=NaN),new xu(n,e,t,i)}function Ige(n){if(n instanceof xu)return new xu(n.h,n.s,n.l,n.opacity);if(n instanceof UD||(n=I0(n)),!n)return new xu;if(n instanceof xu)return n;n=n.rgb();var e=n.r/255,t=n.g/255,i=n.b/255,s=Math.min(e,t,i),o=Math.max(e,t,i),r=NaN,a=o-s,l=(o+s)/2;return a?(e===o?r=(t-i)/a+(t0&&l<1?0:r,new xu(r,a,l,n.opacity)}function iDe(n,e,t,i){return arguments.length===1?Ige(n):new xu(n,e,t,i??1)}function xu(n,e,t,i){this.h=+n,this.s=+e,this.l=+t,this.opacity=+i}AY(xu,iDe,Ege(UD,{brighter(n){return n=n==null?jA:Math.pow(jA,n),new xu(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?OE:Math.pow(OE,n),new xu(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,e=isNaN(n)||isNaN(this.s)?0:this.s,t=this.l,i=t+(t<.5?t:1-t)*e,s=2*t-i;return new Ul(u6(n>=240?n-240:n+120,s,i),u6(n,s,i),u6(n<120?n+240:n-120,s,i),this.opacity)},clamp(){return new xu(oie(this.h),m2(this.s),m2(this.l),zA(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const n=zA(this.opacity);return`${n===1?"hsl(":"hsla("}${oie(this.h)}, ${m2(this.s)*100}%, ${m2(this.l)*100}%${n===1?")":`, ${n})`}`}}));function oie(n){return n=(n||0)%360,n<0?n+360:n}function m2(n){return Math.max(0,Math.min(1,n||0))}function u6(n,e,t){return(n<60?e+(t-e)*n/60:n<180?t:n<240?e+(t-e)*(240-n)/60:e)*255}const PY=n=>()=>n;function nDe(n,e){return function(t){return n+t*e}}function sDe(n,e,t){return n=Math.pow(n,t),e=Math.pow(e,t)-n,t=1/t,function(i){return Math.pow(n+i*e,t)}}function oDe(n){return(n=+n)==1?Dge:function(e,t){return t-e?sDe(e,t,n):PY(isNaN(e)?t:e)}}function Dge(n,e){var t=e-n;return t?nDe(n,t):PY(isNaN(n)?e:n)}const $A=function n(e){var t=oDe(e);function i(s,o){var r=t((s=tH(s)).r,(o=tH(o)).r),a=t(s.g,o.g),l=t(s.b,o.b),c=Dge(s.opacity,o.opacity);return function(d){return s.r=r(d),s.g=a(d),s.b=l(d),s.opacity=c(d),s+""}}return i.gamma=n,i}(1);function rDe(n,e){e||(e=[]);var t=n?Math.min(e.length,n.length):0,i=e.slice(),s;return function(o){for(s=0;st&&(o=e.slice(t,o),a[r]?a[r]+=o:a[++r]=o),(i=i[0])===(s=s[0])?a[r]?a[r]+=s:a[++r]=s:(a[++r]=null,l.push({i:r,x:Rh(i,s)})),t=h6.lastIndex;return t180?d+=360:d-c>180&&(c+=360),h.push({i:u.push(s(u)+"rotate(",null,i)-2,x:Rh(c,d)})):d&&u.push(s(u)+"rotate("+d+i)}function a(c,d,u,h){c!==d?h.push({i:u.push(s(u)+"skewX(",null,i)-2,x:Rh(c,d)}):d&&u.push(s(u)+"skewX("+d+i)}function l(c,d,u,h,f,g){if(c!==u||d!==h){var p=f.push(s(f)+"scale(",null,",",null,")");g.push({i:p-4,x:Rh(c,u)},{i:p-2,x:Rh(d,h)})}else(u!==1||h!==1)&&f.push(s(f)+"scale("+u+","+h+")")}return function(c,d){var u=[],h=[];return c=n(c),d=n(d),o(c.translateX,c.translateY,d.translateX,d.translateY,u,h),r(c.rotate,d.rotate,u,h),a(c.skewX,d.skewX,u,h),l(c.scaleX,c.scaleY,d.scaleX,d.scaleY,u,h),c=d=null,function(f){for(var g=-1,p=h.length,_;++g=0&&n._call.call(void 0,e),n=n._next;--$S}function lie(){D0=(qA=BE.now())+I3,$S=_k=0;try{CDe()}finally{$S=0,SDe(),D0=0}}function yDe(){var n=BE.now(),e=n-qA;e>Age&&(I3-=e,qA=n)}function SDe(){for(var n,e=UA,t,i=1/0;e;)e._call?(i>e._time&&(i=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:UA=t);bk=n,sH(i)}function sH(n){if(!$S){_k&&(_k=clearTimeout(_k));var e=n-D0;e>24?(n<1/0&&(_k=setTimeout(lie,n-BE.now()-I3)),kL&&(kL=clearInterval(kL))):(kL||(qA=BE.now(),kL=setInterval(yDe,Age)),$S=1,Pge(lie))}}function cie(n,e,t){var i=new KA;return e=e==null?0:+e,i.restart(s=>{i.stop(),n(s+e)},e,t),i}var xDe=N3("start","end","cancel","interrupt"),LDe=[],Fge=0,die=1,oH=2,CM=3,uie=4,rH=5,yM=6;function D3(n,e,t,i,s,o){var r=n.__transition;if(!r)n.__transition={};else if(t in r)return;kDe(n,t,{name:e,index:i,group:s,on:xDe,tween:LDe,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Fge})}function FY(n,e){var t=Xu(n,e);if(t.state>Fge)throw new Error("too late; already scheduled");return t}function yf(n,e){var t=Xu(n,e);if(t.state>CM)throw new Error("too late; already running");return t}function Xu(n,e){var t=n.__transition;if(!t||!(t=t[e]))throw new Error("transition not found");return t}function kDe(n,e,t){var i=n.__transition,s;i[e]=t,t.timer=Oge(o,0,t.time);function o(c){t.state=die,t.timer.restart(r,t.delay,t.time),t.delay<=c&&r(c-t.delay)}function r(c){var d,u,h,f;if(t.state!==die)return l();for(d in i)if(f=i[d],f.name===t.name){if(f.state===CM)return cie(r);f.state===uie?(f.state=yM,f.timer.stop(),f.on.call("interrupt",n,n.__data__,f.index,f.group),delete i[d]):+doH&&i.state=0&&(e=e.slice(0,t)),!e||e==="start"})}function iTe(n,e,t){var i,s,o=tTe(e)?FY:yf;return function(){var r=o(this,n),a=r.on;a!==i&&(s=(i=a).copy()).on(e,t),r.on=s}}function nTe(n,e){var t=this._id;return arguments.length<2?Xu(this.node(),t).on.on(n):this.each(iTe(t,n,e))}function sTe(n){return function(){var e=this.parentNode;for(var t in this.__transition)if(+t!==n)return;e&&e.removeChild(this)}}function oTe(){return this.on("end.remove",sTe(this._id))}function rTe(n){var e=this._name,t=this._id;typeof n!="function"&&(n=RY(n));for(var i=this._groups,s=i.length,o=new Array(s),r=0;r()=>n;function TTe(n,{sourceEvent:e,target:t,transform:i,dispatch:s}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function Tg(n,e,t){this.k=n,this.x=e,this.y=t}Tg.prototype={constructor:Tg,scale:function(n){return n===1?this:new Tg(this.k*n,this.x,this.y)},translate:function(n,e){return n===0&e===0?this:new Tg(this.k,this.x+this.k*n,this.y+this.k*e)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var T3=new Tg(1,0,0);Vge.prototype=Tg.prototype;function Vge(n){for(;!n.__zoom;)if(!(n=n.parentNode))return T3;return n.__zoom}function f6(n){n.stopImmediatePropagation()}function NL(n){n.preventDefault(),n.stopImmediatePropagation()}function RTe(n){return(!n.ctrlKey||n.type==="wheel")&&!n.button}function MTe(){var n=this;return n instanceof SVGElement?(n=n.ownerSVGElement||n,n.hasAttribute("viewBox")?(n=n.viewBox.baseVal,[[n.x,n.y],[n.x+n.width,n.y+n.height]]):[[0,0],[n.width.baseVal.value,n.height.baseVal.value]]):[[0,0],[n.clientWidth,n.clientHeight]]}function hie(){return this.__zoom||T3}function ATe(n){return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function PTe(){return navigator.maxTouchPoints||"ontouchstart"in this}function OTe(n,e,t){var i=n.invertX(e[0][0])-t[0][0],s=n.invertX(e[1][0])-t[1][0],o=n.invertY(e[0][1])-t[0][1],r=n.invertY(e[1][1])-t[1][1];return n.translate(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r))}function jge(){var n=RTe,e=MTe,t=OTe,i=ATe,s=PTe,o=[0,1/0],r=[[-1/0,-1/0],[1/0,1/0]],a=250,l=wM,c=N3("start","zoom","end"),d,u,h,f=500,g=150,p=0,_=10;function b(O){O.property("__zoom",hie).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",D).filter(s).on("touchstart.zoom",M).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(O,A,z,U){var B=O.selection?O.selection():O;B.property("__zoom",hie),O!==B?S(O,A,z,U):B.interrupt().each(function(){x(this,arguments).event(U).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},b.scaleBy=function(O,A,z,U){b.scaleTo(O,function(){var B=this.__zoom.k,F=typeof A=="function"?A.apply(this,arguments):A;return B*F},z,U)},b.scaleTo=function(O,A,z,U){b.transform(O,function(){var B=e.apply(this,arguments),F=this.__zoom,q=z==null?y(B):typeof z=="function"?z.apply(this,arguments):z,Y=F.invert(q),Q=typeof A=="function"?A.apply(this,arguments):A;return t(C(v(F,Q),q,Y),B,r)},z,U)},b.translateBy=function(O,A,z,U){b.transform(O,function(){return t(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof z=="function"?z.apply(this,arguments):z),e.apply(this,arguments),r)},null,U)},b.translateTo=function(O,A,z,U,B){b.transform(O,function(){var F=e.apply(this,arguments),q=this.__zoom,Y=U==null?y(F):typeof U=="function"?U.apply(this,arguments):U;return t(T3.translate(Y[0],Y[1]).scale(q.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof z=="function"?-z.apply(this,arguments):-z),F,r)},U,B)};function v(O,A){return A=Math.max(o[0],Math.min(o[1],A)),A===O.k?O:new Tg(A,O.x,O.y)}function C(O,A,z){var U=A[0]-z[0]*O.k,B=A[1]-z[1]*O.k;return U===O.x&&B===O.y?O:new Tg(O.k,U,B)}function y(O){return[(+O[0][0]+ +O[1][0])/2,(+O[0][1]+ +O[1][1])/2]}function S(O,A,z,U){O.on("start.zoom",function(){x(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(U).end()}).tween("zoom",function(){var B=this,F=arguments,q=x(B,F).event(U),Y=e.apply(B,F),Q=z==null?y(Y):typeof z=="function"?z.apply(B,F):z,ne=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),he=B.__zoom,Ce=typeof A=="function"?A.apply(B,F):A,ze=l(he.invert(Q).concat(ne/he.k),Ce.invert(Q).concat(ne/Ce.k));return function(Oe){if(Oe===1)Oe=Ce;else{var Se=ze(Oe),je=ne/Se[2];Oe=new Tg(je,Q[0]-Se[0]*je,Q[1]-Se[1]*je)}q.zoom(null,Oe)}})}function x(O,A,z){return!z&&O.__zooming||new L(O,A)}function L(O,A){this.that=O,this.args=A,this.active=0,this.sourceEvent=null,this.extent=e.apply(O,A),this.taps=0}L.prototype={event:function(O){return O&&(this.sourceEvent=O),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(O,A){return this.mouse&&O!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&O!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&O!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(O){var A=Lc(this.that).datum();c.call(O,this.that,new TTe(O,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:c}),A)}};function k(O,...A){if(!n.apply(this,arguments))return;var z=x(this,A).event(O),U=this.__zoom,B=Math.max(o[0],Math.min(o[1],U.k*Math.pow(2,i.apply(this,arguments)))),F=hu(O);if(z.wheel)(z.mouse[0][0]!==F[0]||z.mouse[0][1]!==F[1])&&(z.mouse[1]=U.invert(z.mouse[0]=F)),clearTimeout(z.wheel);else{if(U.k===B)return;z.mouse=[F,U.invert(F)],SM(this),z.start()}NL(O),z.wheel=setTimeout(q,g),z.zoom("mouse",t(C(v(U,B),z.mouse[0],z.mouse[1]),z.extent,r));function q(){z.wheel=null,z.end()}}function N(O,...A){if(h||!n.apply(this,arguments))return;var z=O.currentTarget,U=x(this,A,!0).event(O),B=Lc(O.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",ne,!0),F=hu(O,z),q=O.clientX,Y=O.clientY;Lge(O.view),f6(O),U.mouse=[F,this.__zoom.invert(F)],SM(this),U.start();function Q(he){if(NL(he),!U.moved){var Ce=he.clientX-q,ze=he.clientY-Y;U.moved=Ce*Ce+ze*ze>p}U.event(he).zoom("mouse",t(C(U.that.__zoom,U.mouse[0]=hu(he,z),U.mouse[1]),U.extent,r))}function ne(he){B.on("mousemove.zoom mouseup.zoom",null),kge(he.view,U.moved),NL(he),U.event(he).end()}}function D(O,...A){if(n.apply(this,arguments)){var z=this.__zoom,U=hu(O.changedTouches?O.changedTouches[0]:O,this),B=z.invert(U),F=z.k*(O.shiftKey?.5:2),q=t(C(v(z,F),U,B),e.apply(this,A),r);NL(O),a>0?Lc(this).transition().duration(a).call(S,q,U,O):Lc(this).call(b.transform,q,U,O)}}function M(O,...A){if(n.apply(this,arguments)){var z=O.touches,U=z.length,B=x(this,A,O.changedTouches.length===U).event(O),F,q,Y,Q;for(f6(O),q=0;q"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:n=>`Node type "${n}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:n=>`The old edge with id=${n} does not exist.`,error009:n=>`Marker type "${n}" doesn't exist.`,error008:(n,{id:e,sourceHandle:t,targetHandle:i})=>`Couldn't create edge for ${n} handle id: "${n==="source"?t:i}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:n=>`Edge type "${n}" not found. Using fallback type "default".`,error012:n=>`Node with id "${n}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(n="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${n}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},WE=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],zge=["Enter"," ","Escape"],$ge={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:n,x:e,y:t})=>`Moved selected node ${n}. New position, x: ${e}, y: ${t}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var US;(function(n){n.Strict="strict",n.Loose="loose"})(US||(US={}));var c1;(function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"})(c1||(c1={}));var HE;(function(n){n.Partial="partial",n.Full="full"})(HE||(HE={}));const Uge={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Cg;(function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"})(Cg||(Cg={}));var T0;(function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"})(T0||(T0={}));var Wt;(function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"})(Wt||(Wt={}));const fie={[Wt.Left]:Wt.Right,[Wt.Right]:Wt.Left,[Wt.Top]:Wt.Bottom,[Wt.Bottom]:Wt.Top};function qge(n){return n===null?null:n?"valid":"invalid"}const Kge=n=>"id"in n&&"source"in n&&"target"in n,FTe=n=>"id"in n&&"position"in n&&!("source"in n)&&!("target"in n),WY=n=>"id"in n&&"internals"in n&&!("source"in n)&&!("target"in n),qD=(n,e=[0,0])=>{const{width:t,height:i}=Fp(n),s=n.origin??e,o=t*s[0],r=i*s[1];return{x:n.position.x-o,y:n.position.y-r}},BTe=(n,e={nodeOrigin:[0,0]})=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const t=n.reduce((i,s)=>{const o=typeof s=="string";let r=!e.nodeLookup&&!o?s:void 0;e.nodeLookup&&(r=o?e.nodeLookup.get(s):WY(s)?s:e.nodeLookup.get(s.id));const a=r?GA(r,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return R3(i,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return M3(t)},KD=(n,e={})=>{let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return n.forEach(s=>{(e.filter===void 0||e.filter(s))&&(t=R3(t,GA(s)),i=!0)}),i?M3(t):{x:0,y:0,width:0,height:0}},HY=(n,e,[t,i,s]=[0,0,1],o=!1,r=!1)=>{const a={...YD(e,[t,i,s]),width:e.width/s,height:e.height/s},l=[];for(const c of n.values()){const{measured:d,selectable:u=!0,hidden:h=!1}=c;if(r&&!u||h)continue;const f=d.width??c.width??c.initialWidth??null,g=d.height??c.height??c.initialHeight??null,p=VE(a,KS(c)),_=(f??0)*(g??0),b=o&&p>0;(!c.internals.handleBounds||b||p>=_||c.dragging)&&l.push(c)}return l},WTe=(n,e)=>{const t=new Set;return n.forEach(i=>{t.add(i.id)}),e.filter(i=>t.has(i.source)||t.has(i.target))};function HTe(n,e){const t=new Map,i=e!=null&&e.nodes?new Set(e.nodes.map(s=>s.id)):null;return n.forEach(s=>{s.measured.width&&s.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!s.hidden)&&(!i||i.has(s.id))&&t.set(s.id,s)}),t}async function VTe({nodes:n,width:e,height:t,panZoom:i,minZoom:s,maxZoom:o},r){if(n.size===0)return Promise.resolve(!0);const a=HTe(n,r),l=KD(a),c=VY(l,e,t,(r==null?void 0:r.minZoom)??s,(r==null?void 0:r.maxZoom)??o,(r==null?void 0:r.padding)??.1);return await i.setViewport(c,{duration:r==null?void 0:r.duration,ease:r==null?void 0:r.ease,interpolate:r==null?void 0:r.interpolate}),Promise.resolve(!0)}function Gge({nodeId:n,nextPosition:e,nodeLookup:t,nodeOrigin:i=[0,0],nodeExtent:s,onError:o}){const r=t.get(n),a=r.parentId?t.get(r.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=r.origin??i;let u=r.extent||s;if(r.extent==="parent"&&!r.expandParent)if(!a)o==null||o("005",df.error005());else{const f=a.measured.width,g=a.measured.height;f&&g&&(u=[[l,c],[l+f,c+g]])}else a&&GS(r.extent)&&(u=[[r.extent[0][0]+l,r.extent[0][1]+c],[r.extent[1][0]+l,r.extent[1][1]+c]]);const h=GS(u)?R0(e,u,r.measured):e;return(r.measured.width===void 0||r.measured.height===void 0)&&(o==null||o("015",df.error015())),{position:{x:h.x-l+(r.measured.width??0)*d[0],y:h.y-c+(r.measured.height??0)*d[1]},positionAbsolute:h}}async function jTe({nodesToRemove:n=[],edgesToRemove:e=[],nodes:t,edges:i,onBeforeDelete:s}){const o=new Set(n.map(h=>h.id)),r=[];for(const h of t){if(h.deletable===!1)continue;const f=o.has(h.id),g=!f&&h.parentId&&r.find(p=>p.id===h.parentId);(f||g)&&r.push(h)}const a=new Set(e.map(h=>h.id)),l=i.filter(h=>h.deletable!==!1),d=WTe(r,l);for(const h of l)a.has(h.id)&&!d.find(g=>g.id===h.id)&&d.push(h);if(!s)return{edges:d,nodes:r};const u=await s({nodes:r,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:r}:{edges:[],nodes:[]}:u}const qS=(n,e=0,t=1)=>Math.min(Math.max(n,e),t),R0=(n={x:0,y:0},e,t)=>({x:qS(n.x,e[0][0],e[1][0]-((t==null?void 0:t.width)??0)),y:qS(n.y,e[0][1],e[1][1]-((t==null?void 0:t.height)??0))});function Yge(n,e,t){const{width:i,height:s}=Fp(t),{x:o,y:r}=t.internals.positionAbsolute;return R0(n,[[o,r],[o+i,r+s]],e)}const gie=(n,e,t)=>nt?-qS(Math.abs(n-t),1,e)/e:0,Zge=(n,e,t=15,i=40)=>{const s=gie(n.x,i,e.width-i)*t,o=gie(n.y,i,e.height-i)*t;return[s,o]},R3=(n,e)=>({x:Math.min(n.x,e.x),y:Math.min(n.y,e.y),x2:Math.max(n.x2,e.x2),y2:Math.max(n.y2,e.y2)}),aH=({x:n,y:e,width:t,height:i})=>({x:n,y:e,x2:n+t,y2:e+i}),M3=({x:n,y:e,x2:t,y2:i})=>({x:n,y:e,width:t-n,height:i-e}),KS=(n,e=[0,0])=>{var s,o;const{x:t,y:i}=WY(n)?n.internals.positionAbsolute:qD(n,e);return{x:t,y:i,width:((s=n.measured)==null?void 0:s.width)??n.width??n.initialWidth??0,height:((o=n.measured)==null?void 0:o.height)??n.height??n.initialHeight??0}},GA=(n,e=[0,0])=>{var s,o;const{x:t,y:i}=WY(n)?n.internals.positionAbsolute:qD(n,e);return{x:t,y:i,x2:t+(((s=n.measured)==null?void 0:s.width)??n.width??n.initialWidth??0),y2:i+(((o=n.measured)==null?void 0:o.height)??n.height??n.initialHeight??0)}},Xge=(n,e)=>M3(R3(aH(n),aH(e))),VE=(n,e)=>{const t=Math.max(0,Math.min(n.x+n.width,e.x+e.width)-Math.max(n.x,e.x)),i=Math.max(0,Math.min(n.y+n.height,e.y+e.height)-Math.max(n.y,e.y));return Math.ceil(t*i)},pie=n=>ku(n.width)&&ku(n.height)&&ku(n.x)&&ku(n.y),ku=n=>!isNaN(n)&&isFinite(n),zTe=(n,e)=>{},GD=(n,e=[1,1])=>({x:e[0]*Math.round(n.x/e[0]),y:e[1]*Math.round(n.y/e[1])}),YD=({x:n,y:e},[t,i,s],o=!1,r=[1,1])=>{const a={x:(n-t)/s,y:(e-i)/s};return o?GD(a,r):a},YA=({x:n,y:e},[t,i,s])=>({x:n*s+t,y:e*s+i});function $w(n,e){if(typeof n=="number")return Math.floor((e-e/(1+n))*.5);if(typeof n=="string"&&n.endsWith("px")){const t=parseFloat(n);if(!Number.isNaN(t))return Math.floor(t)}if(typeof n=="string"&&n.endsWith("%")){const t=parseFloat(n);if(!Number.isNaN(t))return Math.floor(e*t*.01)}return console.error(`[React Flow] The padding value "${n}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function $Te(n,e,t){if(typeof n=="string"||typeof n=="number"){const i=$w(n,t),s=$w(n,e);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof n=="object"){const i=$w(n.top??n.y??0,t),s=$w(n.bottom??n.y??0,t),o=$w(n.left??n.x??0,e),r=$w(n.right??n.x??0,e);return{top:i,right:r,bottom:s,left:o,x:o+r,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function UTe(n,e,t,i,s,o){const{x:r,y:a}=YA(n,[e,t,i]),{x:l,y:c}=YA({x:n.x+n.width,y:n.y+n.height},[e,t,i]),d=s-l,u=o-c;return{left:Math.floor(r),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const VY=(n,e,t,i,s,o)=>{const r=$Te(o,e,t),a=(e-r.x)/n.width,l=(t-r.y)/n.height,c=Math.min(a,l),d=qS(c,i,s),u=n.x+n.width/2,h=n.y+n.height/2,f=e/2-u*d,g=t/2-h*d,p=UTe(n,f,g,d,e,t),_={left:Math.min(p.left-r.left,0),top:Math.min(p.top-r.top,0),right:Math.min(p.right-r.right,0),bottom:Math.min(p.bottom-r.bottom,0)};return{x:f-_.left+_.right,y:g-_.top+_.bottom,zoom:d}},jE=()=>{var n;return typeof navigator<"u"&&((n=navigator==null?void 0:navigator.userAgent)==null?void 0:n.indexOf("Mac"))>=0};function GS(n){return n!=null&&n!=="parent"}function Fp(n){var e,t;return{width:((e=n.measured)==null?void 0:e.width)??n.width??n.initialWidth??0,height:((t=n.measured)==null?void 0:t.height)??n.height??n.initialHeight??0}}function Qge(n){var e,t;return(((e=n.measured)==null?void 0:e.width)??n.width??n.initialWidth)!==void 0&&(((t=n.measured)==null?void 0:t.height)??n.height??n.initialHeight)!==void 0}function Jge(n,e={width:0,height:0},t,i,s){const o={...n},r=i.get(t);if(r){const a=r.origin||s;o.x+=r.internals.positionAbsolute.x-(e.width??0)*a[0],o.y+=r.internals.positionAbsolute.y-(e.height??0)*a[1]}return o}function mie(n,e){if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;return!0}function qTe(){let n,e;return{promise:new Promise((i,s)=>{n=i,e=s}),resolve:n,reject:e}}function KTe(n){return{...$ge,...n||{}}}function Jk(n,{snapGrid:e=[0,0],snapToGrid:t=!1,transform:i,containerBounds:s}){const{x:o,y:r}=Nu(n),a=YD({x:o-((s==null?void 0:s.left)??0),y:r-((s==null?void 0:s.top)??0)},i),{x:l,y:c}=t?GD(a,e):a;return{xSnapped:l,ySnapped:c,...a}}const jY=n=>({width:n.offsetWidth,height:n.offsetHeight}),epe=n=>{var e;return((e=n==null?void 0:n.getRootNode)==null?void 0:e.call(n))||(window==null?void 0:window.document)},GTe=["INPUT","SELECT","TEXTAREA"];function tpe(n){var i,s;const e=((s=(i=n.composedPath)==null?void 0:i.call(n))==null?void 0:s[0])||n.target;return(e==null?void 0:e.nodeType)!==1?!1:GTe.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const ipe=n=>"clientX"in n,Nu=(n,e)=>{var o,r;const t=ipe(n),i=t?n.clientX:(o=n.touches)==null?void 0:o[0].clientX,s=t?n.clientY:(r=n.touches)==null?void 0:r[0].clientY;return{x:i-((e==null?void 0:e.left)??0),y:s-((e==null?void 0:e.top)??0)}},_ie=(n,e,t,i,s)=>{const o=e.querySelectorAll(`.${n}`);return!o||!o.length?null:Array.from(o).map(r=>{const a=r.getBoundingClientRect();return{id:r.getAttribute("data-handleid"),type:n,nodeId:s,position:r.getAttribute("data-handlepos"),x:(a.left-t.left)/i,y:(a.top-t.top)/i,...jY(r)}})};function npe({sourceX:n,sourceY:e,targetX:t,targetY:i,sourceControlX:s,sourceControlY:o,targetControlX:r,targetControlY:a}){const l=n*.125+s*.375+r*.375+t*.125,c=e*.125+o*.375+a*.375+i*.125,d=Math.abs(l-n),u=Math.abs(c-e);return[l,c,d,u]}function v2(n,e){return n>=0?.5*n:e*25*Math.sqrt(-n)}function bie({pos:n,x1:e,y1:t,x2:i,y2:s,c:o}){switch(n){case Wt.Left:return[e-v2(e-i,o),t];case Wt.Right:return[e+v2(i-e,o),t];case Wt.Top:return[e,t-v2(t-s,o)];case Wt.Bottom:return[e,t+v2(s-t,o)]}}function spe({sourceX:n,sourceY:e,sourcePosition:t=Wt.Bottom,targetX:i,targetY:s,targetPosition:o=Wt.Top,curvature:r=.25}){const[a,l]=bie({pos:t,x1:n,y1:e,x2:i,y2:s,c:r}),[c,d]=bie({pos:o,x1:i,y1:s,x2:n,y2:e,c:r}),[u,h,f,g]=npe({sourceX:n,sourceY:e,targetX:i,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${n},${e} C${a},${l} ${c},${d} ${i},${s}`,u,h,f,g]}function ope({sourceX:n,sourceY:e,targetX:t,targetY:i}){const s=Math.abs(t-n)/2,o=t0}const XTe=({source:n,sourceHandle:e,target:t,targetHandle:i})=>`xy-edge__${n}${e||""}-${t}${i||""}`,QTe=(n,e)=>e.some(t=>t.source===n.source&&t.target===n.target&&(t.sourceHandle===n.sourceHandle||!t.sourceHandle&&!n.sourceHandle)&&(t.targetHandle===n.targetHandle||!t.targetHandle&&!n.targetHandle)),JTe=(n,e,t={})=>{if(!n.source||!n.target)return e;const i=t.getEdgeId||XTe;let s;return Kge(n)?s={...n}:s={...n,id:i(n)},QTe(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function rpe({sourceX:n,sourceY:e,targetX:t,targetY:i}){const[s,o,r,a]=ope({sourceX:n,sourceY:e,targetX:t,targetY:i});return[`M ${n},${e}L ${t},${i}`,s,o,r,a]}const vie={[Wt.Left]:{x:-1,y:0},[Wt.Right]:{x:1,y:0},[Wt.Top]:{x:0,y:-1},[Wt.Bottom]:{x:0,y:1}},e2e=({source:n,sourcePosition:e=Wt.Bottom,target:t})=>e===Wt.Left||e===Wt.Right?n.xMath.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2));function t2e({source:n,sourcePosition:e=Wt.Bottom,target:t,targetPosition:i=Wt.Top,center:s,offset:o,stepPosition:r}){const a=vie[e],l=vie[i],c={x:n.x+a.x*o,y:n.y+a.y*o},d={x:t.x+l.x*o,y:t.y+l.y*o},u=e2e({source:c,sourcePosition:e,target:d}),h=u.x!==0?"x":"y",f=u[h];let g=[],p,_;const b={x:0,y:0},v={x:0,y:0},[,,C,y]=ope({sourceX:n.x,sourceY:n.y,targetX:t.x,targetY:t.y});if(a[h]*l[h]===-1){h==="x"?(p=s.x??c.x+(d.x-c.x)*r,_=s.y??(c.y+d.y)/2):(p=s.x??(c.x+d.x)/2,_=s.y??c.y+(d.y-c.y)*r);const k=[{x:p,y:c.y},{x:p,y:d.y}],N=[{x:c.x,y:_},{x:d.x,y:_}];a[h]===f?g=h==="x"?k:N:g=h==="x"?N:k}else{const k=[{x:c.x,y:d.y}],N=[{x:d.x,y:c.y}];if(h==="x"?g=a.x===f?N:k:g=a.y===f?k:N,e===i){const O=Math.abs(n[h]-t[h]);if(O<=o){const A=Math.min(o-1,o-O);a[h]===f?b[h]=(c[h]>n[h]?-1:1)*A:v[h]=(d[h]>t[h]?-1:1)*A}}if(e!==i){const O=h==="x"?"y":"x",A=a[h]===l[O],z=c[O]>d[O],U=c[O]=V?(p=(D.x+M.x)/2,_=g[0].y):(p=g[0].x,_=(D.y+M.y)/2)}const S={x:c.x+b.x,y:c.y+b.y},x={x:d.x+v.x,y:d.y+v.y};return[[n,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...x.x!==g[g.length-1].x||x.y!==g[g.length-1].y?[x]:[],t],p,_,C,y]}function i2e(n,e,t,i){const s=Math.min(wie(n,e)/2,wie(e,t)/2,i),{x:o,y:r}=e;if(n.x===o&&o===t.x||n.y===r&&r===t.y)return`L${o} ${r}`;if(n.y===r){const c=n.xt.id===e):n[0])||null}function cH(n,e){return n?typeof n=="string"?n:`${e?`${e}__`:""}${Object.keys(n).sort().map(i=>`${i}=${n[i]}`).join("&")}`:""}function s2e(n,{id:e,defaultColor:t,defaultMarkerStart:i,defaultMarkerEnd:s}){const o=new Set;return n.reduce((r,a)=>([a.markerStart||i,a.markerEnd||s].forEach(l=>{if(l&&typeof l=="object"){const c=cH(l,e);o.has(c)||(r.push({id:c,color:l.color||t,...l}),o.add(c))}}),r),[]).sort((r,a)=>r.id.localeCompare(a.id))}const ape=1e3,o2e=10,zY={nodeOrigin:[0,0],nodeExtent:WE,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},r2e={...zY,checkEquality:!0};function $Y(n,e){const t={...n};for(const i in e)e[i]!==void 0&&(t[i]=e[i]);return t}function a2e(n,e,t){const i=$Y(zY,t);for(const s of n.values())if(s.parentId)qY(s,n,e,i);else{const o=qD(s,i.nodeOrigin),r=GS(s.extent)?s.extent:i.nodeExtent,a=R0(o,r,Fp(s));s.internals.positionAbsolute=a}}function l2e(n,e){if(!n.handles)return n.measured?e==null?void 0:e.internals.handleBounds:void 0;const t=[],i=[];for(const s of n.handles){const o={id:s.id,width:s.width??1,height:s.height??1,nodeId:n.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?t.push(o):s.type==="target"&&i.push(o)}return{source:t,target:i}}function UY(n){return n==="manual"}function dH(n,e,t,i={}){var d,u;const s=$Y(r2e,i),o={i:0},r=new Map(e),a=s!=null&&s.elevateNodesOnSelect&&!UY(s.zIndexMode)?ape:0;let l=n.length>0,c=!1;e.clear(),t.clear();for(const h of n){let f=r.get(h.id);if(s.checkEquality&&h===(f==null?void 0:f.internals.userNode))e.set(h.id,f);else{const g=qD(h,s.nodeOrigin),p=GS(h.extent)?h.extent:s.nodeExtent,_=R0(g,p,Fp(h));f={...s.defaults,...h,measured:{width:(d=h.measured)==null?void 0:d.width,height:(u=h.measured)==null?void 0:u.height},internals:{positionAbsolute:_,handleBounds:l2e(h,f),z:lpe(h,a,s.zIndexMode),userNode:h}},e.set(h.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(l=!1),h.parentId&&qY(f,e,t,i,o),c||(c=h.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:c}}function c2e(n,e){if(!n.parentId)return;const t=e.get(n.parentId);t?t.set(n.id,n):e.set(n.parentId,new Map([[n.id,n]]))}function qY(n,e,t,i,s){const{elevateNodesOnSelect:o,nodeOrigin:r,nodeExtent:a,zIndexMode:l}=$Y(zY,i),c=n.parentId,d=e.get(c);if(!d){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}c2e(n,t),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&l==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*o2e),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const u=o&&!UY(l)?ape:0,{x:h,y:f,z:g}=d2e(n,d,r,a,u,l),{positionAbsolute:p}=n.internals,_=h!==p.x||f!==p.y;(_||g!==n.internals.z)&&e.set(n.id,{...n,internals:{...n.internals,positionAbsolute:_?{x:h,y:f}:p,z:g}})}function lpe(n,e,t){const i=ku(n.zIndex)?n.zIndex:0;return UY(t)?i:i+(n.selected?e:0)}function d2e(n,e,t,i,s,o){const{x:r,y:a}=e.internals.positionAbsolute,l=Fp(n),c=qD(n,t),d=GS(n.extent)?R0(c,n.extent,l):c;let u=R0({x:r+d.x,y:a+d.y},i,l);n.extent==="parent"&&(u=Yge(u,l,e));const h=lpe(n,s,o),f=e.internals.z??0;return{x:u.x,y:u.y,z:f>=h?f+1:h}}function KY(n,e,t,i=[0,0]){var r;const s=[],o=new Map;for(const a of n){const l=e.get(a.parentId);if(!l)continue;const c=((r=o.get(a.parentId))==null?void 0:r.expandedRect)??KS(l),d=Xge(c,a.rect);o.set(a.parentId,{expandedRect:d,parent:l})}return o.size>0&&o.forEach(({expandedRect:a,parent:l},c)=>{var C;const d=l.internals.positionAbsolute,u=Fp(l),h=l.origin??i,f=a.x0||g>0||b||v)&&(s.push({id:c,type:"position",position:{x:l.position.x-f+b,y:l.position.y-g+v}}),(C=t.get(c))==null||C.forEach(y=>{n.some(S=>S.id===y.id)||s.push({id:y.id,type:"position",position:{x:y.position.x+f,y:y.position.y+g}})})),(u.width0){const f=KY(h,e,t,s);c.push(...f)}return{changes:c,updatedInternals:l}}async function h2e({delta:n,panZoom:e,transform:t,translateExtent:i,width:s,height:o}){if(!e||!n.x&&!n.y)return Promise.resolve(!1);const r=await e.setViewportConstrained({x:t[0]+n.x,y:t[1]+n.y,zoom:t[2]},[[0,0],[s,o]],i),a=!!r&&(r.x!==t[0]||r.y!==t[1]||r.k!==t[2]);return Promise.resolve(a)}function xie(n,e,t,i,s,o){let r=s;const a=i.get(r)||new Map;i.set(r,a.set(t,e)),r=`${s}-${n}`;const l=i.get(r)||new Map;if(i.set(r,l.set(t,e)),o){r=`${s}-${n}-${o}`;const c=i.get(r)||new Map;i.set(r,c.set(t,e))}}function cpe(n,e,t){n.clear(),e.clear();for(const i of t){const{source:s,target:o,sourceHandle:r=null,targetHandle:a=null}=i,l={edgeId:i.id,source:s,target:o,sourceHandle:r,targetHandle:a},c=`${s}-${r}--${o}-${a}`,d=`${o}-${a}--${s}-${r}`;xie("source",l,d,n,s,r),xie("target",l,c,n,o,a),e.set(i.id,i)}}function dpe(n,e){if(!n.parentId)return!1;const t=e.get(n.parentId);return t?t.selected?!0:dpe(t,e):!1}function Lie(n,e,t){var s;let i=n;do{if((s=i==null?void 0:i.matches)!=null&&s.call(i,e))return!0;if(i===t)return!1;i=i==null?void 0:i.parentElement}while(i);return!1}function f2e(n,e,t,i){const s=new Map;for(const[o,r]of n)if((r.selected||r.id===i)&&(!r.parentId||!dpe(r,n))&&(r.draggable||e&&typeof r.draggable>"u")){const a=n.get(o);a&&s.set(o,{id:o,position:a.position||{x:0,y:0},distance:{x:t.x-a.internals.positionAbsolute.x,y:t.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return s}function g6({nodeId:n,dragItems:e,nodeLookup:t,dragging:i=!0}){var r,a,l;const s=[];for(const[c,d]of e){const u=(r=t.get(c))==null?void 0:r.internals.userNode;u&&s.push({...u,position:d.position,dragging:i})}if(!n)return[s[0],s];const o=(a=t.get(n))==null?void 0:a.internals.userNode;return[o?{...o,position:((l=e.get(n))==null?void 0:l.position)||o.position,dragging:i}:s[0],s]}function g2e({dragItems:n,snapGrid:e,x:t,y:i}){const s=n.values().next().value;if(!s)return null;const o={x:t-s.distance.x,y:i-s.distance.y},r=GD(o,e);return{x:r.x-o.x,y:r.y-o.y}}function p2e({onNodeMouseDown:n,getStoreItems:e,onDragStart:t,onDrag:i,onDragStop:s}){let o={x:null,y:null},r=0,a=new Map,l=!1,c={x:0,y:0},d=null,u=!1,h=null,f=!1,g=!1,p=null;function _({noDragClassName:v,handleSelector:C,domNode:y,isSelectable:S,nodeId:x,nodeClickDistance:L=0}){h=Lc(y);function k({x:P,y:V}){const{nodeLookup:O,nodeExtent:A,snapGrid:z,snapToGrid:U,nodeOrigin:B,onNodeDrag:F,onSelectionDrag:q,onError:Y,updateNodePositions:Q}=e();o={x:P,y:V};let ne=!1;const he=a.size>1,Ce=he&&A?aH(KD(a)):null,ze=he&&U?g2e({dragItems:a,snapGrid:z,x:P,y:V}):null;for(const[Oe,Se]of a){if(!O.has(Oe))continue;let je={x:P-Se.distance.x,y:V-Se.distance.y};U&&(je=ze?{x:Math.round(je.x+ze.x),y:Math.round(je.y+ze.y)}:GD(je,z));let it=null;if(he&&A&&!Se.extent&&Ce){const{positionAbsolute:Re}=Se.internals,gt=Re.x-Ce.x+A[0][0],si=Re.x+Se.measured.width-Ce.x2+A[1][0],Ye=Re.y-Ce.y+A[0][1],ri=Re.y+Se.measured.height-Ce.y2+A[1][1];it=[[gt,Ye],[si,ri]]}const{position:Ct,positionAbsolute:Fe}=Gge({nodeId:Oe,nextPosition:je,nodeLookup:O,nodeExtent:it||A,nodeOrigin:B,onError:Y});ne=ne||Se.position.x!==Ct.x||Se.position.y!==Ct.y,Se.position=Ct,Se.internals.positionAbsolute=Fe}if(g=g||ne,!!ne&&(Q(a,!0),p&&(i||F||!x&&q))){const[Oe,Se]=g6({nodeId:x,dragItems:a,nodeLookup:O});i==null||i(p,a,Oe,Se),F==null||F(p,Oe,Se),x||q==null||q(p,Se)}}async function N(){if(!d)return;const{transform:P,panBy:V,autoPanSpeed:O,autoPanOnNodeDrag:A}=e();if(!A){l=!1,cancelAnimationFrame(r);return}const[z,U]=Zge(c,d,O);(z!==0||U!==0)&&(o.x=(o.x??0)-z/P[2],o.y=(o.y??0)-U/P[2],await V({x:z,y:U})&&k(o)),r=requestAnimationFrame(N)}function D(P){var he;const{nodeLookup:V,multiSelectionActive:O,nodesDraggable:A,transform:z,snapGrid:U,snapToGrid:B,selectNodesOnDrag:F,onNodeDragStart:q,onSelectionDragStart:Y,unselectNodesAndEdges:Q}=e();u=!0,(!F||!S)&&!O&&x&&((he=V.get(x))!=null&&he.selected||Q()),S&&F&&x&&(n==null||n(x));const ne=Jk(P.sourceEvent,{transform:z,snapGrid:U,snapToGrid:B,containerBounds:d});if(o=ne,a=f2e(V,A,ne,x),a.size>0&&(t||q||!x&&Y)){const[Ce,ze]=g6({nodeId:x,dragItems:a,nodeLookup:V});t==null||t(P.sourceEvent,a,Ce,ze),q==null||q(P.sourceEvent,Ce,ze),x||Y==null||Y(P.sourceEvent,ze)}}const M=Nge().clickDistance(L).on("start",P=>{const{domNode:V,nodeDragThreshold:O,transform:A,snapGrid:z,snapToGrid:U}=e();d=(V==null?void 0:V.getBoundingClientRect())||null,f=!1,g=!1,p=P.sourceEvent,O===0&&D(P),o=Jk(P.sourceEvent,{transform:A,snapGrid:z,snapToGrid:U,containerBounds:d}),c=Nu(P.sourceEvent,d)}).on("drag",P=>{const{autoPanOnNodeDrag:V,transform:O,snapGrid:A,snapToGrid:z,nodeDragThreshold:U,nodeLookup:B}=e(),F=Jk(P.sourceEvent,{transform:O,snapGrid:A,snapToGrid:z,containerBounds:d});if(p=P.sourceEvent,(P.sourceEvent.type==="touchmove"&&P.sourceEvent.touches.length>1||x&&!B.has(x))&&(f=!0),!f){if(!l&&V&&u&&(l=!0,N()),!u){const q=Nu(P.sourceEvent,d),Y=q.x-c.x,Q=q.y-c.y;Math.sqrt(Y*Y+Q*Q)>U&&D(P)}(o.x!==F.xSnapped||o.y!==F.ySnapped)&&a&&u&&(c=Nu(P.sourceEvent,d),k(F))}}).on("end",P=>{if(!(!u||f)&&(l=!1,u=!1,cancelAnimationFrame(r),a.size>0)){const{nodeLookup:V,updateNodePositions:O,onNodeDragStop:A,onSelectionDragStop:z}=e();if(g&&(O(a,!1),g=!1),s||A||!x&&z){const[U,B]=g6({nodeId:x,dragItems:a,nodeLookup:V,dragging:!1});s==null||s(P.sourceEvent,a,U,B),A==null||A(P.sourceEvent,U,B),x||z==null||z(P.sourceEvent,B)}}}).filter(P=>{const V=P.target;return!P.button&&(!v||!Lie(V,`.${v}`,y))&&(!C||Lie(V,C,y))});h.call(M)}function b(){h==null||h.on(".drag",null)}return{update:_,destroy:b}}function m2e(n,e,t){const i=[],s={x:n.x-t,y:n.y-t,width:t*2,height:t*2};for(const o of e.values())VE(s,KS(o))>0&&i.push(o);return i}const _2e=250;function b2e(n,e,t,i){var a,l;let s=[],o=1/0;const r=m2e(n,t,e+_2e);for(const c of r){const d=[...((a=c.internals.handleBounds)==null?void 0:a.source)??[],...((l=c.internals.handleBounds)==null?void 0:l.target)??[]];for(const u of d){if(i.nodeId===u.nodeId&&i.type===u.type&&i.id===u.id)continue;const{x:h,y:f}=M0(c,u,u.position,!0),g=Math.sqrt(Math.pow(h-n.x,2)+Math.pow(f-n.y,2));g>e||(g1){const c=i.type==="source"?"target":"source";return s.find(d=>d.type===c)??s[0]}return s[0]}function upe(n,e,t,i,s,o=!1){var c,d,u;const r=i.get(n);if(!r)return null;const a=s==="strict"?(c=r.internals.handleBounds)==null?void 0:c[e]:[...((d=r.internals.handleBounds)==null?void 0:d.source)??[],...((u=r.internals.handleBounds)==null?void 0:u.target)??[]],l=(t?a==null?void 0:a.find(h=>h.id===t):a==null?void 0:a[0])??null;return l&&o?{...l,...M0(r,l,l.position,!0)}:l}function hpe(n,e){return n||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function v2e(n,e){let t=null;return e?t=!0:n&&!e&&(t=!1),t}const fpe=()=>!0;function w2e(n,{connectionMode:e,connectionRadius:t,handleId:i,nodeId:s,edgeUpdaterType:o,isTarget:r,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:h,cancelConnection:f,onConnectStart:g,onConnect:p,onConnectEnd:_,isValidConnection:b=fpe,onReconnectEnd:v,updateConnection:C,getTransform:y,getFromHandle:S,autoPanSpeed:x,dragThreshold:L=1,handleDomNode:k}){const N=epe(n.target);let D=0,M;const{x:P,y:V}=Nu(n),O=hpe(o,k),A=a==null?void 0:a.getBoundingClientRect();let z=!1;if(!A||!O)return;const U=upe(s,O,i,l,e);if(!U)return;let B=Nu(n,A),F=!1,q=null,Y=!1,Q=null;function ne(){if(!d||!A)return;const[Ct,Fe]=Zge(B,A,x);h({x:Ct,y:Fe}),D=requestAnimationFrame(ne)}const he={...U,nodeId:s,type:O,position:U.position},Ce=l.get(s);let Oe={inProgress:!0,isValid:null,from:M0(Ce,he,Wt.Left,!0),fromHandle:he,fromPosition:he.position,fromNode:Ce,to:B,toHandle:null,toPosition:fie[he.position],toNode:null,pointer:B};function Se(){z=!0,C(Oe),g==null||g(n,{nodeId:s,handleId:i,handleType:O})}L===0&&Se();function je(Ct){if(!z){const{x:ri,y:Di}=Nu(Ct),Nn=ri-P,Xe=Di-V;if(!(Nn*Nn+Xe*Xe>L*L))return;Se()}if(!S()||!he){it(Ct);return}const Fe=y();B=Nu(Ct,A),M=b2e(YD(B,Fe,!1,[1,1]),t,l,he),F||(ne(),F=!0);const Re=gpe(Ct,{handle:M,connectionMode:e,fromNodeId:s,fromHandleId:i,fromType:r?"target":"source",isValidConnection:b,doc:N,lib:c,flowId:u,nodeLookup:l});Q=Re.handleDomNode,q=Re.connection,Y=v2e(!!M,Re.isValid);const gt=l.get(s),si=gt?M0(gt,he,Wt.Left,!0):Oe.from,Ye={...Oe,from:si,isValid:Y,to:Re.toHandle&&Y?YA({x:Re.toHandle.x,y:Re.toHandle.y},Fe):B,toHandle:Re.toHandle,toPosition:Y&&Re.toHandle?Re.toHandle.position:fie[he.position],toNode:Re.toHandle?l.get(Re.toHandle.nodeId):null,pointer:B};C(Ye),Oe=Ye}function it(Ct){if(!("touches"in Ct&&Ct.touches.length>0)){if(z){(M||Q)&&q&&Y&&(p==null||p(q));const{inProgress:Fe,...Re}=Oe,gt={...Re,toPosition:Oe.toHandle?Oe.toPosition:null};_==null||_(Ct,gt),o&&(v==null||v(Ct,gt))}f(),cancelAnimationFrame(D),F=!1,Y=!1,q=null,Q=null,N.removeEventListener("mousemove",je),N.removeEventListener("mouseup",it),N.removeEventListener("touchmove",je),N.removeEventListener("touchend",it)}}N.addEventListener("mousemove",je),N.addEventListener("mouseup",it),N.addEventListener("touchmove",je),N.addEventListener("touchend",it)}function gpe(n,{handle:e,connectionMode:t,fromNodeId:i,fromHandleId:s,fromType:o,doc:r,lib:a,flowId:l,isValidConnection:c=fpe,nodeLookup:d}){const u=o==="target",h=e?r.querySelector(`.${a}-flow__handle[data-id="${l}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:f,y:g}=Nu(n),p=r.elementFromPoint(f,g),_=p!=null&&p.classList.contains(`${a}-flow__handle`)?p:h,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const v=hpe(void 0,_),C=_.getAttribute("data-nodeid"),y=_.getAttribute("data-handleid"),S=_.classList.contains("connectable"),x=_.classList.contains("connectableend");if(!C||!v)return b;const L={source:u?C:i,sourceHandle:u?y:s,target:u?i:C,targetHandle:u?s:y};b.connection=L;const N=S&&x&&(t===US.Strict?u&&v==="source"||!u&&v==="target":C!==i||y!==s);b.isValid=N&&c(L),b.toHandle=upe(C,v,y,d,t,!0)}return b}const uH={onPointerDown:w2e,isValid:gpe};function C2e({domNode:n,panZoom:e,getTransform:t,getViewScale:i}){const s=Lc(n);function o({translateExtent:a,width:l,height:c,zoomStep:d=1,pannable:u=!0,zoomable:h=!0,inversePan:f=!1}){const g=C=>{if(C.sourceEvent.type!=="wheel"||!e)return;const y=t(),S=C.sourceEvent.ctrlKey&&jE()?10:1,x=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*d,L=y[2]*Math.pow(2,x*S);e.scaleTo(L)};let p=[0,0];const _=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(p=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},b=C=>{const y=t();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!e)return;const S=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],x=[S[0]-p[0],S[1]-p[1]];p=S;const L=i()*Math.max(y[2],Math.log(y[2]))*(f?-1:1),k={x:y[0]-x[0]*L,y:y[1]-x[1]*L},N=[[0,0],[l,c]];e.setViewportConstrained({x:k.x,y:k.y,zoom:y[2]},N,a)},v=jge().on("start",_).on("zoom",u?b:null).on("zoom.wheel",h?g:null);s.call(v,{})}function r(){s.on("zoom",null)}return{update:o,destroy:r,pointer:hu}}const A3=n=>({x:n.x,y:n.y,zoom:n.k}),p6=({x:n,y:e,zoom:t})=>T3.translate(n,e).scale(t),$C=(n,e)=>n.target.closest(`.${e}`),ppe=(n,e)=>e===2&&Array.isArray(n)&&n.includes(2),y2e=n=>((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2,m6=(n,e=0,t=y2e,i=()=>{})=>{const s=typeof e=="number"&&e>0;return s||i(),s?n.transition().duration(e).ease(t).on("end",i):n},mpe=n=>{const e=n.ctrlKey&&jE()?10:1;return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*e};function S2e({zoomPanValues:n,noWheelClassName:e,d3Selection:t,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:r,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if($C(d,e))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=t.property("__zoom").k||1;if(d.ctrlKey&&r){const _=hu(d),b=mpe(d),v=u*Math.pow(2,b);i.scaleTo(t,v,_,d);return}const h=d.deltaMode===1?20:1;let f=s===c1.Vertical?0:d.deltaX*h,g=s===c1.Horizontal?0:d.deltaY*h;!jE()&&d.shiftKey&&s!==c1.Vertical&&(f=d.deltaY*h,g=0),i.translateBy(t,-(f/u)*o,-(g/u)*o,{internal:!0});const p=A3(t.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling?(l==null||l(d,p),n.panScrollTimeout=setTimeout(()=>{c==null||c(d,p),n.isPanScrolling=!1},150)):(n.isPanScrolling=!0,a==null||a(d,p))}}function x2e({noWheelClassName:n,preventScrolling:e,d3ZoomHandler:t}){return function(i,s){const o=i.type==="wheel",r=!e&&o&&!i.ctrlKey,a=$C(i,n);if(i.ctrlKey&&o&&a&&i.preventDefault(),r||a)return null;i.preventDefault(),t.call(this,i,s)}}function L2e({zoomPanValues:n,onDraggingChange:e,onPanZoomStart:t}){return i=>{var o,r,a;if((o=i.sourceEvent)!=null&&o.internal)return;const s=A3(i.transform);n.mouseButton=((r=i.sourceEvent)==null?void 0:r.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=s,((a=i.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),t&&(t==null||t(i.sourceEvent,s))}}function k2e({zoomPanValues:n,panOnDrag:e,onPaneContextMenu:t,onTransformChange:i,onPanZoom:s}){return o=>{var r,a;n.usedRightMouseButton=!!(t&&ppe(e,n.mouseButton??0)),(r=o.sourceEvent)!=null&&r.sync||i([o.transform.x,o.transform.y,o.transform.k]),s&&!((a=o.sourceEvent)!=null&&a.internal)&&(s==null||s(o.sourceEvent,A3(o.transform)))}}function N2e({zoomPanValues:n,panOnDrag:e,panOnScroll:t,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:o}){return r=>{var a;if(!((a=r.sourceEvent)!=null&&a.internal)&&(n.isZoomingOrPanning=!1,o&&ppe(e,n.mouseButton??0)&&!n.usedRightMouseButton&&r.sourceEvent&&o(r.sourceEvent),n.usedRightMouseButton=!1,i(!1),s)){const l=A3(r.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout(()=>{s==null||s(r.sourceEvent,l)},t?150:0)}}}function E2e({zoomActivationKeyPressed:n,zoomOnScroll:e,zoomOnPinch:t,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:o,userSelectionActive:r,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:d}){return u=>{var _;const h=n||e,f=t&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&($C(u,`${c}-flow__node`)||$C(u,`${c}-flow__edge`)))return!0;if(!i&&!h&&!s&&!o&&!t||r||d&&!g||$C(u,a)&&g||$C(u,l)&&(!g||s&&g&&!n)||!t&&u.ctrlKey&&g)return!1;if(!t&&u.type==="touchstart"&&((_=u.touches)==null?void 0:_.length)>1)return u.preventDefault(),!1;if(!h&&!s&&!f&&g||!i&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(i)&&!i.includes(u.button)&&u.type==="mousedown")return!1;const p=Array.isArray(i)&&i.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&p}}function I2e({domNode:n,minZoom:e,maxZoom:t,translateExtent:i,viewport:s,onPanZoom:o,onPanZoomStart:r,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=n.getBoundingClientRect(),u=jge().scaleExtent([e,t]).translateExtent(i),h=Lc(n).call(u);v({x:s.x,y:s.y,zoom:qS(s.zoom,e,t)},[[0,0],[d.width,d.height]],i);const f=h.on("wheel.zoom"),g=h.on("dblclick.zoom");u.wheelDelta(mpe);function p(M,P){return h?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Qk:wM).transform(m6(h,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function _({noWheelClassName:M,noPanClassName:P,onPaneContextMenu:V,userSelectionActive:O,panOnScroll:A,panOnDrag:z,panOnScrollMode:U,panOnScrollSpeed:B,preventScrolling:F,zoomOnPinch:q,zoomOnScroll:Y,zoomOnDoubleClick:Q,zoomActivationKeyPressed:ne,lib:he,onTransformChange:Ce,connectionInProgress:ze,paneClickDistance:Oe,selectionOnDrag:Se}){O&&!c.isZoomingOrPanning&&b();const je=A&&!ne&&!O;u.clickDistance(Se?1/0:!ku(Oe)||Oe<0?0:Oe);const it=je?S2e({zoomPanValues:c,noWheelClassName:M,d3Selection:h,d3Zoom:u,panOnScrollMode:U,panOnScrollSpeed:B,zoomOnPinch:q,onPanZoomStart:r,onPanZoom:o,onPanZoomEnd:a}):x2e({noWheelClassName:M,preventScrolling:F,d3ZoomHandler:f});if(h.on("wheel.zoom",it,{passive:!1}),!O){const Fe=L2e({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:r});u.on("start",Fe);const Re=k2e({zoomPanValues:c,panOnDrag:z,onPaneContextMenu:!!V,onPanZoom:o,onTransformChange:Ce});u.on("zoom",Re);const gt=N2e({zoomPanValues:c,panOnDrag:z,panOnScroll:A,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:l});u.on("end",gt)}const Ct=E2e({zoomActivationKeyPressed:ne,panOnDrag:z,zoomOnScroll:Y,panOnScroll:A,zoomOnDoubleClick:Q,zoomOnPinch:q,userSelectionActive:O,noPanClassName:P,noWheelClassName:M,lib:he,connectionInProgress:ze});u.filter(Ct),Q?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function b(){u.on("zoom",null)}async function v(M,P,V){const O=p6(M),A=u==null?void 0:u.constrain()(O,P,V);return A&&await p(A),new Promise(z=>z(A))}async function C(M,P){const V=p6(M);return await p(V,P),new Promise(O=>O(V))}function y(M){if(h){const P=p6(M),V=h.property("__zoom");(V.k!==M.zoom||V.x!==M.x||V.y!==M.y)&&(u==null||u.transform(h,P,null,{sync:!0}))}}function S(){const M=h?Vge(h.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}function x(M,P){return h?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Qk:wM).scaleTo(m6(h,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function L(M,P){return h?new Promise(V=>{u==null||u.interpolate((P==null?void 0:P.interpolate)==="linear"?Qk:wM).scaleBy(m6(h,P==null?void 0:P.duration,P==null?void 0:P.ease,()=>V(!0)),M)}):Promise.resolve(!1)}function k(M){u==null||u.scaleExtent(M)}function N(M){u==null||u.translateExtent(M)}function D(M){const P=!ku(M)||M<0?0:M;u==null||u.clickDistance(P)}return{update:_,destroy:b,setViewport:C,setViewportConstrained:v,getViewport:S,scaleTo:x,scaleBy:L,setScaleExtent:k,setTranslateExtent:N,syncViewport:y,setClickDistance:D}}var YS;(function(n){n.Line="line",n.Handle="handle"})(YS||(YS={}));function D2e({width:n,prevWidth:e,height:t,prevHeight:i,affectsX:s,affectsY:o}){const r=n-e,a=t-i,l=[r>0?1:r<0?-1:0,a>0?1:a<0?-1:0];return r&&s&&(l[0]=l[0]*-1),a&&o&&(l[1]=l[1]*-1),l}function kie(n){const e=n.includes("right")||n.includes("left"),t=n.includes("bottom")||n.includes("top"),i=n.includes("left"),s=n.includes("top");return{isHorizontal:e,isVertical:t,affectsX:i,affectsY:s}}function Jp(n,e){return Math.max(0,e-n)}function em(n,e){return Math.max(0,n-e)}function w2(n,e,t){return Math.max(0,e-n,n-t)}function Nie(n,e){return n?!e:e}function T2e(n,e,t,i,s,o,r,a){let{affectsX:l,affectsY:c}=e;const{isHorizontal:d,isVertical:u}=e,h=d&&u,{xSnapped:f,ySnapped:g}=t,{minWidth:p,maxWidth:_,minHeight:b,maxHeight:v}=i,{x:C,y,width:S,height:x,aspectRatio:L}=n;let k=Math.floor(d?f-n.pointerX:0),N=Math.floor(u?g-n.pointerY:0);const D=S+(l?-k:k),M=x+(c?-N:N),P=-o[0]*S,V=-o[1]*x;let O=w2(D,p,_),A=w2(M,b,v);if(r){let B=0,F=0;l&&k<0?B=Jp(C+k+P,r[0][0]):!l&&k>0&&(B=em(C+D+P,r[1][0])),c&&N<0?F=Jp(y+N+V,r[0][1]):!c&&N>0&&(F=em(y+M+V,r[1][1])),O=Math.max(O,B),A=Math.max(A,F)}if(a){let B=0,F=0;l&&k>0?B=em(C+k,a[0][0]):!l&&k<0&&(B=Jp(C+D,a[1][0])),c&&N>0?F=em(y+N,a[0][1]):!c&&N<0&&(F=Jp(y+M,a[1][1])),O=Math.max(O,B),A=Math.max(A,F)}if(s){if(d){const B=w2(D/L,b,v)*L;if(O=Math.max(O,B),r){let F=0;!l&&!c||l&&!c&&h?F=em(y+V+D/L,r[1][1])*L:F=Jp(y+V+(l?k:-k)/L,r[0][1])*L,O=Math.max(O,F)}if(a){let F=0;!l&&!c||l&&!c&&h?F=Jp(y+D/L,a[1][1])*L:F=em(y+(l?k:-k)/L,a[0][1])*L,O=Math.max(O,F)}}if(u){const B=w2(M*L,p,_)/L;if(A=Math.max(A,B),r){let F=0;!l&&!c||c&&!l&&h?F=em(C+M*L+P,r[1][0])/L:F=Jp(C+(c?N:-N)*L+P,r[0][0])/L,A=Math.max(A,F)}if(a){let F=0;!l&&!c||c&&!l&&h?F=Jp(C+M*L,a[1][0])/L:F=em(C+(c?N:-N)*L,a[0][0])/L,A=Math.max(A,F)}}}N=N+(N<0?A:-A),k=k+(k<0?O:-O),s&&(h?D>M*L?N=(Nie(l,c)?-k:k)/L:k=(Nie(l,c)?-N:N)*L:d?(N=k/L,c=l):(k=N*L,l=c));const z=l?C+k:C,U=c?y+N:y;return{width:S+(l?-k:k),height:x+(c?-N:N),x:o[0]*k*(l?-1:1)+z,y:o[1]*N*(c?-1:1)+U}}const _pe={width:0,height:0,x:0,y:0},R2e={..._pe,pointerX:0,pointerY:0,aspectRatio:1};function M2e(n){return[[0,0],[n.measured.width,n.measured.height]]}function A2e(n,e,t){const i=e.position.x+n.position.x,s=e.position.y+n.position.y,o=n.measured.width??0,r=n.measured.height??0,a=t[0]*o,l=t[1]*r;return[[i-a,s-l],[i+o-a,s+r-l]]}function P2e({domNode:n,nodeId:e,getStoreItems:t,onChange:i,onEnd:s}){const o=Lc(n);let r={controlDirection:kie("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:d,keepAspectRatio:u,resizeDirection:h,onResizeStart:f,onResize:g,onResizeEnd:p,shouldResize:_}){let b={..._pe},v={...R2e};r={boundaries:d,resizeDirection:h,keepAspectRatio:u,controlDirection:kie(c)};let C,y=null,S=[],x,L,k,N=!1;const D=Nge().on("start",M=>{const{nodeLookup:P,transform:V,snapGrid:O,snapToGrid:A,nodeOrigin:z,paneDomNode:U}=t();if(C=P.get(e),!C)return;y=(U==null?void 0:U.getBoundingClientRect())??null;const{xSnapped:B,ySnapped:F}=Jk(M.sourceEvent,{transform:V,snapGrid:O,snapToGrid:A,containerBounds:y});b={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},v={...b,pointerX:B,pointerY:F,aspectRatio:b.width/b.height},x=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(x=P.get(C.parentId),L=x&&C.extent==="parent"?M2e(x):void 0),S=[],k=void 0;for(const[q,Y]of P)if(Y.parentId===e&&(S.push({id:q,position:{...Y.position},extent:Y.extent}),Y.extent==="parent"||Y.expandParent)){const Q=A2e(Y,C,Y.origin??z);k?k=[[Math.min(Q[0][0],k[0][0]),Math.min(Q[0][1],k[0][1])],[Math.max(Q[1][0],k[1][0]),Math.max(Q[1][1],k[1][1])]]:k=Q}f==null||f(M,{...b})}).on("drag",M=>{const{transform:P,snapGrid:V,snapToGrid:O,nodeOrigin:A}=t(),z=Jk(M.sourceEvent,{transform:P,snapGrid:V,snapToGrid:O,containerBounds:y}),U=[];if(!C)return;const{x:B,y:F,width:q,height:Y}=b,Q={},ne=C.origin??A,{width:he,height:Ce,x:ze,y:Oe}=T2e(v,r.controlDirection,z,r.boundaries,r.keepAspectRatio,ne,L,k),Se=he!==q,je=Ce!==Y,it=ze!==B&&Se,Ct=Oe!==F&&je;if(!it&&!Ct&&!Se&&!je)return;if((it||Ct||ne[0]===1||ne[1]===1)&&(Q.x=it?ze:b.x,Q.y=Ct?Oe:b.y,b.x=Q.x,b.y=Q.y,S.length>0)){const si=ze-B,Ye=Oe-F;for(const ri of S)ri.position={x:ri.position.x-si+ne[0]*(he-q),y:ri.position.y-Ye+ne[1]*(Ce-Y)},U.push(ri)}if((Se||je)&&(Q.width=Se&&(!r.resizeDirection||r.resizeDirection==="horizontal")?he:b.width,Q.height=je&&(!r.resizeDirection||r.resizeDirection==="vertical")?Ce:b.height,b.width=Q.width,b.height=Q.height),x&&C.expandParent){const si=ne[0]*(Q.width??0);Q.x&&Q.x{N&&(p==null||p(M,{...b}),s==null||s({...b}),N=!1)});o.call(D)}function l(){o.on(".drag",null)}return{update:a,destroy:l}}var bpe={exports:{}},vpe={},wpe={exports:{}},Cpe={};/**
* @license React
* use-sync-external-store-shim.production.js
*
@@ -45,7 +45,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var ZS=R;function P2e(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var O2e=typeof Object.is=="function"?Object.is:P2e,F2e=ZS.useState,B2e=ZS.useEffect,W2e=ZS.useLayoutEffect,H2e=ZS.useDebugValue;function V2e(n,e){var t=e(),i=F2e({inst:{value:t,getSnapshot:e}}),s=i[0].inst,o=i[1];return W2e(function(){s.value=t,s.getSnapshot=e,_6(s)&&o({inst:s})},[n,t,e]),B2e(function(){return _6(s)&&o({inst:s}),n(function(){_6(s)&&o({inst:s})})},[n]),H2e(t),t}function _6(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!O2e(n,t)}catch{return!0}}function j2e(n,e){return e()}var z2e=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?j2e:V2e;wpe.useSyncExternalStore=ZS.useSyncExternalStore!==void 0?ZS.useSyncExternalStore:z2e;vpe.exports=wpe;var $2e=vpe.exports;/**
+ */var ZS=R;function O2e(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var F2e=typeof Object.is=="function"?Object.is:O2e,B2e=ZS.useState,W2e=ZS.useEffect,H2e=ZS.useLayoutEffect,V2e=ZS.useDebugValue;function j2e(n,e){var t=e(),i=B2e({inst:{value:t,getSnapshot:e}}),s=i[0].inst,o=i[1];return H2e(function(){s.value=t,s.getSnapshot=e,_6(s)&&o({inst:s})},[n,t,e]),W2e(function(){return _6(s)&&o({inst:s}),n(function(){_6(s)&&o({inst:s})})},[n]),V2e(t),t}function _6(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!F2e(n,t)}catch{return!0}}function z2e(n,e){return e()}var $2e=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?z2e:j2e;Cpe.useSyncExternalStore=ZS.useSyncExternalStore!==void 0?ZS.useSyncExternalStore:$2e;wpe.exports=Cpe;var U2e=wpe.exports;/**
* @license React
* use-sync-external-store-shim/with-selector.production.js
*
@@ -53,43 +53,43 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var P3=R,U2e=$2e;function q2e(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var K2e=typeof Object.is=="function"?Object.is:q2e,G2e=U2e.useSyncExternalStore,Y2e=P3.useRef,Z2e=P3.useEffect,X2e=P3.useMemo,Q2e=P3.useDebugValue;bpe.useSyncExternalStoreWithSelector=function(n,e,t,i,s){var o=Y2e(null);if(o.current===null){var r={hasValue:!1,value:null};o.current=r}else r=o.current;o=X2e(function(){function l(f){if(!c){if(c=!0,d=f,f=i(f),s!==void 0&&r.hasValue){var g=r.value;if(s(g,f))return u=g}return u=f}if(g=u,K2e(d,f))return g;var p=i(f);return s!==void 0&&s(g,p)?(d=f,g):(d=f,u=p)}var c=!1,d,u,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,i,s]);var a=G2e(n,o[0],o[1]);return Z2e(function(){r.hasValue=!0,r.value=a},[a]),Q2e(a),a};_pe.exports=bpe;var J2e=_pe.exports;const eRe=Que(J2e),tRe={},Eie=n=>{let e;const t=new Set,i=(d,u)=>{const h=typeof d=="function"?d(e):d;if(!Object.is(h,e)){const f=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),t.forEach(g=>g(e,f))}},s=()=>e,l={setState:i,getState:s,getInitialState:()=>c,subscribe:d=>(t.add(d),()=>t.delete(d)),destroy:()=>{(tRe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},c=e=n(i,s,l);return l},iRe=n=>n?Eie(n):Eie,{useDebugValue:nRe}=s_,{useSyncExternalStoreWithSelector:sRe}=eRe,oRe=n=>n;function Cpe(n,e=oRe,t){const i=sRe(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return nRe(i),i}const Iie=(n,e)=>{const t=iRe(n),i=(s,o=e)=>Cpe(t,s,o);return Object.assign(i,t),i},rRe=(n,e)=>n?Iie(n,e):Iie;function Bs(n,e){if(Object.is(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;if(n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(const[i,s]of n)if(!Object.is(s,e.get(i)))return!1;return!0}if(n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(const i of n)if(!e.has(i))return!1;return!0}const t=Object.keys(n);if(t.length!==Object.keys(e).length)return!1;for(const i of t)if(!Object.prototype.hasOwnProperty.call(e,i)||!Object.is(n[i],e[i]))return!1;return!0}const O3=R.createContext(null),aRe=O3.Provider,ype=df.error001();function rn(n,e){const t=R.useContext(O3);if(t===null)throw new Error(ype);return Cpe(t,n,e)}function Vs(){const n=R.useContext(O3);if(n===null)throw new Error(ype);return R.useMemo(()=>({getState:n.getState,setState:n.setState,subscribe:n.subscribe}),[n])}const Die={display:"none"},lRe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Spe="react-flow__node-desc",xpe="react-flow__edge-desc",cRe="react-flow__aria-live",dRe=n=>n.ariaLiveMessage,uRe=n=>n.ariaLabelConfig;function hRe({rfId:n}){const e=rn(dRe);return _.jsx("div",{id:`${cRe}-${n}`,"aria-live":"assertive","aria-atomic":"true",style:lRe,children:e})}function fRe({rfId:n,disableKeyboardA11y:e}){const t=rn(uRe);return _.jsxs(_.Fragment,{children:[_.jsx("div",{id:`${Spe}-${n}`,style:Die,children:e?t["node.a11yDescription.default"]:t["node.a11yDescription.keyboardDisabled"]}),_.jsx("div",{id:`${xpe}-${n}`,style:Die,children:t["edge.a11yDescription.default"]}),!e&&_.jsx(hRe,{rfId:n})]})}const F3=R.forwardRef(({position:n="top-left",children:e,className:t,style:i,...s},o)=>{const r=`${n}`.split("-");return _.jsx("div",{className:Zo(["react-flow__panel",t,...r]),style:i,ref:o,...s,children:e})});F3.displayName="Panel";function gRe({proOptions:n,position:e="bottom-right"}){return n!=null&&n.hideAttribution?null:_.jsx(F3,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:_.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const pRe=n=>{const e=[],t=[];for(const[,i]of n.nodeLookup)i.selected&&e.push(i.internals.userNode);for(const[,i]of n.edgeLookup)i.selected&&t.push(i);return{selectedNodes:e,selectedEdges:t}},C2=n=>n.id;function mRe(n,e){return Bs(n.selectedNodes.map(C2),e.selectedNodes.map(C2))&&Bs(n.selectedEdges.map(C2),e.selectedEdges.map(C2))}function _Re({onSelectionChange:n}){const e=Vs(),{selectedNodes:t,selectedEdges:i}=rn(pRe,mRe);return R.useEffect(()=>{const s={nodes:t,edges:i};n==null||n(s),e.getState().onSelectionChangeHandlers.forEach(o=>o(s))},[t,i,n]),null}const bRe=n=>!!n.onSelectionChangeHandlers;function vRe({onSelectionChange:n}){const e=rn(bRe);return n||e?_.jsx(_Re,{onSelectionChange:n}):null}const hH=typeof window<"u"?R.useLayoutEffect:R.useEffect,Lpe=[0,0],wRe={x:0,y:0,zoom:1},CRe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Tie=[...CRe,"rfId"],yRe=n=>({setNodes:n.setNodes,setEdges:n.setEdges,setMinZoom:n.setMinZoom,setMaxZoom:n.setMaxZoom,setTranslateExtent:n.setTranslateExtent,setNodeExtent:n.setNodeExtent,reset:n.reset,setDefaultNodesAndEdges:n.setDefaultNodesAndEdges}),Rie={translateExtent:WE,nodeOrigin:Lpe,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function SRe(n){const{setNodes:e,setEdges:t,setMinZoom:i,setMaxZoom:s,setTranslateExtent:o,setNodeExtent:r,reset:a,setDefaultNodesAndEdges:l}=rn(yRe,Bs),c=Vs();hH(()=>(l(n.defaultNodes,n.defaultEdges),()=>{d.current=Rie,a()}),[]);const d=R.useRef(Rie);return hH(()=>{for(const u of Tie){const h=n[u],f=d.current[u];h!==f&&(typeof n[u]>"u"||(u==="nodes"?e(h):u==="edges"?t(h):u==="minZoom"?i(h):u==="maxZoom"?s(h):u==="translateExtent"?o(h):u==="nodeExtent"?r(h):u==="ariaLabelConfig"?c.setState({ariaLabelConfig:qTe(h)}):u==="fitView"?c.setState({fitViewQueued:h}):u==="fitViewOptions"?c.setState({fitViewOptions:h}):c.setState({[u]:h})))}d.current=n},Tie.map(u=>n[u])),null}function Mie(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function xRe(n){var i;const[e,t]=R.useState(n==="system"?null:n);return R.useEffect(()=>{if(n!=="system"){t(n);return}const s=Mie(),o=()=>t(s!=null&&s.matches?"dark":"light");return o(),s==null||s.addEventListener("change",o),()=>{s==null||s.removeEventListener("change",o)}},[n]),e!==null?e:(i=Mie())!=null&&i.matches?"dark":"light"}const Aie=typeof document<"u"?document:null;function zE(n=null,e={target:Aie,actInsideInputWithModifier:!0}){const[t,i]=R.useState(!1),s=R.useRef(!1),o=R.useRef(new Set([])),[r,a]=R.useMemo(()=>{if(n!==null){const c=(Array.isArray(n)?n:[n]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
+ */var P3=R,q2e=U2e;function K2e(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var G2e=typeof Object.is=="function"?Object.is:K2e,Y2e=q2e.useSyncExternalStore,Z2e=P3.useRef,X2e=P3.useEffect,Q2e=P3.useMemo,J2e=P3.useDebugValue;vpe.useSyncExternalStoreWithSelector=function(n,e,t,i,s){var o=Z2e(null);if(o.current===null){var r={hasValue:!1,value:null};o.current=r}else r=o.current;o=Q2e(function(){function l(f){if(!c){if(c=!0,d=f,f=i(f),s!==void 0&&r.hasValue){var g=r.value;if(s(g,f))return u=g}return u=f}if(g=u,G2e(d,f))return g;var p=i(f);return s!==void 0&&s(g,p)?(d=f,g):(d=f,u=p)}var c=!1,d,u,h=t===void 0?null:t;return[function(){return l(e())},h===null?void 0:function(){return l(h())}]},[e,t,i,s]);var a=Y2e(n,o[0],o[1]);return X2e(function(){r.hasValue=!0,r.value=a},[a]),J2e(a),a};bpe.exports=vpe;var eRe=bpe.exports;const tRe=Jue(eRe),iRe={},Eie=n=>{let e;const t=new Set,i=(d,u)=>{const h=typeof d=="function"?d(e):d;if(!Object.is(h,e)){const f=e;e=u??(typeof h!="object"||h===null)?h:Object.assign({},e,h),t.forEach(g=>g(e,f))}},s=()=>e,l={setState:i,getState:s,getInitialState:()=>c,subscribe:d=>(t.add(d),()=>t.delete(d)),destroy:()=>{(iRe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},c=e=n(i,s,l);return l},nRe=n=>n?Eie(n):Eie,{useDebugValue:sRe}=s_,{useSyncExternalStoreWithSelector:oRe}=tRe,rRe=n=>n;function ype(n,e=rRe,t){const i=oRe(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return sRe(i),i}const Iie=(n,e)=>{const t=nRe(n),i=(s,o=e)=>ype(t,s,o);return Object.assign(i,t),i},aRe=(n,e)=>n?Iie(n,e):Iie;function Bs(n,e){if(Object.is(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;if(n instanceof Map&&e instanceof Map){if(n.size!==e.size)return!1;for(const[i,s]of n)if(!Object.is(s,e.get(i)))return!1;return!0}if(n instanceof Set&&e instanceof Set){if(n.size!==e.size)return!1;for(const i of n)if(!e.has(i))return!1;return!0}const t=Object.keys(n);if(t.length!==Object.keys(e).length)return!1;for(const i of t)if(!Object.prototype.hasOwnProperty.call(e,i)||!Object.is(n[i],e[i]))return!1;return!0}const O3=R.createContext(null),lRe=O3.Provider,Spe=df.error001();function rn(n,e){const t=R.useContext(O3);if(t===null)throw new Error(Spe);return ype(t,n,e)}function Vs(){const n=R.useContext(O3);if(n===null)throw new Error(Spe);return R.useMemo(()=>({getState:n.getState,setState:n.setState,subscribe:n.subscribe}),[n])}const Die={display:"none"},cRe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},xpe="react-flow__node-desc",Lpe="react-flow__edge-desc",dRe="react-flow__aria-live",uRe=n=>n.ariaLiveMessage,hRe=n=>n.ariaLabelConfig;function fRe({rfId:n}){const e=rn(uRe);return m.jsx("div",{id:`${dRe}-${n}`,"aria-live":"assertive","aria-atomic":"true",style:cRe,children:e})}function gRe({rfId:n,disableKeyboardA11y:e}){const t=rn(hRe);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${xpe}-${n}`,style:Die,children:e?t["node.a11yDescription.default"]:t["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${Lpe}-${n}`,style:Die,children:t["edge.a11yDescription.default"]}),!e&&m.jsx(fRe,{rfId:n})]})}const F3=R.forwardRef(({position:n="top-left",children:e,className:t,style:i,...s},o)=>{const r=`${n}`.split("-");return m.jsx("div",{className:Zo(["react-flow__panel",t,...r]),style:i,ref:o,...s,children:e})});F3.displayName="Panel";function pRe({proOptions:n,position:e="bottom-right"}){return n!=null&&n.hideAttribution?null:m.jsx(F3,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:m.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const mRe=n=>{const e=[],t=[];for(const[,i]of n.nodeLookup)i.selected&&e.push(i.internals.userNode);for(const[,i]of n.edgeLookup)i.selected&&t.push(i);return{selectedNodes:e,selectedEdges:t}},C2=n=>n.id;function _Re(n,e){return Bs(n.selectedNodes.map(C2),e.selectedNodes.map(C2))&&Bs(n.selectedEdges.map(C2),e.selectedEdges.map(C2))}function bRe({onSelectionChange:n}){const e=Vs(),{selectedNodes:t,selectedEdges:i}=rn(mRe,_Re);return R.useEffect(()=>{const s={nodes:t,edges:i};n==null||n(s),e.getState().onSelectionChangeHandlers.forEach(o=>o(s))},[t,i,n]),null}const vRe=n=>!!n.onSelectionChangeHandlers;function wRe({onSelectionChange:n}){const e=rn(vRe);return n||e?m.jsx(bRe,{onSelectionChange:n}):null}const hH=typeof window<"u"?R.useLayoutEffect:R.useEffect,kpe=[0,0],CRe={x:0,y:0,zoom:1},yRe=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],Tie=[...yRe,"rfId"],SRe=n=>({setNodes:n.setNodes,setEdges:n.setEdges,setMinZoom:n.setMinZoom,setMaxZoom:n.setMaxZoom,setTranslateExtent:n.setTranslateExtent,setNodeExtent:n.setNodeExtent,reset:n.reset,setDefaultNodesAndEdges:n.setDefaultNodesAndEdges}),Rie={translateExtent:WE,nodeOrigin:kpe,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function xRe(n){const{setNodes:e,setEdges:t,setMinZoom:i,setMaxZoom:s,setTranslateExtent:o,setNodeExtent:r,reset:a,setDefaultNodesAndEdges:l}=rn(SRe,Bs),c=Vs();hH(()=>(l(n.defaultNodes,n.defaultEdges),()=>{d.current=Rie,a()}),[]);const d=R.useRef(Rie);return hH(()=>{for(const u of Tie){const h=n[u],f=d.current[u];h!==f&&(typeof n[u]>"u"||(u==="nodes"?e(h):u==="edges"?t(h):u==="minZoom"?i(h):u==="maxZoom"?s(h):u==="translateExtent"?o(h):u==="nodeExtent"?r(h):u==="ariaLabelConfig"?c.setState({ariaLabelConfig:KTe(h)}):u==="fitView"?c.setState({fitViewQueued:h}):u==="fitViewOptions"?c.setState({fitViewOptions:h}):c.setState({[u]:h})))}d.current=n},Tie.map(u=>n[u])),null}function Mie(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function LRe(n){var i;const[e,t]=R.useState(n==="system"?null:n);return R.useEffect(()=>{if(n!=="system"){t(n);return}const s=Mie(),o=()=>t(s!=null&&s.matches?"dark":"light");return o(),s==null||s.addEventListener("change",o),()=>{s==null||s.removeEventListener("change",o)}},[n]),e!==null?e:(i=Mie())!=null&&i.matches?"dark":"light"}const Aie=typeof document<"u"?document:null;function zE(n=null,e={target:Aie,actInsideInputWithModifier:!0}){const[t,i]=R.useState(!1),s=R.useRef(!1),o=R.useRef(new Set([])),[r,a]=R.useMemo(()=>{if(n!==null){const c=(Array.isArray(n)?n:[n]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
`).replace(`
`,`
+`).split(`
-`)),d=c.reduce((u,h)=>u.concat(...h),[]);return[c,d]}return[[],[]]},[n]);return R.useEffect(()=>{const l=(e==null?void 0:e.target)??Aie,c=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(n!==null){const d=f=>{var m,b;if(s.current=f.ctrlKey||f.metaKey||f.shiftKey||f.altKey,(!s.current||s.current&&!c)&&epe(f))return!1;const p=Oie(f.code,a);if(o.current.add(f[p]),Pie(r,o.current,!1)){const v=((b=(m=f.composedPath)==null?void 0:m.call(f))==null?void 0:b[0])||f.target,C=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";e.preventDefault!==!1&&(s.current||!C)&&f.preventDefault(),i(!0)}},u=f=>{const g=Oie(f.code,a);Pie(r,o.current,!0)?(i(!1),o.current.clear()):o.current.delete(f[g]),f.key==="Meta"&&o.current.clear(),s.current=!1},h=()=>{o.current.clear(),i(!1)};return l==null||l.addEventListener("keydown",d),l==null||l.addEventListener("keyup",u),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{l==null||l.removeEventListener("keydown",d),l==null||l.removeEventListener("keyup",u),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[n,i]),t}function Pie(n,e,t){return n.filter(i=>t||i.length===e.size).some(i=>i.every(s=>e.has(s)))}function Oie(n,e){return e.includes(n)?"code":"key"}const LRe=()=>{const n=Vs();return R.useMemo(()=>({zoomIn:e=>{const{panZoom:t}=n.getState();return t?t.scaleBy(1.2,e):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:t}=n.getState();return t?t.scaleBy(1/1.2,e):Promise.resolve(!1)},zoomTo:(e,t)=>{const{panZoom:i}=n.getState();return i?i.scaleTo(e,t):Promise.resolve(!1)},getZoom:()=>n.getState().transform[2],setViewport:async(e,t)=>{const{transform:[i,s,o],panZoom:r}=n.getState();return r?(await r.setViewport({x:e.x??i,y:e.y??s,zoom:e.zoom??o},t),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,t,i]=n.getState().transform;return{x:e,y:t,zoom:i}},setCenter:async(e,t,i)=>n.getState().setCenter(e,t,i),fitBounds:async(e,t)=>{const{width:i,height:s,minZoom:o,maxZoom:r,panZoom:a}=n.getState(),l=VY(e,i,s,o,r,(t==null?void 0:t.padding)??.1);return a?(await a.setViewport(l,{duration:t==null?void 0:t.duration,ease:t==null?void 0:t.ease,interpolate:t==null?void 0:t.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,t={})=>{const{transform:i,snapGrid:s,snapToGrid:o,domNode:r}=n.getState();if(!r)return e;const{x:a,y:l}=r.getBoundingClientRect(),c={x:e.x-a,y:e.y-l},d=t.snapGrid??s,u=t.snapToGrid??o;return YD(c,i,u,d)},flowToScreenPosition:e=>{const{transform:t,domNode:i}=n.getState();if(!i)return e;const{x:s,y:o}=i.getBoundingClientRect(),r=YA(e,t);return{x:r.x+s,y:r.y+o}}}),[])};function kpe(n,e){const t=[],i=new Map,s=[];for(const o of n)if(o.type==="add"){s.push(o);continue}else if(o.type==="remove"||o.type==="replace")i.set(o.id,[o]);else{const r=i.get(o.id);r?r.push(o):i.set(o.id,[o])}for(const o of e){const r=i.get(o.id);if(!r){t.push(o);continue}if(r[0].type==="remove")continue;if(r[0].type==="replace"){t.push({...r[0].item});continue}const a={...o};for(const l of r)kRe(l,a);t.push(a)}return s.length&&s.forEach(o=>{o.index!==void 0?t.splice(o.index,0,{...o.item}):t.push({...o.item})}),t}function kRe(n,e){switch(n.type){case"select":{e.selected=n.selected;break}case"position":{typeof n.position<"u"&&(e.position=n.position),typeof n.dragging<"u"&&(e.dragging=n.dragging);break}case"dimensions":{typeof n.dimensions<"u"&&(e.measured={...n.dimensions},n.setAttributes&&((n.setAttributes===!0||n.setAttributes==="width")&&(e.width=n.dimensions.width),(n.setAttributes===!0||n.setAttributes==="height")&&(e.height=n.dimensions.height))),typeof n.resizing=="boolean"&&(e.resizing=n.resizing);break}}}function Npe(n,e){return kpe(n,e)}function Epe(n,e){return kpe(n,e)}function qb(n,e){return{id:n,type:"select",selected:e}}function UC(n,e=new Set,t=!1){const i=[];for(const[s,o]of n){const r=e.has(s);!(o.selected===void 0&&!r)&&o.selected!==r&&(t&&(o.selected=r),i.push(qb(o.id,r)))}return i}function Fie({items:n=[],lookup:e}){var s;const t=[],i=new Map(n.map(o=>[o.id,o]));for(const[o,r]of n.entries()){const a=e.get(r.id),l=((s=a==null?void 0:a.internals)==null?void 0:s.userNode)??a;l!==void 0&&l!==r&&t.push({id:r.id,item:r,type:"replace"}),l===void 0&&t.push({item:r,type:"add",index:o})}for(const[o]of e)i.get(o)===void 0&&t.push({id:o,type:"remove"});return t}function Bie(n){return{id:n.id,type:"remove"}}const Wie=n=>OTe(n),NRe=n=>qge(n);function Ipe(n){return R.forwardRef(n)}function Hie(n){const[e,t]=R.useState(BigInt(0)),[i]=R.useState(()=>ERe(()=>t(s=>s+BigInt(1))));return hH(()=>{const s=i.get();s.length&&(n(s),i.reset())},[e]),i}function ERe(n){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n()}}}const Dpe=R.createContext(null);function IRe({children:n}){const e=Vs(),t=R.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:d,onNodesChange:u,nodeLookup:h,fitViewQueued:f,onNodesChangeMiddlewareMap:g}=e.getState();let p=l;for(const b of a)p=typeof b=="function"?b(p):b;let m=Fie({items:p,lookup:h});for(const b of g.values())m=b(m);d&&c(p),m.length>0?u==null||u(m):f&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:v,setNodes:C}=e.getState();b&&C(v)})},[]),i=Hie(t),s=R.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:h}=e.getState();let f=l;for(const g of a)f=typeof g=="function"?g(f):g;d?c(f):u&&u(Fie({items:f,lookup:h}))},[]),o=Hie(s),r=R.useMemo(()=>({nodeQueue:i,edgeQueue:o}),[]);return _.jsx(Dpe.Provider,{value:r,children:n})}function DRe(){const n=R.useContext(Dpe);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}const TRe=n=>!!n.panZoom;function GY(){const n=LRe(),e=Vs(),t=DRe(),i=rn(TRe),s=R.useMemo(()=>{const o=u=>e.getState().nodeLookup.get(u),r=u=>{t.nodeQueue.push(u)},a=u=>{t.edgeQueue.push(u)},l=u=>{var b,v;const{nodeLookup:h,nodeOrigin:f}=e.getState(),g=Wie(u)?u:h.get(u.id),p=g.parentId?Qge(g.position,g.measured,g.parentId,h,f):g.position,m={...g,position:p,width:((b=g.measured)==null?void 0:b.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return KS(m)},c=(u,h,f={replace:!1})=>{r(g=>g.map(p=>{if(p.id===u){const m=typeof h=="function"?h(p):h;return f.replace&&Wie(m)?m:{...p,...m}}return p}))},d=(u,h,f={replace:!1})=>{a(g=>g.map(p=>{if(p.id===u){const m=typeof h=="function"?h(p):h;return f.replace&&NRe(m)?m:{...p,...m}}return p}))};return{getNodes:()=>e.getState().nodes.map(u=>({...u})),getNode:u=>{var h;return(h=o(u))==null?void 0:h.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:u=[]}=e.getState();return u.map(h=>({...h}))},getEdge:u=>e.getState().edgeLookup.get(u),setNodes:r,setEdges:a,addNodes:u=>{const h=Array.isArray(u)?u:[u];t.nodeQueue.push(f=>[...f,...h])},addEdges:u=>{const h=Array.isArray(u)?u:[u];t.edgeQueue.push(f=>[...f,...h])},toObject:()=>{const{nodes:u=[],edges:h=[],transform:f}=e.getState(),[g,p,m]=f;return{nodes:u.map(b=>({...b})),edges:h.map(b=>({...b})),viewport:{x:g,y:p,zoom:m}}},deleteElements:async({nodes:u=[],edges:h=[]})=>{const{nodes:f,edges:g,onNodesDelete:p,onEdgesDelete:m,triggerNodeChanges:b,triggerEdgeChanges:v,onDelete:C,onBeforeDelete:y}=e.getState(),{nodes:S,edges:x}=await VTe({nodesToRemove:u,edgesToRemove:h,nodes:f,edges:g,onBeforeDelete:y}),L=x.length>0,k=S.length>0;if(L){const N=x.map(Bie);m==null||m(x),v(N)}if(k){const N=S.map(Bie);p==null||p(S),b(N)}return(k||L)&&(C==null||C({nodes:S,edges:x})),{deletedNodes:S,deletedEdges:x}},getIntersectingNodes:(u,h=!0,f)=>{const g=pie(u),p=g?u:l(u),m=f!==void 0;return p?(f||e.getState().nodes).filter(b=>{const v=e.getState().nodeLookup.get(b.id);if(v&&!g&&(b.id===u.id||!v.internals.positionAbsolute))return!1;const C=KS(m?b:v),y=VE(C,p);return h&&y>0||y>=C.width*C.height||y>=p.width*p.height}):[]},isNodeIntersecting:(u,h,f=!0)=>{const p=pie(u)?u:l(u);if(!p)return!1;const m=VE(p,h);return f&&m>0||m>=h.width*h.height||m>=p.width*p.height},updateNode:c,updateNodeData:(u,h,f={replace:!1})=>{c(u,g=>{const p=typeof h=="function"?h(g):h;return f.replace?{...g,data:p}:{...g,data:{...g.data,...p}}},f)},updateEdge:d,updateEdgeData:(u,h,f={replace:!1})=>{d(u,g=>{const p=typeof h=="function"?h(g):h;return f.replace?{...g,data:p}:{...g,data:{...g.data,...p}}},f)},getNodesBounds:u=>{const{nodeLookup:h,nodeOrigin:f}=e.getState();return FTe(u,{nodeLookup:h,nodeOrigin:f})},getHandleConnections:({type:u,id:h,nodeId:f})=>{var g;return Array.from(((g=e.getState().connectionLookup.get(`${f}-${u}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:u,handleId:h,nodeId:f})=>{var g;return Array.from(((g=e.getState().connectionLookup.get(`${f}${u?h?`-${u}-${h}`:`-${u}`:""}`))==null?void 0:g.values())??[])},fitView:async u=>{const h=e.getState().fitViewResolver??UTe();return e.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:h}),t.nodeQueue.push(f=>[...f]),h.promise}}},[]);return R.useMemo(()=>({...s,...n,viewportInitialized:i}),[i])}const Vie=n=>n.selected,RRe=typeof window<"u"?window:void 0;function MRe({deleteKeyCode:n,multiSelectionKeyCode:e}){const t=Vs(),{deleteElements:i}=GY(),s=zE(n,{actInsideInputWithModifier:!1}),o=zE(e,{target:RRe});R.useEffect(()=>{if(s){const{edges:r,nodes:a}=t.getState();i({nodes:a.filter(Vie),edges:r.filter(Vie)}),t.setState({nodesSelectionActive:!1})}},[s]),R.useEffect(()=>{t.setState({multiSelectionActive:o})},[o])}function ARe(n){const e=Vs();R.useEffect(()=>{const t=()=>{var s,o,r,a;if(!n.current||!(((o=(s=n.current).checkVisibility)==null?void 0:o.call(s))??!0))return!1;const i=jY(n.current);(i.height===0||i.width===0)&&((a=(r=e.getState()).onError)==null||a.call(r,"004",df.error004())),e.setState({width:i.width||500,height:i.height||500})};if(n.current){t(),window.addEventListener("resize",t);const i=new ResizeObserver(()=>t());return i.observe(n.current),()=>{window.removeEventListener("resize",t),i&&n.current&&i.unobserve(n.current)}}},[])}const B3={position:"absolute",width:"100%",height:"100%",top:0,left:0},PRe=n=>({userSelectionActive:n.userSelectionActive,lib:n.lib,connectionInProgress:n.connection.inProgress});function ORe({onPaneContextMenu:n,zoomOnScroll:e=!0,zoomOnPinch:t=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:o=c1.Free,zoomOnDoubleClick:r=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:d,maxZoom:u,zoomActivationKeyCode:h,preventScrolling:f=!0,children:g,noWheelClassName:p,noPanClassName:m,onViewportChange:b,isControlledViewport:v,paneClickDistance:C,selectionOnDrag:y}){const S=Vs(),x=R.useRef(null),{userSelectionActive:L,lib:k,connectionInProgress:N}=rn(PRe,Bs),T=zE(h),M=R.useRef();ARe(x);const P=R.useCallback(V=>{b==null||b({x:V[0],y:V[1],zoom:V[2]}),v||S.setState({transform:V})},[b,v]);return R.useEffect(()=>{if(x.current){M.current=E2e({domNode:x.current,minZoom:d,maxZoom:u,translateExtent:c,viewport:l,onDraggingChange:z=>S.setState(U=>U.paneDragging===z?U:{paneDragging:z}),onPanZoomStart:(z,U)=>{const{onViewportChangeStart:W,onMoveStart:F}=S.getState();F==null||F(z,U),W==null||W(U)},onPanZoom:(z,U)=>{const{onViewportChange:W,onMove:F}=S.getState();F==null||F(z,U),W==null||W(U)},onPanZoomEnd:(z,U)=>{const{onViewportChangeEnd:W,onMoveEnd:F}=S.getState();F==null||F(z,U),W==null||W(U)}});const{x:V,y:O,zoom:A}=M.current.getViewport();return S.setState({panZoom:M.current,transform:[V,O,A],domNode:x.current.closest(".react-flow")}),()=>{var z;(z=M.current)==null||z.destroy()}}},[]),R.useEffect(()=>{var V;(V=M.current)==null||V.update({onPaneContextMenu:n,zoomOnScroll:e,zoomOnPinch:t,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:o,zoomOnDoubleClick:r,panOnDrag:a,zoomActivationKeyPressed:T,preventScrolling:f,noPanClassName:m,userSelectionActive:L,noWheelClassName:p,lib:k,onTransformChange:P,connectionInProgress:N,selectionOnDrag:y,paneClickDistance:C})},[n,e,t,i,s,o,r,a,T,f,m,L,p,k,P,N,y,C]),_.jsx("div",{className:"react-flow__renderer",ref:x,style:B3,children:g})}const FRe=n=>({userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect});function BRe(){const{userSelectionActive:n,userSelectionRect:e}=rn(FRe,Bs);return n&&e?_.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const b6=(n,e)=>t=>{t.target===e.current&&(n==null||n(t))},WRe=n=>({userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,connectionInProgress:n.connection.inProgress,dragging:n.paneDragging});function HRe({isSelecting:n,selectionKeyPressed:e,selectionMode:t=HE.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:o,onSelectionStart:r,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:d,onPaneMouseEnter:u,onPaneMouseMove:h,onPaneMouseLeave:f,children:g}){const p=Vs(),{userSelectionActive:m,elementsSelectable:b,dragging:v,connectionInProgress:C}=rn(WRe,Bs),y=b&&(n||m),S=R.useRef(null),x=R.useRef(),L=R.useRef(new Set),k=R.useRef(new Set),N=R.useRef(!1),T=W=>{if(N.current||C){N.current=!1;return}l==null||l(W),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},M=W=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){W.preventDefault();return}c==null||c(W)},P=d?W=>d(W):void 0,V=W=>{N.current&&(W.stopPropagation(),N.current=!1)},O=W=>{var ye,$e;const{domNode:F}=p.getState();if(x.current=F==null?void 0:F.getBoundingClientRect(),!x.current)return;const q=W.target===S.current;if(!q&&!!W.target.closest(".nokey")||!n||!(o&&q||e)||W.button!==0||!W.isPrimary)return;($e=(ye=W.target)==null?void 0:ye.setPointerCapture)==null||$e.call(ye,W.pointerId),N.current=!1;const{x:oe,y:ge}=Nu(W.nativeEvent,x.current);p.setState({userSelectionRect:{width:0,height:0,startX:oe,startY:ge,x:oe,y:ge}}),q||(W.stopPropagation(),W.preventDefault())},A=W=>{const{userSelectionRect:F,transform:q,nodeLookup:X,edgeLookup:Q,connectionLookup:oe,triggerNodeChanges:ge,triggerEdgeChanges:ye,defaultEdgeOptions:$e,resetSelectedElements:Ze}=p.getState();if(!x.current||!F)return;const{x:Ee,y:Je}=Nu(W.nativeEvent,x.current),{startX:lt,startY:Ct}=F;if(!N.current){const Ke=e?0:s;if(Math.hypot(Ee-lt,Je-Ct)<=Ke)return;Ze(),r==null||r(W)}N.current=!0;const Oe={startX:lt,startY:Ct,x:EeKe.id)),k.current=new Set;const si=($e==null?void 0:$e.selectable)??!0;for(const Ke of L.current){const ri=oe.get(Ke);if(ri)for(const{edgeId:Di}of ri.values()){const Nn=Q.get(Di);Nn&&(Nn.selectable??si)&&k.current.add(Di)}}if(!mie(Re,L.current)){const Ke=UC(X,L.current,!0);ge(Ke)}if(!mie(gt,k.current)){const Ke=UC(Q,k.current);ye(Ke)}p.setState({userSelectionRect:Oe,userSelectionActive:!0,nodesSelectionActive:!1})},z=W=>{var F,q;W.button===0&&((q=(F=W.target)==null?void 0:F.releasePointerCapture)==null||q.call(F,W.pointerId),!m&&W.target===S.current&&p.getState().userSelectionRect&&(T==null||T(W)),p.setState({userSelectionActive:!1,userSelectionRect:null}),N.current&&(a==null||a(W),p.setState({nodesSelectionActive:L.current.size>0})))},U=i===!0||Array.isArray(i)&&i.includes(0);return _.jsxs("div",{className:Zo(["react-flow__pane",{draggable:U,dragging:v,selection:n}]),onClick:y?void 0:b6(T,S),onContextMenu:b6(M,S),onWheel:b6(P,S),onPointerEnter:y?void 0:u,onPointerMove:y?A:h,onPointerUp:y?z:void 0,onPointerDownCapture:y?O:void 0,onClickCapture:y?V:void 0,onPointerLeave:f,ref:S,style:B3,children:[g,_.jsx(BRe,{})]})}function fH({id:n,store:e,unselect:t=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:r,nodeLookup:a,onError:l}=e.getState(),c=a.get(n);if(!c){l==null||l("012",df.error012(n));return}e.setState({nodesSelectionActive:!1}),c.selected?(t||c.selected&&r)&&(o({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):s([n])}function Tpe({nodeRef:n,disabled:e=!1,noDragClassName:t,handleSelector:i,nodeId:s,isSelectable:o,nodeClickDistance:r}){const a=Vs(),[l,c]=R.useState(!1),d=R.useRef();return R.useEffect(()=>{d.current=g2e({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{fH({id:u,store:a,nodeRef:n})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),R.useEffect(()=>{if(!(e||!n.current||!d.current))return d.current.update({noDragClassName:t,handleSelector:i,domNode:n.current,isSelectable:o,nodeId:s,nodeClickDistance:r}),()=>{var u;(u=d.current)==null||u.destroy()}},[t,i,e,o,n,s,r]),l}const VRe=n=>e=>e.selected&&(e.draggable||n&&typeof e.draggable>"u");function Rpe(){const n=Vs();return R.useCallback(t=>{const{nodeExtent:i,snapToGrid:s,snapGrid:o,nodesDraggable:r,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:d}=n.getState(),u=new Map,h=VRe(r),f=s?o[0]:5,g=s?o[1]:5,p=t.direction.x*f*t.factor,m=t.direction.y*g*t.factor;for(const[,b]of c){if(!h(b))continue;let v={x:b.internals.positionAbsolute.x+p,y:b.internals.positionAbsolute.y+m};s&&(v=GD(v,o));const{position:C,positionAbsolute:y}=Kge({nodeId:b.id,nextPosition:v,nodeLookup:c,nodeExtent:i,nodeOrigin:d,onError:a});b.position=C,b.internals.positionAbsolute=y,u.set(b.id,b)}l(u)},[])}const YY=R.createContext(null),jRe=YY.Provider;YY.Consumer;const Mpe=()=>R.useContext(YY),zRe=n=>({connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName,rfId:n.rfId}),$Re=(n,e,t)=>i=>{const{connectionClickStartHandle:s,connectionMode:o,connection:r}=i,{fromHandle:a,toHandle:l,isValid:c}=r,d=(l==null?void 0:l.nodeId)===n&&(l==null?void 0:l.id)===e&&(l==null?void 0:l.type)===t;return{connectingFrom:(a==null?void 0:a.nodeId)===n&&(a==null?void 0:a.id)===e&&(a==null?void 0:a.type)===t,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===n&&(s==null?void 0:s.id)===e&&(s==null?void 0:s.type)===t,isPossibleEndHandle:o===US.Strict?(a==null?void 0:a.type)!==t:n!==(a==null?void 0:a.nodeId)||e!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!s,valid:d&&c}};function URe({type:n="source",position:e=Wt.Top,isValidConnection:t,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:r,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...h},f){var A,z;const g=r||null,p=n==="target",m=Vs(),b=Mpe(),{connectOnClick:v,noPanClassName:C,rfId:y}=rn(zRe,Bs),{connectingFrom:S,connectingTo:x,clickConnecting:L,isPossibleEndHandle:k,connectionInProcess:N,clickConnectionInProcess:T,valid:M}=rn($Re(b,g,n),Bs);b||(z=(A=m.getState()).onError)==null||z.call(A,"010",df.error010());const P=U=>{const{defaultEdgeOptions:W,onConnect:F,hasDefaultEdges:q}=m.getState(),X={...W,...U};if(q){const{edges:Q,setEdges:oe}=m.getState();oe(QTe(X,Q))}F==null||F(X),a==null||a(X)},V=U=>{if(!b)return;const W=tpe(U.nativeEvent);if(s&&(W&&U.button===0||!W)){const F=m.getState();uH.onPointerDown(U.nativeEvent,{handleDomNode:U.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:p,handleId:g,nodeId:b,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...q)=>{var X,Q;return(Q=(X=m.getState()).onConnectEnd)==null?void 0:Q.call(X,...q)},updateConnection:F.updateConnection,onConnect:P,isValidConnection:t||((...q)=>{var X,Q;return((Q=(X=m.getState()).isValidConnection)==null?void 0:Q.call(X,...q))??!0}),getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}W?d==null||d(U):u==null||u(U)},O=U=>{const{onClickConnectStart:W,onClickConnectEnd:F,connectionClickStartHandle:q,connectionMode:X,isValidConnection:Q,lib:oe,rfId:ge,nodeLookup:ye,connection:$e}=m.getState();if(!b||!q&&!s)return;if(!q){W==null||W(U.nativeEvent,{nodeId:b,handleId:g,handleType:n}),m.setState({connectionClickStartHandle:{nodeId:b,type:n,id:g}});return}const Ze=Jge(U.target),Ee=t||Q,{connection:Je,isValid:lt}=uH.isValid(U.nativeEvent,{handle:{nodeId:b,id:g,type:n},connectionMode:X,fromNodeId:q.nodeId,fromHandleId:q.id||null,fromType:q.type,isValidConnection:Ee,flowId:ge,doc:Ze,lib:oe,nodeLookup:ye});lt&&Je&&P(Je);const Ct=structuredClone($e);delete Ct.inProgress,Ct.toPosition=Ct.toHandle?Ct.toHandle.position:null,F==null||F(U,Ct),m.setState({connectionClickStartHandle:null})};return _.jsx("div",{"data-handleid":g,"data-nodeid":b,"data-handlepos":e,"data-id":`${y}-${b}-${g}-${n}`,className:Zo(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,c,{source:!p,target:p,connectable:i,connectablestart:s,connectableend:o,clickconnecting:L,connectingfrom:S,connectingto:x,valid:M,connectionindicator:i&&(!N||k)&&(N||T?o:s)}]),onMouseDown:V,onTouchStart:V,onClick:v?O:void 0,ref:f,...h,children:l})}const XS=R.memo(Ipe(URe));function qRe({data:n,isConnectable:e,sourcePosition:t=Wt.Bottom}){return _.jsxs(_.Fragment,{children:[n==null?void 0:n.label,_.jsx(XS,{type:"source",position:t,isConnectable:e})]})}function KRe({data:n,isConnectable:e,targetPosition:t=Wt.Top,sourcePosition:i=Wt.Bottom}){return _.jsxs(_.Fragment,{children:[_.jsx(XS,{type:"target",position:t,isConnectable:e}),n==null?void 0:n.label,_.jsx(XS,{type:"source",position:i,isConnectable:e})]})}function GRe(){return null}function YRe({data:n,isConnectable:e,targetPosition:t=Wt.Top}){return _.jsxs(_.Fragment,{children:[_.jsx(XS,{type:"target",position:t,isConnectable:e}),n==null?void 0:n.label]})}const ZA={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},jie={input:qRe,default:KRe,output:YRe,group:GRe};function ZRe(n){var e,t,i,s;return n.internals.handleBounds===void 0?{width:n.width??n.initialWidth??((e=n.style)==null?void 0:e.width),height:n.height??n.initialHeight??((t=n.style)==null?void 0:t.height)}:{width:n.width??((i=n.style)==null?void 0:i.width),height:n.height??((s=n.style)==null?void 0:s.height)}}const XRe=n=>{const{width:e,height:t,x:i,y:s}=KD(n.nodeLookup,{filter:o=>!!o.selected});return{width:ku(e)?e:null,height:ku(t)?t:null,userSelectionActive:n.userSelectionActive,transformString:`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]}) translate(${i}px,${s}px)`}};function QRe({onSelectionContextMenu:n,noPanClassName:e,disableKeyboardA11y:t}){const i=Vs(),{width:s,height:o,transformString:r,userSelectionActive:a}=rn(XRe,Bs),l=Rpe(),c=R.useRef(null);R.useEffect(()=>{var f;t||(f=c.current)==null||f.focus({preventScroll:!0})},[t]);const d=!a&&s!==null&&o!==null;if(Tpe({nodeRef:c,disabled:!d}),!d)return null;const u=n?f=>{const g=i.getState().nodes.filter(p=>p.selected);n(f,g)}:void 0,h=f=>{Object.prototype.hasOwnProperty.call(ZA,f.key)&&(f.preventDefault(),l({direction:ZA[f.key],factor:f.shiftKey?4:1}))};return _.jsx("div",{className:Zo(["react-flow__nodesselection","react-flow__container",e]),style:{transform:r},children:_.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:t?void 0:-1,onKeyDown:t?void 0:h,style:{width:s,height:o}})})}const zie=typeof window<"u"?window:void 0,JRe=n=>({nodesSelectionActive:n.nodesSelectionActive,userSelectionActive:n.userSelectionActive});function Ape({children:n,onPaneClick:e,onPaneMouseEnter:t,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:r,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:d,selectionMode:u,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:g,panActivationKeyCode:p,zoomActivationKeyCode:m,elementsSelectable:b,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:y,panOnScrollSpeed:S,panOnScrollMode:x,zoomOnDoubleClick:L,panOnDrag:k,defaultViewport:N,translateExtent:T,minZoom:M,maxZoom:P,preventScrolling:V,onSelectionContextMenu:O,noWheelClassName:A,noPanClassName:z,disableKeyboardA11y:U,onViewportChange:W,isControlledViewport:F}){const{nodesSelectionActive:q,userSelectionActive:X}=rn(JRe,Bs),Q=zE(c,{target:zie}),oe=zE(p,{target:zie}),ge=oe||k,ye=oe||y,$e=d&&ge!==!0,Ze=Q||X||$e;return MRe({deleteKeyCode:l,multiSelectionKeyCode:g}),_.jsx(ORe,{onPaneContextMenu:o,elementsSelectable:b,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:ye,panOnScrollSpeed:S,panOnScrollMode:x,zoomOnDoubleClick:L,panOnDrag:!Q&&ge,defaultViewport:N,translateExtent:T,minZoom:M,maxZoom:P,zoomActivationKeyCode:m,preventScrolling:V,noWheelClassName:A,noPanClassName:z,onViewportChange:W,isControlledViewport:F,paneClickDistance:a,selectionOnDrag:$e,children:_.jsxs(HRe,{onSelectionStart:h,onSelectionEnd:f,onPaneClick:e,onPaneMouseEnter:t,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:r,panOnDrag:ge,isSelecting:!!Ze,selectionMode:u,selectionKeyPressed:Q,paneClickDistance:a,selectionOnDrag:$e,children:[n,q&&_.jsx(QRe,{onSelectionContextMenu:O,noPanClassName:z,disableKeyboardA11y:U})]})})}Ape.displayName="FlowRenderer";const eMe=R.memo(Ape),tMe=n=>e=>n?HY(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(t=>t.id):Array.from(e.nodeLookup.keys());function iMe(n){return rn(R.useCallback(tMe(n),[n]),Bs)}const nMe=n=>n.updateNodeInternals;function sMe(){const n=rn(nMe),[e]=R.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(t=>{const i=new Map;t.forEach(s=>{const o=s.target.getAttribute("data-id");i.set(o,{id:o,nodeElement:s.target,force:!0})}),n(i)}));return R.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function oMe({node:n,nodeType:e,hasDimensions:t,resizeObserver:i}){const s=Vs(),o=R.useRef(null),r=R.useRef(null),a=R.useRef(n.sourcePosition),l=R.useRef(n.targetPosition),c=R.useRef(e),d=t&&!!n.internals.handleBounds;return R.useEffect(()=>{o.current&&!n.hidden&&(!d||r.current!==o.current)&&(r.current&&(i==null||i.unobserve(r.current)),i==null||i.observe(o.current),r.current=o.current)},[d,n.hidden]),R.useEffect(()=>()=>{r.current&&(i==null||i.unobserve(r.current),r.current=null)},[]),R.useEffect(()=>{if(o.current){const u=c.current!==e,h=a.current!==n.sourcePosition,f=l.current!==n.targetPosition;(u||h||f)&&(c.current=e,a.current=n.sourcePosition,l.current=n.targetPosition,s.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:o.current,force:!0}]])))}},[n.id,e,n.sourcePosition,n.targetPosition]),o}function rMe({id:n,onClick:e,onMouseEnter:t,onMouseMove:i,onMouseLeave:s,onContextMenu:o,onDoubleClick:r,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:d,resizeObserver:u,noDragClassName:h,noPanClassName:f,disableKeyboardA11y:g,rfId:p,nodeTypes:m,nodeClickDistance:b,onError:v}){const{node:C,internals:y,isParent:S}=rn(Ee=>{const Je=Ee.nodeLookup.get(n),lt=Ee.parentLookup.has(n);return{node:Je,internals:Je.internals,isParent:lt}},Bs);let x=C.type||"default",L=(m==null?void 0:m[x])||jie[x];L===void 0&&(v==null||v("003",df.error003(x)),x="default",L=(m==null?void 0:m.default)||jie.default);const k=!!(C.draggable||a&&typeof C.draggable>"u"),N=!!(C.selectable||l&&typeof C.selectable>"u"),T=!!(C.connectable||c&&typeof C.connectable>"u"),M=!!(C.focusable||d&&typeof C.focusable>"u"),P=Vs(),V=Xge(C),O=oMe({node:C,nodeType:x,hasDimensions:V,resizeObserver:u}),A=Tpe({nodeRef:O,disabled:C.hidden||!k,noDragClassName:h,handleSelector:C.dragHandle,nodeId:n,isSelectable:N,nodeClickDistance:b}),z=Rpe();if(C.hidden)return null;const U=Fp(C),W=ZRe(C),F=N||k||e||t||i||s,q=t?Ee=>t(Ee,{...y.userNode}):void 0,X=i?Ee=>i(Ee,{...y.userNode}):void 0,Q=s?Ee=>s(Ee,{...y.userNode}):void 0,oe=o?Ee=>o(Ee,{...y.userNode}):void 0,ge=r?Ee=>r(Ee,{...y.userNode}):void 0,ye=Ee=>{const{selectNodesOnDrag:Je,nodeDragThreshold:lt}=P.getState();N&&(!Je||!k||lt>0)&&fH({id:n,store:P,nodeRef:O}),e&&e(Ee,{...y.userNode})},$e=Ee=>{if(!(epe(Ee.nativeEvent)||g)){if(jge.includes(Ee.key)&&N){const Je=Ee.key==="Escape";fH({id:n,store:P,unselect:Je,nodeRef:O})}else if(k&&C.selected&&Object.prototype.hasOwnProperty.call(ZA,Ee.key)){Ee.preventDefault();const{ariaLabelConfig:Je}=P.getState();P.setState({ariaLiveMessage:Je["node.a11yDescription.ariaLiveMessage"]({direction:Ee.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),z({direction:ZA[Ee.key],factor:Ee.shiftKey?4:1})}}},Ze=()=>{var gt;if(g||!((gt=O.current)!=null&>.matches(":focus-visible")))return;const{transform:Ee,width:Je,height:lt,autoPanOnNodeFocus:Ct,setCenter:Oe}=P.getState();if(!Ct)return;HY(new Map([[n,C]]),{x:0,y:0,width:Je,height:lt},Ee,!0).length>0||Oe(C.position.x+U.width/2,C.position.y+U.height/2,{zoom:Ee[2]})};return _.jsx("div",{className:Zo(["react-flow__node",`react-flow__node-${x}`,{[f]:k},C.className,{selected:C.selected,selectable:N,parent:S,draggable:k,dragging:A}]),ref:O,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:V?"visible":"hidden",...C.style,...W},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:q,onMouseMove:X,onMouseLeave:Q,onContextMenu:oe,onClick:ye,onDoubleClick:ge,onKeyDown:M?$e:void 0,tabIndex:M?0:void 0,onFocus:M?Ze:void 0,role:C.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Spe}-${p}`,"aria-label":C.ariaLabel,...C.domAttributes,children:_.jsx(jRe,{value:n,children:_.jsx(L,{id:n,data:C.data,type:x,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:C.selected??!1,selectable:N,draggable:k,deletable:C.deletable??!0,isConnectable:T,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:A,dragHandle:C.dragHandle,zIndex:y.z,parentId:C.parentId,...U})})})}var aMe=R.memo(rMe);const lMe=n=>({nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,onError:n.onError});function Ppe(n){const{nodesDraggable:e,nodesConnectable:t,nodesFocusable:i,elementsSelectable:s,onError:o}=rn(lMe,Bs),r=iMe(n.onlyRenderVisibleElements),a=sMe();return _.jsx("div",{className:"react-flow__nodes",style:B3,children:r.map(l=>_.jsx(aMe,{id:l,nodeTypes:n.nodeTypes,nodeExtent:n.nodeExtent,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:a,nodesDraggable:e,nodesConnectable:t,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:n.nodeClickDistance,onError:o},l))})}Ppe.displayName="NodeRenderer";const cMe=R.memo(Ppe);function dMe(n){return rn(R.useCallback(t=>{if(!n)return t.edges.map(s=>s.id);const i=[];if(t.width&&t.height)for(const s of t.edges){const o=t.nodeLookup.get(s.source),r=t.nodeLookup.get(s.target);o&&r&&YTe({sourceNode:o,targetNode:r,width:t.width,height:t.height,transform:t.transform})&&i.push(s.id)}return i},[n]),Bs)}const uMe=({color:n="none",strokeWidth:e=1})=>{const t={strokeWidth:e,...n&&{stroke:n}};return _.jsx("polyline",{className:"arrow",style:t,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},hMe=({color:n="none",strokeWidth:e=1})=>{const t={strokeWidth:e,...n&&{stroke:n,fill:n}};return _.jsx("polyline",{className:"arrowclosed",style:t,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},$ie={[T0.Arrow]:uMe,[T0.ArrowClosed]:hMe};function fMe(n){const e=Vs();return R.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call($ie,n)?$ie[n]:((o=(s=e.getState()).onError)==null||o.call(s,"009",df.error009(n)),null)},[n])}const gMe=({id:n,type:e,color:t,width:i=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:r,orient:a="auto-start-reverse"})=>{const l=fMe(e);return l?_.jsx("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:_.jsx(l,{color:t,strokeWidth:r})}):null},Ope=({defaultColor:n,rfId:e})=>{const t=rn(o=>o.edges),i=rn(o=>o.defaultEdgeOptions),s=R.useMemo(()=>n2e(t,{id:e,defaultColor:n,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[t,i,e,n]);return s.length?_.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:_.jsx("defs",{children:s.map(o=>_.jsx(gMe,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};Ope.displayName="MarkerDefinitions";var pMe=R.memo(Ope);function Fpe({x:n,y:e,label:t,labelStyle:i,labelShowBg:s=!0,labelBgStyle:o,labelBgPadding:r=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d}){const[u,h]=R.useState({x:1,y:0,width:0,height:0}),f=Zo(["react-flow__edge-textwrapper",c]),g=R.useRef(null);return R.useEffect(()=>{if(g.current){const p=g.current.getBBox();h({x:p.x,y:p.y,width:p.width,height:p.height})}},[t]),t?_.jsxs("g",{transform:`translate(${n-u.width/2} ${e-u.height/2})`,className:f,visibility:u.width?"visible":"hidden",...d,children:[s&&_.jsx("rect",{width:u.width+2*r[0],x:-r[0],y:-r[1],height:u.height+2*r[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),_.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:i,children:t}),l]}):null}Fpe.displayName="EdgeText";const mMe=R.memo(Fpe);function W3({path:n,labelX:e,labelY:t,label:i,labelStyle:s,labelShowBg:o,labelBgStyle:r,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...d}){return _.jsxs(_.Fragment,{children:[_.jsx("path",{...d,d:n,fill:"none",className:Zo(["react-flow__edge-path",d.className])}),c?_.jsx("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,i&&ku(e)&&ku(t)?_.jsx(mMe,{x:e,y:t,label:i,labelStyle:s,labelShowBg:o,labelBgStyle:r,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Uie({pos:n,x1:e,y1:t,x2:i,y2:s}){return n===Wt.Left||n===Wt.Right?[.5*(e+i),t]:[e,.5*(t+s)]}function Bpe({sourceX:n,sourceY:e,sourcePosition:t=Wt.Bottom,targetX:i,targetY:s,targetPosition:o=Wt.Top}){const[r,a]=Uie({pos:t,x1:n,y1:e,x2:i,y2:s}),[l,c]=Uie({pos:o,x1:i,y1:s,x2:n,y2:e}),[d,u,h,f]=ipe({sourceX:n,sourceY:e,targetX:i,targetY:s,sourceControlX:r,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${n},${e} C${r},${a} ${l},${c} ${i},${s}`,d,u,h,f]}function Wpe(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,sourcePosition:r,targetPosition:a,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:m,interactionWidth:b})=>{const[v,C,y]=Bpe({sourceX:t,sourceY:i,sourcePosition:r,targetX:s,targetY:o,targetPosition:a}),S=n.isInternal?void 0:e;return _.jsx(W3,{id:S,path:v,labelX:C,labelY:y,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:m,interactionWidth:b})})}const _Me=Wpe({isInternal:!1}),Hpe=Wpe({isInternal:!0});_Me.displayName="SimpleBezierEdge";Hpe.displayName="SimpleBezierEdgeInternal";function Vpe(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,sourcePosition:f=Wt.Bottom,targetPosition:g=Wt.Top,markerEnd:p,markerStart:m,pathOptions:b,interactionWidth:v})=>{const[C,y,S]=lH({sourceX:t,sourceY:i,sourcePosition:f,targetX:s,targetY:o,targetPosition:g,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset,stepPosition:b==null?void 0:b.stepPosition}),x=n.isInternal?void 0:e;return _.jsx(W3,{id:x,path:C,labelX:y,labelY:S,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:p,markerStart:m,interactionWidth:v})})}const jpe=Vpe({isInternal:!1}),zpe=Vpe({isInternal:!0});jpe.displayName="SmoothStepEdge";zpe.displayName="SmoothStepEdgeInternal";function $pe(n){return R.memo(({id:e,...t})=>{var s;const i=n.isInternal?void 0:e;return _.jsx(jpe,{...t,id:i,pathOptions:R.useMemo(()=>{var o;return{borderRadius:0,offset:(o=t.pathOptions)==null?void 0:o.offset}},[(s=t.pathOptions)==null?void 0:s.offset])})})}const bMe=$pe({isInternal:!1}),Upe=$pe({isInternal:!0});bMe.displayName="StepEdge";Upe.displayName="StepEdgeInternal";function qpe(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:g,interactionWidth:p})=>{const[m,b,v]=ope({sourceX:t,sourceY:i,targetX:s,targetY:o}),C=n.isInternal?void 0:e;return _.jsx(W3,{id:C,path:m,labelX:b,labelY:v,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:g,interactionWidth:p})})}const vMe=qpe({isInternal:!1}),Kpe=qpe({isInternal:!0});vMe.displayName="StraightEdge";Kpe.displayName="StraightEdgeInternal";function Gpe(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,sourcePosition:r=Wt.Bottom,targetPosition:a=Wt.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:m,pathOptions:b,interactionWidth:v})=>{const[C,y,S]=npe({sourceX:t,sourceY:i,sourcePosition:r,targetX:s,targetY:o,targetPosition:a,curvature:b==null?void 0:b.curvature}),x=n.isInternal?void 0:e;return _.jsx(W3,{id:x,path:C,labelX:y,labelY:S,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:m,interactionWidth:v})})}const wMe=Gpe({isInternal:!1}),Ype=Gpe({isInternal:!0});wMe.displayName="BezierEdge";Ype.displayName="BezierEdgeInternal";const qie={default:Ype,straight:Kpe,step:Upe,smoothstep:zpe,simplebezier:Hpe},Kie={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},CMe=(n,e,t)=>t===Wt.Left?n-e:t===Wt.Right?n+e:n,yMe=(n,e,t)=>t===Wt.Top?n-e:t===Wt.Bottom?n+e:n,Gie="react-flow__edgeupdater";function Yie({position:n,centerX:e,centerY:t,radius:i=10,onMouseDown:s,onMouseEnter:o,onMouseOut:r,type:a}){return _.jsx("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:r,className:Zo([Gie,`${Gie}-${a}`]),cx:CMe(e,i,n),cy:yMe(t,i,n),r:i,stroke:"transparent",fill:"transparent"})}function SMe({isReconnectable:n,reconnectRadius:e,edge:t,sourceX:i,sourceY:s,targetX:o,targetY:r,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:d,onReconnectEnd:u,setReconnecting:h,setUpdateHover:f}){const g=Vs(),p=(y,S)=>{if(y.button!==0)return;const{autoPanOnConnect:x,domNode:L,connectionMode:k,connectionRadius:N,lib:T,onConnectStart:M,cancelConnection:P,nodeLookup:V,rfId:O,panBy:A,updateConnection:z}=g.getState(),U=S.type==="target",W=(X,Q)=>{h(!1),u==null||u(X,t,S.type,Q)},F=X=>c==null?void 0:c(t,X),q=(X,Q)=>{h(!0),d==null||d(y,t,S.type),M==null||M(X,Q)};uH.onPointerDown(y.nativeEvent,{autoPanOnConnect:x,connectionMode:k,connectionRadius:N,domNode:L,handleId:S.id,nodeId:S.nodeId,nodeLookup:V,isTarget:U,edgeUpdaterType:S.type,lib:T,flowId:O,cancelConnection:P,panBy:A,isValidConnection:(...X)=>{var Q,oe;return((oe=(Q=g.getState()).isValidConnection)==null?void 0:oe.call(Q,...X))??!0},onConnect:F,onConnectStart:q,onConnectEnd:(...X)=>{var Q,oe;return(oe=(Q=g.getState()).onConnectEnd)==null?void 0:oe.call(Q,...X)},onReconnectEnd:W,updateConnection:z,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},m=y=>p(y,{nodeId:t.target,id:t.targetHandle??null,type:"target"}),b=y=>p(y,{nodeId:t.source,id:t.sourceHandle??null,type:"source"}),v=()=>f(!0),C=()=>f(!1);return _.jsxs(_.Fragment,{children:[(n===!0||n==="source")&&_.jsx(Yie,{position:a,centerX:i,centerY:s,radius:e,onMouseDown:m,onMouseEnter:v,onMouseOut:C,type:"source"}),(n===!0||n==="target")&&_.jsx(Yie,{position:l,centerX:o,centerY:r,radius:e,onMouseDown:b,onMouseEnter:v,onMouseOut:C,type:"target"})]})}function xMe({id:n,edgesFocusable:e,edgesReconnectable:t,elementsSelectable:i,onClick:s,onDoubleClick:o,onContextMenu:r,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,rfId:g,edgeTypes:p,noPanClassName:m,onError:b,disableKeyboardA11y:v}){let C=rn(Oe=>Oe.edgeLookup.get(n));const y=rn(Oe=>Oe.defaultEdgeOptions);C=y?{...y,...C}:C;let S=C.type||"default",x=(p==null?void 0:p[S])||qie[S];x===void 0&&(b==null||b("011",df.error011(S)),S="default",x=(p==null?void 0:p.default)||qie.default);const L=!!(C.focusable||e&&typeof C.focusable>"u"),k=typeof u<"u"&&(C.reconnectable||t&&typeof C.reconnectable>"u"),N=!!(C.selectable||i&&typeof C.selectable>"u"),T=R.useRef(null),[M,P]=R.useState(!1),[V,O]=R.useState(!1),A=Vs(),{zIndex:z,sourceX:U,sourceY:W,targetX:F,targetY:q,sourcePosition:X,targetPosition:Q}=rn(R.useCallback(Oe=>{const Re=Oe.nodeLookup.get(C.source),gt=Oe.nodeLookup.get(C.target);if(!Re||!gt)return{zIndex:C.zIndex,...Kie};const si=i2e({id:n,sourceNode:Re,targetNode:gt,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:Oe.connectionMode,onError:b});return{zIndex:GTe({selected:C.selected,zIndex:C.zIndex,sourceNode:Re,targetNode:gt,elevateOnSelect:Oe.elevateEdgesOnSelect,zIndexMode:Oe.zIndexMode}),...si||Kie}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),Bs),oe=R.useMemo(()=>C.markerStart?`url('#${cH(C.markerStart,g)}')`:void 0,[C.markerStart,g]),ge=R.useMemo(()=>C.markerEnd?`url('#${cH(C.markerEnd,g)}')`:void 0,[C.markerEnd,g]);if(C.hidden||U===null||W===null||F===null||q===null)return null;const ye=Oe=>{var Ke;const{addSelectedEdges:Re,unselectNodesAndEdges:gt,multiSelectionActive:si}=A.getState();N&&(A.setState({nodesSelectionActive:!1}),C.selected&&si?(gt({nodes:[],edges:[C]}),(Ke=T.current)==null||Ke.blur()):Re([n])),s&&s(Oe,C)},$e=o?Oe=>{o(Oe,{...C})}:void 0,Ze=r?Oe=>{r(Oe,{...C})}:void 0,Ee=a?Oe=>{a(Oe,{...C})}:void 0,Je=l?Oe=>{l(Oe,{...C})}:void 0,lt=c?Oe=>{c(Oe,{...C})}:void 0,Ct=Oe=>{var Re;if(!v&&jge.includes(Oe.key)&&N){const{unselectNodesAndEdges:gt,addSelectedEdges:si}=A.getState();Oe.key==="Escape"?((Re=T.current)==null||Re.blur(),gt({edges:[C]})):si([n])}};return _.jsx("svg",{style:{zIndex:z},children:_.jsxs("g",{className:Zo(["react-flow__edge",`react-flow__edge-${S}`,C.className,m,{selected:C.selected,animated:C.animated,inactive:!N&&!s,updating:M,selectable:N}]),onClick:ye,onDoubleClick:$e,onContextMenu:Ze,onMouseEnter:Ee,onMouseMove:Je,onMouseLeave:lt,onKeyDown:L?Ct:void 0,tabIndex:L?0:void 0,role:C.ariaRole??(L?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":L?`${xpe}-${g}`:void 0,ref:T,...C.domAttributes,children:[!V&&_.jsx(x,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:N,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:U,sourceY:W,targetX:F,targetY:q,sourcePosition:X,targetPosition:Q,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:oe,markerEnd:ge,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),k&&_.jsx(SMe,{edge:C,isReconnectable:k,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,sourceX:U,sourceY:W,targetX:F,targetY:q,sourcePosition:X,targetPosition:Q,setUpdateHover:P,setReconnecting:O})]})})}var LMe=R.memo(xMe);const kMe=n=>({edgesFocusable:n.edgesFocusable,edgesReconnectable:n.edgesReconnectable,elementsSelectable:n.elementsSelectable,connectionMode:n.connectionMode,onError:n.onError});function Zpe({defaultMarkerColor:n,onlyRenderVisibleElements:e,rfId:t,edgeTypes:i,noPanClassName:s,onReconnect:o,onEdgeContextMenu:r,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:h,onReconnectStart:f,onReconnectEnd:g,disableKeyboardA11y:p}){const{edgesFocusable:m,edgesReconnectable:b,elementsSelectable:v,onError:C}=rn(kMe,Bs),y=dMe(e);return _.jsxs("div",{className:"react-flow__edges",children:[_.jsx(pMe,{defaultColor:n,rfId:t}),y.map(S=>_.jsx(LMe,{id:S,edgesFocusable:m,edgesReconnectable:b,elementsSelectable:v,noPanClassName:s,onReconnect:o,onContextMenu:r,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,reconnectRadius:u,onDoubleClick:h,onReconnectStart:f,onReconnectEnd:g,rfId:t,onError:C,edgeTypes:i,disableKeyboardA11y:p},S))]})}Zpe.displayName="EdgeRenderer";const NMe=R.memo(Zpe),EMe=n=>`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`;function IMe({children:n}){const e=rn(EMe);return _.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:n})}function DMe(n){const e=GY(),t=R.useRef(!1);R.useEffect(()=>{!t.current&&e.viewportInitialized&&n&&(setTimeout(()=>n(e),1),t.current=!0)},[n,e.viewportInitialized])}const TMe=n=>{var e;return(e=n.panZoom)==null?void 0:e.syncViewport};function RMe(n){const e=rn(TMe),t=Vs();return R.useEffect(()=>{n&&(e==null||e(n),t.setState({transform:[n.x,n.y,n.zoom]}))},[n,e]),null}function MMe(n){return n.connection.inProgress?{...n.connection,to:YD(n.connection.to,n.transform)}:{...n.connection}}function AMe(n){return MMe}function PMe(n){const e=AMe();return rn(e,Bs)}const OMe=n=>({nodesConnectable:n.nodesConnectable,isValid:n.connection.isValid,inProgress:n.connection.inProgress,width:n.width,height:n.height});function FMe({containerStyle:n,style:e,type:t,component:i}){const{nodesConnectable:s,width:o,height:r,isValid:a,inProgress:l}=rn(OMe,Bs);return!(o&&s&&l)?null:_.jsx("svg",{style:n,width:o,height:r,className:"react-flow__connectionline react-flow__container",children:_.jsx("g",{className:Zo(["react-flow__connection",Uge(a)]),children:_.jsx(Xpe,{style:e,type:t,CustomComponent:i,isValid:a})})})}const Xpe=({style:n,type:e=Cg.Bezier,CustomComponent:t,isValid:i})=>{const{inProgress:s,from:o,fromNode:r,fromHandle:a,fromPosition:l,to:c,toNode:d,toHandle:u,toPosition:h,pointer:f}=PMe();if(!s)return;if(t)return _.jsx(t,{connectionLineType:e,connectionLineStyle:n,fromNode:r,fromHandle:a,fromX:o.x,fromY:o.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:h,connectionStatus:Uge(i),toNode:d,toHandle:u,pointer:f});let g="";const p={sourceX:o.x,sourceY:o.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:h};switch(e){case Cg.Bezier:[g]=npe(p);break;case Cg.SimpleBezier:[g]=Bpe(p);break;case Cg.Step:[g]=lH({...p,borderRadius:0});break;case Cg.SmoothStep:[g]=lH(p);break;default:[g]=ope(p)}return _.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:n})};Xpe.displayName="ConnectionLine";const BMe={};function Zie(n=BMe){R.useRef(n),Vs(),R.useEffect(()=>{},[n])}function WMe(){Vs(),R.useRef(!1),R.useEffect(()=>{},[])}function Qpe({nodeTypes:n,edgeTypes:e,onInit:t,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:o,onEdgeDoubleClick:r,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:h,onSelectionEnd:f,connectionLineType:g,connectionLineStyle:p,connectionLineComponent:m,connectionLineContainerStyle:b,selectionKeyCode:v,selectionOnDrag:C,selectionMode:y,multiSelectionKeyCode:S,panActivationKeyCode:x,zoomActivationKeyCode:L,deleteKeyCode:k,onlyRenderVisibleElements:N,elementsSelectable:T,defaultViewport:M,translateExtent:P,minZoom:V,maxZoom:O,preventScrolling:A,defaultMarkerColor:z,zoomOnScroll:U,zoomOnPinch:W,panOnScroll:F,panOnScrollSpeed:q,panOnScrollMode:X,zoomOnDoubleClick:Q,panOnDrag:oe,onPaneClick:ge,onPaneMouseEnter:ye,onPaneMouseMove:$e,onPaneMouseLeave:Ze,onPaneScroll:Ee,onPaneContextMenu:Je,paneClickDistance:lt,nodeClickDistance:Ct,onEdgeContextMenu:Oe,onEdgeMouseEnter:Re,onEdgeMouseMove:gt,onEdgeMouseLeave:si,reconnectRadius:Ke,onReconnect:ri,onReconnectStart:Di,onReconnectEnd:Nn,noDragClassName:Ye,noWheelClassName:qt,noPanClassName:Zt,disableKeyboardA11y:ln,nodeExtent:fa,rfId:po,viewport:es,onViewportChange:ts}){return Zie(n),Zie(e),WMe(),DMe(t),RMe(es),_.jsx(eMe,{onPaneClick:ge,onPaneMouseEnter:ye,onPaneMouseMove:$e,onPaneMouseLeave:Ze,onPaneContextMenu:Je,onPaneScroll:Ee,paneClickDistance:lt,deleteKeyCode:k,selectionKeyCode:v,selectionOnDrag:C,selectionMode:y,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:S,panActivationKeyCode:x,zoomActivationKeyCode:L,elementsSelectable:T,zoomOnScroll:U,zoomOnPinch:W,zoomOnDoubleClick:Q,panOnScroll:F,panOnScrollSpeed:q,panOnScrollMode:X,panOnDrag:oe,defaultViewport:M,translateExtent:P,minZoom:V,maxZoom:O,onSelectionContextMenu:u,preventScrolling:A,noDragClassName:Ye,noWheelClassName:qt,noPanClassName:Zt,disableKeyboardA11y:ln,onViewportChange:ts,isControlledViewport:!!es,children:_.jsxs(IMe,{children:[_.jsx(NMe,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:r,onReconnect:ri,onReconnectStart:Di,onReconnectEnd:Nn,onlyRenderVisibleElements:N,onEdgeContextMenu:Oe,onEdgeMouseEnter:Re,onEdgeMouseMove:gt,onEdgeMouseLeave:si,reconnectRadius:Ke,defaultMarkerColor:z,noPanClassName:Zt,disableKeyboardA11y:ln,rfId:po}),_.jsx(FMe,{style:p,type:g,component:m,containerStyle:b}),_.jsx("div",{className:"react-flow__edgelabel-renderer"}),_.jsx(cMe,{nodeTypes:n,onNodeClick:i,onNodeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,nodeClickDistance:Ct,onlyRenderVisibleElements:N,noPanClassName:Zt,noDragClassName:Ye,disableKeyboardA11y:ln,nodeExtent:fa,rfId:po}),_.jsx("div",{className:"react-flow__viewport-portal"})]})})}Qpe.displayName="GraphView";const HMe=R.memo(Qpe),Xie=({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,width:s,height:o,fitView:r,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:h="basic"}={})=>{const f=new Map,g=new Map,p=new Map,m=new Map,b=i??e??[],v=t??n??[],C=d??[0,0],y=u??WE;lpe(p,m,b);const{nodesInitialized:S}=dH(v,f,g,{nodeOrigin:C,nodeExtent:y,zIndexMode:h});let x=[0,0,1];if(r&&s&&o){const L=KD(f,{filter:M=>!!((M.width||M.initialWidth)&&(M.height||M.initialHeight))}),{x:k,y:N,zoom:T}=VY(L,s,o,l,c,(a==null?void 0:a.padding)??.1);x=[k,N,T]}return{rfId:"1",width:s??0,height:o??0,transform:x,nodes:v,nodesInitialized:S,nodeLookup:f,parentLookup:g,edges:b,edgeLookup:m,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:t!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:WE,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:US.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:r??!1,fitViewOptions:a,fitViewResolver:null,connection:{...$ge},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:jTe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:zge,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},VMe=({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,width:s,height:o,fitView:r,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h})=>rRe((f,g)=>{async function p(){const{nodeLookup:m,panZoom:b,fitViewOptions:v,fitViewResolver:C,width:y,height:S,minZoom:x,maxZoom:L}=g();b&&(await HTe({nodes:m,width:y,height:S,panZoom:b,minZoom:x,maxZoom:L},v),C==null||C.resolve(!0),f({fitViewResolver:null}))}return{...Xie({nodes:n,edges:e,width:s,height:o,fitView:r,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:t,defaultEdges:i,zIndexMode:h}),setNodes:m=>{const{nodeLookup:b,parentLookup:v,nodeOrigin:C,elevateNodesOnSelect:y,fitViewQueued:S,zIndexMode:x,nodesSelectionActive:L}=g(),{nodesInitialized:k,hasSelectedNodes:N}=dH(m,b,v,{nodeOrigin:C,nodeExtent:u,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:x}),T=L&&N;S&&k?(p(),f({nodes:m,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:T})):f({nodes:m,nodesInitialized:k,nodesSelectionActive:T})},setEdges:m=>{const{connectionLookup:b,edgeLookup:v}=g();lpe(b,v,m),f({edges:m})},setDefaultNodesAndEdges:(m,b)=>{if(m){const{setNodes:v}=g();v(m),f({hasDefaultNodes:!0})}if(b){const{setEdges:v}=g();v(b),f({hasDefaultEdges:!0})}},updateNodeInternals:m=>{const{triggerNodeChanges:b,nodeLookup:v,parentLookup:C,domNode:y,nodeOrigin:S,nodeExtent:x,debug:L,fitViewQueued:k,zIndexMode:N}=g(),{changes:T,updatedInternals:M}=d2e(m,v,C,y,S,x,N);M&&(r2e(v,C,{nodeOrigin:S,nodeExtent:x,zIndexMode:N}),k?(p(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),(T==null?void 0:T.length)>0&&(L&&console.log("React Flow: trigger node changes",T),b==null||b(T)))},updateNodePositions:(m,b=!1)=>{const v=[];let C=[];const{nodeLookup:y,triggerNodeChanges:S,connection:x,updateConnection:L,onNodesChangeMiddlewareMap:k}=g();for(const[N,T]of m){const M=y.get(N),P=!!(M!=null&&M.expandParent&&(M!=null&&M.parentId)&&(T!=null&&T.position)),V={id:N,type:"position",position:P?{x:Math.max(0,T.position.x),y:Math.max(0,T.position.y)}:T.position,dragging:b};if(M&&x.inProgress&&x.fromNode.id===M.id){const O=M0(M,x.fromHandle,Wt.Left,!0);L({...x,from:O})}P&&M.parentId&&v.push({id:N,parentId:M.parentId,rect:{...T.internals.positionAbsolute,width:T.measured.width??0,height:T.measured.height??0}}),C.push(V)}if(v.length>0){const{parentLookup:N,nodeOrigin:T}=g(),M=KY(v,y,N,T);C.push(...M)}for(const N of k.values())C=N(C);S(C)},triggerNodeChanges:m=>{const{onNodesChange:b,setNodes:v,nodes:C,hasDefaultNodes:y,debug:S}=g();if(m!=null&&m.length){if(y){const x=Npe(m,C);v(x)}S&&console.log("React Flow: trigger node changes",m),b==null||b(m)}},triggerEdgeChanges:m=>{const{onEdgesChange:b,setEdges:v,edges:C,hasDefaultEdges:y,debug:S}=g();if(m!=null&&m.length){if(y){const x=Epe(m,C);v(x)}S&&console.log("React Flow: trigger edge changes",m),b==null||b(m)}},addSelectedNodes:m=>{const{multiSelectionActive:b,edgeLookup:v,nodeLookup:C,triggerNodeChanges:y,triggerEdgeChanges:S}=g();if(b){const x=m.map(L=>qb(L,!0));y(x);return}y(UC(C,new Set([...m]),!0)),S(UC(v))},addSelectedEdges:m=>{const{multiSelectionActive:b,edgeLookup:v,nodeLookup:C,triggerNodeChanges:y,triggerEdgeChanges:S}=g();if(b){const x=m.map(L=>qb(L,!0));S(x);return}S(UC(v,new Set([...m]))),y(UC(C,new Set,!0))},unselectNodesAndEdges:({nodes:m,edges:b}={})=>{const{edges:v,nodes:C,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:x}=g(),L=m||C,k=b||v,N=[];for(const M of L){if(!M.selected)continue;const P=y.get(M.id);P&&(P.selected=!1),N.push(qb(M.id,!1))}const T=[];for(const M of k)M.selected&&T.push(qb(M.id,!1));S(N),x(T)},setMinZoom:m=>{const{panZoom:b,maxZoom:v}=g();b==null||b.setScaleExtent([m,v]),f({minZoom:m})},setMaxZoom:m=>{const{panZoom:b,minZoom:v}=g();b==null||b.setScaleExtent([v,m]),f({maxZoom:m})},setTranslateExtent:m=>{var b;(b=g().panZoom)==null||b.setTranslateExtent(m),f({translateExtent:m})},resetSelectedElements:()=>{const{edges:m,nodes:b,triggerNodeChanges:v,triggerEdgeChanges:C,elementsSelectable:y}=g();if(!y)return;const S=b.reduce((L,k)=>k.selected?[...L,qb(k.id,!1)]:L,[]),x=m.reduce((L,k)=>k.selected?[...L,qb(k.id,!1)]:L,[]);v(S),C(x)},setNodeExtent:m=>{const{nodes:b,nodeLookup:v,parentLookup:C,nodeOrigin:y,elevateNodesOnSelect:S,nodeExtent:x,zIndexMode:L}=g();m[0][0]===x[0][0]&&m[0][1]===x[0][1]&&m[1][0]===x[1][0]&&m[1][1]===x[1][1]||(dH(b,v,C,{nodeOrigin:y,nodeExtent:m,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:L}),f({nodeExtent:m}))},panBy:m=>{const{transform:b,width:v,height:C,panZoom:y,translateExtent:S}=g();return u2e({delta:m,panZoom:y,transform:b,translateExtent:S,width:v,height:C})},setCenter:async(m,b,v)=>{const{width:C,height:y,maxZoom:S,panZoom:x}=g();if(!x)return Promise.resolve(!1);const L=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:S;return await x.setViewport({x:C/2-m*L,y:y/2-b*L,zoom:L},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...$ge}})},updateConnection:m=>{f({connection:m})},reset:()=>f({...Xie()})}},Object.is);function jMe({initialNodes:n,initialEdges:e,defaultNodes:t,defaultEdges:i,initialWidth:s,initialHeight:o,initialMinZoom:r,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h,children:f}){const[g]=R.useState(()=>VMe({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,width:s,height:o,fitView:c,minZoom:r,maxZoom:a,fitViewOptions:l,nodeOrigin:d,nodeExtent:u,zIndexMode:h}));return _.jsx(aRe,{value:g,children:_.jsx(IRe,{children:f})})}function zMe({children:n,nodes:e,edges:t,defaultNodes:i,defaultEdges:s,width:o,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f}){return R.useContext(O3)?_.jsx(_.Fragment,{children:n}):_.jsx(jMe,{initialNodes:e,initialEdges:t,defaultNodes:i,defaultEdges:s,initialWidth:o,initialHeight:r,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f,children:n})}const $Me={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function UMe({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,className:s,nodeTypes:o,edgeTypes:r,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:h,onConnect:f,onConnectStart:g,onConnectEnd:p,onClickConnectStart:m,onClickConnectEnd:b,onNodeMouseEnter:v,onNodeMouseMove:C,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:x,onNodeDragStart:L,onNodeDrag:k,onNodeDragStop:N,onNodesDelete:T,onEdgesDelete:M,onDelete:P,onSelectionChange:V,onSelectionDragStart:O,onSelectionDrag:A,onSelectionDragStop:z,onSelectionContextMenu:U,onSelectionStart:W,onSelectionEnd:F,onBeforeDelete:q,connectionMode:X,connectionLineType:Q=Cg.Bezier,connectionLineStyle:oe,connectionLineComponent:ge,connectionLineContainerStyle:ye,deleteKeyCode:$e="Backspace",selectionKeyCode:Ze="Shift",selectionOnDrag:Ee=!1,selectionMode:Je=HE.Full,panActivationKeyCode:lt="Space",multiSelectionKeyCode:Ct=jE()?"Meta":"Control",zoomActivationKeyCode:Oe=jE()?"Meta":"Control",snapToGrid:Re,snapGrid:gt,onlyRenderVisibleElements:si=!1,selectNodesOnDrag:Ke,nodesDraggable:ri,autoPanOnNodeFocus:Di,nodesConnectable:Nn,nodesFocusable:Ye,nodeOrigin:qt=Lpe,edgesFocusable:Zt,edgesReconnectable:ln,elementsSelectable:fa=!0,defaultViewport:po=wRe,minZoom:es=.5,maxZoom:ts=2,translateExtent:yl=WE,preventScrolling:_r=!0,nodeExtent:ga,defaultMarkerColor:dc="#b1b1b7",zoomOnScroll:cn=!0,zoomOnPinch:Io=!0,panOnScroll:bn=!1,panOnScrollSpeed:ms=.5,panOnScrollMode:Wr=c1.Free,zoomOnDoubleClick:Ha=!0,panOnDrag:Tf=!0,onPaneClick:js,onPaneMouseEnter:Do,onPaneMouseMove:zs,onPaneMouseLeave:Ri,onPaneScroll:Va,onPaneContextMenu:Oi,paneClickDistance:vn=1,nodeClickDistance:li=0,children:Ud,onReconnect:ja,onReconnectStart:Y,onReconnectEnd:nd,onEdgeContextMenu:qd,onEdgeDoubleClick:Wi,onEdgeMouseEnter:_s,onEdgeMouseMove:it,onEdgeMouseLeave:ih,reconnectRadius:vi=10,onNodesChange:$t,onEdgesChange:no,noDragClassName:To="nodrag",noWheelClassName:za="nowheel",noPanClassName:Hr="nopan",fitView:pa,fitViewOptions:mo,connectOnClick:Kd,attributionPosition:Nt,proOptions:ce,defaultEdgeOptions:Te,elevateNodesOnSelect:bt=!0,elevateEdgesOnSelect:Qi=!1,disableKeyboardA11y:Kn=!1,autoPanOnConnect:Sn,autoPanOnNodeDrag:Es,autoPanSpeed:br,connectionRadius:$s,isValidConnection:Vr,onError:dn,style:Gd,id:Sl,nodeDragThreshold:Rf,connectionDragThreshold:$a,viewport:sd,onViewportChange:Kp,width:Gp,height:Mf,colorMode:Yp="light",debug:Af,onScroll:Qo,ariaLabelConfig:Pf,zIndexMode:re="basic",...Ie},Ve){const ke=Sl||"1",ai=xRe(Yp),Xt=R.useCallback(gi=>{gi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Qo==null||Qo(gi)},[Qo]);return _.jsx("div",{"data-testid":"rf__wrapper",...Ie,onScroll:Xt,style:{...Gd,...$Me},ref:Ve,className:Zo(["react-flow",s,ai]),id:Sl,role:"application",children:_.jsxs(zMe,{nodes:n,edges:e,width:Gp,height:Mf,fitView:pa,fitViewOptions:mo,minZoom:es,maxZoom:ts,nodeOrigin:qt,nodeExtent:ga,zIndexMode:re,children:[_.jsx(SRe,{nodes:n,edges:e,defaultNodes:t,defaultEdges:i,onConnect:f,onConnectStart:g,onConnectEnd:p,onClickConnectStart:m,onClickConnectEnd:b,nodesDraggable:ri,autoPanOnNodeFocus:Di,nodesConnectable:Nn,nodesFocusable:Ye,edgesFocusable:Zt,edgesReconnectable:ln,elementsSelectable:fa,elevateNodesOnSelect:bt,elevateEdgesOnSelect:Qi,minZoom:es,maxZoom:ts,nodeExtent:ga,onNodesChange:$t,onEdgesChange:no,snapToGrid:Re,snapGrid:gt,connectionMode:X,translateExtent:yl,connectOnClick:Kd,defaultEdgeOptions:Te,fitView:pa,fitViewOptions:mo,onNodesDelete:T,onEdgesDelete:M,onDelete:P,onNodeDragStart:L,onNodeDrag:k,onNodeDragStop:N,onSelectionDrag:A,onSelectionDragStart:O,onSelectionDragStop:z,onMove:d,onMoveStart:u,onMoveEnd:h,noPanClassName:Hr,nodeOrigin:qt,rfId:ke,autoPanOnConnect:Sn,autoPanOnNodeDrag:Es,autoPanSpeed:br,onError:dn,connectionRadius:$s,isValidConnection:Vr,selectNodesOnDrag:Ke,nodeDragThreshold:Rf,connectionDragThreshold:$a,onBeforeDelete:q,debug:Af,ariaLabelConfig:Pf,zIndexMode:re}),_.jsx(HMe,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:C,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:x,nodeTypes:o,edgeTypes:r,connectionLineType:Q,connectionLineStyle:oe,connectionLineComponent:ge,connectionLineContainerStyle:ye,selectionKeyCode:Ze,selectionOnDrag:Ee,selectionMode:Je,deleteKeyCode:$e,multiSelectionKeyCode:Ct,panActivationKeyCode:lt,zoomActivationKeyCode:Oe,onlyRenderVisibleElements:si,defaultViewport:po,translateExtent:yl,minZoom:es,maxZoom:ts,preventScrolling:_r,zoomOnScroll:cn,zoomOnPinch:Io,zoomOnDoubleClick:Ha,panOnScroll:bn,panOnScrollSpeed:ms,panOnScrollMode:Wr,panOnDrag:Tf,onPaneClick:js,onPaneMouseEnter:Do,onPaneMouseMove:zs,onPaneMouseLeave:Ri,onPaneScroll:Va,onPaneContextMenu:Oi,paneClickDistance:vn,nodeClickDistance:li,onSelectionContextMenu:U,onSelectionStart:W,onSelectionEnd:F,onReconnect:ja,onReconnectStart:Y,onReconnectEnd:nd,onEdgeContextMenu:qd,onEdgeDoubleClick:Wi,onEdgeMouseEnter:_s,onEdgeMouseMove:it,onEdgeMouseLeave:ih,reconnectRadius:vi,defaultMarkerColor:dc,noDragClassName:To,noWheelClassName:za,noPanClassName:Hr,rfId:ke,disableKeyboardA11y:Kn,nodeExtent:ga,viewport:sd,onViewportChange:Kp}),_.jsx(vRe,{onSelectionChange:V}),Ud,_.jsx(gRe,{proOptions:ce,position:Nt}),_.jsx(fRe,{rfId:ke,disableKeyboardA11y:Kn})]})})}var qMe=Ipe(UMe);function KMe({dimensions:n,lineWidth:e,variant:t,className:i}){return _.jsx("path",{strokeWidth:e,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`,className:Zo(["react-flow__background-pattern",t,i])})}function GMe({radius:n,className:e}){return _.jsx("circle",{cx:n,cy:n,r:n,className:Zo(["react-flow__background-pattern","dots",e])})}var Zg;(function(n){n.Lines="lines",n.Dots="dots",n.Cross="cross"})(Zg||(Zg={}));const YMe={[Zg.Dots]:1,[Zg.Lines]:1,[Zg.Cross]:6},ZMe=n=>({transform:n.transform,patternId:`pattern-${n.rfId}`});function Jpe({id:n,variant:e=Zg.Dots,gap:t=20,size:i,lineWidth:s=1,offset:o=0,color:r,bgColor:a,style:l,className:c,patternClassName:d}){const u=R.useRef(null),{transform:h,patternId:f}=rn(ZMe,Bs),g=i||YMe[e],p=e===Zg.Dots,m=e===Zg.Cross,b=Array.isArray(t)?t:[t,t],v=[b[0]*h[2]||1,b[1]*h[2]||1],C=g*h[2],y=Array.isArray(o)?o:[o,o],S=m?[C,C]:v,x=[y[0]*h[2]||1+S[0]/2,y[1]*h[2]||1+S[1]/2],L=`${f}${n||""}`;return _.jsxs("svg",{className:Zo(["react-flow__background",c]),style:{...l,...B3,"--xy-background-color-props":a,"--xy-background-pattern-color-props":r},ref:u,"data-testid":"rf__background",children:[_.jsx("pattern",{id:L,x:h[0]%v[0],y:h[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${x[0]},-${x[1]})`,children:p?_.jsx(GMe,{radius:C/2,className:d}):_.jsx(KMe,{dimensions:S,lineWidth:s,variant:e,className:d})}),_.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${L})`})]})}Jpe.displayName="Background";const XMe=R.memo(Jpe);function QMe(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:_.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function JMe(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:_.jsx("path",{d:"M0 0h32v4.2H0z"})})}function eAe(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:_.jsx("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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function tAe(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-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"})})}function iAe(){return _.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:_.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function y2({children:n,className:e,...t}){return _.jsx("button",{type:"button",className:Zo(["react-flow__controls-button",e]),...t,children:n})}const nAe=n=>({isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom,ariaLabelConfig:n.ariaLabelConfig});function eme({style:n,showZoom:e=!0,showFitView:t=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:r,onFitView:a,onInteractiveChange:l,className:c,children:d,position:u="bottom-left",orientation:h="vertical","aria-label":f}){const g=Vs(),{isInteractive:p,minZoomReached:m,maxZoomReached:b,ariaLabelConfig:v}=rn(nAe,Bs),{zoomIn:C,zoomOut:y,fitView:S}=GY(),x=()=>{C(),o==null||o()},L=()=>{y(),r==null||r()},k=()=>{S(s),a==null||a()},N=()=>{g.setState({nodesDraggable:!p,nodesConnectable:!p,elementsSelectable:!p}),l==null||l(!p)},T=h==="horizontal"?"horizontal":"vertical";return _.jsxs(F3,{className:Zo(["react-flow__controls",T,c]),position:u,style:n,"data-testid":"rf__controls","aria-label":f??v["controls.ariaLabel"],children:[e&&_.jsxs(_.Fragment,{children:[_.jsx(y2,{onClick:x,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:b,children:_.jsx(QMe,{})}),_.jsx(y2,{onClick:L,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:m,children:_.jsx(JMe,{})})]}),t&&_.jsx(y2,{className:"react-flow__controls-fitview",onClick:k,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:_.jsx(eAe,{})}),i&&_.jsx(y2,{className:"react-flow__controls-interactive",onClick:N,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:p?_.jsx(iAe,{}):_.jsx(tAe,{})}),d]})}eme.displayName="Controls";const sAe=R.memo(eme);function oAe({id:n,x:e,y:t,width:i,height:s,style:o,color:r,strokeColor:a,strokeWidth:l,className:c,borderRadius:d,shapeRendering:u,selected:h,onClick:f}){const{background:g,backgroundColor:p}=o||{},m=r||g||p;return _.jsx("rect",{className:Zo(["react-flow__minimap-node",{selected:h},c]),x:e,y:t,rx:d,ry:d,width:i,height:s,style:{fill:m,stroke:a,strokeWidth:l},shapeRendering:u,onClick:f?b=>f(b,n):void 0})}const rAe=R.memo(oAe),aAe=n=>n.nodes.map(e=>e.id),v6=n=>n instanceof Function?n:()=>n;function lAe({nodeStrokeColor:n,nodeColor:e,nodeClassName:t="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:o=rAe,onClick:r}){const a=rn(aAe,Bs),l=v6(e),c=v6(n),d=v6(t),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return _.jsx(_.Fragment,{children:a.map(h=>_.jsx(dAe,{id:h,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:o,onClick:r,shapeRendering:u},h))})}function cAe({id:n,nodeColorFunc:e,nodeStrokeColorFunc:t,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:o,shapeRendering:r,NodeComponent:a,onClick:l}){const{node:c,x:d,y:u,width:h,height:f}=rn(g=>{const p=g.nodeLookup.get(n);if(!p)return{node:void 0,x:0,y:0,width:0,height:0};const m=p.internals.userNode,{x:b,y:v}=p.internals.positionAbsolute,{width:C,height:y}=Fp(m);return{node:m,x:b,y:v,width:C,height:y}},Bs);return!c||c.hidden||!Xge(c)?null:_.jsx(a,{x:d,y:u,width:h,height:f,style:c.style,selected:!!c.selected,className:i(c),color:e(c),borderRadius:s,strokeColor:t(c),strokeWidth:o,shapeRendering:r,onClick:l,id:c.id})}const dAe=R.memo(cAe);var uAe=R.memo(lAe);const hAe=200,fAe=150,gAe=n=>!n.hidden,pAe=n=>{const e={x:-n.transform[0]/n.transform[2],y:-n.transform[1]/n.transform[2],width:n.width/n.transform[2],height:n.height/n.transform[2]};return{viewBB:e,boundingRect:n.nodeLookup.size>0?Zge(KD(n.nodeLookup,{filter:gAe}),e):e,rfId:n.rfId,panZoom:n.panZoom,translateExtent:n.translateExtent,flowWidth:n.width,flowHeight:n.height,ariaLabelConfig:n.ariaLabelConfig}},mAe="react-flow__minimap-desc";function tme({style:n,className:e,nodeStrokeColor:t,nodeColor:i,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:d,maskStrokeWidth:u,position:h="bottom-right",onClick:f,onNodeClick:g,pannable:p=!1,zoomable:m=!1,ariaLabel:b,inversePan:v,zoomStep:C=1,offsetScale:y=5}){const S=Vs(),x=R.useRef(null),{boundingRect:L,viewBB:k,rfId:N,panZoom:T,translateExtent:M,flowWidth:P,flowHeight:V,ariaLabelConfig:O}=rn(pAe,Bs),A=(n==null?void 0:n.width)??hAe,z=(n==null?void 0:n.height)??fAe,U=L.width/A,W=L.height/z,F=Math.max(U,W),q=F*A,X=F*z,Q=y*F,oe=L.x-(q-L.width)/2-Q,ge=L.y-(X-L.height)/2-Q,ye=q+Q*2,$e=X+Q*2,Ze=`${mAe}-${N}`,Ee=R.useRef(0),Je=R.useRef();Ee.current=F,R.useEffect(()=>{if(x.current&&T)return Je.current=w2e({domNode:x.current,panZoom:T,getTransform:()=>S.getState().transform,getViewScale:()=>Ee.current}),()=>{var Re;(Re=Je.current)==null||Re.destroy()}},[T]),R.useEffect(()=>{var Re;(Re=Je.current)==null||Re.update({translateExtent:M,width:P,height:V,inversePan:v,pannable:p,zoomStep:C,zoomable:m})},[p,m,v,C,M,P,V]);const lt=f?Re=>{var Ke;const[gt,si]=((Ke=Je.current)==null?void 0:Ke.pointer(Re))||[0,0];f(Re,{x:gt,y:si})}:void 0,Ct=g?R.useCallback((Re,gt)=>{const si=S.getState().nodeLookup.get(gt).internals.userNode;g(Re,si)},[]):void 0,Oe=b??O["minimap.ariaLabel"];return _.jsx(F3,{position:h,style:{...n,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*F:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof t=="string"?t:void 0,"--xy-minimap-node-stroke-width-props":typeof r=="number"?r:void 0},className:Zo(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:_.jsxs("svg",{width:A,height:z,viewBox:`${oe} ${ge} ${ye} ${$e}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Ze,ref:x,onClick:lt,children:[Oe&&_.jsx("title",{id:Ze,children:Oe}),_.jsx(uAe,{onClick:Ct,nodeColor:i,nodeStrokeColor:t,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:r,nodeComponent:a}),_.jsx("path",{className:"react-flow__minimap-mask",d:`M${oe-Q},${ge-Q}h${ye+Q*2}v${$e+Q*2}h${-ye-Q*2}z
- M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}tme.displayName="MiniMap";const _Ae=R.memo(tme),bAe=n=>e=>n?`${Math.max(1/e.transform[2],1)}`:void 0,vAe={[YS.Line]:"right",[YS.Handle]:"bottom-right"};function wAe({nodeId:n,position:e,variant:t=YS.Handle,className:i,style:s=void 0,children:o,color:r,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:h,autoScale:f=!0,shouldResize:g,onResizeStart:p,onResize:m,onResizeEnd:b}){const v=Mpe(),C=typeof n=="string"?n:v,y=Vs(),S=R.useRef(null),x=t===YS.Handle,L=rn(R.useCallback(bAe(x&&f),[x,f]),Bs),k=R.useRef(null),N=e??vAe[t];R.useEffect(()=>{if(!(!S.current||!C))return k.current||(k.current=A2e({domNode:S.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:M,transform:P,snapGrid:V,snapToGrid:O,nodeOrigin:A,domNode:z}=y.getState();return{nodeLookup:M,transform:P,snapGrid:V,snapToGrid:O,nodeOrigin:A,paneDomNode:z}},onChange:(M,P)=>{const{triggerNodeChanges:V,nodeLookup:O,parentLookup:A,nodeOrigin:z}=y.getState(),U=[],W={x:M.x,y:M.y},F=O.get(C);if(F&&F.expandParent&&F.parentId){const q=F.origin??z,X=M.width??F.measured.width??0,Q=M.height??F.measured.height??0,oe={id:F.id,parentId:F.parentId,rect:{width:X,height:Q,...Qge({x:M.x??F.position.x,y:M.y??F.position.y},{width:X,height:Q},F.parentId,O,q)}},ge=KY([oe],O,A,z);U.push(...ge),W.x=M.x?Math.max(q[0]*X,M.x):void 0,W.y=M.y?Math.max(q[1]*Q,M.y):void 0}if(W.x!==void 0&&W.y!==void 0){const q={id:C,type:"position",position:{...W}};U.push(q)}if(M.width!==void 0&&M.height!==void 0){const X={id:C,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};U.push(X)}for(const q of P){const X={...q,type:"position"};U.push(X)}V(U)},onEnd:({width:M,height:P})=>{const V={id:C,type:"dimensions",resizing:!1,dimensions:{width:M,height:P}};y.getState().triggerNodeChanges([V])}})),k.current.update({controlPosition:N,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:d},keepAspectRatio:u,resizeDirection:h,onResizeStart:p,onResize:m,onResizeEnd:b,shouldResize:g}),()=>{var M;(M=k.current)==null||M.destroy()}},[N,a,l,c,d,u,p,m,b,g]);const T=N.split("-");return _.jsx("div",{className:Zo(["react-flow__resize-control","nodrag",...T,t,i]),ref:S,style:{...s,scale:L,...r&&{[x?"backgroundColor":"borderColor"]:r}},children:o})}R.memo(wAe);/**
+`)),d=c.reduce((u,h)=>u.concat(...h),[]);return[c,d]}return[[],[]]},[n]);return R.useEffect(()=>{const l=(e==null?void 0:e.target)??Aie,c=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(n!==null){const d=f=>{var _,b;if(s.current=f.ctrlKey||f.metaKey||f.shiftKey||f.altKey,(!s.current||s.current&&!c)&&tpe(f))return!1;const p=Oie(f.code,a);if(o.current.add(f[p]),Pie(r,o.current,!1)){const v=((b=(_=f.composedPath)==null?void 0:_.call(f))==null?void 0:b[0])||f.target,C=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";e.preventDefault!==!1&&(s.current||!C)&&f.preventDefault(),i(!0)}},u=f=>{const g=Oie(f.code,a);Pie(r,o.current,!0)?(i(!1),o.current.clear()):o.current.delete(f[g]),f.key==="Meta"&&o.current.clear(),s.current=!1},h=()=>{o.current.clear(),i(!1)};return l==null||l.addEventListener("keydown",d),l==null||l.addEventListener("keyup",u),window.addEventListener("blur",h),window.addEventListener("contextmenu",h),()=>{l==null||l.removeEventListener("keydown",d),l==null||l.removeEventListener("keyup",u),window.removeEventListener("blur",h),window.removeEventListener("contextmenu",h)}}},[n,i]),t}function Pie(n,e,t){return n.filter(i=>t||i.length===e.size).some(i=>i.every(s=>e.has(s)))}function Oie(n,e){return e.includes(n)?"code":"key"}const kRe=()=>{const n=Vs();return R.useMemo(()=>({zoomIn:e=>{const{panZoom:t}=n.getState();return t?t.scaleBy(1.2,e):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:t}=n.getState();return t?t.scaleBy(1/1.2,e):Promise.resolve(!1)},zoomTo:(e,t)=>{const{panZoom:i}=n.getState();return i?i.scaleTo(e,t):Promise.resolve(!1)},getZoom:()=>n.getState().transform[2],setViewport:async(e,t)=>{const{transform:[i,s,o],panZoom:r}=n.getState();return r?(await r.setViewport({x:e.x??i,y:e.y??s,zoom:e.zoom??o},t),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,t,i]=n.getState().transform;return{x:e,y:t,zoom:i}},setCenter:async(e,t,i)=>n.getState().setCenter(e,t,i),fitBounds:async(e,t)=>{const{width:i,height:s,minZoom:o,maxZoom:r,panZoom:a}=n.getState(),l=VY(e,i,s,o,r,(t==null?void 0:t.padding)??.1);return a?(await a.setViewport(l,{duration:t==null?void 0:t.duration,ease:t==null?void 0:t.ease,interpolate:t==null?void 0:t.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,t={})=>{const{transform:i,snapGrid:s,snapToGrid:o,domNode:r}=n.getState();if(!r)return e;const{x:a,y:l}=r.getBoundingClientRect(),c={x:e.x-a,y:e.y-l},d=t.snapGrid??s,u=t.snapToGrid??o;return YD(c,i,u,d)},flowToScreenPosition:e=>{const{transform:t,domNode:i}=n.getState();if(!i)return e;const{x:s,y:o}=i.getBoundingClientRect(),r=YA(e,t);return{x:r.x+s,y:r.y+o}}}),[])};function Npe(n,e){const t=[],i=new Map,s=[];for(const o of n)if(o.type==="add"){s.push(o);continue}else if(o.type==="remove"||o.type==="replace")i.set(o.id,[o]);else{const r=i.get(o.id);r?r.push(o):i.set(o.id,[o])}for(const o of e){const r=i.get(o.id);if(!r){t.push(o);continue}if(r[0].type==="remove")continue;if(r[0].type==="replace"){t.push({...r[0].item});continue}const a={...o};for(const l of r)NRe(l,a);t.push(a)}return s.length&&s.forEach(o=>{o.index!==void 0?t.splice(o.index,0,{...o.item}):t.push({...o.item})}),t}function NRe(n,e){switch(n.type){case"select":{e.selected=n.selected;break}case"position":{typeof n.position<"u"&&(e.position=n.position),typeof n.dragging<"u"&&(e.dragging=n.dragging);break}case"dimensions":{typeof n.dimensions<"u"&&(e.measured={...n.dimensions},n.setAttributes&&((n.setAttributes===!0||n.setAttributes==="width")&&(e.width=n.dimensions.width),(n.setAttributes===!0||n.setAttributes==="height")&&(e.height=n.dimensions.height))),typeof n.resizing=="boolean"&&(e.resizing=n.resizing);break}}}function Epe(n,e){return Npe(n,e)}function Ipe(n,e){return Npe(n,e)}function qb(n,e){return{id:n,type:"select",selected:e}}function UC(n,e=new Set,t=!1){const i=[];for(const[s,o]of n){const r=e.has(s);!(o.selected===void 0&&!r)&&o.selected!==r&&(t&&(o.selected=r),i.push(qb(o.id,r)))}return i}function Fie({items:n=[],lookup:e}){var s;const t=[],i=new Map(n.map(o=>[o.id,o]));for(const[o,r]of n.entries()){const a=e.get(r.id),l=((s=a==null?void 0:a.internals)==null?void 0:s.userNode)??a;l!==void 0&&l!==r&&t.push({id:r.id,item:r,type:"replace"}),l===void 0&&t.push({item:r,type:"add",index:o})}for(const[o]of e)i.get(o)===void 0&&t.push({id:o,type:"remove"});return t}function Bie(n){return{id:n.id,type:"remove"}}const Wie=n=>FTe(n),ERe=n=>Kge(n);function Dpe(n){return R.forwardRef(n)}function Hie(n){const[e,t]=R.useState(BigInt(0)),[i]=R.useState(()=>IRe(()=>t(s=>s+BigInt(1))));return hH(()=>{const s=i.get();s.length&&(n(s),i.reset())},[e]),i}function IRe(n){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n()}}}const Tpe=R.createContext(null);function DRe({children:n}){const e=Vs(),t=R.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:d,onNodesChange:u,nodeLookup:h,fitViewQueued:f,onNodesChangeMiddlewareMap:g}=e.getState();let p=l;for(const b of a)p=typeof b=="function"?b(p):b;let _=Fie({items:p,lookup:h});for(const b of g.values())_=b(_);d&&c(p),_.length>0?u==null||u(_):f&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:v,setNodes:C}=e.getState();b&&C(v)})},[]),i=Hie(t),s=R.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:h}=e.getState();let f=l;for(const g of a)f=typeof g=="function"?g(f):g;d?c(f):u&&u(Fie({items:f,lookup:h}))},[]),o=Hie(s),r=R.useMemo(()=>({nodeQueue:i,edgeQueue:o}),[]);return m.jsx(Tpe.Provider,{value:r,children:n})}function TRe(){const n=R.useContext(Tpe);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}const RRe=n=>!!n.panZoom;function GY(){const n=kRe(),e=Vs(),t=TRe(),i=rn(RRe),s=R.useMemo(()=>{const o=u=>e.getState().nodeLookup.get(u),r=u=>{t.nodeQueue.push(u)},a=u=>{t.edgeQueue.push(u)},l=u=>{var b,v;const{nodeLookup:h,nodeOrigin:f}=e.getState(),g=Wie(u)?u:h.get(u.id),p=g.parentId?Jge(g.position,g.measured,g.parentId,h,f):g.position,_={...g,position:p,width:((b=g.measured)==null?void 0:b.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return KS(_)},c=(u,h,f={replace:!1})=>{r(g=>g.map(p=>{if(p.id===u){const _=typeof h=="function"?h(p):h;return f.replace&&Wie(_)?_:{...p,..._}}return p}))},d=(u,h,f={replace:!1})=>{a(g=>g.map(p=>{if(p.id===u){const _=typeof h=="function"?h(p):h;return f.replace&&ERe(_)?_:{...p,..._}}return p}))};return{getNodes:()=>e.getState().nodes.map(u=>({...u})),getNode:u=>{var h;return(h=o(u))==null?void 0:h.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:u=[]}=e.getState();return u.map(h=>({...h}))},getEdge:u=>e.getState().edgeLookup.get(u),setNodes:r,setEdges:a,addNodes:u=>{const h=Array.isArray(u)?u:[u];t.nodeQueue.push(f=>[...f,...h])},addEdges:u=>{const h=Array.isArray(u)?u:[u];t.edgeQueue.push(f=>[...f,...h])},toObject:()=>{const{nodes:u=[],edges:h=[],transform:f}=e.getState(),[g,p,_]=f;return{nodes:u.map(b=>({...b})),edges:h.map(b=>({...b})),viewport:{x:g,y:p,zoom:_}}},deleteElements:async({nodes:u=[],edges:h=[]})=>{const{nodes:f,edges:g,onNodesDelete:p,onEdgesDelete:_,triggerNodeChanges:b,triggerEdgeChanges:v,onDelete:C,onBeforeDelete:y}=e.getState(),{nodes:S,edges:x}=await jTe({nodesToRemove:u,edgesToRemove:h,nodes:f,edges:g,onBeforeDelete:y}),L=x.length>0,k=S.length>0;if(L){const N=x.map(Bie);_==null||_(x),v(N)}if(k){const N=S.map(Bie);p==null||p(S),b(N)}return(k||L)&&(C==null||C({nodes:S,edges:x})),{deletedNodes:S,deletedEdges:x}},getIntersectingNodes:(u,h=!0,f)=>{const g=pie(u),p=g?u:l(u),_=f!==void 0;return p?(f||e.getState().nodes).filter(b=>{const v=e.getState().nodeLookup.get(b.id);if(v&&!g&&(b.id===u.id||!v.internals.positionAbsolute))return!1;const C=KS(_?b:v),y=VE(C,p);return h&&y>0||y>=C.width*C.height||y>=p.width*p.height}):[]},isNodeIntersecting:(u,h,f=!0)=>{const p=pie(u)?u:l(u);if(!p)return!1;const _=VE(p,h);return f&&_>0||_>=h.width*h.height||_>=p.width*p.height},updateNode:c,updateNodeData:(u,h,f={replace:!1})=>{c(u,g=>{const p=typeof h=="function"?h(g):h;return f.replace?{...g,data:p}:{...g,data:{...g.data,...p}}},f)},updateEdge:d,updateEdgeData:(u,h,f={replace:!1})=>{d(u,g=>{const p=typeof h=="function"?h(g):h;return f.replace?{...g,data:p}:{...g,data:{...g.data,...p}}},f)},getNodesBounds:u=>{const{nodeLookup:h,nodeOrigin:f}=e.getState();return BTe(u,{nodeLookup:h,nodeOrigin:f})},getHandleConnections:({type:u,id:h,nodeId:f})=>{var g;return Array.from(((g=e.getState().connectionLookup.get(`${f}-${u}${h?`-${h}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:u,handleId:h,nodeId:f})=>{var g;return Array.from(((g=e.getState().connectionLookup.get(`${f}${u?h?`-${u}-${h}`:`-${u}`:""}`))==null?void 0:g.values())??[])},fitView:async u=>{const h=e.getState().fitViewResolver??qTe();return e.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:h}),t.nodeQueue.push(f=>[...f]),h.promise}}},[]);return R.useMemo(()=>({...s,...n,viewportInitialized:i}),[i])}const Vie=n=>n.selected,MRe=typeof window<"u"?window:void 0;function ARe({deleteKeyCode:n,multiSelectionKeyCode:e}){const t=Vs(),{deleteElements:i}=GY(),s=zE(n,{actInsideInputWithModifier:!1}),o=zE(e,{target:MRe});R.useEffect(()=>{if(s){const{edges:r,nodes:a}=t.getState();i({nodes:a.filter(Vie),edges:r.filter(Vie)}),t.setState({nodesSelectionActive:!1})}},[s]),R.useEffect(()=>{t.setState({multiSelectionActive:o})},[o])}function PRe(n){const e=Vs();R.useEffect(()=>{const t=()=>{var s,o,r,a;if(!n.current||!(((o=(s=n.current).checkVisibility)==null?void 0:o.call(s))??!0))return!1;const i=jY(n.current);(i.height===0||i.width===0)&&((a=(r=e.getState()).onError)==null||a.call(r,"004",df.error004())),e.setState({width:i.width||500,height:i.height||500})};if(n.current){t(),window.addEventListener("resize",t);const i=new ResizeObserver(()=>t());return i.observe(n.current),()=>{window.removeEventListener("resize",t),i&&n.current&&i.unobserve(n.current)}}},[])}const B3={position:"absolute",width:"100%",height:"100%",top:0,left:0},ORe=n=>({userSelectionActive:n.userSelectionActive,lib:n.lib,connectionInProgress:n.connection.inProgress});function FRe({onPaneContextMenu:n,zoomOnScroll:e=!0,zoomOnPinch:t=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:o=c1.Free,zoomOnDoubleClick:r=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:d,maxZoom:u,zoomActivationKeyCode:h,preventScrolling:f=!0,children:g,noWheelClassName:p,noPanClassName:_,onViewportChange:b,isControlledViewport:v,paneClickDistance:C,selectionOnDrag:y}){const S=Vs(),x=R.useRef(null),{userSelectionActive:L,lib:k,connectionInProgress:N}=rn(ORe,Bs),D=zE(h),M=R.useRef();PRe(x);const P=R.useCallback(V=>{b==null||b({x:V[0],y:V[1],zoom:V[2]}),v||S.setState({transform:V})},[b,v]);return R.useEffect(()=>{if(x.current){M.current=I2e({domNode:x.current,minZoom:d,maxZoom:u,translateExtent:c,viewport:l,onDraggingChange:z=>S.setState(U=>U.paneDragging===z?U:{paneDragging:z}),onPanZoomStart:(z,U)=>{const{onViewportChangeStart:B,onMoveStart:F}=S.getState();F==null||F(z,U),B==null||B(U)},onPanZoom:(z,U)=>{const{onViewportChange:B,onMove:F}=S.getState();F==null||F(z,U),B==null||B(U)},onPanZoomEnd:(z,U)=>{const{onViewportChangeEnd:B,onMoveEnd:F}=S.getState();F==null||F(z,U),B==null||B(U)}});const{x:V,y:O,zoom:A}=M.current.getViewport();return S.setState({panZoom:M.current,transform:[V,O,A],domNode:x.current.closest(".react-flow")}),()=>{var z;(z=M.current)==null||z.destroy()}}},[]),R.useEffect(()=>{var V;(V=M.current)==null||V.update({onPaneContextMenu:n,zoomOnScroll:e,zoomOnPinch:t,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:o,zoomOnDoubleClick:r,panOnDrag:a,zoomActivationKeyPressed:D,preventScrolling:f,noPanClassName:_,userSelectionActive:L,noWheelClassName:p,lib:k,onTransformChange:P,connectionInProgress:N,selectionOnDrag:y,paneClickDistance:C})},[n,e,t,i,s,o,r,a,D,f,_,L,p,k,P,N,y,C]),m.jsx("div",{className:"react-flow__renderer",ref:x,style:B3,children:g})}const BRe=n=>({userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect});function WRe(){const{userSelectionActive:n,userSelectionRect:e}=rn(BRe,Bs);return n&&e?m.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const b6=(n,e)=>t=>{t.target===e.current&&(n==null||n(t))},HRe=n=>({userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,connectionInProgress:n.connection.inProgress,dragging:n.paneDragging});function VRe({isSelecting:n,selectionKeyPressed:e,selectionMode:t=HE.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:o,onSelectionStart:r,onSelectionEnd:a,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:d,onPaneMouseEnter:u,onPaneMouseMove:h,onPaneMouseLeave:f,children:g}){const p=Vs(),{userSelectionActive:_,elementsSelectable:b,dragging:v,connectionInProgress:C}=rn(HRe,Bs),y=b&&(n||_),S=R.useRef(null),x=R.useRef(),L=R.useRef(new Set),k=R.useRef(new Set),N=R.useRef(!1),D=B=>{if(N.current||C){N.current=!1;return}l==null||l(B),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},M=B=>{if(Array.isArray(i)&&(i!=null&&i.includes(2))){B.preventDefault();return}c==null||c(B)},P=d?B=>d(B):void 0,V=B=>{N.current&&(B.stopPropagation(),N.current=!1)},O=B=>{var Ce,ze;const{domNode:F}=p.getState();if(x.current=F==null?void 0:F.getBoundingClientRect(),!x.current)return;const q=B.target===S.current;if(!q&&!!B.target.closest(".nokey")||!n||!(o&&q||e)||B.button!==0||!B.isPrimary)return;(ze=(Ce=B.target)==null?void 0:Ce.setPointerCapture)==null||ze.call(Ce,B.pointerId),N.current=!1;const{x:ne,y:he}=Nu(B.nativeEvent,x.current);p.setState({userSelectionRect:{width:0,height:0,startX:ne,startY:he,x:ne,y:he}}),q||(B.stopPropagation(),B.preventDefault())},A=B=>{const{userSelectionRect:F,transform:q,nodeLookup:Y,edgeLookup:Q,connectionLookup:ne,triggerNodeChanges:he,triggerEdgeChanges:Ce,defaultEdgeOptions:ze,resetSelectedElements:Oe}=p.getState();if(!x.current||!F)return;const{x:Se,y:je}=Nu(B.nativeEvent,x.current),{startX:it,startY:Ct}=F;if(!N.current){const Ye=e?0:s;if(Math.hypot(Se-it,je-Ct)<=Ye)return;Oe(),r==null||r(B)}N.current=!0;const Fe={startX:it,startY:Ct,x:SeYe.id)),k.current=new Set;const si=(ze==null?void 0:ze.selectable)??!0;for(const Ye of L.current){const ri=ne.get(Ye);if(ri)for(const{edgeId:Di}of ri.values()){const Nn=Q.get(Di);Nn&&(Nn.selectable??si)&&k.current.add(Di)}}if(!mie(Re,L.current)){const Ye=UC(Y,L.current,!0);he(Ye)}if(!mie(gt,k.current)){const Ye=UC(Q,k.current);Ce(Ye)}p.setState({userSelectionRect:Fe,userSelectionActive:!0,nodesSelectionActive:!1})},z=B=>{var F,q;B.button===0&&((q=(F=B.target)==null?void 0:F.releasePointerCapture)==null||q.call(F,B.pointerId),!_&&B.target===S.current&&p.getState().userSelectionRect&&(D==null||D(B)),p.setState({userSelectionActive:!1,userSelectionRect:null}),N.current&&(a==null||a(B),p.setState({nodesSelectionActive:L.current.size>0})))},U=i===!0||Array.isArray(i)&&i.includes(0);return m.jsxs("div",{className:Zo(["react-flow__pane",{draggable:U,dragging:v,selection:n}]),onClick:y?void 0:b6(D,S),onContextMenu:b6(M,S),onWheel:b6(P,S),onPointerEnter:y?void 0:u,onPointerMove:y?A:h,onPointerUp:y?z:void 0,onPointerDownCapture:y?O:void 0,onClickCapture:y?V:void 0,onPointerLeave:f,ref:S,style:B3,children:[g,m.jsx(WRe,{})]})}function fH({id:n,store:e,unselect:t=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:r,nodeLookup:a,onError:l}=e.getState(),c=a.get(n);if(!c){l==null||l("012",df.error012(n));return}e.setState({nodesSelectionActive:!1}),c.selected?(t||c.selected&&r)&&(o({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var d;return(d=i==null?void 0:i.current)==null?void 0:d.blur()})):s([n])}function Rpe({nodeRef:n,disabled:e=!1,noDragClassName:t,handleSelector:i,nodeId:s,isSelectable:o,nodeClickDistance:r}){const a=Vs(),[l,c]=R.useState(!1),d=R.useRef();return R.useEffect(()=>{d.current=p2e({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{fH({id:u,store:a,nodeRef:n})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),R.useEffect(()=>{if(!(e||!n.current||!d.current))return d.current.update({noDragClassName:t,handleSelector:i,domNode:n.current,isSelectable:o,nodeId:s,nodeClickDistance:r}),()=>{var u;(u=d.current)==null||u.destroy()}},[t,i,e,o,n,s,r]),l}const jRe=n=>e=>e.selected&&(e.draggable||n&&typeof e.draggable>"u");function Mpe(){const n=Vs();return R.useCallback(t=>{const{nodeExtent:i,snapToGrid:s,snapGrid:o,nodesDraggable:r,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:d}=n.getState(),u=new Map,h=jRe(r),f=s?o[0]:5,g=s?o[1]:5,p=t.direction.x*f*t.factor,_=t.direction.y*g*t.factor;for(const[,b]of c){if(!h(b))continue;let v={x:b.internals.positionAbsolute.x+p,y:b.internals.positionAbsolute.y+_};s&&(v=GD(v,o));const{position:C,positionAbsolute:y}=Gge({nodeId:b.id,nextPosition:v,nodeLookup:c,nodeExtent:i,nodeOrigin:d,onError:a});b.position=C,b.internals.positionAbsolute=y,u.set(b.id,b)}l(u)},[])}const YY=R.createContext(null),zRe=YY.Provider;YY.Consumer;const Ape=()=>R.useContext(YY),$Re=n=>({connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName,rfId:n.rfId}),URe=(n,e,t)=>i=>{const{connectionClickStartHandle:s,connectionMode:o,connection:r}=i,{fromHandle:a,toHandle:l,isValid:c}=r,d=(l==null?void 0:l.nodeId)===n&&(l==null?void 0:l.id)===e&&(l==null?void 0:l.type)===t;return{connectingFrom:(a==null?void 0:a.nodeId)===n&&(a==null?void 0:a.id)===e&&(a==null?void 0:a.type)===t,connectingTo:d,clickConnecting:(s==null?void 0:s.nodeId)===n&&(s==null?void 0:s.id)===e&&(s==null?void 0:s.type)===t,isPossibleEndHandle:o===US.Strict?(a==null?void 0:a.type)!==t:n!==(a==null?void 0:a.nodeId)||e!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!s,valid:d&&c}};function qRe({type:n="source",position:e=Wt.Top,isValidConnection:t,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:r,onConnect:a,children:l,className:c,onMouseDown:d,onTouchStart:u,...h},f){var A,z;const g=r||null,p=n==="target",_=Vs(),b=Ape(),{connectOnClick:v,noPanClassName:C,rfId:y}=rn($Re,Bs),{connectingFrom:S,connectingTo:x,clickConnecting:L,isPossibleEndHandle:k,connectionInProcess:N,clickConnectionInProcess:D,valid:M}=rn(URe(b,g,n),Bs);b||(z=(A=_.getState()).onError)==null||z.call(A,"010",df.error010());const P=U=>{const{defaultEdgeOptions:B,onConnect:F,hasDefaultEdges:q}=_.getState(),Y={...B,...U};if(q){const{edges:Q,setEdges:ne}=_.getState();ne(JTe(Y,Q))}F==null||F(Y),a==null||a(Y)},V=U=>{if(!b)return;const B=ipe(U.nativeEvent);if(s&&(B&&U.button===0||!B)){const F=_.getState();uH.onPointerDown(U.nativeEvent,{handleDomNode:U.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:p,handleId:g,nodeId:b,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...q)=>{var Y,Q;return(Q=(Y=_.getState()).onConnectEnd)==null?void 0:Q.call(Y,...q)},updateConnection:F.updateConnection,onConnect:P,isValidConnection:t||((...q)=>{var Y,Q;return((Q=(Y=_.getState()).isValidConnection)==null?void 0:Q.call(Y,...q))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}B?d==null||d(U):u==null||u(U)},O=U=>{const{onClickConnectStart:B,onClickConnectEnd:F,connectionClickStartHandle:q,connectionMode:Y,isValidConnection:Q,lib:ne,rfId:he,nodeLookup:Ce,connection:ze}=_.getState();if(!b||!q&&!s)return;if(!q){B==null||B(U.nativeEvent,{nodeId:b,handleId:g,handleType:n}),_.setState({connectionClickStartHandle:{nodeId:b,type:n,id:g}});return}const Oe=epe(U.target),Se=t||Q,{connection:je,isValid:it}=uH.isValid(U.nativeEvent,{handle:{nodeId:b,id:g,type:n},connectionMode:Y,fromNodeId:q.nodeId,fromHandleId:q.id||null,fromType:q.type,isValidConnection:Se,flowId:he,doc:Oe,lib:ne,nodeLookup:Ce});it&&je&&P(je);const Ct=structuredClone(ze);delete Ct.inProgress,Ct.toPosition=Ct.toHandle?Ct.toHandle.position:null,F==null||F(U,Ct),_.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":g,"data-nodeid":b,"data-handlepos":e,"data-id":`${y}-${b}-${g}-${n}`,className:Zo(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,c,{source:!p,target:p,connectable:i,connectablestart:s,connectableend:o,clickconnecting:L,connectingfrom:S,connectingto:x,valid:M,connectionindicator:i&&(!N||k)&&(N||D?o:s)}]),onMouseDown:V,onTouchStart:V,onClick:v?O:void 0,ref:f,...h,children:l})}const XS=R.memo(Dpe(qRe));function KRe({data:n,isConnectable:e,sourcePosition:t=Wt.Bottom}){return m.jsxs(m.Fragment,{children:[n==null?void 0:n.label,m.jsx(XS,{type:"source",position:t,isConnectable:e})]})}function GRe({data:n,isConnectable:e,targetPosition:t=Wt.Top,sourcePosition:i=Wt.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(XS,{type:"target",position:t,isConnectable:e}),n==null?void 0:n.label,m.jsx(XS,{type:"source",position:i,isConnectable:e})]})}function YRe(){return null}function ZRe({data:n,isConnectable:e,targetPosition:t=Wt.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(XS,{type:"target",position:t,isConnectable:e}),n==null?void 0:n.label]})}const ZA={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},jie={input:KRe,default:GRe,output:ZRe,group:YRe};function XRe(n){var e,t,i,s;return n.internals.handleBounds===void 0?{width:n.width??n.initialWidth??((e=n.style)==null?void 0:e.width),height:n.height??n.initialHeight??((t=n.style)==null?void 0:t.height)}:{width:n.width??((i=n.style)==null?void 0:i.width),height:n.height??((s=n.style)==null?void 0:s.height)}}const QRe=n=>{const{width:e,height:t,x:i,y:s}=KD(n.nodeLookup,{filter:o=>!!o.selected});return{width:ku(e)?e:null,height:ku(t)?t:null,userSelectionActive:n.userSelectionActive,transformString:`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]}) translate(${i}px,${s}px)`}};function JRe({onSelectionContextMenu:n,noPanClassName:e,disableKeyboardA11y:t}){const i=Vs(),{width:s,height:o,transformString:r,userSelectionActive:a}=rn(QRe,Bs),l=Mpe(),c=R.useRef(null);R.useEffect(()=>{var f;t||(f=c.current)==null||f.focus({preventScroll:!0})},[t]);const d=!a&&s!==null&&o!==null;if(Rpe({nodeRef:c,disabled:!d}),!d)return null;const u=n?f=>{const g=i.getState().nodes.filter(p=>p.selected);n(f,g)}:void 0,h=f=>{Object.prototype.hasOwnProperty.call(ZA,f.key)&&(f.preventDefault(),l({direction:ZA[f.key],factor:f.shiftKey?4:1}))};return m.jsx("div",{className:Zo(["react-flow__nodesselection","react-flow__container",e]),style:{transform:r},children:m.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:t?void 0:-1,onKeyDown:t?void 0:h,style:{width:s,height:o}})})}const zie=typeof window<"u"?window:void 0,eMe=n=>({nodesSelectionActive:n.nodesSelectionActive,userSelectionActive:n.userSelectionActive});function Ppe({children:n,onPaneClick:e,onPaneMouseEnter:t,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:r,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:d,selectionMode:u,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:g,panActivationKeyCode:p,zoomActivationKeyCode:_,elementsSelectable:b,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:y,panOnScrollSpeed:S,panOnScrollMode:x,zoomOnDoubleClick:L,panOnDrag:k,defaultViewport:N,translateExtent:D,minZoom:M,maxZoom:P,preventScrolling:V,onSelectionContextMenu:O,noWheelClassName:A,noPanClassName:z,disableKeyboardA11y:U,onViewportChange:B,isControlledViewport:F}){const{nodesSelectionActive:q,userSelectionActive:Y}=rn(eMe,Bs),Q=zE(c,{target:zie}),ne=zE(p,{target:zie}),he=ne||k,Ce=ne||y,ze=d&&he!==!0,Oe=Q||Y||ze;return ARe({deleteKeyCode:l,multiSelectionKeyCode:g}),m.jsx(FRe,{onPaneContextMenu:o,elementsSelectable:b,zoomOnScroll:v,zoomOnPinch:C,panOnScroll:Ce,panOnScrollSpeed:S,panOnScrollMode:x,zoomOnDoubleClick:L,panOnDrag:!Q&&he,defaultViewport:N,translateExtent:D,minZoom:M,maxZoom:P,zoomActivationKeyCode:_,preventScrolling:V,noWheelClassName:A,noPanClassName:z,onViewportChange:B,isControlledViewport:F,paneClickDistance:a,selectionOnDrag:ze,children:m.jsxs(VRe,{onSelectionStart:h,onSelectionEnd:f,onPaneClick:e,onPaneMouseEnter:t,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:r,panOnDrag:he,isSelecting:!!Oe,selectionMode:u,selectionKeyPressed:Q,paneClickDistance:a,selectionOnDrag:ze,children:[n,q&&m.jsx(JRe,{onSelectionContextMenu:O,noPanClassName:z,disableKeyboardA11y:U})]})})}Ppe.displayName="FlowRenderer";const tMe=R.memo(Ppe),iMe=n=>e=>n?HY(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(t=>t.id):Array.from(e.nodeLookup.keys());function nMe(n){return rn(R.useCallback(iMe(n),[n]),Bs)}const sMe=n=>n.updateNodeInternals;function oMe(){const n=rn(sMe),[e]=R.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(t=>{const i=new Map;t.forEach(s=>{const o=s.target.getAttribute("data-id");i.set(o,{id:o,nodeElement:s.target,force:!0})}),n(i)}));return R.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function rMe({node:n,nodeType:e,hasDimensions:t,resizeObserver:i}){const s=Vs(),o=R.useRef(null),r=R.useRef(null),a=R.useRef(n.sourcePosition),l=R.useRef(n.targetPosition),c=R.useRef(e),d=t&&!!n.internals.handleBounds;return R.useEffect(()=>{o.current&&!n.hidden&&(!d||r.current!==o.current)&&(r.current&&(i==null||i.unobserve(r.current)),i==null||i.observe(o.current),r.current=o.current)},[d,n.hidden]),R.useEffect(()=>()=>{r.current&&(i==null||i.unobserve(r.current),r.current=null)},[]),R.useEffect(()=>{if(o.current){const u=c.current!==e,h=a.current!==n.sourcePosition,f=l.current!==n.targetPosition;(u||h||f)&&(c.current=e,a.current=n.sourcePosition,l.current=n.targetPosition,s.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:o.current,force:!0}]])))}},[n.id,e,n.sourcePosition,n.targetPosition]),o}function aMe({id:n,onClick:e,onMouseEnter:t,onMouseMove:i,onMouseLeave:s,onContextMenu:o,onDoubleClick:r,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:d,resizeObserver:u,noDragClassName:h,noPanClassName:f,disableKeyboardA11y:g,rfId:p,nodeTypes:_,nodeClickDistance:b,onError:v}){const{node:C,internals:y,isParent:S}=rn(Se=>{const je=Se.nodeLookup.get(n),it=Se.parentLookup.has(n);return{node:je,internals:je.internals,isParent:it}},Bs);let x=C.type||"default",L=(_==null?void 0:_[x])||jie[x];L===void 0&&(v==null||v("003",df.error003(x)),x="default",L=(_==null?void 0:_.default)||jie.default);const k=!!(C.draggable||a&&typeof C.draggable>"u"),N=!!(C.selectable||l&&typeof C.selectable>"u"),D=!!(C.connectable||c&&typeof C.connectable>"u"),M=!!(C.focusable||d&&typeof C.focusable>"u"),P=Vs(),V=Qge(C),O=rMe({node:C,nodeType:x,hasDimensions:V,resizeObserver:u}),A=Rpe({nodeRef:O,disabled:C.hidden||!k,noDragClassName:h,handleSelector:C.dragHandle,nodeId:n,isSelectable:N,nodeClickDistance:b}),z=Mpe();if(C.hidden)return null;const U=Fp(C),B=XRe(C),F=N||k||e||t||i||s,q=t?Se=>t(Se,{...y.userNode}):void 0,Y=i?Se=>i(Se,{...y.userNode}):void 0,Q=s?Se=>s(Se,{...y.userNode}):void 0,ne=o?Se=>o(Se,{...y.userNode}):void 0,he=r?Se=>r(Se,{...y.userNode}):void 0,Ce=Se=>{const{selectNodesOnDrag:je,nodeDragThreshold:it}=P.getState();N&&(!je||!k||it>0)&&fH({id:n,store:P,nodeRef:O}),e&&e(Se,{...y.userNode})},ze=Se=>{if(!(tpe(Se.nativeEvent)||g)){if(zge.includes(Se.key)&&N){const je=Se.key==="Escape";fH({id:n,store:P,unselect:je,nodeRef:O})}else if(k&&C.selected&&Object.prototype.hasOwnProperty.call(ZA,Se.key)){Se.preventDefault();const{ariaLabelConfig:je}=P.getState();P.setState({ariaLiveMessage:je["node.a11yDescription.ariaLiveMessage"]({direction:Se.key.replace("Arrow","").toLowerCase(),x:~~y.positionAbsolute.x,y:~~y.positionAbsolute.y})}),z({direction:ZA[Se.key],factor:Se.shiftKey?4:1})}}},Oe=()=>{var gt;if(g||!((gt=O.current)!=null&>.matches(":focus-visible")))return;const{transform:Se,width:je,height:it,autoPanOnNodeFocus:Ct,setCenter:Fe}=P.getState();if(!Ct)return;HY(new Map([[n,C]]),{x:0,y:0,width:je,height:it},Se,!0).length>0||Fe(C.position.x+U.width/2,C.position.y+U.height/2,{zoom:Se[2]})};return m.jsx("div",{className:Zo(["react-flow__node",`react-flow__node-${x}`,{[f]:k},C.className,{selected:C.selected,selectable:N,parent:S,draggable:k,dragging:A}]),ref:O,style:{zIndex:y.z,transform:`translate(${y.positionAbsolute.x}px,${y.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:V?"visible":"hidden",...C.style,...B},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:q,onMouseMove:Y,onMouseLeave:Q,onContextMenu:ne,onClick:Ce,onDoubleClick:he,onKeyDown:M?ze:void 0,tabIndex:M?0:void 0,onFocus:M?Oe:void 0,role:C.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${xpe}-${p}`,"aria-label":C.ariaLabel,...C.domAttributes,children:m.jsx(zRe,{value:n,children:m.jsx(L,{id:n,data:C.data,type:x,positionAbsoluteX:y.positionAbsolute.x,positionAbsoluteY:y.positionAbsolute.y,selected:C.selected??!1,selectable:N,draggable:k,deletable:C.deletable??!0,isConnectable:D,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:A,dragHandle:C.dragHandle,zIndex:y.z,parentId:C.parentId,...U})})})}var lMe=R.memo(aMe);const cMe=n=>({nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,onError:n.onError});function Ope(n){const{nodesDraggable:e,nodesConnectable:t,nodesFocusable:i,elementsSelectable:s,onError:o}=rn(cMe,Bs),r=nMe(n.onlyRenderVisibleElements),a=oMe();return m.jsx("div",{className:"react-flow__nodes",style:B3,children:r.map(l=>m.jsx(lMe,{id:l,nodeTypes:n.nodeTypes,nodeExtent:n.nodeExtent,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:a,nodesDraggable:e,nodesConnectable:t,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:n.nodeClickDistance,onError:o},l))})}Ope.displayName="NodeRenderer";const dMe=R.memo(Ope);function uMe(n){return rn(R.useCallback(t=>{if(!n)return t.edges.map(s=>s.id);const i=[];if(t.width&&t.height)for(const s of t.edges){const o=t.nodeLookup.get(s.source),r=t.nodeLookup.get(s.target);o&&r&&ZTe({sourceNode:o,targetNode:r,width:t.width,height:t.height,transform:t.transform})&&i.push(s.id)}return i},[n]),Bs)}const hMe=({color:n="none",strokeWidth:e=1})=>{const t={strokeWidth:e,...n&&{stroke:n}};return m.jsx("polyline",{className:"arrow",style:t,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},fMe=({color:n="none",strokeWidth:e=1})=>{const t={strokeWidth:e,...n&&{stroke:n,fill:n}};return m.jsx("polyline",{className:"arrowclosed",style:t,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},$ie={[T0.Arrow]:hMe,[T0.ArrowClosed]:fMe};function gMe(n){const e=Vs();return R.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call($ie,n)?$ie[n]:((o=(s=e.getState()).onError)==null||o.call(s,"009",df.error009(n)),null)},[n])}const pMe=({id:n,type:e,color:t,width:i=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:r,orient:a="auto-start-reverse"})=>{const l=gMe(e);return l?m.jsx("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:a,refX:"0",refY:"0",children:m.jsx(l,{color:t,strokeWidth:r})}):null},Fpe=({defaultColor:n,rfId:e})=>{const t=rn(o=>o.edges),i=rn(o=>o.defaultEdgeOptions),s=R.useMemo(()=>s2e(t,{id:e,defaultColor:n,defaultMarkerStart:i==null?void 0:i.markerStart,defaultMarkerEnd:i==null?void 0:i.markerEnd}),[t,i,e,n]);return s.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:s.map(o=>m.jsx(pMe,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};Fpe.displayName="MarkerDefinitions";var mMe=R.memo(Fpe);function Bpe({x:n,y:e,label:t,labelStyle:i,labelShowBg:s=!0,labelBgStyle:o,labelBgPadding:r=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...d}){const[u,h]=R.useState({x:1,y:0,width:0,height:0}),f=Zo(["react-flow__edge-textwrapper",c]),g=R.useRef(null);return R.useEffect(()=>{if(g.current){const p=g.current.getBBox();h({x:p.x,y:p.y,width:p.width,height:p.height})}},[t]),t?m.jsxs("g",{transform:`translate(${n-u.width/2} ${e-u.height/2})`,className:f,visibility:u.width?"visible":"hidden",...d,children:[s&&m.jsx("rect",{width:u.width+2*r[0],x:-r[0],y:-r[1],height:u.height+2*r[1],className:"react-flow__edge-textbg",style:o,rx:a,ry:a}),m.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:i,children:t}),l]}):null}Bpe.displayName="EdgeText";const _Me=R.memo(Bpe);function W3({path:n,labelX:e,labelY:t,label:i,labelStyle:s,labelShowBg:o,labelBgStyle:r,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...d}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...d,d:n,fill:"none",className:Zo(["react-flow__edge-path",d.className])}),c?m.jsx("path",{d:n,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,i&&ku(e)&&ku(t)?m.jsx(_Me,{x:e,y:t,label:i,labelStyle:s,labelShowBg:o,labelBgStyle:r,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function Uie({pos:n,x1:e,y1:t,x2:i,y2:s}){return n===Wt.Left||n===Wt.Right?[.5*(e+i),t]:[e,.5*(t+s)]}function Wpe({sourceX:n,sourceY:e,sourcePosition:t=Wt.Bottom,targetX:i,targetY:s,targetPosition:o=Wt.Top}){const[r,a]=Uie({pos:t,x1:n,y1:e,x2:i,y2:s}),[l,c]=Uie({pos:o,x1:i,y1:s,x2:n,y2:e}),[d,u,h,f]=npe({sourceX:n,sourceY:e,targetX:i,targetY:s,sourceControlX:r,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${n},${e} C${r},${a} ${l},${c} ${i},${s}`,d,u,h,f]}function Hpe(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,sourcePosition:r,targetPosition:a,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:_,interactionWidth:b})=>{const[v,C,y]=Wpe({sourceX:t,sourceY:i,sourcePosition:r,targetX:s,targetY:o,targetPosition:a}),S=n.isInternal?void 0:e;return m.jsx(W3,{id:S,path:v,labelX:C,labelY:y,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:_,interactionWidth:b})})}const bMe=Hpe({isInternal:!1}),Vpe=Hpe({isInternal:!0});bMe.displayName="SimpleBezierEdge";Vpe.displayName="SimpleBezierEdgeInternal";function jpe(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,sourcePosition:f=Wt.Bottom,targetPosition:g=Wt.Top,markerEnd:p,markerStart:_,pathOptions:b,interactionWidth:v})=>{const[C,y,S]=lH({sourceX:t,sourceY:i,sourcePosition:f,targetX:s,targetY:o,targetPosition:g,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset,stepPosition:b==null?void 0:b.stepPosition}),x=n.isInternal?void 0:e;return m.jsx(W3,{id:x,path:C,labelX:y,labelY:S,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:p,markerStart:_,interactionWidth:v})})}const zpe=jpe({isInternal:!1}),$pe=jpe({isInternal:!0});zpe.displayName="SmoothStepEdge";$pe.displayName="SmoothStepEdgeInternal";function Upe(n){return R.memo(({id:e,...t})=>{var s;const i=n.isInternal?void 0:e;return m.jsx(zpe,{...t,id:i,pathOptions:R.useMemo(()=>{var o;return{borderRadius:0,offset:(o=t.pathOptions)==null?void 0:o.offset}},[(s=t.pathOptions)==null?void 0:s.offset])})})}const vMe=Upe({isInternal:!1}),qpe=Upe({isInternal:!0});vMe.displayName="StepEdge";qpe.displayName="StepEdgeInternal";function Kpe(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:g,interactionWidth:p})=>{const[_,b,v]=rpe({sourceX:t,sourceY:i,targetX:s,targetY:o}),C=n.isInternal?void 0:e;return m.jsx(W3,{id:C,path:_,labelX:b,labelY:v,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:d,labelBgBorderRadius:u,style:h,markerEnd:f,markerStart:g,interactionWidth:p})})}const wMe=Kpe({isInternal:!1}),Gpe=Kpe({isInternal:!0});wMe.displayName="StraightEdge";Gpe.displayName="StraightEdgeInternal";function Ype(n){return R.memo(({id:e,sourceX:t,sourceY:i,targetX:s,targetY:o,sourcePosition:r=Wt.Bottom,targetPosition:a=Wt.Top,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:_,pathOptions:b,interactionWidth:v})=>{const[C,y,S]=spe({sourceX:t,sourceY:i,sourcePosition:r,targetX:s,targetY:o,targetPosition:a,curvature:b==null?void 0:b.curvature}),x=n.isInternal?void 0:e;return m.jsx(W3,{id:x,path:C,labelX:y,labelY:S,label:l,labelStyle:c,labelShowBg:d,labelBgStyle:u,labelBgPadding:h,labelBgBorderRadius:f,style:g,markerEnd:p,markerStart:_,interactionWidth:v})})}const CMe=Ype({isInternal:!1}),Zpe=Ype({isInternal:!0});CMe.displayName="BezierEdge";Zpe.displayName="BezierEdgeInternal";const qie={default:Zpe,straight:Gpe,step:qpe,smoothstep:$pe,simplebezier:Vpe},Kie={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},yMe=(n,e,t)=>t===Wt.Left?n-e:t===Wt.Right?n+e:n,SMe=(n,e,t)=>t===Wt.Top?n-e:t===Wt.Bottom?n+e:n,Gie="react-flow__edgeupdater";function Yie({position:n,centerX:e,centerY:t,radius:i=10,onMouseDown:s,onMouseEnter:o,onMouseOut:r,type:a}){return m.jsx("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:r,className:Zo([Gie,`${Gie}-${a}`]),cx:yMe(e,i,n),cy:SMe(t,i,n),r:i,stroke:"transparent",fill:"transparent"})}function xMe({isReconnectable:n,reconnectRadius:e,edge:t,sourceX:i,sourceY:s,targetX:o,targetY:r,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:d,onReconnectEnd:u,setReconnecting:h,setUpdateHover:f}){const g=Vs(),p=(y,S)=>{if(y.button!==0)return;const{autoPanOnConnect:x,domNode:L,connectionMode:k,connectionRadius:N,lib:D,onConnectStart:M,cancelConnection:P,nodeLookup:V,rfId:O,panBy:A,updateConnection:z}=g.getState(),U=S.type==="target",B=(Y,Q)=>{h(!1),u==null||u(Y,t,S.type,Q)},F=Y=>c==null?void 0:c(t,Y),q=(Y,Q)=>{h(!0),d==null||d(y,t,S.type),M==null||M(Y,Q)};uH.onPointerDown(y.nativeEvent,{autoPanOnConnect:x,connectionMode:k,connectionRadius:N,domNode:L,handleId:S.id,nodeId:S.nodeId,nodeLookup:V,isTarget:U,edgeUpdaterType:S.type,lib:D,flowId:O,cancelConnection:P,panBy:A,isValidConnection:(...Y)=>{var Q,ne;return((ne=(Q=g.getState()).isValidConnection)==null?void 0:ne.call(Q,...Y))??!0},onConnect:F,onConnectStart:q,onConnectEnd:(...Y)=>{var Q,ne;return(ne=(Q=g.getState()).onConnectEnd)==null?void 0:ne.call(Q,...Y)},onReconnectEnd:B,updateConnection:z,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:y.currentTarget})},_=y=>p(y,{nodeId:t.target,id:t.targetHandle??null,type:"target"}),b=y=>p(y,{nodeId:t.source,id:t.sourceHandle??null,type:"source"}),v=()=>f(!0),C=()=>f(!1);return m.jsxs(m.Fragment,{children:[(n===!0||n==="source")&&m.jsx(Yie,{position:a,centerX:i,centerY:s,radius:e,onMouseDown:_,onMouseEnter:v,onMouseOut:C,type:"source"}),(n===!0||n==="target")&&m.jsx(Yie,{position:l,centerX:o,centerY:r,radius:e,onMouseDown:b,onMouseEnter:v,onMouseOut:C,type:"target"})]})}function LMe({id:n,edgesFocusable:e,edgesReconnectable:t,elementsSelectable:i,onClick:s,onDoubleClick:o,onContextMenu:r,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,rfId:g,edgeTypes:p,noPanClassName:_,onError:b,disableKeyboardA11y:v}){let C=rn(Fe=>Fe.edgeLookup.get(n));const y=rn(Fe=>Fe.defaultEdgeOptions);C=y?{...y,...C}:C;let S=C.type||"default",x=(p==null?void 0:p[S])||qie[S];x===void 0&&(b==null||b("011",df.error011(S)),S="default",x=(p==null?void 0:p.default)||qie.default);const L=!!(C.focusable||e&&typeof C.focusable>"u"),k=typeof u<"u"&&(C.reconnectable||t&&typeof C.reconnectable>"u"),N=!!(C.selectable||i&&typeof C.selectable>"u"),D=R.useRef(null),[M,P]=R.useState(!1),[V,O]=R.useState(!1),A=Vs(),{zIndex:z,sourceX:U,sourceY:B,targetX:F,targetY:q,sourcePosition:Y,targetPosition:Q}=rn(R.useCallback(Fe=>{const Re=Fe.nodeLookup.get(C.source),gt=Fe.nodeLookup.get(C.target);if(!Re||!gt)return{zIndex:C.zIndex,...Kie};const si=n2e({id:n,sourceNode:Re,targetNode:gt,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:Fe.connectionMode,onError:b});return{zIndex:YTe({selected:C.selected,zIndex:C.zIndex,sourceNode:Re,targetNode:gt,elevateOnSelect:Fe.elevateEdgesOnSelect,zIndexMode:Fe.zIndexMode}),...si||Kie}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),Bs),ne=R.useMemo(()=>C.markerStart?`url('#${cH(C.markerStart,g)}')`:void 0,[C.markerStart,g]),he=R.useMemo(()=>C.markerEnd?`url('#${cH(C.markerEnd,g)}')`:void 0,[C.markerEnd,g]);if(C.hidden||U===null||B===null||F===null||q===null)return null;const Ce=Fe=>{var Ye;const{addSelectedEdges:Re,unselectNodesAndEdges:gt,multiSelectionActive:si}=A.getState();N&&(A.setState({nodesSelectionActive:!1}),C.selected&&si?(gt({nodes:[],edges:[C]}),(Ye=D.current)==null||Ye.blur()):Re([n])),s&&s(Fe,C)},ze=o?Fe=>{o(Fe,{...C})}:void 0,Oe=r?Fe=>{r(Fe,{...C})}:void 0,Se=a?Fe=>{a(Fe,{...C})}:void 0,je=l?Fe=>{l(Fe,{...C})}:void 0,it=c?Fe=>{c(Fe,{...C})}:void 0,Ct=Fe=>{var Re;if(!v&&zge.includes(Fe.key)&&N){const{unselectNodesAndEdges:gt,addSelectedEdges:si}=A.getState();Fe.key==="Escape"?((Re=D.current)==null||Re.blur(),gt({edges:[C]})):si([n])}};return m.jsx("svg",{style:{zIndex:z},children:m.jsxs("g",{className:Zo(["react-flow__edge",`react-flow__edge-${S}`,C.className,_,{selected:C.selected,animated:C.animated,inactive:!N&&!s,updating:M,selectable:N}]),onClick:Ce,onDoubleClick:ze,onContextMenu:Oe,onMouseEnter:Se,onMouseMove:je,onMouseLeave:it,onKeyDown:L?Ct:void 0,tabIndex:L?0:void 0,role:C.ariaRole??(L?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":L?`${Lpe}-${g}`:void 0,ref:D,...C.domAttributes,children:[!V&&m.jsx(x,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:N,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:U,sourceY:B,targetX:F,targetY:q,sourcePosition:Y,targetPosition:Q,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:ne,markerEnd:he,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),k&&m.jsx(xMe,{edge:C,isReconnectable:k,reconnectRadius:d,onReconnect:u,onReconnectStart:h,onReconnectEnd:f,sourceX:U,sourceY:B,targetX:F,targetY:q,sourcePosition:Y,targetPosition:Q,setUpdateHover:P,setReconnecting:O})]})})}var kMe=R.memo(LMe);const NMe=n=>({edgesFocusable:n.edgesFocusable,edgesReconnectable:n.edgesReconnectable,elementsSelectable:n.elementsSelectable,connectionMode:n.connectionMode,onError:n.onError});function Xpe({defaultMarkerColor:n,onlyRenderVisibleElements:e,rfId:t,edgeTypes:i,noPanClassName:s,onReconnect:o,onEdgeContextMenu:r,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:h,onReconnectStart:f,onReconnectEnd:g,disableKeyboardA11y:p}){const{edgesFocusable:_,edgesReconnectable:b,elementsSelectable:v,onError:C}=rn(NMe,Bs),y=uMe(e);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(mMe,{defaultColor:n,rfId:t}),y.map(S=>m.jsx(kMe,{id:S,edgesFocusable:_,edgesReconnectable:b,elementsSelectable:v,noPanClassName:s,onReconnect:o,onContextMenu:r,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:d,reconnectRadius:u,onDoubleClick:h,onReconnectStart:f,onReconnectEnd:g,rfId:t,onError:C,edgeTypes:i,disableKeyboardA11y:p},S))]})}Xpe.displayName="EdgeRenderer";const EMe=R.memo(Xpe),IMe=n=>`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`;function DMe({children:n}){const e=rn(IMe);return m.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:n})}function TMe(n){const e=GY(),t=R.useRef(!1);R.useEffect(()=>{!t.current&&e.viewportInitialized&&n&&(setTimeout(()=>n(e),1),t.current=!0)},[n,e.viewportInitialized])}const RMe=n=>{var e;return(e=n.panZoom)==null?void 0:e.syncViewport};function MMe(n){const e=rn(RMe),t=Vs();return R.useEffect(()=>{n&&(e==null||e(n),t.setState({transform:[n.x,n.y,n.zoom]}))},[n,e]),null}function AMe(n){return n.connection.inProgress?{...n.connection,to:YD(n.connection.to,n.transform)}:{...n.connection}}function PMe(n){return AMe}function OMe(n){const e=PMe();return rn(e,Bs)}const FMe=n=>({nodesConnectable:n.nodesConnectable,isValid:n.connection.isValid,inProgress:n.connection.inProgress,width:n.width,height:n.height});function BMe({containerStyle:n,style:e,type:t,component:i}){const{nodesConnectable:s,width:o,height:r,isValid:a,inProgress:l}=rn(FMe,Bs);return!(o&&s&&l)?null:m.jsx("svg",{style:n,width:o,height:r,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Zo(["react-flow__connection",qge(a)]),children:m.jsx(Qpe,{style:e,type:t,CustomComponent:i,isValid:a})})})}const Qpe=({style:n,type:e=Cg.Bezier,CustomComponent:t,isValid:i})=>{const{inProgress:s,from:o,fromNode:r,fromHandle:a,fromPosition:l,to:c,toNode:d,toHandle:u,toPosition:h,pointer:f}=OMe();if(!s)return;if(t)return m.jsx(t,{connectionLineType:e,connectionLineStyle:n,fromNode:r,fromHandle:a,fromX:o.x,fromY:o.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:h,connectionStatus:qge(i),toNode:d,toHandle:u,pointer:f});let g="";const p={sourceX:o.x,sourceY:o.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:h};switch(e){case Cg.Bezier:[g]=spe(p);break;case Cg.SimpleBezier:[g]=Wpe(p);break;case Cg.Step:[g]=lH({...p,borderRadius:0});break;case Cg.SmoothStep:[g]=lH(p);break;default:[g]=rpe(p)}return m.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:n})};Qpe.displayName="ConnectionLine";const WMe={};function Zie(n=WMe){R.useRef(n),Vs(),R.useEffect(()=>{},[n])}function HMe(){Vs(),R.useRef(!1),R.useEffect(()=>{},[])}function Jpe({nodeTypes:n,edgeTypes:e,onInit:t,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:o,onEdgeDoubleClick:r,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:h,onSelectionEnd:f,connectionLineType:g,connectionLineStyle:p,connectionLineComponent:_,connectionLineContainerStyle:b,selectionKeyCode:v,selectionOnDrag:C,selectionMode:y,multiSelectionKeyCode:S,panActivationKeyCode:x,zoomActivationKeyCode:L,deleteKeyCode:k,onlyRenderVisibleElements:N,elementsSelectable:D,defaultViewport:M,translateExtent:P,minZoom:V,maxZoom:O,preventScrolling:A,defaultMarkerColor:z,zoomOnScroll:U,zoomOnPinch:B,panOnScroll:F,panOnScrollSpeed:q,panOnScrollMode:Y,zoomOnDoubleClick:Q,panOnDrag:ne,onPaneClick:he,onPaneMouseEnter:Ce,onPaneMouseMove:ze,onPaneMouseLeave:Oe,onPaneScroll:Se,onPaneContextMenu:je,paneClickDistance:it,nodeClickDistance:Ct,onEdgeContextMenu:Fe,onEdgeMouseEnter:Re,onEdgeMouseMove:gt,onEdgeMouseLeave:si,reconnectRadius:Ye,onReconnect:ri,onReconnectStart:Di,onReconnectEnd:Nn,noDragClassName:Xe,noWheelClassName:qt,noPanClassName:Zt,disableKeyboardA11y:ln,nodeExtent:fa,rfId:po,viewport:es,onViewportChange:ts}){return Zie(n),Zie(e),HMe(),TMe(t),MMe(es),m.jsx(tMe,{onPaneClick:he,onPaneMouseEnter:Ce,onPaneMouseMove:ze,onPaneMouseLeave:Oe,onPaneContextMenu:je,onPaneScroll:Se,paneClickDistance:it,deleteKeyCode:k,selectionKeyCode:v,selectionOnDrag:C,selectionMode:y,onSelectionStart:h,onSelectionEnd:f,multiSelectionKeyCode:S,panActivationKeyCode:x,zoomActivationKeyCode:L,elementsSelectable:D,zoomOnScroll:U,zoomOnPinch:B,zoomOnDoubleClick:Q,panOnScroll:F,panOnScrollSpeed:q,panOnScrollMode:Y,panOnDrag:ne,defaultViewport:M,translateExtent:P,minZoom:V,maxZoom:O,onSelectionContextMenu:u,preventScrolling:A,noDragClassName:Xe,noWheelClassName:qt,noPanClassName:Zt,disableKeyboardA11y:ln,onViewportChange:ts,isControlledViewport:!!es,children:m.jsxs(DMe,{children:[m.jsx(EMe,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:r,onReconnect:ri,onReconnectStart:Di,onReconnectEnd:Nn,onlyRenderVisibleElements:N,onEdgeContextMenu:Fe,onEdgeMouseEnter:Re,onEdgeMouseMove:gt,onEdgeMouseLeave:si,reconnectRadius:Ye,defaultMarkerColor:z,noPanClassName:Zt,disableKeyboardA11y:ln,rfId:po}),m.jsx(BMe,{style:p,type:g,component:_,containerStyle:b}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(dMe,{nodeTypes:n,onNodeClick:i,onNodeDoubleClick:o,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:d,nodeClickDistance:Ct,onlyRenderVisibleElements:N,noPanClassName:Zt,noDragClassName:Xe,disableKeyboardA11y:ln,nodeExtent:fa,rfId:po}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}Jpe.displayName="GraphView";const VMe=R.memo(Jpe),Xie=({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,width:s,height:o,fitView:r,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:h="basic"}={})=>{const f=new Map,g=new Map,p=new Map,_=new Map,b=i??e??[],v=t??n??[],C=d??[0,0],y=u??WE;cpe(p,_,b);const{nodesInitialized:S}=dH(v,f,g,{nodeOrigin:C,nodeExtent:y,zIndexMode:h});let x=[0,0,1];if(r&&s&&o){const L=KD(f,{filter:M=>!!((M.width||M.initialWidth)&&(M.height||M.initialHeight))}),{x:k,y:N,zoom:D}=VY(L,s,o,l,c,(a==null?void 0:a.padding)??.1);x=[k,N,D]}return{rfId:"1",width:s??0,height:o??0,transform:x,nodes:v,nodesInitialized:S,nodeLookup:f,parentLookup:g,edges:b,edgeLookup:_,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:t!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:WE,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:US.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:r??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Uge},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:zTe,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:$ge,zIndexMode:h,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},jMe=({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,width:s,height:o,fitView:r,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h})=>aRe((f,g)=>{async function p(){const{nodeLookup:_,panZoom:b,fitViewOptions:v,fitViewResolver:C,width:y,height:S,minZoom:x,maxZoom:L}=g();b&&(await VTe({nodes:_,width:y,height:S,panZoom:b,minZoom:x,maxZoom:L},v),C==null||C.resolve(!0),f({fitViewResolver:null}))}return{...Xie({nodes:n,edges:e,width:s,height:o,fitView:r,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:t,defaultEdges:i,zIndexMode:h}),setNodes:_=>{const{nodeLookup:b,parentLookup:v,nodeOrigin:C,elevateNodesOnSelect:y,fitViewQueued:S,zIndexMode:x,nodesSelectionActive:L}=g(),{nodesInitialized:k,hasSelectedNodes:N}=dH(_,b,v,{nodeOrigin:C,nodeExtent:u,elevateNodesOnSelect:y,checkEquality:!0,zIndexMode:x}),D=L&&N;S&&k?(p(),f({nodes:_,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:D})):f({nodes:_,nodesInitialized:k,nodesSelectionActive:D})},setEdges:_=>{const{connectionLookup:b,edgeLookup:v}=g();cpe(b,v,_),f({edges:_})},setDefaultNodesAndEdges:(_,b)=>{if(_){const{setNodes:v}=g();v(_),f({hasDefaultNodes:!0})}if(b){const{setEdges:v}=g();v(b),f({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:b,nodeLookup:v,parentLookup:C,domNode:y,nodeOrigin:S,nodeExtent:x,debug:L,fitViewQueued:k,zIndexMode:N}=g(),{changes:D,updatedInternals:M}=u2e(_,v,C,y,S,x,N);M&&(a2e(v,C,{nodeOrigin:S,nodeExtent:x,zIndexMode:N}),k?(p(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),(D==null?void 0:D.length)>0&&(L&&console.log("React Flow: trigger node changes",D),b==null||b(D)))},updateNodePositions:(_,b=!1)=>{const v=[];let C=[];const{nodeLookup:y,triggerNodeChanges:S,connection:x,updateConnection:L,onNodesChangeMiddlewareMap:k}=g();for(const[N,D]of _){const M=y.get(N),P=!!(M!=null&&M.expandParent&&(M!=null&&M.parentId)&&(D!=null&&D.position)),V={id:N,type:"position",position:P?{x:Math.max(0,D.position.x),y:Math.max(0,D.position.y)}:D.position,dragging:b};if(M&&x.inProgress&&x.fromNode.id===M.id){const O=M0(M,x.fromHandle,Wt.Left,!0);L({...x,from:O})}P&&M.parentId&&v.push({id:N,parentId:M.parentId,rect:{...D.internals.positionAbsolute,width:D.measured.width??0,height:D.measured.height??0}}),C.push(V)}if(v.length>0){const{parentLookup:N,nodeOrigin:D}=g(),M=KY(v,y,N,D);C.push(...M)}for(const N of k.values())C=N(C);S(C)},triggerNodeChanges:_=>{const{onNodesChange:b,setNodes:v,nodes:C,hasDefaultNodes:y,debug:S}=g();if(_!=null&&_.length){if(y){const x=Epe(_,C);v(x)}S&&console.log("React Flow: trigger node changes",_),b==null||b(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:b,setEdges:v,edges:C,hasDefaultEdges:y,debug:S}=g();if(_!=null&&_.length){if(y){const x=Ipe(_,C);v(x)}S&&console.log("React Flow: trigger edge changes",_),b==null||b(_)}},addSelectedNodes:_=>{const{multiSelectionActive:b,edgeLookup:v,nodeLookup:C,triggerNodeChanges:y,triggerEdgeChanges:S}=g();if(b){const x=_.map(L=>qb(L,!0));y(x);return}y(UC(C,new Set([..._]),!0)),S(UC(v))},addSelectedEdges:_=>{const{multiSelectionActive:b,edgeLookup:v,nodeLookup:C,triggerNodeChanges:y,triggerEdgeChanges:S}=g();if(b){const x=_.map(L=>qb(L,!0));S(x);return}S(UC(v,new Set([..._]))),y(UC(C,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:b}={})=>{const{edges:v,nodes:C,nodeLookup:y,triggerNodeChanges:S,triggerEdgeChanges:x}=g(),L=_||C,k=b||v,N=[];for(const M of L){if(!M.selected)continue;const P=y.get(M.id);P&&(P.selected=!1),N.push(qb(M.id,!1))}const D=[];for(const M of k)M.selected&&D.push(qb(M.id,!1));S(N),x(D)},setMinZoom:_=>{const{panZoom:b,maxZoom:v}=g();b==null||b.setScaleExtent([_,v]),f({minZoom:_})},setMaxZoom:_=>{const{panZoom:b,minZoom:v}=g();b==null||b.setScaleExtent([v,_]),f({maxZoom:_})},setTranslateExtent:_=>{var b;(b=g().panZoom)==null||b.setTranslateExtent(_),f({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:b,triggerNodeChanges:v,triggerEdgeChanges:C,elementsSelectable:y}=g();if(!y)return;const S=b.reduce((L,k)=>k.selected?[...L,qb(k.id,!1)]:L,[]),x=_.reduce((L,k)=>k.selected?[...L,qb(k.id,!1)]:L,[]);v(S),C(x)},setNodeExtent:_=>{const{nodes:b,nodeLookup:v,parentLookup:C,nodeOrigin:y,elevateNodesOnSelect:S,nodeExtent:x,zIndexMode:L}=g();_[0][0]===x[0][0]&&_[0][1]===x[0][1]&&_[1][0]===x[1][0]&&_[1][1]===x[1][1]||(dH(b,v,C,{nodeOrigin:y,nodeExtent:_,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:L}),f({nodeExtent:_}))},panBy:_=>{const{transform:b,width:v,height:C,panZoom:y,translateExtent:S}=g();return h2e({delta:_,panZoom:y,transform:b,translateExtent:S,width:v,height:C})},setCenter:async(_,b,v)=>{const{width:C,height:y,maxZoom:S,panZoom:x}=g();if(!x)return Promise.resolve(!1);const L=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:S;return await x.setViewport({x:C/2-_*L,y:y/2-b*L,zoom:L},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...Uge}})},updateConnection:_=>{f({connection:_})},reset:()=>f({...Xie()})}},Object.is);function zMe({initialNodes:n,initialEdges:e,defaultNodes:t,defaultEdges:i,initialWidth:s,initialHeight:o,initialMinZoom:r,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:d,nodeExtent:u,zIndexMode:h,children:f}){const[g]=R.useState(()=>jMe({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,width:s,height:o,fitView:c,minZoom:r,maxZoom:a,fitViewOptions:l,nodeOrigin:d,nodeExtent:u,zIndexMode:h}));return m.jsx(lRe,{value:g,children:m.jsx(DRe,{children:f})})}function $Me({children:n,nodes:e,edges:t,defaultNodes:i,defaultEdges:s,width:o,height:r,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f}){return R.useContext(O3)?m.jsx(m.Fragment,{children:n}):m.jsx(zMe,{initialNodes:e,initialEdges:t,defaultNodes:i,defaultEdges:s,initialWidth:o,initialHeight:r,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:f,children:n})}const UMe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function qMe({nodes:n,edges:e,defaultNodes:t,defaultEdges:i,className:s,nodeTypes:o,edgeTypes:r,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:d,onMoveStart:u,onMoveEnd:h,onConnect:f,onConnectStart:g,onConnectEnd:p,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:v,onNodeMouseMove:C,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:x,onNodeDragStart:L,onNodeDrag:k,onNodeDragStop:N,onNodesDelete:D,onEdgesDelete:M,onDelete:P,onSelectionChange:V,onSelectionDragStart:O,onSelectionDrag:A,onSelectionDragStop:z,onSelectionContextMenu:U,onSelectionStart:B,onSelectionEnd:F,onBeforeDelete:q,connectionMode:Y,connectionLineType:Q=Cg.Bezier,connectionLineStyle:ne,connectionLineComponent:he,connectionLineContainerStyle:Ce,deleteKeyCode:ze="Backspace",selectionKeyCode:Oe="Shift",selectionOnDrag:Se=!1,selectionMode:je=HE.Full,panActivationKeyCode:it="Space",multiSelectionKeyCode:Ct=jE()?"Meta":"Control",zoomActivationKeyCode:Fe=jE()?"Meta":"Control",snapToGrid:Re,snapGrid:gt,onlyRenderVisibleElements:si=!1,selectNodesOnDrag:Ye,nodesDraggable:ri,autoPanOnNodeFocus:Di,nodesConnectable:Nn,nodesFocusable:Xe,nodeOrigin:qt=kpe,edgesFocusable:Zt,edgesReconnectable:ln,elementsSelectable:fa=!0,defaultViewport:po=CRe,minZoom:es=.5,maxZoom:ts=2,translateExtent:yl=WE,preventScrolling:_r=!0,nodeExtent:ga,defaultMarkerColor:dc="#b1b1b7",zoomOnScroll:cn=!0,zoomOnPinch:Io=!0,panOnScroll:bn=!1,panOnScrollSpeed:ms=.5,panOnScrollMode:Wr=c1.Free,zoomOnDoubleClick:Ha=!0,panOnDrag:Tf=!0,onPaneClick:js,onPaneMouseEnter:Do,onPaneMouseMove:zs,onPaneMouseLeave:Ri,onPaneScroll:Va,onPaneContextMenu:Oi,paneClickDistance:vn=1,nodeClickDistance:li=0,children:Ud,onReconnect:ja,onReconnectStart:Z,onReconnectEnd:nd,onEdgeContextMenu:qd,onEdgeDoubleClick:Wi,onEdgeMouseEnter:_s,onEdgeMouseMove:nt,onEdgeMouseLeave:ih,reconnectRadius:vi=10,onNodesChange:$t,onEdgesChange:no,noDragClassName:To="nodrag",noWheelClassName:za="nowheel",noPanClassName:Hr="nopan",fitView:pa,fitViewOptions:mo,connectOnClick:Kd,attributionPosition:Nt,proOptions:ce,defaultEdgeOptions:Te,elevateNodesOnSelect:bt=!0,elevateEdgesOnSelect:Qi=!1,disableKeyboardA11y:Kn=!1,autoPanOnConnect:Sn,autoPanOnNodeDrag:Es,autoPanSpeed:br,connectionRadius:$s,isValidConnection:Vr,onError:dn,style:Gd,id:Sl,nodeDragThreshold:Rf,connectionDragThreshold:$a,viewport:sd,onViewportChange:Kp,width:Gp,height:Mf,colorMode:Yp="light",debug:Af,onScroll:Qo,ariaLabelConfig:Pf,zIndexMode:re="basic",...Ie},$e){const Ne=Sl||"1",ai=LRe(Yp),Xt=R.useCallback(gi=>{gi.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Qo==null||Qo(gi)},[Qo]);return m.jsx("div",{"data-testid":"rf__wrapper",...Ie,onScroll:Xt,style:{...Gd,...UMe},ref:$e,className:Zo(["react-flow",s,ai]),id:Sl,role:"application",children:m.jsxs($Me,{nodes:n,edges:e,width:Gp,height:Mf,fitView:pa,fitViewOptions:mo,minZoom:es,maxZoom:ts,nodeOrigin:qt,nodeExtent:ga,zIndexMode:re,children:[m.jsx(xRe,{nodes:n,edges:e,defaultNodes:t,defaultEdges:i,onConnect:f,onConnectStart:g,onConnectEnd:p,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:ri,autoPanOnNodeFocus:Di,nodesConnectable:Nn,nodesFocusable:Xe,edgesFocusable:Zt,edgesReconnectable:ln,elementsSelectable:fa,elevateNodesOnSelect:bt,elevateEdgesOnSelect:Qi,minZoom:es,maxZoom:ts,nodeExtent:ga,onNodesChange:$t,onEdgesChange:no,snapToGrid:Re,snapGrid:gt,connectionMode:Y,translateExtent:yl,connectOnClick:Kd,defaultEdgeOptions:Te,fitView:pa,fitViewOptions:mo,onNodesDelete:D,onEdgesDelete:M,onDelete:P,onNodeDragStart:L,onNodeDrag:k,onNodeDragStop:N,onSelectionDrag:A,onSelectionDragStart:O,onSelectionDragStop:z,onMove:d,onMoveStart:u,onMoveEnd:h,noPanClassName:Hr,nodeOrigin:qt,rfId:Ne,autoPanOnConnect:Sn,autoPanOnNodeDrag:Es,autoPanSpeed:br,onError:dn,connectionRadius:$s,isValidConnection:Vr,selectNodesOnDrag:Ye,nodeDragThreshold:Rf,connectionDragThreshold:$a,onBeforeDelete:q,debug:Af,ariaLabelConfig:Pf,zIndexMode:re}),m.jsx(VMe,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:v,onNodeMouseMove:C,onNodeMouseLeave:y,onNodeContextMenu:S,onNodeDoubleClick:x,nodeTypes:o,edgeTypes:r,connectionLineType:Q,connectionLineStyle:ne,connectionLineComponent:he,connectionLineContainerStyle:Ce,selectionKeyCode:Oe,selectionOnDrag:Se,selectionMode:je,deleteKeyCode:ze,multiSelectionKeyCode:Ct,panActivationKeyCode:it,zoomActivationKeyCode:Fe,onlyRenderVisibleElements:si,defaultViewport:po,translateExtent:yl,minZoom:es,maxZoom:ts,preventScrolling:_r,zoomOnScroll:cn,zoomOnPinch:Io,zoomOnDoubleClick:Ha,panOnScroll:bn,panOnScrollSpeed:ms,panOnScrollMode:Wr,panOnDrag:Tf,onPaneClick:js,onPaneMouseEnter:Do,onPaneMouseMove:zs,onPaneMouseLeave:Ri,onPaneScroll:Va,onPaneContextMenu:Oi,paneClickDistance:vn,nodeClickDistance:li,onSelectionContextMenu:U,onSelectionStart:B,onSelectionEnd:F,onReconnect:ja,onReconnectStart:Z,onReconnectEnd:nd,onEdgeContextMenu:qd,onEdgeDoubleClick:Wi,onEdgeMouseEnter:_s,onEdgeMouseMove:nt,onEdgeMouseLeave:ih,reconnectRadius:vi,defaultMarkerColor:dc,noDragClassName:To,noWheelClassName:za,noPanClassName:Hr,rfId:Ne,disableKeyboardA11y:Kn,nodeExtent:ga,viewport:sd,onViewportChange:Kp}),m.jsx(wRe,{onSelectionChange:V}),Ud,m.jsx(pRe,{proOptions:ce,position:Nt}),m.jsx(gRe,{rfId:Ne,disableKeyboardA11y:Kn})]})})}var KMe=Dpe(qMe);function GMe({dimensions:n,lineWidth:e,variant:t,className:i}){return m.jsx("path",{strokeWidth:e,d:`M${n[0]/2} 0 V${n[1]} M0 ${n[1]/2} H${n[0]}`,className:Zo(["react-flow__background-pattern",t,i])})}function YMe({radius:n,className:e}){return m.jsx("circle",{cx:n,cy:n,r:n,className:Zo(["react-flow__background-pattern","dots",e])})}var Zg;(function(n){n.Lines="lines",n.Dots="dots",n.Cross="cross"})(Zg||(Zg={}));const ZMe={[Zg.Dots]:1,[Zg.Lines]:1,[Zg.Cross]:6},XMe=n=>({transform:n.transform,patternId:`pattern-${n.rfId}`});function eme({id:n,variant:e=Zg.Dots,gap:t=20,size:i,lineWidth:s=1,offset:o=0,color:r,bgColor:a,style:l,className:c,patternClassName:d}){const u=R.useRef(null),{transform:h,patternId:f}=rn(XMe,Bs),g=i||ZMe[e],p=e===Zg.Dots,_=e===Zg.Cross,b=Array.isArray(t)?t:[t,t],v=[b[0]*h[2]||1,b[1]*h[2]||1],C=g*h[2],y=Array.isArray(o)?o:[o,o],S=_?[C,C]:v,x=[y[0]*h[2]||1+S[0]/2,y[1]*h[2]||1+S[1]/2],L=`${f}${n||""}`;return m.jsxs("svg",{className:Zo(["react-flow__background",c]),style:{...l,...B3,"--xy-background-color-props":a,"--xy-background-pattern-color-props":r},ref:u,"data-testid":"rf__background",children:[m.jsx("pattern",{id:L,x:h[0]%v[0],y:h[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${x[0]},-${x[1]})`,children:p?m.jsx(YMe,{radius:C/2,className:d}):m.jsx(GMe,{dimensions:S,lineWidth:s,variant:e,className:d})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${L})`})]})}eme.displayName="Background";const QMe=R.memo(eme);function JMe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function eAe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function tAe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.jsx("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 0027.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.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function iAe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-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"})})}function nAe(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.jsx("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 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function y2({children:n,className:e,...t}){return m.jsx("button",{type:"button",className:Zo(["react-flow__controls-button",e]),...t,children:n})}const sAe=n=>({isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom,ariaLabelConfig:n.ariaLabelConfig});function tme({style:n,showZoom:e=!0,showFitView:t=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:r,onFitView:a,onInteractiveChange:l,className:c,children:d,position:u="bottom-left",orientation:h="vertical","aria-label":f}){const g=Vs(),{isInteractive:p,minZoomReached:_,maxZoomReached:b,ariaLabelConfig:v}=rn(sAe,Bs),{zoomIn:C,zoomOut:y,fitView:S}=GY(),x=()=>{C(),o==null||o()},L=()=>{y(),r==null||r()},k=()=>{S(s),a==null||a()},N=()=>{g.setState({nodesDraggable:!p,nodesConnectable:!p,elementsSelectable:!p}),l==null||l(!p)},D=h==="horizontal"?"horizontal":"vertical";return m.jsxs(F3,{className:Zo(["react-flow__controls",D,c]),position:u,style:n,"data-testid":"rf__controls","aria-label":f??v["controls.ariaLabel"],children:[e&&m.jsxs(m.Fragment,{children:[m.jsx(y2,{onClick:x,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:b,children:m.jsx(JMe,{})}),m.jsx(y2,{onClick:L,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:_,children:m.jsx(eAe,{})})]}),t&&m.jsx(y2,{className:"react-flow__controls-fitview",onClick:k,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:m.jsx(tAe,{})}),i&&m.jsx(y2,{className:"react-flow__controls-interactive",onClick:N,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:p?m.jsx(nAe,{}):m.jsx(iAe,{})}),d]})}tme.displayName="Controls";const oAe=R.memo(tme);function rAe({id:n,x:e,y:t,width:i,height:s,style:o,color:r,strokeColor:a,strokeWidth:l,className:c,borderRadius:d,shapeRendering:u,selected:h,onClick:f}){const{background:g,backgroundColor:p}=o||{},_=r||g||p;return m.jsx("rect",{className:Zo(["react-flow__minimap-node",{selected:h},c]),x:e,y:t,rx:d,ry:d,width:i,height:s,style:{fill:_,stroke:a,strokeWidth:l},shapeRendering:u,onClick:f?b=>f(b,n):void 0})}const aAe=R.memo(rAe),lAe=n=>n.nodes.map(e=>e.id),v6=n=>n instanceof Function?n:()=>n;function cAe({nodeStrokeColor:n,nodeColor:e,nodeClassName:t="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:o=aAe,onClick:r}){const a=rn(lAe,Bs),l=v6(e),c=v6(n),d=v6(t),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:a.map(h=>m.jsx(uAe,{id:h,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:d,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:o,onClick:r,shapeRendering:u},h))})}function dAe({id:n,nodeColorFunc:e,nodeStrokeColorFunc:t,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:o,shapeRendering:r,NodeComponent:a,onClick:l}){const{node:c,x:d,y:u,width:h,height:f}=rn(g=>{const p=g.nodeLookup.get(n);if(!p)return{node:void 0,x:0,y:0,width:0,height:0};const _=p.internals.userNode,{x:b,y:v}=p.internals.positionAbsolute,{width:C,height:y}=Fp(_);return{node:_,x:b,y:v,width:C,height:y}},Bs);return!c||c.hidden||!Qge(c)?null:m.jsx(a,{x:d,y:u,width:h,height:f,style:c.style,selected:!!c.selected,className:i(c),color:e(c),borderRadius:s,strokeColor:t(c),strokeWidth:o,shapeRendering:r,onClick:l,id:c.id})}const uAe=R.memo(dAe);var hAe=R.memo(cAe);const fAe=200,gAe=150,pAe=n=>!n.hidden,mAe=n=>{const e={x:-n.transform[0]/n.transform[2],y:-n.transform[1]/n.transform[2],width:n.width/n.transform[2],height:n.height/n.transform[2]};return{viewBB:e,boundingRect:n.nodeLookup.size>0?Xge(KD(n.nodeLookup,{filter:pAe}),e):e,rfId:n.rfId,panZoom:n.panZoom,translateExtent:n.translateExtent,flowWidth:n.width,flowHeight:n.height,ariaLabelConfig:n.ariaLabelConfig}},_Ae="react-flow__minimap-desc";function ime({style:n,className:e,nodeStrokeColor:t,nodeColor:i,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:d,maskStrokeWidth:u,position:h="bottom-right",onClick:f,onNodeClick:g,pannable:p=!1,zoomable:_=!1,ariaLabel:b,inversePan:v,zoomStep:C=1,offsetScale:y=5}){const S=Vs(),x=R.useRef(null),{boundingRect:L,viewBB:k,rfId:N,panZoom:D,translateExtent:M,flowWidth:P,flowHeight:V,ariaLabelConfig:O}=rn(mAe,Bs),A=(n==null?void 0:n.width)??fAe,z=(n==null?void 0:n.height)??gAe,U=L.width/A,B=L.height/z,F=Math.max(U,B),q=F*A,Y=F*z,Q=y*F,ne=L.x-(q-L.width)/2-Q,he=L.y-(Y-L.height)/2-Q,Ce=q+Q*2,ze=Y+Q*2,Oe=`${_Ae}-${N}`,Se=R.useRef(0),je=R.useRef();Se.current=F,R.useEffect(()=>{if(x.current&&D)return je.current=C2e({domNode:x.current,panZoom:D,getTransform:()=>S.getState().transform,getViewScale:()=>Se.current}),()=>{var Re;(Re=je.current)==null||Re.destroy()}},[D]),R.useEffect(()=>{var Re;(Re=je.current)==null||Re.update({translateExtent:M,width:P,height:V,inversePan:v,pannable:p,zoomStep:C,zoomable:_})},[p,_,v,C,M,P,V]);const it=f?Re=>{var Ye;const[gt,si]=((Ye=je.current)==null?void 0:Ye.pointer(Re))||[0,0];f(Re,{x:gt,y:si})}:void 0,Ct=g?R.useCallback((Re,gt)=>{const si=S.getState().nodeLookup.get(gt).internals.userNode;g(Re,si)},[]):void 0,Fe=b??O["minimap.ariaLabel"];return m.jsx(F3,{position:h,style:{...n,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*F:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof t=="string"?t:void 0,"--xy-minimap-node-stroke-width-props":typeof r=="number"?r:void 0},className:Zo(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:A,height:z,viewBox:`${ne} ${he} ${Ce} ${ze}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Oe,ref:x,onClick:it,children:[Fe&&m.jsx("title",{id:Oe,children:Fe}),m.jsx(hAe,{onClick:Ct,nodeColor:i,nodeStrokeColor:t,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:r,nodeComponent:a}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${ne-Q},${he-Q}h${Ce+Q*2}v${ze+Q*2}h${-Ce-Q*2}z
+ M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ime.displayName="MiniMap";const bAe=R.memo(ime),vAe=n=>e=>n?`${Math.max(1/e.transform[2],1)}`:void 0,wAe={[YS.Line]:"right",[YS.Handle]:"bottom-right"};function CAe({nodeId:n,position:e,variant:t=YS.Handle,className:i,style:s=void 0,children:o,color:r,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:h,autoScale:f=!0,shouldResize:g,onResizeStart:p,onResize:_,onResizeEnd:b}){const v=Ape(),C=typeof n=="string"?n:v,y=Vs(),S=R.useRef(null),x=t===YS.Handle,L=rn(R.useCallback(vAe(x&&f),[x,f]),Bs),k=R.useRef(null),N=e??wAe[t];R.useEffect(()=>{if(!(!S.current||!C))return k.current||(k.current=P2e({domNode:S.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:M,transform:P,snapGrid:V,snapToGrid:O,nodeOrigin:A,domNode:z}=y.getState();return{nodeLookup:M,transform:P,snapGrid:V,snapToGrid:O,nodeOrigin:A,paneDomNode:z}},onChange:(M,P)=>{const{triggerNodeChanges:V,nodeLookup:O,parentLookup:A,nodeOrigin:z}=y.getState(),U=[],B={x:M.x,y:M.y},F=O.get(C);if(F&&F.expandParent&&F.parentId){const q=F.origin??z,Y=M.width??F.measured.width??0,Q=M.height??F.measured.height??0,ne={id:F.id,parentId:F.parentId,rect:{width:Y,height:Q,...Jge({x:M.x??F.position.x,y:M.y??F.position.y},{width:Y,height:Q},F.parentId,O,q)}},he=KY([ne],O,A,z);U.push(...he),B.x=M.x?Math.max(q[0]*Y,M.x):void 0,B.y=M.y?Math.max(q[1]*Q,M.y):void 0}if(B.x!==void 0&&B.y!==void 0){const q={id:C,type:"position",position:{...B}};U.push(q)}if(M.width!==void 0&&M.height!==void 0){const Y={id:C,type:"dimensions",resizing:!0,setAttributes:h?h==="horizontal"?"width":"height":!0,dimensions:{width:M.width,height:M.height}};U.push(Y)}for(const q of P){const Y={...q,type:"position"};U.push(Y)}V(U)},onEnd:({width:M,height:P})=>{const V={id:C,type:"dimensions",resizing:!1,dimensions:{width:M,height:P}};y.getState().triggerNodeChanges([V])}})),k.current.update({controlPosition:N,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:d},keepAspectRatio:u,resizeDirection:h,onResizeStart:p,onResize:_,onResizeEnd:b,shouldResize:g}),()=>{var M;(M=k.current)==null||M.destroy()}},[N,a,l,c,d,u,p,_,b,g]);const D=N.split("-");return m.jsx("div",{className:Zo(["react-flow__resize-control","nodrag",...D,t,i]),ref:S,style:{...s,scale:L,...r&&{[x?"backgroundColor":"borderColor"]:r}},children:o})}R.memo(CAe);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const CAe=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ime=(...n)=>n.filter((e,t,i)=>!!e&&i.indexOf(e)===t).join(" ");/**
+ */const yAe=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nme=(...n)=>n.filter((e,t,i)=>!!e&&i.indexOf(e)===t).join(" ");/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */var yAe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
+ */var SAe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const SAe=R.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:s="",children:o,iconNode:r,...a},l)=>R.createElement("svg",{ref:l,...yAe,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:ime("lucide",s),...a},[...r.map(([c,d])=>R.createElement(c,d)),...Array.isArray(o)?o:[o]]));/**
+ */const xAe=R.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:s="",children:o,iconNode:r,...a},l)=>R.createElement("svg",{ref:l,...SAe,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:nme("lucide",s),...a},[...r.map(([c,d])=>R.createElement(c,d)),...Array.isArray(o)?o:[o]]));/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const ii=(n,e)=>{const t=R.forwardRef(({className:i,...s},o)=>R.createElement(SAe,{ref:o,iconNode:e,className:ime(`lucide-${CAe(n)}`,i),...s}));return t.displayName=`${n}`,t};/**
+ */const ii=(n,e)=>{const t=R.forwardRef(({className:i,...s},o)=>R.createElement(xAe,{ref:o,iconNode:e,className:nme(`lucide-${yAe(n)}`,i),...s}));return t.displayName=`${n}`,t};/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const xAe=ii("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/**
+ */const LAe=ii("AlignLeft",[["line",{x1:"21",x2:"3",y1:"6",y2:"6",key:"1fp77t"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}],["line",{x1:"17",x2:"3",y1:"18",y2:"18",key:"1awlsn"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const nme=ii("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
+ */const sme=ii("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -99,12 +99,12 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const sme=ii("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
+ */const ome=ii("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const LAe=ii("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
+ */const kAe=ii("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -124,7 +124,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const ome=ii("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
+ */const rme=ii("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -134,7 +134,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const rme=ii("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
+ */const ame=ii("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -149,7 +149,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const ame=ii("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
+ */const lme=ii("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -159,7 +159,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const kAe=ii("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
+ */const NAe=ii("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -179,12 +179,12 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const NAe=ii("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
+ */const EAe=ii("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const EAe=ii("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
+ */const IAe=ii("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -199,7 +199,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const IAe=ii("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
+ */const DAe=ii("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -209,7 +209,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const DAe=ii("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
+ */const TAe=ii("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -219,12 +219,12 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const TAe=ii("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
+ */const RAe=ii("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const lme=ii("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
+ */const cme=ii("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -254,12 +254,12 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const RAe=ii("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/**
+ */const MAe=ii("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const cme=ii("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
+ */const dme=ii("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -274,7 +274,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const MAe=ii("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
+ */const AAe=ii("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -284,7 +284,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const AAe=ii("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
+ */const PAe=ii("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -304,7 +304,7 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const PAe=ii("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
+ */const OAe=ii("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
@@ -319,19 +319,19 @@ Error generating stack: `+o.message+`
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const OAe=ii("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
+ */const FAe=ii("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
* @license lucide-react v0.400.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
- */const Rg=ii("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Id={};var $ue;const A0=(($ue=Id==null?void 0:Id.VITE_NYXID_BASE_URL)==null?void 0:$ue.trim())||"https://nyx.chrono-ai.fun";var Uue;const FAe=((Uue=Id==null?void 0:Id.VITE_NYXID_API_URL)==null?void 0:Uue.trim())||"https://nyx-api.chrono-ai.fun";var que;const XY=((que=Id==null?void 0:Id.VITE_NYXID_CLIENT_ID)==null?void 0:que.trim())||"37a93189-2734-406e-bca1-7dbdf25c5a53";var Kue;const BAe=((Kue=Id==null?void 0:Id.VITE_NYXID_SCOPE)==null?void 0:Kue.trim())||"openid profile email proxy",JA="aevatar-cli:nyxid:session",Mg="aevatar-cli:nyxid:pending",dme=3e4;function ume(n){let e="";for(const t of n)e+=String.fromCharCode(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function rne(n=32){const e=new Uint8Array(n);return crypto.getRandomValues(e),ume(e)}async function WAe(n){const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return ume(new Uint8Array(e))}function Em(){try{const n=localStorage.getItem(JA);if(!n)return null;const e=JSON.parse(n);return e.tokens.expiresAt-dme>Date.now()||e.tokens.refreshToken?e:(localStorage.removeItem(JA),null)}catch{return null}}function hme(){const n=Em();return n&&n.tokens.expiresAt-dme>Date.now()?n:null}function QY(n){localStorage.setItem(JA,JSON.stringify(n))}function HAe(){localStorage.removeItem(JA)}function _H(){var n;return(n=hme())==null?void 0:n.tokens.accessToken}function VAe(){return!!window.electronAPI}function jAe(){return`${window.location.origin}/auth/callback`}async function fme(n="/"){const e=rne(48),t=await WAe(e),i=rne(24),s=window.electronAPI,o=s!=null&&s.getAuthRedirectUri?await s.getAuthRedirectUri():jAe(),r={state:i,codeVerifier:e,redirectUri:o,returnTo:n};localStorage.setItem(Mg,JSON.stringify(r));const a=new URL(`${A0}/oauth/authorize`);a.searchParams.set("response_type","code"),a.searchParams.set("client_id",XY),a.searchParams.set("redirect_uri",o),a.searchParams.set("scope",BAe),a.searchParams.set("code_challenge",t),a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("state",i),VAe()?window.open(a.toString()):window.location.assign(a.toString())}async function zAe(){const n=new URL(window.location.href).searchParams,e=n.get("error");if(e)throw new Error(n.get("error_description")??`OAuth error: ${e}`);const t=n.get("code"),i=n.get("state");if(!t||!i)throw new Error("Missing authorization code or state");const s=localStorage.getItem(Mg),o=s?JSON.parse(s):null;if(!o)throw new Error("Missing PKCE state");if(o.state!==i)throw localStorage.removeItem(Mg),new Error("State mismatch");const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",t),r.set("redirect_uri",o.redirectUri),r.set("client_id",XY),r.set("code_verifier",o.codeVerifier);const a=await fetch(`${A0}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!a.ok){const f=await a.json().catch(()=>null);throw localStorage.removeItem(Mg),new Error(`Token exchange failed: ${(f==null?void 0:f.error_description)||a.statusText}`)}const l=await a.json(),c={accessToken:l.access_token,tokenType:l.token_type,expiresIn:l.expires_in,expiresAt:Date.now()+l.expires_in*1e3,refreshToken:l.refresh_token,idToken:l.id_token,scope:l.scope},d=await fetch(`${A0}/oauth/userinfo`,{headers:{Authorization:`Bearer ${c.accessToken}`}}),u=d.ok?await d.json():{sub:""},h={tokens:c,user:u};return QY(h),localStorage.removeItem(Mg),{session:h,returnTo:o.returnTo||"/"}}async function $Ae(n){if(!n.tokens.refreshToken)return null;const e=new URLSearchParams;e.set("grant_type","refresh_token"),e.set("refresh_token",n.tokens.refreshToken);try{const t=await fetch(`${A0}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()});if(!t.ok)return null;const i=await t.json(),s={accessToken:i.access_token,tokenType:i.token_type,expiresIn:i.expires_in,expiresAt:Date.now()+i.expires_in*1e3,refreshToken:i.refresh_token??n.tokens.refreshToken,idToken:i.id_token??n.tokens.idToken,scope:i.scope??n.tokens.scope};let o=n.user;try{const a=await fetch(`${A0}/oauth/userinfo`,{headers:{Authorization:`Bearer ${s.accessToken}`}});a.ok&&(o=await a.json())}catch{}const r={tokens:s,user:o};return QY(r),r}catch{return null}}function UAe(){return window.location.pathname==="/auth/callback"&&!!new URLSearchParams(window.location.search).get("code")}function qAe(n,e){const t=window.electronAPI;return t!=null&&t.onAuthCallback?t.onAuthCallback(async i=>{if(i.error){e(new Error(i.errorDescription??`OAuth error: ${i.error}`));return}if(!i.code||!i.state){e(new Error("Missing authorization code or state"));return}const s=localStorage.getItem(Mg),o=s?JSON.parse(s):null;if(!o){e(new Error("Missing PKCE state"));return}if(o.state!==i.state){localStorage.removeItem(Mg),e(new Error("State mismatch"));return}try{const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",i.code),r.set("redirect_uri",o.redirectUri),r.set("client_id",XY),r.set("code_verifier",o.codeVerifier);const a=await fetch(`${A0}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!a.ok){const f=await a.json().catch(()=>null);localStorage.removeItem(Mg),e(new Error(`Token exchange failed: ${(f==null?void 0:f.error_description)||a.statusText}`));return}const l=await a.json(),c={accessToken:l.access_token,tokenType:l.token_type,expiresIn:l.expires_in,expiresAt:Date.now()+l.expires_in*1e3,refreshToken:l.refresh_token,idToken:l.id_token,scope:l.scope},d=await fetch(`${A0}/oauth/userinfo`,{headers:{Authorization:`Bearer ${c.accessToken}`}}),u=d.ok?await d.json():{sub:""},h={tokens:c,user:u};QY(h),localStorage.removeItem(Mg),n({session:h,returnTo:o.returnTo||"/"})}catch(r){e(r instanceof Error?r:new Error(String(r)))}}):null}const $y="/api",bH="aevatar:auth-required",KAe="chrono_storage_service_unavailable",GAe="chrono-storage-service",YAe="Studio could not access chrono-storage-service. It may not be enabled for this host, the service may be unavailable, or NyxID may be configured to require approval for every proxy request.";function ex(){const n=_H();return n?{Authorization:`Bearer ${n}`}:{}}function gme(n){const e=String(n||"").toLowerCase();return e.includes("application/json")||e.includes("+json")}function vH(n){const e=String(n||"").toLowerCase();return e.includes("text/html")||e.includes("application/xhtml+xml")}function tx(n){typeof window>"u"||window.dispatchEvent(new CustomEvent(bH,{detail:n}))}function pme(n){const e=new Headers(n==null?void 0:n.headers);if(!(typeof FormData<"u"&&(n==null?void 0:n.body)instanceof FormData)&&!e.has("Content-Type")&&e.set("Content-Type","application/json"),!e.has("Authorization")){const i=ex();i.Authorization&&e.set("Authorization",i.Authorization)}return e}async function mme(n){const e=n.headers.get("content-type"),t=gme(e)?await n.json().catch(()=>({})):{message:await n.text().catch(()=>"")};throw(n.status===401||t!=null&&t.loginUrl)&&tx({loginUrl:t==null?void 0:t.loginUrl,message:(t==null?void 0:t.message)||"Sign in to continue."}),{status:n.status,...t}}function ZAe(n){if(typeof window>"u")return()=>{};const e=t=>{const i=t.detail||{};n(i)};return window.addEventListener(bH,e),()=>window.removeEventListener(bH,e)}async function wt(n,e){const t=pme(e),i=await fetch(`${$y}${n}`,{...e,headers:t,credentials:"include"}),s=i.headers.get("content-type");if(!i.ok)return mme(i);if(i.status===204)return;const o=i.headers.get("content-length");if(o==="0"||!s&&o==="0")return;if(gme(s))return i.json();if(!s){const a=await i.text();if(!a.trim())return;try{return JSON.parse(a)}catch{}}i.redirected&&tx({loginUrl:i.url,message:"Sign in to continue."});const r=await i.text().catch(()=>"");throw(vH(s)||i.redirected)&&tx({loginUrl:i.redirected?i.url:null,message:"API returned HTML instead of JSON. Sign-in may be required."}),{status:i.redirected?401:i.status,message:vH(s)?"API returned HTML instead of JSON. Sign-in may be required.":"API returned an unexpected response format.",rawBody:r}}async function XAe(n,e){const t=pme(e),i=await fetch(`${$y}${n}`,{...e,headers:t,credentials:"include"}),s=i.headers.get("content-type");if(!i.ok)return mme(i);if(i.redirected||vH(s))throw tx({loginUrl:i.redirected?i.url:null,message:"API returned HTML instead of the requested file. Sign-in may be required."}),{status:i.redirected?401:i.status,message:"API returned HTML instead of the requested file. Sign-in may be required."};return i.text()}function xM(n){return!!((n==null?void 0:n.code)===KAe||(n==null?void 0:n.dependency)===GAe||typeof(n==null?void 0:n.message)=="string"&&n.message.includes("chrono-storage-service"))}function JY(n){return typeof(n==null?void 0:n.message)=="string"&&n.message.trim()?n.message.trim():YAe}async function Qg(n,e,t,i){const s=await fetch(`${$y}${n}`,{method:"POST",headers:{Accept:"text/event-stream","Content-Type":"application/json",...ex()},body:JSON.stringify(e),credentials:"include",signal:i});if(s.redirected&&tx({loginUrl:s.url,message:"Sign in to continue."}),!s.ok){const l=await s.json().catch(()=>({}));throw(s.status===401||l!=null&&l.loginUrl)&&tx({loginUrl:(l==null?void 0:l.loginUrl)||(s.redirected?s.url:null),message:(l==null?void 0:l.message)||"Sign in to continue."}),{status:s.status,...l}}if(!s.body)return;const o=s.body.getReader(),r=new TextDecoder;let a="";for(;;){const{value:l,done:c}=await o.read();a+=r.decode(l||new Uint8Array,{stream:!c});let d=a.indexOf(`
+ */const Rg=ii("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Id={};var Uue;const A0=((Uue=Id==null?void 0:Id.VITE_NYXID_BASE_URL)==null?void 0:Uue.trim())||"https://nyx.chrono-ai.fun";var que;const BAe=((que=Id==null?void 0:Id.VITE_NYXID_API_URL)==null?void 0:que.trim())||"https://nyx-api.chrono-ai.fun";var Kue;const XY=((Kue=Id==null?void 0:Id.VITE_NYXID_CLIENT_ID)==null?void 0:Kue.trim())||"37a93189-2734-406e-bca1-7dbdf25c5a53";var Gue;const WAe=((Gue=Id==null?void 0:Id.VITE_NYXID_SCOPE)==null?void 0:Gue.trim())||"openid profile email proxy",JA="aevatar-cli:nyxid:session",Mg="aevatar-cli:nyxid:pending",ume=3e4;function hme(n){let e="";for(const t of n)e+=String.fromCharCode(t);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function rne(n=32){const e=new Uint8Array(n);return crypto.getRandomValues(e),hme(e)}async function HAe(n){const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return hme(new Uint8Array(e))}function Em(){try{const n=localStorage.getItem(JA);if(!n)return null;const e=JSON.parse(n);return e.tokens.expiresAt-ume>Date.now()||e.tokens.refreshToken?e:(localStorage.removeItem(JA),null)}catch{return null}}function fme(){const n=Em();return n&&n.tokens.expiresAt-ume>Date.now()?n:null}function QY(n){localStorage.setItem(JA,JSON.stringify(n))}function VAe(){localStorage.removeItem(JA)}function _H(){var n;return(n=fme())==null?void 0:n.tokens.accessToken}function jAe(){return!!window.electronAPI}function zAe(){return`${window.location.origin}/auth/callback`}async function gme(n="/"){const e=rne(48),t=await HAe(e),i=rne(24),s=window.electronAPI,o=s!=null&&s.getAuthRedirectUri?await s.getAuthRedirectUri():zAe(),r={state:i,codeVerifier:e,redirectUri:o,returnTo:n};localStorage.setItem(Mg,JSON.stringify(r));const a=new URL(`${A0}/oauth/authorize`);a.searchParams.set("response_type","code"),a.searchParams.set("client_id",XY),a.searchParams.set("redirect_uri",o),a.searchParams.set("scope",WAe),a.searchParams.set("code_challenge",t),a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("state",i),jAe()?window.open(a.toString()):window.location.assign(a.toString())}async function $Ae(){const n=new URL(window.location.href).searchParams,e=n.get("error");if(e)throw new Error(n.get("error_description")??`OAuth error: ${e}`);const t=n.get("code"),i=n.get("state");if(!t||!i)throw new Error("Missing authorization code or state");const s=localStorage.getItem(Mg),o=s?JSON.parse(s):null;if(!o)throw new Error("Missing PKCE state");if(o.state!==i)throw localStorage.removeItem(Mg),new Error("State mismatch");const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",t),r.set("redirect_uri",o.redirectUri),r.set("client_id",XY),r.set("code_verifier",o.codeVerifier);const a=await fetch(`${A0}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!a.ok){const f=await a.json().catch(()=>null);throw localStorage.removeItem(Mg),new Error(`Token exchange failed: ${(f==null?void 0:f.error_description)||a.statusText}`)}const l=await a.json(),c={accessToken:l.access_token,tokenType:l.token_type,expiresIn:l.expires_in,expiresAt:Date.now()+l.expires_in*1e3,refreshToken:l.refresh_token,idToken:l.id_token,scope:l.scope},d=await fetch(`${A0}/oauth/userinfo`,{headers:{Authorization:`Bearer ${c.accessToken}`}}),u=d.ok?await d.json():{sub:""},h={tokens:c,user:u};return QY(h),localStorage.removeItem(Mg),{session:h,returnTo:o.returnTo||"/"}}async function UAe(n){if(!n.tokens.refreshToken)return null;const e=new URLSearchParams;e.set("grant_type","refresh_token"),e.set("refresh_token",n.tokens.refreshToken);try{const t=await fetch(`${A0}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e.toString()});if(!t.ok)return null;const i=await t.json(),s={accessToken:i.access_token,tokenType:i.token_type,expiresIn:i.expires_in,expiresAt:Date.now()+i.expires_in*1e3,refreshToken:i.refresh_token??n.tokens.refreshToken,idToken:i.id_token??n.tokens.idToken,scope:i.scope??n.tokens.scope};let o=n.user;try{const a=await fetch(`${A0}/oauth/userinfo`,{headers:{Authorization:`Bearer ${s.accessToken}`}});a.ok&&(o=await a.json())}catch{}const r={tokens:s,user:o};return QY(r),r}catch{return null}}function qAe(){return window.location.pathname==="/auth/callback"&&!!new URLSearchParams(window.location.search).get("code")}function KAe(n,e){const t=window.electronAPI;return t!=null&&t.onAuthCallback?t.onAuthCallback(async i=>{if(i.error){e(new Error(i.errorDescription??`OAuth error: ${i.error}`));return}if(!i.code||!i.state){e(new Error("Missing authorization code or state"));return}const s=localStorage.getItem(Mg),o=s?JSON.parse(s):null;if(!o){e(new Error("Missing PKCE state"));return}if(o.state!==i.state){localStorage.removeItem(Mg),e(new Error("State mismatch"));return}try{const r=new URLSearchParams;r.set("grant_type","authorization_code"),r.set("code",i.code),r.set("redirect_uri",o.redirectUri),r.set("client_id",XY),r.set("code_verifier",o.codeVerifier);const a=await fetch(`${A0}/oauth/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!a.ok){const f=await a.json().catch(()=>null);localStorage.removeItem(Mg),e(new Error(`Token exchange failed: ${(f==null?void 0:f.error_description)||a.statusText}`));return}const l=await a.json(),c={accessToken:l.access_token,tokenType:l.token_type,expiresIn:l.expires_in,expiresAt:Date.now()+l.expires_in*1e3,refreshToken:l.refresh_token,idToken:l.id_token,scope:l.scope},d=await fetch(`${A0}/oauth/userinfo`,{headers:{Authorization:`Bearer ${c.accessToken}`}}),u=d.ok?await d.json():{sub:""},h={tokens:c,user:u};QY(h),localStorage.removeItem(Mg),n({session:h,returnTo:o.returnTo||"/"})}catch(r){e(r instanceof Error?r:new Error(String(r)))}}):null}const $y="/api",bH="aevatar:auth-required",GAe="chrono_storage_service_unavailable",YAe="chrono-storage-service",ZAe="Studio could not access chrono-storage-service. It may not be enabled for this host, the service may be unavailable, or NyxID may be configured to require approval for every proxy request.";function ex(){const n=_H();return n?{Authorization:`Bearer ${n}`}:{}}function pme(n){const e=String(n||"").toLowerCase();return e.includes("application/json")||e.includes("+json")}function vH(n){const e=String(n||"").toLowerCase();return e.includes("text/html")||e.includes("application/xhtml+xml")}function tx(n){typeof window>"u"||window.dispatchEvent(new CustomEvent(bH,{detail:n}))}function mme(n){const e=new Headers(n==null?void 0:n.headers);if(!(typeof FormData<"u"&&(n==null?void 0:n.body)instanceof FormData)&&!e.has("Content-Type")&&e.set("Content-Type","application/json"),!e.has("Authorization")){const i=ex();i.Authorization&&e.set("Authorization",i.Authorization)}return e}async function _me(n){const e=n.headers.get("content-type"),t=pme(e)?await n.json().catch(()=>({})):{message:await n.text().catch(()=>"")};throw(n.status===401||t!=null&&t.loginUrl)&&tx({loginUrl:t==null?void 0:t.loginUrl,message:(t==null?void 0:t.message)||"Sign in to continue."}),{status:n.status,...t}}function XAe(n){if(typeof window>"u")return()=>{};const e=t=>{const i=t.detail||{};n(i)};return window.addEventListener(bH,e),()=>window.removeEventListener(bH,e)}async function wt(n,e){const t=mme(e),i=await fetch(`${$y}${n}`,{...e,headers:t,credentials:"include"}),s=i.headers.get("content-type");if(!i.ok)return _me(i);if(i.status===204)return;const o=i.headers.get("content-length");if(o==="0"||!s&&o==="0")return;if(pme(s))return i.json();if(!s){const a=await i.text();if(!a.trim())return;try{return JSON.parse(a)}catch{}}i.redirected&&tx({loginUrl:i.url,message:"Sign in to continue."});const r=await i.text().catch(()=>"");throw(vH(s)||i.redirected)&&tx({loginUrl:i.redirected?i.url:null,message:"API returned HTML instead of JSON. Sign-in may be required."}),{status:i.redirected?401:i.status,message:vH(s)?"API returned HTML instead of JSON. Sign-in may be required.":"API returned an unexpected response format.",rawBody:r}}async function QAe(n,e){const t=mme(e),i=await fetch(`${$y}${n}`,{...e,headers:t,credentials:"include"}),s=i.headers.get("content-type");if(!i.ok)return _me(i);if(i.redirected||vH(s))throw tx({loginUrl:i.redirected?i.url:null,message:"API returned HTML instead of the requested file. Sign-in may be required."}),{status:i.redirected?401:i.status,message:"API returned HTML instead of the requested file. Sign-in may be required."};return i.text()}function xM(n){return!!((n==null?void 0:n.code)===GAe||(n==null?void 0:n.dependency)===YAe||typeof(n==null?void 0:n.message)=="string"&&n.message.includes("chrono-storage-service"))}function JY(n){return typeof(n==null?void 0:n.message)=="string"&&n.message.trim()?n.message.trim():ZAe}async function Qg(n,e,t,i){const s=await fetch(`${$y}${n}`,{method:"POST",headers:{Accept:"text/event-stream","Content-Type":"application/json",...ex()},body:JSON.stringify(e),credentials:"include",signal:i});if(s.redirected&&tx({loginUrl:s.url,message:"Sign in to continue."}),!s.ok){const l=await s.json().catch(()=>({}));throw(s.status===401||l!=null&&l.loginUrl)&&tx({loginUrl:(l==null?void 0:l.loginUrl)||(s.redirected?s.url:null),message:(l==null?void 0:l.message)||"Sign in to continue."}),{status:s.status,...l}}if(!s.body)return;const o=s.body.getReader(),r=new TextDecoder;let a="";for(;;){const{value:l,done:c}=await o.read();a+=r.decode(l||new Uint8Array,{stream:!c});let d=a.indexOf(`
`);for(;d>=0;){const u=a.slice(0,d);a=a.slice(d+2);const h=u.split(`
`).filter(f=>f.startsWith("data:")).map(f=>f.slice(5).trim()).join(`
`);h&&h!=="[DONE]"&&t(JSON.parse(h)),d=a.indexOf(`
-`)}if(c)break}}function ane(n){return!n||typeof n!="object"?null:n.type?n:n.textMessageContent?{type:"TEXT_MESSAGE_CONTENT",delta:n.textMessageContent.delta||""}:n.textMessageReasoning?{type:"TEXT_MESSAGE_REASONING",delta:n.textMessageReasoning.delta||""}:n.textMessageEnd?{type:"TEXT_MESSAGE_END",message:n.textMessageEnd.message||"",delta:n.textMessageEnd.delta||""}:n.runError?{type:"RUN_ERROR",message:n.runError.message||"Assistant run failed."}:n}const xb={parseYaml:(n,e)=>wt("/editor/parse-yaml",{method:"POST",body:JSON.stringify({yaml:n,availableWorkflowNames:e})}),serializeYaml:(n,e)=>wt("/editor/serialize-yaml",{method:"POST",body:JSON.stringify({document:n,availableWorkflowNames:e})}),validate:(n,e)=>wt("/editor/validate",{method:"POST",body:JSON.stringify({document:n,availableWorkflowNames:e})}),normalize:(n,e)=>wt("/editor/normalize",{method:"POST",body:JSON.stringify({document:n,availableWorkflowNames:e})}),diff:(n,e)=>wt("/editor/diff",{method:"POST",body:JSON.stringify({before:n,after:e})})},CC={getSettings:()=>wt("/workspace"),updateSettings:n=>wt("/workspace/settings",{method:"PUT",body:JSON.stringify(n)}),addDirectory:n=>wt("/workspace/directories",{method:"POST",body:JSON.stringify(n)}),removeDirectory:n=>wt(`/workspace/directories/${n}`,{method:"DELETE"}),listWorkflows:()=>wt("/workspace/workflows"),getWorkflow:n=>wt(`/workspace/workflows/${n}`),saveWorkflow:n=>wt("/workspace/workflows",{method:"POST",body:JSON.stringify(n)})},Hv={getCatalog:()=>wt("/connectors"),saveCatalog:n=>wt("/connectors",{method:"PUT",body:JSON.stringify(n)}),importCatalog:n=>{const e=new FormData;return e.set("file",n,n.name),wt("/connectors/import",{method:"POST",body:e})},getDraft:()=>wt("/connectors/draft"),saveDraft:n=>wt("/connectors/draft",{method:"PUT",body:JSON.stringify(n)}),deleteDraft:()=>wt("/connectors/draft",{method:"DELETE"})},Vv={getCatalog:()=>wt("/roles"),saveCatalog:n=>wt("/roles",{method:"PUT",body:JSON.stringify(n)}),importCatalog:n=>{const e=new FormData;return e.set("file",n,n.name),wt("/roles/import",{method:"POST",body:e})},getDraft:()=>wt("/roles/draft"),saveDraft:n=>wt("/roles/draft",{method:"PUT",body:JSON.stringify(n)}),deleteDraft:()=>wt("/roles/draft",{method:"DELETE"})},S2={get:()=>wt("/settings"),save:n=>wt("/settings",{method:"PUT",body:JSON.stringify(n)}),testRuntime:n=>wt("/settings/runtime/test",{method:"POST",body:JSON.stringify(n)})},Jg={get:()=>wt("/user-config"),save:n=>wt("/user-config",{method:"PUT",body:JSON.stringify(n)}),models:()=>wt("/user-config/models")},EL={list:()=>wt("/executions"),get:n=>wt(`/executions/${n}`),start:n=>wt("/executions",{method:"POST",body:JSON.stringify(n)}),resume:(n,e)=>wt(`/executions/${n}/resume`,{method:"POST",body:JSON.stringify(e)}),stop:(n,e)=>wt(`/executions/${n}/stop`,{method:"POST",body:JSON.stringify(e)})},_me={authorWorkflow:async(n,e)=>{let t="",i="";return await Qg("/app/workflow-generator",n,s=>{var r,a,l;const o=ane(s);if(o){if(o.type==="TEXT_MESSAGE_CONTENT"){t+=o.delta||"",(r=e==null?void 0:e.onText)==null||r.call(e,t);return}if(o.type==="TEXT_MESSAGE_REASONING"){i+=o.delta||"",(a=e==null?void 0:e.onReasoning)==null||a.call(e,i);return}if(o.type==="TEXT_MESSAGE_END"){t=t||o.message||o.delta||"",(l=e==null?void 0:e.onText)==null||l.call(e,t);return}if(o.type==="RUN_ERROR")throw new Error(o.message||"Assistant run failed.")}},e==null?void 0:e.signal),t},authorScript:async(n,e)=>{let t="",i="",s=null,o="";return await Qg("/app/scripts/generator",n,r=>{var l,c,d;const a=ane(r);if(a){if(a.type==="TEXT_MESSAGE_CONTENT"){t+=a.delta||"",(l=e==null?void 0:e.onText)==null||l.call(e,t);return}if(a.type==="TEXT_MESSAGE_REASONING"){i+=a.delta||"",(c=e==null?void 0:e.onReasoning)==null||c.call(e,i);return}if(a.type==="TEXT_MESSAGE_END"){t=t||a.message||a.delta||"",s=a.scriptPackage||null,o=a.currentFilePath||"",(d=e==null?void 0:e.onText)==null||d.call(e,t);return}if(a.type==="RUN_ERROR")throw new Error(a.message||"Assistant run failed.")}},e==null?void 0:e.signal),{text:t,scriptPackage:s,currentFilePath:o}}},QAe={getSession:()=>wt("/auth/me")},Ya={getBinding:n=>wt(`/scopes/${Ni(n)}/binding`),bindWorkflow:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/binding`,{method:"PUT",body:JSON.stringify({implementationKind:"workflow",...t?{displayName:t}:{},...i?{serviceId:i}:{},workflowYamls:e})}),bindGAgent:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/binding`,{method:"PUT",body:JSON.stringify({implementationKind:"gagent",...t?{displayName:t}:{},...i?{serviceId:i}:{},gagent:{actorTypeName:e,endpoints:[{endpointId:"chat",displayName:"Chat",kind:"chat",requestTypeUrl:"",responseTypeUrl:"",description:""}]}})}),bindScript:(n,e,t,i,s)=>wt(`/scopes/${Ni(n)}/binding`,{method:"PUT",body:JSON.stringify({implementationKind:"script",...t?{displayName:t}:{},...i?{serviceId:i}:{},script:{scriptId:e,...s?{scriptRevision:s}:{}}})}),streamDraftRun:(n,e,t,i,s)=>{const o={prompt:e};return t!=null&&t.length&&(o.workflowYamls=t),Qg(`/scopes/${Ni(n)}/workflow/draft-run`,o,i??(()=>{}),s)},streamDefaultChat:(n,e,t,i,s,o,r)=>{const a={prompt:e};return t&&(a.actorId=t),i&&(a.sessionId=i),r&&Object.keys(r).length>0&&(a.headers=r),Qg(`/scopes/${Ni(n)}/invoke/chat:stream`,a,s??(()=>{}),o)},streamInvoke:(n,e,t,i,s,o="chat",r,a,l)=>{const c={prompt:t};return r&&Object.keys(r).length>0&&(c.headers=r),a&&(c.actorId=a),l&&l.length>0&&(c.inputParts=l),Qg(`/scopes/${Ni(n)}/services/${Ni(e)}/invoke/${Ni(o)}:stream`,c,i??(()=>{}),s)},listServices:(n,e=20)=>wt(`/services?tenantId=${Ni(n)}&appId=default&namespace=default&take=${e}`),resumeRun:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/services/${Ni(e)}/runs/${Ni(t)}:resume`,{method:"POST",body:JSON.stringify(i)}),getActorSnapshot:n=>wt(`/actors/${Ni(n)}`),getActorTimeline:(n,e=50)=>wt(`/actors/${Ni(n)}/timeline?take=${e}`)},JAe={createConversation:n=>wt(`/scopes/${Ni(n)}/nyxid-chat/conversations`,{method:"POST"}),listConversations:n=>wt(`/scopes/${Ni(n)}/nyxid-chat/conversations`),streamMessage:(n,e,t,i,s)=>Qg(`/scopes/${Ni(n)}/nyxid-chat/conversations/${Ni(e)}:stream`,{prompt:t},i??(()=>{}),s),deleteConversation:(n,e)=>wt(`/scopes/${Ni(n)}/nyxid-chat/conversations/${Ni(e)}`,{method:"DELETE"}),approveToolCall:(n,e,t,i,s,o,r,a)=>Qg(`/scopes/${Ni(n)}/nyxid-chat/conversations/${Ni(e)}:approve`,{requestId:t,approved:i,reason:a??"",sessionId:r??""},s??(()=>{}),o)},IL={createRoom:(n,e)=>wt(`/scopes/${Ni(n)}/streaming-proxy/rooms`,{method:"POST",body:JSON.stringify(e?{roomName:e}:{})}),streamChat:(n,e,t,i,s,o,r,a)=>{const l={prompt:t};return o&&(l.sessionId=o),r!==void 0&&(l.llmRoute=r),a!==void 0&&(l.llmModel=a),Qg(`/scopes/${Ni(n)}/streaming-proxy/rooms/${Ni(e)}:chat`,l,i??(()=>{}),s)},deleteRoom:(n,e)=>wt(`/scopes/${Ni(n)}/streaming-proxy/rooms/${Ni(e)}`,{method:"DELETE"})},Uw={getIndex:n=>wt(`/scopes/${Ni(n)}/chat-history`),getConversation:(n,e)=>wt(`/scopes/${Ni(n)}/chat-history/conversations/${Ni(e)}`),saveConversation:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/chat-history/conversations/${Ni(e)}`,{method:"PUT",body:JSON.stringify({meta:t,messages:i})}),deleteConversation:(n,e)=>wt(`/scopes/${Ni(n)}/chat-history/conversations/${Ni(e)}`,{method:"DELETE"})},DL={listTypes:()=>wt("/scopes/gagent-types"),listActors:n=>wt(`/scopes/${Ni(n)}/gagent-actors`),addActor:(n,e,t)=>wt(`/scopes/${Ni(n)}/gagent-actors`,{method:"POST",body:JSON.stringify({gagentType:e,actorId:t})}),removeActor:(n,e,t)=>wt(`/scopes/${Ni(n)}/gagent-actors/${Ni(t)}?gagentType=${Ni(e)}`,{method:"DELETE"}),streamDraftRun:(n,e,t,i,s,o)=>Qg(`/scopes/${Ni(n)}/gagent/draft-run`,{actorTypeName:e,prompt:t,preferredActorId:i||null},s??(()=>{}),o)};function Ni(n){return encodeURIComponent(n.trim())}const lne={searchSkills:async(n,e="",t="mixed",i=1,s=50)=>{const o=`${n.replace(/\/+$/,"")}/api/web/skill-search?query=${encodeURIComponent(e)}&mode=keyword&scope=${encodeURIComponent(t)}&page=${i}&pageSize=${s}`,r=await fetch(o,{headers:{...ex()}});if(!r.ok)throw{status:r.status,message:`Ornn search failed: ${r.statusText}`};const a=await r.json();return(a==null?void 0:a.data)||{total:0,totalPages:0,page:1,pageSize:s,items:[]}},checkHealth:async n=>{try{const e=`${n.replace(/\/+$/,"")}/api/web/skill-search?query=&scope=public&page=1&pageSize=1`;return(await fetch(e,{headers:{...ex()},signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}},qw=n=>n.split("/").map(e=>encodeURIComponent(e)).join("/"),ov={getManifest:()=>wt("/explorer/manifest"),getFile:n=>XAe(`/explorer/files/${qw(n)}`),getFileUrl:n=>`${$y}/explorer/files/${qw(n)}`,getFileBlob:async n=>{const e=await fetch(`${$y}/explorer/files/${qw(n)}`,{headers:ex(),credentials:"include"});if(!e.ok)throw new Error(`Failed to fetch file: ${e.status}`);return e.blob()},putFile:(n,e)=>wt(`/explorer/files/${qw(n)}`,{method:"PUT",headers:{"Content-Type":"text/plain"},body:e}),uploadFile:async(n,e)=>{const t=new FormData;t.append("file",e);const i=await fetch(`${$y}/explorer/upload/${qw(n)}`,{method:"POST",headers:ex(),body:t,credentials:"include"});if(!i.ok)throw new Error(`Upload failed: ${i.status}`);return i.json()},deleteFile:n=>wt(`/explorer/files/${qw(n)}`,{method:"DELETE"})},wa={getContext:()=>wt("/app/context"),validateDraftScript:(n,e)=>wt("/app/scripts/validate",{method:"POST",body:JSON.stringify(n),signal:e}),listScripts:(n=!1)=>wt(`/app/scripts?includeSource=${n?"true":"false"}`),getScript:n=>wt(`/app/scripts/${encodeURIComponent(n)}`),getScriptCatalog:n=>wt(`/app/scripts/${encodeURIComponent(n)}/catalog`),listScriptRuntimes:(n=24)=>wt(`/app/scripts/runtimes?take=${n}`),getEvolutionDecision:n=>wt(`/app/scripts/evolutions/${encodeURIComponent(n)}`),getRuntimeReadModel:n=>wt(`/app/scripts/runtimes/${encodeURIComponent(n)}/readmodel`),saveScript:n=>wt("/app/scripts",{method:"POST",body:JSON.stringify(n)}),observeScriptSave:(n,e)=>wt(`/app/scripts/${encodeURIComponent(n)}/save-observation`,{method:"POST",body:JSON.stringify(e)}),runDraftScript:(n,e)=>wt(`/scopes/${Ni(n)}/scripts/draft-run`,{method:"POST",body:JSON.stringify(e)})},ePe={getReadModel:n=>wt(`/app/scripts/runtimes/${encodeURIComponent(n)}/readmodel`),proposeEvolution:n=>wt("/app/scripts/evolutions/proposals",{method:"POST",body:JSON.stringify(n)})};function cne(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t=n.length?n.apply(this,s):function(){for(var r=arguments.length,a=new Array(r),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};x2.initial(n),x2.handler(e);var t={current:n},i=vk(xPe)(t,e),s=vk(SPe)(t),o=vk(x2.changes)(n),r=vk(yPe)(t);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return x2.selector(c),c(t.current)}function l(c){hPe(i,s,o,r)(c)}return[a,l]}function yPe(n,e){return UE(e)?e(n.current):e}function SPe(n,e){return n.current=fne(fne({},n.current),e),e}function xPe(n,e,t){return UE(e)?e(n.current):Object.keys(t).forEach(function(i){var s;return(s=e[i])===null||s===void 0?void 0:s.call(e,n.current[i])}),t}var LPe={create:CPe},kPe={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function NPe(n){return function e(){for(var t=this,i=arguments.length,s=new Array(i),o=0;o=n.length?n.apply(this,s):function(){for(var r=arguments.length,a=new Array(r),l=0;lwt("/editor/parse-yaml",{method:"POST",body:JSON.stringify({yaml:n,availableWorkflowNames:e})}),serializeYaml:(n,e)=>wt("/editor/serialize-yaml",{method:"POST",body:JSON.stringify({document:n,availableWorkflowNames:e})}),validate:(n,e)=>wt("/editor/validate",{method:"POST",body:JSON.stringify({document:n,availableWorkflowNames:e})}),normalize:(n,e)=>wt("/editor/normalize",{method:"POST",body:JSON.stringify({document:n,availableWorkflowNames:e})}),diff:(n,e)=>wt("/editor/diff",{method:"POST",body:JSON.stringify({before:n,after:e})})},CC={getSettings:()=>wt("/workspace"),updateSettings:n=>wt("/workspace/settings",{method:"PUT",body:JSON.stringify(n)}),addDirectory:n=>wt("/workspace/directories",{method:"POST",body:JSON.stringify(n)}),removeDirectory:n=>wt(`/workspace/directories/${n}`,{method:"DELETE"}),listWorkflows:()=>wt("/workspace/workflows"),getWorkflow:n=>wt(`/workspace/workflows/${n}`),saveWorkflow:n=>wt("/workspace/workflows",{method:"POST",body:JSON.stringify(n)})},Hv={getCatalog:()=>wt("/connectors"),saveCatalog:n=>wt("/connectors",{method:"PUT",body:JSON.stringify(n)}),importCatalog:n=>{const e=new FormData;return e.set("file",n,n.name),wt("/connectors/import",{method:"POST",body:e})},getDraft:()=>wt("/connectors/draft"),saveDraft:n=>wt("/connectors/draft",{method:"PUT",body:JSON.stringify(n)}),deleteDraft:()=>wt("/connectors/draft",{method:"DELETE"})},Vv={getCatalog:()=>wt("/roles"),saveCatalog:n=>wt("/roles",{method:"PUT",body:JSON.stringify(n)}),importCatalog:n=>{const e=new FormData;return e.set("file",n,n.name),wt("/roles/import",{method:"POST",body:e})},getDraft:()=>wt("/roles/draft"),saveDraft:n=>wt("/roles/draft",{method:"PUT",body:JSON.stringify(n)}),deleteDraft:()=>wt("/roles/draft",{method:"DELETE"})},S2={get:()=>wt("/settings"),save:n=>wt("/settings",{method:"PUT",body:JSON.stringify(n)}),testRuntime:n=>wt("/settings/runtime/test",{method:"POST",body:JSON.stringify(n)})},Jg={get:()=>wt("/user-config"),save:n=>wt("/user-config",{method:"PUT",body:JSON.stringify(n)}),models:()=>wt("/user-config/models")},EL={list:()=>wt("/executions"),get:n=>wt(`/executions/${n}`),start:n=>wt("/executions",{method:"POST",body:JSON.stringify(n)}),resume:(n,e)=>wt(`/executions/${n}/resume`,{method:"POST",body:JSON.stringify(e)}),stop:(n,e)=>wt(`/executions/${n}/stop`,{method:"POST",body:JSON.stringify(e)})},bme={authorWorkflow:async(n,e)=>{let t="",i="";return await Qg("/app/workflow-generator",n,s=>{var r,a,l;const o=ane(s);if(o){if(o.type==="TEXT_MESSAGE_CONTENT"){t+=o.delta||"",(r=e==null?void 0:e.onText)==null||r.call(e,t);return}if(o.type==="TEXT_MESSAGE_REASONING"){i+=o.delta||"",(a=e==null?void 0:e.onReasoning)==null||a.call(e,i);return}if(o.type==="TEXT_MESSAGE_END"){t=t||o.message||o.delta||"",(l=e==null?void 0:e.onText)==null||l.call(e,t);return}if(o.type==="RUN_ERROR")throw new Error(o.message||"Assistant run failed.")}},e==null?void 0:e.signal),t},authorScript:async(n,e)=>{let t="",i="",s=null,o="";return await Qg("/app/scripts/generator",n,r=>{var l,c,d;const a=ane(r);if(a){if(a.type==="TEXT_MESSAGE_CONTENT"){t+=a.delta||"",(l=e==null?void 0:e.onText)==null||l.call(e,t);return}if(a.type==="TEXT_MESSAGE_REASONING"){i+=a.delta||"",(c=e==null?void 0:e.onReasoning)==null||c.call(e,i);return}if(a.type==="TEXT_MESSAGE_END"){t=t||a.message||a.delta||"",s=a.scriptPackage||null,o=a.currentFilePath||"",(d=e==null?void 0:e.onText)==null||d.call(e,t);return}if(a.type==="RUN_ERROR")throw new Error(a.message||"Assistant run failed.")}},e==null?void 0:e.signal),{text:t,scriptPackage:s,currentFilePath:o}}},JAe={getSession:()=>wt("/auth/me")},Ya={getBinding:n=>wt(`/scopes/${Ni(n)}/binding`),bindWorkflow:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/binding`,{method:"PUT",body:JSON.stringify({implementationKind:"workflow",...t?{displayName:t}:{},...i?{serviceId:i}:{},workflowYamls:e})}),bindGAgent:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/binding`,{method:"PUT",body:JSON.stringify({implementationKind:"gagent",...t?{displayName:t}:{},...i?{serviceId:i}:{},gagent:{actorTypeName:e,endpoints:[{endpointId:"chat",displayName:"Chat",kind:"chat",requestTypeUrl:"",responseTypeUrl:"",description:""}]}})}),bindScript:(n,e,t,i,s)=>wt(`/scopes/${Ni(n)}/binding`,{method:"PUT",body:JSON.stringify({implementationKind:"script",...t?{displayName:t}:{},...i?{serviceId:i}:{},script:{scriptId:e,...s?{scriptRevision:s}:{}}})}),streamDraftRun:(n,e,t,i,s)=>{const o={prompt:e};return t!=null&&t.length&&(o.workflowYamls=t),Qg(`/scopes/${Ni(n)}/workflow/draft-run`,o,i??(()=>{}),s)},streamDefaultChat:(n,e,t,i,s,o,r)=>{const a={prompt:e};return t&&(a.actorId=t),i&&(a.sessionId=i),r&&Object.keys(r).length>0&&(a.headers=r),Qg(`/scopes/${Ni(n)}/invoke/chat:stream`,a,s??(()=>{}),o)},streamInvoke:(n,e,t,i,s,o="chat",r,a,l)=>{const c={prompt:t};return r&&Object.keys(r).length>0&&(c.headers=r),a&&(c.actorId=a),l&&l.length>0&&(c.inputParts=l),Qg(`/scopes/${Ni(n)}/services/${Ni(e)}/invoke/${Ni(o)}:stream`,c,i??(()=>{}),s)},listServices:(n,e=20)=>wt(`/services?tenantId=${Ni(n)}&appId=default&namespace=default&take=${e}`),resumeRun:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/services/${Ni(e)}/runs/${Ni(t)}:resume`,{method:"POST",body:JSON.stringify(i)}),getActorSnapshot:n=>wt(`/actors/${Ni(n)}`),getActorTimeline:(n,e=50)=>wt(`/actors/${Ni(n)}/timeline?take=${e}`)},ePe={createConversation:n=>wt(`/scopes/${Ni(n)}/nyxid-chat/conversations`,{method:"POST"}),listConversations:n=>wt(`/scopes/${Ni(n)}/nyxid-chat/conversations`),streamMessage:(n,e,t,i,s)=>Qg(`/scopes/${Ni(n)}/nyxid-chat/conversations/${Ni(e)}:stream`,{prompt:t},i??(()=>{}),s),deleteConversation:(n,e)=>wt(`/scopes/${Ni(n)}/nyxid-chat/conversations/${Ni(e)}`,{method:"DELETE"}),approveToolCall:(n,e,t,i,s,o,r,a)=>Qg(`/scopes/${Ni(n)}/nyxid-chat/conversations/${Ni(e)}:approve`,{requestId:t,approved:i,reason:a??"",sessionId:r??""},s??(()=>{}),o)},IL={createRoom:(n,e)=>wt(`/scopes/${Ni(n)}/streaming-proxy/rooms`,{method:"POST",body:JSON.stringify(e?{roomName:e}:{})}),streamChat:(n,e,t,i,s,o,r,a)=>{const l={prompt:t};return o&&(l.sessionId=o),r!==void 0&&(l.llmRoute=r),a!==void 0&&(l.llmModel=a),Qg(`/scopes/${Ni(n)}/streaming-proxy/rooms/${Ni(e)}:chat`,l,i??(()=>{}),s)},deleteRoom:(n,e)=>wt(`/scopes/${Ni(n)}/streaming-proxy/rooms/${Ni(e)}`,{method:"DELETE"})},Uw={getIndex:n=>wt(`/scopes/${Ni(n)}/chat-history`),getConversation:(n,e)=>wt(`/scopes/${Ni(n)}/chat-history/conversations/${Ni(e)}`),saveConversation:(n,e,t,i)=>wt(`/scopes/${Ni(n)}/chat-history/conversations/${Ni(e)}`,{method:"PUT",body:JSON.stringify({meta:t,messages:i})}),deleteConversation:(n,e)=>wt(`/scopes/${Ni(n)}/chat-history/conversations/${Ni(e)}`,{method:"DELETE"})},DL={listTypes:()=>wt("/scopes/gagent-types"),listActors:n=>wt(`/scopes/${Ni(n)}/gagent-actors`),addActor:(n,e,t)=>wt(`/scopes/${Ni(n)}/gagent-actors`,{method:"POST",body:JSON.stringify({gagentType:e,actorId:t})}),removeActor:(n,e,t)=>wt(`/scopes/${Ni(n)}/gagent-actors/${Ni(t)}?gagentType=${Ni(e)}`,{method:"DELETE"}),streamDraftRun:(n,e,t,i,s,o)=>Qg(`/scopes/${Ni(n)}/gagent/draft-run`,{actorTypeName:e,prompt:t,preferredActorId:i||null},s??(()=>{}),o)};function Ni(n){return encodeURIComponent(n.trim())}const lne={searchSkills:async(n,e="",t="mixed",i=1,s=50)=>{const o=`${n.replace(/\/+$/,"")}/api/web/skill-search?query=${encodeURIComponent(e)}&mode=keyword&scope=${encodeURIComponent(t)}&page=${i}&pageSize=${s}`,r=await fetch(o,{headers:{...ex()}});if(!r.ok)throw{status:r.status,message:`Ornn search failed: ${r.statusText}`};const a=await r.json();return(a==null?void 0:a.data)||{total:0,totalPages:0,page:1,pageSize:s,items:[]}},checkHealth:async n=>{try{const e=`${n.replace(/\/+$/,"")}/api/web/skill-search?query=&scope=public&page=1&pageSize=1`;return(await fetch(e,{headers:{...ex()},signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}},qw=n=>n.split("/").map(e=>encodeURIComponent(e)).join("/"),ov={getManifest:()=>wt("/explorer/manifest"),getFile:n=>QAe(`/explorer/files/${qw(n)}`),getFileUrl:n=>`${$y}/explorer/files/${qw(n)}`,getFileBlob:async n=>{const e=await fetch(`${$y}/explorer/files/${qw(n)}`,{headers:ex(),credentials:"include"});if(!e.ok)throw new Error(`Failed to fetch file: ${e.status}`);return e.blob()},putFile:(n,e)=>wt(`/explorer/files/${qw(n)}`,{method:"PUT",headers:{"Content-Type":"text/plain"},body:e}),uploadFile:async(n,e)=>{const t=new FormData;t.append("file",e);const i=await fetch(`${$y}/explorer/upload/${qw(n)}`,{method:"POST",headers:ex(),body:t,credentials:"include"});if(!i.ok)throw new Error(`Upload failed: ${i.status}`);return i.json()},deleteFile:n=>wt(`/explorer/files/${qw(n)}`,{method:"DELETE"})},wa={getContext:()=>wt("/app/context"),validateDraftScript:(n,e)=>wt("/app/scripts/validate",{method:"POST",body:JSON.stringify(n),signal:e}),listScripts:(n=!1)=>wt(`/app/scripts?includeSource=${n?"true":"false"}`),getScript:n=>wt(`/app/scripts/${encodeURIComponent(n)}`),getScriptCatalog:n=>wt(`/app/scripts/${encodeURIComponent(n)}/catalog`),listScriptRuntimes:(n=24)=>wt(`/app/scripts/runtimes?take=${n}`),getEvolutionDecision:n=>wt(`/app/scripts/evolutions/${encodeURIComponent(n)}`),getRuntimeReadModel:n=>wt(`/app/scripts/runtimes/${encodeURIComponent(n)}/readmodel`),saveScript:n=>wt("/app/scripts",{method:"POST",body:JSON.stringify(n)}),observeScriptSave:(n,e)=>wt(`/app/scripts/${encodeURIComponent(n)}/save-observation`,{method:"POST",body:JSON.stringify(e)}),runDraftScript:(n,e)=>wt(`/scopes/${Ni(n)}/scripts/draft-run`,{method:"POST",body:JSON.stringify(e)})},tPe={getReadModel:n=>wt(`/app/scripts/runtimes/${encodeURIComponent(n)}/readmodel`),proposeEvolution:n=>wt("/app/scripts/evolutions/proposals",{method:"POST",body:JSON.stringify(n)})};function cne(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t=n.length?n.apply(this,s):function(){for(var r=arguments.length,a=new Array(r),l=0;l1&&arguments[1]!==void 0?arguments[1]:{};x2.initial(n),x2.handler(e);var t={current:n},i=vk(LPe)(t,e),s=vk(xPe)(t),o=vk(x2.changes)(n),r=vk(SPe)(t);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return x2.selector(c),c(t.current)}function l(c){fPe(i,s,o,r)(c)}return[a,l]}function SPe(n,e){return UE(e)?e(n.current):e}function xPe(n,e){return n.current=fne(fne({},n.current),e),e}function LPe(n,e,t){return UE(e)?e(n.current):Object.keys(t).forEach(function(i){var s;return(s=e[i])===null||s===void 0?void 0:s.call(e,n.current[i])}),t}var kPe={create:yPe},NPe={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function EPe(n){return function e(){for(var t=this,i=arguments.length,s=new Array(i),o=0;o=n.length?n.apply(this,s):function(){for(var r=arguments.length,a=new Array(r),l=0;l{i.current=!1}:n,e)}var Cc=JPe;function tN(){}function GC(n,e,t,i){return eOe(n,i)||tOe(n,e,t,i)}function eOe(n,e){return n.editor.getModel(xme(n,e))}function tOe(n,e,t,i){return n.editor.createModel(e,t,i?xme(n,i):void 0)}function xme(n,e){return n.Uri.parse(e)}function iOe({original:n,modified:e,language:t,originalLanguage:i,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:r,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:h="100%",width:f="100%",className:g,wrapperProps:p={},beforeMount:m=tN,onMount:b=tN}){let[v,C]=R.useState(!1),[y,S]=R.useState(!0),x=R.useRef(null),L=R.useRef(null),k=R.useRef(null),N=R.useRef(b),T=R.useRef(m),M=R.useRef(!1);Sme(()=>{let A=eZ.init();return A.then(z=>(L.current=z)&&S(!1)).catch(z=>(z==null?void 0:z.type)!=="cancelation"&&console.error("Monaco initialization: error:",z)),()=>x.current?O():A.cancel()}),Cc(()=>{if(x.current&&L.current){let A=x.current.getOriginalEditor(),z=GC(L.current,n||"",i||t||"text",o||"");z!==A.getModel()&&A.setModel(z)}},[o],v),Cc(()=>{if(x.current&&L.current){let A=x.current.getModifiedEditor(),z=GC(L.current,e||"",s||t||"text",r||"");z!==A.getModel()&&A.setModel(z)}},[r],v),Cc(()=>{let A=x.current.getModifiedEditor();A.getOption(L.current.editor.EditorOption.readOnly)?A.setValue(e||""):e!==A.getValue()&&(A.executeEdits("",[{range:A.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),A.pushUndoStop())},[e],v),Cc(()=>{var A,z;(z=(A=x.current)==null?void 0:A.getModel())==null||z.original.setValue(n||"")},[n],v),Cc(()=>{let{original:A,modified:z}=x.current.getModel();L.current.editor.setModelLanguage(A,i||t||"text"),L.current.editor.setModelLanguage(z,s||t||"text")},[t,i,s],v),Cc(()=>{var A;(A=L.current)==null||A.editor.setTheme(c)},[c],v),Cc(()=>{var A;(A=x.current)==null||A.updateOptions(u)},[u],v);let P=R.useCallback(()=>{var U;if(!L.current)return;T.current(L.current);let A=GC(L.current,n||"",i||t||"text",o||""),z=GC(L.current,e||"",s||t||"text",r||"");(U=x.current)==null||U.setModel({original:A,modified:z})},[t,e,s,n,i,o,r]),V=R.useCallback(()=>{var A;!M.current&&k.current&&(x.current=L.current.editor.createDiffEditor(k.current,{automaticLayout:!0,...u}),P(),(A=L.current)==null||A.editor.setTheme(c),C(!0),M.current=!0)},[u,c,P]);R.useEffect(()=>{v&&N.current(x.current,L.current)},[v]),R.useEffect(()=>{!y&&!v&&V()},[y,v,V]);function O(){var z,U,W,F;let A=(z=x.current)==null?void 0:z.getModel();a||((U=A==null?void 0:A.original)==null||U.dispose()),l||((W=A==null?void 0:A.modified)==null||W.dispose()),(F=x.current)==null||F.dispose()}return s_.createElement(yme,{width:f,height:h,isEditorReady:v,loading:d,_ref:k,className:g,wrapperProps:p})}var nOe=iOe;R.memo(nOe);function sOe(n){let e=R.useRef();return R.useEffect(()=>{e.current=n},[n]),e.current}var oOe=sOe,L2=new Map;function rOe({defaultValue:n,defaultLanguage:e,defaultPath:t,value:i,language:s,path:o,theme:r="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:h=!1,width:f="100%",height:g="100%",className:p,wrapperProps:m={},beforeMount:b=tN,onMount:v=tN,onChange:C,onValidate:y=tN}){let[S,x]=R.useState(!1),[L,k]=R.useState(!0),N=R.useRef(null),T=R.useRef(null),M=R.useRef(null),P=R.useRef(v),V=R.useRef(b),O=R.useRef(),A=R.useRef(i),z=oOe(o),U=R.useRef(!1),W=R.useRef(!1);Sme(()=>{let X=eZ.init();return X.then(Q=>(N.current=Q)&&k(!1)).catch(Q=>(Q==null?void 0:Q.type)!=="cancelation"&&console.error("Monaco initialization: error:",Q)),()=>T.current?q():X.cancel()}),Cc(()=>{var Q,oe,ge,ye;let X=GC(N.current,n||i||"",e||s||"",o||t||"");X!==((Q=T.current)==null?void 0:Q.getModel())&&(u&&L2.set(z,(oe=T.current)==null?void 0:oe.saveViewState()),(ge=T.current)==null||ge.setModel(X),u&&((ye=T.current)==null||ye.restoreViewState(L2.get(o))))},[o],S),Cc(()=>{var X;(X=T.current)==null||X.updateOptions(c)},[c],S),Cc(()=>{!T.current||i===void 0||(T.current.getOption(N.current.editor.EditorOption.readOnly)?T.current.setValue(i):i!==T.current.getValue()&&(W.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),T.current.pushUndoStop(),W.current=!1))},[i],S),Cc(()=>{var Q,oe;let X=(Q=T.current)==null?void 0:Q.getModel();X&&s&&((oe=N.current)==null||oe.editor.setModelLanguage(X,s))},[s],S),Cc(()=>{var X;a!==void 0&&((X=T.current)==null||X.revealLine(a))},[a],S),Cc(()=>{var X;(X=N.current)==null||X.editor.setTheme(r)},[r],S);let F=R.useCallback(()=>{var X;if(!(!M.current||!N.current)&&!U.current){V.current(N.current);let Q=o||t,oe=GC(N.current,i||n||"",e||s||"",Q||"");T.current=(X=N.current)==null?void 0:X.editor.create(M.current,{model:oe,automaticLayout:!0,...c},d),u&&T.current.restoreViewState(L2.get(Q)),N.current.editor.setTheme(r),a!==void 0&&T.current.revealLine(a),x(!0),U.current=!0}},[n,e,t,i,s,o,c,d,u,r,a]);R.useEffect(()=>{S&&P.current(T.current,N.current)},[S]),R.useEffect(()=>{!L&&!S&&F()},[L,S,F]),A.current=i,R.useEffect(()=>{var X,Q;S&&C&&((X=O.current)==null||X.dispose(),O.current=(Q=T.current)==null?void 0:Q.onDidChangeModelContent(oe=>{W.current||C(T.current.getValue(),oe)}))},[S,C]),R.useEffect(()=>{if(S){let X=N.current.editor.onDidChangeMarkers(Q=>{var ge;let oe=(ge=T.current.getModel())==null?void 0:ge.uri;if(oe&&Q.find(ye=>ye.path===oe.path)){let ye=N.current.editor.getModelMarkers({resource:oe});y==null||y(ye)}});return()=>{X==null||X.dispose()}}return()=>{}},[S,y]);function q(){var X,Q;(X=O.current)==null||X.dispose(),h?u&&L2.set(o,T.current.saveViewState()):(Q=T.current.getModel())==null||Q.dispose(),T.current.dispose()}return s_.createElement(yme,{width:f,height:g,isEditorReady:S,loading:l,_ref:M,className:p,wrapperProps:m})}var aOe=rOe,lOe=R.memo(aOe),cOe=lOe;function dOe(n){if(n.length===0)throw new Error("Invalid tail call");return[n.slice(0,n.length-1),n[n.length-1]]}function gn(n,e,t=(i,s)=>i===s){if(n===e)return!0;if(!n||!e||n.length!==e.length)return!1;for(let i=0,s=n.length;it(n[i],e))}function tZ(n,e){let t=0,i=n-1;for(;t<=i;){const s=(t+i)/2|0,o=e(s);if(o<0)t=s+1;else if(o>0)i=s-1;else return s}return-(t+1)}function wH(n,e,t){if(n=n|0,n>=e.length)throw new TypeError("invalid index");const i=e[Math.floor(e.length*Math.random())],s=[],o=[],r=[];for(const a of e){const l=t(a,i);l<0?s.push(a):l>0?o.push(a):r.push(a)}return n!!e)}function mne(n){let e=0;for(let t=0;t0}function mp(n,e=t=>t){const t=new Set;return n.filter(i=>{const s=e(i);return t.has(s)?!1:(t.add(s),!0)})}function Gr(n,e){let t=typeof e=="number"?n:0;typeof e=="number"?t=n:(t=0,e=n);const i=[];if(t<=e)for(let s=t;se;s--)i.push(s);return i}function V3(n,e,t){const i=n.slice(0,e),s=n.slice(e);return i.concat(t,s)}function x6(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.unshift(e))}function k2(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.push(e))}function CH(n,e){for(const t of e)n.push(t)}function fOe(n,e){const t=[];for(const i of n){const s=e(i);s!==void 0&&t.push(s)}return t}function nZ(n){return Array.isArray(n)?n:[n]}function gOe(n,e,t){const i=Nme(n,e),s=n.length,o=t.length;n.length=s+o;for(let r=s-1;r>=i;r--)n[r+o]=n[r];for(let r=0;r0}n.isGreaterThan=i;function s(o){return o===0}n.isNeitherLessOrGreaterThan=s,n.greaterThan=1,n.lessThan=-1,n.neitherLessOrGreaterThan=0})(g_||(g_={}));function Ko(n,e){return(t,i)=>e(n(t),n(i))}function pOe(...n){return(e,t)=>{for(const i of n){const s=i(e,t);if(!g_.isNeitherLessOrGreaterThan(s))return s}return g_.neitherLessOrGreaterThan}}const al=(n,e)=>n-e,Eme=(n,e)=>al(n?1:0,e?1:0);function Ime(n){return(e,t)=>-n(e,t)}function mOe(n){return(e,t)=>e===void 0?t===void 0?g_.neitherLessOrGreaterThan:g_.lessThan:t===void 0?g_.greaterThan:n(e,t)}class _p{constructor(e){this.firstIdx=0,this.items=e,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t=0&&e(this.items[t]);)t--;const i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(this.length!==0)return this.items[this.firstIdx]}dequeue(){const e=this.items[this.firstIdx];return this.firstIdx++,e}takeCount(e){const t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}}const vy=class vy{constructor(e){this.iterate=e}toArray(){const e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new vy(t=>this.iterate(i=>e(i)?t(i):!0))}map(e){return new vy(t=>this.iterate(i=>t(e(i))))}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(s=>((i||g_.isGreaterThan(e(s,t)))&&(i=!1,t=s),!0)),t}};vy.empty=new vy(e=>{});let d1=vy;class nP{constructor(e){this._indexMap=e}static createSortPermutation(e,t){const i=Array.from(e.keys()).sort((s,o)=>t(e[s],e[o]));return new nP(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){const e=this._indexMap.slice();for(let t=0;te+t,0)}class _Oe{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ix.isErrorNoTelemetry(e)?new ix(e.message+`
+ `},gne=EPe(RPe)(vme),MPe={config:DPe},APe=function(){for(var e=arguments.length,t=new Array(e),i=0;i{i.current=!1}:n,e)}var Cc=eOe;function tN(){}function GC(n,e,t,i){return tOe(n,i)||iOe(n,e,t,i)}function tOe(n,e){return n.editor.getModel(Lme(n,e))}function iOe(n,e,t,i){return n.editor.createModel(e,t,i?Lme(n,i):void 0)}function Lme(n,e){return n.Uri.parse(e)}function nOe({original:n,modified:e,language:t,originalLanguage:i,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:r,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:d="Loading...",options:u={},height:h="100%",width:f="100%",className:g,wrapperProps:p={},beforeMount:_=tN,onMount:b=tN}){let[v,C]=R.useState(!1),[y,S]=R.useState(!0),x=R.useRef(null),L=R.useRef(null),k=R.useRef(null),N=R.useRef(b),D=R.useRef(_),M=R.useRef(!1);xme(()=>{let A=eZ.init();return A.then(z=>(L.current=z)&&S(!1)).catch(z=>(z==null?void 0:z.type)!=="cancelation"&&console.error("Monaco initialization: error:",z)),()=>x.current?O():A.cancel()}),Cc(()=>{if(x.current&&L.current){let A=x.current.getOriginalEditor(),z=GC(L.current,n||"",i||t||"text",o||"");z!==A.getModel()&&A.setModel(z)}},[o],v),Cc(()=>{if(x.current&&L.current){let A=x.current.getModifiedEditor(),z=GC(L.current,e||"",s||t||"text",r||"");z!==A.getModel()&&A.setModel(z)}},[r],v),Cc(()=>{let A=x.current.getModifiedEditor();A.getOption(L.current.editor.EditorOption.readOnly)?A.setValue(e||""):e!==A.getValue()&&(A.executeEdits("",[{range:A.getModel().getFullModelRange(),text:e||"",forceMoveMarkers:!0}]),A.pushUndoStop())},[e],v),Cc(()=>{var A,z;(z=(A=x.current)==null?void 0:A.getModel())==null||z.original.setValue(n||"")},[n],v),Cc(()=>{let{original:A,modified:z}=x.current.getModel();L.current.editor.setModelLanguage(A,i||t||"text"),L.current.editor.setModelLanguage(z,s||t||"text")},[t,i,s],v),Cc(()=>{var A;(A=L.current)==null||A.editor.setTheme(c)},[c],v),Cc(()=>{var A;(A=x.current)==null||A.updateOptions(u)},[u],v);let P=R.useCallback(()=>{var U;if(!L.current)return;D.current(L.current);let A=GC(L.current,n||"",i||t||"text",o||""),z=GC(L.current,e||"",s||t||"text",r||"");(U=x.current)==null||U.setModel({original:A,modified:z})},[t,e,s,n,i,o,r]),V=R.useCallback(()=>{var A;!M.current&&k.current&&(x.current=L.current.editor.createDiffEditor(k.current,{automaticLayout:!0,...u}),P(),(A=L.current)==null||A.editor.setTheme(c),C(!0),M.current=!0)},[u,c,P]);R.useEffect(()=>{v&&N.current(x.current,L.current)},[v]),R.useEffect(()=>{!y&&!v&&V()},[y,v,V]);function O(){var z,U,B,F;let A=(z=x.current)==null?void 0:z.getModel();a||((U=A==null?void 0:A.original)==null||U.dispose()),l||((B=A==null?void 0:A.modified)==null||B.dispose()),(F=x.current)==null||F.dispose()}return s_.createElement(Sme,{width:f,height:h,isEditorReady:v,loading:d,_ref:k,className:g,wrapperProps:p})}var sOe=nOe;R.memo(sOe);function oOe(n){let e=R.useRef();return R.useEffect(()=>{e.current=n},[n]),e.current}var rOe=oOe,L2=new Map;function aOe({defaultValue:n,defaultLanguage:e,defaultPath:t,value:i,language:s,path:o,theme:r="light",line:a,loading:l="Loading...",options:c={},overrideServices:d={},saveViewState:u=!0,keepCurrentModel:h=!1,width:f="100%",height:g="100%",className:p,wrapperProps:_={},beforeMount:b=tN,onMount:v=tN,onChange:C,onValidate:y=tN}){let[S,x]=R.useState(!1),[L,k]=R.useState(!0),N=R.useRef(null),D=R.useRef(null),M=R.useRef(null),P=R.useRef(v),V=R.useRef(b),O=R.useRef(),A=R.useRef(i),z=rOe(o),U=R.useRef(!1),B=R.useRef(!1);xme(()=>{let Y=eZ.init();return Y.then(Q=>(N.current=Q)&&k(!1)).catch(Q=>(Q==null?void 0:Q.type)!=="cancelation"&&console.error("Monaco initialization: error:",Q)),()=>D.current?q():Y.cancel()}),Cc(()=>{var Q,ne,he,Ce;let Y=GC(N.current,n||i||"",e||s||"",o||t||"");Y!==((Q=D.current)==null?void 0:Q.getModel())&&(u&&L2.set(z,(ne=D.current)==null?void 0:ne.saveViewState()),(he=D.current)==null||he.setModel(Y),u&&((Ce=D.current)==null||Ce.restoreViewState(L2.get(o))))},[o],S),Cc(()=>{var Y;(Y=D.current)==null||Y.updateOptions(c)},[c],S),Cc(()=>{!D.current||i===void 0||(D.current.getOption(N.current.editor.EditorOption.readOnly)?D.current.setValue(i):i!==D.current.getValue()&&(B.current=!0,D.current.executeEdits("",[{range:D.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),D.current.pushUndoStop(),B.current=!1))},[i],S),Cc(()=>{var Q,ne;let Y=(Q=D.current)==null?void 0:Q.getModel();Y&&s&&((ne=N.current)==null||ne.editor.setModelLanguage(Y,s))},[s],S),Cc(()=>{var Y;a!==void 0&&((Y=D.current)==null||Y.revealLine(a))},[a],S),Cc(()=>{var Y;(Y=N.current)==null||Y.editor.setTheme(r)},[r],S);let F=R.useCallback(()=>{var Y;if(!(!M.current||!N.current)&&!U.current){V.current(N.current);let Q=o||t,ne=GC(N.current,i||n||"",e||s||"",Q||"");D.current=(Y=N.current)==null?void 0:Y.editor.create(M.current,{model:ne,automaticLayout:!0,...c},d),u&&D.current.restoreViewState(L2.get(Q)),N.current.editor.setTheme(r),a!==void 0&&D.current.revealLine(a),x(!0),U.current=!0}},[n,e,t,i,s,o,c,d,u,r,a]);R.useEffect(()=>{S&&P.current(D.current,N.current)},[S]),R.useEffect(()=>{!L&&!S&&F()},[L,S,F]),A.current=i,R.useEffect(()=>{var Y,Q;S&&C&&((Y=O.current)==null||Y.dispose(),O.current=(Q=D.current)==null?void 0:Q.onDidChangeModelContent(ne=>{B.current||C(D.current.getValue(),ne)}))},[S,C]),R.useEffect(()=>{if(S){let Y=N.current.editor.onDidChangeMarkers(Q=>{var he;let ne=(he=D.current.getModel())==null?void 0:he.uri;if(ne&&Q.find(Ce=>Ce.path===ne.path)){let Ce=N.current.editor.getModelMarkers({resource:ne});y==null||y(Ce)}});return()=>{Y==null||Y.dispose()}}return()=>{}},[S,y]);function q(){var Y,Q;(Y=O.current)==null||Y.dispose(),h?u&&L2.set(o,D.current.saveViewState()):(Q=D.current.getModel())==null||Q.dispose(),D.current.dispose()}return s_.createElement(Sme,{width:f,height:g,isEditorReady:S,loading:l,_ref:M,className:p,wrapperProps:_})}var lOe=aOe,cOe=R.memo(lOe),dOe=cOe;function uOe(n){if(n.length===0)throw new Error("Invalid tail call");return[n.slice(0,n.length-1),n[n.length-1]]}function gn(n,e,t=(i,s)=>i===s){if(n===e)return!0;if(!n||!e||n.length!==e.length)return!1;for(let i=0,s=n.length;it(n[i],e))}function tZ(n,e){let t=0,i=n-1;for(;t<=i;){const s=(t+i)/2|0,o=e(s);if(o<0)t=s+1;else if(o>0)i=s-1;else return s}return-(t+1)}function wH(n,e,t){if(n=n|0,n>=e.length)throw new TypeError("invalid index");const i=e[Math.floor(e.length*Math.random())],s=[],o=[],r=[];for(const a of e){const l=t(a,i);l<0?s.push(a):l>0?o.push(a):r.push(a)}return n!!e)}function mne(n){let e=0;for(let t=0;t0}function mp(n,e=t=>t){const t=new Set;return n.filter(i=>{const s=e(i);return t.has(s)?!1:(t.add(s),!0)})}function Gr(n,e){let t=typeof e=="number"?n:0;typeof e=="number"?t=n:(t=0,e=n);const i=[];if(t<=e)for(let s=t;se;s--)i.push(s);return i}function V3(n,e,t){const i=n.slice(0,e),s=n.slice(e);return i.concat(t,s)}function x6(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.unshift(e))}function k2(n,e){const t=n.indexOf(e);t>-1&&(n.splice(t,1),n.push(e))}function CH(n,e){for(const t of e)n.push(t)}function gOe(n,e){const t=[];for(const i of n){const s=e(i);s!==void 0&&t.push(s)}return t}function nZ(n){return Array.isArray(n)?n:[n]}function pOe(n,e,t){const i=Eme(n,e),s=n.length,o=t.length;n.length=s+o;for(let r=s-1;r>=i;r--)n[r+o]=n[r];for(let r=0;r0}n.isGreaterThan=i;function s(o){return o===0}n.isNeitherLessOrGreaterThan=s,n.greaterThan=1,n.lessThan=-1,n.neitherLessOrGreaterThan=0})(g_||(g_={}));function Ko(n,e){return(t,i)=>e(n(t),n(i))}function mOe(...n){return(e,t)=>{for(const i of n){const s=i(e,t);if(!g_.isNeitherLessOrGreaterThan(s))return s}return g_.neitherLessOrGreaterThan}}const al=(n,e)=>n-e,Ime=(n,e)=>al(n?1:0,e?1:0);function Dme(n){return(e,t)=>-n(e,t)}function _Oe(n){return(e,t)=>e===void 0?t===void 0?g_.neitherLessOrGreaterThan:g_.lessThan:t===void 0?g_.greaterThan:n(e,t)}class _p{constructor(e){this.firstIdx=0,this.items=e,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t=0&&e(this.items[t]);)t--;const i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(this.length!==0)return this.items[this.firstIdx]}dequeue(){const e=this.items[this.firstIdx];return this.firstIdx++,e}takeCount(e){const t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}}const vy=class vy{constructor(e){this.iterate=e}toArray(){const e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new vy(t=>this.iterate(i=>e(i)?t(i):!0))}map(e){return new vy(t=>this.iterate(i=>t(e(i))))}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(s=>((i||g_.isGreaterThan(e(s,t)))&&(i=!1,t=s),!0)),t}};vy.empty=new vy(e=>{});let d1=vy;class nP{constructor(e){this._indexMap=e}static createSortPermutation(e,t){const i=Array.from(e.keys()).sort((s,o)=>t(e[s],e[o]));return new nP(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){const e=this._indexMap.slice();for(let t=0;te+t,0)}class bOe{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?ix.isErrorNoTelemetry(e)?new ix(e.message+`
`+e.stack):new Error(e.message+`
-`+e.stack):e},0)}}emit(e){this.listeners.forEach(t=>{t(e)})}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}}const sZ=new _Oe;function oP(n){sZ.onUnexpectedError(n)}function ht(n){rc(n)||sZ.onUnexpectedError(n)}function gs(n){rc(n)||sZ.onUnexpectedExternalError(n)}function yH(n){if(n instanceof Error){const{name:e,message:t,cause:i}=n,s=n.stacktrace||n.stack;return{$isError:!0,name:e,message:t,stack:s,noTelemetry:ix.isErrorNoTelemetry(n),cause:i?yH(i):void 0,code:n.code}}return n}const rP="Canceled";function rc(n){return n instanceof jc?!0:n instanceof Error&&n.name===rP&&n.message===rP}class jc extends Error{constructor(){super(rP),this.name=this.message}}function bOe(){const n=new Error(rP);return n.name=n.message,n}function Oc(n){return n?new Error(`Illegal argument: ${n}`):new Error("Illegal argument")}function aP(n){return n?new Error(`Illegal state: ${n}`):new Error("Illegal state")}class vOe extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}class ix extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof ix)return e;const t=new ix;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}}class Qe extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,Qe.prototype)}}function L6(n,e){if(!n)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}function XD(n,e="Unreachable"){throw new Error(e)}function qE(n,e="unexpected state"){if(!n)throw typeof e=="string"?new Qe(`Assertion Failed: ${e}`):e}function _ne(n,e="Soft Assertion Failed"){n||ht(new Qe(e))}function U_(n){if(!n()){debugger;n(),ht(new Qe("Assertion Failed"))}}function QD(n,e){let t=0;for(;t"u"}function co(n){return!kc(n)}function kc(n){return dr(n)||n===null}function Gt(n,e){if(!n)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function Wm(n){return qE(n!=null,"Argument is `undefined` or `null`."),n}function P0(n){return typeof n=="function"}function yOe(n,e){const t=Math.min(n.length,e.length);for(let i=0;i{e[t]=i&&typeof i=="object"?Mh(i):i}),e}function xOe(n){if(!n||typeof n!="object")return n;const e=[n];for(;e.length>0;){const t=e.shift();Object.freeze(t);for(const i in t)if(Dme.call(t,i)){const s=t[i];typeof s=="object"&&!Object.isFrozen(s)&&!COe(s)&&e.push(s)}}return n}const Dme=Object.prototype.hasOwnProperty;function Tme(n,e){return LH(n,e,new Set)}function LH(n,e,t){if(kc(n))return n;const i=e(n);if(typeof i<"u")return i;if(Array.isArray(n)){const s=[];for(const o of n)s.push(LH(o,e,t));return s}if(As(n)){if(t.has(n))throw new Error("Cannot clone recursive data-structure");t.add(n);const s={};for(const o in n)Dme.call(n,o)&&(s[o]=LH(n[o],e,t));return t.delete(n),s}return n}function j3(n,e,t=!0){return As(n)?(As(e)&&Object.keys(e).forEach(i=>{i in n?t&&(As(n[i])&&As(e[i])?j3(n[i],e[i],t):n[i]=e[i]):n[i]=e[i]}),n):e}function ll(n,e){if(n===e)return!0;if(n==null||e===null||e===void 0||typeof n!=typeof e||typeof n!="object"||Array.isArray(n)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(t=0;t=0;function lP(n,e){let t;return e.length===0?t=n:t=n.replace(/\{(\d+)\}/g,(i,s)=>{const o=s[0],r=e[o];let a=i;return typeof r=="string"?a=r:(typeof r=="number"||typeof r=="boolean"||r===void 0||r===null)&&(a=String(r)),a}),LOe&&(t="["+t.replace(/[aouei]/g,"$&$&")+"]"),t}function w(n,e,...t){return lP(typeof n=="number"?Mme(n,e):e,t)}function Mme(n,e){var i;const t=(i=Rme())==null?void 0:i[n];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${n} !!!`)}return t}function te(n,e,...t){let i;typeof n=="number"?i=Mme(n,e):i=e;const s=lP(i,t);return{value:s,original:e===i?s:lP(e,t)}}const jv="en";let KE=!1,GE=!1,iN=!1,Ame=!1,rZ=!1,aZ=!1,Pme=!1,N2,LM=jv,bne=jv,kOe,tu;const ep=globalThis;let xr;var Gue;typeof ep.vscode<"u"&&typeof ep.vscode.process<"u"?xr=ep.vscode.process:typeof process<"u"&&typeof((Gue=process==null?void 0:process.versions)==null?void 0:Gue.node)=="string"&&(xr=process);var Yue;const NOe=typeof((Yue=xr==null?void 0:xr.versions)==null?void 0:Yue.electron)=="string",EOe=NOe&&(xr==null?void 0:xr.type)==="renderer";var Zue;if(typeof xr=="object"){KE=xr.platform==="win32",GE=xr.platform==="darwin",iN=xr.platform==="linux",iN&&xr.env.SNAP&&xr.env.SNAP_REVISION,xr.env.CI||xr.env.BUILD_ARTIFACTSTAGINGDIRECTORY||xr.env.GITHUB_WORKSPACE,N2=jv,LM=jv;const n=xr.env.VSCODE_NLS_CONFIG;if(n)try{const e=JSON.parse(n);N2=e.userLocale,bne=e.osLocale,LM=e.resolvedLanguage||jv,kOe=(Zue=e.languagePack)==null?void 0:Zue.translationsConfigFile}catch{}Ame=!0}else typeof navigator=="object"&&!EOe?(tu=navigator.userAgent,KE=tu.indexOf("Windows")>=0,GE=tu.indexOf("Macintosh")>=0,aZ=(tu.indexOf("Macintosh")>=0||tu.indexOf("iPad")>=0||tu.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,iN=tu.indexOf("Linux")>=0,Pme=(tu==null?void 0:tu.indexOf("Mobi"))>=0,rZ=!0,LM=oZ()||jv,N2=navigator.language.toLowerCase(),bne=N2):console.error("Unable to resolve platform.");let kM=0;GE?kM=1:KE?kM=3:iN&&(kM=2);const ko=KE,Pt=GE,Ra=iN,Vu=Ame,Sf=rZ,IOe=rZ&&typeof ep.importScripts=="function",DOe=IOe?ep.origin:void 0,zc=aZ,Ome=Pme,k6=kM,uf=tu,TOe=LM,ROe=typeof ep.postMessage=="function"&&!ep.importScripts,JD=(()=>{if(ROe){const n=[];ep.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,s=n.length;i{const i=++e;n.push({id:i,callback:t}),ep.postMessage({vscodeScheduleAsyncWork:i},"*")}}return n=>setTimeout(n)})(),nl=GE||aZ?2:KE?1:3;let vne=!0,wne=!1;function Fme(){if(!wne){wne=!0;const n=new Uint8Array(2);n[0]=1,n[1]=2,vne=new Uint16Array(n.buffer)[0]===513}return vne}const lZ=!!(uf&&uf.indexOf("Chrome")>=0),MOe=!!(uf&&uf.indexOf("Firefox")>=0),AOe=!!(!lZ&&uf&&uf.indexOf("Safari")>=0),Bme=!!(uf&&uf.indexOf("Edg/")>=0),POe=!!(uf&&uf.indexOf("Android")>=0);function O0(n,e){const t=this;let i=!1,s;return function(){return i||(i=!0,s=n.apply(t,arguments)),s}}var Ht;(function(n){function e(L){return!!L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}n.is=e;const t=Object.freeze([]);function i(){return t}n.empty=i;function*s(L){yield L}n.single=s;function o(L){return e(L)?L:s(L)}n.wrap=o;function r(L){return L||t}n.from=r;function*a(L){for(let k=L.length-1;k>=0;k--)yield L[k]}n.reverse=a;function l(L){return!L||L[Symbol.iterator]().next().done===!0}n.isEmpty=l;function c(L){return L[Symbol.iterator]().next().value}n.first=c;function d(L,k){let N=0;for(const T of L)if(k(T,N++))return!0;return!1}n.some=d;function u(L,k){let N=0;for(const T of L)if(!k(T,N++))return!1;return!0}n.every=u;function h(L,k){for(const N of L)if(k(N))return N}n.find=h;function*f(L,k){for(const N of L)k(N)&&(yield N)}n.filter=f;function*g(L,k){let N=0;for(const T of L)yield k(T,N++)}n.map=g;function*p(L,k){let N=0;for(const T of L)yield*k(T,N++)}n.flatMap=p;function*m(...L){for(const k of L)SH(k)?yield*k:yield k}n.concat=m;function b(L,k,N){let T=N;for(const M of L)T=k(T,M);return T}n.reduce=b;function v(L){let k=0;for(const N of L)k++;return k}n.length=v;function*C(L,k,N=L.length){for(k<-L.length&&(k=0),k<0&&(k+=L.length),N<0?N+=L.length:N>L.length&&(N=L.length);k1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(n)?[]:n}else if(n)return n.dispose(),n}function Dd(...n){return We(()=>bi(n))}class OOe{constructor(e){this._isDisposed=!1,this._fn=e}dispose(){if(!this._isDisposed){if(!this._fn)throw new Error("Unbound disposable context: Need to use an arrow function to preserve the value of this");this._isDisposed=!0,this._fn()}}}function We(n){return new OOe(n)}const x5=class x5{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{bi(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e||e===Z.None)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?x5.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}};x5.DISABLE_DISPOSED_WARNING=!1;let se=x5;const see=class see{constructor(){this._store=new se,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};see.None=Object.freeze({dispose(){}});let Z=see;class fi{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}}class FOe{constructor(e){this._disposable=e,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}}class BOe{constructor(e){this.object=e}dispose(){}}class z3{constructor(){this._store=new Map,this._isDisposed=!1}dispose(){this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{bi(this._store.values())}finally{this._store.clear()}}get(e){return this._store.get(e)}set(e,t,i=!1){var s;this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||(s=this._store.get(e))==null||s.dispose(),this._store.set(e,t)}deleteAndDispose(e){var t;(t=this._store.get(e))==null||t.dispose(),this._store.delete(e)}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}var zg;let Us=(zg=class{constructor(e){this.element=e,this.next=zg.Undefined,this.prev=zg.Undefined}},zg.Undefined=new zg(void 0),zg);class Tr{constructor(){this._first=Us.Undefined,this._last=Us.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Us.Undefined}clear(){let e=this._first;for(;e!==Us.Undefined;){const t=e.next;e.prev=Us.Undefined,e.next=Us.Undefined,e=t}this._first=Us.Undefined,this._last=Us.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const i=new Us(e);if(this._first===Us.Undefined)this._first=i,this._last=i;else if(t){const o=this._last;this._last=i,i.prev=o,o.next=i}else{const o=this._first;this._first=i,i.next=o,o.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==Us.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Us.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Us.Undefined&&e.next!==Us.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Us.Undefined&&e.next===Us.Undefined?(this._first=Us.Undefined,this._last=Us.Undefined):e.next===Us.Undefined?(this._last=this._last.prev,this._last.next=Us.Undefined):e.prev===Us.Undefined&&(this._first=this._first.next,this._first.prev=Us.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Us.Undefined;)yield e.element,e=e.next}}const WOe=globalThis.performance.now.bind(globalThis.performance);class io{static create(e){return new io(e)}constructor(e){this._now=e===!1?Date.now:WOe,this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}var we;(function(n){n.None=()=>Z.None;function e(P,V){return h(P,()=>{},0,void 0,!0,void 0,V)}n.defer=e;function t(P){return(V,O=null,A)=>{let z=!1,U;return U=P(W=>{if(!z)return U?U.dispose():z=!0,V.call(O,W)},null,A),z&&U.dispose(),U}}n.once=t;function i(P,V){return n.once(n.filter(P,V))}n.onceIf=i;function s(P,V,O){return d((A,z=null,U)=>P(W=>A.call(z,V(W)),null,U),O)}n.map=s;function o(P,V,O){return d((A,z=null,U)=>P(W=>{V(W),A.call(z,W)},null,U),O)}n.forEach=o;function r(P,V,O){return d((A,z=null,U)=>P(W=>V(W)&&A.call(z,W),null,U),O)}n.filter=r;function a(P){return P}n.signal=a;function l(...P){return(V,O=null,A)=>{const z=Dd(...P.map(U=>U(W=>V.call(O,W))));return u(z,A)}}n.any=l;function c(P,V,O,A){let z=O;return s(P,U=>(z=V(z,U),z),A)}n.reduce=c;function d(P,V){let O;const A={onWillAddFirstListener(){O=P(z.fire,z)},onDidRemoveLastListener(){O==null||O.dispose()}},z=new G(A);return V==null||V.add(z),z.event}function u(P,V){return V instanceof Array?V.push(P):V&&V.add(P),P}function h(P,V,O=100,A=!1,z=!1,U,W){let F,q,X,Q=0,oe;const ge={leakWarningThreshold:U,onWillAddFirstListener(){F=P($e=>{Q++,q=V(q,$e),A&&!X&&(ye.fire(q),q=void 0),oe=()=>{const Ze=q;q=void 0,X=void 0,(!A||Q>1)&&ye.fire(Ze),Q=0},typeof O=="number"?(X&&clearTimeout(X),X=setTimeout(oe,O)):X===void 0&&(X=null,queueMicrotask(oe))})},onWillRemoveListener(){z&&Q>0&&(oe==null||oe())},onDidRemoveLastListener(){oe=void 0,F.dispose()}},ye=new G(ge);return W==null||W.add(ye),ye.event}n.debounce=h;function f(P,V=0,O){return n.debounce(P,(A,z)=>A?(A.push(z),A):[z],V,void 0,!0,void 0,O)}n.accumulate=f;function g(P,V=(A,z)=>A===z,O){let A=!0,z;return r(P,U=>{const W=A||!V(U,z);return A=!1,z=U,W},O)}n.latch=g;function p(P,V,O){return[n.filter(P,V,O),n.filter(P,A=>!V(A),O)]}n.split=p;function m(P,V=!1,O=[],A){let z=O.slice(),U=P(q=>{z?z.push(q):F.fire(q)});A&&A.add(U);const W=()=>{z==null||z.forEach(q=>F.fire(q)),z=null},F=new G({onWillAddFirstListener(){U||(U=P(q=>F.fire(q)),A&&A.add(U))},onDidAddFirstListener(){z&&(V?setTimeout(W):W())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return A&&A.add(F),F.event}n.buffer=m;function b(P,V){return(A,z,U)=>{const W=V(new C);return P(function(F){const q=W.evaluate(F);q!==v&&A.call(z,q)},void 0,U)}}n.chain=b;const v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(V){return this.steps.push(V),this}forEach(V){return this.steps.push(O=>(V(O),O)),this}filter(V){return this.steps.push(O=>V(O)?O:v),this}reduce(V,O){let A=O;return this.steps.push(z=>(A=V(A,z),A)),this}latch(V=(O,A)=>O===A){let O=!0,A;return this.steps.push(z=>{const U=O||!V(z,A);return O=!1,A=z,U?z:v}),this}evaluate(V){for(const O of this.steps)if(V=O(V),V===v)break;return V}}function y(P,V,O=A=>A){const A=(...F)=>W.fire(O(...F)),z=()=>P.on(V,A),U=()=>P.removeListener(V,A),W=new G({onWillAddFirstListener:z,onDidRemoveLastListener:U});return W.event}n.fromNodeEventEmitter=y;function S(P,V,O=A=>A){const A=(...F)=>W.fire(O(...F)),z=()=>P.addEventListener(V,A),U=()=>P.removeEventListener(V,A),W=new G({onWillAddFirstListener:z,onDidRemoveLastListener:U});return W.event}n.fromDOMEventEmitter=S;function x(P,V){let O;const A=new Promise((z,U)=>{const W=t(P)(z,null,V);O=()=>W.dispose()});return A.cancel=O,A}n.toPromise=x;function L(P,V){return P(O=>V.fire(O))}n.forward=L;function k(P,V,O){return V(O),P(A=>V(A))}n.runAndSubscribe=k;class N{constructor(V,O){this._observable=V,this._counter=0,this._hasChanged=!1;const A={onWillAddFirstListener:()=>{V.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{V.removeObserver(this)}};this.emitter=new G(A),O&&O.add(this.emitter)}beginUpdate(V){this._counter++}handlePossibleChange(V){}handleChange(V,O){this._hasChanged=!0}endUpdate(V){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(P,V){return new N(P,V).emitter.event}n.fromObservable=T;function M(P){return(V,O,A)=>{let z=0,U=!1;const W={beginUpdate(){z++},endUpdate(){z--,z===0&&(P.reportChanges(),U&&(U=!1,V.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};P.addObserver(W),P.reportChanges();const F={dispose(){P.removeObserver(W)}};return A instanceof se?A.add(F):Array.isArray(A)&&A.push(F),F}}n.fromObservableLight=M})(we||(we={}));const wy=class wy{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${wy._idPool++}`,wy.all.add(this)}start(e){this._stopWatch=new io,this.listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};wy.all=new Set,wy._idPool=0;let kH=wy,HOe=-1;const L5=class L5{constructor(e,t,i=(L5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=i,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,t){const i=this.threshold;if(i<=0||t{const o=this._stacks.get(e.value)||0;this._stacks.set(e.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(const[i,s]of this._stacks)(!e||t{t(e)})}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}}const sZ=new bOe;function oP(n){sZ.onUnexpectedError(n)}function ht(n){rc(n)||sZ.onUnexpectedError(n)}function gs(n){rc(n)||sZ.onUnexpectedExternalError(n)}function yH(n){if(n instanceof Error){const{name:e,message:t,cause:i}=n,s=n.stacktrace||n.stack;return{$isError:!0,name:e,message:t,stack:s,noTelemetry:ix.isErrorNoTelemetry(n),cause:i?yH(i):void 0,code:n.code}}return n}const rP="Canceled";function rc(n){return n instanceof jc?!0:n instanceof Error&&n.name===rP&&n.message===rP}class jc extends Error{constructor(){super(rP),this.name=this.message}}function vOe(){const n=new Error(rP);return n.name=n.message,n}function Oc(n){return n?new Error(`Illegal argument: ${n}`):new Error("Illegal argument")}function aP(n){return n?new Error(`Illegal state: ${n}`):new Error("Illegal state")}class wOe extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}class ix extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof ix)return e;const t=new ix;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}}class Je extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,Je.prototype)}}function L6(n,e){if(!n)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}function XD(n,e="Unreachable"){throw new Error(e)}function qE(n,e="unexpected state"){if(!n)throw typeof e=="string"?new Je(`Assertion Failed: ${e}`):e}function _ne(n,e="Soft Assertion Failed"){n||ht(new Je(e))}function U_(n){if(!n()){debugger;n(),ht(new Je("Assertion Failed"))}}function QD(n,e){let t=0;for(;t"u"}function co(n){return!kc(n)}function kc(n){return dr(n)||n===null}function Gt(n,e){if(!n)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function Wm(n){return qE(n!=null,"Argument is `undefined` or `null`."),n}function P0(n){return typeof n=="function"}function SOe(n,e){const t=Math.min(n.length,e.length);for(let i=0;i{e[t]=i&&typeof i=="object"?Mh(i):i}),e}function LOe(n){if(!n||typeof n!="object")return n;const e=[n];for(;e.length>0;){const t=e.shift();Object.freeze(t);for(const i in t)if(Tme.call(t,i)){const s=t[i];typeof s=="object"&&!Object.isFrozen(s)&&!yOe(s)&&e.push(s)}}return n}const Tme=Object.prototype.hasOwnProperty;function Rme(n,e){return LH(n,e,new Set)}function LH(n,e,t){if(kc(n))return n;const i=e(n);if(typeof i<"u")return i;if(Array.isArray(n)){const s=[];for(const o of n)s.push(LH(o,e,t));return s}if(As(n)){if(t.has(n))throw new Error("Cannot clone recursive data-structure");t.add(n);const s={};for(const o in n)Tme.call(n,o)&&(s[o]=LH(n[o],e,t));return t.delete(n),s}return n}function j3(n,e,t=!0){return As(n)?(As(e)&&Object.keys(e).forEach(i=>{i in n?t&&(As(n[i])&&As(e[i])?j3(n[i],e[i],t):n[i]=e[i]):n[i]=e[i]}),n):e}function ll(n,e){if(n===e)return!0;if(n==null||e===null||e===void 0||typeof n!=typeof e||typeof n!="object"||Array.isArray(n)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(n)){if(n.length!==e.length)return!1;for(t=0;t=0;function lP(n,e){let t;return e.length===0?t=n:t=n.replace(/\{(\d+)\}/g,(i,s)=>{const o=s[0],r=e[o];let a=i;return typeof r=="string"?a=r:(typeof r=="number"||typeof r=="boolean"||r===void 0||r===null)&&(a=String(r)),a}),kOe&&(t="["+t.replace(/[aouei]/g,"$&$&")+"]"),t}function w(n,e,...t){return lP(typeof n=="number"?Ame(n,e):e,t)}function Ame(n,e){var i;const t=(i=Mme())==null?void 0:i[n];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${n} !!!`)}return t}function te(n,e,...t){let i;typeof n=="number"?i=Ame(n,e):i=e;const s=lP(i,t);return{value:s,original:e===i?s:lP(e,t)}}const jv="en";let KE=!1,GE=!1,iN=!1,Pme=!1,rZ=!1,aZ=!1,Ome=!1,N2,LM=jv,bne=jv,NOe,tu;const ep=globalThis;let xr;var Yue;typeof ep.vscode<"u"&&typeof ep.vscode.process<"u"?xr=ep.vscode.process:typeof process<"u"&&typeof((Yue=process==null?void 0:process.versions)==null?void 0:Yue.node)=="string"&&(xr=process);var Zue;const EOe=typeof((Zue=xr==null?void 0:xr.versions)==null?void 0:Zue.electron)=="string",IOe=EOe&&(xr==null?void 0:xr.type)==="renderer";var Xue;if(typeof xr=="object"){KE=xr.platform==="win32",GE=xr.platform==="darwin",iN=xr.platform==="linux",iN&&xr.env.SNAP&&xr.env.SNAP_REVISION,xr.env.CI||xr.env.BUILD_ARTIFACTSTAGINGDIRECTORY||xr.env.GITHUB_WORKSPACE,N2=jv,LM=jv;const n=xr.env.VSCODE_NLS_CONFIG;if(n)try{const e=JSON.parse(n);N2=e.userLocale,bne=e.osLocale,LM=e.resolvedLanguage||jv,NOe=(Xue=e.languagePack)==null?void 0:Xue.translationsConfigFile}catch{}Pme=!0}else typeof navigator=="object"&&!IOe?(tu=navigator.userAgent,KE=tu.indexOf("Windows")>=0,GE=tu.indexOf("Macintosh")>=0,aZ=(tu.indexOf("Macintosh")>=0||tu.indexOf("iPad")>=0||tu.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,iN=tu.indexOf("Linux")>=0,Ome=(tu==null?void 0:tu.indexOf("Mobi"))>=0,rZ=!0,LM=oZ()||jv,N2=navigator.language.toLowerCase(),bne=N2):console.error("Unable to resolve platform.");let kM=0;GE?kM=1:KE?kM=3:iN&&(kM=2);const ko=KE,Pt=GE,Ra=iN,Vu=Pme,Sf=rZ,DOe=rZ&&typeof ep.importScripts=="function",TOe=DOe?ep.origin:void 0,zc=aZ,Fme=Ome,k6=kM,uf=tu,ROe=LM,MOe=typeof ep.postMessage=="function"&&!ep.importScripts,JD=(()=>{if(MOe){const n=[];ep.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,s=n.length;i{const i=++e;n.push({id:i,callback:t}),ep.postMessage({vscodeScheduleAsyncWork:i},"*")}}return n=>setTimeout(n)})(),nl=GE||aZ?2:KE?1:3;let vne=!0,wne=!1;function Bme(){if(!wne){wne=!0;const n=new Uint8Array(2);n[0]=1,n[1]=2,vne=new Uint16Array(n.buffer)[0]===513}return vne}const lZ=!!(uf&&uf.indexOf("Chrome")>=0),AOe=!!(uf&&uf.indexOf("Firefox")>=0),POe=!!(!lZ&&uf&&uf.indexOf("Safari")>=0),Wme=!!(uf&&uf.indexOf("Edg/")>=0),OOe=!!(uf&&uf.indexOf("Android")>=0);function O0(n,e){const t=this;let i=!1,s;return function(){return i||(i=!0,s=n.apply(t,arguments)),s}}var Ht;(function(n){function e(L){return!!L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}n.is=e;const t=Object.freeze([]);function i(){return t}n.empty=i;function*s(L){yield L}n.single=s;function o(L){return e(L)?L:s(L)}n.wrap=o;function r(L){return L||t}n.from=r;function*a(L){for(let k=L.length-1;k>=0;k--)yield L[k]}n.reverse=a;function l(L){return!L||L[Symbol.iterator]().next().done===!0}n.isEmpty=l;function c(L){return L[Symbol.iterator]().next().value}n.first=c;function d(L,k){let N=0;for(const D of L)if(k(D,N++))return!0;return!1}n.some=d;function u(L,k){let N=0;for(const D of L)if(!k(D,N++))return!1;return!0}n.every=u;function h(L,k){for(const N of L)if(k(N))return N}n.find=h;function*f(L,k){for(const N of L)k(N)&&(yield N)}n.filter=f;function*g(L,k){let N=0;for(const D of L)yield k(D,N++)}n.map=g;function*p(L,k){let N=0;for(const D of L)yield*k(D,N++)}n.flatMap=p;function*_(...L){for(const k of L)SH(k)?yield*k:yield k}n.concat=_;function b(L,k,N){let D=N;for(const M of L)D=k(D,M);return D}n.reduce=b;function v(L){let k=0;for(const N of L)k++;return k}n.length=v;function*C(L,k,N=L.length){for(k<-L.length&&(k=0),k<0&&(k+=L.length),N<0?N+=L.length:N>L.length&&(N=L.length);k1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(n)?[]:n}else if(n)return n.dispose(),n}function Dd(...n){return He(()=>bi(n))}class FOe{constructor(e){this._isDisposed=!1,this._fn=e}dispose(){if(!this._isDisposed){if(!this._fn)throw new Error("Unbound disposable context: Need to use an arrow function to preserve the value of this");this._isDisposed=!0,this._fn()}}}function He(n){return new FOe(n)}const x5=class x5{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{bi(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e||e===X.None)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?x5.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}};x5.DISABLE_DISPOSED_WARNING=!1;let oe=x5;const see=class see{constructor(){this._store=new oe,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};see.None=Object.freeze({dispose(){}});let X=see;class fi{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||((t=this._value)==null||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,(e=this._value)==null||e.dispose(),this._value=void 0}}class BOe{constructor(e){this._disposable=e,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}}class WOe{constructor(e){this.object=e}dispose(){}}class z3{constructor(){this._store=new Map,this._isDisposed=!1}dispose(){this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{bi(this._store.values())}finally{this._store.clear()}}get(e){return this._store.get(e)}set(e,t,i=!1){var s;this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||(s=this._store.get(e))==null||s.dispose(),this._store.set(e,t)}deleteAndDispose(e){var t;(t=this._store.get(e))==null||t.dispose(),this._store.delete(e)}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}var zg;let Us=(zg=class{constructor(e){this.element=e,this.next=zg.Undefined,this.prev=zg.Undefined}},zg.Undefined=new zg(void 0),zg);class Tr{constructor(){this._first=Us.Undefined,this._last=Us.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Us.Undefined}clear(){let e=this._first;for(;e!==Us.Undefined;){const t=e.next;e.prev=Us.Undefined,e.next=Us.Undefined,e=t}this._first=Us.Undefined,this._last=Us.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const i=new Us(e);if(this._first===Us.Undefined)this._first=i,this._last=i;else if(t){const o=this._last;this._last=i,i.prev=o,o.next=i}else{const o=this._first;this._first=i,i.next=o,o.prev=i}this._size+=1;let s=!1;return()=>{s||(s=!0,this._remove(i))}}shift(){if(this._first!==Us.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Us.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Us.Undefined&&e.next!==Us.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Us.Undefined&&e.next===Us.Undefined?(this._first=Us.Undefined,this._last=Us.Undefined):e.next===Us.Undefined?(this._last=this._last.prev,this._last.next=Us.Undefined):e.prev===Us.Undefined&&(this._first=this._first.next,this._first.prev=Us.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Us.Undefined;)yield e.element,e=e.next}}const HOe=globalThis.performance.now.bind(globalThis.performance);class io{static create(e){return new io(e)}constructor(e){this._now=e===!1?Date.now:HOe,this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}var we;(function(n){n.None=()=>X.None;function e(P,V){return h(P,()=>{},0,void 0,!0,void 0,V)}n.defer=e;function t(P){return(V,O=null,A)=>{let z=!1,U;return U=P(B=>{if(!z)return U?U.dispose():z=!0,V.call(O,B)},null,A),z&&U.dispose(),U}}n.once=t;function i(P,V){return n.once(n.filter(P,V))}n.onceIf=i;function s(P,V,O){return d((A,z=null,U)=>P(B=>A.call(z,V(B)),null,U),O)}n.map=s;function o(P,V,O){return d((A,z=null,U)=>P(B=>{V(B),A.call(z,B)},null,U),O)}n.forEach=o;function r(P,V,O){return d((A,z=null,U)=>P(B=>V(B)&&A.call(z,B),null,U),O)}n.filter=r;function a(P){return P}n.signal=a;function l(...P){return(V,O=null,A)=>{const z=Dd(...P.map(U=>U(B=>V.call(O,B))));return u(z,A)}}n.any=l;function c(P,V,O,A){let z=O;return s(P,U=>(z=V(z,U),z),A)}n.reduce=c;function d(P,V){let O;const A={onWillAddFirstListener(){O=P(z.fire,z)},onDidRemoveLastListener(){O==null||O.dispose()}},z=new G(A);return V==null||V.add(z),z.event}function u(P,V){return V instanceof Array?V.push(P):V&&V.add(P),P}function h(P,V,O=100,A=!1,z=!1,U,B){let F,q,Y,Q=0,ne;const he={leakWarningThreshold:U,onWillAddFirstListener(){F=P(ze=>{Q++,q=V(q,ze),A&&!Y&&(Ce.fire(q),q=void 0),ne=()=>{const Oe=q;q=void 0,Y=void 0,(!A||Q>1)&&Ce.fire(Oe),Q=0},typeof O=="number"?(Y&&clearTimeout(Y),Y=setTimeout(ne,O)):Y===void 0&&(Y=null,queueMicrotask(ne))})},onWillRemoveListener(){z&&Q>0&&(ne==null||ne())},onDidRemoveLastListener(){ne=void 0,F.dispose()}},Ce=new G(he);return B==null||B.add(Ce),Ce.event}n.debounce=h;function f(P,V=0,O){return n.debounce(P,(A,z)=>A?(A.push(z),A):[z],V,void 0,!0,void 0,O)}n.accumulate=f;function g(P,V=(A,z)=>A===z,O){let A=!0,z;return r(P,U=>{const B=A||!V(U,z);return A=!1,z=U,B},O)}n.latch=g;function p(P,V,O){return[n.filter(P,V,O),n.filter(P,A=>!V(A),O)]}n.split=p;function _(P,V=!1,O=[],A){let z=O.slice(),U=P(q=>{z?z.push(q):F.fire(q)});A&&A.add(U);const B=()=>{z==null||z.forEach(q=>F.fire(q)),z=null},F=new G({onWillAddFirstListener(){U||(U=P(q=>F.fire(q)),A&&A.add(U))},onDidAddFirstListener(){z&&(V?setTimeout(B):B())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return A&&A.add(F),F.event}n.buffer=_;function b(P,V){return(A,z,U)=>{const B=V(new C);return P(function(F){const q=B.evaluate(F);q!==v&&A.call(z,q)},void 0,U)}}n.chain=b;const v=Symbol("HaltChainable");class C{constructor(){this.steps=[]}map(V){return this.steps.push(V),this}forEach(V){return this.steps.push(O=>(V(O),O)),this}filter(V){return this.steps.push(O=>V(O)?O:v),this}reduce(V,O){let A=O;return this.steps.push(z=>(A=V(A,z),A)),this}latch(V=(O,A)=>O===A){let O=!0,A;return this.steps.push(z=>{const U=O||!V(z,A);return O=!1,A=z,U?z:v}),this}evaluate(V){for(const O of this.steps)if(V=O(V),V===v)break;return V}}function y(P,V,O=A=>A){const A=(...F)=>B.fire(O(...F)),z=()=>P.on(V,A),U=()=>P.removeListener(V,A),B=new G({onWillAddFirstListener:z,onDidRemoveLastListener:U});return B.event}n.fromNodeEventEmitter=y;function S(P,V,O=A=>A){const A=(...F)=>B.fire(O(...F)),z=()=>P.addEventListener(V,A),U=()=>P.removeEventListener(V,A),B=new G({onWillAddFirstListener:z,onDidRemoveLastListener:U});return B.event}n.fromDOMEventEmitter=S;function x(P,V){let O;const A=new Promise((z,U)=>{const B=t(P)(z,null,V);O=()=>B.dispose()});return A.cancel=O,A}n.toPromise=x;function L(P,V){return P(O=>V.fire(O))}n.forward=L;function k(P,V,O){return V(O),P(A=>V(A))}n.runAndSubscribe=k;class N{constructor(V,O){this._observable=V,this._counter=0,this._hasChanged=!1;const A={onWillAddFirstListener:()=>{V.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{V.removeObserver(this)}};this.emitter=new G(A),O&&O.add(this.emitter)}beginUpdate(V){this._counter++}handlePossibleChange(V){}handleChange(V,O){this._hasChanged=!0}endUpdate(V){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function D(P,V){return new N(P,V).emitter.event}n.fromObservable=D;function M(P){return(V,O,A)=>{let z=0,U=!1;const B={beginUpdate(){z++},endUpdate(){z--,z===0&&(P.reportChanges(),U&&(U=!1,V.call(O)))},handlePossibleChange(){},handleChange(){U=!0}};P.addObserver(B),P.reportChanges();const F={dispose(){P.removeObserver(B)}};return A instanceof oe?A.add(F):Array.isArray(A)&&A.push(F),F}}n.fromObservableLight=M})(we||(we={}));const wy=class wy{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${wy._idPool++}`,wy.all.add(this)}start(e){this._stopWatch=new io,this.listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};wy.all=new Set,wy._idPool=0;let kH=wy,VOe=-1;const L5=class L5{constructor(e,t,i=(L5._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=i,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,t){const i=this.threshold;if(i<=0||t{const o=this._stacks.get(e.value)||0;this._stacks.set(e.value,o-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(const[i,s]of this._stacks)(!e||t{var a,l,c,d,u,h,f;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);const p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],m=new jOe(`${g}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((a=this._options)==null?void 0:a.onListenerError)||ht)(m),Z.None}if(this._disposed)return Z.None;t&&(e=e.bind(t));const s=new N6(e);let o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=cZ.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof N6?(this._deliveryQueue??(this._deliveryQueue=new Wme),this._listeners=[this._listeners,s]):this._listeners.push(s):((c=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||c.call(l,this),this._listeners=s,(u=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||u.call(d,this)),(f=(h=this._options)==null?void 0:h.onDidAddListener)==null||f.call(h,this),this._size++;const r=We(()=>{o==null||o(),this._removeListener(s)});return i instanceof se?i.add(r):Array.isArray(i)&&i.push(r),r}),this._event}_removeListener(e){var o,r,a,l;if((r=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||r.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||l.call(a,this),this._size=0;return}const t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;const s=this._deliveryQueue.current===this;if(this._size*zOe<=t.length){let c=0;for(let d=0;d0}};const $Oe=()=>new Wme;class Wme{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}class F0 extends G{constructor(e){super(e),this._isPaused=0,this._eventQueue=new Tr,this._mergeFn=e==null?void 0:e.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}}class Hme extends F0{constructor(e){super(e),this._delay=e.delay??100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}}class UOe extends G{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e==null?void 0:e.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(t=>super.fire(t)),this._queuedEvents=[]}))}}class qOe{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new G({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),We(O0(()=>{this.hasListeners&&this.unhook(t);const s=this.events.indexOf(t);this.events.splice(s,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){var t;(t=e.listener)==null||t.dispose(),e.listener=null}dispose(){var e;this.emitter.dispose();for(const t of this.events)(e=t.listener)==null||e.dispose();this.events=[]}}class eT{constructor(){this.data=[]}wrapEvent(e,t,i){return(s,o,r)=>e(a=>{const l=this.data[this.data.length-1];if(!t){l?l.buffers.push(()=>s.call(o,a)):s.call(o,a);return}const c=l;if(!c){s.call(o,t(i,a));return}c.items??(c.items=[]),c.items.push(a),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??(c.reducedResult=i?c.items.reduce(t,i):c.items.reduce(t)),s.call(o,c.reducedResult)})},void 0,r)}bufferEvents(e){const t={buffers:new Array};this.data.push(t);const i=e();return this.data.pop(),t.buffers.forEach(s=>s()),i}}class TL{constructor(){this.listening=!1,this.inputEvent=we.None,this.inputEventListener=Z.None,this.emitter=new G({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}const Nc=new class{constructor(){this._zoomLevel=0,this._onDidChangeZoomLevel=new G,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(n){n=Math.min(Math.max(-5,n),20),this._zoomLevel!==n&&(this._zoomLevel=n,this._onDidChangeZoomLevel.fire(this._zoomLevel))}},KOe=Pt?1.5:1.35,E6=8;class B0{static _create(e,t,i,s,o,r,a,l,c){r===0?r=KOe*i:r/?";function QOe(n=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(const t of dP)n.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}const dZ=QOe();function uZ(n){let e=dZ;if(n&&n instanceof RegExp)if(n.global)e=n;else{let t="g";n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.unicode&&(t+="u"),e=new RegExp(n.source,t)}return e.lastIndex=0,e}const zme=new Tr;zme.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function YE(n,e,t,i,s){if(e=uZ(e),s||(s=Ht.first(zme)),t.length>s.maxLen){let c=n-s.maxLen/2;return c<0?c=0:i+=c,t=t.substring(c,n+s.maxLen/2),YE(n,e,t,i,s)}const o=Date.now(),r=n-1-i;let a=-1,l=null;for(let c=1;!(Date.now()-o>=s.timeBudget);c++){const d=r-s.windowSize*c;e.lastIndex=Math.max(0,d);const u=JOe(e,t,r,a);if(!u&&l||(l=u,d<=0))break;a=d}if(l){const c={word:l[0],startColumn:i+1+l.index,endColumn:i+1+l.index+l[0].length};return e.lastIndex=0,c}return null}function JOe(n,e,t,i){let s;for(;s=n.exec(e);){const o=s.index||0;if(o<=t&&n.lastIndex>=t)return s;if(i>0&&o>i)return null}return null}const ph=8;class $me{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class Ume{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class yn{constructor(e,t,i,s){this.id=e,this.name=t,this.defaultValue=i,this.schema=s}applyUpdate(e,t){return $3(e,t)}compute(e,t,i){return i}}class nN{constructor(e,t){this.newValue=e,this.didChange=t}}function $3(n,e){if(typeof n!="object"||typeof e!="object"||!n||!e)return new nN(e,n!==e);if(Array.isArray(n)||Array.isArray(e)){const i=Array.isArray(n)&&Array.isArray(e)&&gn(n,e);return new nN(e,!i)}let t=!1;for(const i in e)if(e.hasOwnProperty(i)){const s=$3(n[i],e[i]);s.didChange&&(n[i]=s.newValue,t=!0)}return new nN(n,t)}class fb{constructor(e,t){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=t}applyUpdate(e,t){return $3(e,t)}validate(e){return this.defaultValue}}class $x{constructor(e,t,i,s){this.id=e,this.name=t,this.defaultValue=i,this.schema=s}applyUpdate(e,t){return $3(e,t)}compute(e,t,i){return i}}function Ge(n,e){return typeof n>"u"?e:n==="false"?!1:!!n}class Rt extends $x{constructor(e,t,i,s=void 0){typeof s<"u"&&(s.type="boolean",s.default=i),super(e,t,i,s)}validate(e){return Ge(e,this.defaultValue)}}function mg(n,e,t,i){if(typeof n=="string"&&(n=parseInt(n,10)),typeof n!="number"||isNaN(n))return e;let s=n;return s=Math.max(t,s),s=Math.min(i,s),s|0}class ki extends $x{static clampedInt(e,t,i,s){return mg(e,t,i,s)}constructor(e,t,i,s,o,r=void 0){typeof r<"u"&&(r.type="integer",r.default=i,r.minimum=s,r.maximum=o),super(e,t,i,r),this.minimum=s,this.maximum=o}validate(e){return ki.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}function e4e(n,e,t,i){if(typeof n>"u")return e;const s=Na.float(n,e);return Na.clamp(s,t,i)}class Na extends $x{static clamp(e,t,i){return ei?i:e}static float(e,t){return typeof e=="string"&&(e=parseFloat(e)),typeof e!="number"||isNaN(e)?t:e}constructor(e,t,i,s,o,r,a){typeof o<"u"&&(o.type="number",o.default=i,o.minimum=r,o.maximum=a),super(e,t,i,o),this.validationFn=s,this.minimum=r,this.maximum=a}validate(e){return this.validationFn(Na.float(e,this.defaultValue))}}class Nr extends $x{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,s=void 0){typeof s<"u"&&(s.type="string",s.default=i),super(e,t,i,s)}validate(e){return Nr.string(e,this.defaultValue)}}function nn(n,e,t,i){return typeof n!="string"?e:i&&n in i?i[n]:t.indexOf(n)===-1?e:n}class wn extends $x{constructor(e,t,i,s,o=void 0){typeof o<"u"&&(o.type="string",o.enum=s.slice(0),o.default=i),super(e,t,i,o),this._allowedValues=s}validate(e){return nn(e,this.defaultValue,this._allowedValues)}}class RL extends yn{constructor(e,t,i,s,o,r,a=void 0){typeof a<"u"&&(a.type="string",a.enum=o,a.default=s),super(e,t,i,a),this._allowedValues=o,this._convert=r}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}}function t4e(n){switch(n){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}class i4e extends yn{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[w(201,"Use platform APIs to detect when a Screen Reader is attached."),w(202,"Optimize for usage with a Screen Reader."),w(203,"Assume a screen reader is not attached.")],default:"auto",tags:["accessibility"],description:w(204,"Controls if the UI should run in a mode where it is optimized for screen readers.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return i===0?e.accessibilitySupport:i}}class n4e extends yn{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:w(205,"Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:w(206,"Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertSpace:Ge(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Ge(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}function s4e(n){switch(n){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var Gs;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(Gs||(Gs={}));function Cne(n){switch(n){case"line":return Gs.Line;case"block":return Gs.Block;case"underline":return Gs.Underline;case"line-thin":return Gs.LineThin;case"block-outline":return Gs.BlockOutline;case"underline-thin":return Gs.UnderlineThin}}class o4e extends fb{constructor(){super(162,"")}compute(e,t,i){const s=["monaco-editor"];return t.get(48)&&s.push(t.get(48)),e.extraEditorClassName&&s.push(e.extraEditorClassName),t.get(82)==="default"?s.push("mouse-default"):t.get(82)==="copy"&&s.push("mouse-copy"),t.get(127)&&s.push("showUnused"),t.get(157)&&s.push("showDeprecated"),s.join(" ")}}class r4e extends Rt{constructor(){super(45,"emptySelectionClipboard",!0,{description:w(207,"Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}class a4e extends yn{constructor(){const e={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,history:"workspace",replaceHistory:"workspace"};super(50,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:w(208,"Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[w(209,"Never seed search string from the editor selection."),w(210,"Always seed search string from the editor selection, including word at cursor position."),w(211,"Only seed search string from the editor selection.")],description:w(212,"Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[w(213,"Never turn on Find in Selection automatically (default)."),w(214,"Always turn on Find in Selection automatically."),w(215,"Turn on Find in Selection automatically when multiple lines of content are selected.")],description:w(216,"Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:w(217,"Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:Pt},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:w(218,"Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:w(219,"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[w(220,"Do not store search history from the find widget."),w(221,"Store search history across the active workspace")],description:w(222,"Controls how the find widget history should be stored")},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[w(223,"Do not store history from the replace widget."),w(224,"Store replace history across the active workspace")],description:w(225,"Controls how the replace widget history should be stored")},"editor.find.findOnType":{type:"boolean",default:e.findOnType,description:w(226,"Controls whether the Find Widget should search as you type.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{cursorMoveOnType:Ge(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:Ge(t.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof t.seedSearchStringFromSelection=="boolean"?t.seedSearchStringFromSelection?"always":"never":nn(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof t.autoFindInSelection=="boolean"?t.autoFindInSelection?"always":"never":nn(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Ge(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Ge(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Ge(t.loop,this.defaultValue.loop),history:nn(t.history,this.defaultValue.history,["never","workspace"]),replaceHistory:nn(t.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}}const dg=class dg extends yn{constructor(){super(60,"fontLigatures",dg.OFF,{anyOf:[{type:"boolean",description:w(227,"Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:w(228,"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:w(229,"Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"||e.length===0?dg.OFF:e==="true"?dg.ON:e:e?dg.ON:dg.OFF}};dg.OFF='"liga" off, "calt" off',dg.ON='"liga" on, "calt" on';let vp=dg;const ug=class ug extends yn{constructor(){super(63,"fontVariations",ug.OFF,{anyOf:[{type:"boolean",description:w(230,"Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.")},{type:"string",description:w(231,"Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")}],description:w(232,"Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"?ug.OFF:e==="true"?ug.TRANSLATE:e:e?ug.TRANSLATE:ug.OFF}compute(e,t,i){return e.fontInfo.fontVariationSettings}};ug.OFF=Vme,ug.TRANSLATE=jme;let EH=ug;class l4e extends fb{constructor(){super(59,new cP({pixelRatio:0,fontFamily:"",fontWeight:"",fontSize:0,fontFeatureSettings:"",fontVariationSettings:"",lineHeight:0,letterSpacing:0,isMonospace:!1,typicalHalfwidthCharacterWidth:0,typicalFullwidthCharacterWidth:0,canUseHalfwidthRightwardsArrow:!1,spaceWidth:0,middotWidth:0,wsmiddotWidth:0,maxDigitWidth:0},!1))}compute(e,t,i){return e.fontInfo}}class c4e extends fb{constructor(){super(161,Gs.Line)}compute(e,t,i){return e.inputMode==="overtype"?t.get(92):t.get(34)}}class d4e extends fb{constructor(){super(170,!1)}compute(e,t){return e.editContextSupported&&t.get(44)}}class u4e extends fb{constructor(){super(172,!1)}compute(e,t){return e.accessibilitySupport===2?t.get(7):t.get(6)}}class h4e extends $x{constructor(){super(61,"fontSize",Ia.fontSize,{type:"number",minimum:6,maximum:100,default:Ia.fontSize,description:w(233,"Controls the font size in pixels.")})}validate(e){const t=Na.float(e,this.defaultValue);return t===0?Ia.fontSize:Na.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}const Sh=class Sh extends yn{constructor(){super(62,"fontWeight",Ia.fontWeight,{anyOf:[{type:"number",minimum:Sh.MINIMUM_VALUE,maximum:Sh.MAXIMUM_VALUE,errorMessage:w(234,'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:Sh.SUGGESTION_VALUES}],default:Ia.fontWeight,description:w(235,'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(ki.clampedInt(e,Ia.fontWeight,Sh.MINIMUM_VALUE,Sh.MAXIMUM_VALUE))}};Sh.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"],Sh.MINIMUM_VALUE=1,Sh.MAXIMUM_VALUE=1e3;let IH=Sh;class f4e extends yn{constructor(){const e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[w(236,"Show Peek view of the results (default)"),w(237,"Go to the primary result and show a Peek view"),w(238,"Go to the primary result and enable Peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(67,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:w(239,"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":{description:w(240,"Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleTypeDefinitions":{description:w(241,"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleDeclarations":{description:w(242,"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleImplementations":{description:w(243,"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleReferences":{description:w(244,"Controls the behavior the 'Go to References'-command when multiple target locations exist."),...t},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:w(245,"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:w(246,"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:w(247,"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:w(248,"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:w(249,"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{multiple:nn(t.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:nn(t.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:nn(t.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:nn(t.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:nn(t.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:nn(t.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:nn(t.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:Nr.string(t.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:Nr.string(t.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:Nr.string(t.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:Nr.string(t.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:Nr.string(t.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:Nr.string(t.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}}class g4e extends yn{constructor(){const e={enabled:!0,delay:300,hidingDelay:300,sticky:!0,above:!0};super(69,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:w(250,"Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:w(251,"Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:w(252,"Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:e.hidingDelay,markdownDescription:w(253,"Controls the delay in milliseconds after which the hover is hidden. Requires `#editor.hover.sticky#` to be enabled.")},"editor.hover.above":{type:"boolean",default:e.above,description:w(254,"Prefer showing hovers above the line, if there's space.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Ge(t.enabled,this.defaultValue.enabled),delay:ki.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:Ge(t.sticky,this.defaultValue.sticky),hidingDelay:ki.clampedInt(t.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:Ge(t.above,this.defaultValue.above)}}}class Uy extends fb{constructor(){super(165,{width:0,height:0,glyphMarginLeft:0,glyphMarginWidth:0,glyphMarginDecorationLaneCount:0,lineNumbersLeft:0,lineNumbersWidth:0,decorationsLeft:0,decorationsWidth:0,contentLeft:0,contentWidth:0,minimap:{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:0,minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:0},viewportColumn:0,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1,verticalScrollbarWidth:0,horizontalScrollbarHeight:0,overviewRuler:{top:0,width:0,height:0,right:0}})}compute(e,t,i){return Uy.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(e){const t=e.height/e.lineHeight,i=Math.floor(e.paddingTop/e.lineHeight);let s=Math.floor(e.paddingBottom/e.lineHeight);e.scrollBeyondLastLine&&(s=Math.max(s,t-1));const o=(i+e.viewLineCount+s)/(e.pixelRatio*e.height),r=Math.floor(e.viewLineCount/o);return{typicalViewportLineCount:t,extraLinesBeforeFirstLine:i,extraLinesBeyondLastLine:s,desiredRatio:o,minimapLineCount:r}}static _computeMinimapLayout(e,t){const i=e.outerWidth,s=e.outerHeight,o=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(o*s),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:s};const r=t.stableMinimapLayoutInput,a=r&&e.outerHeight===r.outerHeight&&e.lineHeight===r.lineHeight&&e.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&e.pixelRatio===r.pixelRatio&&e.scrollBeyondLastLine===r.scrollBeyondLastLine&&e.paddingTop===r.paddingTop&&e.paddingBottom===r.paddingBottom&&e.minimap.enabled===r.minimap.enabled&&e.minimap.side===r.minimap.side&&e.minimap.size===r.minimap.size&&e.minimap.showSlider===r.minimap.showSlider&&e.minimap.renderCharacters===r.minimap.renderCharacters&&e.minimap.maxColumn===r.minimap.maxColumn&&e.minimap.scale===r.minimap.scale&&e.verticalScrollbarWidth===r.verticalScrollbarWidth&&e.isViewportWrapping===r.isViewportWrapping,l=e.lineHeight,c=e.typicalHalfwidthCharacterWidth,d=e.scrollBeyondLastLine,u=e.minimap.renderCharacters;let h=o>=2?Math.round(e.minimap.scale*2):e.minimap.scale;const f=e.minimap.maxColumn,g=e.minimap.size,p=e.minimap.side,m=e.verticalScrollbarWidth,b=e.viewLineCount,v=e.remainingWidth,C=e.isViewportWrapping,y=u?2:3;let S=Math.floor(o*s);const x=S/o;let L=!1,k=!1,N=y*h,T=h/o,M=1;if(g==="fill"||g==="fit"){const{typicalViewportLineCount:W,extraLinesBeforeFirstLine:F,extraLinesBeyondLastLine:q,desiredRatio:X,minimapLineCount:Q}=Uy.computeContainedMinimapLineCount({viewLineCount:b,scrollBeyondLastLine:d,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:s,lineHeight:l,pixelRatio:o});if(b/Q>1)L=!0,k=!0,h=1,N=1,T=h/o;else{let ge=!1,ye=h+1;if(g==="fit"){const $e=Math.ceil((F+b+q)*N);C&&a&&v<=t.stableFitRemainingWidth?(ge=!0,ye=t.stableFitMaxMinimapScale):ge=$e>S}if(g==="fill"||ge){L=!0;const $e=h;N=Math.min(l*o,Math.max(1,Math.floor(1/X))),C&&a&&v<=t.stableFitRemainingWidth&&(ye=t.stableFitMaxMinimapScale),h=Math.min(ye,Math.max(1,Math.floor(N/y))),h>$e&&(M=Math.min(2,h/$e)),T=h/o/M,S=Math.ceil(Math.max(W,F+b+q)*N),C?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=v,t.stableFitMaxMinimapScale=h):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const P=Math.floor(f*T),V=Math.min(P,Math.max(0,Math.floor((v-m-2)*T/(c+T)))+ph);let O=Math.floor(o*V);const A=O/o;O=Math.floor(O*M);const z=u?1:2,U=p==="left"?0:i-V-m;return{renderMinimap:z,minimapLeft:U,minimapWidth:V,minimapHeightIsEditorHeight:L,minimapIsSampling:k,minimapScale:h,minimapLineHeight:N,minimapCanvasInnerWidth:O,minimapCanvasInnerHeight:S,minimapCanvasOuterWidth:A,minimapCanvasOuterHeight:x}}static computeLayout(e,t){const i=t.outerWidth|0,s=t.outerHeight|0,o=t.lineHeight|0,r=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,l=t.maxDigitWidth,c=t.pixelRatio,d=t.viewLineCount,u=e.get(154),h=u==="inherit"?e.get(153):u,f=h==="inherit"?e.get(149):h,g=e.get(152),p=t.isDominatedByLongLines,m=e.get(66),b=e.get(76).renderType!==0,v=e.get(77),C=e.get(119),y=e.get(96),S=e.get(81),x=e.get(117),L=x.verticalScrollbarSize,k=x.verticalHasArrows,N=x.arrowSize,T=x.horizontalScrollbarSize,M=e.get(52),P=e.get(126)!=="never";let V=e.get(74);M&&P&&(V+=16);let O=0;if(b){const Ee=Math.max(r,v);O=Math.round(Ee*l)}let A=0;m&&(A=o*t.glyphMarginDecorationLaneCount);let z=0,U=z+A,W=U+O,F=W+V;const q=i-A-O-V;let X=!1,Q=!1,oe=-1;e.get(2)===2&&h==="inherit"&&p?(X=!0,Q=!0):f==="on"||f==="bounded"?Q=!0:f==="wordWrapColumn"&&(oe=g);const ge=Uy._computeMinimapLayout({outerWidth:i,outerHeight:s,lineHeight:o,typicalHalfwidthCharacterWidth:a,pixelRatio:c,scrollBeyondLastLine:C,paddingTop:y.top,paddingBottom:y.bottom,minimap:S,verticalScrollbarWidth:L,viewLineCount:d,remainingWidth:q,isViewportWrapping:Q},t.memory||new Ume);ge.renderMinimap!==0&&ge.minimapLeft===0&&(z+=ge.minimapWidth,U+=ge.minimapWidth,W+=ge.minimapWidth,F+=ge.minimapWidth);const ye=q-ge.minimapWidth,$e=Math.max(1,Math.floor((ye-L-2)/a)),Ze=k?N:0;return Q&&(oe=Math.max(1,$e),f==="bounded"&&(oe=Math.min(oe,g))),{width:i,height:s,glyphMarginLeft:z,glyphMarginWidth:A,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount,lineNumbersLeft:U,lineNumbersWidth:O,decorationsLeft:W,decorationsWidth:V,contentLeft:F,contentWidth:ye,minimap:ge,viewportColumn:$e,isWordWrapMinified:X,isViewportWrapping:Q,wrappingColumn:oe,verticalScrollbarWidth:L,horizontalScrollbarHeight:T,overviewRuler:{top:Ze,width:L,height:s-2*Ze,right:0}}}}class p4e extends yn{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[w(255,"Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),w(256,"Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],type:"string",enum:["simple","advanced"],default:"simple",description:w(257,"Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")}})}validate(e){return nn(e,"simple",["simple","advanced"])}compute(e,t,i){return t.get(2)===2?"advanced":i}}var bd;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(bd||(bd={}));class m4e extends yn{constructor(){const e={enabled:bd.OnCode};super(73,"lightbulb",e,{"editor.lightbulb.enabled":{type:"string",enum:[bd.Off,bd.OnCode,bd.On],default:e.enabled,enumDescriptions:[w(258,"Disable the code action menu."),w(259,"Show the code action menu when the cursor is on lines with code."),w(260,"Show the code action menu when the cursor is on lines with code or on empty lines.")],description:w(261,"Enables the Code Action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:nn(e.enabled,this.defaultValue.enabled,[bd.Off,bd.OnCode,bd.On])}}}class _4e extends yn{constructor(){const e={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",e,{"editor.stickyScroll.enabled":{type:"boolean",default:e.enabled,description:w(262,"Shows the nested current scopes during the scroll at the top of the editor.")},"editor.stickyScroll.maxLineCount":{type:"number",default:e.maxLineCount,minimum:1,maximum:20,description:w(263,"Defines the maximum number of sticky lines to show.")},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:e.defaultModel,description:w(264,"Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:e.scrollWithEditor,description:w(265,"Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Ge(t.enabled,this.defaultValue.enabled),maxLineCount:ki.clampedInt(t.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:nn(t.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:Ge(t.scrollWithEditor,this.defaultValue.scrollWithEditor)}}}class b4e extends yn{constructor(){const e={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",e,{"editor.inlayHints.enabled":{type:"string",default:e.enabled,description:w(266,"Enables the inlay hints in the editor."),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[w(267,"Inlay hints are enabled"),w(268,"Inlay hints are showing by default and hide when holding {0}",Pt?"Ctrl+Option":"Ctrl+Alt"),w(269,"Inlay hints are hidden by default and show when holding {0}",Pt?"Ctrl+Option":"Ctrl+Alt"),w(270,"Inlay hints are disabled")]},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:w(271,"Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.","`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:w(272,"Controls font family of inlay hints in the editor. When set to empty, the {0} is used.","`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:e.padding,description:w(273,"Enables the padding around the inlay hints in the editor.")},"editor.inlayHints.maximumLength":{type:"number",default:e.maximumLength,markdownDescription:w(274,"Maximum overall length of inlay hints, for a single line, before they get truncated by the editor. Set to `0` to never truncate")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return typeof t.enabled=="boolean"&&(t.enabled=t.enabled?"on":"off"),{enabled:nn(t.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:ki.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:Nr.string(t.fontFamily,this.defaultValue.fontFamily),padding:Ge(t.padding,this.defaultValue.padding),maximumLength:ki.clampedInt(t.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}}class v4e extends yn{constructor(){super(74,"lineDecorationsWidth",10)}validate(e){return typeof e=="string"&&/^\d+(\.\d+)?ch$/.test(e)?-parseFloat(e.substring(0,e.length-2)):ki.clampedInt(e,this.defaultValue,0,1e3)}compute(e,t,i){return i<0?ki.clampedInt(-i*e.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):i}}class w4e extends Na{constructor(){super(75,"lineHeight",Ia.lineHeight,e=>Na.clamp(e,0,150),{markdownDescription:w(275,`Controls the line height.
+`))}}class jOe extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}}class zOe extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}}class N6{constructor(e){this.value=e}}const $Oe=2;let G=class{constructor(e){var t,i,s,o;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new NH((e==null?void 0:e.onListenerError)??ht,((i=this._options)==null?void 0:i.leakWarningThreshold)??VOe):void 0,this._perfMon=(s=this._options)!=null&&s._profName?new kH(this._options._profName):void 0,this._deliveryQueue=(o=this._options)==null?void 0:o.deliveryQueue}dispose(){var e,t,i,s;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(i=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||i.call(t),(s=this._leakageMon)==null||s.dispose())}get event(){return this._event??(this._event=(e,t,i)=>{var a,l,c,d,u,h,f;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);const p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],_=new zOe(`${g}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(((a=this._options)==null?void 0:a.onListenerError)||ht)(_),X.None}if(this._disposed)return X.None;t&&(e=e.bind(t));const s=new N6(e);let o;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(s.stack=cZ.create(),o=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof N6?(this._deliveryQueue??(this._deliveryQueue=new Hme),this._listeners=[this._listeners,s]):this._listeners.push(s):((c=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||c.call(l,this),this._listeners=s,(u=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||u.call(d,this)),(f=(h=this._options)==null?void 0:h.onDidAddListener)==null||f.call(h,this),this._size++;const r=He(()=>{o==null||o(),this._removeListener(s)});return i instanceof oe?i.add(r):Array.isArray(i)&&i.push(r),r}),this._event}_removeListener(e){var o,r,a,l;if((r=(o=this._options)==null?void 0:o.onWillRemoveListener)==null||r.call(o,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||l.call(a,this),this._size=0;return}const t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;const s=this._deliveryQueue.current===this;if(this._size*$Oe<=t.length){let c=0;for(let d=0;d0}};const UOe=()=>new Hme;class Hme{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}class F0 extends G{constructor(e){super(e),this._isPaused=0,this._eventQueue=new Tr,this._mergeFn=e==null?void 0:e.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}}class Vme extends F0{constructor(e){super(e),this._delay=e.delay??100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}}class qOe extends G{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e==null?void 0:e.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(t=>super.fire(t)),this._queuedEvents=[]}))}}class KOe{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new G({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),He(O0(()=>{this.hasListeners&&this.unhook(t);const s=this.events.indexOf(t);this.events.splice(s,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){var t;(t=e.listener)==null||t.dispose(),e.listener=null}dispose(){var e;this.emitter.dispose();for(const t of this.events)(e=t.listener)==null||e.dispose();this.events=[]}}class eT{constructor(){this.data=[]}wrapEvent(e,t,i){return(s,o,r)=>e(a=>{const l=this.data[this.data.length-1];if(!t){l?l.buffers.push(()=>s.call(o,a)):s.call(o,a);return}const c=l;if(!c){s.call(o,t(i,a));return}c.items??(c.items=[]),c.items.push(a),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??(c.reducedResult=i?c.items.reduce(t,i):c.items.reduce(t)),s.call(o,c.reducedResult)})},void 0,r)}bufferEvents(e){const t={buffers:new Array};this.data.push(t);const i=e();return this.data.pop(),t.buffers.forEach(s=>s()),i}}class TL{constructor(){this.listening=!1,this.inputEvent=we.None,this.inputEventListener=X.None,this.emitter=new G({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}const Nc=new class{constructor(){this._zoomLevel=0,this._onDidChangeZoomLevel=new G,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(n){n=Math.min(Math.max(-5,n),20),this._zoomLevel!==n&&(this._zoomLevel=n,this._onDidChangeZoomLevel.fire(this._zoomLevel))}},GOe=Pt?1.5:1.35,E6=8;class B0{static _create(e,t,i,s,o,r,a,l,c){r===0?r=GOe*i:r/?";function JOe(n=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(const t of dP)n.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}const dZ=JOe();function uZ(n){let e=dZ;if(n&&n instanceof RegExp)if(n.global)e=n;else{let t="g";n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.unicode&&(t+="u"),e=new RegExp(n.source,t)}return e.lastIndex=0,e}const $me=new Tr;$me.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function YE(n,e,t,i,s){if(e=uZ(e),s||(s=Ht.first($me)),t.length>s.maxLen){let c=n-s.maxLen/2;return c<0?c=0:i+=c,t=t.substring(c,n+s.maxLen/2),YE(n,e,t,i,s)}const o=Date.now(),r=n-1-i;let a=-1,l=null;for(let c=1;!(Date.now()-o>=s.timeBudget);c++){const d=r-s.windowSize*c;e.lastIndex=Math.max(0,d);const u=e4e(e,t,r,a);if(!u&&l||(l=u,d<=0))break;a=d}if(l){const c={word:l[0],startColumn:i+1+l.index,endColumn:i+1+l.index+l[0].length};return e.lastIndex=0,c}return null}function e4e(n,e,t,i){let s;for(;s=n.exec(e);){const o=s.index||0;if(o<=t&&n.lastIndex>=t)return s;if(i>0&&o>i)return null}return null}const ph=8;class Ume{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class qme{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class yn{constructor(e,t,i,s){this.id=e,this.name=t,this.defaultValue=i,this.schema=s}applyUpdate(e,t){return $3(e,t)}compute(e,t,i){return i}}class nN{constructor(e,t){this.newValue=e,this.didChange=t}}function $3(n,e){if(typeof n!="object"||typeof e!="object"||!n||!e)return new nN(e,n!==e);if(Array.isArray(n)||Array.isArray(e)){const i=Array.isArray(n)&&Array.isArray(e)&&gn(n,e);return new nN(e,!i)}let t=!1;for(const i in e)if(e.hasOwnProperty(i)){const s=$3(n[i],e[i]);s.didChange&&(n[i]=s.newValue,t=!0)}return new nN(n,t)}class fb{constructor(e,t){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=t}applyUpdate(e,t){return $3(e,t)}validate(e){return this.defaultValue}}class $x{constructor(e,t,i,s){this.id=e,this.name=t,this.defaultValue=i,this.schema=s}applyUpdate(e,t){return $3(e,t)}compute(e,t,i){return i}}function Ze(n,e){return typeof n>"u"?e:n==="false"?!1:!!n}class Rt extends $x{constructor(e,t,i,s=void 0){typeof s<"u"&&(s.type="boolean",s.default=i),super(e,t,i,s)}validate(e){return Ze(e,this.defaultValue)}}function mg(n,e,t,i){if(typeof n=="string"&&(n=parseInt(n,10)),typeof n!="number"||isNaN(n))return e;let s=n;return s=Math.max(t,s),s=Math.min(i,s),s|0}class ki extends $x{static clampedInt(e,t,i,s){return mg(e,t,i,s)}constructor(e,t,i,s,o,r=void 0){typeof r<"u"&&(r.type="integer",r.default=i,r.minimum=s,r.maximum=o),super(e,t,i,r),this.minimum=s,this.maximum=o}validate(e){return ki.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}function t4e(n,e,t,i){if(typeof n>"u")return e;const s=Na.float(n,e);return Na.clamp(s,t,i)}class Na extends $x{static clamp(e,t,i){return ei?i:e}static float(e,t){return typeof e=="string"&&(e=parseFloat(e)),typeof e!="number"||isNaN(e)?t:e}constructor(e,t,i,s,o,r,a){typeof o<"u"&&(o.type="number",o.default=i,o.minimum=r,o.maximum=a),super(e,t,i,o),this.validationFn=s,this.minimum=r,this.maximum=a}validate(e){return this.validationFn(Na.float(e,this.defaultValue))}}class Nr extends $x{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,s=void 0){typeof s<"u"&&(s.type="string",s.default=i),super(e,t,i,s)}validate(e){return Nr.string(e,this.defaultValue)}}function nn(n,e,t,i){return typeof n!="string"?e:i&&n in i?i[n]:t.indexOf(n)===-1?e:n}class wn extends $x{constructor(e,t,i,s,o=void 0){typeof o<"u"&&(o.type="string",o.enum=s.slice(0),o.default=i),super(e,t,i,o),this._allowedValues=s}validate(e){return nn(e,this.defaultValue,this._allowedValues)}}class RL extends yn{constructor(e,t,i,s,o,r,a=void 0){typeof a<"u"&&(a.type="string",a.enum=o,a.default=s),super(e,t,i,a),this._allowedValues=o,this._convert=r}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}}function i4e(n){switch(n){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}class n4e extends yn{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[w(201,"Use platform APIs to detect when a Screen Reader is attached."),w(202,"Optimize for usage with a Screen Reader."),w(203,"Assume a screen reader is not attached.")],default:"auto",tags:["accessibility"],description:w(204,"Controls if the UI should run in a mode where it is optimized for screen readers.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return i===0?e.accessibilitySupport:i}}class s4e extends yn{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:w(205,"Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:w(206,"Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertSpace:Ze(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Ze(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}function o4e(n){switch(n){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var Gs;(function(n){n[n.Line=1]="Line",n[n.Block=2]="Block",n[n.Underline=3]="Underline",n[n.LineThin=4]="LineThin",n[n.BlockOutline=5]="BlockOutline",n[n.UnderlineThin=6]="UnderlineThin"})(Gs||(Gs={}));function Cne(n){switch(n){case"line":return Gs.Line;case"block":return Gs.Block;case"underline":return Gs.Underline;case"line-thin":return Gs.LineThin;case"block-outline":return Gs.BlockOutline;case"underline-thin":return Gs.UnderlineThin}}class r4e extends fb{constructor(){super(162,"")}compute(e,t,i){const s=["monaco-editor"];return t.get(48)&&s.push(t.get(48)),e.extraEditorClassName&&s.push(e.extraEditorClassName),t.get(82)==="default"?s.push("mouse-default"):t.get(82)==="copy"&&s.push("mouse-copy"),t.get(127)&&s.push("showUnused"),t.get(157)&&s.push("showDeprecated"),s.join(" ")}}class a4e extends Rt{constructor(){super(45,"emptySelectionClipboard",!0,{description:w(207,"Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}class l4e extends yn{constructor(){const e={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,history:"workspace",replaceHistory:"workspace"};super(50,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:w(208,"Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[w(209,"Never seed search string from the editor selection."),w(210,"Always seed search string from the editor selection, including word at cursor position."),w(211,"Only seed search string from the editor selection.")],description:w(212,"Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[w(213,"Never turn on Find in Selection automatically (default)."),w(214,"Always turn on Find in Selection automatically."),w(215,"Turn on Find in Selection automatically when multiple lines of content are selected.")],description:w(216,"Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:w(217,"Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:Pt},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:w(218,"Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:w(219,"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[w(220,"Do not store search history from the find widget."),w(221,"Store search history across the active workspace")],description:w(222,"Controls how the find widget history should be stored")},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[w(223,"Do not store history from the replace widget."),w(224,"Store replace history across the active workspace")],description:w(225,"Controls how the replace widget history should be stored")},"editor.find.findOnType":{type:"boolean",default:e.findOnType,description:w(226,"Controls whether the Find Widget should search as you type.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{cursorMoveOnType:Ze(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:Ze(t.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof t.seedSearchStringFromSelection=="boolean"?t.seedSearchStringFromSelection?"always":"never":nn(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof t.autoFindInSelection=="boolean"?t.autoFindInSelection?"always":"never":nn(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Ze(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Ze(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Ze(t.loop,this.defaultValue.loop),history:nn(t.history,this.defaultValue.history,["never","workspace"]),replaceHistory:nn(t.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}}const dg=class dg extends yn{constructor(){super(60,"fontLigatures",dg.OFF,{anyOf:[{type:"boolean",description:w(227,"Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:w(228,"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:w(229,"Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"||e.length===0?dg.OFF:e==="true"?dg.ON:e:e?dg.ON:dg.OFF}};dg.OFF='"liga" off, "calt" off',dg.ON='"liga" on, "calt" on';let vp=dg;const ug=class ug extends yn{constructor(){super(63,"fontVariations",ug.OFF,{anyOf:[{type:"boolean",description:w(230,"Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.")},{type:"string",description:w(231,"Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")}],description:w(232,"Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"?ug.OFF:e==="true"?ug.TRANSLATE:e:e?ug.TRANSLATE:ug.OFF}compute(e,t,i){return e.fontInfo.fontVariationSettings}};ug.OFF=jme,ug.TRANSLATE=zme;let EH=ug;class c4e extends fb{constructor(){super(59,new cP({pixelRatio:0,fontFamily:"",fontWeight:"",fontSize:0,fontFeatureSettings:"",fontVariationSettings:"",lineHeight:0,letterSpacing:0,isMonospace:!1,typicalHalfwidthCharacterWidth:0,typicalFullwidthCharacterWidth:0,canUseHalfwidthRightwardsArrow:!1,spaceWidth:0,middotWidth:0,wsmiddotWidth:0,maxDigitWidth:0},!1))}compute(e,t,i){return e.fontInfo}}class d4e extends fb{constructor(){super(161,Gs.Line)}compute(e,t,i){return e.inputMode==="overtype"?t.get(92):t.get(34)}}class u4e extends fb{constructor(){super(170,!1)}compute(e,t){return e.editContextSupported&&t.get(44)}}class h4e extends fb{constructor(){super(172,!1)}compute(e,t){return e.accessibilitySupport===2?t.get(7):t.get(6)}}class f4e extends $x{constructor(){super(61,"fontSize",Ia.fontSize,{type:"number",minimum:6,maximum:100,default:Ia.fontSize,description:w(233,"Controls the font size in pixels.")})}validate(e){const t=Na.float(e,this.defaultValue);return t===0?Ia.fontSize:Na.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}const Sh=class Sh extends yn{constructor(){super(62,"fontWeight",Ia.fontWeight,{anyOf:[{type:"number",minimum:Sh.MINIMUM_VALUE,maximum:Sh.MAXIMUM_VALUE,errorMessage:w(234,'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:Sh.SUGGESTION_VALUES}],default:Ia.fontWeight,description:w(235,'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(ki.clampedInt(e,Ia.fontWeight,Sh.MINIMUM_VALUE,Sh.MAXIMUM_VALUE))}};Sh.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"],Sh.MINIMUM_VALUE=1,Sh.MAXIMUM_VALUE=1e3;let IH=Sh;class g4e extends yn{constructor(){const e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[w(236,"Show Peek view of the results (default)"),w(237,"Go to the primary result and show a Peek view"),w(238,"Go to the primary result and enable Peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(67,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:w(239,"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":{description:w(240,"Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleTypeDefinitions":{description:w(241,"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleDeclarations":{description:w(242,"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleImplementations":{description:w(243,"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleReferences":{description:w(244,"Controls the behavior the 'Go to References'-command when multiple target locations exist."),...t},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:w(245,"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:w(246,"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:w(247,"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:w(248,"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:w(249,"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{multiple:nn(t.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:nn(t.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:nn(t.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:nn(t.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:nn(t.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:nn(t.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:nn(t.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:Nr.string(t.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:Nr.string(t.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:Nr.string(t.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:Nr.string(t.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:Nr.string(t.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:Nr.string(t.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}}class p4e extends yn{constructor(){const e={enabled:!0,delay:300,hidingDelay:300,sticky:!0,above:!0};super(69,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:w(250,"Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:w(251,"Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:w(252,"Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:e.hidingDelay,markdownDescription:w(253,"Controls the delay in milliseconds after which the hover is hidden. Requires `#editor.hover.sticky#` to be enabled.")},"editor.hover.above":{type:"boolean",default:e.above,description:w(254,"Prefer showing hovers above the line, if there's space.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Ze(t.enabled,this.defaultValue.enabled),delay:ki.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:Ze(t.sticky,this.defaultValue.sticky),hidingDelay:ki.clampedInt(t.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:Ze(t.above,this.defaultValue.above)}}}class Uy extends fb{constructor(){super(165,{width:0,height:0,glyphMarginLeft:0,glyphMarginWidth:0,glyphMarginDecorationLaneCount:0,lineNumbersLeft:0,lineNumbersWidth:0,decorationsLeft:0,decorationsWidth:0,contentLeft:0,contentWidth:0,minimap:{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:0,minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:0},viewportColumn:0,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1,verticalScrollbarWidth:0,horizontalScrollbarHeight:0,overviewRuler:{top:0,width:0,height:0,right:0}})}compute(e,t,i){return Uy.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(e){const t=e.height/e.lineHeight,i=Math.floor(e.paddingTop/e.lineHeight);let s=Math.floor(e.paddingBottom/e.lineHeight);e.scrollBeyondLastLine&&(s=Math.max(s,t-1));const o=(i+e.viewLineCount+s)/(e.pixelRatio*e.height),r=Math.floor(e.viewLineCount/o);return{typicalViewportLineCount:t,extraLinesBeforeFirstLine:i,extraLinesBeyondLastLine:s,desiredRatio:o,minimapLineCount:r}}static _computeMinimapLayout(e,t){const i=e.outerWidth,s=e.outerHeight,o=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(o*s),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:s};const r=t.stableMinimapLayoutInput,a=r&&e.outerHeight===r.outerHeight&&e.lineHeight===r.lineHeight&&e.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&e.pixelRatio===r.pixelRatio&&e.scrollBeyondLastLine===r.scrollBeyondLastLine&&e.paddingTop===r.paddingTop&&e.paddingBottom===r.paddingBottom&&e.minimap.enabled===r.minimap.enabled&&e.minimap.side===r.minimap.side&&e.minimap.size===r.minimap.size&&e.minimap.showSlider===r.minimap.showSlider&&e.minimap.renderCharacters===r.minimap.renderCharacters&&e.minimap.maxColumn===r.minimap.maxColumn&&e.minimap.scale===r.minimap.scale&&e.verticalScrollbarWidth===r.verticalScrollbarWidth&&e.isViewportWrapping===r.isViewportWrapping,l=e.lineHeight,c=e.typicalHalfwidthCharacterWidth,d=e.scrollBeyondLastLine,u=e.minimap.renderCharacters;let h=o>=2?Math.round(e.minimap.scale*2):e.minimap.scale;const f=e.minimap.maxColumn,g=e.minimap.size,p=e.minimap.side,_=e.verticalScrollbarWidth,b=e.viewLineCount,v=e.remainingWidth,C=e.isViewportWrapping,y=u?2:3;let S=Math.floor(o*s);const x=S/o;let L=!1,k=!1,N=y*h,D=h/o,M=1;if(g==="fill"||g==="fit"){const{typicalViewportLineCount:B,extraLinesBeforeFirstLine:F,extraLinesBeyondLastLine:q,desiredRatio:Y,minimapLineCount:Q}=Uy.computeContainedMinimapLineCount({viewLineCount:b,scrollBeyondLastLine:d,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:s,lineHeight:l,pixelRatio:o});if(b/Q>1)L=!0,k=!0,h=1,N=1,D=h/o;else{let he=!1,Ce=h+1;if(g==="fit"){const ze=Math.ceil((F+b+q)*N);C&&a&&v<=t.stableFitRemainingWidth?(he=!0,Ce=t.stableFitMaxMinimapScale):he=ze>S}if(g==="fill"||he){L=!0;const ze=h;N=Math.min(l*o,Math.max(1,Math.floor(1/Y))),C&&a&&v<=t.stableFitRemainingWidth&&(Ce=t.stableFitMaxMinimapScale),h=Math.min(Ce,Math.max(1,Math.floor(N/y))),h>ze&&(M=Math.min(2,h/ze)),D=h/o/M,S=Math.ceil(Math.max(B,F+b+q)*N),C?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=v,t.stableFitMaxMinimapScale=h):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const P=Math.floor(f*D),V=Math.min(P,Math.max(0,Math.floor((v-_-2)*D/(c+D)))+ph);let O=Math.floor(o*V);const A=O/o;O=Math.floor(O*M);const z=u?1:2,U=p==="left"?0:i-V-_;return{renderMinimap:z,minimapLeft:U,minimapWidth:V,minimapHeightIsEditorHeight:L,minimapIsSampling:k,minimapScale:h,minimapLineHeight:N,minimapCanvasInnerWidth:O,minimapCanvasInnerHeight:S,minimapCanvasOuterWidth:A,minimapCanvasOuterHeight:x}}static computeLayout(e,t){const i=t.outerWidth|0,s=t.outerHeight|0,o=t.lineHeight|0,r=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,l=t.maxDigitWidth,c=t.pixelRatio,d=t.viewLineCount,u=e.get(154),h=u==="inherit"?e.get(153):u,f=h==="inherit"?e.get(149):h,g=e.get(152),p=t.isDominatedByLongLines,_=e.get(66),b=e.get(76).renderType!==0,v=e.get(77),C=e.get(119),y=e.get(96),S=e.get(81),x=e.get(117),L=x.verticalScrollbarSize,k=x.verticalHasArrows,N=x.arrowSize,D=x.horizontalScrollbarSize,M=e.get(52),P=e.get(126)!=="never";let V=e.get(74);M&&P&&(V+=16);let O=0;if(b){const Se=Math.max(r,v);O=Math.round(Se*l)}let A=0;_&&(A=o*t.glyphMarginDecorationLaneCount);let z=0,U=z+A,B=U+O,F=B+V;const q=i-A-O-V;let Y=!1,Q=!1,ne=-1;e.get(2)===2&&h==="inherit"&&p?(Y=!0,Q=!0):f==="on"||f==="bounded"?Q=!0:f==="wordWrapColumn"&&(ne=g);const he=Uy._computeMinimapLayout({outerWidth:i,outerHeight:s,lineHeight:o,typicalHalfwidthCharacterWidth:a,pixelRatio:c,scrollBeyondLastLine:C,paddingTop:y.top,paddingBottom:y.bottom,minimap:S,verticalScrollbarWidth:L,viewLineCount:d,remainingWidth:q,isViewportWrapping:Q},t.memory||new qme);he.renderMinimap!==0&&he.minimapLeft===0&&(z+=he.minimapWidth,U+=he.minimapWidth,B+=he.minimapWidth,F+=he.minimapWidth);const Ce=q-he.minimapWidth,ze=Math.max(1,Math.floor((Ce-L-2)/a)),Oe=k?N:0;return Q&&(ne=Math.max(1,ze),f==="bounded"&&(ne=Math.min(ne,g))),{width:i,height:s,glyphMarginLeft:z,glyphMarginWidth:A,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount,lineNumbersLeft:U,lineNumbersWidth:O,decorationsLeft:B,decorationsWidth:V,contentLeft:F,contentWidth:Ce,minimap:he,viewportColumn:ze,isWordWrapMinified:Y,isViewportWrapping:Q,wrappingColumn:ne,verticalScrollbarWidth:L,horizontalScrollbarHeight:D,overviewRuler:{top:Oe,width:L,height:s-2*Oe,right:0}}}}class m4e extends yn{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[w(255,"Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),w(256,"Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],type:"string",enum:["simple","advanced"],default:"simple",description:w(257,"Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")}})}validate(e){return nn(e,"simple",["simple","advanced"])}compute(e,t,i){return t.get(2)===2?"advanced":i}}var bd;(function(n){n.Off="off",n.OnCode="onCode",n.On="on"})(bd||(bd={}));class _4e extends yn{constructor(){const e={enabled:bd.OnCode};super(73,"lightbulb",e,{"editor.lightbulb.enabled":{type:"string",enum:[bd.Off,bd.OnCode,bd.On],default:e.enabled,enumDescriptions:[w(258,"Disable the code action menu."),w(259,"Show the code action menu when the cursor is on lines with code."),w(260,"Show the code action menu when the cursor is on lines with code or on empty lines.")],description:w(261,"Enables the Code Action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:nn(e.enabled,this.defaultValue.enabled,[bd.Off,bd.OnCode,bd.On])}}}class b4e extends yn{constructor(){const e={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",e,{"editor.stickyScroll.enabled":{type:"boolean",default:e.enabled,description:w(262,"Shows the nested current scopes during the scroll at the top of the editor.")},"editor.stickyScroll.maxLineCount":{type:"number",default:e.maxLineCount,minimum:1,maximum:20,description:w(263,"Defines the maximum number of sticky lines to show.")},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:e.defaultModel,description:w(264,"Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:e.scrollWithEditor,description:w(265,"Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:Ze(t.enabled,this.defaultValue.enabled),maxLineCount:ki.clampedInt(t.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:nn(t.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:Ze(t.scrollWithEditor,this.defaultValue.scrollWithEditor)}}}class v4e extends yn{constructor(){const e={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",e,{"editor.inlayHints.enabled":{type:"string",default:e.enabled,description:w(266,"Enables the inlay hints in the editor."),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[w(267,"Inlay hints are enabled"),w(268,"Inlay hints are showing by default and hide when holding {0}",Pt?"Ctrl+Option":"Ctrl+Alt"),w(269,"Inlay hints are hidden by default and show when holding {0}",Pt?"Ctrl+Option":"Ctrl+Alt"),w(270,"Inlay hints are disabled")]},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:w(271,"Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.","`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:w(272,"Controls font family of inlay hints in the editor. When set to empty, the {0} is used.","`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:e.padding,description:w(273,"Enables the padding around the inlay hints in the editor.")},"editor.inlayHints.maximumLength":{type:"number",default:e.maximumLength,markdownDescription:w(274,"Maximum overall length of inlay hints, for a single line, before they get truncated by the editor. Set to `0` to never truncate")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return typeof t.enabled=="boolean"&&(t.enabled=t.enabled?"on":"off"),{enabled:nn(t.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:ki.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:Nr.string(t.fontFamily,this.defaultValue.fontFamily),padding:Ze(t.padding,this.defaultValue.padding),maximumLength:ki.clampedInt(t.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}}class w4e extends yn{constructor(){super(74,"lineDecorationsWidth",10)}validate(e){return typeof e=="string"&&/^\d+(\.\d+)?ch$/.test(e)?-parseFloat(e.substring(0,e.length-2)):ki.clampedInt(e,this.defaultValue,0,1e3)}compute(e,t,i){return i<0?ki.clampedInt(-i*e.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):i}}class C4e extends Na{constructor(){super(75,"lineHeight",Ia.lineHeight,e=>Na.clamp(e,0,150),{markdownDescription:w(275,`Controls the line height.
- Use 0 to automatically compute the line height from the font size.
- Values between 0 and 8 will be used as a multiplier with the font size.
- - Values greater than or equal to 8 will be used as effective values.`)},0,150)}compute(e,t,i){return e.fontInfo.lineHeight}}class C4e extends yn{constructor(){const e={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:"none",renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,markSectionHeaderRegex:"\\bMARK:\\s*(?-?)\\s*(?