@linkdlab/funcnodes_react_flow 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/funcnodes_react_flow.css +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +19 -20
- package/dist/index.umd.js +6 -6
- package/package.json +89 -89
package/dist/index.umd.js
CHANGED
|
@@ -416,7 +416,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
|
|
|
416
416
|
animation-iteration-count: infinite;
|
|
417
417
|
animation-delay: 200ms;
|
|
418
418
|
}
|
|
419
|
-
`,C3=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiTouchRipple"}),{center:a=!1,classes:l={},className:u,...d}=r,[h,m]=z.useState([]),y=z.useRef(0),v=z.useRef(null);z.useEffect(()=>{v.current&&(v.current(),v.current=null)},[h]);const S=z.useRef(!1),w=s$(),A=z.useRef(null),E=z.useRef(null),k=z.useCallback(I=>{const{pulsate:L,rippleX:P,rippleY:G,rippleSize:$,cb:Z}=I;m(j=>[...j,T.jsx(p$,{classes:{ripple:ar(l.ripple,pi.ripple),rippleVisible:ar(l.rippleVisible,pi.rippleVisible),ripplePulsate:ar(l.ripplePulsate,pi.ripplePulsate),child:ar(l.child,pi.child),childLeaving:ar(l.childLeaving,pi.childLeaving),childPulsate:ar(l.childPulsate,pi.childPulsate)},timeout:P_,pulsate:L,rippleX:P,rippleY:G,rippleSize:$},y.current)]),y.current+=1,v.current=Z},[l]),R=z.useCallback((I={},L={},P=()=>{})=>{const{pulsate:G=!1,center:$=a||L.pulsate,fakeElement:Z=!1}=L;if(I?.type==="mousedown"&&S.current){S.current=!1;return}I?.type==="touchstart"&&(S.current=!0);const j=Z?null:E.current,X=j?j.getBoundingClientRect():{width:0,height:0,left:0,top:0};let ee,ae,U;if($||I===void 0||I.clientX===0&&I.clientY===0||!I.clientX&&!I.touches)ee=Math.round(X.width/2),ae=Math.round(X.height/2);else{const{clientX:te,clientY:V}=I.touches&&I.touches.length>0?I.touches[0]:I;ee=Math.round(te-X.left),ae=Math.round(V-X.top)}if($)U=Math.sqrt((2*X.width**2+X.height**2)/3),U%2===0&&(U+=1);else{const te=Math.max(Math.abs((j?j.clientWidth:0)-ee),ee)*2+2,V=Math.max(Math.abs((j?j.clientHeight:0)-ae),ae)*2+2;U=Math.sqrt(te**2+V**2)}I?.touches?A.current===null&&(A.current=()=>{k({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},w.start(u$,()=>{A.current&&(A.current(),A.current=null)})):k({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},[a,k,w]),D=z.useCallback(()=>{R({},{pulsate:!0})},[R]),M=z.useCallback((I,L)=>{if(w.clear(),I?.type==="touchend"&&A.current){A.current(),A.current=null,w.start(0,()=>{M(I,L)});return}A.current=null,m(P=>P.length>0?P.slice(1):P),v.current=L},[w]);return z.useImperativeHandle(n,()=>({pulsate:D,start:R,stop:M}),[D,R,M]),T.jsx(h$,{className:ar(pi.root,l.root,u),ref:E,...d,children:T.jsx(B_,{component:null,exit:!0,children:h})})});process.env.NODE_ENV!=="production"&&(C3.propTypes={center:ie.bool,classes:ie.object,className:ie.string});function m$(e){return gl("MuiButtonBase",e)}const g$=hs("MuiButtonBase",["root","disabled","focusVisible"]),y$=e=>{const{disabled:t,focusVisible:n,focusVisibleClassName:r,classes:a}=e,u=_u({root:["root",t&&"disabled",n&&"focusVisible"]},m$,a);return n&&r&&(u.root+=` ${r}`),u},v$=hi("button",{name:"MuiButtonBase",slot:"Root"})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${g$.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),_3=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiButtonBase"}),{action:a,centerRipple:l=!1,children:u,className:d,component:h="button",disabled:m=!1,disableRipple:y=!1,disableTouchRipple:v=!1,focusRipple:S=!1,focusVisibleClassName:w,LinkComponent:A="a",onBlur:E,onClick:k,onContextMenu:R,onDragLeave:D,onFocus:M,onFocusVisible:I,onKeyDown:L,onKeyUp:P,onMouseDown:G,onMouseLeave:$,onMouseUp:Z,onTouchEnd:j,onTouchMove:X,onTouchStart:ee,tabIndex:ae=0,TouchRippleProps:U,touchRippleRef:te,type:V,...W}=r,Q=z.useRef(null),ne=KU(),B=I_(ne.ref,te),[oe,se]=z.useState(!1);m&&oe&&se(!1),z.useImperativeHandle(a,()=>({focusVisible:()=>{se(!0),Q.current.focus()}}),[]);const Y=ne.shouldMount&&!y&&!m;z.useEffect(()=>{oe&&S&&!y&&ne.pulsate()},[y,S,oe,ne]);const he=Ru(ne,"start",G,v),ke=Ru(ne,"stop",R,v),me=Ru(ne,"stop",D,v),Ee=Ru(ne,"stop",Z,v),xe=Ru(ne,"stop",ut=>{oe&&ut.preventDefault(),$&&$(ut)},v),Be=Ru(ne,"start",ee,v),He=Ru(ne,"stop",j,v),Ye=Ru(ne,"stop",X,v),Re=Ru(ne,"stop",ut=>{y3(ut.target)||se(!1),E&&E(ut)},!1),Xe=RS(ut=>{Q.current||(Q.current=ut.currentTarget),y3(ut.target)&&(se(!0),I&&I(ut)),M&&M(ut)}),We=()=>{const ut=Q.current;return h&&h!=="button"&&!(ut.tagName==="A"&&ut.href)},At=RS(ut=>{S&&!ut.repeat&&oe&&ut.key===" "&&ne.stop(ut,()=>{ne.start(ut)}),ut.target===ut.currentTarget&&We()&&ut.key===" "&&ut.preventDefault(),L&&L(ut),ut.target===ut.currentTarget&&We()&&ut.key==="Enter"&&!m&&(ut.preventDefault(),k&&k(ut))}),Kt=RS(ut=>{S&&ut.key===" "&&oe&&!ut.defaultPrevented&&ne.stop(ut,()=>{ne.pulsate(ut)}),P&&P(ut),k&&ut.target===ut.currentTarget&&We()&&ut.key===" "&&!ut.defaultPrevented&&k(ut)});let qt=h;qt==="button"&&(W.href||W.to)&&(qt=A);const er={};qt==="button"?(er.type=V===void 0?"button":V,er.disabled=m):(!W.href&&!W.to&&(er.role="button"),m&&(er["aria-disabled"]=m));const da=I_(n,Q),xo={...r,centerRipple:l,component:h,disabled:m,disableRipple:y,disableTouchRipple:v,focusRipple:S,tabIndex:ae,focusVisible:oe},So=y$(xo);return T.jsxs(v$,{as:qt,className:ar(So.root,d),ownerState:xo,onBlur:Re,onClick:k,onContextMenu:ke,onFocus:Xe,onKeyDown:At,onKeyUp:Kt,onMouseDown:he,onMouseLeave:xe,onMouseUp:Ee,onDragLeave:me,onTouchEnd:He,onTouchMove:Ye,onTouchStart:Be,ref:da,tabIndex:m?-1:ae,type:V,...er,...W,children:[u,Y?T.jsx(C3,{ref:B,center:l,...U}):null]})});function Ru(e,t,n,r=!1){return RS(a=>(n&&n(a),r||e[t](a),!0))}process.env.NODE_ENV!=="production"&&(_3.propTypes={action:ZU,centerRipple:ie.bool,children:ie.node,classes:ie.object,className:ie.string,component:QU,disabled:ie.bool,disableRipple:ie.bool,disableTouchRipple:ie.bool,focusRipple:ie.bool,focusVisibleClassName:ie.string,href:ie.any,LinkComponent:ie.elementType,onBlur:ie.func,onClick:ie.func,onContextMenu:ie.func,onDragLeave:ie.func,onFocus:ie.func,onFocusVisible:ie.func,onKeyDown:ie.func,onKeyUp:ie.func,onMouseDown:ie.func,onMouseLeave:ie.func,onMouseUp:ie.func,onTouchEnd:ie.func,onTouchMove:ie.func,onTouchStart:ie.func,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),tabIndex:ie.number,TouchRippleProps:ie.object,touchRippleRef:ie.oneOfType([ie.func,ie.shape({current:ie.shape({pulsate:ie.func.isRequired,start:ie.func.isRequired,stop:ie.func.isRequired})})]),type:ie.oneOfType([ie.oneOf(["button","reset","submit"]),ie.string])});function b$(e){return gl("MuiSvgIcon",e)}hs("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const x$=e=>{const{color:t,fontSize:n,classes:r}=e,a={root:["root",t!=="inherit"&&`color${fo(t)}`,`fontSize${fo(n)}`]};return _u(a,b$,r)},S$=hi("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${fo(n.color)}`],t[`fontSize${fo(n.fontSize)}`]]}})(fm(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),NS=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiSvgIcon"}),{children:a,className:l,color:u="inherit",component:d="svg",fontSize:h="medium",htmlColor:m,inheritViewBox:y=!1,titleAccess:v,viewBox:S="0 0 24 24",...w}=r,A=z.isValidElement(a)&&a.type==="svg",E={...r,color:u,component:d,fontSize:h,instanceFontSize:t.fontSize,inheritViewBox:y,viewBox:S,hasSvgAsChild:A},k={};y||(k.viewBox=S);const R=x$(E);return T.jsxs(S$,{as:d,className:ar(R.root,l),focusable:"false",color:m,"aria-hidden":v?void 0:!0,role:v?"img":void 0,ref:n,...k,...w,...A&&a.props,ownerState:E,children:[A?a.props.children:a,v?T.jsx("title",{children:v}):null]})});process.env.NODE_ENV!=="production"&&(NS.propTypes={children:ie.node,classes:ie.object,className:ie.string,color:ie.oneOfType([ie.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),ie.string]),component:ie.elementType,fontSize:ie.oneOfType([ie.oneOf(["inherit","large","medium","small"]),ie.string]),htmlColor:ie.string,inheritViewBox:ie.bool,shapeRendering:ie.string,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),titleAccess:ie.string,viewBox:ie.string}),NS.muiName="SvgIcon";function w$(e,t){function n(r,a){return T.jsx(NS,{"data-testid":process.env.NODE_ENV!=="production"?`${t}Icon`:void 0,ref:a,...r,children:e})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=NS.muiName,z.memo(z.forwardRef(n))}const E$=w$(T.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function C$(e){return gl("MuiTableSortLabel",e)}const H_=hs("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]);function _$(e){return typeof e=="string"}function A$(e,t,n){return e===void 0||_$(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function T$(e,t,n){return typeof e=="function"?e(t,n):e}function k$(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function A3(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function R$(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:a,className:l}=e;if(!t){const w=ar(n?.className,l,a?.className,r?.className),A={...n?.style,...a?.style,...r?.style},E={...n,...a,...r};return w.length>0&&(E.className=w),Object.keys(A).length>0&&(E.style=A),{props:E,internalRef:void 0}}const u=k$({...a,...r}),d=A3(r),h=A3(a),m=t(u),y=ar(m?.className,n?.className,l,a?.className,r?.className),v={...m?.style,...n?.style,...a?.style,...r?.style},S={...m,...n,...h,...d};return y.length>0&&(S.className=y),Object.keys(v).length>0&&(S.style=v),{props:S,internalRef:m.ref}}function T3(e,t){const{className:n,elementType:r,ownerState:a,externalForwardedProps:l,internalForwardedProps:u,shouldForwardComponentProp:d=!1,...h}=t,{component:m,slots:y={[e]:void 0},slotProps:v={[e]:void 0},...S}=l,w=y[e]||r,A=T$(v[e],a),{props:{component:E,...k},internalRef:R}=R$({className:n,...h,externalForwardedProps:e==="root"?S:void 0,externalSlotProps:A}),D=I_(R,A?.ref,t.ref),M=e==="root"?E||m:E,I=A$(w,{...e==="root"&&!m&&!y[e]&&u,...e!=="root"&&!y[e]&&u,...k,...M&&!d&&{as:M},...M&&d&&{component:M},ref:D},a);return[w,I]}const O$=e=>{const{classes:t,direction:n,active:r}=e,a={root:["root",r&&"active",`direction${fo(n)}`],icon:["icon",`iconDirection${fo(n)}`]};return _u(a,C$,t)},M$=hi(_3,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.active&&t.active]}})(fm(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${H_.icon}`]:{opacity:.5}},[`&.${H_.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${H_.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),N$=hi("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,t[`iconDirection${fo(n.direction)}`]]}})(fm(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),k3=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiTableSortLabel"}),{active:a=!1,children:l,className:u,direction:d="asc",hideSortIcon:h=!1,IconComponent:m=E$,slots:y={},slotProps:v={},...S}=r,w={...r,active:a,direction:d,hideSortIcon:h,IconComponent:m},A=O$(w),E={slots:y,slotProps:v},[k,R]=T3("root",{elementType:M$,externalForwardedProps:E,ownerState:w,className:ar(A.root,u),ref:n}),[D,M]=T3("icon",{elementType:N$,externalForwardedProps:E,ownerState:w,className:A.icon});return T.jsxs(k,{disableRipple:!0,component:"span",...R,...S,children:[l,h&&!a?null:T.jsx(D,{as:m,...M})]})});process.env.NODE_ENV!=="production"&&(k3.propTypes={active:ie.bool,children:ie.node,classes:ie.object,className:ie.string,direction:ie.oneOf(["asc","desc"]),hideSortIcon:ie.bool,IconComponent:ie.elementType,slotProps:ie.shape({icon:ie.oneOfType([ie.func,ie.object]),root:ie.oneOfType([ie.func,ie.object])}),slots:ie.shape({icon:ie.elementType,root:ie.elementType}),sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object])});const D$=e=>{const t=[];if(e===void 0)return{header:[],rows:[]};e.data===void 0&&(e.data=[]),(e.columns===void 0||e.columns.length===0)&&(e.data.length===0?e.columns=[]:e.columns=e.data[0].map((r,a)=>`col${a}`)),(e.index===void 0||e.index.length===0)&&(e.index=e.data.map((r,a)=>`row${a}`));const n=Math.max(e.index.length,e.data.length);for(let r=0;r<n;r++){const l=[r<e.index.length?e.index[r]:`row${r}`];for(let u=0;u<e.columns.length;u++)l.push(e.data[r]?e.data[r][u]:void 0);t.push(l)}return{header:["index",...e.columns],rows:t}},I$=(e,t)=>e==="desc"?(n,r)=>r[t]<n[t]?-1:r[t]>n[t]?1:0:(n,r)=>n[t]<r[t]?-1:n[t]>r[t]?1:0,V_=(e,t)=>{const n=e.map((r,a)=>[r,a]);return n.sort((r,a)=>t(r[0],a[0])),n.map(r=>r[0])},z$=(e,t,n=1e3)=>{if(e.length<=n)return V_(e,t);const r=[];for(let l=0;l<e.length;l+=n)r.push(e.slice(l,l+n));const a=r.map(l=>V_(l,t));return j$(a,t)},j$=(e,t)=>{if(e.length===1)return e[0];const n=[],r=new Array(e.length).fill(0);for(;r.some((a,l)=>a<e[l].length);){let a=-1,l=null;for(let u=0;u<e.length;u++)if(r[u]<e[u].length){const d=e[u][r[u]];(l===null||t(d,l)<0)&&(l=d,a=u)}a!==-1&&l!==null&&(n.push(l),r[a]++)}return n},R3=(e,t,n)=>{const r=Math.ceil(e/n);return{currentPage:r===0?1:Math.min(Math.max(1,t),r),pageSize:n,totalPages:r,totalRows:e}},B$=(e,t,n)=>{const r=(t-1)*n,a=r+n;return e.slice(r,a)},L$=(e,t,n,r,a=5)=>{const l=Math.max(0,Math.floor(e/n)-a),u=Math.min(r-1,Math.ceil((e+t)/n)+a);return{startIndex:l,endIndex:u}},P$=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},O3=({tabledata:e,className:t="",size:n="small",onSortChange:r,enablePagination:a=void 0,pageSize:l=50,enableVirtualScrolling:u=void 0,virtualScrollingHeight:d=400,enableLazyLoading:h=void 0,onLoadMore:m})=>{e||(e={columns:[],index:[],data:[]});const y=e.index.length;y>1e4&&(h=h===void 0?!0:h),y>1e3&&(u=u===void 0?!0:u),y>2*l&&(a=a===void 0?!0:a),h=h===void 0?!1:h,u=u===void 0?!1:u,a=a===void 0?!1:a;const v=q.useMemo(()=>D$(e),[e]),[S,w]=q.useState("asc"),[A,E]=q.useState("index"),[k,R]=q.useState(()=>R3(v.rows.length,1,l)),[D,M]=q.useState(0),I=q.useRef(null),L=q.useMemo(()=>{const Q=v.header.indexOf(A);return Q===-1?0:Q},[v.header,A]),P=q.useMemo(()=>P$((Q,ne)=>{w(ne),E(Q),r?.(Q,ne)},150),[r]),G=q.useCallback(Q=>{const B=A===Q&&S==="asc"?"desc":"asc";v.rows.length>1e3?P(Q,B):(w(B),E(Q),r?.(Q,B))},[A,S,r,v.rows.length,P]),$=q.useMemo(()=>I$(S,L),[S,L]),Z=q.useMemo(()=>v.rows.length>1e3?z$(v.rows,$):V_(v.rows,$),[v.rows,$]),j=q.useMemo(()=>a?B$(Z,k.currentPage,k.pageSize):Z,[Z,a,k.currentPage,k.pageSize]),X={itemHeight:48,overscan:5,containerHeight:d},ee=q.useMemo(()=>u?L$(D,X.containerHeight,X.itemHeight,j.length,X.overscan):{startIndex:0,endIndex:j.length-1},[D,u,j.length,X]),ae=q.useCallback(Q=>{u&&M(Q.currentTarget.scrollTop)},[u]),U=q.useCallback(Q=>{R(ne=>({...ne,currentPage:Q}))},[]),te=q.useCallback(Q=>{if(!(!a||!(Q.target.closest(".sortable-table-wrapper")===Q.currentTarget)))switch(Q.key){case"ArrowLeft":k.currentPage>1&&(Q.preventDefault(),Q.stopPropagation(),U(k.currentPage-1));break;case"ArrowRight":k.currentPage<k.totalPages&&(console.log("ArrowRight",k.currentPage,k.totalPages),Q.preventDefault(),Q.stopPropagation(),U(k.currentPage+1));break;case"Home":k.currentPage>1&&(Q.preventDefault(),Q.stopPropagation(),U(1));break;case"End":k.currentPage<k.totalPages&&(Q.preventDefault(),Q.stopPropagation(),U(k.totalPages));break}},[a,k.currentPage,k.totalPages,U]);q.useEffect(()=>{a&&R(Q=>R3(Z.length,Q.currentPage,l))},[Z.length,a,l]),q.useEffect(()=>{h&&m&&k.currentPage>=k.totalPages-1&&m(k.currentPage+1)},[h,m,k.currentPage,k.totalPages]);const V=()=>a?T.jsxs("div",{className:"sortable-table-pagination",children:[T.jsx("button",{onClick:()=>U(k.currentPage-1),disabled:k.currentPage<=1,className:"pagination-button",children:"Previous"}),T.jsxs("span",{className:"pagination-info",children:["Page ",k.currentPage," of ",k.totalPages,"(",k.totalRows," total rows)"]}),T.jsx("button",{onClick:()=>U(k.currentPage+1),disabled:k.currentPage>=k.totalPages,className:"pagination-button",children:"Next"})]}):null,W=()=>{const Q=u?j.slice(ee.startIndex,ee.endIndex+1):j;return T.jsxs(f3,{children:[u&&T.jsx(F0,{style:{height:ee.startIndex*X.itemHeight},children:T.jsx(V0,{colSpan:v.header.length})}),Q.map((ne,B)=>{const oe=u?ee.startIndex+B:B;return T.jsx(F0,{children:ne.map((se,Y)=>T.jsx(V0,{className:Y===0?"sortable-table-index-cell":"sortable-table-data-cell",children:se},`${e.index?.[oe]||oe}-${Y}`))},e.index?.[oe]||oe)}),u&&T.jsx(F0,{style:{height:(j.length-ee.endIndex-1)*X.itemHeight},children:T.jsx(V0,{colSpan:v.header.length})})]})};return T.jsxs("div",{className:"sortable-table-wrapper",onKeyDown:te,tabIndex:a?0:-1,role:a?"application":void 0,"aria-label":a?"Sortable table with pagination":void 0,children:[T.jsx(d3,{className:`sortable-table-container ${t}`,ref:I,onScroll:ae,style:u?{height:d}:void 0,children:T.jsxs(u3,{size:n,children:[T.jsx(p3,{className:"sortable-table-head",children:T.jsx(F0,{className:"sortable-table-header-row",children:v.header.map(Q=>T.jsx(V0,{className:"sortable-table-header-cell","aria-label":`Sort by ${Q}`,children:T.jsx(k3,{active:A===Q,direction:A===Q?S:"asc",onClick:()=>G(Q),className:"sortable-table-sort-label",sx:{"& .MuiTableSortLabel-icon":{color:"inherit !important"}},children:Q})},Q))})}),W()]})}),V()]})};O3.displayName="SortableTable";function Ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function M3(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function DS(...e){return t=>{let n=!1;const r=e.map(a=>{const l=M3(a,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let a=0;a<r.length;a++){const l=r[a];typeof l=="function"?l():M3(e[a],null)}}}}function bn(...e){return z.useCallback(DS(...e),e)}function H$(e,t){const n=z.createContext(t),r=l=>{const{children:u,...d}=l,h=z.useMemo(()=>d,Object.values(d));return T.jsx(n.Provider,{value:h,children:u})};r.displayName=e+"Provider";function a(l){const u=z.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,a]}function gs(e,t=[]){let n=[];function r(l,u){const d=z.createContext(u),h=n.length;n=[...n,u];const m=v=>{const{scope:S,children:w,...A}=v,E=S?.[e]?.[h]||d,k=z.useMemo(()=>A,Object.values(A));return T.jsx(E.Provider,{value:k,children:w})};m.displayName=l+"Provider";function y(v,S){const w=S?.[e]?.[h]||d,A=z.useContext(w);if(A)return A;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${l}\``)}return[m,y]}const a=()=>{const l=n.map(u=>z.createContext(u));return function(d){const h=d?.[e]||l;return z.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return a.scopeName=e,[r,V$(a,...t)]}function V$(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const u=r.reduce((d,{useScope:h,scopeName:m})=>{const v=h(l)[`__scope${m}`];return{...d,...v}},{});return z.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Ou=globalThis?.document?z.useLayoutEffect:()=>{},F$=z[" useId ".trim().toString()]||(()=>{}),G$=0;function ys(e){const[t,n]=z.useState(F$());return Ou(()=>{n(r=>r??String(G$++))},[e]),e||(t?`radix-${t}`:"")}var U$=z[" useInsertionEffect ".trim().toString()]||Ou;function cf({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,l,u]=$$({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:a;{const y=z.useRef(e!==void 0);z.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,r])}const m=z.useCallback(y=>{if(d){const v=X$(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[h,m]}function $$({defaultProp:e,onChange:t}){const[n,r]=z.useState(e),a=z.useRef(n),l=z.useRef(t);return U$(()=>{l.current=t},[t]),z.useEffect(()=>{a.current!==n&&(l.current?.(n),a.current=n)},[n,a]),[n,r,l]}function X$(e){return typeof e=="function"}function dm(e){const t=Y$(e),n=z.forwardRef((r,a)=>{const{children:l,...u}=r,d=z.Children.toArray(l),h=d.find(W$);if(h){const m=h.props.children,y=d.map(v=>v===h?z.Children.count(m)>1?z.Children.only(null):z.isValidElement(m)?m.props.children:null:v);return T.jsx(t,{...u,ref:a,children:z.isValidElement(m)?z.cloneElement(m,void 0,y):null})}return T.jsx(t,{...u,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function Y$(e){const t=z.forwardRef((n,r)=>{const{children:a,...l}=n;if(z.isValidElement(a)){const u=J$(a),d=q$(l,a.props);return a.type!==z.Fragment&&(d.ref=r?DS(r,u):u),z.cloneElement(a,d)}return z.Children.count(a)>1?z.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Z$=Symbol("radix.slottable");function W$(e){return z.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Z$}function q$(e,t){const n={...t};for(const r in t){const a=e[r],l=t[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function J$(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Q$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],It=Q$.reduce((e,t)=>{const n=dm(`Primitive.${t}`),r=z.forwardRef((a,l)=>{const{asChild:u,...d}=a,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function F_(e,t){e&&$x.flushSync(()=>e.dispatchEvent(t))}function aa(e){const t=z.useRef(e);return z.useEffect(()=>{t.current=e}),z.useMemo(()=>(...n)=>t.current?.(...n),[])}function K$(e,t=globalThis?.document){const n=aa(e);z.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var eX="DismissableLayer",G_="dismissableLayer.update",tX="dismissableLayer.pointerDownOutside",nX="dismissableLayer.focusOutside",N3,D3=z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),G0=z.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=z.useContext(D3),[y,v]=z.useState(null),S=y?.ownerDocument??globalThis?.document,[,w]=z.useState({}),A=bn(t,G=>v(G)),E=Array.from(m.layers),[k]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),R=E.indexOf(k),D=y?E.indexOf(y):-1,M=m.layersWithOutsidePointerEventsDisabled.size>0,I=D>=R,L=oX(G=>{const $=G.target,Z=[...m.branches].some(j=>j.contains($));!I||Z||(a?.(G),u?.(G),G.defaultPrevented||d?.())},S),P=aX(G=>{const $=G.target;[...m.branches].some(j=>j.contains($))||(l?.(G),u?.(G),G.defaultPrevented||d?.())},S);return K$(G=>{D===m.layers.size-1&&(r?.(G),!G.defaultPrevented&&d&&(G.preventDefault(),d()))},S),z.useEffect(()=>{if(y)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(N3=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),z3(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(S.body.style.pointerEvents=N3)}},[y,S,n,m]),z.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),z3())},[y,m]),z.useEffect(()=>{const G=()=>w({});return document.addEventListener(G_,G),()=>document.removeEventListener(G_,G)},[]),T.jsx(It.div,{...h,ref:A,style:{pointerEvents:M?I?"auto":"none":void 0,...e.style},onFocusCapture:Ke(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ke(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ke(e.onPointerDownCapture,L.onPointerDownCapture)})});G0.displayName=eX;var rX="DismissableLayerBranch",I3=z.forwardRef((e,t)=>{const n=z.useContext(D3),r=z.useRef(null),a=bn(t,r);return z.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),T.jsx(It.div,{...e,ref:a})});I3.displayName=rX;function oX(e,t=globalThis?.document){const n=aa(e),r=z.useRef(!1),a=z.useRef(()=>{});return z.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let h=function(){j3(tX,n,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=h,t.addEventListener("click",a.current,{once:!0})):h()}else t.removeEventListener("click",a.current);r.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function aX(e,t=globalThis?.document){const n=aa(e),r=z.useRef(!1);return z.useEffect(()=>{const a=l=>{l.target&&!r.current&&j3(nX,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function z3(){const e=new CustomEvent(G_);document.dispatchEvent(e)}function j3(e,t,n,{discrete:r}){const a=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?F_(a,l):a.dispatchEvent(l)}var iX=G0,lX=I3,U_="focusScope.autoFocusOnMount",$_="focusScope.autoFocusOnUnmount",B3={bubbles:!1,cancelable:!0},sX="FocusScope",IS=z.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...u}=e,[d,h]=z.useState(null),m=aa(a),y=aa(l),v=z.useRef(null),S=bn(t,E=>h(E)),w=z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;z.useEffect(()=>{if(r){let E=function(M){if(w.paused||!d)return;const I=M.target;d.contains(I)?v.current=I:ff(v.current,{select:!0})},k=function(M){if(w.paused||!d)return;const I=M.relatedTarget;I!==null&&(d.contains(I)||ff(v.current,{select:!0}))},R=function(M){if(document.activeElement===document.body)for(const L of M)L.removedNodes.length>0&&ff(d)};document.addEventListener("focusin",E),document.addEventListener("focusout",k);const D=new MutationObserver(R);return d&&D.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",k),D.disconnect()}}},[r,d,w.paused]),z.useEffect(()=>{if(d){H3.add(w);const E=document.activeElement;if(!d.contains(E)){const R=new CustomEvent(U_,B3);d.addEventListener(U_,m),d.dispatchEvent(R),R.defaultPrevented||(uX(pX(L3(d)),{select:!0}),document.activeElement===E&&ff(d))}return()=>{d.removeEventListener(U_,m),setTimeout(()=>{const R=new CustomEvent($_,B3);d.addEventListener($_,y),d.dispatchEvent(R),R.defaultPrevented||ff(E??document.body,{select:!0}),d.removeEventListener($_,y),H3.remove(w)},0)}}},[d,m,y,w]);const A=z.useCallback(E=>{if(!n&&!r||w.paused)return;const k=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,R=document.activeElement;if(k&&R){const D=E.currentTarget,[M,I]=cX(D);M&&I?!E.shiftKey&&R===I?(E.preventDefault(),n&&ff(M,{select:!0})):E.shiftKey&&R===M&&(E.preventDefault(),n&&ff(I,{select:!0})):R===D&&E.preventDefault()}},[n,r,w.paused]);return T.jsx(It.div,{tabIndex:-1,...u,ref:S,onKeyDown:A})});IS.displayName=sX;function uX(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ff(r,{select:t}),document.activeElement!==n)return}function cX(e){const t=L3(e),n=P3(t,e),r=P3(t.reverse(),e);return[n,r]}function L3(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function P3(e,t){for(const n of e)if(!fX(n,{upTo:t}))return n}function fX(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function dX(e){return e instanceof HTMLInputElement&&"select"in e}function ff(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&dX(e)&&t&&e.select()}}var H3=hX();function hX(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=V3(e,t),e.unshift(t)},remove(t){e=V3(e,t),e[0]?.resume()}}}function V3(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function pX(e){return e.filter(t=>t.tagName!=="A")}var mX="Portal",zS=z.forwardRef((e,t)=>{const{container:n,...r}=e,[a,l]=z.useState(!1);Ou(()=>l(!0),[]);const u=n||a&&globalThis?.document?.body;return u?w0.createPortal(T.jsx(It.div,{...r,ref:t}),u):null});zS.displayName=mX;function gX(e,t){return z.useReducer((n,r)=>t[n][r]??n,e)}var yl=e=>{const{present:t,children:n}=e,r=yX(t),a=typeof n=="function"?n({present:r.isPresent}):z.Children.only(n),l=bn(r.ref,vX(a));return typeof n=="function"||r.isPresent?z.cloneElement(a,{ref:l}):null};yl.displayName="Presence";function yX(e){const[t,n]=z.useState(),r=z.useRef(null),a=z.useRef(e),l=z.useRef("none"),u=e?"mounted":"unmounted",[d,h]=gX(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return z.useEffect(()=>{const m=jS(r.current);l.current=d==="mounted"?m:"none"},[d]),Ou(()=>{const m=r.current,y=a.current;if(y!==e){const S=l.current,w=jS(m);e?h("MOUNT"):w==="none"||m?.display==="none"?h("UNMOUNT"):h(y&&S!==w?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),Ou(()=>{if(t){let m;const y=t.ownerDocument.defaultView??window,v=w=>{const E=jS(r.current).includes(w.animationName);if(w.target===t&&E&&(h("ANIMATION_END"),!a.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",m=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},S=w=>{w.target===t&&(l.current=jS(r.current))};return t.addEventListener("animationstart",S),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{y.clearTimeout(m),t.removeEventListener("animationstart",S),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:z.useCallback(m=>{r.current=m?getComputedStyle(m):null,n(m)},[])}}function jS(e){return e?.animationName||"none"}function vX(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X_=0;function Y_(){z.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??F3()),document.body.insertAdjacentElement("beforeend",e[1]??F3()),X_++,()=>{X_===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),X_--}},[])}function F3(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var vs=function(){return vs=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},vs.apply(this,arguments)};function G3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function BS(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,l;r<a;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var LS="right-scroll-bar-position",PS="width-before-scroll-bar",bX="with-scroll-bars-hidden",xX="--removed-body-scroll-bar-size";function Z_(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function SX(e,t){var n=q.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var wX=typeof window<"u"?z.useLayoutEffect:z.useEffect,U3=new WeakMap;function EX(e,t){var n=SX(null,function(r){return e.forEach(function(a){return Z_(a,r)})});return wX(function(){var r=U3.get(n);if(r){var a=new Set(r),l=new Set(e),u=n.current;a.forEach(function(d){l.has(d)||Z_(d,null)}),l.forEach(function(d){a.has(d)||Z_(d,u)})}U3.set(n,e)},[e]),n}function CX(e){return e}function _X(e,t){t===void 0&&(t=CX);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var u=t(l,r);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(r=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){r=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var y=u;u=[],y.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(y){u.push(y),m()},filter:function(y){return u=u.filter(y),n}}}};return a}function AX(e){e===void 0&&(e={});var t=_X(null);return t.options=vs({async:!0,ssr:!1},e),t}var $3=function(e){var t=e.sideCar,n=G3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return z.createElement(r,vs({},n))};$3.isSideCarExport=!0;function TX(e,t){return e.useMedium(t),$3}var X3=AX(),W_=function(){},HS=z.forwardRef(function(e,t){var n=z.useRef(null),r=z.useState({onScrollCapture:W_,onWheelCapture:W_,onTouchMoveCapture:W_}),a=r[0],l=r[1],u=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,y=e.enabled,v=e.shards,S=e.sideCar,w=e.noRelative,A=e.noIsolation,E=e.inert,k=e.allowPinchZoom,R=e.as,D=R===void 0?"div":R,M=e.gapMode,I=G3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=S,P=EX([n,t]),G=vs(vs({},I),a);return z.createElement(z.Fragment,null,y&&z.createElement(L,{sideCar:X3,removeScrollBar:m,shards:v,noRelative:w,noIsolation:A,inert:E,setCallbacks:l,allowPinchZoom:!!k,lockRef:n,gapMode:M}),u?z.cloneElement(z.Children.only(d),vs(vs({},G),{ref:P})):z.createElement(D,vs({},G,{className:h,ref:P}),d))});HS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},HS.classNames={fullWidth:PS,zeroRight:LS};var kX=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function RX(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kX();return t&&e.setAttribute("nonce",t),e}function OX(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function MX(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var NX=function(){var e=0,t=null;return{add:function(n){e==0&&(t=RX())&&(OX(t,n),MX(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},DX=function(){var e=NX();return function(t,n){z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Y3=function(){var e=DX(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},IX={left:0,top:0,right:0,gap:0},q_=function(e){return parseInt(e||"",10)||0},zX=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[q_(n),q_(r),q_(a)]},jX=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return IX;var t=zX(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BX=Y3(),hm="data-scroll-locked",LX=function(e,t,n,r){var a=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
|
|
419
|
+
`,C3=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiTouchRipple"}),{center:a=!1,classes:l={},className:u,...d}=r,[h,m]=z.useState([]),y=z.useRef(0),v=z.useRef(null);z.useEffect(()=>{v.current&&(v.current(),v.current=null)},[h]);const S=z.useRef(!1),w=s$(),A=z.useRef(null),E=z.useRef(null),k=z.useCallback(I=>{const{pulsate:L,rippleX:P,rippleY:G,rippleSize:$,cb:Z}=I;m(j=>[...j,T.jsx(p$,{classes:{ripple:ar(l.ripple,pi.ripple),rippleVisible:ar(l.rippleVisible,pi.rippleVisible),ripplePulsate:ar(l.ripplePulsate,pi.ripplePulsate),child:ar(l.child,pi.child),childLeaving:ar(l.childLeaving,pi.childLeaving),childPulsate:ar(l.childPulsate,pi.childPulsate)},timeout:P_,pulsate:L,rippleX:P,rippleY:G,rippleSize:$},y.current)]),y.current+=1,v.current=Z},[l]),R=z.useCallback((I={},L={},P=()=>{})=>{const{pulsate:G=!1,center:$=a||L.pulsate,fakeElement:Z=!1}=L;if(I?.type==="mousedown"&&S.current){S.current=!1;return}I?.type==="touchstart"&&(S.current=!0);const j=Z?null:E.current,X=j?j.getBoundingClientRect():{width:0,height:0,left:0,top:0};let ee,ae,U;if($||I===void 0||I.clientX===0&&I.clientY===0||!I.clientX&&!I.touches)ee=Math.round(X.width/2),ae=Math.round(X.height/2);else{const{clientX:te,clientY:V}=I.touches&&I.touches.length>0?I.touches[0]:I;ee=Math.round(te-X.left),ae=Math.round(V-X.top)}if($)U=Math.sqrt((2*X.width**2+X.height**2)/3),U%2===0&&(U+=1);else{const te=Math.max(Math.abs((j?j.clientWidth:0)-ee),ee)*2+2,V=Math.max(Math.abs((j?j.clientHeight:0)-ae),ae)*2+2;U=Math.sqrt(te**2+V**2)}I?.touches?A.current===null&&(A.current=()=>{k({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},w.start(u$,()=>{A.current&&(A.current(),A.current=null)})):k({pulsate:G,rippleX:ee,rippleY:ae,rippleSize:U,cb:P})},[a,k,w]),D=z.useCallback(()=>{R({},{pulsate:!0})},[R]),M=z.useCallback((I,L)=>{if(w.clear(),I?.type==="touchend"&&A.current){A.current(),A.current=null,w.start(0,()=>{M(I,L)});return}A.current=null,m(P=>P.length>0?P.slice(1):P),v.current=L},[w]);return z.useImperativeHandle(n,()=>({pulsate:D,start:R,stop:M}),[D,R,M]),T.jsx(h$,{className:ar(pi.root,l.root,u),ref:E,...d,children:T.jsx(B_,{component:null,exit:!0,children:h})})});process.env.NODE_ENV!=="production"&&(C3.propTypes={center:ie.bool,classes:ie.object,className:ie.string});function m$(e){return gl("MuiButtonBase",e)}const g$=hs("MuiButtonBase",["root","disabled","focusVisible"]),y$=e=>{const{disabled:t,focusVisible:n,focusVisibleClassName:r,classes:a}=e,u=_u({root:["root",t&&"disabled",n&&"focusVisible"]},m$,a);return n&&r&&(u.root+=` ${r}`),u},v$=hi("button",{name:"MuiButtonBase",slot:"Root"})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${g$.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),_3=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiButtonBase"}),{action:a,centerRipple:l=!1,children:u,className:d,component:h="button",disabled:m=!1,disableRipple:y=!1,disableTouchRipple:v=!1,focusRipple:S=!1,focusVisibleClassName:w,LinkComponent:A="a",onBlur:E,onClick:k,onContextMenu:R,onDragLeave:D,onFocus:M,onFocusVisible:I,onKeyDown:L,onKeyUp:P,onMouseDown:G,onMouseLeave:$,onMouseUp:Z,onTouchEnd:j,onTouchMove:X,onTouchStart:ee,tabIndex:ae=0,TouchRippleProps:U,touchRippleRef:te,type:V,...W}=r,Q=z.useRef(null),ne=KU(),B=I_(ne.ref,te),[oe,se]=z.useState(!1);m&&oe&&se(!1),z.useImperativeHandle(a,()=>({focusVisible:()=>{se(!0),Q.current.focus()}}),[]);const Y=ne.shouldMount&&!y&&!m;z.useEffect(()=>{oe&&S&&!y&&ne.pulsate()},[y,S,oe,ne]);const he=Ru(ne,"start",G,v),ke=Ru(ne,"stop",R,v),me=Ru(ne,"stop",D,v),Ee=Ru(ne,"stop",Z,v),xe=Ru(ne,"stop",ut=>{oe&&ut.preventDefault(),$&&$(ut)},v),Be=Ru(ne,"start",ee,v),He=Ru(ne,"stop",j,v),Ye=Ru(ne,"stop",X,v),Re=Ru(ne,"stop",ut=>{y3(ut.target)||se(!1),E&&E(ut)},!1),Xe=RS(ut=>{Q.current||(Q.current=ut.currentTarget),y3(ut.target)&&(se(!0),I&&I(ut)),M&&M(ut)}),We=()=>{const ut=Q.current;return h&&h!=="button"&&!(ut.tagName==="A"&&ut.href)},At=RS(ut=>{S&&!ut.repeat&&oe&&ut.key===" "&&ne.stop(ut,()=>{ne.start(ut)}),ut.target===ut.currentTarget&&We()&&ut.key===" "&&ut.preventDefault(),L&&L(ut),ut.target===ut.currentTarget&&We()&&ut.key==="Enter"&&!m&&(ut.preventDefault(),k&&k(ut))}),Kt=RS(ut=>{S&&ut.key===" "&&oe&&!ut.defaultPrevented&&ne.stop(ut,()=>{ne.pulsate(ut)}),P&&P(ut),k&&ut.target===ut.currentTarget&&We()&&ut.key===" "&&!ut.defaultPrevented&&k(ut)});let qt=h;qt==="button"&&(W.href||W.to)&&(qt=A);const er={};qt==="button"?(er.type=V===void 0?"button":V,er.disabled=m):(!W.href&&!W.to&&(er.role="button"),m&&(er["aria-disabled"]=m));const da=I_(n,Q),xo={...r,centerRipple:l,component:h,disabled:m,disableRipple:y,disableTouchRipple:v,focusRipple:S,tabIndex:ae,focusVisible:oe},So=y$(xo);return T.jsxs(v$,{as:qt,className:ar(So.root,d),ownerState:xo,onBlur:Re,onClick:k,onContextMenu:ke,onFocus:Xe,onKeyDown:At,onKeyUp:Kt,onMouseDown:he,onMouseLeave:xe,onMouseUp:Ee,onDragLeave:me,onTouchEnd:He,onTouchMove:Ye,onTouchStart:Be,ref:da,tabIndex:m?-1:ae,type:V,...er,...W,children:[u,Y?T.jsx(C3,{ref:B,center:l,...U}):null]})});function Ru(e,t,n,r=!1){return RS(a=>(n&&n(a),r||e[t](a),!0))}process.env.NODE_ENV!=="production"&&(_3.propTypes={action:ZU,centerRipple:ie.bool,children:ie.node,classes:ie.object,className:ie.string,component:QU,disabled:ie.bool,disableRipple:ie.bool,disableTouchRipple:ie.bool,focusRipple:ie.bool,focusVisibleClassName:ie.string,href:ie.any,LinkComponent:ie.elementType,onBlur:ie.func,onClick:ie.func,onContextMenu:ie.func,onDragLeave:ie.func,onFocus:ie.func,onFocusVisible:ie.func,onKeyDown:ie.func,onKeyUp:ie.func,onMouseDown:ie.func,onMouseLeave:ie.func,onMouseUp:ie.func,onTouchEnd:ie.func,onTouchMove:ie.func,onTouchStart:ie.func,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),tabIndex:ie.number,TouchRippleProps:ie.object,touchRippleRef:ie.oneOfType([ie.func,ie.shape({current:ie.shape({pulsate:ie.func.isRequired,start:ie.func.isRequired,stop:ie.func.isRequired})})]),type:ie.oneOfType([ie.oneOf(["button","reset","submit"]),ie.string])});function b$(e){return gl("MuiSvgIcon",e)}hs("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const x$=e=>{const{color:t,fontSize:n,classes:r}=e,a={root:["root",t!=="inherit"&&`color${fo(t)}`,`fontSize${fo(n)}`]};return _u(a,b$,r)},S$=hi("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.color!=="inherit"&&t[`color${fo(n.color)}`],t[`fontSize${fo(n.fontSize)}`]]}})(fm(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:t=>!t.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,t])=>t&&t.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),NS=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiSvgIcon"}),{children:a,className:l,color:u="inherit",component:d="svg",fontSize:h="medium",htmlColor:m,inheritViewBox:y=!1,titleAccess:v,viewBox:S="0 0 24 24",...w}=r,A=z.isValidElement(a)&&a.type==="svg",E={...r,color:u,component:d,fontSize:h,instanceFontSize:t.fontSize,inheritViewBox:y,viewBox:S,hasSvgAsChild:A},k={};y||(k.viewBox=S);const R=x$(E);return T.jsxs(S$,{as:d,className:ar(R.root,l),focusable:"false",color:m,"aria-hidden":v?void 0:!0,role:v?"img":void 0,ref:n,...k,...w,...A&&a.props,ownerState:E,children:[A?a.props.children:a,v?T.jsx("title",{children:v}):null]})});process.env.NODE_ENV!=="production"&&(NS.propTypes={children:ie.node,classes:ie.object,className:ie.string,color:ie.oneOfType([ie.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),ie.string]),component:ie.elementType,fontSize:ie.oneOfType([ie.oneOf(["inherit","large","medium","small"]),ie.string]),htmlColor:ie.string,inheritViewBox:ie.bool,shapeRendering:ie.string,sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object]),titleAccess:ie.string,viewBox:ie.string}),NS.muiName="SvgIcon";function w$(e,t){function n(r,a){return T.jsx(NS,{"data-testid":process.env.NODE_ENV!=="production"?`${t}Icon`:void 0,ref:a,...r,children:e})}return process.env.NODE_ENV!=="production"&&(n.displayName=`${t}Icon`),n.muiName=NS.muiName,z.memo(z.forwardRef(n))}const E$=w$(T.jsx("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function C$(e){return gl("MuiTableSortLabel",e)}const H_=hs("MuiTableSortLabel",["root","active","icon","iconDirectionDesc","iconDirectionAsc","directionDesc","directionAsc"]);function _$(e){return typeof e=="string"}function A$(e,t,n){return e===void 0||_$(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function T$(e,t,n){return typeof e=="function"?e(t,n):e}function k$(e,t=[]){if(e===void 0)return{};const n={};return Object.keys(e).filter(r=>r.match(/^on[A-Z]/)&&typeof e[r]=="function"&&!t.includes(r)).forEach(r=>{n[r]=e[r]}),n}function A3(e){if(e===void 0)return{};const t={};return Object.keys(e).filter(n=>!(n.match(/^on[A-Z]/)&&typeof e[n]=="function")).forEach(n=>{t[n]=e[n]}),t}function R$(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:r,externalForwardedProps:a,className:l}=e;if(!t){const w=ar(n?.className,l,a?.className,r?.className),A={...n?.style,...a?.style,...r?.style},E={...n,...a,...r};return w.length>0&&(E.className=w),Object.keys(A).length>0&&(E.style=A),{props:E,internalRef:void 0}}const u=k$({...a,...r}),d=A3(r),h=A3(a),m=t(u),y=ar(m?.className,n?.className,l,a?.className,r?.className),v={...m?.style,...n?.style,...a?.style,...r?.style},S={...m,...n,...h,...d};return y.length>0&&(S.className=y),Object.keys(v).length>0&&(S.style=v),{props:S,internalRef:m.ref}}function T3(e,t){const{className:n,elementType:r,ownerState:a,externalForwardedProps:l,internalForwardedProps:u,shouldForwardComponentProp:d=!1,...h}=t,{component:m,slots:y={[e]:void 0},slotProps:v={[e]:void 0},...S}=l,w=y[e]||r,A=T$(v[e],a),{props:{component:E,...k},internalRef:R}=R$({className:n,...h,externalForwardedProps:e==="root"?S:void 0,externalSlotProps:A}),D=I_(R,A?.ref,t.ref),M=e==="root"?E||m:E,I=A$(w,{...e==="root"&&!m&&!y[e]&&u,...e!=="root"&&!y[e]&&u,...k,...M&&!d&&{as:M},...M&&d&&{component:M},ref:D},a);return[w,I]}const O$=e=>{const{classes:t,direction:n,active:r}=e,a={root:["root",r&&"active",`direction${fo(n)}`],icon:["icon",`iconDirection${fo(n)}`]};return _u(a,C$,t)},M$=hi(_3,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.active&&t.active]}})(fm(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${H_.icon}`]:{opacity:.5}},[`&.${H_.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${H_.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),N$=hi("span",{name:"MuiTableSortLabel",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,t[`iconDirection${fo(n.direction)}`]]}})(fm(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),k3=z.forwardRef(function(t,n){const r=ms({props:t,name:"MuiTableSortLabel"}),{active:a=!1,children:l,className:u,direction:d="asc",hideSortIcon:h=!1,IconComponent:m=E$,slots:y={},slotProps:v={},...S}=r,w={...r,active:a,direction:d,hideSortIcon:h,IconComponent:m},A=O$(w),E={slots:y,slotProps:v},[k,R]=T3("root",{elementType:M$,externalForwardedProps:E,ownerState:w,className:ar(A.root,u),ref:n}),[D,M]=T3("icon",{elementType:N$,externalForwardedProps:E,ownerState:w,className:A.icon});return T.jsxs(k,{disableRipple:!0,component:"span",...R,...S,children:[l,h&&!a?null:T.jsx(D,{as:m,...M})]})});process.env.NODE_ENV!=="production"&&(k3.propTypes={active:ie.bool,children:ie.node,classes:ie.object,className:ie.string,direction:ie.oneOf(["asc","desc"]),hideSortIcon:ie.bool,IconComponent:ie.elementType,slotProps:ie.shape({icon:ie.oneOfType([ie.func,ie.object]),root:ie.oneOfType([ie.func,ie.object])}),slots:ie.shape({icon:ie.elementType,root:ie.elementType}),sx:ie.oneOfType([ie.arrayOf(ie.oneOfType([ie.func,ie.object,ie.bool])),ie.func,ie.object])});const D$=e=>{const t=[];if(e===void 0)return{header:[],rows:[]};e.data===void 0&&(e.data=[]),(e.columns===void 0||e.columns.length===0)&&(e.data.length===0?e.columns=[]:e.columns=e.data[0].map((r,a)=>`col${a}`)),(e.index===void 0||e.index.length===0)&&(e.index=e.data.map((r,a)=>`row${a}`));const n=Math.max(e.index.length,e.data.length);for(let r=0;r<n;r++){const l=[r<e.index.length?e.index[r]:`row${r}`];for(let u=0;u<e.columns.length;u++)l.push(e.data[r]?e.data[r][u]:void 0);t.push(l)}return{header:["index",...e.columns],rows:t}},I$=(e,t)=>e==="desc"?(n,r)=>r[t]<n[t]?-1:r[t]>n[t]?1:0:(n,r)=>n[t]<r[t]?-1:n[t]>r[t]?1:0,V_=(e,t)=>{const n=e.map((r,a)=>[r,a]);return n.sort((r,a)=>t(r[0],a[0])),n.map(r=>r[0])},z$=(e,t,n=1e3)=>{if(e.length<=n)return V_(e,t);const r=[];for(let l=0;l<e.length;l+=n)r.push(e.slice(l,l+n));const a=r.map(l=>V_(l,t));return j$(a,t)},j$=(e,t)=>{if(e.length===1)return e[0];const n=[],r=new Array(e.length).fill(0);for(;r.some((a,l)=>a<e[l].length);){let a=-1,l=null;for(let u=0;u<e.length;u++)if(r[u]<e[u].length){const d=e[u][r[u]];(l===null||t(d,l)<0)&&(l=d,a=u)}a!==-1&&l!==null&&(n.push(l),r[a]++)}return n},R3=(e,t,n)=>{const r=Math.ceil(e/n);return{currentPage:r===0?1:Math.min(Math.max(1,t),r),pageSize:n,totalPages:r,totalRows:e}},B$=(e,t,n)=>{const r=(t-1)*n,a=r+n;return e.slice(r,a)},L$=(e,t,n,r,a=5)=>{const l=Math.max(0,Math.floor(e/n)-a),u=Math.min(r-1,Math.ceil((e+t)/n)+a);return{startIndex:l,endIndex:u}},P$=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},O3=({tabledata:e,className:t="",size:n="small",onSortChange:r,enablePagination:a=void 0,pageSize:l=50,enableVirtualScrolling:u=void 0,virtualScrollingHeight:d=400,enableLazyLoading:h=void 0,onLoadMore:m})=>{e||(e={columns:[],index:[],data:[]});const y=e.index.length;y>1e4&&(h=h===void 0?!0:h),y>1e3&&(u=u===void 0?!0:u),y>2*l&&(a=a===void 0?!0:a),h=h===void 0?!1:h,u=u===void 0?!1:u,a=a===void 0?!1:a;const v=q.useMemo(()=>D$(e),[e]),[S,w]=q.useState("asc"),[A,E]=q.useState("index"),[k,R]=q.useState(()=>R3(v.rows.length,1,l)),[D,M]=q.useState(0),I=q.useRef(null),L=q.useMemo(()=>{const Q=v.header.indexOf(A);return Q===-1?0:Q},[v.header,A]),P=q.useMemo(()=>P$((Q,ne)=>{w(ne),E(Q),r?.(Q,ne)},150),[r]),G=q.useCallback(Q=>{const B=A===Q&&S==="asc"?"desc":"asc";v.rows.length>1e3?P(Q,B):(w(B),E(Q),r?.(Q,B))},[A,S,r,v.rows.length,P]),$=q.useMemo(()=>I$(S,L),[S,L]),Z=q.useMemo(()=>v.rows.length>1e3?z$(v.rows,$):V_(v.rows,$),[v.rows,$]),j=q.useMemo(()=>a?B$(Z,k.currentPage,k.pageSize):Z,[Z,a,k.currentPage,k.pageSize]),X={itemHeight:48,overscan:5,containerHeight:d},ee=q.useMemo(()=>u?L$(D,X.containerHeight,X.itemHeight,j.length,X.overscan):{startIndex:0,endIndex:j.length-1},[D,u,j.length,X]),ae=q.useCallback(Q=>{u&&M(Q.currentTarget.scrollTop)},[u]),U=q.useCallback(Q=>{R(ne=>({...ne,currentPage:Q}))},[]),te=q.useCallback(Q=>{if(!(!a||!(Q.target.closest(".sortable-table-wrapper")===Q.currentTarget)))switch(Q.key){case"ArrowLeft":k.currentPage>1&&(Q.preventDefault(),Q.stopPropagation(),U(k.currentPage-1));break;case"ArrowRight":k.currentPage<k.totalPages&&(Q.preventDefault(),Q.stopPropagation(),U(k.currentPage+1));break;case"Home":k.currentPage>1&&(Q.preventDefault(),Q.stopPropagation(),U(1));break;case"End":k.currentPage<k.totalPages&&(Q.preventDefault(),Q.stopPropagation(),U(k.totalPages));break}},[a,k.currentPage,k.totalPages,U]);q.useEffect(()=>{a&&R(Q=>R3(Z.length,Q.currentPage,l))},[Z.length,a,l]),q.useEffect(()=>{h&&m&&k.currentPage>=k.totalPages-1&&m(k.currentPage+1)},[h,m,k.currentPage,k.totalPages]);const V=()=>a?T.jsxs("div",{className:"sortable-table-pagination",children:[T.jsx("button",{onClick:()=>U(k.currentPage-1),disabled:k.currentPage<=1,className:"pagination-button",children:"Previous"}),T.jsxs("span",{className:"pagination-info",children:["Page ",k.currentPage," of ",k.totalPages,"(",k.totalRows," total rows)"]}),T.jsx("button",{onClick:()=>U(k.currentPage+1),disabled:k.currentPage>=k.totalPages,className:"pagination-button",children:"Next"})]}):null,W=()=>{const Q=u?j.slice(ee.startIndex,ee.endIndex+1):j;return T.jsxs(f3,{children:[u&&T.jsx(F0,{style:{height:ee.startIndex*X.itemHeight},children:T.jsx(V0,{colSpan:v.header.length})}),Q.map((ne,B)=>{const oe=u?ee.startIndex+B:B;return T.jsx(F0,{children:ne.map((se,Y)=>T.jsx(V0,{className:Y===0?"sortable-table-index-cell":"sortable-table-data-cell",children:se},`${e.index?.[oe]||oe}-${Y}`))},e.index?.[oe]||oe)}),u&&T.jsx(F0,{style:{height:(j.length-ee.endIndex-1)*X.itemHeight},children:T.jsx(V0,{colSpan:v.header.length})})]})};return T.jsxs("div",{className:"sortable-table-wrapper",onKeyDown:te,tabIndex:a?0:-1,role:a?"application":void 0,"aria-label":a?"Sortable table with pagination":void 0,children:[T.jsx(d3,{className:`sortable-table-container ${t}`,ref:I,onScroll:ae,style:u?{height:d}:void 0,children:T.jsxs(u3,{size:n,children:[T.jsx(p3,{className:"sortable-table-head",children:T.jsx(F0,{className:"sortable-table-header-row",children:v.header.map(Q=>T.jsx(V0,{className:"sortable-table-header-cell","aria-label":`Sort by ${Q}`,children:T.jsx(k3,{active:A===Q,direction:A===Q?S:"asc",onClick:()=>G(Q),className:"sortable-table-sort-label",sx:{"& .MuiTableSortLabel-icon":{color:"inherit !important"}},children:Q})},Q))})}),W()]})}),V()]})};O3.displayName="SortableTable";function Ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e?.(a),n===!1||!a.defaultPrevented)return t?.(a)}}function M3(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function DS(...e){return t=>{let n=!1;const r=e.map(a=>{const l=M3(a,t);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let a=0;a<r.length;a++){const l=r[a];typeof l=="function"?l():M3(e[a],null)}}}}function bn(...e){return z.useCallback(DS(...e),e)}function H$(e,t){const n=z.createContext(t),r=l=>{const{children:u,...d}=l,h=z.useMemo(()=>d,Object.values(d));return T.jsx(n.Provider,{value:h,children:u})};r.displayName=e+"Provider";function a(l){const u=z.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,a]}function gs(e,t=[]){let n=[];function r(l,u){const d=z.createContext(u),h=n.length;n=[...n,u];const m=v=>{const{scope:S,children:w,...A}=v,E=S?.[e]?.[h]||d,k=z.useMemo(()=>A,Object.values(A));return T.jsx(E.Provider,{value:k,children:w})};m.displayName=l+"Provider";function y(v,S){const w=S?.[e]?.[h]||d,A=z.useContext(w);if(A)return A;if(u!==void 0)return u;throw new Error(`\`${v}\` must be used within \`${l}\``)}return[m,y]}const a=()=>{const l=n.map(u=>z.createContext(u));return function(d){const h=d?.[e]||l;return z.useMemo(()=>({[`__scope${e}`]:{...d,[e]:h}}),[d,h])}};return a.scopeName=e,[r,V$(a,...t)]}function V$(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(l){const u=r.reduce((d,{useScope:h,scopeName:m})=>{const v=h(l)[`__scope${m}`];return{...d,...v}},{});return z.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var Ou=globalThis?.document?z.useLayoutEffect:()=>{},F$=z[" useId ".trim().toString()]||(()=>{}),G$=0;function ys(e){const[t,n]=z.useState(F$());return Ou(()=>{n(r=>r??String(G$++))},[e]),e||(t?`radix-${t}`:"")}var U$=z[" useInsertionEffect ".trim().toString()]||Ou;function cf({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,l,u]=$$({defaultProp:t,onChange:n}),d=e!==void 0,h=d?e:a;{const y=z.useRef(e!==void 0);z.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,r])}const m=z.useCallback(y=>{if(d){const v=X$(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[h,m]}function $$({defaultProp:e,onChange:t}){const[n,r]=z.useState(e),a=z.useRef(n),l=z.useRef(t);return U$(()=>{l.current=t},[t]),z.useEffect(()=>{a.current!==n&&(l.current?.(n),a.current=n)},[n,a]),[n,r,l]}function X$(e){return typeof e=="function"}function dm(e){const t=Y$(e),n=z.forwardRef((r,a)=>{const{children:l,...u}=r,d=z.Children.toArray(l),h=d.find(W$);if(h){const m=h.props.children,y=d.map(v=>v===h?z.Children.count(m)>1?z.Children.only(null):z.isValidElement(m)?m.props.children:null:v);return T.jsx(t,{...u,ref:a,children:z.isValidElement(m)?z.cloneElement(m,void 0,y):null})}return T.jsx(t,{...u,ref:a,children:l})});return n.displayName=`${e}.Slot`,n}function Y$(e){const t=z.forwardRef((n,r)=>{const{children:a,...l}=n;if(z.isValidElement(a)){const u=J$(a),d=q$(l,a.props);return a.type!==z.Fragment&&(d.ref=r?DS(r,u):u),z.cloneElement(a,d)}return z.Children.count(a)>1?z.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Z$=Symbol("radix.slottable");function W$(e){return z.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Z$}function q$(e,t){const n={...t};for(const r in t){const a=e[r],l=t[r];/^on[A-Z]/.test(r)?a&&l?n[r]=(...d)=>{const h=l(...d);return a(...d),h}:a&&(n[r]=a):r==="style"?n[r]={...a,...l}:r==="className"&&(n[r]=[a,l].filter(Boolean).join(" "))}return{...e,...n}}function J$(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Q$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],It=Q$.reduce((e,t)=>{const n=dm(`Primitive.${t}`),r=z.forwardRef((a,l)=>{const{asChild:u,...d}=a,h=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),T.jsx(h,{...d,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function F_(e,t){e&&$x.flushSync(()=>e.dispatchEvent(t))}function aa(e){const t=z.useRef(e);return z.useEffect(()=>{t.current=e}),z.useMemo(()=>(...n)=>t.current?.(...n),[])}function K$(e,t=globalThis?.document){const n=aa(e);z.useEffect(()=>{const r=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var eX="DismissableLayer",G_="dismissableLayer.update",tX="dismissableLayer.pointerDownOutside",nX="dismissableLayer.focusOutside",N3,D3=z.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),G0=z.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:u,onDismiss:d,...h}=e,m=z.useContext(D3),[y,v]=z.useState(null),S=y?.ownerDocument??globalThis?.document,[,w]=z.useState({}),A=bn(t,G=>v(G)),E=Array.from(m.layers),[k]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),R=E.indexOf(k),D=y?E.indexOf(y):-1,M=m.layersWithOutsidePointerEventsDisabled.size>0,I=D>=R,L=oX(G=>{const $=G.target,Z=[...m.branches].some(j=>j.contains($));!I||Z||(a?.(G),u?.(G),G.defaultPrevented||d?.())},S),P=aX(G=>{const $=G.target;[...m.branches].some(j=>j.contains($))||(l?.(G),u?.(G),G.defaultPrevented||d?.())},S);return K$(G=>{D===m.layers.size-1&&(r?.(G),!G.defaultPrevented&&d&&(G.preventDefault(),d()))},S),z.useEffect(()=>{if(y)return n&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(N3=S.body.style.pointerEvents,S.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(y)),m.layers.add(y),z3(),()=>{n&&m.layersWithOutsidePointerEventsDisabled.size===1&&(S.body.style.pointerEvents=N3)}},[y,S,n,m]),z.useEffect(()=>()=>{y&&(m.layers.delete(y),m.layersWithOutsidePointerEventsDisabled.delete(y),z3())},[y,m]),z.useEffect(()=>{const G=()=>w({});return document.addEventListener(G_,G),()=>document.removeEventListener(G_,G)},[]),T.jsx(It.div,{...h,ref:A,style:{pointerEvents:M?I?"auto":"none":void 0,...e.style},onFocusCapture:Ke(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Ke(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Ke(e.onPointerDownCapture,L.onPointerDownCapture)})});G0.displayName=eX;var rX="DismissableLayerBranch",I3=z.forwardRef((e,t)=>{const n=z.useContext(D3),r=z.useRef(null),a=bn(t,r);return z.useEffect(()=>{const l=r.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),T.jsx(It.div,{...e,ref:a})});I3.displayName=rX;function oX(e,t=globalThis?.document){const n=aa(e),r=z.useRef(!1),a=z.useRef(()=>{});return z.useEffect(()=>{const l=d=>{if(d.target&&!r.current){let h=function(){j3(tX,n,m,{discrete:!0})};const m={originalEvent:d};d.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=h,t.addEventListener("click",a.current,{once:!0})):h()}else t.removeEventListener("click",a.current);r.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",l),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function aX(e,t=globalThis?.document){const n=aa(e),r=z.useRef(!1);return z.useEffect(()=>{const a=l=>{l.target&&!r.current&&j3(nX,n,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function z3(){const e=new CustomEvent(G_);document.dispatchEvent(e)}function j3(e,t,n,{discrete:r}){const a=n.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?F_(a,l):a.dispatchEvent(l)}var iX=G0,lX=I3,U_="focusScope.autoFocusOnMount",$_="focusScope.autoFocusOnUnmount",B3={bubbles:!1,cancelable:!0},sX="FocusScope",IS=z.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:l,...u}=e,[d,h]=z.useState(null),m=aa(a),y=aa(l),v=z.useRef(null),S=bn(t,E=>h(E)),w=z.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;z.useEffect(()=>{if(r){let E=function(M){if(w.paused||!d)return;const I=M.target;d.contains(I)?v.current=I:ff(v.current,{select:!0})},k=function(M){if(w.paused||!d)return;const I=M.relatedTarget;I!==null&&(d.contains(I)||ff(v.current,{select:!0}))},R=function(M){if(document.activeElement===document.body)for(const L of M)L.removedNodes.length>0&&ff(d)};document.addEventListener("focusin",E),document.addEventListener("focusout",k);const D=new MutationObserver(R);return d&&D.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",E),document.removeEventListener("focusout",k),D.disconnect()}}},[r,d,w.paused]),z.useEffect(()=>{if(d){H3.add(w);const E=document.activeElement;if(!d.contains(E)){const R=new CustomEvent(U_,B3);d.addEventListener(U_,m),d.dispatchEvent(R),R.defaultPrevented||(uX(pX(L3(d)),{select:!0}),document.activeElement===E&&ff(d))}return()=>{d.removeEventListener(U_,m),setTimeout(()=>{const R=new CustomEvent($_,B3);d.addEventListener($_,y),d.dispatchEvent(R),R.defaultPrevented||ff(E??document.body,{select:!0}),d.removeEventListener($_,y),H3.remove(w)},0)}}},[d,m,y,w]);const A=z.useCallback(E=>{if(!n&&!r||w.paused)return;const k=E.key==="Tab"&&!E.altKey&&!E.ctrlKey&&!E.metaKey,R=document.activeElement;if(k&&R){const D=E.currentTarget,[M,I]=cX(D);M&&I?!E.shiftKey&&R===I?(E.preventDefault(),n&&ff(M,{select:!0})):E.shiftKey&&R===M&&(E.preventDefault(),n&&ff(I,{select:!0})):R===D&&E.preventDefault()}},[n,r,w.paused]);return T.jsx(It.div,{tabIndex:-1,...u,ref:S,onKeyDown:A})});IS.displayName=sX;function uX(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(ff(r,{select:t}),document.activeElement!==n)return}function cX(e){const t=L3(e),n=P3(t,e),r=P3(t.reverse(),e);return[n,r]}function L3(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function P3(e,t){for(const n of e)if(!fX(n,{upTo:t}))return n}function fX(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function dX(e){return e instanceof HTMLInputElement&&"select"in e}function ff(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&dX(e)&&t&&e.select()}}var H3=hX();function hX(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=V3(e,t),e.unshift(t)},remove(t){e=V3(e,t),e[0]?.resume()}}}function V3(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function pX(e){return e.filter(t=>t.tagName!=="A")}var mX="Portal",zS=z.forwardRef((e,t)=>{const{container:n,...r}=e,[a,l]=z.useState(!1);Ou(()=>l(!0),[]);const u=n||a&&globalThis?.document?.body;return u?w0.createPortal(T.jsx(It.div,{...r,ref:t}),u):null});zS.displayName=mX;function gX(e,t){return z.useReducer((n,r)=>t[n][r]??n,e)}var yl=e=>{const{present:t,children:n}=e,r=yX(t),a=typeof n=="function"?n({present:r.isPresent}):z.Children.only(n),l=bn(r.ref,vX(a));return typeof n=="function"||r.isPresent?z.cloneElement(a,{ref:l}):null};yl.displayName="Presence";function yX(e){const[t,n]=z.useState(),r=z.useRef(null),a=z.useRef(e),l=z.useRef("none"),u=e?"mounted":"unmounted",[d,h]=gX(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return z.useEffect(()=>{const m=jS(r.current);l.current=d==="mounted"?m:"none"},[d]),Ou(()=>{const m=r.current,y=a.current;if(y!==e){const S=l.current,w=jS(m);e?h("MOUNT"):w==="none"||m?.display==="none"?h("UNMOUNT"):h(y&&S!==w?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,h]),Ou(()=>{if(t){let m;const y=t.ownerDocument.defaultView??window,v=w=>{const E=jS(r.current).includes(w.animationName);if(w.target===t&&E&&(h("ANIMATION_END"),!a.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",m=y.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},S=w=>{w.target===t&&(l.current=jS(r.current))};return t.addEventListener("animationstart",S),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{y.clearTimeout(m),t.removeEventListener("animationstart",S),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:z.useCallback(m=>{r.current=m?getComputedStyle(m):null,n(m)},[])}}function jS(e){return e?.animationName||"none"}function vX(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X_=0;function Y_(){z.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??F3()),document.body.insertAdjacentElement("beforeend",e[1]??F3()),X_++,()=>{X_===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),X_--}},[])}function F3(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var vs=function(){return vs=Object.assign||function(t){for(var n,r=1,a=arguments.length;r<a;r++){n=arguments[r];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},vs.apply(this,arguments)};function G3(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)t.indexOf(r[a])<0&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(n[r[a]]=e[r[a]]);return n}function BS(e,t,n){if(n||arguments.length===2)for(var r=0,a=t.length,l;r<a;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var LS="right-scroll-bar-position",PS="width-before-scroll-bar",bX="with-scroll-bars-hidden",xX="--removed-body-scroll-bar-size";function Z_(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function SX(e,t){var n=q.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var a=n.value;a!==r&&(n.value=r,n.callback(r,a))}}}})[0];return n.callback=t,n.facade}var wX=typeof window<"u"?z.useLayoutEffect:z.useEffect,U3=new WeakMap;function EX(e,t){var n=SX(null,function(r){return e.forEach(function(a){return Z_(a,r)})});return wX(function(){var r=U3.get(n);if(r){var a=new Set(r),l=new Set(e),u=n.current;a.forEach(function(d){l.has(d)||Z_(d,null)}),l.forEach(function(d){a.has(d)||Z_(d,u)})}U3.set(n,e)},[e]),n}function CX(e){return e}function _X(e,t){t===void 0&&(t=CX);var n=[],r=!1,a={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(l){var u=t(l,r);return n.push(u),function(){n=n.filter(function(d){return d!==u})}},assignSyncMedium:function(l){for(r=!0;n.length;){var u=n;n=[],u.forEach(l)}n={push:function(d){return l(d)},filter:function(){return n}}},assignMedium:function(l){r=!0;var u=[];if(n.length){var d=n;n=[],d.forEach(l),u=n}var h=function(){var y=u;u=[],y.forEach(l)},m=function(){return Promise.resolve().then(h)};m(),n={push:function(y){u.push(y),m()},filter:function(y){return u=u.filter(y),n}}}};return a}function AX(e){e===void 0&&(e={});var t=_X(null);return t.options=vs({async:!0,ssr:!1},e),t}var $3=function(e){var t=e.sideCar,n=G3(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return z.createElement(r,vs({},n))};$3.isSideCarExport=!0;function TX(e,t){return e.useMedium(t),$3}var X3=AX(),W_=function(){},HS=z.forwardRef(function(e,t){var n=z.useRef(null),r=z.useState({onScrollCapture:W_,onWheelCapture:W_,onTouchMoveCapture:W_}),a=r[0],l=r[1],u=e.forwardProps,d=e.children,h=e.className,m=e.removeScrollBar,y=e.enabled,v=e.shards,S=e.sideCar,w=e.noRelative,A=e.noIsolation,E=e.inert,k=e.allowPinchZoom,R=e.as,D=R===void 0?"div":R,M=e.gapMode,I=G3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=S,P=EX([n,t]),G=vs(vs({},I),a);return z.createElement(z.Fragment,null,y&&z.createElement(L,{sideCar:X3,removeScrollBar:m,shards:v,noRelative:w,noIsolation:A,inert:E,setCallbacks:l,allowPinchZoom:!!k,lockRef:n,gapMode:M}),u?z.cloneElement(z.Children.only(d),vs(vs({},G),{ref:P})):z.createElement(D,vs({},G,{className:h,ref:P}),d))});HS.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},HS.classNames={fullWidth:PS,zeroRight:LS};var kX=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function RX(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kX();return t&&e.setAttribute("nonce",t),e}function OX(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function MX(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var NX=function(){var e=0,t=null;return{add:function(n){e==0&&(t=RX())&&(OX(t,n),MX(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},DX=function(){var e=NX();return function(t,n){z.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Y3=function(){var e=DX(),t=function(n){var r=n.styles,a=n.dynamic;return e(r,a),null};return t},IX={left:0,top:0,right:0,gap:0},q_=function(e){return parseInt(e||"",10)||0},zX=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[q_(n),q_(r),q_(a)]},jX=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return IX;var t=zX(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BX=Y3(),hm="data-scroll-locked",LX=function(e,t,n,r){var a=e.left,l=e.top,u=e.right,d=e.gap;return n===void 0&&(n="margin"),`
|
|
420
420
|
.`.concat(bX,` {
|
|
421
421
|
overflow: hidden `).concat(r,`;
|
|
422
422
|
padding-right: `).concat(d,"px ").concat(r,`;
|
|
@@ -1033,7 +1033,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1033
1033
|
* content-type
|
|
1034
1034
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
1035
1035
|
* MIT Licensed
|
|
1036
|
-
*/var rz;function dne(){if(rz)return Dw;rz=1;var e=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,t=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,r=/\\([\u000b\u0020-\u00ff])/g,a=/([\\"])/g,l=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Dw.format=u,Dw.parse=d;function u(v){if(!v||typeof v!="object")throw new TypeError("argument obj is required");var S=v.parameters,w=v.type;if(!w||!l.test(w))throw new TypeError("invalid type");var A=w;if(S&&typeof S=="object")for(var E,k=Object.keys(S).sort(),R=0;R<k.length;R++){if(E=k[R],!n.test(E))throw new TypeError("invalid parameter name");A+="; "+E+"="+m(S[E])}return A}function d(v){if(!v)throw new TypeError("argument string is required");var S=typeof v=="object"?h(v):v;if(typeof S!="string")throw new TypeError("argument string is required to be a string");var w=S.indexOf(";"),A=w!==-1?S.slice(0,w).trim():S.trim();if(!l.test(A))throw new TypeError("invalid media type");var E=new y(A.toLowerCase());if(w!==-1){var k,R,D;for(e.lastIndex=w;R=e.exec(S);){if(R.index!==w)throw new TypeError("invalid parameter format");w+=R[0].length,k=R[1].toLowerCase(),D=R[2],D.charCodeAt(0)===34&&(D=D.slice(1,-1),D.indexOf("\\")!==-1&&(D=D.replace(r,"$1"))),E.parameters[k]=D}if(w!==S.length)throw new TypeError("invalid parameter format")}return E}function h(v){var S;if(typeof v.getHeader=="function"?S=v.getHeader("content-type"):typeof v.headers=="object"&&(S=v.headers&&v.headers["content-type"]),typeof S!="string")throw new TypeError("content-type header is missing from object");return S}function m(v){var S=String(v);if(n.test(S))return S;if(S.length>0&&!t.test(S))throw new TypeError("invalid parameter value");return'"'+S.replace(a,"\\$1")+'"'}function y(v){this.parameters=Object.create(null),this.type=v}return Dw}var hne=dne(),Om=new Map,oz=function(t){return t.cloneNode(!0)},az=function(){return window.location.protocol==="file:"},iz=function(t,n,r){var a=new XMLHttpRequest;a.onreadystatechange=function(){try{if(!/\.svg/i.test(t)&&a.readyState===2){var l=a.getResponseHeader("Content-Type");if(!l)throw new Error("Content type not found");var u=hne.parse(l).type;if(!(u==="image/svg+xml"||u==="text/plain"))throw new Error("Invalid content type: ".concat(u))}if(a.readyState===4){if(a.status===404||a.responseXML===null)throw new Error(az()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+t);if(a.status===200||az()&&a.status===0)r(null,a);else throw new Error("There was a problem injecting the SVG: "+a.status+" "+a.statusText)}}catch(d){if(a.abort(),d instanceof Error)r(d,a);else throw d}},a.open("GET",t),a.withCredentials=n,a.overrideMimeType&&a.overrideMimeType("text/xml"),a.send()},bf={},lz=function(t,n){bf[t]=bf[t]||[],bf[t].push(n)},pne=function(t){for(var n=function(u,d){setTimeout(function(){if(Array.isArray(bf[t])){var h=Om.get(t),m=bf[t][u];h instanceof SVGSVGElement&&m(null,oz(h)),h instanceof Error&&m(h),u===bf[t].length-1&&delete bf[t]}},0)},r=0,a=bf[t].length;r<a;r++)n(r)},mne=function(t,n,r){if(Om.has(t)){var a=Om.get(t);if(a===void 0){lz(t,r);return}if(a instanceof SVGSVGElement){r(null,oz(a));return}}Om.set(t,void 0),lz(t,r),iz(t,n,function(l,u){var d;l?Om.set(t,l):((d=u.responseXML)===null||d===void 0?void 0:d.documentElement)instanceof SVGSVGElement&&Om.set(t,u.responseXML.documentElement),pne(t)})},gne=function(t,n,r){iz(t,n,function(a,l){var u;a?r(a):((u=l.responseXML)===null||u===void 0?void 0:u.documentElement)instanceof SVGSVGElement&&r(null,l.responseXML.documentElement)})},yne=0,vne=function(){return++yne},_s=[],sz={},bne="http://www.w3.org/2000/svg",vT="http://www.w3.org/1999/xlink",uz=function(t,n,r,a,l,u,d){var h=t.getAttribute("data-src")||t.getAttribute("src");if(!h){d(new Error("Invalid data-src or src attribute"));return}if(_s.indexOf(t)!==-1){_s.splice(_s.indexOf(t),1),t=null;return}_s.push(t),t.setAttribute("src","");var m=a?mne:gne;m(h,l,function(y,v){if(!v){_s.splice(_s.indexOf(t),1),t=null,d(y);return}var S=t.getAttribute("id");S&&v.setAttribute("id",S);var w=t.getAttribute("title");w&&v.setAttribute("title",w);var A=t.getAttribute("width");A&&v.setAttribute("width",A);var E=t.getAttribute("height");E&&v.setAttribute("height",E);var k=Array.from(new Set(BS(BS(BS([],(v.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(t.getAttribute("class")||"").split(" "),!0))).join(" ").trim();v.setAttribute("class",k);var R=t.getAttribute("style");R&&v.setAttribute("style",R),v.setAttribute("data-src",h);var D=[].filter.call(t.attributes,function(Q){return/^data-\w[\w-]*$/.test(Q.name)});if(Array.prototype.forEach.call(D,function(Q){Q.name&&Q.value&&v.setAttribute(Q.name,Q.value)}),r){var M={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]},I,L,P,G,$;Object.keys(M).forEach(function(Q){I=Q,P=M[Q],L=v.querySelectorAll(I+"[id]");for(var ne=function(Y,he){G=L[Y].id,$=G+"-"+vne();var ke;Array.prototype.forEach.call(P,function(Xe){ke=v.querySelectorAll("["+Xe+'*="'+G+'"]');for(var We=0,At=ke.length;We<At;We++){var Kt=ke[We].getAttribute(Xe);Kt&&!Kt.match(new RegExp('url\\("?#'+G+'"?\\)'))||ke[We].setAttribute(Xe,"url(#"+$+")")}});for(var me=v.querySelectorAll("[*|href]"),Ee=[],xe=0,Be=me.length;xe<Be;xe++){var He=me[xe].getAttributeNS(vT,"href");He&&He.toString()==="#"+L[Y].id&&Ee.push(me[xe])}for(var Ye=0,Re=Ee.length;Ye<Re;Ye++)Ee[Ye].setAttributeNS(vT,"href","#"+$);L[Y].id=$},B=0,oe=L.length;B<oe;B++)ne(B)})}v.removeAttribute("xmlns:a");for(var Z=v.querySelectorAll("script"),j=[],X,ee,ae=0,U=Z.length;ae<U;ae++)ee=Z[ae].getAttribute("type"),(!ee||ee==="application/ecmascript"||ee==="application/javascript"||ee==="text/javascript")&&(X=Z[ae].innerText||Z[ae].textContent,X&&j.push(X),v.removeChild(Z[ae]));if(j.length>0&&(n==="always"||n==="once"&&!sz[h])){for(var te=0,V=j.length;te<V;te++)new Function(j[te])(window);sz[h]=!0}var W=v.querySelectorAll("style");if(Array.prototype.forEach.call(W,function(Q){Q.textContent+=""}),v.setAttribute("xmlns",bne),v.setAttribute("xmlns:xlink",vT),u(v),!t.parentNode){_s.splice(_s.indexOf(t),1),t=null,d(new Error("Parent node is null"));return}t.parentNode.replaceChild(v,t),_s.splice(_s.indexOf(t),1),t=null,d(null,v)})},xne=function(t,n){var r=n===void 0?{}:n,a=r.afterAll,l=a===void 0?function(){}:a,u=r.afterEach,d=u===void 0?function(){}:u,h=r.beforeEach,m=h===void 0?function(){}:h,y=r.cacheRequests,v=y===void 0?!0:y,S=r.evalScripts,w=S===void 0?"never":S,A=r.httpRequestWithCredentials,E=A===void 0?!1:A,k=r.renumerateIRIElements,R=k===void 0?!0:k;if(t&&"length"in t)for(var D=0,M=0,I=t.length;M<I;M++)uz(t[M],w,R,v,E,m,function(L,P){d(L,P),t&&"length"in t&&t.length===++D&&l(D)});else t?uz(t,w,R,v,E,m,function(L,P){d(L,P),l(1),t=null}):l(0)},Sne=function(t){var n=t?.ownerDocument||document;return n.defaultView||window},wne=function(t,n){for(var r in t)if(!(r in n))return!0;for(var a in n)if(t[a]!==n[a])return!0;return!1},Ene=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Iw="http://www.w3.org/2000/svg",cz="http://www.w3.org/1999/xlink",bT=function(e){function t(){for(var r,a=arguments.length,l=new Array(a),u=0;u<a;u++)l[u]=arguments[u];return r=e.call.apply(e,[this].concat(l))||this,r.initialState={hasError:!1,isLoading:!0},r.state=r.initialState,r._isMounted=!1,r.reactWrapper=void 0,r.nonReactWrapper=void 0,r.refCallback=function(d){r.reactWrapper=d},r}x3(t,e);var n=t.prototype;return n.renderSVG=function(){var a=this;if(this.reactWrapper instanceof Sne(this.reactWrapper).Node){var l=this.props,u=l.desc,d=l.evalScripts,h=l.httpRequestWithCredentials,m=l.renumerateIRIElements,y=l.src,v=l.title,S=l.useRequestCache,w=this.props.onError,A=this.props.beforeInjection,E=this.props.afterInjection,k=this.props.wrapper,R,D;k==="svg"?(R=document.createElementNS(Iw,k),R.setAttribute("xmlns",Iw),R.setAttribute("xmlns:xlink",cz),D=document.createElementNS(Iw,k)):(R=document.createElement(k),D=document.createElement(k)),R.appendChild(D),D.dataset.src=y,this.nonReactWrapper=this.reactWrapper.appendChild(R);var M=function(G){if(a.removeSVG(),!a._isMounted){w(G);return}a.setState(function(){return{hasError:!0,isLoading:!1}},function(){w(G)})},I=function(G,$){if(G){M(G);return}a._isMounted&&a.setState(function(){return{isLoading:!1}},function(){try{E($)}catch(Z){M(Z)}})},L=function(G){if(G.setAttribute("role","img"),u){var $=G.querySelector(":scope > desc");$&&G.removeChild($);var Z=document.createElement("desc");Z.innerHTML=u,G.prepend(Z)}if(v){var j=G.querySelector(":scope > title");j&&G.removeChild(j);var X=document.createElement("title");X.innerHTML=v,G.prepend(X)}try{A(G)}catch(ee){M(ee)}};xne(D,{afterEach:I,beforeEach:L,cacheRequests:S,evalScripts:d,httpRequestWithCredentials:h,renumerateIRIElements:m})}},n.removeSVG=function(){var a;(a=this.nonReactWrapper)!=null&&a.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},n.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},n.componentDidUpdate=function(a){var l=this;wne(lt({},a),this.props)&&this.setState(function(){return l.initialState},function(){l.removeSVG(),l.renderSVG()})},n.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},n.render=function(){var a=this.props;a.afterInjection,a.beforeInjection,a.desc,a.evalScripts;var l=a.fallback;a.httpRequestWithCredentials;var u=a.loading;a.renumerateIRIElements,a.src,a.title,a.useRequestCache;var d=a.wrapper,h=z_(a,Ene),m=d;return z.createElement(m,lt({},h,{ref:this.refCallback},d==="svg"?{xmlns:Iw,xmlnsXlink:cz}:{}),this.state.isLoading&&u&&z.createElement(u,null),this.state.hasError&&l&&z.createElement(l,null))},t}(z.Component);bT.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"},bT.propTypes={afterInjection:gr.func,beforeInjection:gr.func,desc:gr.string,evalScripts:gr.oneOf(["always","once","never"]),fallback:gr.oneOfType([gr.func,gr.object,gr.string]),httpRequestWithCredentials:gr.bool,loading:gr.oneOfType([gr.func,gr.object,gr.string]),onError:gr.func,renumerateIRIElements:gr.bool,src:gr.string.isRequired,title:gr.string,useRequestCache:gr.bool,wrapper:gr.oneOf(["div","span","svg"])};const xT=({text:e="No image data provided"})=>T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:e}),Cne=z.memo(({value:e,format:t="jpeg",alt:n="Base64 image",onError:r,onLoad:a,...l})=>{const[u,d]=z.useState(!1),[h,m]=z.useState(!0),y=z.useRef(null),v=z.useMemo(()=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"data"in e){const E=e.data;if(E instanceof ArrayBuffer){const k=new Uint8Array(E);let R="";for(let D=0;D<k.byteLength;D++)R+=String.fromCharCode(k[D]);return btoa(R)}}return""},[e]),S=z.useMemo(()=>v?`data:image/${t};base64,${v}`:"",[v,t]),w=z.useCallback(E=>{d(!0),m(!1),r?.(E)},[r]),A=z.useCallback(()=>{m(!1),d(!1),a?.()},[a]);return z.useEffect(()=>{const E=y.current;if(E)return E.addEventListener("error",w),E.addEventListener("load",A),()=>{E.removeEventListener("error",w),E.removeEventListener("load",A)}},[w,A,e]),z.useEffect(()=>{d(!1),m(!0)},[e]),v?u?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load base64 image"}):T.jsx("img",{ref:y,src:S,alt:n,className:`base64-image-renderer ${l.className||""} ${h?" loading":""}`,...l}):T.jsx(xT,{})}),_ne=z.memo(({value:e,alt:t="SVG image",onError:n,onLoad:r,...a})=>{const[l,u]=z.useState(!1),d=z.useMemo(()=>{if(!e)return"";try{return`data:image/svg+xml;base64,${btoa(e)}`}catch(m){return console.error("Failed to encode SVG to base64:",m),""}},[e]);z.useEffect(()=>{u(!1)},[e]);const h=z.useCallback(m=>{u(!0),n?.(m)},[n]);return e?l||!d?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load SVG"}):T.jsx(bT,{src:d,className:`svg-renderer ${a.className||""}`,style:{maxWidth:"100%",maxHeight:"100%",...a.style},beforeInjection:m=>{m.classList.add("svg-renderer"),m.setAttribute("style","max-width: 100%; max-height: 100%;"),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("aria-label",t);const y=()=>{u(!1),r?.()},v=S=>{u(!0),n?.(S)};try{m.addEventListener("load",y),m.addEventListener("error",v)}catch{y()}},onError:h}):T.jsx(xT,{})}),Ane=z.memo(({src:e,alt:t="Streaming image",onError:n,onLoad:r,...a})=>{const l=z.useRef(null),[u,d]=z.useState(!1),[h,m]=z.useState(!0);z.useEffect(()=>{l.current&&e&&(m(!0),d(!1),l.current.src=e)},[e]);const y=z.useCallback(S=>{d(!0),m(!1),n?.(S)},[n]),v=z.useCallback(()=>{m(!1),d(!1),r?.()},[r]);return z.useEffect(()=>{const S=l.current;if(S)return S.addEventListener("error",y),S.addEventListener("load",v),()=>{S.removeEventListener("error",y),S.removeEventListener("load",v)}},[y,v]),u?T.jsx(xT,{text:"Failed to load image"}):T.jsx("img",{ref:l,className:`streaming-image ${a.className||""} ${h?" loading":""}`,alt:t,...a})});function zw(e){const t=e+"CollectionProvider",[n,r]=gs(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=E=>{const{scope:k,children:R}=E,D=q.useRef(null),M=q.useRef(new Map).current;return T.jsx(a,{scope:k,itemMap:M,collectionRef:D,children:R})};u.displayName=t;const d=e+"CollectionSlot",h=dm(d),m=q.forwardRef((E,k)=>{const{scope:R,children:D}=E,M=l(d,R),I=bn(k,M.collectionRef);return T.jsx(h,{ref:I,children:D})});m.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",S=dm(y),w=q.forwardRef((E,k)=>{const{scope:R,children:D,...M}=E,I=q.useRef(null),L=bn(k,I),P=l(y,R);return q.useEffect(()=>(P.itemMap.set(I,{ref:I,...M}),()=>void P.itemMap.delete(I))),T.jsx(S,{[v]:"",ref:L,children:D})});w.displayName=y;function A(E){const k=l(e+"CollectionConsumer",E);return q.useCallback(()=>{const D=k.collectionRef.current;if(!D)return[];const M=Array.from(D.querySelectorAll(`[${v}]`));return Array.from(k.itemMap.values()).sort((P,G)=>M.indexOf(P.ref.current)-M.indexOf(G.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:u,Slot:m,ItemSlot:w},A,r]}var Tne=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),kne="VisuallyHidden",ST=z.forwardRef((e,t)=>T.jsx(It.span,{...e,ref:t,style:{...Tne,...e.style}}));ST.displayName=kne;var wT="ToastProvider",[ET,Rne,One]=zw("Toast"),[fz,pSe]=gs("Toast",[One]),[Mne,jw]=fz(wT),dz=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:l=50,children:u}=e,[d,h]=z.useState(null),[m,y]=z.useState(0),v=z.useRef(!1),S=z.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${wT}\`. Expected non-empty \`string\`.`),T.jsx(ET.Provider,{scope:t,children:T.jsx(Mne,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:l,toastCount:m,viewport:d,onViewportChange:h,onToastAdd:z.useCallback(()=>y(w=>w+1),[]),onToastRemove:z.useCallback(()=>y(w=>w-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:S,children:u})})};dz.displayName=wT;var hz="ToastViewport",Nne=["F8"],CT="toast.viewportPause",_T="toast.viewportResume",pz=z.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Nne,label:a="Notifications ({hotkey})",...l}=e,u=jw(hz,n),d=Rne(n),h=z.useRef(null),m=z.useRef(null),y=z.useRef(null),v=z.useRef(null),S=bn(t,v,u.onViewportChange),w=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=u.toastCount>0;z.useEffect(()=>{const k=R=>{r.length!==0&&r.every(M=>R[M]||R.code===M)&&v.current?.focus()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r]),z.useEffect(()=>{const k=h.current,R=v.current;if(A&&k&&R){const D=()=>{if(!u.isClosePausedRef.current){const P=new CustomEvent(CT);R.dispatchEvent(P),u.isClosePausedRef.current=!0}},M=()=>{if(u.isClosePausedRef.current){const P=new CustomEvent(_T);R.dispatchEvent(P),u.isClosePausedRef.current=!1}},I=P=>{!k.contains(P.relatedTarget)&&M()},L=()=>{k.contains(document.activeElement)||M()};return k.addEventListener("focusin",D),k.addEventListener("focusout",I),k.addEventListener("pointermove",D),k.addEventListener("pointerleave",L),window.addEventListener("blur",D),window.addEventListener("focus",M),()=>{k.removeEventListener("focusin",D),k.removeEventListener("focusout",I),k.removeEventListener("pointermove",D),k.removeEventListener("pointerleave",L),window.removeEventListener("blur",D),window.removeEventListener("focus",M)}}},[A,u.isClosePausedRef]);const E=z.useCallback(({tabbingDirection:k})=>{const D=d().map(M=>{const I=M.ref.current,L=[I,...$ne(I)];return k==="forwards"?L:L.reverse()});return(k==="forwards"?D.reverse():D).flat()},[d]);return z.useEffect(()=>{const k=v.current;if(k){const R=D=>{const M=D.altKey||D.ctrlKey||D.metaKey;if(D.key==="Tab"&&!M){const L=document.activeElement,P=D.shiftKey;if(D.target===k&&P){m.current?.focus();return}const Z=E({tabbingDirection:P?"backwards":"forwards"}),j=Z.findIndex(X=>X===L);kT(Z.slice(j+1))?D.preventDefault():P?m.current?.focus():y.current?.focus()}};return k.addEventListener("keydown",R),()=>k.removeEventListener("keydown",R)}},[d,E]),T.jsxs(lX,{ref:h,role:"region","aria-label":a.replace("{hotkey}",w),tabIndex:-1,style:{pointerEvents:A?void 0:"none"},children:[A&&T.jsx(AT,{ref:m,onFocusFromOutsideViewport:()=>{const k=E({tabbingDirection:"forwards"});kT(k)}}),T.jsx(ET.Slot,{scope:n,children:T.jsx(It.ol,{tabIndex:-1,...l,ref:S})}),A&&T.jsx(AT,{ref:y,onFocusFromOutsideViewport:()=>{const k=E({tabbingDirection:"backwards"});kT(k)}})]})});pz.displayName=hz;var mz="ToastFocusProxy",AT=z.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,l=jw(mz,n);return T.jsx(ST,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:u=>{const d=u.relatedTarget;!l.viewport?.contains(d)&&r()}})});AT.displayName=mz;var lv="Toast",Dne="toast.swipeStart",Ine="toast.swipeMove",zne="toast.swipeCancel",jne="toast.swipeEnd",gz=z.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:l,...u}=e,[d,h]=cf({prop:r,defaultProp:a??!0,onChange:l,caller:lv});return T.jsx(yl,{present:n||d,children:T.jsx(Pne,{open:d,...u,ref:t,onClose:()=>h(!1),onPause:aa(e.onPause),onResume:aa(e.onResume),onSwipeStart:Ke(e.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ke(e.onSwipeMove,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:Ke(e.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ke(e.onSwipeEnd,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),h(!1)})})})});gz.displayName=lv;var[Bne,Lne]=fz(lv,{onClose(){}}),Pne=z.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:l,onClose:u,onEscapeKeyDown:d,onPause:h,onResume:m,onSwipeStart:y,onSwipeMove:v,onSwipeCancel:S,onSwipeEnd:w,...A}=e,E=jw(lv,n),[k,R]=z.useState(null),D=bn(t,U=>R(U)),M=z.useRef(null),I=z.useRef(null),L=a||E.duration,P=z.useRef(0),G=z.useRef(L),$=z.useRef(0),{onToastAdd:Z,onToastRemove:j}=E,X=aa(()=>{k?.contains(document.activeElement)&&E.viewport?.focus(),u()}),ee=z.useCallback(U=>{!U||U===1/0||(window.clearTimeout($.current),P.current=new Date().getTime(),$.current=window.setTimeout(X,U))},[X]);z.useEffect(()=>{const U=E.viewport;if(U){const te=()=>{ee(G.current),m?.()},V=()=>{const W=new Date().getTime()-P.current;G.current=G.current-W,window.clearTimeout($.current),h?.()};return U.addEventListener(CT,V),U.addEventListener(_T,te),()=>{U.removeEventListener(CT,V),U.removeEventListener(_T,te)}}},[E.viewport,L,h,m,ee]),z.useEffect(()=>{l&&!E.isClosePausedRef.current&&ee(L)},[l,L,E.isClosePausedRef,ee]),z.useEffect(()=>(Z(),()=>j()),[Z,j]);const ae=z.useMemo(()=>k?Ez(k):null,[k]);return E.viewport?T.jsxs(T.Fragment,{children:[ae&&T.jsx(Hne,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:ae}),T.jsx(Bne,{scope:n,onClose:X,children:$x.createPortal(T.jsx(ET.ItemSlot,{scope:n,children:T.jsx(iX,{asChild:!0,onEscapeKeyDown:Ke(d,()=>{E.isFocusedToastEscapeKeyDownRef.current||X(),E.isFocusedToastEscapeKeyDownRef.current=!1}),children:T.jsx(It.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":l?"open":"closed","data-swipe-direction":E.swipeDirection,...A,ref:D,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ke(e.onKeyDown,U=>{U.key==="Escape"&&(d?.(U.nativeEvent),U.nativeEvent.defaultPrevented||(E.isFocusedToastEscapeKeyDownRef.current=!0,X()))}),onPointerDown:Ke(e.onPointerDown,U=>{U.button===0&&(M.current={x:U.clientX,y:U.clientY})}),onPointerMove:Ke(e.onPointerMove,U=>{if(!M.current)return;const te=U.clientX-M.current.x,V=U.clientY-M.current.y,W=!!I.current,Q=["left","right"].includes(E.swipeDirection),ne=["left","up"].includes(E.swipeDirection)?Math.min:Math.max,B=Q?ne(0,te):0,oe=Q?0:ne(0,V),se=U.pointerType==="touch"?10:2,Y={x:B,y:oe},he={originalEvent:U,delta:Y};W?(I.current=Y,Bw(Ine,v,he,{discrete:!1})):Cz(Y,E.swipeDirection,se)?(I.current=Y,Bw(Dne,y,he,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(te)>se||Math.abs(V)>se)&&(M.current=null)}),onPointerUp:Ke(e.onPointerUp,U=>{const te=I.current,V=U.target;if(V.hasPointerCapture(U.pointerId)&&V.releasePointerCapture(U.pointerId),I.current=null,M.current=null,te){const W=U.currentTarget,Q={originalEvent:U,delta:te};Cz(te,E.swipeDirection,E.swipeThreshold)?Bw(jne,w,Q,{discrete:!0}):Bw(zne,S,Q,{discrete:!0}),W.addEventListener("click",ne=>ne.preventDefault(),{once:!0})}})})})}),E.viewport)})]}):null}),Hne=e=>{const{__scopeToast:t,children:n,...r}=e,a=jw(lv,t),[l,u]=z.useState(!1),[d,h]=z.useState(!1);return Gne(()=>u(!0)),z.useEffect(()=>{const m=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(m)},[]),d?null:T.jsx(zS,{asChild:!0,children:T.jsx(ST,{...r,children:l&&T.jsxs(T.Fragment,{children:[a.label," ",n]})})})},Vne="ToastTitle",yz=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(It.div,{...r,ref:t})});yz.displayName=Vne;var Fne="ToastDescription",vz=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(It.div,{...r,ref:t})});vz.displayName=Fne;var bz="ToastAction",xz=z.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?T.jsx(wz,{altText:n,asChild:!0,children:T.jsx(TT,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${bz}\`. Expected non-empty \`string\`.`),null)});xz.displayName=bz;var Sz="ToastClose",TT=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=Lne(Sz,n);return T.jsx(wz,{asChild:!0,children:T.jsx(It.button,{type:"button",...r,ref:t,onClick:Ke(e.onClick,a.onClose)})})});TT.displayName=Sz;var wz=z.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return T.jsx(It.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function Ez(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),Une(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",l=r.dataset.radixToastAnnounceExclude==="";if(!a)if(l){const u=r.dataset.radixToastAnnounceAlt;u&&t.push(u)}else t.push(...Ez(r))}}),t}function Bw(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,l=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?F_(a,l):a.dispatchEvent(l)}var Cz=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),l=r>a;return t==="left"||t==="right"?l&&r>n:!l&&a>n};function Gne(e=()=>{}){const t=aa(e);Ou(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function Une(e){return e.nodeType===e.ELEMENT_NODE}function $ne(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function kT(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Xne=dz,Yne=pz,Zne=gz,Wne=yz,qne=vz,Jne=xz,Qne=TT;const to=[];for(let e=0;e<256;++e)to.push((e+256).toString(16).slice(1));function Kne(e,t=0){return(to[e[t+0]]+to[e[t+1]]+to[e[t+2]]+to[e[t+3]]+"-"+to[e[t+4]]+to[e[t+5]]+"-"+to[e[t+6]]+to[e[t+7]]+"-"+to[e[t+8]]+to[e[t+9]]+"-"+to[e[t+10]]+to[e[t+11]]+to[e[t+12]]+to[e[t+13]]+to[e[t+14]]+to[e[t+15]]).toLowerCase()}let RT;const ere=new Uint8Array(16);function tre(){if(!RT){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");RT=crypto.getRandomValues.bind(crypto)}return RT(ere)}const _z={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function OT(e,t,n){if(_z.randomUUID&&!e)return _z.randomUUID();e=e||{};const r=e.random??e.rng?.()??tre();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Kne(r)}const Az=z.createContext(void 0),Tz=z.createContext(void 0),nre=350,rre=({children:e,fixedHeight:t,duration:n=5e3,maxVisible:r=3,...a})=>{const[l,u]=z.useState(new Map),d=z.useRef(new Map),h=z.useRef(null),m=z.useRef(!0),y=z.useCallback(()=>{const R=Array.from(d.current).reverse();if(t){const D=t;R.forEach(([,M],I)=>{if(!M)return;M.setAttribute("data-front",String(I===0)),M.setAttribute("data-hidden",String(I>=r)),M.style.setProperty("--index",String(I)),M.style.setProperty("--height",`${t}px`),M.style.setProperty("--front-height",`${D}px`);const L=t*I;M.style.setProperty("--hover-offset-y",`-${L}px`)})}else{const D=R.map(([,I])=>{if(!I)return 0;const L=I.querySelector(".ToastInner");if(!L)return I.clientHeight;const P=L.style.height;L.style.height="auto";const G=I.clientHeight;return L.style.height=P,G}),M=D[0]||0;R.forEach(([,I],L)=>{if(!I)return;const P=D[L];I.setAttribute("data-front",String(L===0)),I.setAttribute("data-hidden",String(L>=r)),I.style.setProperty("--index",String(L)),I.style.setProperty("--height",`${P}px`),I.style.setProperty("--front-height",`${M}px`);const G=D.slice(0,L).reduce(($,Z)=>$+Z,0);I.style.setProperty("--hover-offset-y",`-${G}px`)})}},[t,r]),v=z.useCallback(R=>{u(D=>{const M=new Map(D);return M.set(OT(),{...R,duration:R.duration||n,open:!0}),M})},[n]),S=z.useCallback(R=>{m.current&&u(D=>{const M=new Map(D);return M.delete(R),M})},[]),w=z.useCallback(R=>v({...R,status:R.status||"default"}),[v]),A=z.useCallback(R=>v({...R,status:"success"}),[v]),E=z.useCallback(R=>v({...R,status:"error"}),[v]);z.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]),z.useEffect(()=>{const R=h.current;if(R){const D=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","true")})},M=L=>{(!R.contains(L.target)||R===L.target)&&d.current.forEach(P=>{P.setAttribute("data-hovering","false")})},I=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","false")})};return R.addEventListener("pointermove",D),R.addEventListener("pointerleave",I),R.addEventListener("focusin",D),R.addEventListener("focusout",M),()=>{R.removeEventListener("pointermove",D),R.removeEventListener("pointerleave",I),R.removeEventListener("focusin",D),R.removeEventListener("focusout",M)}}},[]);const k=z.useMemo(()=>Object.assign(w,{success:A,error:E}),[w,A,E]);return T.jsx(Az.Provider,{value:k,children:T.jsx(Tz.Provider,{value:z.useMemo(()=>({toastElementsMapRef:d,sortToasts:y}),[y]),children:T.jsxs(Xne,{...a,children:[e,Array.from(l).map(([R,D])=>T.jsx(ire,{id:R,toast:D,onOpenChange:M=>{M||(d.current.delete(R),y(),u(I=>{const L=new Map(I),P=L.get(R);return P&&L.set(R,{...P,open:!1}),L}),setTimeout(()=>{S(R)},nre))}},R)),T.jsx(Yne,{ref:h,className:"ToastViewport",style:t?{"--fixed-toast-height":`${t}px`}:void 0})]})})})},ore=()=>{const e=z.useContext(Az);if(e)return e;throw new Error("useToast must be used within Toasts")},are=()=>{const e=z.useContext(Tz);if(e)return e;throw new Error("useToastContext must be used within Toasts")},ire=({onOpenChange:e,toast:t,id:n,...r})=>{const a=z.useRef(null),l=are(),{sortToasts:u,toastElementsMapRef:d}=l,h=d.current;return z.useLayoutEffect(()=>(a.current&&(h.set(n,a.current),u()),()=>{h.delete(n),u()}),[n,u,h]),T.jsx(Zne,{...r,ref:a,type:t.type,duration:t.duration,className:"ToastRoot",onOpenChange:e,open:t.open,children:T.jsxs("div",{className:"ToastInner","data-status":t.status,children:[T.jsx(lre,{status:t.status}),t.title&&T.jsx(Wne,{className:"ToastTitle",children:t.title}),T.jsx(qne,{className:"ToastDescription",children:t.description}),t.action&&T.jsx(Jne,{className:"ToastAction Button small green",altText:t.action.altText,onClick:t.action.onClick,asChild:!0,children:T.jsx("button",{children:t.action.label})}),T.jsx(Qne,{"aria-label":"Close",className:"ToastClose",children:T.jsx(cw,{style:{fontSize:"12px"}})})]})})},lre=({status:e})=>e!=="default"&&e?T.jsxs("div",{style:{gridArea:"icon",alignSelf:"start"},children:[e==="success"&&T.jsx(bJ,{style:{color:"#61d345",fontSize:"20px"}}),e==="error"&&T.jsx(xJ,{style:{color:"#ff4b4b",fontSize:"20px"}})]}):null,sre={},kz=e=>{let t;const n=new Set,r=(y,v)=>{const S=typeof y=="function"?y(t):y;if(!Object.is(S,t)){const w=t;t=v??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(A=>A(t,w))}},a=()=>t,h={setState:r,getState:a,getInitialState:()=>m,subscribe:y=>(n.add(y),()=>n.delete(y)),destroy:()=>{(sre?"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."),n.clear()}},m=t=e(r,a,h);return h},Rz=e=>e?kz(e):kz;var Lw={exports:{}},MT={},Pw={exports:{}},NT={};/**
|
|
1036
|
+
*/var rz;function dne(){if(rz)return Dw;rz=1;var e=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,t=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,r=/\\([\u000b\u0020-\u00ff])/g,a=/([\\"])/g,l=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;Dw.format=u,Dw.parse=d;function u(v){if(!v||typeof v!="object")throw new TypeError("argument obj is required");var S=v.parameters,w=v.type;if(!w||!l.test(w))throw new TypeError("invalid type");var A=w;if(S&&typeof S=="object")for(var E,k=Object.keys(S).sort(),R=0;R<k.length;R++){if(E=k[R],!n.test(E))throw new TypeError("invalid parameter name");A+="; "+E+"="+m(S[E])}return A}function d(v){if(!v)throw new TypeError("argument string is required");var S=typeof v=="object"?h(v):v;if(typeof S!="string")throw new TypeError("argument string is required to be a string");var w=S.indexOf(";"),A=w!==-1?S.slice(0,w).trim():S.trim();if(!l.test(A))throw new TypeError("invalid media type");var E=new y(A.toLowerCase());if(w!==-1){var k,R,D;for(e.lastIndex=w;R=e.exec(S);){if(R.index!==w)throw new TypeError("invalid parameter format");w+=R[0].length,k=R[1].toLowerCase(),D=R[2],D.charCodeAt(0)===34&&(D=D.slice(1,-1),D.indexOf("\\")!==-1&&(D=D.replace(r,"$1"))),E.parameters[k]=D}if(w!==S.length)throw new TypeError("invalid parameter format")}return E}function h(v){var S;if(typeof v.getHeader=="function"?S=v.getHeader("content-type"):typeof v.headers=="object"&&(S=v.headers&&v.headers["content-type"]),typeof S!="string")throw new TypeError("content-type header is missing from object");return S}function m(v){var S=String(v);if(n.test(S))return S;if(S.length>0&&!t.test(S))throw new TypeError("invalid parameter value");return'"'+S.replace(a,"\\$1")+'"'}function y(v){this.parameters=Object.create(null),this.type=v}return Dw}var hne=dne(),Om=new Map,oz=function(t){return t.cloneNode(!0)},az=function(){return window.location.protocol==="file:"},iz=function(t,n,r){var a=new XMLHttpRequest;a.onreadystatechange=function(){try{if(!/\.svg/i.test(t)&&a.readyState===2){var l=a.getResponseHeader("Content-Type");if(!l)throw new Error("Content type not found");var u=hne.parse(l).type;if(!(u==="image/svg+xml"||u==="text/plain"))throw new Error("Invalid content type: ".concat(u))}if(a.readyState===4){if(a.status===404||a.responseXML===null)throw new Error(az()?"Note: SVG injection ajax calls do not work locally without adjusting security settings in your browser. Or consider using a local webserver.":"Unable to load SVG file: "+t);if(a.status===200||az()&&a.status===0)r(null,a);else throw new Error("There was a problem injecting the SVG: "+a.status+" "+a.statusText)}}catch(d){if(a.abort(),d instanceof Error)r(d,a);else throw d}},a.open("GET",t),a.withCredentials=n,a.overrideMimeType&&a.overrideMimeType("text/xml"),a.send()},bf={},lz=function(t,n){bf[t]=bf[t]||[],bf[t].push(n)},pne=function(t){for(var n=function(u,d){setTimeout(function(){if(Array.isArray(bf[t])){var h=Om.get(t),m=bf[t][u];h instanceof SVGSVGElement&&m(null,oz(h)),h instanceof Error&&m(h),u===bf[t].length-1&&delete bf[t]}},0)},r=0,a=bf[t].length;r<a;r++)n(r)},mne=function(t,n,r){if(Om.has(t)){var a=Om.get(t);if(a===void 0){lz(t,r);return}if(a instanceof SVGSVGElement){r(null,oz(a));return}}Om.set(t,void 0),lz(t,r),iz(t,n,function(l,u){var d;l?Om.set(t,l):((d=u.responseXML)===null||d===void 0?void 0:d.documentElement)instanceof SVGSVGElement&&Om.set(t,u.responseXML.documentElement),pne(t)})},gne=function(t,n,r){iz(t,n,function(a,l){var u;a?r(a):((u=l.responseXML)===null||u===void 0?void 0:u.documentElement)instanceof SVGSVGElement&&r(null,l.responseXML.documentElement)})},yne=0,vne=function(){return++yne},_s=[],sz={},bne="http://www.w3.org/2000/svg",vT="http://www.w3.org/1999/xlink",uz=function(t,n,r,a,l,u,d){var h=t.getAttribute("data-src")||t.getAttribute("src");if(!h){d(new Error("Invalid data-src or src attribute"));return}if(_s.indexOf(t)!==-1){_s.splice(_s.indexOf(t),1),t=null;return}_s.push(t),t.setAttribute("src","");var m=a?mne:gne;m(h,l,function(y,v){if(!v){_s.splice(_s.indexOf(t),1),t=null,d(y);return}var S=t.getAttribute("id");S&&v.setAttribute("id",S);var w=t.getAttribute("title");w&&v.setAttribute("title",w);var A=t.getAttribute("width");A&&v.setAttribute("width",A);var E=t.getAttribute("height");E&&v.setAttribute("height",E);var k=Array.from(new Set(BS(BS(BS([],(v.getAttribute("class")||"").split(" "),!0),["injected-svg"],!1),(t.getAttribute("class")||"").split(" "),!0))).join(" ").trim();v.setAttribute("class",k);var R=t.getAttribute("style");R&&v.setAttribute("style",R),v.setAttribute("data-src",h);var D=[].filter.call(t.attributes,function(Q){return/^data-\w[\w-]*$/.test(Q.name)});if(Array.prototype.forEach.call(D,function(Q){Q.name&&Q.value&&v.setAttribute(Q.name,Q.value)}),r){var M={clipPath:["clip-path"],"color-profile":["color-profile"],cursor:["cursor"],filter:["filter"],linearGradient:["fill","stroke"],marker:["marker","marker-start","marker-mid","marker-end"],mask:["mask"],path:[],pattern:["fill","stroke"],radialGradient:["fill","stroke"]},I,L,P,G,$;Object.keys(M).forEach(function(Q){I=Q,P=M[Q],L=v.querySelectorAll(I+"[id]");for(var ne=function(Y,he){G=L[Y].id,$=G+"-"+vne();var ke;Array.prototype.forEach.call(P,function(Xe){ke=v.querySelectorAll("["+Xe+'*="'+G+'"]');for(var We=0,At=ke.length;We<At;We++){var Kt=ke[We].getAttribute(Xe);Kt&&!Kt.match(new RegExp('url\\("?#'+G+'"?\\)'))||ke[We].setAttribute(Xe,"url(#"+$+")")}});for(var me=v.querySelectorAll("[*|href]"),Ee=[],xe=0,Be=me.length;xe<Be;xe++){var He=me[xe].getAttributeNS(vT,"href");He&&He.toString()==="#"+L[Y].id&&Ee.push(me[xe])}for(var Ye=0,Re=Ee.length;Ye<Re;Ye++)Ee[Ye].setAttributeNS(vT,"href","#"+$);L[Y].id=$},B=0,oe=L.length;B<oe;B++)ne(B)})}v.removeAttribute("xmlns:a");for(var Z=v.querySelectorAll("script"),j=[],X,ee,ae=0,U=Z.length;ae<U;ae++)ee=Z[ae].getAttribute("type"),(!ee||ee==="application/ecmascript"||ee==="application/javascript"||ee==="text/javascript")&&(X=Z[ae].innerText||Z[ae].textContent,X&&j.push(X),v.removeChild(Z[ae]));if(j.length>0&&(n==="always"||n==="once"&&!sz[h])){for(var te=0,V=j.length;te<V;te++)new Function(j[te])(window);sz[h]=!0}var W=v.querySelectorAll("style");if(Array.prototype.forEach.call(W,function(Q){Q.textContent+=""}),v.setAttribute("xmlns",bne),v.setAttribute("xmlns:xlink",vT),u(v),!t.parentNode){_s.splice(_s.indexOf(t),1),t=null,d(new Error("Parent node is null"));return}t.parentNode.replaceChild(v,t),_s.splice(_s.indexOf(t),1),t=null,d(null,v)})},xne=function(t,n){var r=n===void 0?{}:n,a=r.afterAll,l=a===void 0?function(){}:a,u=r.afterEach,d=u===void 0?function(){}:u,h=r.beforeEach,m=h===void 0?function(){}:h,y=r.cacheRequests,v=y===void 0?!0:y,S=r.evalScripts,w=S===void 0?"never":S,A=r.httpRequestWithCredentials,E=A===void 0?!1:A,k=r.renumerateIRIElements,R=k===void 0?!0:k;if(t&&"length"in t)for(var D=0,M=0,I=t.length;M<I;M++)uz(t[M],w,R,v,E,m,function(L,P){d(L,P),t&&"length"in t&&t.length===++D&&l(D)});else t?uz(t,w,R,v,E,m,function(L,P){d(L,P),l(1),t=null}):l(0)},Sne=function(t){var n=t?.ownerDocument||document;return n.defaultView||window},wne=function(t,n){for(var r in t)if(!(r in n))return!0;for(var a in n)if(t[a]!==n[a])return!0;return!1},Ene=["afterInjection","beforeInjection","desc","evalScripts","fallback","httpRequestWithCredentials","loading","renumerateIRIElements","src","title","useRequestCache","wrapper"],Iw="http://www.w3.org/2000/svg",cz="http://www.w3.org/1999/xlink",bT=function(e){function t(){for(var r,a=arguments.length,l=new Array(a),u=0;u<a;u++)l[u]=arguments[u];return r=e.call.apply(e,[this].concat(l))||this,r.initialState={hasError:!1,isLoading:!0},r.state=r.initialState,r._isMounted=!1,r.reactWrapper=void 0,r.nonReactWrapper=void 0,r.refCallback=function(d){r.reactWrapper=d},r}x3(t,e);var n=t.prototype;return n.renderSVG=function(){var a=this;if(this.reactWrapper instanceof Sne(this.reactWrapper).Node){var l=this.props,u=l.desc,d=l.evalScripts,h=l.httpRequestWithCredentials,m=l.renumerateIRIElements,y=l.src,v=l.title,S=l.useRequestCache,w=this.props.onError,A=this.props.beforeInjection,E=this.props.afterInjection,k=this.props.wrapper,R,D;k==="svg"?(R=document.createElementNS(Iw,k),R.setAttribute("xmlns",Iw),R.setAttribute("xmlns:xlink",cz),D=document.createElementNS(Iw,k)):(R=document.createElement(k),D=document.createElement(k)),R.appendChild(D),D.dataset.src=y,this.nonReactWrapper=this.reactWrapper.appendChild(R);var M=function(G){if(a.removeSVG(),!a._isMounted){w(G);return}a.setState(function(){return{hasError:!0,isLoading:!1}},function(){w(G)})},I=function(G,$){if(G){M(G);return}a._isMounted&&a.setState(function(){return{isLoading:!1}},function(){try{E($)}catch(Z){M(Z)}})},L=function(G){if(G.setAttribute("role","img"),u){var $=G.querySelector(":scope > desc");$&&G.removeChild($);var Z=document.createElement("desc");Z.innerHTML=u,G.prepend(Z)}if(v){var j=G.querySelector(":scope > title");j&&G.removeChild(j);var X=document.createElement("title");X.innerHTML=v,G.prepend(X)}try{A(G)}catch(ee){M(ee)}};xne(D,{afterEach:I,beforeEach:L,cacheRequests:S,evalScripts:d,httpRequestWithCredentials:h,renumerateIRIElements:m})}},n.removeSVG=function(){var a;(a=this.nonReactWrapper)!=null&&a.parentNode&&(this.nonReactWrapper.parentNode.removeChild(this.nonReactWrapper),this.nonReactWrapper=null)},n.componentDidMount=function(){this._isMounted=!0,this.renderSVG()},n.componentDidUpdate=function(a){var l=this;wne(lt({},a),this.props)&&this.setState(function(){return l.initialState},function(){l.removeSVG(),l.renderSVG()})},n.componentWillUnmount=function(){this._isMounted=!1,this.removeSVG()},n.render=function(){var a=this.props;a.afterInjection,a.beforeInjection,a.desc,a.evalScripts;var l=a.fallback;a.httpRequestWithCredentials;var u=a.loading;a.renumerateIRIElements,a.src,a.title,a.useRequestCache;var d=a.wrapper,h=z_(a,Ene),m=d;return z.createElement(m,lt({},h,{ref:this.refCallback},d==="svg"?{xmlns:Iw,xmlnsXlink:cz}:{}),this.state.isLoading&&u&&z.createElement(u,null),this.state.hasError&&l&&z.createElement(l,null))},t}(z.Component);bT.defaultProps={afterInjection:function(){},beforeInjection:function(){},desc:"",evalScripts:"never",fallback:null,httpRequestWithCredentials:!1,loading:null,onError:function(){},renumerateIRIElements:!0,title:"",useRequestCache:!0,wrapper:"div"},bT.propTypes={afterInjection:gr.func,beforeInjection:gr.func,desc:gr.string,evalScripts:gr.oneOf(["always","once","never"]),fallback:gr.oneOfType([gr.func,gr.object,gr.string]),httpRequestWithCredentials:gr.bool,loading:gr.oneOfType([gr.func,gr.object,gr.string]),onError:gr.func,renumerateIRIElements:gr.bool,src:gr.string.isRequired,title:gr.string,useRequestCache:gr.bool,wrapper:gr.oneOf(["div","span","svg"])};const xT=({text:e="No image data provided"})=>T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:e}),Cne=z.memo(({value:e,format:t="jpeg",alt:n="Base64 image",onError:r,onLoad:a,...l})=>{const[u,d]=z.useState(!1),[h,m]=z.useState(!0),y=z.useRef(null),v=z.useMemo(()=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"data"in e){const E=e.data;if(E instanceof ArrayBuffer){const k=new Uint8Array(E);let R="";for(let D=0;D<k.byteLength;D++)R+=String.fromCharCode(k[D]);return btoa(R)}}return""},[e]),S=z.useMemo(()=>v?`data:image/${t};base64,${v}`:"",[v,t]),w=z.useCallback(E=>{d(!0),m(!1),r?.(E)},[r]),A=z.useCallback(()=>{m(!1),d(!1),a?.()},[a]);return z.useEffect(()=>{const E=y.current;if(E)return E.addEventListener("error",w),E.addEventListener("load",A),()=>{E.removeEventListener("error",w),E.removeEventListener("load",A)}},[w,A,e]),z.useEffect(()=>{d(!1),m(!0)},[e]),v?u?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load base64 image"}):T.jsx("img",{ref:y,src:S,alt:n,className:`base64-image-renderer image-renderer ${l.className||""} ${h?" loading":""}`,...l}):T.jsx(xT,{})}),_ne=z.memo(({value:e,alt:t="SVG image",onError:n,onLoad:r,...a})=>{const[l,u]=z.useState(!1),d=z.useMemo(()=>{if(!e)return"";try{return`data:image/svg+xml;base64,${btoa(e)}`}catch(m){return console.error("Failed to encode SVG to base64:",m),""}},[e]);z.useEffect(()=>{u(!1)},[e]);const h=z.useCallback(m=>{u(!0),n?.(m)},[n]);return e?l||!d?T.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",minHeight:"100px",border:"1px dashed #ccc",color:"#666"},children:"Failed to load SVG"}):T.jsx(bT,{src:d,className:`svg-renderer ${a.className||""}`,style:{maxWidth:"100%",maxHeight:"100%",...a.style},beforeInjection:m=>{m.classList.add("svg-renderer"),m.setAttribute("style","max-width: 100%; max-height: 100%;"),m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("aria-label",t);const y=()=>{u(!1),r?.()},v=S=>{u(!0),n?.(S)};try{m.addEventListener("load",y),m.addEventListener("error",v)}catch{y()}},onError:h}):T.jsx(xT,{})}),Ane=z.memo(({src:e,alt:t="Streaming image",onError:n,onLoad:r,...a})=>{const l=z.useRef(null),[u,d]=z.useState(!1),[h,m]=z.useState(!0);z.useEffect(()=>{l.current&&e&&(m(!0),d(!1),l.current.src=e)},[e]);const y=z.useCallback(S=>{d(!0),m(!1),n?.(S)},[n]),v=z.useCallback(()=>{m(!1),d(!1),r?.()},[r]);return z.useEffect(()=>{const S=l.current;if(S)return S.addEventListener("error",y),S.addEventListener("load",v),()=>{S.removeEventListener("error",y),S.removeEventListener("load",v)}},[y,v]),u?T.jsx(xT,{text:"Failed to load image"}):T.jsx("img",{ref:l,className:`streaming-image image-renderer ${a.className||""} ${h?" loading":""}`,alt:t,...a})});function zw(e){const t=e+"CollectionProvider",[n,r]=gs(t),[a,l]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=E=>{const{scope:k,children:R}=E,D=q.useRef(null),M=q.useRef(new Map).current;return T.jsx(a,{scope:k,itemMap:M,collectionRef:D,children:R})};u.displayName=t;const d=e+"CollectionSlot",h=dm(d),m=q.forwardRef((E,k)=>{const{scope:R,children:D}=E,M=l(d,R),I=bn(k,M.collectionRef);return T.jsx(h,{ref:I,children:D})});m.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",S=dm(y),w=q.forwardRef((E,k)=>{const{scope:R,children:D,...M}=E,I=q.useRef(null),L=bn(k,I),P=l(y,R);return q.useEffect(()=>(P.itemMap.set(I,{ref:I,...M}),()=>void P.itemMap.delete(I))),T.jsx(S,{[v]:"",ref:L,children:D})});w.displayName=y;function A(E){const k=l(e+"CollectionConsumer",E);return q.useCallback(()=>{const D=k.collectionRef.current;if(!D)return[];const M=Array.from(D.querySelectorAll(`[${v}]`));return Array.from(k.itemMap.values()).sort((P,G)=>M.indexOf(P.ref.current)-M.indexOf(G.ref.current))},[k.collectionRef,k.itemMap])}return[{Provider:u,Slot:m,ItemSlot:w},A,r]}var Tne=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),kne="VisuallyHidden",ST=z.forwardRef((e,t)=>T.jsx(It.span,{...e,ref:t,style:{...Tne,...e.style}}));ST.displayName=kne;var wT="ToastProvider",[ET,Rne,One]=zw("Toast"),[fz,pSe]=gs("Toast",[One]),[Mne,jw]=fz(wT),dz=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:a="right",swipeThreshold:l=50,children:u}=e,[d,h]=z.useState(null),[m,y]=z.useState(0),v=z.useRef(!1),S=z.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${wT}\`. Expected non-empty \`string\`.`),T.jsx(ET.Provider,{scope:t,children:T.jsx(Mne,{scope:t,label:n,duration:r,swipeDirection:a,swipeThreshold:l,toastCount:m,viewport:d,onViewportChange:h,onToastAdd:z.useCallback(()=>y(w=>w+1),[]),onToastRemove:z.useCallback(()=>y(w=>w-1),[]),isFocusedToastEscapeKeyDownRef:v,isClosePausedRef:S,children:u})})};dz.displayName=wT;var hz="ToastViewport",Nne=["F8"],CT="toast.viewportPause",_T="toast.viewportResume",pz=z.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Nne,label:a="Notifications ({hotkey})",...l}=e,u=jw(hz,n),d=Rne(n),h=z.useRef(null),m=z.useRef(null),y=z.useRef(null),v=z.useRef(null),S=bn(t,v,u.onViewportChange),w=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=u.toastCount>0;z.useEffect(()=>{const k=R=>{r.length!==0&&r.every(M=>R[M]||R.code===M)&&v.current?.focus()};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[r]),z.useEffect(()=>{const k=h.current,R=v.current;if(A&&k&&R){const D=()=>{if(!u.isClosePausedRef.current){const P=new CustomEvent(CT);R.dispatchEvent(P),u.isClosePausedRef.current=!0}},M=()=>{if(u.isClosePausedRef.current){const P=new CustomEvent(_T);R.dispatchEvent(P),u.isClosePausedRef.current=!1}},I=P=>{!k.contains(P.relatedTarget)&&M()},L=()=>{k.contains(document.activeElement)||M()};return k.addEventListener("focusin",D),k.addEventListener("focusout",I),k.addEventListener("pointermove",D),k.addEventListener("pointerleave",L),window.addEventListener("blur",D),window.addEventListener("focus",M),()=>{k.removeEventListener("focusin",D),k.removeEventListener("focusout",I),k.removeEventListener("pointermove",D),k.removeEventListener("pointerleave",L),window.removeEventListener("blur",D),window.removeEventListener("focus",M)}}},[A,u.isClosePausedRef]);const E=z.useCallback(({tabbingDirection:k})=>{const D=d().map(M=>{const I=M.ref.current,L=[I,...$ne(I)];return k==="forwards"?L:L.reverse()});return(k==="forwards"?D.reverse():D).flat()},[d]);return z.useEffect(()=>{const k=v.current;if(k){const R=D=>{const M=D.altKey||D.ctrlKey||D.metaKey;if(D.key==="Tab"&&!M){const L=document.activeElement,P=D.shiftKey;if(D.target===k&&P){m.current?.focus();return}const Z=E({tabbingDirection:P?"backwards":"forwards"}),j=Z.findIndex(X=>X===L);kT(Z.slice(j+1))?D.preventDefault():P?m.current?.focus():y.current?.focus()}};return k.addEventListener("keydown",R),()=>k.removeEventListener("keydown",R)}},[d,E]),T.jsxs(lX,{ref:h,role:"region","aria-label":a.replace("{hotkey}",w),tabIndex:-1,style:{pointerEvents:A?void 0:"none"},children:[A&&T.jsx(AT,{ref:m,onFocusFromOutsideViewport:()=>{const k=E({tabbingDirection:"forwards"});kT(k)}}),T.jsx(ET.Slot,{scope:n,children:T.jsx(It.ol,{tabIndex:-1,...l,ref:S})}),A&&T.jsx(AT,{ref:y,onFocusFromOutsideViewport:()=>{const k=E({tabbingDirection:"backwards"});kT(k)}})]})});pz.displayName=hz;var mz="ToastFocusProxy",AT=z.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...a}=e,l=jw(mz,n);return T.jsx(ST,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:u=>{const d=u.relatedTarget;!l.viewport?.contains(d)&&r()}})});AT.displayName=mz;var lv="Toast",Dne="toast.swipeStart",Ine="toast.swipeMove",zne="toast.swipeCancel",jne="toast.swipeEnd",gz=z.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:a,onOpenChange:l,...u}=e,[d,h]=cf({prop:r,defaultProp:a??!0,onChange:l,caller:lv});return T.jsx(yl,{present:n||d,children:T.jsx(Pne,{open:d,...u,ref:t,onClose:()=>h(!1),onPause:aa(e.onPause),onResume:aa(e.onResume),onSwipeStart:Ke(e.onSwipeStart,m=>{m.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ke(e.onSwipeMove,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","move"),m.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${v}px`)}),onSwipeCancel:Ke(e.onSwipeCancel,m=>{m.currentTarget.setAttribute("data-swipe","cancel"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ke(e.onSwipeEnd,m=>{const{x:y,y:v}=m.detail.delta;m.currentTarget.setAttribute("data-swipe","end"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),m.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),m.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${y}px`),m.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${v}px`),h(!1)})})})});gz.displayName=lv;var[Bne,Lne]=fz(lv,{onClose(){}}),Pne=z.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:a,open:l,onClose:u,onEscapeKeyDown:d,onPause:h,onResume:m,onSwipeStart:y,onSwipeMove:v,onSwipeCancel:S,onSwipeEnd:w,...A}=e,E=jw(lv,n),[k,R]=z.useState(null),D=bn(t,U=>R(U)),M=z.useRef(null),I=z.useRef(null),L=a||E.duration,P=z.useRef(0),G=z.useRef(L),$=z.useRef(0),{onToastAdd:Z,onToastRemove:j}=E,X=aa(()=>{k?.contains(document.activeElement)&&E.viewport?.focus(),u()}),ee=z.useCallback(U=>{!U||U===1/0||(window.clearTimeout($.current),P.current=new Date().getTime(),$.current=window.setTimeout(X,U))},[X]);z.useEffect(()=>{const U=E.viewport;if(U){const te=()=>{ee(G.current),m?.()},V=()=>{const W=new Date().getTime()-P.current;G.current=G.current-W,window.clearTimeout($.current),h?.()};return U.addEventListener(CT,V),U.addEventListener(_T,te),()=>{U.removeEventListener(CT,V),U.removeEventListener(_T,te)}}},[E.viewport,L,h,m,ee]),z.useEffect(()=>{l&&!E.isClosePausedRef.current&&ee(L)},[l,L,E.isClosePausedRef,ee]),z.useEffect(()=>(Z(),()=>j()),[Z,j]);const ae=z.useMemo(()=>k?Ez(k):null,[k]);return E.viewport?T.jsxs(T.Fragment,{children:[ae&&T.jsx(Hne,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:ae}),T.jsx(Bne,{scope:n,onClose:X,children:$x.createPortal(T.jsx(ET.ItemSlot,{scope:n,children:T.jsx(iX,{asChild:!0,onEscapeKeyDown:Ke(d,()=>{E.isFocusedToastEscapeKeyDownRef.current||X(),E.isFocusedToastEscapeKeyDownRef.current=!1}),children:T.jsx(It.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":l?"open":"closed","data-swipe-direction":E.swipeDirection,...A,ref:D,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:Ke(e.onKeyDown,U=>{U.key==="Escape"&&(d?.(U.nativeEvent),U.nativeEvent.defaultPrevented||(E.isFocusedToastEscapeKeyDownRef.current=!0,X()))}),onPointerDown:Ke(e.onPointerDown,U=>{U.button===0&&(M.current={x:U.clientX,y:U.clientY})}),onPointerMove:Ke(e.onPointerMove,U=>{if(!M.current)return;const te=U.clientX-M.current.x,V=U.clientY-M.current.y,W=!!I.current,Q=["left","right"].includes(E.swipeDirection),ne=["left","up"].includes(E.swipeDirection)?Math.min:Math.max,B=Q?ne(0,te):0,oe=Q?0:ne(0,V),se=U.pointerType==="touch"?10:2,Y={x:B,y:oe},he={originalEvent:U,delta:Y};W?(I.current=Y,Bw(Ine,v,he,{discrete:!1})):Cz(Y,E.swipeDirection,se)?(I.current=Y,Bw(Dne,y,he,{discrete:!1}),U.target.setPointerCapture(U.pointerId)):(Math.abs(te)>se||Math.abs(V)>se)&&(M.current=null)}),onPointerUp:Ke(e.onPointerUp,U=>{const te=I.current,V=U.target;if(V.hasPointerCapture(U.pointerId)&&V.releasePointerCapture(U.pointerId),I.current=null,M.current=null,te){const W=U.currentTarget,Q={originalEvent:U,delta:te};Cz(te,E.swipeDirection,E.swipeThreshold)?Bw(jne,w,Q,{discrete:!0}):Bw(zne,S,Q,{discrete:!0}),W.addEventListener("click",ne=>ne.preventDefault(),{once:!0})}})})})}),E.viewport)})]}):null}),Hne=e=>{const{__scopeToast:t,children:n,...r}=e,a=jw(lv,t),[l,u]=z.useState(!1),[d,h]=z.useState(!1);return Gne(()=>u(!0)),z.useEffect(()=>{const m=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(m)},[]),d?null:T.jsx(zS,{asChild:!0,children:T.jsx(ST,{...r,children:l&&T.jsxs(T.Fragment,{children:[a.label," ",n]})})})},Vne="ToastTitle",yz=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(It.div,{...r,ref:t})});yz.displayName=Vne;var Fne="ToastDescription",vz=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return T.jsx(It.div,{...r,ref:t})});vz.displayName=Fne;var bz="ToastAction",xz=z.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?T.jsx(wz,{altText:n,asChild:!0,children:T.jsx(TT,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${bz}\`. Expected non-empty \`string\`.`),null)});xz.displayName=bz;var Sz="ToastClose",TT=z.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,a=Lne(Sz,n);return T.jsx(wz,{asChild:!0,children:T.jsx(It.button,{type:"button",...r,ref:t,onClick:Ke(e.onClick,a.onClose)})})});TT.displayName=Sz;var wz=z.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...a}=e;return T.jsx(It.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...a,ref:t})});function Ez(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),Une(r)){const a=r.ariaHidden||r.hidden||r.style.display==="none",l=r.dataset.radixToastAnnounceExclude==="";if(!a)if(l){const u=r.dataset.radixToastAnnounceAlt;u&&t.push(u)}else t.push(...Ez(r))}}),t}function Bw(e,t,n,{discrete:r}){const a=n.originalEvent.currentTarget,l=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?F_(a,l):a.dispatchEvent(l)}var Cz=(e,t,n=0)=>{const r=Math.abs(e.x),a=Math.abs(e.y),l=r>a;return t==="left"||t==="right"?l&&r>n:!l&&a>n};function Gne(e=()=>{}){const t=aa(e);Ou(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function Une(e){return e.nodeType===e.ELEMENT_NODE}function $ne(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function kT(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Xne=dz,Yne=pz,Zne=gz,Wne=yz,qne=vz,Jne=xz,Qne=TT;const to=[];for(let e=0;e<256;++e)to.push((e+256).toString(16).slice(1));function Kne(e,t=0){return(to[e[t+0]]+to[e[t+1]]+to[e[t+2]]+to[e[t+3]]+"-"+to[e[t+4]]+to[e[t+5]]+"-"+to[e[t+6]]+to[e[t+7]]+"-"+to[e[t+8]]+to[e[t+9]]+"-"+to[e[t+10]]+to[e[t+11]]+to[e[t+12]]+to[e[t+13]]+to[e[t+14]]+to[e[t+15]]).toLowerCase()}let RT;const ere=new Uint8Array(16);function tre(){if(!RT){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");RT=crypto.getRandomValues.bind(crypto)}return RT(ere)}const _z={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function OT(e,t,n){if(_z.randomUUID&&!e)return _z.randomUUID();e=e||{};const r=e.random??e.rng?.()??tre();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Kne(r)}const Az=z.createContext(void 0),Tz=z.createContext(void 0),nre=350,rre=({children:e,fixedHeight:t,duration:n=5e3,maxVisible:r=3,...a})=>{const[l,u]=z.useState(new Map),d=z.useRef(new Map),h=z.useRef(null),m=z.useRef(!0),y=z.useCallback(()=>{const R=Array.from(d.current).reverse();if(t){const D=t;R.forEach(([,M],I)=>{if(!M)return;M.setAttribute("data-front",String(I===0)),M.setAttribute("data-hidden",String(I>=r)),M.style.setProperty("--index",String(I)),M.style.setProperty("--height",`${t}px`),M.style.setProperty("--front-height",`${D}px`);const L=t*I;M.style.setProperty("--hover-offset-y",`-${L}px`)})}else{const D=R.map(([,I])=>{if(!I)return 0;const L=I.querySelector(".ToastInner");if(!L)return I.clientHeight;const P=L.style.height;L.style.height="auto";const G=I.clientHeight;return L.style.height=P,G}),M=D[0]||0;R.forEach(([,I],L)=>{if(!I)return;const P=D[L];I.setAttribute("data-front",String(L===0)),I.setAttribute("data-hidden",String(L>=r)),I.style.setProperty("--index",String(L)),I.style.setProperty("--height",`${P}px`),I.style.setProperty("--front-height",`${M}px`);const G=D.slice(0,L).reduce(($,Z)=>$+Z,0);I.style.setProperty("--hover-offset-y",`-${G}px`)})}},[t,r]),v=z.useCallback(R=>{u(D=>{const M=new Map(D);return M.set(OT(),{...R,duration:R.duration||n,open:!0}),M})},[n]),S=z.useCallback(R=>{m.current&&u(D=>{const M=new Map(D);return M.delete(R),M})},[]),w=z.useCallback(R=>v({...R,status:R.status||"default"}),[v]),A=z.useCallback(R=>v({...R,status:"success"}),[v]),E=z.useCallback(R=>v({...R,status:"error"}),[v]);z.useEffect(()=>(m.current=!0,()=>{m.current=!1}),[]),z.useEffect(()=>{const R=h.current;if(R){const D=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","true")})},M=L=>{(!R.contains(L.target)||R===L.target)&&d.current.forEach(P=>{P.setAttribute("data-hovering","false")})},I=()=>{d.current.forEach(L=>{L.setAttribute("data-hovering","false")})};return R.addEventListener("pointermove",D),R.addEventListener("pointerleave",I),R.addEventListener("focusin",D),R.addEventListener("focusout",M),()=>{R.removeEventListener("pointermove",D),R.removeEventListener("pointerleave",I),R.removeEventListener("focusin",D),R.removeEventListener("focusout",M)}}},[]);const k=z.useMemo(()=>Object.assign(w,{success:A,error:E}),[w,A,E]);return T.jsx(Az.Provider,{value:k,children:T.jsx(Tz.Provider,{value:z.useMemo(()=>({toastElementsMapRef:d,sortToasts:y}),[y]),children:T.jsxs(Xne,{...a,children:[e,Array.from(l).map(([R,D])=>T.jsx(ire,{id:R,toast:D,onOpenChange:M=>{M||(d.current.delete(R),y(),u(I=>{const L=new Map(I),P=L.get(R);return P&&L.set(R,{...P,open:!1}),L}),setTimeout(()=>{S(R)},nre))}},R)),T.jsx(Yne,{ref:h,className:"ToastViewport",style:t?{"--fixed-toast-height":`${t}px`}:void 0})]})})})},ore=()=>{const e=z.useContext(Az);if(e)return e;throw new Error("useToast must be used within Toasts")},are=()=>{const e=z.useContext(Tz);if(e)return e;throw new Error("useToastContext must be used within Toasts")},ire=({onOpenChange:e,toast:t,id:n,...r})=>{const a=z.useRef(null),l=are(),{sortToasts:u,toastElementsMapRef:d}=l,h=d.current;return z.useLayoutEffect(()=>(a.current&&(h.set(n,a.current),u()),()=>{h.delete(n),u()}),[n,u,h]),T.jsx(Zne,{...r,ref:a,type:t.type,duration:t.duration,className:"ToastRoot",onOpenChange:e,open:t.open,children:T.jsxs("div",{className:"ToastInner","data-status":t.status,children:[T.jsx(lre,{status:t.status}),t.title&&T.jsx(Wne,{className:"ToastTitle",children:t.title}),T.jsx(qne,{className:"ToastDescription",children:t.description}),t.action&&T.jsx(Jne,{className:"ToastAction Button small green",altText:t.action.altText,onClick:t.action.onClick,asChild:!0,children:T.jsx("button",{children:t.action.label})}),T.jsx(Qne,{"aria-label":"Close",className:"ToastClose",children:T.jsx(cw,{style:{fontSize:"12px"}})})]})})},lre=({status:e})=>e!=="default"&&e?T.jsxs("div",{style:{gridArea:"icon",alignSelf:"start"},children:[e==="success"&&T.jsx(bJ,{style:{color:"#61d345",fontSize:"20px"}}),e==="error"&&T.jsx(xJ,{style:{color:"#ff4b4b",fontSize:"20px"}})]}):null,sre={},kz=e=>{let t;const n=new Set,r=(y,v)=>{const S=typeof y=="function"?y(t):y;if(!Object.is(S,t)){const w=t;t=v??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(A=>A(t,w))}},a=()=>t,h={setState:r,getState:a,getInitialState:()=>m,subscribe:y=>(n.add(y),()=>n.delete(y)),destroy:()=>{(sre?"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."),n.clear()}},m=t=e(r,a,h);return h},Rz=e=>e?kz(e):kz;var Lw={exports:{}},MT={},Pw={exports:{}},NT={};/**
|
|
1037
1037
|
* @license React
|
|
1038
1038
|
* use-sync-external-store-shim.production.js
|
|
1039
1039
|
*
|
|
@@ -1069,12 +1069,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1069
1069
|
`+t.error),n=t.id&&this.messagePromises.get(t.id),n)return n.reject(t.error);break;case"progress":if(!this.context.worker._zustand)return;this.context.worker._zustand.set_progress(t);break;case"workerevent":return await this.context.worker.getEventManager().receive_workerevent(t);case"large_message":return await this.context.worker.handle_large_message_hint(t);default:console.warn("Unhandled message",t);break}}async recieve_bytes(t,n){const{type:r}=t;if(r==="io_value"){if(!this.context.worker._zustand)return;const{node:a,io:l,preview:u,mime:d}=t,h=u?"value":"fullvalue";(!a||!l)&&console.error("Invalid io_value message",t);const m=Uz({data:n,mime:d||"application/octet-stream"});this.context.worker._zustand.on_node_action({type:"update",node:{id:a,io:{[l]:{[h]:m}}},id:a,from_remote:!0})}else if(r=="result"){const a=t.id&&this.messagePromises.get(t.id);a&&a.resolve({bytes:n,header:t})}else console.warn("Unhandled bytes message",t)}async onbytes(t){try{const n=new TextDecoder("utf-8").decode(t),r=n.indexOf(`\r
|
|
1070
1070
|
\r
|
|
1071
1071
|
`);if(r===-1){console.error(`Header terminator not found for:
|
|
1072
|
-
`,n);return}const a=n.substring(0,r+4),l=t.slice(r+4),u=a.split(";"),d={};if(u.forEach(v=>{const[S,w]=v.split("=");d[S.trim()]=w.trim()}),!d.chunk||!d.msgid){console.error("Header missing required fields chunk or msgid",d);return}const[h,m]=d.chunk.split("/"),y=d.msgid;if(h==="1"&&m==="1")return this.recieve_bytes(d,l);if(this.blobChunks[y]||(this.blobChunks[y]={chunks:Array.from({length:parseInt(m)},()=>null),timestamp:Date.now()}),this.blobChunks[y].chunks.length!==parseInt(m)){console.error("Total chunks mismatch");return}if(this.blobChunks[y].chunks[parseInt(h)-1]=t,this.blobChunks[y].chunks.every(v=>v!==null)){const v=new Uint8Array(this.blobChunks[y].chunks.reduce((S,w)=>S.concat(Array.from(w)),[]));this.recieve_bytes(d,v),delete this.blobChunks[y]}}catch(n){console.error("Websocketworker: onbytes error",n,t);return}}}class Ere extends Hu{constructor(){super(...arguments),this._ns_event_intercepts=new Map}start(){}stop(){}async _receive_edge_added(t,n,r,a){this.context.worker._zustand&&this.context.worker._zustand.on_edge_action({type:"add",from_remote:!0,src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a})}async _receive_groups(t){this.context.worker._zustand&&this.context.worker._zustand.on_group_action({type:"set",groups:t})}async _receive_node_added(t){if(this.context.worker._zustand)return this.context.worker._zustand.on_node_action({type:"add",node:t,id:t.id,from_remote:!0})}async receive_workerevent({event:t,data:n}){switch(t){case"worker_error":return this.context.worker._zustand?this.context.worker._zustand.logger.error(n.error):void 0;case"update_worker_dependencies":return this.context.worker._zustand?this.context.worker._zustand.lib.libstate.getState().set({external_worker:n.worker_dependencies}):void 0;case"lib_update":await this.context.worker.getSyncManager().sync_lib();return;case"fullsync":await this.context.worker.getSyncManager().stepwise_fullsync();return;case"external_worker_update":await this.context.worker.getSyncManager().sync_lib(),await this.context.worker.getSyncManager().sync_external_worker();return;case"starting":this.hookManager.call_hooks("starting");return;case"stopping":this.hookManager.call_hooks("stopping");return;default:console.warn("Unhandled worker event",t,n);break}}async intercept_ns_event(t){let n=t;for(const r of this._ns_event_intercepts.get(t.event)||[])n=await r(n);return n}async receive_nodespace_event(t){const{event:n,data:r}=await this.intercept_ns_event(t);switch(n){case"after_set_value":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value:r.result}}},id:r.node,from_remote:!0}):void 0;case"after_update_value_options":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value_options:r.result}}},id:r.node,from_remote:!0}):void 0;case"triggerstart":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}):void 0;case"triggerdone":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0}):void 0;case"triggerfast":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}),setTimeout(()=>{this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0})},50);return;case"node_trigger_error":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"error",errortype:"trigger",error:r.error,id:r.node,tb:r.tb,from_remote:!0}):void 0;case"node_removed":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"delete",id:r.node,from_remote:!0}),this.hookManager.call_hooks("node_removed",{node:r.node});return;case"node_added":this._receive_node_added(r.node);return;case"after_disconnect":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_unforward":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_connect":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_forward":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_add_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"after_remove_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"progress":if(!this.context.worker._zustand)return;if(r.node)return this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,progress:r.info},id:r.node,from_remote:!0});console.warn("Unhandled nodepsace event",n,r);break;default:if(["after_set_nodespace"].includes(n))return;console.warn("Unhandled nodepsace event",n,r);break}}add_ns_event_intercept(t,n){const r=this._ns_event_intercepts.get(t)||[];return r.push(n),this._ns_event_intercepts.set(t,r),()=>{const l=this._ns_event_intercepts.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}}class Cre extends Hu{constructor(){super(...arguments),this._hooks=new Map}start(){}stop(){}add_hook(t,n){const r=this._hooks.get(t)||[];return r.push(n),this._hooks.set(t,r),()=>{const l=this._hooks.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}async call_hooks(t,n){const r=[];for(const a of this._hooks.get(t)||[]){const l=a({worker:this.context.worker,data:n});l instanceof Promise&&r.push(l)}await Promise.all(r)}}class _re extends Hu{start(){}stop(){}async trigger_node(t){await this.communicationManager._send_cmd({cmd:"trigger_node",kwargs:{nid:t},wait_for_response:!1})}async add_node(t){const n=await this.communicationManager._send_cmd({cmd:"add_node",kwargs:{id:t}});return this.eventManager._receive_node_added(n)}async remove_node(t){await this.communicationManager._send_cmd({cmd:"remove_node",kwargs:{id:t}})}locally_update_node(t){this.syncManager.locally_update_node(t)}set_io_value({nid:t,ioid:n,value:r,set_default:a=!1}){return this.communicationManager._send_cmd({cmd:"set_io_value",kwargs:{nid:t,ioid:n,value:r,set_default:a},wait_for_response:!0})}set_io_value_options({nid:t,ioid:n,values:r,keys:a,nullable:l}){return this.communicationManager._send_cmd({cmd:"update_io_value_options",kwargs:{nid:t,ioid:n,options:{options:{type:"enum",values:r,keys:a,nullable:l}}}})}async get_io_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_value",kwargs:{nid:t,ioid:n},wait_for_response:!0});return this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{value:r}}},id:t,from_remote:!0}),r}async get_ios_values({nid:t}){const n=await this.communicationManager._send_cmd({cmd:"get_ios_values",kwargs:{nid:t},wait_for_response:!0});if(!this.context.worker._zustand)return n;const r={};for(const a in n)r[a]={value:n[a]};return this.context.worker._zustand.on_node_action({type:"update",node:{io:r},id:t,from_remote:!0}),n}async get_io_full_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_full_value",kwargs:{nid:t,ioid:n},wait_for_response:!0,as_bytes:!0}),{header:a,bytes:l}=r,{mime:u}=a,d=Uz({data:l,mime:u||"application/octet-stream"});return this.context.worker._zustand?.on_node_action?.({type:"update",node:{id:t,io:{[n]:{fullvalue:d}}},id:t,from_remote:!0}),d}async update_io_options({nid:t,ioid:n,options:r}){const a=await this.communicationManager._send_cmd({cmd:"update_io_options",kwargs:{nid:t,ioid:n,...r},wait_for_response:!0});if(!this.context.worker._zustand)return a;this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{...r}}},id:t,from_remote:!0})}async get_node_status(t){return await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0})}async get_remote_node_state(t){const n=await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0});this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:n,id:n.id,from_remote:!0})}}class Are extends Hu{start(){}stop(){}add_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l=!1}){return this.communicationManager._send_cmd({cmd:"add_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l}})}remove_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}){return this.communicationManager._send_cmd({cmd:"remove_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}})}}class Tre extends Hu{start(){}stop(){}async group_nodes(t,n){const r=await this.communicationManager._send_cmd({cmd:"group_nodes",kwargs:{node_ids:t,group_ids:n},wait_for_response:!0});return this.eventManager._receive_groups(r),r}async remove_group(t){await this.communicationManager._send_cmd({cmd:"remove_group",kwargs:{gid:t},wait_for_response:!0}),await this.syncManager.sync_nodespace()}locally_update_group(t){this.syncManager.locally_update_group(t)}}class kre extends Hu{start(){}stop(){}async add_external_worker({module:t,cls_module:n,cls_name:r}){return await this.communicationManager._send_cmd({cmd:"add_external_worker",kwargs:{module:t,cls_module:n,cls_name:r}})}async add_lib(t,n){return await this.communicationManager._send_cmd({cmd:"add_package_dependency",kwargs:{name:t,version:n},wait_for_response:!1})}async remove_lib(t){return await this.communicationManager._send_cmd({cmd:"remove_package_dependency",kwargs:{name:t},wait_for_response:!1})}async get_available_modules(){return await this.communicationManager._send_cmd({cmd:"get_available_modules",wait_for_response:!0,unique:!0})}async remove_external_worker(t,n){return await this.communicationManager._send_cmd({cmd:"remove_external_worker",kwargs:{worker_id:t,class_id:n},wait_for_response:!0})}}class Rre{getEventManager(){return this._eventManager}getSyncManager(){return this._syncManager}getCommunicationManager(){return this._communicationManager}getConnectionHealthManager(){return this._connectionhealthManager}getHookManager(){return this._hookManager}getNodeManager(){return this._nodeManager}getEdgeManager(){return this._edgeManager}getGroupManager(){return this._groupManager}getLibraryManager(){return this._libraryManager}constructor(t){this.uuid=t.uuid,this.on_error=t.on_error||(r=>{this._zustand?.logger.error(r)}),this.state=mi((r,a)=>({is_open:!1}));const n={worker:this};this._connectionhealthManager=new bre(n),this._communicationManager=new wre(n),this._eventManager=new Ere({...n}),this._syncManager=new xre({...n,on_sync_complete:t.on_sync_complete}),this._hookManager=new Cre(n),this._nodeManager=new _re(n),this._edgeManager=new Are(n),this._groupManager=new Tre(n),this._libraryManager=new kre(n),this._communicationManager.start(),this._connectionhealthManager.start(),this._syncManager.start(),this._eventManager.start(),this._hookManager.start(),this._nodeManager.start(),this._edgeManager.start(),this._groupManager.start(),this._libraryManager.start(),t.zustand&&this.set_zustand(t.zustand),this.api={node:this._nodeManager,group:this._groupManager,edge:this._edgeManager,hooks:this._hookManager,lib:this._libraryManager}}set_zustand(t){t!==this._zustand&&(this._zustand=t,t.set_worker(this),this._zustand.auto_progress(),this._syncManager.stepwise_fullsync())}get is_open(){return this.state.getState().is_open}set is_open(t){this.state.setState({is_open:t})}get is_responsive(){return this._connectionhealthManager.isResponsive()}clear(){return this._communicationManager._send_cmd({cmd:"clear",unique:!0})}save(){return this._communicationManager._send_cmd({cmd:"save",wait_for_response:!0,unique:!0})}load(t){return this._communicationManager._send_cmd({cmd:"load_data",kwargs:{data:t},wait_for_response:!0}).then(()=>{this._syncManager.stepwise_fullsync()})}async get_runstate(){return await this._communicationManager._send_cmd({cmd:"get_runstate",wait_for_response:!0,unique:!0})}async send(t){throw new Error("async send(data: any) not implemented")}async upload_file(t){throw new Error("upload_file not implemented ")}async handle_large_message_hint({}){throw new Error("async handle_large_message_hint({}: LargeMessageHint) not implemented ")}disconnect(){}onclose(){this.is_open=!1,this._zustand&&this._zustand.auto_progress()}async reconnect(){}async stop(){await this._communicationManager._send_cmd({cmd:"stop_worker",wait_for_response:!1});const t=this.onclose.bind(this);this.onclose=()=>{t(),this._zustand&&(this._zustand.worker===this&&this._zustand.clear_all(),this.onclose=t)}}async update_external_worker(t,n,r){return await this._communicationManager._send_cmd({cmd:"update_external_worker",kwargs:{worker_id:t,class_id:n,...r},wait_for_response:!0})}async export({withFiles:t=!1}){return await this._communicationManager._send_cmd({cmd:"export_worker",wait_for_response:!0,kwargs:{with_files:t}})}async update_from_export(t){const n=this._hookManager.add_hook("node_added",async({})=>{this._zustand?.center_all()});try{const r=await this._communicationManager._send_cmd({cmd:"update_from_export",kwargs:{data:t},wait_for_response:!0,response_timeout:6e5,unique:!0});return await new Promise(a=>{setTimeout(()=>{a()},1e3)}),await this._syncManager.stepwise_fullsync(),r}finally{n()}}_send_cmd(t){return this._communicationManager._send_cmd(t)}set_io_value(t){return this._nodeManager.set_io_value(t)}get_io_value(t){return this._nodeManager.get_io_value(t)}}function $z(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ore}=Object.prototype,{getPrototypeOf:LT}=Object,{iterator:Vw,toStringTag:Xz}=Symbol,Fw=(e=>t=>{const n=Ore.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Cl=e=>(e=e.toLowerCase(),t=>Fw(t)===e),Gw=e=>t=>typeof t===e,{isArray:Mm}=Array,sv=Gw("undefined");function uv(e){return e!==null&&!sv(e)&&e.constructor!==null&&!sv(e.constructor)&&ia(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yz=Cl("ArrayBuffer");function Mre(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yz(e.buffer),t}const Nre=Gw("string"),ia=Gw("function"),Zz=Gw("number"),cv=e=>e!==null&&typeof e=="object",Dre=e=>e===!0||e===!1,Uw=e=>{if(Fw(e)!=="object")return!1;const t=LT(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Xz in e)&&!(Vw in e)},Ire=e=>{if(!cv(e)||uv(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},zre=Cl("Date"),jre=Cl("File"),Bre=Cl("Blob"),Lre=Cl("FileList"),Pre=e=>cv(e)&&ia(e.pipe),Hre=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||ia(e.append)&&((t=Fw(e))==="formdata"||t==="object"&&ia(e.toString)&&e.toString()==="[object FormData]"))},Vre=Cl("URLSearchParams"),[Fre,Gre,Ure,$re]=["ReadableStream","Request","Response","Headers"].map(Cl),Xre=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fv(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),Mm(e))for(r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else{if(uv(e))return;const l=n?Object.getOwnPropertyNames(e):Object.keys(e),u=l.length;let d;for(r=0;r<u;r++)d=l[r],t.call(null,e[d],d,e)}}function Wz(e,t){if(uv(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,a;for(;r-- >0;)if(a=n[r],t===a.toLowerCase())return a;return null}const th=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,qz=e=>!sv(e)&&e!==th;function PT(){const{caseless:e}=qz(this)&&this||{},t={},n=(r,a)=>{const l=e&&Wz(t,a)||a;Uw(t[l])&&Uw(r)?t[l]=PT(t[l],r):Uw(r)?t[l]=PT({},r):Mm(r)?t[l]=r.slice():t[l]=r};for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&fv(arguments[r],n);return t}const Yre=(e,t,n,{allOwnKeys:r}={})=>(fv(t,(a,l)=>{n&&ia(a)?e[l]=$z(a,n):e[l]=a},{allOwnKeys:r}),e),Zre=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Wre=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},qre=(e,t,n,r)=>{let a,l,u;const d={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),l=a.length;l-- >0;)u=a[l],(!r||r(u,e,t))&&!d[u]&&(t[u]=e[u],d[u]=!0);e=n!==!1&<(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Jre=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Qre=e=>{if(!e)return null;if(Mm(e))return e;let t=e.length;if(!Zz(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Kre=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&<(Uint8Array)),eoe=(e,t)=>{const r=(e&&e[Vw]).call(e);let a;for(;(a=r.next())&&!a.done;){const l=a.value;t.call(e,l[0],l[1])}},toe=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},noe=Cl("HTMLFormElement"),roe=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),Jz=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ooe=Cl("RegExp"),Qz=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};fv(n,(a,l)=>{let u;(u=t(a,l,e))!==!1&&(r[l]=u||a)}),Object.defineProperties(e,r)},aoe=e=>{Qz(e,(t,n)=>{if(ia(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(ia(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},ioe=(e,t)=>{const n={},r=a=>{a.forEach(l=>{n[l]=!0})};return Mm(e)?r(e):r(String(e).split(t)),n},loe=()=>{},soe=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function uoe(e){return!!(e&&ia(e.append)&&e[Xz]==="FormData"&&e[Vw])}const coe=e=>{const t=new Array(10),n=(r,a)=>{if(cv(r)){if(t.indexOf(r)>=0)return;if(uv(r))return r;if(!("toJSON"in r)){t[a]=r;const l=Mm(r)?[]:{};return fv(r,(u,d)=>{const h=n(u,a+1);!sv(h)&&(l[d]=h)}),t[a]=void 0,l}}return r};return n(e,0)},foe=Cl("AsyncFunction"),doe=e=>e&&(cv(e)||ia(e))&&ia(e.then)&&ia(e.catch),Kz=((e,t)=>e?setImmediate:t?((n,r)=>(th.addEventListener("message",({source:a,data:l})=>{a===th&&l===n&&r.length&&r.shift()()},!1),a=>{r.push(a),th.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ia(th.postMessage)),hoe=typeof queueMicrotask<"u"?queueMicrotask.bind(th):typeof process<"u"&&process.nextTick||Kz,Te={isArray:Mm,isArrayBuffer:Yz,isBuffer:uv,isFormData:Hre,isArrayBufferView:Mre,isString:Nre,isNumber:Zz,isBoolean:Dre,isObject:cv,isPlainObject:Uw,isEmptyObject:Ire,isReadableStream:Fre,isRequest:Gre,isResponse:Ure,isHeaders:$re,isUndefined:sv,isDate:zre,isFile:jre,isBlob:Bre,isRegExp:ooe,isFunction:ia,isStream:Pre,isURLSearchParams:Vre,isTypedArray:Kre,isFileList:Lre,forEach:fv,merge:PT,extend:Yre,trim:Xre,stripBOM:Zre,inherits:Wre,toFlatObject:qre,kindOf:Fw,kindOfTest:Cl,endsWith:Jre,toArray:Qre,forEachEntry:eoe,matchAll:toe,isHTMLForm:noe,hasOwnProperty:Jz,hasOwnProp:Jz,reduceDescriptors:Qz,freezeMethods:aoe,toObjectSet:ioe,toCamelCase:roe,noop:loe,toFiniteNumber:soe,findKey:Wz,global:th,isContextDefined:qz,isSpecCompliantForm:uoe,toJSONObject:coe,isAsyncFn:foe,isThenable:doe,setImmediate:Kz,asap:hoe,isIterable:e=>e!=null&&ia(e[Vw])};function Et(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}Te.inherits(Et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Te.toJSONObject(this.config),code:this.code,status:this.status}}});const ej=Et.prototype,tj={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{tj[e]={value:e}}),Object.defineProperties(Et,tj),Object.defineProperty(ej,"isAxiosError",{value:!0}),Et.from=(e,t,n,r,a,l)=>{const u=Object.create(ej);return Te.toFlatObject(e,u,function(h){return h!==Error.prototype},d=>d!=="isAxiosError"),Et.call(u,e.message,t,n,r,a),u.cause=e,u.name=e.name,l&&Object.assign(u,l),u};const poe=null;function HT(e){return Te.isPlainObject(e)||Te.isArray(e)}function nj(e){return Te.endsWith(e,"[]")?e.slice(0,-2):e}function rj(e,t,n){return e?e.concat(t).map(function(a,l){return a=nj(a),!n&&l?"["+a+"]":a}).join(n?".":""):t}function moe(e){return Te.isArray(e)&&!e.some(HT)}const goe=Te.toFlatObject(Te,{},null,function(t){return/^is[A-Z]/.test(t)});function $w(e,t,n){if(!Te.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=Te.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,k){return!Te.isUndefined(k[E])});const r=n.metaTokens,a=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&Te.isSpecCompliantForm(t);if(!Te.isFunction(a))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(Te.isDate(A))return A.toISOString();if(Te.isBoolean(A))return A.toString();if(!h&&Te.isBlob(A))throw new Et("Blob is not supported. Use a Buffer instead.");return Te.isArrayBuffer(A)||Te.isTypedArray(A)?h&&typeof Blob=="function"?new Blob([A]):Buffer.from(A):A}function y(A,E,k){let R=A;if(A&&!k&&typeof A=="object"){if(Te.endsWith(E,"{}"))E=r?E:E.slice(0,-2),A=JSON.stringify(A);else if(Te.isArray(A)&&moe(A)||(Te.isFileList(A)||Te.endsWith(E,"[]"))&&(R=Te.toArray(A)))return E=nj(E),R.forEach(function(M,I){!(Te.isUndefined(M)||M===null)&&t.append(u===!0?rj([E],I,l):u===null?E:E+"[]",m(M))}),!1}return HT(A)?!0:(t.append(rj(k,E,l),m(A)),!1)}const v=[],S=Object.assign(goe,{defaultVisitor:y,convertValue:m,isVisitable:HT});function w(A,E){if(!Te.isUndefined(A)){if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+E.join("."));v.push(A),Te.forEach(A,function(R,D){(!(Te.isUndefined(R)||R===null)&&a.call(t,R,Te.isString(D)?D.trim():D,E,S))===!0&&w(R,E?E.concat(D):[D])}),v.pop()}}if(!Te.isObject(e))throw new TypeError("data must be an object");return w(e),t}function oj(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function VT(e,t){this._pairs=[],e&&$w(e,this,t)}const aj=VT.prototype;aj.append=function(t,n){this._pairs.push([t,n])},aj.toString=function(t){const n=t?function(r){return t.call(this,r,oj)}:oj;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function yoe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ij(e,t,n){if(!t)return e;const r=n&&n.encode||yoe;Te.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let l;if(a?l=a(t,n):l=Te.isURLSearchParams(t)?t.toString():new VT(t,n).toString(r),l){const u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+l}return e}class lj{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Te.forEach(this.handlers,function(r){r!==null&&t(r)})}}const sj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},voe={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:VT,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},FT=typeof window<"u"&&typeof document<"u",GT=typeof navigator=="object"&&navigator||void 0,boe=FT&&(!GT||["ReactNative","NativeScript","NS"].indexOf(GT.product)<0),xoe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Soe=FT&&window.location.href||"http://localhost",go={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:FT,hasStandardBrowserEnv:boe,hasStandardBrowserWebWorkerEnv:xoe,navigator:GT,origin:Soe},Symbol.toStringTag,{value:"Module"})),...voe};function woe(e,t){return $w(e,new go.classes.URLSearchParams,{visitor:function(n,r,a,l){return go.isNode&&Te.isBuffer(n)?(this.append(r,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...t})}function Eoe(e){return Te.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Coe(e){const t={},n=Object.keys(e);let r;const a=n.length;let l;for(r=0;r<a;r++)l=n[r],t[l]=e[l];return t}function uj(e){function t(n,r,a,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&Te.isArray(a)?a.length:u,h?(Te.hasOwnProp(a,u)?a[u]=[a[u],r]:a[u]=r,!d):((!a[u]||!Te.isObject(a[u]))&&(a[u]=[]),t(n,r,a[u],l)&&Te.isArray(a[u])&&(a[u]=Coe(a[u])),!d)}if(Te.isFormData(e)&&Te.isFunction(e.entries)){const n={};return Te.forEachEntry(e,(r,a)=>{t(Eoe(r),a,n,0)}),n}return null}function _oe(e,t,n){if(Te.isString(e))try{return(t||JSON.parse)(e),Te.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const dv={transitional:sj,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,l=Te.isObject(t);if(l&&Te.isHTMLForm(t)&&(t=new FormData(t)),Te.isFormData(t))return a?JSON.stringify(uj(t)):t;if(Te.isArrayBuffer(t)||Te.isBuffer(t)||Te.isStream(t)||Te.isFile(t)||Te.isBlob(t)||Te.isReadableStream(t))return t;if(Te.isArrayBufferView(t))return t.buffer;if(Te.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let d;if(l){if(r.indexOf("application/x-www-form-urlencoded")>-1)return woe(t,this.formSerializer).toString();if((d=Te.isFileList(t))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return $w(d?{"files[]":t}:t,h&&new h,this.formSerializer)}}return l||a?(n.setContentType("application/json",!1),_oe(t)):t}],transformResponse:[function(t){const n=this.transitional||dv.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(Te.isResponse(t)||Te.isReadableStream(t))return t;if(t&&Te.isString(t)&&(r&&!this.responseType||a)){const u=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t)}catch(d){if(u)throw d.name==="SyntaxError"?Et.from(d,Et.ERR_BAD_RESPONSE,this,null,this.response):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:go.classes.FormData,Blob:go.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Te.forEach(["delete","get","head","post","put","patch"],e=>{dv.headers[e]={}});const Aoe=Te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Toe=e=>{const t={};let n,r,a;return e&&e.split(`
|
|
1072
|
+
`,n);return}const a=n.substring(0,r+4),l=t.slice(r+4),u=a.split(";"),d={};if(u.forEach(v=>{const[S,w]=v.split("=");d[S.trim()]=w.trim()}),!d.chunk||!d.msgid){console.error("Header missing required fields chunk or msgid",d);return}const[h,m]=d.chunk.split("/"),y=d.msgid;if(h==="1"&&m==="1")return this.recieve_bytes(d,l);if(this.blobChunks[y]||(this.blobChunks[y]={chunks:Array.from({length:parseInt(m)},()=>null),timestamp:Date.now()}),this.blobChunks[y].chunks.length!==parseInt(m)){console.error("Total chunks mismatch");return}if(this.blobChunks[y].chunks[parseInt(h)-1]=t,this.blobChunks[y].chunks.every(v=>v!==null)){const v=new Uint8Array(this.blobChunks[y].chunks.reduce((S,w)=>S.concat(Array.from(w)),[]));this.recieve_bytes(d,v),delete this.blobChunks[y]}}catch(n){console.error("Websocketworker: onbytes error",n,t);return}}}class Ere extends Hu{constructor(){super(...arguments),this._ns_event_intercepts=new Map}start(){}stop(){}async _receive_edge_added(t,n,r,a){this.context.worker._zustand&&this.context.worker._zustand.on_edge_action({type:"add",from_remote:!0,src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a})}async _receive_groups(t){this.context.worker._zustand&&this.context.worker._zustand.on_group_action({type:"set",groups:t})}async _receive_node_added(t){if(this.context.worker._zustand)return this.context.worker._zustand.on_node_action({type:"add",node:t,id:t.id,from_remote:!0})}async receive_workerevent({event:t,data:n}){switch(t){case"worker_error":return this.context.worker._zustand?this.context.worker._zustand.logger.error(n.error):void 0;case"update_worker_dependencies":return this.context.worker._zustand?this.context.worker._zustand.lib.libstate.getState().set({external_worker:n.worker_dependencies}):void 0;case"lib_update":await this.context.worker.getSyncManager().sync_lib();return;case"fullsync":await this.context.worker.getSyncManager().stepwise_fullsync();return;case"external_worker_update":await this.context.worker.getSyncManager().sync_lib(),await this.context.worker.getSyncManager().sync_external_worker();return;case"starting":this.hookManager.call_hooks("starting");return;case"stopping":this.hookManager.call_hooks("stopping");return;default:console.warn("Unhandled worker event",t,n);break}}async intercept_ns_event(t){let n=t;for(const r of this._ns_event_intercepts.get(t.event)||[])n=await r(n);return n}async receive_nodespace_event(t){const{event:n,data:r}=await this.intercept_ns_event(t);switch(n){case"after_set_value":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value:r.result}}},id:r.node,from_remote:!0}):void 0;case"after_update_value_options":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,io:{[r.io]:{value_options:r.result}}},id:r.node,from_remote:!0}):void 0;case"triggerstart":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}):void 0;case"triggerdone":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0}):void 0;case"triggerfast":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!0},id:r.node,from_remote:!0}),setTimeout(()=>{this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,in_trigger:!1},id:r.node,from_remote:!0})},50);return;case"node_trigger_error":return this.context.worker._zustand?this.context.worker._zustand.on_node_action({type:"error",errortype:"trigger",error:r.error,id:r.node,tb:r.tb,from_remote:!0}):void 0;case"node_removed":if(!this.context.worker._zustand)return;this.context.worker._zustand.on_node_action({type:"delete",id:r.node,from_remote:!0}),this.hookManager.call_hooks("node_removed",{node:r.node});return;case"node_added":this._receive_node_added(r.node);return;case"after_disconnect":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_unforward":return!r.result||!Array.isArray(r.result)||r.result.length!==4||!this.context.worker._zustand?void 0:this.context.worker._zustand.on_edge_action({type:"delete",from_remote:!0,src_nid:r.result[0],src_ioid:r.result[1],trg_nid:r.result[2],trg_ioid:r.result[3]});case"after_connect":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_forward":return!r.result||!Array.isArray(r.result)||r.result.length!==4?void 0:this._receive_edge_added(...r.result);case"after_add_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"after_remove_shelf":return!r.result||!this.context.worker._zustand?void 0:this.context.worker._zustand.lib.libstate.getState().set({lib:r.result});case"progress":if(!this.context.worker._zustand)return;if(r.node)return this.context.worker._zustand.on_node_action({type:"update",node:{id:r.node,progress:r.info},id:r.node,from_remote:!0});console.warn("Unhandled nodepsace event",n,r);break;default:if(["after_set_nodespace"].includes(n))return;console.warn("Unhandled nodepsace event",n,r);break}}add_ns_event_intercept(t,n){const r=this._ns_event_intercepts.get(t)||[];return r.push(n),this._ns_event_intercepts.set(t,r),()=>{const l=this._ns_event_intercepts.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}}class Cre extends Hu{constructor(){super(...arguments),this._hooks=new Map}start(){}stop(){}add_hook(t,n){const r=this._hooks.get(t)||[];return r.push(n),this._hooks.set(t,r),()=>{const l=this._hooks.get(t)||[],u=l.indexOf(n);u>=0&&l.splice(u,1)}}async call_hooks(t,n){const r=[];for(const a of this._hooks.get(t)||[]){const l=a({worker:this.context.worker,data:n});l instanceof Promise&&r.push(l)}await Promise.all(r)}}class _re extends Hu{start(){}stop(){}async trigger_node(t){await this.communicationManager._send_cmd({cmd:"trigger_node",kwargs:{nid:t},wait_for_response:!1})}async add_node(t){const n=await this.communicationManager._send_cmd({cmd:"add_node",kwargs:{id:t}});return this.eventManager._receive_node_added(n)}async remove_node(t){await this.communicationManager._send_cmd({cmd:"remove_node",kwargs:{id:t}})}locally_update_node(t){this.syncManager.locally_update_node(t)}set_io_value({nid:t,ioid:n,value:r,set_default:a=!1}){return this.communicationManager._send_cmd({cmd:"set_io_value",kwargs:{nid:t,ioid:n,value:r,set_default:a},wait_for_response:!0})}set_io_value_options({nid:t,ioid:n,values:r,keys:a,nullable:l}){return this.communicationManager._send_cmd({cmd:"update_io_value_options",kwargs:{nid:t,ioid:n,options:{options:{type:"enum",values:r,keys:a,nullable:l}}}})}async get_io_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_value",kwargs:{nid:t,ioid:n},wait_for_response:!0});return this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{value:r}}},id:t,from_remote:!0}),r}async get_ios_values({nid:t}){const n=await this.communicationManager._send_cmd({cmd:"get_ios_values",kwargs:{nid:t},wait_for_response:!0});if(!this.context.worker._zustand)return n;const r={};for(const a in n)r[a]={value:n[a]};return this.context.worker._zustand.on_node_action({type:"update",node:{io:r},id:t,from_remote:!0}),n}async get_io_full_value({nid:t,ioid:n}){const r=await this.communicationManager._send_cmd({cmd:"get_io_full_value",kwargs:{nid:t,ioid:n},wait_for_response:!0,as_bytes:!0}),{header:a,bytes:l}=r,{mime:u}=a,d=Uz({data:l,mime:u||"application/octet-stream"});return this.context.worker._zustand?.on_node_action?.({type:"update",node:{id:t,io:{[n]:{fullvalue:d}}},id:t,from_remote:!0}),d}async update_io_options({nid:t,ioid:n,options:r}){const a=await this.communicationManager._send_cmd({cmd:"update_io_options",kwargs:{nid:t,ioid:n,...r},wait_for_response:!0});if(!this.context.worker._zustand)return a;this.context.worker._zustand.on_node_action({type:"update",node:{io:{[n]:{...r}}},id:t,from_remote:!0})}async get_node_status(t){return await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0})}async get_remote_node_state(t){const n=await this.communicationManager._send_cmd({cmd:"get_node_state",kwargs:{nid:t},wait_for_response:!0});this.context.worker._zustand&&this.context.worker._zustand.on_node_action({type:"update",node:n,id:n.id,from_remote:!0})}}class Are extends Hu{start(){}stop(){}add_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l=!1}){return this.communicationManager._send_cmd({cmd:"add_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a,replace:l}})}remove_edge({src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}){return this.communicationManager._send_cmd({cmd:"remove_edge",kwargs:{src_nid:t,src_ioid:n,trg_nid:r,trg_ioid:a}})}}class Tre extends Hu{start(){}stop(){}async group_nodes(t,n){const r=await this.communicationManager._send_cmd({cmd:"group_nodes",kwargs:{node_ids:t,group_ids:n},wait_for_response:!0});return this.eventManager._receive_groups(r),r}async remove_group(t){await this.communicationManager._send_cmd({cmd:"remove_group",kwargs:{gid:t},wait_for_response:!0}),await this.syncManager.sync_nodespace()}locally_update_group(t){this.syncManager.locally_update_group(t)}}class kre extends Hu{start(){}stop(){}async add_external_worker({module:t,cls_module:n,cls_name:r}){return await this.communicationManager._send_cmd({cmd:"add_external_worker",kwargs:{module:t,cls_module:n,cls_name:r}})}async add_lib(t,n){return await this.communicationManager._send_cmd({cmd:"add_package_dependency",kwargs:{name:t,version:n},wait_for_response:!1})}async remove_lib(t){return await this.communicationManager._send_cmd({cmd:"remove_package_dependency",kwargs:{name:t},wait_for_response:!1})}async get_available_modules(){return await this.communicationManager._send_cmd({cmd:"get_available_modules",wait_for_response:!0,unique:!0})}async remove_external_worker(t,n){return await this.communicationManager._send_cmd({cmd:"remove_external_worker",kwargs:{worker_id:t,class_id:n},wait_for_response:!0})}}class Rre{getEventManager(){return this._eventManager}getSyncManager(){return this._syncManager}getCommunicationManager(){return this._communicationManager}getConnectionHealthManager(){return this._connectionhealthManager}getHookManager(){return this._hookManager}getNodeManager(){return this._nodeManager}getEdgeManager(){return this._edgeManager}getGroupManager(){return this._groupManager}getLibraryManager(){return this._libraryManager}constructor(t){this.uuid=t.uuid,this.on_error=t.on_error||(r=>{this._zustand?.logger.error(r)}),this.state=mi((r,a)=>({is_open:!1}));const n={worker:this};this._connectionhealthManager=new bre(n),this._communicationManager=new wre(n),this._eventManager=new Ere({...n}),this._syncManager=new xre({...n,on_sync_complete:t.on_sync_complete}),this._hookManager=new Cre(n),this._nodeManager=new _re(n),this._edgeManager=new Are(n),this._groupManager=new Tre(n),this._libraryManager=new kre(n),this._communicationManager.start(),this._connectionhealthManager.start(),this._syncManager.start(),this._eventManager.start(),this._hookManager.start(),this._nodeManager.start(),this._edgeManager.start(),this._groupManager.start(),this._libraryManager.start(),t.zustand&&this.set_zustand(t.zustand),this.api={node:this._nodeManager,group:this._groupManager,edge:this._edgeManager,hooks:this._hookManager,lib:this._libraryManager}}set_zustand(t){t!==this._zustand&&(t.logger.debug("Setting zustand for worker"),this._zustand=t,t.set_worker(this),this._zustand.auto_progress(),this._syncManager.stepwise_fullsync())}get is_open(){return this.state.getState().is_open}set is_open(t){this.state.setState({is_open:t})}get is_responsive(){return this._connectionhealthManager.isResponsive()}clear(){return this._communicationManager._send_cmd({cmd:"clear",unique:!0})}save(){return this._communicationManager._send_cmd({cmd:"save",wait_for_response:!0,unique:!0})}load(t){return this._communicationManager._send_cmd({cmd:"load_data",kwargs:{data:t},wait_for_response:!0}).then(()=>{this._syncManager.stepwise_fullsync()})}async get_runstate(){return await this._communicationManager._send_cmd({cmd:"get_runstate",wait_for_response:!0,unique:!0})}async send(t){throw new Error("async send(data: any) not implemented")}async upload_file(t){throw new Error("upload_file not implemented ")}async handle_large_message_hint({}){throw new Error("async handle_large_message_hint({}: LargeMessageHint) not implemented ")}disconnect(){}onclose(){this.is_open=!1,this._zustand&&this._zustand.auto_progress()}async reconnect(){}async stop(){await this._communicationManager._send_cmd({cmd:"stop_worker",wait_for_response:!1});const t=this.onclose.bind(this);this.onclose=()=>{t(),this._zustand&&(this._zustand.worker===this&&this._zustand.clear_all(),this.onclose=t)}}async update_external_worker(t,n,r){return await this._communicationManager._send_cmd({cmd:"update_external_worker",kwargs:{worker_id:t,class_id:n,...r},wait_for_response:!0})}async export({withFiles:t=!1}){return await this._communicationManager._send_cmd({cmd:"export_worker",wait_for_response:!0,kwargs:{with_files:t}})}async update_from_export(t){const n=this._hookManager.add_hook("node_added",async({})=>{this._zustand?.center_all()});try{const r=await this._communicationManager._send_cmd({cmd:"update_from_export",kwargs:{data:t},wait_for_response:!0,response_timeout:6e5,unique:!0});return await new Promise(a=>{setTimeout(()=>{a()},1e3)}),await this._syncManager.stepwise_fullsync(),r}finally{n()}}_send_cmd(t){return this._communicationManager._send_cmd(t)}set_io_value(t){return this._nodeManager.set_io_value(t)}get_io_value(t){return this._nodeManager.get_io_value(t)}}function $z(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ore}=Object.prototype,{getPrototypeOf:LT}=Object,{iterator:Vw,toStringTag:Xz}=Symbol,Fw=(e=>t=>{const n=Ore.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Cl=e=>(e=e.toLowerCase(),t=>Fw(t)===e),Gw=e=>t=>typeof t===e,{isArray:Mm}=Array,sv=Gw("undefined");function uv(e){return e!==null&&!sv(e)&&e.constructor!==null&&!sv(e.constructor)&&ia(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Yz=Cl("ArrayBuffer");function Mre(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Yz(e.buffer),t}const Nre=Gw("string"),ia=Gw("function"),Zz=Gw("number"),cv=e=>e!==null&&typeof e=="object",Dre=e=>e===!0||e===!1,Uw=e=>{if(Fw(e)!=="object")return!1;const t=LT(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Xz in e)&&!(Vw in e)},Ire=e=>{if(!cv(e)||uv(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},zre=Cl("Date"),jre=Cl("File"),Bre=Cl("Blob"),Lre=Cl("FileList"),Pre=e=>cv(e)&&ia(e.pipe),Hre=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||ia(e.append)&&((t=Fw(e))==="formdata"||t==="object"&&ia(e.toString)&&e.toString()==="[object FormData]"))},Vre=Cl("URLSearchParams"),[Fre,Gre,Ure,$re]=["ReadableStream","Request","Response","Headers"].map(Cl),Xre=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function fv(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,a;if(typeof e!="object"&&(e=[e]),Mm(e))for(r=0,a=e.length;r<a;r++)t.call(null,e[r],r,e);else{if(uv(e))return;const l=n?Object.getOwnPropertyNames(e):Object.keys(e),u=l.length;let d;for(r=0;r<u;r++)d=l[r],t.call(null,e[d],d,e)}}function Wz(e,t){if(uv(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,a;for(;r-- >0;)if(a=n[r],t===a.toLowerCase())return a;return null}const th=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,qz=e=>!sv(e)&&e!==th;function PT(){const{caseless:e}=qz(this)&&this||{},t={},n=(r,a)=>{const l=e&&Wz(t,a)||a;Uw(t[l])&&Uw(r)?t[l]=PT(t[l],r):Uw(r)?t[l]=PT({},r):Mm(r)?t[l]=r.slice():t[l]=r};for(let r=0,a=arguments.length;r<a;r++)arguments[r]&&fv(arguments[r],n);return t}const Yre=(e,t,n,{allOwnKeys:r}={})=>(fv(t,(a,l)=>{n&&ia(a)?e[l]=$z(a,n):e[l]=a},{allOwnKeys:r}),e),Zre=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Wre=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},qre=(e,t,n,r)=>{let a,l,u;const d={};if(t=t||{},e==null)return t;do{for(a=Object.getOwnPropertyNames(e),l=a.length;l-- >0;)u=a[l],(!r||r(u,e,t))&&!d[u]&&(t[u]=e[u],d[u]=!0);e=n!==!1&<(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Jre=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Qre=e=>{if(!e)return null;if(Mm(e))return e;let t=e.length;if(!Zz(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Kre=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&<(Uint8Array)),eoe=(e,t)=>{const r=(e&&e[Vw]).call(e);let a;for(;(a=r.next())&&!a.done;){const l=a.value;t.call(e,l[0],l[1])}},toe=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},noe=Cl("HTMLFormElement"),roe=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,a){return r.toUpperCase()+a}),Jz=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ooe=Cl("RegExp"),Qz=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};fv(n,(a,l)=>{let u;(u=t(a,l,e))!==!1&&(r[l]=u||a)}),Object.defineProperties(e,r)},aoe=e=>{Qz(e,(t,n)=>{if(ia(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(ia(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},ioe=(e,t)=>{const n={},r=a=>{a.forEach(l=>{n[l]=!0})};return Mm(e)?r(e):r(String(e).split(t)),n},loe=()=>{},soe=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function uoe(e){return!!(e&&ia(e.append)&&e[Xz]==="FormData"&&e[Vw])}const coe=e=>{const t=new Array(10),n=(r,a)=>{if(cv(r)){if(t.indexOf(r)>=0)return;if(uv(r))return r;if(!("toJSON"in r)){t[a]=r;const l=Mm(r)?[]:{};return fv(r,(u,d)=>{const h=n(u,a+1);!sv(h)&&(l[d]=h)}),t[a]=void 0,l}}return r};return n(e,0)},foe=Cl("AsyncFunction"),doe=e=>e&&(cv(e)||ia(e))&&ia(e.then)&&ia(e.catch),Kz=((e,t)=>e?setImmediate:t?((n,r)=>(th.addEventListener("message",({source:a,data:l})=>{a===th&&l===n&&r.length&&r.shift()()},!1),a=>{r.push(a),th.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ia(th.postMessage)),hoe=typeof queueMicrotask<"u"?queueMicrotask.bind(th):typeof process<"u"&&process.nextTick||Kz,Te={isArray:Mm,isArrayBuffer:Yz,isBuffer:uv,isFormData:Hre,isArrayBufferView:Mre,isString:Nre,isNumber:Zz,isBoolean:Dre,isObject:cv,isPlainObject:Uw,isEmptyObject:Ire,isReadableStream:Fre,isRequest:Gre,isResponse:Ure,isHeaders:$re,isUndefined:sv,isDate:zre,isFile:jre,isBlob:Bre,isRegExp:ooe,isFunction:ia,isStream:Pre,isURLSearchParams:Vre,isTypedArray:Kre,isFileList:Lre,forEach:fv,merge:PT,extend:Yre,trim:Xre,stripBOM:Zre,inherits:Wre,toFlatObject:qre,kindOf:Fw,kindOfTest:Cl,endsWith:Jre,toArray:Qre,forEachEntry:eoe,matchAll:toe,isHTMLForm:noe,hasOwnProperty:Jz,hasOwnProp:Jz,reduceDescriptors:Qz,freezeMethods:aoe,toObjectSet:ioe,toCamelCase:roe,noop:loe,toFiniteNumber:soe,findKey:Wz,global:th,isContextDefined:qz,isSpecCompliantForm:uoe,toJSONObject:coe,isAsyncFn:foe,isThenable:doe,setImmediate:Kz,asap:hoe,isIterable:e=>e!=null&&ia(e[Vw])};function Et(e,t,n,r,a){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),a&&(this.response=a,this.status=a.status?a.status:null)}Te.inherits(Et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Te.toJSONObject(this.config),code:this.code,status:this.status}}});const ej=Et.prototype,tj={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{tj[e]={value:e}}),Object.defineProperties(Et,tj),Object.defineProperty(ej,"isAxiosError",{value:!0}),Et.from=(e,t,n,r,a,l)=>{const u=Object.create(ej);return Te.toFlatObject(e,u,function(h){return h!==Error.prototype},d=>d!=="isAxiosError"),Et.call(u,e.message,t,n,r,a),u.cause=e,u.name=e.name,l&&Object.assign(u,l),u};const poe=null;function HT(e){return Te.isPlainObject(e)||Te.isArray(e)}function nj(e){return Te.endsWith(e,"[]")?e.slice(0,-2):e}function rj(e,t,n){return e?e.concat(t).map(function(a,l){return a=nj(a),!n&&l?"["+a+"]":a}).join(n?".":""):t}function moe(e){return Te.isArray(e)&&!e.some(HT)}const goe=Te.toFlatObject(Te,{},null,function(t){return/^is[A-Z]/.test(t)});function $w(e,t,n){if(!Te.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=Te.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(E,k){return!Te.isUndefined(k[E])});const r=n.metaTokens,a=n.visitor||y,l=n.dots,u=n.indexes,h=(n.Blob||typeof Blob<"u"&&Blob)&&Te.isSpecCompliantForm(t);if(!Te.isFunction(a))throw new TypeError("visitor must be a function");function m(A){if(A===null)return"";if(Te.isDate(A))return A.toISOString();if(Te.isBoolean(A))return A.toString();if(!h&&Te.isBlob(A))throw new Et("Blob is not supported. Use a Buffer instead.");return Te.isArrayBuffer(A)||Te.isTypedArray(A)?h&&typeof Blob=="function"?new Blob([A]):Buffer.from(A):A}function y(A,E,k){let R=A;if(A&&!k&&typeof A=="object"){if(Te.endsWith(E,"{}"))E=r?E:E.slice(0,-2),A=JSON.stringify(A);else if(Te.isArray(A)&&moe(A)||(Te.isFileList(A)||Te.endsWith(E,"[]"))&&(R=Te.toArray(A)))return E=nj(E),R.forEach(function(M,I){!(Te.isUndefined(M)||M===null)&&t.append(u===!0?rj([E],I,l):u===null?E:E+"[]",m(M))}),!1}return HT(A)?!0:(t.append(rj(k,E,l),m(A)),!1)}const v=[],S=Object.assign(goe,{defaultVisitor:y,convertValue:m,isVisitable:HT});function w(A,E){if(!Te.isUndefined(A)){if(v.indexOf(A)!==-1)throw Error("Circular reference detected in "+E.join("."));v.push(A),Te.forEach(A,function(R,D){(!(Te.isUndefined(R)||R===null)&&a.call(t,R,Te.isString(D)?D.trim():D,E,S))===!0&&w(R,E?E.concat(D):[D])}),v.pop()}}if(!Te.isObject(e))throw new TypeError("data must be an object");return w(e),t}function oj(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function VT(e,t){this._pairs=[],e&&$w(e,this,t)}const aj=VT.prototype;aj.append=function(t,n){this._pairs.push([t,n])},aj.toString=function(t){const n=t?function(r){return t.call(this,r,oj)}:oj;return this._pairs.map(function(a){return n(a[0])+"="+n(a[1])},"").join("&")};function yoe(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ij(e,t,n){if(!t)return e;const r=n&&n.encode||yoe;Te.isFunction(n)&&(n={serialize:n});const a=n&&n.serialize;let l;if(a?l=a(t,n):l=Te.isURLSearchParams(t)?t.toString():new VT(t,n).toString(r),l){const u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+l}return e}class lj{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Te.forEach(this.handlers,function(r){r!==null&&t(r)})}}const sj={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},voe={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<"u"?URLSearchParams:VT,FormData:typeof FormData<"u"?FormData:null,Blob:typeof Blob<"u"?Blob:null},protocols:["http","https","file","blob","url","data"]},FT=typeof window<"u"&&typeof document<"u",GT=typeof navigator=="object"&&navigator||void 0,boe=FT&&(!GT||["ReactNative","NativeScript","NS"].indexOf(GT.product)<0),xoe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Soe=FT&&window.location.href||"http://localhost",go={...Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:FT,hasStandardBrowserEnv:boe,hasStandardBrowserWebWorkerEnv:xoe,navigator:GT,origin:Soe},Symbol.toStringTag,{value:"Module"})),...voe};function woe(e,t){return $w(e,new go.classes.URLSearchParams,{visitor:function(n,r,a,l){return go.isNode&&Te.isBuffer(n)?(this.append(r,n.toString("base64")),!1):l.defaultVisitor.apply(this,arguments)},...t})}function Eoe(e){return Te.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Coe(e){const t={},n=Object.keys(e);let r;const a=n.length;let l;for(r=0;r<a;r++)l=n[r],t[l]=e[l];return t}function uj(e){function t(n,r,a,l){let u=n[l++];if(u==="__proto__")return!0;const d=Number.isFinite(+u),h=l>=n.length;return u=!u&&Te.isArray(a)?a.length:u,h?(Te.hasOwnProp(a,u)?a[u]=[a[u],r]:a[u]=r,!d):((!a[u]||!Te.isObject(a[u]))&&(a[u]=[]),t(n,r,a[u],l)&&Te.isArray(a[u])&&(a[u]=Coe(a[u])),!d)}if(Te.isFormData(e)&&Te.isFunction(e.entries)){const n={};return Te.forEachEntry(e,(r,a)=>{t(Eoe(r),a,n,0)}),n}return null}function _oe(e,t,n){if(Te.isString(e))try{return(t||JSON.parse)(e),Te.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const dv={transitional:sj,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",a=r.indexOf("application/json")>-1,l=Te.isObject(t);if(l&&Te.isHTMLForm(t)&&(t=new FormData(t)),Te.isFormData(t))return a?JSON.stringify(uj(t)):t;if(Te.isArrayBuffer(t)||Te.isBuffer(t)||Te.isStream(t)||Te.isFile(t)||Te.isBlob(t)||Te.isReadableStream(t))return t;if(Te.isArrayBufferView(t))return t.buffer;if(Te.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let d;if(l){if(r.indexOf("application/x-www-form-urlencoded")>-1)return woe(t,this.formSerializer).toString();if((d=Te.isFileList(t))||r.indexOf("multipart/form-data")>-1){const h=this.env&&this.env.FormData;return $w(d?{"files[]":t}:t,h&&new h,this.formSerializer)}}return l||a?(n.setContentType("application/json",!1),_oe(t)):t}],transformResponse:[function(t){const n=this.transitional||dv.transitional,r=n&&n.forcedJSONParsing,a=this.responseType==="json";if(Te.isResponse(t)||Te.isReadableStream(t))return t;if(t&&Te.isString(t)&&(r&&!this.responseType||a)){const u=!(n&&n.silentJSONParsing)&&a;try{return JSON.parse(t)}catch(d){if(u)throw d.name==="SyntaxError"?Et.from(d,Et.ERR_BAD_RESPONSE,this,null,this.response):d}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:go.classes.FormData,Blob:go.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Te.forEach(["delete","get","head","post","put","patch"],e=>{dv.headers[e]={}});const Aoe=Te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Toe=e=>{const t={};let n,r,a;return e&&e.split(`
|
|
1073
1073
|
`).forEach(function(u){a=u.indexOf(":"),n=u.substring(0,a).trim().toLowerCase(),r=u.substring(a+1).trim(),!(!n||t[n]&&Aoe[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},cj=Symbol("internals");function hv(e){return e&&String(e).trim().toLowerCase()}function Xw(e){return e===!1||e==null?e:Te.isArray(e)?e.map(Xw):String(e)}function koe(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Roe=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function UT(e,t,n,r,a){if(Te.isFunction(r))return r.call(this,t,n);if(a&&(t=n),!!Te.isString(t)){if(Te.isString(r))return t.indexOf(r)!==-1;if(Te.isRegExp(r))return r.test(t)}}function Ooe(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Moe(e,t){const n=Te.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(a,l,u){return this[r].call(this,t,a,l,u)},configurable:!0})})}let la=class{constructor(t){t&&this.set(t)}set(t,n,r){const a=this;function l(d,h,m){const y=hv(h);if(!y)throw new Error("header name must be a non-empty string");const v=Te.findKey(a,y);(!v||a[v]===void 0||m===!0||m===void 0&&a[v]!==!1)&&(a[v||h]=Xw(d))}const u=(d,h)=>Te.forEach(d,(m,y)=>l(m,y,h));if(Te.isPlainObject(t)||t instanceof this.constructor)u(t,n);else if(Te.isString(t)&&(t=t.trim())&&!Roe(t))u(Toe(t),n);else if(Te.isObject(t)&&Te.isIterable(t)){let d={},h,m;for(const y of t){if(!Te.isArray(y))throw TypeError("Object iterator must return a key-value pair");d[m=y[0]]=(h=d[m])?Te.isArray(h)?[...h,y[1]]:[h,y[1]]:y[1]}u(d,n)}else t!=null&&l(n,t,r);return this}get(t,n){if(t=hv(t),t){const r=Te.findKey(this,t);if(r){const a=this[r];if(!n)return a;if(n===!0)return koe(a);if(Te.isFunction(n))return n.call(this,a,r);if(Te.isRegExp(n))return n.exec(a);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=hv(t),t){const r=Te.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||UT(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let a=!1;function l(u){if(u=hv(u),u){const d=Te.findKey(r,u);d&&(!n||UT(r,r[d],d,n))&&(delete r[d],a=!0)}}return Te.isArray(t)?t.forEach(l):l(t),a}clear(t){const n=Object.keys(this);let r=n.length,a=!1;for(;r--;){const l=n[r];(!t||UT(this,this[l],l,t,!0))&&(delete this[l],a=!0)}return a}normalize(t){const n=this,r={};return Te.forEach(this,(a,l)=>{const u=Te.findKey(r,l);if(u){n[u]=Xw(a),delete n[l];return}const d=t?Ooe(l):String(l).trim();d!==l&&delete n[l],n[d]=Xw(a),r[d]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return Te.forEach(this,(r,a)=>{r!=null&&r!==!1&&(n[a]=t&&Te.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
1074
1074
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[cj]=this[cj]={accessors:{}}).accessors,a=this.prototype;function l(u){const d=hv(u);r[d]||(Moe(a,u),r[d]=!0)}return Te.isArray(t)?t.forEach(l):l(t),this}};la.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Te.reduceDescriptors(la.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}}),Te.freezeMethods(la);function $T(e,t){const n=this||dv,r=t||n,a=la.from(r.headers);let l=r.data;return Te.forEach(e,function(d){l=d.call(n,l,a.normalize(),t?t.status:void 0)}),a.normalize(),l}function fj(e){return!!(e&&e.__CANCEL__)}function Nm(e,t,n){Et.call(this,e??"canceled",Et.ERR_CANCELED,t,n),this.name="CanceledError"}Te.inherits(Nm,Et,{__CANCEL__:!0});function dj(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Et("Request failed with status code "+n.status,[Et.ERR_BAD_REQUEST,Et.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Noe(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Doe(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,l=0,u;return t=t!==void 0?t:1e3,function(h){const m=Date.now(),y=r[l];u||(u=m),n[a]=h,r[a]=m;let v=l,S=0;for(;v!==a;)S+=n[v++],v=v%e;if(a=(a+1)%e,a===l&&(l=(l+1)%e),m-u<t)return;const w=y&&m-y;return w?Math.round(S*1e3/w):void 0}}function Ioe(e,t){let n=0,r=1e3/t,a,l;const u=(m,y=Date.now())=>{n=y,a=null,l&&(clearTimeout(l),l=null),e(...m)};return[(...m)=>{const y=Date.now(),v=y-n;v>=r?u(m,y):(a=m,l||(l=setTimeout(()=>{l=null,u(a)},r-v)))},()=>a&&u(a)]}const Yw=(e,t,n=3)=>{let r=0;const a=Doe(50,250);return Ioe(l=>{const u=l.loaded,d=l.lengthComputable?l.total:void 0,h=u-r,m=a(h),y=u<=d;r=u;const v={loaded:u,total:d,progress:d?u/d:void 0,bytes:h,rate:m||void 0,estimated:m&&d&&y?(d-u)/m:void 0,event:l,lengthComputable:d!=null,[t?"download":"upload"]:!0};e(v)},n)},hj=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},pj=e=>(...t)=>Te.asap(()=>e(...t)),zoe=go.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,go.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(go.origin),go.navigator&&/(msie|trident)/i.test(go.navigator.userAgent)):()=>!0,joe=go.hasStandardBrowserEnv?{write(e,t,n,r,a,l){const u=[e+"="+encodeURIComponent(t)];Te.isNumber(n)&&u.push("expires="+new Date(n).toGMTString()),Te.isString(r)&&u.push("path="+r),Te.isString(a)&&u.push("domain="+a),l===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Boe(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Loe(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function mj(e,t,n){let r=!Boe(t);return e&&(r||n==!1)?Loe(e,t):t}const gj=e=>e instanceof la?{...e}:e;function nh(e,t){t=t||{};const n={};function r(m,y,v,S){return Te.isPlainObject(m)&&Te.isPlainObject(y)?Te.merge.call({caseless:S},m,y):Te.isPlainObject(y)?Te.merge({},y):Te.isArray(y)?y.slice():y}function a(m,y,v,S){if(Te.isUndefined(y)){if(!Te.isUndefined(m))return r(void 0,m,v,S)}else return r(m,y,v,S)}function l(m,y){if(!Te.isUndefined(y))return r(void 0,y)}function u(m,y){if(Te.isUndefined(y)){if(!Te.isUndefined(m))return r(void 0,m)}else return r(void 0,y)}function d(m,y,v){if(v in t)return r(m,y);if(v in e)return r(void 0,m)}const h={url:l,method:l,data:l,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:d,headers:(m,y,v)=>a(gj(m),gj(y),v,!0)};return Te.forEach(Object.keys({...e,...t}),function(y){const v=h[y]||a,S=v(e[y],t[y],y);Te.isUndefined(S)&&v!==d||(n[y]=S)}),n}const yj=e=>{const t=nh({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:a,xsrfCookieName:l,headers:u,auth:d}=t;t.headers=u=la.from(u),t.url=ij(mj(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),d&&u.set("Authorization","Basic "+btoa((d.username||"")+":"+(d.password?unescape(encodeURIComponent(d.password)):"")));let h;if(Te.isFormData(n)){if(go.hasStandardBrowserEnv||go.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((h=u.getContentType())!==!1){const[m,...y]=h?h.split(";").map(v=>v.trim()).filter(Boolean):[];u.setContentType([m||"multipart/form-data",...y].join("; "))}}if(go.hasStandardBrowserEnv&&(r&&Te.isFunction(r)&&(r=r(t)),r||r!==!1&&zoe(t.url))){const m=a&&l&&joe.read(l);m&&u.set(a,m)}return t},Poe=typeof XMLHttpRequest<"u"&&function(e){return new Promise(function(n,r){const a=yj(e);let l=a.data;const u=la.from(a.headers).normalize();let{responseType:d,onUploadProgress:h,onDownloadProgress:m}=a,y,v,S,w,A;function E(){w&&w(),A&&A(),a.cancelToken&&a.cancelToken.unsubscribe(y),a.signal&&a.signal.removeEventListener("abort",y)}let k=new XMLHttpRequest;k.open(a.method.toUpperCase(),a.url,!0),k.timeout=a.timeout;function R(){if(!k)return;const M=la.from("getAllResponseHeaders"in k&&k.getAllResponseHeaders()),L={data:!d||d==="text"||d==="json"?k.responseText:k.response,status:k.status,statusText:k.statusText,headers:M,config:e,request:k};dj(function(G){n(G),E()},function(G){r(G),E()},L),k=null}"onloadend"in k?k.onloadend=R:k.onreadystatechange=function(){!k||k.readyState!==4||k.status===0&&!(k.responseURL&&k.responseURL.indexOf("file:")===0)||setTimeout(R)},k.onabort=function(){k&&(r(new Et("Request aborted",Et.ECONNABORTED,e,k)),k=null)},k.onerror=function(){r(new Et("Network Error",Et.ERR_NETWORK,e,k)),k=null},k.ontimeout=function(){let I=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const L=a.transitional||sj;a.timeoutErrorMessage&&(I=a.timeoutErrorMessage),r(new Et(I,L.clarifyTimeoutError?Et.ETIMEDOUT:Et.ECONNABORTED,e,k)),k=null},l===void 0&&u.setContentType(null),"setRequestHeader"in k&&Te.forEach(u.toJSON(),function(I,L){k.setRequestHeader(L,I)}),Te.isUndefined(a.withCredentials)||(k.withCredentials=!!a.withCredentials),d&&d!=="json"&&(k.responseType=a.responseType),m&&([S,A]=Yw(m,!0),k.addEventListener("progress",S)),h&&k.upload&&([v,w]=Yw(h),k.upload.addEventListener("progress",v),k.upload.addEventListener("loadend",w)),(a.cancelToken||a.signal)&&(y=M=>{k&&(r(!M||M.type?new Nm(null,e,k):M),k.abort(),k=null)},a.cancelToken&&a.cancelToken.subscribe(y),a.signal&&(a.signal.aborted?y():a.signal.addEventListener("abort",y)));const D=Noe(a.url);if(D&&go.protocols.indexOf(D)===-1){r(new Et("Unsupported protocol "+D+":",Et.ERR_BAD_REQUEST,e));return}k.send(l||null)})},Hoe=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,a;const l=function(m){if(!a){a=!0,d();const y=m instanceof Error?m:this.reason;r.abort(y instanceof Et?y:new Nm(y instanceof Error?y.message:y))}};let u=t&&setTimeout(()=>{u=null,l(new Et(`timeout ${t} of ms exceeded`,Et.ETIMEDOUT))},t);const d=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(m=>{m.unsubscribe?m.unsubscribe(l):m.removeEventListener("abort",l)}),e=null)};e.forEach(m=>m.addEventListener("abort",l));const{signal:h}=r;return h.unsubscribe=()=>Te.asap(d),h}},Voe=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,a;for(;r<n;)a=r+t,yield e.slice(r,a),r=a},Foe=async function*(e,t){for await(const n of Goe(e))yield*Voe(n,t)},Goe=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},vj=(e,t,n,r)=>{const a=Foe(e,t);let l=0,u,d=h=>{u||(u=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:m,value:y}=await a.next();if(m){d(),h.close();return}let v=y.byteLength;if(n){let S=l+=v;n(S)}h.enqueue(new Uint8Array(y))}catch(m){throw d(m),m}},cancel(h){return d(h),a.return()}},{highWaterMark:2})},Zw=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",bj=Zw&&typeof ReadableStream=="function",Uoe=Zw&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),xj=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$oe=bj&&xj(()=>{let e=!1;const t=new Request(go.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Sj=64*1024,XT=bj&&xj(()=>Te.isReadableStream(new Response("").body)),Ww={stream:XT&&(e=>e.body)};Zw&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ww[t]&&(Ww[t]=Te.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new Et(`Response type '${t}' is not supported`,Et.ERR_NOT_SUPPORT,r)})})})(new Response);const Xoe=async e=>{if(e==null)return 0;if(Te.isBlob(e))return e.size;if(Te.isSpecCompliantForm(e))return(await new Request(go.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(Te.isArrayBufferView(e)||Te.isArrayBuffer(e))return e.byteLength;if(Te.isURLSearchParams(e)&&(e=e+""),Te.isString(e))return(await Uoe(e)).byteLength},Yoe=async(e,t)=>{const n=Te.toFiniteNumber(e.getContentLength());return n??Xoe(t)},YT={http:poe,xhr:Poe,fetch:Zw&&(async e=>{let{url:t,method:n,data:r,signal:a,cancelToken:l,timeout:u,onDownloadProgress:d,onUploadProgress:h,responseType:m,headers:y,withCredentials:v="same-origin",fetchOptions:S}=yj(e);m=m?(m+"").toLowerCase():"text";let w=Hoe([a,l&&l.toAbortSignal()],u),A;const E=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let k;try{if(h&&$oe&&n!=="get"&&n!=="head"&&(k=await Yoe(y,r))!==0){let L=new Request(t,{method:"POST",body:r,duplex:"half"}),P;if(Te.isFormData(r)&&(P=L.headers.get("content-type"))&&y.setContentType(P),L.body){const[G,$]=hj(k,Yw(pj(h)));r=vj(L.body,Sj,G,$)}}Te.isString(v)||(v=v?"include":"omit");const R="credentials"in Request.prototype;A=new Request(t,{...S,signal:w,method:n.toUpperCase(),headers:y.normalize().toJSON(),body:r,duplex:"half",credentials:R?v:void 0});let D=await fetch(A,S);const M=XT&&(m==="stream"||m==="response");if(XT&&(d||M&&E)){const L={};["status","statusText","headers"].forEach(Z=>{L[Z]=D[Z]});const P=Te.toFiniteNumber(D.headers.get("content-length")),[G,$]=d&&hj(P,Yw(pj(d),!0))||[];D=new Response(vj(D.body,Sj,G,()=>{$&&$(),E&&E()}),L)}m=m||"text";let I=await Ww[Te.findKey(Ww,m)||"text"](D,e);return!M&&E&&E(),await new Promise((L,P)=>{dj(L,P,{data:I,headers:la.from(D.headers),status:D.status,statusText:D.statusText,config:e,request:A})})}catch(R){throw E&&E(),R&&R.name==="TypeError"&&/Load failed|fetch/i.test(R.message)?Object.assign(new Et("Network Error",Et.ERR_NETWORK,e,A),{cause:R.cause||R}):Et.from(R,R&&R.code,e,A)}})};Te.forEach(YT,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const wj=e=>`- ${e}`,Zoe=e=>Te.isFunction(e)||e===null||e===!1,Ej={getAdapter:e=>{e=Te.isArray(e)?e:[e];const{length:t}=e;let n,r;const a={};for(let l=0;l<t;l++){n=e[l];let u;if(r=n,!Zoe(n)&&(r=YT[(u=String(n)).toLowerCase()],r===void 0))throw new Et(`Unknown adapter '${u}'`);if(r)break;a[u||"#"+l]=r}if(!r){const l=Object.entries(a).map(([d,h])=>`adapter ${d} `+(h===!1?"is not supported by the environment":"is not available in the build"));let u=t?l.length>1?`since :
|
|
1075
1075
|
`+l.map(wj).join(`
|
|
1076
1076
|
`):" "+wj(l[0]):"as no adapter specified";throw new Et("There is no suitable adapter to dispatch the request "+u,"ERR_NOT_SUPPORT")}return r},adapters:YT};function ZT(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Nm(null,e)}function Cj(e){return ZT(e),e.headers=la.from(e.headers),e.data=$T.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ej.getAdapter(e.adapter||dv.adapter)(e).then(function(r){return ZT(e),r.data=$T.call(e,e.transformResponse,r),r.headers=la.from(r.headers),r},function(r){return fj(r)||(ZT(e),r&&r.response&&(r.response.data=$T.call(e,e.transformResponse,r.response),r.response.headers=la.from(r.response.headers))),Promise.reject(r)})}const _j="1.11.0",qw={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{qw[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Aj={};qw.transitional=function(t,n,r){function a(l,u){return"[Axios v"+_j+"] Transitional option '"+l+"'"+u+(r?". "+r:"")}return(l,u,d)=>{if(t===!1)throw new Et(a(u," has been removed"+(n?" in "+n:"")),Et.ERR_DEPRECATED);return n&&!Aj[u]&&(Aj[u]=!0,console.warn(a(u," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(l,u,d):!0}},qw.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Woe(e,t,n){if(typeof e!="object")throw new Et("options must be an object",Et.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const l=r[a],u=t[l];if(u){const d=e[l],h=d===void 0||u(d,l,e);if(h!==!0)throw new Et("option "+l+" must be "+h,Et.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Et("Unknown option "+l,Et.ERR_BAD_OPTION)}}const Jw={assertOptions:Woe,validators:qw},As=Jw.validators;let rh=class{constructor(t){this.defaults=t||{},this.interceptors={request:new lj,response:new lj}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a={};Error.captureStackTrace?Error.captureStackTrace(a):a=new Error;const l=a.stack?a.stack.replace(/^.+\n/,""):"";try{r.stack?l&&!String(r.stack).endsWith(l.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
1077
|
-
`+l):r.stack=l}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=nh(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:l}=n;r!==void 0&&Jw.assertOptions(r,{silentJSONParsing:As.transitional(As.boolean),forcedJSONParsing:As.transitional(As.boolean),clarifyTimeoutError:As.transitional(As.boolean)},!1),a!=null&&(Te.isFunction(a)?n.paramsSerializer={serialize:a}:Jw.assertOptions(a,{encode:As.function,serialize:As.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Jw.assertOptions(n,{baseUrl:As.spelling("baseURL"),withXsrfToken:As.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&Te.merge(l.common,l[n.method]);l&&Te.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),n.headers=la.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(n)===!1||(h=h&&E.synchronous,d.unshift(E.fulfilled,E.rejected))});const m=[];this.interceptors.response.forEach(function(E){m.push(E.fulfilled,E.rejected)});let y,v=0,S;if(!h){const A=[Cj.bind(this),void 0];for(A.unshift(...d),A.push(...m),S=A.length,y=Promise.resolve(n);v<S;)y=y.then(A[v++],A[v++]);return y}S=d.length;let w=n;for(v=0;v<S;){const A=d[v++],E=d[v++];try{w=A(w)}catch(k){E.call(this,k);break}}try{y=Cj.call(this,w)}catch(A){return Promise.reject(A)}for(v=0,S=m.length;v<S;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=nh(this.defaults,t);const n=mj(t.baseURL,t.url,t.allowAbsoluteUrls);return ij(n,t.params,t.paramsSerializer)}};Te.forEach(["delete","get","head","options"],function(t){rh.prototype[t]=function(n,r){return this.request(nh(r||{},{method:t,url:n,data:(r||{}).data}))}}),Te.forEach(["post","put","patch"],function(t){function n(r){return function(l,u,d){return this.request(nh(d||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}rh.prototype[t]=n(),rh.prototype[t+"Form"]=n(!0)});let qoe=class Y8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const r=this;this.promise.then(a=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](a);r._listeners=null}),this.promise.then=a=>{let l;const u=new Promise(d=>{r.subscribe(d),l=d}).then(a);return u.cancel=function(){r.unsubscribe(l)},u},t(function(l,u,d){r.reason||(r.reason=new Nm(l,u,d),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Y8(function(a){t=a}),cancel:t}}};function Joe(e){return function(n){return e.apply(null,n)}}function Qoe(e){return Te.isObject(e)&&e.isAxiosError===!0}const WT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(WT).forEach(([e,t])=>{WT[t]=e});function Tj(e){const t=new rh(e),n=$z(rh.prototype.request,t);return Te.extend(n,rh.prototype,t,{allOwnKeys:!0}),Te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return Tj(nh(e,a))},n}const lr=Tj(dv);lr.Axios=rh,lr.CanceledError=Nm,lr.CancelToken=qoe,lr.isCancel=fj,lr.VERSION=_j,lr.toFormData=$w,lr.AxiosError=Et,lr.Cancel=lr.CanceledError,lr.all=function(t){return Promise.all(t)},lr.spread=Joe,lr.isAxiosError=Qoe,lr.mergeConfig=nh,lr.AxiosHeaders=la,lr.formToJSON=e=>uj(Te.isHTMLForm(e)?new FormData(e):e),lr.getAdapter=Ej.getAdapter,lr.HttpStatusCode=WT,lr.default=lr;const{Axios:ESe,AxiosError:CSe,CanceledError:_Se,isCancel:ASe,CancelToken:TSe,VERSION:kSe,all:RSe,Cancel:OSe,isAxiosError:MSe,spread:NSe,toFormData:DSe,AxiosHeaders:ISe,HttpStatusCode:zSe,formToJSON:jSe,getAdapter:BSe,mergeConfig:LSe}=lr;class kj extends Rre{constructor(t){super(t),this._websocket=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=5e3,this._reconnect=!0,this._reconnect_timeout=void 0,this._url=t.url,this._reconnect_timeout=setTimeout(()=>{this.connect()},200),this._zustand&&this._zustand.auto_progress()}connect(){this._zustand?.logger.info("Connecting to websocket"),this.is_open=!1,this._websocket=new WebSocket(this._url),this._websocket.onopen=()=>{this.onopen()},this._websocket.onclose=()=>{this.onclose()},this._websocket.onerror=()=>{this.on_ws_error()},this._websocket.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):t.data instanceof Blob&&t.data.arrayBuffer().then(n=>{const r=new Uint8Array(n);this.getCommunicationManager().onbytes(r)})}}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}auto_reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this._zustand?.logger.info(`Attempting to reconnect in ${t} ms`),this._reconnect_timeout=setTimeout(()=>{this._websocket&&this._websocket.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this._zustand?.logger.warn("Maximum reconnect attempts reached. Giving up.")}async onmessage(t){try{const n=JSON.parse(t);this._zustand?.logger.debug(`Recieved data of length: ${t.length} and data"`,n),await this.getCommunicationManager().receive(n)}catch(n){console.error("Websocketworker: onmessage JSON.parse error",n,t);return}}get http_protocol(){return this.secure_url?"https":"http"}get secure_url(){return this._url.startsWith("wss")}get url_wo_protocol(){return this._url.substring(this.secure_url?6:5)}get http_url(){var t=this.http_protocol+"://"+this.url_wo_protocol;return t[t.length-1]!=="/"&&(t+="/"),t}get_io_subscription_url({node_id:t,io_id:n,stream:r}){let a=this.http_url+`node/${t}/io/${n}/value`;return r&&(a+="/stream"),a}async upload_file({files:t,onProgressCallback:n,root:r}){const a=`${this.http_url}upload/`,l=new FormData,u=Array.isArray(t)?t:Array.from(t);for(const d of u){const h=d.webkitRelativePath||d.name,m=r?`${r}/${h}`:h;l.append("file",d,m)}try{return(await lr.post(a,l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:h=>{n&&n(h.loaded,h.total)}})).data.file}catch{throw new Error("Failed to upload file")}}async handle_large_message_hint({msg_id:t}){const n=this.http_url+"message/"+t,a=await(await fetch(n,{method:"GET",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})).json();this.getCommunicationManager().receive(a)}onopen(){this._zustand?.logger.info("Websocket opened"),this.is_open=!0,this._zustand&&this._zustand.auto_progress(),this.reconnectAttempts=0,this.getSyncManager().stepwise_fullsync()}onclose(){this._zustand?.logger.info("Websocket closed"),super.onclose(),this._reconnect&&(this._zustand?.logger.info("Websocket closed,reconnecting"),this.auto_reconnect())}on_ws_error(){this._zustand?.logger.warn("Websocket error"),this._websocket?this._websocket.close():this.auto_reconnect()}async send_large_message(t){const n=`${this.http_url}message/`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:t})}async send(t){if(!this._websocket||this._websocket.readyState!==WebSocket.OPEN){this._zustand?.logger.warn("Websocket not connected");return}const n=JSON.stringify(t);if(new Blob([n]).size>1e6)return this._zustand?.logger.info("Data too large, sending via http"),await this.send_large_message(n);this._zustand?.logger.debug("Sending data",t),this._websocket.send(n)}async stop(){await super.stop(),this._reconnect=!1}close(){this._websocket&&this._websocket.close()}disconnect(){super.disconnect(),this._reconnect=!1,this._reconnect_timeout&&(clearTimeout(this._reconnect_timeout),this._reconnect_timeout=void 0),this.close()}async reconnect(){if(await super.reconnect(),this._reconnect=!0,this._websocket&&(this._zustand?.logger.info("Reconnecting"),(this._websocket.readyState===WebSocket.OPEN||this._websocket.readyState===WebSocket.CONNECTING)&&(this._websocket.readyState===WebSocket.CONNECTING&&await new Promise((t,n)=>{if(this._websocket===null)return;let r=setTimeout(()=>{n("Timeout@reconnect")},2e3);this._websocket.addEventListener("open",()=>{clearTimeout(r),t(null)},{once:!0}),this._websocket.readyState===WebSocket.OPEN&&(clearTimeout(r),t(null))}),this._websocket.readyState===WebSocket.OPEN))){this.getSyncManager().stepwise_fullsync();return}this.connect()}}class Koe{constructor(t,n){this.ws=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=2e3,this._wsuri=t,this.zustand=n,this.workers={},this.on_setWorker=r=>{this.zustand.set_worker(r)},this.connectionTimeout=setTimeout(()=>{this.connect()},200)}get wsuri(){return this._wsuri}get open(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.zustand.set_progress({progress:0,message:"connecting to worker manager",status:"info",blocking:!0}),this.zustand.logger.info("Connecting to websocket:",this._wsuri),this.ws=new WebSocket(this._wsuri),this.ws.onopen=()=>{this.onopen()},this.ws.onclose=()=>{this.onclose()},this.ws.onerror=()=>{this.on_ws_error()},this.ws.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):console.error("WorkerManager: onmessage event.data is not a string",typeof t.data)},this.connectionTimeout=setTimeout(()=>{this.ws?.readyState!==WebSocket.OPEN&&this.on_ws_error()},5e3)}on_ws_error(){console.warn("Websocket error"),this.ws?this.ws.close():this.reconnect()}onopen(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.zustand.auto_progress(),this.ws&&this.ws.send("worker_status");const t=window.localStorage.getItem("funcnodes__active_worker");t&&this.set_active(t)}onmessage(t){try{let n=JSON.parse(t);if(n.type==="worker_status"){const r={};for(let a of n.active)a.active=!0,r[a.uuid]=a;for(let a of n.inactive)a.active=!1,r[a.uuid]=a;this.zustand.workers.setState(r);return}else if(n.type==="set_worker"){if(n.data.type==="WSWorker"){let r="ws"+(n.data.ssl?"s":"")+"://"+n.data.host+":"+n.data.port;this.setWorker(this.workers[n.data.uuid]||new kj({url:r,zustand:this.zustand,uuid:n.data.uuid,on_sync_complete:this.zustand.options.on_sync_complete}))}else this.zustand.logger.error("WorkerManager: unknown worker type",n);return}else if(n.type==="progress"){this.zustand.set_progress(n);return}this.zustand.logger.error("WorkerManager: unknown message",n)}catch(n){console.error("WorkerManager: onmessage JSON.parse error",n,t);return}}setWorker(t){for(let n in this.workers)n!==t?.uuid&&this.workers[n].disconnect();t!==void 0&&(this.workers[t.uuid]=t,t.reconnect()),t?.uuid&&window.localStorage.setItem("funcnodes__active_worker",t?.uuid),this.zustand.worker!==void 0&&this.zustand.clear_all(),this.zustand.set_worker(t),this.on_setWorker(t)}async restart_worker(t){this.ws?.send(JSON.stringify({type:"restart_worker",workerid:t}))}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this.zustand.logger.info(`Attempting to reconnect in ${t} ms`),setTimeout(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this.zustand.logger.warn("Maximum reconnect attempts reached. Giving up.")}onclose(){this.zustand.logger.warn("WorkerManager: onclose"),this.reconnect()}set_active(t){this.ws&&this.ws.send(JSON.stringify({type:"set_active",workerid:t}))}new_worker({name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}){t||(t=void 0),r||(r=!1),a||(a=!1),n||(n=void 0,r=!1,a=!1),this.ws&&this.ws.send(JSON.stringify({type:"new_worker",kwargs:{name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}}))}remove(){for(let t in this.workers)this.workers[t].disconnect();this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.ws&&(this.ws.onclose=()=>{},this.ws.onerror=()=>{},this.ws.onmessage=()=>{},this.ws.onopen=()=>{},this.ws.close())}}const yo=()=>{const e=Wt();return e.worker?{...e.worker.api,worker:e.worker}:{node:void 0,group:void 0,edge:void 0,hooks:void 0,lib:void 0,worker:e.worker}},eae={id:"",debug:!1,useWorkerManager:!0,show_library:!0,header:{show:!0,showmenu:!0},flow:{minimap:!0,static:!1,minZoom:.1,maxZoom:5,allowFullScreen:!0,allowExpand:!0,showNodeSettings:!0},library:{show:!0}},Rj=["classic","metal","light","solarized","midnight","forest","scientific","neon","ocean","sunset"];function br(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=br(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var tae={value:()=>{}};function Qw(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Kw(n)}function Kw(e){this._=e}function nae(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Kw.prototype=Qw.prototype={constructor:Kw,on:function(e,t){var n=this._,r=nae(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l<u;)if((a=(e=r[l]).type)&&(a=rae(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<u;)if(a=(e=r[l]).type)n[a]=Oj(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Oj(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Kw(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,l;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,a=l.length;r<a;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,l=r.length;a<l;++a)r[a].value.apply(t,n)}};function rae(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function Oj(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=tae,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var qT="http://www.w3.org/1999/xhtml";const Mj={svg:"http://www.w3.org/2000/svg",xhtml:qT,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function e2(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Mj.hasOwnProperty(t)?{space:Mj[t],local:e}:e}function oae(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===qT&&t.documentElement.namespaceURI===qT?t.createElement(e):t.createElementNS(n,e)}}function aae(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Nj(e){var t=e2(e);return(t.local?aae:oae)(t)}function iae(){}function JT(e){return e==null?iae:function(){return this.querySelector(e)}}function lae(e){typeof e!="function"&&(e=JT(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=new Array(u),h,m,y=0;y<u;++y)(h=l[y])&&(m=e.call(h,h.__data__,y,l))&&("__data__"in h&&(m.__data__=h.__data__),d[y]=m);return new Pa(r,this._parents)}function sae(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function uae(){return[]}function Dj(e){return e==null?uae:function(){return this.querySelectorAll(e)}}function cae(e){return function(){return sae(e.apply(this,arguments))}}function fae(e){typeof e=="function"?e=cae(e):e=Dj(e);for(var t=this._groups,n=t.length,r=[],a=[],l=0;l<n;++l)for(var u=t[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&(r.push(e.call(h,h.__data__,m,u)),a.push(h));return new Pa(r,a)}function Ij(e){return function(){return this.matches(e)}}function zj(e){return function(t){return t.matches(e)}}var dae=Array.prototype.find;function hae(e){return function(){return dae.call(this.children,e)}}function pae(){return this.firstElementChild}function mae(e){return this.select(e==null?pae:hae(typeof e=="function"?e:zj(e)))}var gae=Array.prototype.filter;function yae(){return Array.from(this.children)}function vae(e){return function(){return gae.call(this.children,e)}}function bae(e){return this.selectAll(e==null?yae:vae(typeof e=="function"?e:zj(e)))}function xae(e){typeof e!="function"&&(e=Ij(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new Pa(r,this._parents)}function jj(e){return new Array(e.length)}function Sae(){return new Pa(this._enter||this._groups.map(jj),this._parents)}function t2(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}t2.prototype={constructor:t2,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function wae(e){return function(){return e}}function Eae(e,t,n,r,a,l){for(var u=0,d,h=t.length,m=l.length;u<m;++u)(d=t[u])?(d.__data__=l[u],r[u]=d):n[u]=new t2(e,l[u]);for(;u<h;++u)(d=t[u])&&(a[u]=d)}function Cae(e,t,n,r,a,l,u){var d,h,m=new Map,y=t.length,v=l.length,S=new Array(y),w;for(d=0;d<y;++d)(h=t[d])&&(S[d]=w=u.call(h,h.__data__,d,t)+"",m.has(w)?a[d]=h:m.set(w,h));for(d=0;d<v;++d)w=u.call(e,l[d],d,l)+"",(h=m.get(w))?(r[d]=h,h.__data__=l[d],m.delete(w)):n[d]=new t2(e,l[d]);for(d=0;d<y;++d)(h=t[d])&&m.get(S[d])===h&&(a[d]=h)}function _ae(e){return e.__data__}function Aae(e,t){if(!arguments.length)return Array.from(this,_ae);var n=t?Cae:Eae,r=this._parents,a=this._groups;typeof e!="function"&&(e=wae(e));for(var l=a.length,u=new Array(l),d=new Array(l),h=new Array(l),m=0;m<l;++m){var y=r[m],v=a[m],S=v.length,w=Tae(e.call(y,y&&y.__data__,m,r)),A=w.length,E=d[m]=new Array(A),k=u[m]=new Array(A),R=h[m]=new Array(S);n(y,v,E,k,R,w,t);for(var D=0,M=0,I,L;D<A;++D)if(I=E[D]){for(D>=M&&(M=D+1);!(L=k[M])&&++M<A;);I._next=L||null}}return u=new Pa(u,r),u._enter=d,u._exit=h,u}function Tae(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function kae(){return new Pa(this._exit||this._groups.map(jj),this._parents)}function Rae(e,t,n){var r=this.enter(),a=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?l.remove():n(l),r&&a?r.merge(a).order():a}function Oae(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,l=r.length,u=Math.min(a,l),d=new Array(a),h=0;h<u;++h)for(var m=n[h],y=r[h],v=m.length,S=d[h]=new Array(v),w,A=0;A<v;++A)(w=m[A]||y[A])&&(S[A]=w);for(;h<a;++h)d[h]=n[h];return new Pa(d,this._parents)}function Mae(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,l=r[a],u;--a>=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function Nae(e){e||(e=Dae);function t(v,S){return v&&S?e(v.__data__,S.__data__):!v-!S}for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l){for(var u=n[l],d=u.length,h=a[l]=new Array(d),m,y=0;y<d;++y)(m=u[y])&&(h[y]=m);h.sort(t)}return new Pa(a,this._parents).order()}function Dae(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Iae(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zae(){return Array.from(this)}function jae(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length;a<l;++a){var u=r[a];if(u)return u}return null}function Bae(){let e=0;for(const t of this)++e;return e}function Lae(){return!this.node()}function Pae(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],l=0,u=a.length,d;l<u;++l)(d=a[l])&&e.call(d,d.__data__,l,a);return this}function Hae(e){return function(){this.removeAttribute(e)}}function Vae(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fae(e,t){return function(){this.setAttribute(e,t)}}function Gae(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Uae(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function $ae(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Xae(e,t){var n=e2(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Vae:Hae:typeof t=="function"?n.local?$ae:Uae:n.local?Gae:Fae)(n,t))}function Bj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Yae(e){return function(){this.style.removeProperty(e)}}function Zae(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Wae(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function qae(e,t,n){return arguments.length>1?this.each((t==null?Yae:typeof t=="function"?Wae:Zae)(e,t,n??"")):Dm(this.node(),e)}function Dm(e,t){return e.style.getPropertyValue(t)||Bj(e).getComputedStyle(e,null).getPropertyValue(t)}function Jae(e){return function(){delete this[e]}}function Qae(e,t){return function(){this[e]=t}}function Kae(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function eie(e,t){return arguments.length>1?this.each((t==null?Jae:typeof t=="function"?Kae:Qae)(e,t)):this.node()[e]}function Lj(e){return e.trim().split(/^|\s+/)}function QT(e){return e.classList||new Pj(e)}function Pj(e){this._node=e,this._names=Lj(e.getAttribute("class")||"")}Pj.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Hj(e,t){for(var n=QT(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function Vj(e,t){for(var n=QT(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function tie(e){return function(){Hj(this,e)}}function nie(e){return function(){Vj(this,e)}}function rie(e,t){return function(){(t.apply(this,arguments)?Hj:Vj)(this,e)}}function oie(e,t){var n=Lj(e+"");if(arguments.length<2){for(var r=QT(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?rie:t?tie:nie)(n,t))}function aie(){this.textContent=""}function iie(e){return function(){this.textContent=e}}function lie(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function sie(e){return arguments.length?this.each(e==null?aie:(typeof e=="function"?lie:iie)(e)):this.node().textContent}function uie(){this.innerHTML=""}function cie(e){return function(){this.innerHTML=e}}function fie(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function die(e){return arguments.length?this.each(e==null?uie:(typeof e=="function"?fie:cie)(e)):this.node().innerHTML}function hie(){this.nextSibling&&this.parentNode.appendChild(this)}function pie(){return this.each(hie)}function mie(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function gie(){return this.each(mie)}function yie(e){var t=typeof e=="function"?e:Nj(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function vie(){return null}function bie(e,t){var n=typeof e=="function"?e:Nj(e),r=t==null?vie:typeof t=="function"?t:JT(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function xie(){var e=this.parentNode;e&&e.removeChild(this)}function Sie(){return this.each(xie)}function wie(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Eie(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Cie(e){return this.select(e?Eie:wie)}function _ie(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Aie(e){return function(t){e.call(this,t,this.__data__)}}function Tie(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function kie(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function Rie(e,t,n){return function(){var r=this.__on,a,l=Aie(t);if(r){for(var u=0,d=r.length;u<d;++u)if((a=r[u]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},r?r.push(a):this.__on=[a]}}function Oie(e,t,n){var r=Tie(e+""),a,l=r.length,u;if(arguments.length<2){var d=this.node().__on;if(d){for(var h=0,m=d.length,y;h<m;++h)for(a=0,y=d[h];a<l;++a)if((u=r[a]).type===y.type&&u.name===y.name)return y.value}return}for(d=t?Rie:kie,a=0;a<l;++a)this.each(d(r[a],t,n));return this}function Fj(e,t,n){var r=Bj(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Mie(e,t){return function(){return Fj(this,e,t)}}function Nie(e,t){return function(){return Fj(this,e,t.apply(this,arguments))}}function Die(e,t){return this.each((typeof t=="function"?Nie:Mie)(e,t))}function*Iie(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length,u;a<l;++a)(u=r[a])&&(yield u)}var Gj=[null];function Pa(e,t){this._groups=e,this._parents=t}function pv(){return new Pa([[document.documentElement]],Gj)}function zie(){return this}Pa.prototype=pv.prototype={constructor:Pa,select:lae,selectAll:fae,selectChild:mae,selectChildren:bae,filter:xae,data:Aae,enter:Sae,exit:kae,join:Rae,merge:Oae,selection:zie,order:Mae,sort:Nae,call:Iae,nodes:zae,node:jae,size:Bae,empty:Lae,each:Pae,attr:Xae,style:qae,property:eie,classed:oie,text:sie,html:die,raise:pie,lower:gie,append:yie,insert:bie,remove:Sie,clone:Cie,datum:_ie,on:Oie,dispatch:Die,[Symbol.iterator]:Iie};function Ha(e){return typeof e=="string"?new Pa([[document.querySelector(e)]],[document.documentElement]):new Pa([[e]],Gj)}function jie(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _l(e,t){if(e=jie(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Bie={passive:!1},mv={capture:!0,passive:!1};function KT(e){e.stopImmediatePropagation()}function Im(e){e.preventDefault(),e.stopImmediatePropagation()}function Uj(e){var t=e.document.documentElement,n=Ha(e).on("dragstart.drag",Im,mv);"onselectstart"in t?n.on("selectstart.drag",Im,mv):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $j(e,t){var n=e.document.documentElement,r=Ha(e).on("dragstart.drag",null);t&&(r.on("click.drag",Im,mv),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const n2=e=>()=>e;function ek(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:d,dx:h,dy:m,dispatch:y}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:y}})}ek.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Lie(e){return!e.ctrlKey&&!e.button}function Pie(){return this.parentNode}function Hie(e,t){return t??{x:e.x,y:e.y}}function Vie(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xj(){var e=Lie,t=Pie,n=Hie,r=Vie,a={},l=Qw("start","drag","end"),u=0,d,h,m,y,v=0;function S(I){I.on("mousedown.drag",w).filter(r).on("touchstart.drag",k).on("touchmove.drag",R,Bie).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(I,L){if(!(y||!e.call(this,I,L))){var P=M(this,t.call(this,I,L),I,L,"mouse");P&&(Ha(I.view).on("mousemove.drag",A,mv).on("mouseup.drag",E,mv),Uj(I.view),KT(I),m=!1,d=I.clientX,h=I.clientY,P("start",I))}}function A(I){if(Im(I),!m){var L=I.clientX-d,P=I.clientY-h;m=L*L+P*P>v}a.mouse("drag",I)}function E(I){Ha(I.view).on("mousemove.drag mouseup.drag",null),$j(I.view,m),Im(I),a.mouse("end",I)}function k(I,L){if(e.call(this,I,L)){var P=I.changedTouches,G=t.call(this,I,L),$=P.length,Z,j;for(Z=0;Z<$;++Z)(j=M(this,G,I,L,P[Z].identifier,P[Z]))&&(KT(I),j("start",I,P[Z]))}}function R(I){var L=I.changedTouches,P=L.length,G,$;for(G=0;G<P;++G)($=a[L[G].identifier])&&(Im(I),$("drag",I,L[G]))}function D(I){var L=I.changedTouches,P=L.length,G,$;for(y&&clearTimeout(y),y=setTimeout(function(){y=null},500),G=0;G<P;++G)($=a[L[G].identifier])&&(KT(I),$("end",I,L[G]))}function M(I,L,P,G,$,Z){var j=l.copy(),X=_l(Z||P,L),ee,ae,U;if((U=n.call(I,new ek("beforestart",{sourceEvent:P,target:S,identifier:$,active:u,x:X[0],y:X[1],dx:0,dy:0,dispatch:j}),G))!=null)return ee=U.x-X[0]||0,ae=U.y-X[1]||0,function te(V,W,Q){var ne=X,B;switch(V){case"start":a[$]=te,B=u++;break;case"end":delete a[$],--u;case"drag":X=_l(Q||W,L),B=u;break}j.call(V,I,new ek(V,{sourceEvent:W,subject:U,target:S,identifier:$,active:B,x:X[0]+ee,y:X[1]+ae,dx:X[0]-ne[0],dy:X[1]-ne[1],dispatch:j}),G)}}return S.filter=function(I){return arguments.length?(e=typeof I=="function"?I:n2(!!I),S):e},S.container=function(I){return arguments.length?(t=typeof I=="function"?I:n2(I),S):t},S.subject=function(I){return arguments.length?(n=typeof I=="function"?I:n2(I),S):n},S.touchable=function(I){return arguments.length?(r=typeof I=="function"?I:n2(!!I),S):r},S.on=function(){var I=l.on.apply(l,arguments);return I===l?S:I},S.clickDistance=function(I){return arguments.length?(v=(I=+I)*I,S):Math.sqrt(v)},S}function tk(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Yj(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function gv(){}var yv=.7,r2=1/yv,zm="\\s*([+-]?\\d+)\\s*",vv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ts="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Fie=/^#([0-9a-f]{3,8})$/,Gie=new RegExp(`^rgb\\(${zm},${zm},${zm}\\)$`),Uie=new RegExp(`^rgb\\(${Ts},${Ts},${Ts}\\)$`),$ie=new RegExp(`^rgba\\(${zm},${zm},${zm},${vv}\\)$`),Xie=new RegExp(`^rgba\\(${Ts},${Ts},${Ts},${vv}\\)$`),Yie=new RegExp(`^hsl\\(${vv},${Ts},${Ts}\\)$`),Zie=new RegExp(`^hsla\\(${vv},${Ts},${Ts},${vv}\\)$`),Zj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};tk(gv,oh,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wj,formatHex:Wj,formatHex8:Wie,formatHsl:qie,formatRgb:qj,toString:qj});function Wj(){return this.rgb().formatHex()}function Wie(){return this.rgb().formatHex8()}function qie(){return t9(this).formatHsl()}function qj(){return this.rgb().formatRgb()}function oh(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Fie.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Jj(t):n===3?new sa(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?o2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?o2(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Gie.exec(e))?new sa(t[1],t[2],t[3],1):(t=Uie.exec(e))?new sa(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$ie.exec(e))?o2(t[1],t[2],t[3],t[4]):(t=Xie.exec(e))?o2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Yie.exec(e))?e9(t[1],t[2]/100,t[3]/100,1):(t=Zie.exec(e))?e9(t[1],t[2]/100,t[3]/100,t[4]):Zj.hasOwnProperty(e)?Jj(Zj[e]):e==="transparent"?new sa(NaN,NaN,NaN,0):null}function Jj(e){return new sa(e>>16&255,e>>8&255,e&255,1)}function o2(e,t,n,r){return r<=0&&(e=t=n=NaN),new sa(e,t,n,r)}function Jie(e){return e instanceof gv||(e=oh(e)),e?(e=e.rgb(),new sa(e.r,e.g,e.b,e.opacity)):new sa}function nk(e,t,n,r){return arguments.length===1?Jie(e):new sa(e,t,n,r??1)}function sa(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tk(sa,nk,Yj(gv,{brighter(e){return e=e==null?r2:Math.pow(r2,e),new sa(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yv:Math.pow(yv,e),new sa(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new sa(ah(this.r),ah(this.g),ah(this.b),a2(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:Qj,formatHex:Qj,formatHex8:Qie,formatRgb:Kj,toString:Kj}));function Qj(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}`}function Qie(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}${ih((isNaN(this.opacity)?1:this.opacity)*255)}`}function Kj(){const e=a2(this.opacity);return`${e===1?"rgb(":"rgba("}${ah(this.r)}, ${ah(this.g)}, ${ah(this.b)}${e===1?")":`, ${e})`}`}function a2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ah(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ih(e){return e=ah(e),(e<16?"0":"")+e.toString(16)}function e9(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Al(e,t,n,r)}function t9(e){if(e instanceof Al)return new Al(e.h,e.s,e.l,e.opacity);if(e instanceof gv||(e=oh(e)),!e)return new Al;if(e instanceof Al)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,d=l-a,h=(l+a)/2;return d?(t===l?u=(n-r)/d+(n<r)*6:n===l?u=(r-t)/d+2:u=(t-n)/d+4,d/=h<.5?l+a:2-l-a,u*=60):d=h>0&&h<1?0:u,new Al(u,d,h,e.opacity)}function Kie(e,t,n,r){return arguments.length===1?t9(e):new Al(e,t,n,r??1)}function Al(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}tk(Al,Kie,Yj(gv,{brighter(e){return e=e==null?r2:Math.pow(r2,e),new Al(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yv:Math.pow(yv,e),new Al(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new sa(rk(e>=240?e-240:e+120,a,r),rk(e,a,r),rk(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Al(n9(this.h),i2(this.s),i2(this.l),a2(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 e=a2(this.opacity);return`${e===1?"hsl(":"hsla("}${n9(this.h)}, ${i2(this.s)*100}%, ${i2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function n9(e){return e=(e||0)%360,e<0?e+360:e}function i2(e){return Math.max(0,Math.min(1,e||0))}function rk(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ok=e=>()=>e;function ele(e,t){return function(n){return e+n*t}}function tle(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function nle(e){return(e=+e)==1?r9:function(t,n){return n-t?tle(t,n,e):ok(isNaN(t)?n:t)}}function r9(e,t){var n=t-e;return n?ele(e,n):ok(isNaN(e)?t:e)}const l2=function e(t){var n=nle(t);function r(a,l){var u=n((a=nk(a)).r,(l=nk(l)).r),d=n(a.g,l.g),h=n(a.b,l.b),m=r9(a.opacity,l.opacity);return function(y){return a.r=u(y),a.g=d(y),a.b=h(y),a.opacity=m(y),a+""}}return r.gamma=e,r}(1);function rle(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;a<n;++a)r[a]=e[a]*(1-l)+t[a]*l;return r}}function ole(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ale(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),l=new Array(n),u;for(u=0;u<r;++u)a[u]=bv(e[u],t[u]);for(;u<n;++u)l[u]=t[u];return function(d){for(u=0;u<r;++u)l[u]=a[u](d);return l}}function ile(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ks(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function lle(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=bv(e[a],t[a]):r[a]=t[a];return function(l){for(a in n)r[a]=n[a](l);return r}}var ak=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ik=new RegExp(ak.source,"g");function sle(e){return function(){return e}}function ule(e){return function(t){return e(t)+""}}function o9(e,t){var n=ak.lastIndex=ik.lastIndex=0,r,a,l,u=-1,d=[],h=[];for(e=e+"",t=t+"";(r=ak.exec(e))&&(a=ik.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),d[u]?d[u]+=l:d[++u]=l),(r=r[0])===(a=a[0])?d[u]?d[u]+=a:d[++u]=a:(d[++u]=null,h.push({i:u,x:ks(r,a)})),n=ik.lastIndex;return n<t.length&&(l=t.slice(n),d[u]?d[u]+=l:d[++u]=l),d.length<2?h[0]?ule(h[0].x):sle(t):(t=h.length,function(m){for(var y=0,v;y<t;++y)d[(v=h[y]).i]=v.x(m);return d.join("")})}function bv(e,t){var n=typeof t,r;return t==null||n==="boolean"?ok(t):(n==="number"?ks:n==="string"?(r=oh(t))?(t=r,l2):o9:t instanceof oh?l2:t instanceof Date?ile:ole(t)?rle:Array.isArray(t)?ale:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lle:ks)(e,t)}var a9=180/Math.PI,lk={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function i9(e,t,n,r,a,l){var u,d,h;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(h=e*n+t*r)&&(n-=e*h,r-=t*h),(d=Math.sqrt(n*n+r*r))&&(n/=d,r/=d,h/=d),e*r<t*n&&(e=-e,t=-t,h=-h,u=-u),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*a9,skewX:Math.atan(h)*a9,scaleX:u,scaleY:d}}var s2;function cle(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?lk:i9(t.a,t.b,t.c,t.d,t.e,t.f)}function fle(e){return e==null||(s2||(s2=document.createElementNS("http://www.w3.org/2000/svg","g")),s2.setAttribute("transform",e),!(e=s2.transform.baseVal.consolidate()))?lk:(e=e.matrix,i9(e.a,e.b,e.c,e.d,e.e,e.f))}function l9(e,t,n,r){function a(m){return m.length?m.pop()+" ":""}function l(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push("translate(",null,t,null,n);A.push({i:E-4,x:ks(m,v)},{i:E-2,x:ks(y,S)})}else(v||S)&&w.push("translate("+v+t+S+n)}function u(m,y,v,S){m!==y?(m-y>180?y+=360:y-m>180&&(m+=360),S.push({i:v.push(a(v)+"rotate(",null,r)-2,x:ks(m,y)})):y&&v.push(a(v)+"rotate("+y+r)}function d(m,y,v,S){m!==y?S.push({i:v.push(a(v)+"skewX(",null,r)-2,x:ks(m,y)}):y&&v.push(a(v)+"skewX("+y+r)}function h(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push(a(w)+"scale(",null,",",null,")");A.push({i:E-4,x:ks(m,v)},{i:E-2,x:ks(y,S)})}else(v!==1||S!==1)&&w.push(a(w)+"scale("+v+","+S+")")}return function(m,y){var v=[],S=[];return m=e(m),y=e(y),l(m.translateX,m.translateY,y.translateX,y.translateY,v,S),u(m.rotate,y.rotate,v,S),d(m.skewX,y.skewX,v,S),h(m.scaleX,m.scaleY,y.scaleX,y.scaleY,v,S),m=y=null,function(w){for(var A=-1,E=S.length,k;++A<E;)v[(k=S[A]).i]=k.x(w);return v.join("")}}}var dle=l9(cle,"px, ","px)","deg)"),hle=l9(fle,", ",")",")"),ple=1e-12;function s9(e){return((e=Math.exp(e))+1/e)/2}function mle(e){return((e=Math.exp(e))-1/e)/2}function gle(e){return((e=Math.exp(2*e))-1)/(e+1)}const u2=function e(t,n,r){function a(l,u){var d=l[0],h=l[1],m=l[2],y=u[0],v=u[1],S=u[2],w=y-d,A=v-h,E=w*w+A*A,k,R;if(E<ple)R=Math.log(S/m)/t,k=function(G){return[d+G*w,h+G*A,m*Math.exp(t*G*R)]};else{var D=Math.sqrt(E),M=(S*S-m*m+r*E)/(2*m*n*D),I=(S*S-m*m-r*E)/(2*S*n*D),L=Math.log(Math.sqrt(M*M+1)-M),P=Math.log(Math.sqrt(I*I+1)-I);R=(P-L)/t,k=function(G){var $=G*R,Z=s9(L),j=m/(n*D)*(Z*gle(t*$+L)-mle(L));return[d+j*w,h+j*A,m*Z/s9(t*$+L)]}}return k.duration=R*1e3*t/Math.SQRT2,k}return a.rho=function(l){var u=Math.max(.001,+l),d=u*u,h=d*d;return e(u,d,h)},a}(Math.SQRT2,2,4);var jm=0,xv=0,Sv=0,u9=1e3,c2,wv,f2=0,lh=0,d2=0,Ev=typeof performance=="object"&&performance.now?performance:Date,c9=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function sk(){return lh||(c9(yle),lh=Ev.now()+d2)}function yle(){lh=0}function h2(){this._call=this._time=this._next=null}h2.prototype=f9.prototype={constructor:h2,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?sk():+n)+(t==null?0:+t),!this._next&&wv!==this&&(wv?wv._next=this:c2=this,wv=this),this._call=e,this._time=n,uk()},stop:function(){this._call&&(this._call=null,this._time=1/0,uk())}};function f9(e,t,n){var r=new h2;return r.restart(e,t,n),r}function vle(){sk(),++jm;for(var e=c2,t;e;)(t=lh-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jm}function d9(){lh=(f2=Ev.now())+d2,jm=xv=0;try{vle()}finally{jm=0,xle(),lh=0}}function ble(){var e=Ev.now(),t=e-f2;t>u9&&(d2-=t,f2=e)}function xle(){for(var e,t=c2,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:c2=n);wv=e,uk(r)}function uk(e){if(!jm){xv&&(xv=clearTimeout(xv));var t=e-lh;t>24?(e<1/0&&(xv=setTimeout(d9,e-Ev.now()-d2)),Sv&&(Sv=clearInterval(Sv))):(Sv||(f2=Ev.now(),Sv=setInterval(ble,u9)),jm=1,c9(d9))}}function h9(e,t,n){var r=new h2;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var Sle=Qw("start","end","cancel","interrupt"),wle=[],p9=0,m9=1,ck=2,p2=3,g9=4,fk=5,m2=6;function g2(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;Ele(e,n,{name:t,index:r,group:a,on:Sle,tween:wle,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:p9})}function dk(e,t){var n=Tl(e,t);if(n.state>p9)throw new Error("too late; already scheduled");return n}function Rs(e,t){var n=Tl(e,t);if(n.state>p2)throw new Error("too late; already running");return n}function Tl(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ele(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=f9(l,0,n.time);function l(m){n.state=m9,n.timer.restart(u,n.delay,n.time),n.delay<=m&&u(m-n.delay)}function u(m){var y,v,S,w;if(n.state!==m9)return h();for(y in r)if(w=r[y],w.name===n.name){if(w.state===p2)return h9(u);w.state===g9?(w.state=m2,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[y]):+y<t&&(w.state=m2,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[y])}if(h9(function(){n.state===p2&&(n.state=g9,n.timer.restart(d,n.delay,n.time),d(m))}),n.state=ck,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ck){for(n.state=p2,a=new Array(S=n.tween.length),y=0,v=-1;y<S;++y)(w=n.tween[y].value.call(e,e.__data__,n.index,n.group))&&(a[++v]=w);a.length=v+1}}function d(m){for(var y=m<n.duration?n.ease.call(null,m/n.duration):(n.timer.restart(h),n.state=fk,1),v=-1,S=a.length;++v<S;)a[v].call(e,y);n.state===fk&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=m2,n.timer.stop(),delete r[t];for(var m in r)return;delete e.__transition}}function y2(e,t){var n=e.__transition,r,a,l=!0,u;if(n){t=t==null?null:t+"";for(u in n){if((r=n[u]).name!==t){l=!1;continue}a=r.state>ck&&r.state<fk,r.state=m2,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[u]}l&&delete e.__transition}}function Cle(e){return this.each(function(){y2(this,e)})}function _le(e,t){var n,r;return function(){var a=Rs(this,e),l=a.tween;if(l!==n){r=n=l;for(var u=0,d=r.length;u<d;++u)if(r[u].name===t){r=r.slice(),r.splice(u,1);break}}a.tween=r}}function Ale(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=Rs(this,e),u=l.tween;if(u!==r){a=(r=u).slice();for(var d={name:t,value:n},h=0,m=a.length;h<m;++h)if(a[h].name===t){a[h]=d;break}h===m&&a.push(d)}l.tween=a}}function Tle(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Tl(this.node(),n).tween,a=0,l=r.length,u;a<l;++a)if((u=r[a]).name===e)return u.value;return null}return this.each((t==null?_le:Ale)(n,e,t))}function hk(e,t,n){var r=e._id;return e.each(function(){var a=Rs(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Tl(a,r).value[t]}}function y9(e,t){var n;return(typeof t=="number"?ks:t instanceof oh?l2:(n=oh(t))?(t=n,l2):o9)(e,t)}function kle(e){return function(){this.removeAttribute(e)}}function Rle(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ole(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttribute(e);return u===a?null:u===r?l:l=t(r=u,n)}}function Mle(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===a?null:u===r?l:l=t(r=u,n)}}function Nle(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function Dle(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function Ile(e,t){var n=e2(e),r=n==="transform"?hle:y9;return this.attrTween(e,typeof t=="function"?(n.local?Dle:Nle)(n,r,hk(this,"attr."+e,t)):t==null?(n.local?Rle:kle)(n):(n.local?Mle:Ole)(n,r,t))}function zle(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jle(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ble(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&jle(e,l)),n}return a._value=t,a}function Lle(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&zle(e,l)),n}return a._value=t,a}function Ple(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=e2(e);return this.tween(n,(r.local?Ble:Lle)(r,t))}function Hle(e,t){return function(){dk(this,e).delay=+t.apply(this,arguments)}}function Vle(e,t){return t=+t,function(){dk(this,e).delay=t}}function Fle(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hle:Vle)(t,e)):Tl(this.node(),t).delay}function Gle(e,t){return function(){Rs(this,e).duration=+t.apply(this,arguments)}}function Ule(e,t){return t=+t,function(){Rs(this,e).duration=t}}function $le(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Gle:Ule)(t,e)):Tl(this.node(),t).duration}function Xle(e,t){if(typeof t!="function")throw new Error;return function(){Rs(this,e).ease=t}}function Yle(e){var t=this._id;return arguments.length?this.each(Xle(t,e)):Tl(this.node(),t).ease}function Zle(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Rs(this,e).ease=n}}function Wle(e){if(typeof e!="function")throw new Error;return this.each(Zle(this._id,e))}function qle(e){typeof e!="function"&&(e=Ij(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new Fu(r,this._parents,this._name,this._id)}function Jle(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,l=Math.min(r,a),u=new Array(r),d=0;d<l;++d)for(var h=t[d],m=n[d],y=h.length,v=u[d]=new Array(y),S,w=0;w<y;++w)(S=h[w]||m[w])&&(v[w]=S);for(;d<r;++d)u[d]=t[d];return new Fu(u,this._parents,this._name,this._id)}function Qle(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Kle(e,t,n){var r,a,l=Qle(t)?dk:Rs;return function(){var u=l(this,e),d=u.on;d!==r&&(a=(r=d).copy()).on(t,n),u.on=a}}function ese(e,t){var n=this._id;return arguments.length<2?Tl(this.node(),n).on.on(e):this.each(Kle(n,e,t))}function tse(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function nse(){return this.on("end.remove",tse(this._id))}function rse(e){var t=this._name,n=this._id;typeof e!="function"&&(e=JT(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u<a;++u)for(var d=r[u],h=d.length,m=l[u]=new Array(h),y,v,S=0;S<h;++S)(y=d[S])&&(v=e.call(y,y.__data__,S,d))&&("__data__"in y&&(v.__data__=y.__data__),m[S]=v,g2(m[S],t,n,S,m,Tl(y,n)));return new Fu(l,this._parents,t,n)}function ose(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Dj(e));for(var r=this._groups,a=r.length,l=[],u=[],d=0;d<a;++d)for(var h=r[d],m=h.length,y,v=0;v<m;++v)if(y=h[v]){for(var S=e.call(y,y.__data__,v,h),w,A=Tl(y,n),E=0,k=S.length;E<k;++E)(w=S[E])&&g2(w,t,n,E,S,A);l.push(S),u.push(y)}return new Fu(l,u,t,n)}var ase=pv.prototype.constructor;function ise(){return new ase(this._groups,this._parents)}function lse(e,t){var n,r,a;return function(){var l=Dm(this,e),u=(this.style.removeProperty(e),Dm(this,e));return l===u?null:l===n&&u===r?a:a=t(n=l,r=u)}}function v9(e){return function(){this.style.removeProperty(e)}}function sse(e,t,n){var r,a=n+"",l;return function(){var u=Dm(this,e);return u===a?null:u===r?l:l=t(r=u,n)}}function use(e,t,n){var r,a,l;return function(){var u=Dm(this,e),d=n(this),h=d+"";return d==null&&(h=d=(this.style.removeProperty(e),Dm(this,e))),u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d))}}function cse(e,t){var n,r,a,l="style."+t,u="end."+l,d;return function(){var h=Rs(this,e),m=h.on,y=h.value[l]==null?d||(d=v9(t)):void 0;(m!==n||a!==y)&&(r=(n=m).copy()).on(u,a=y),h.on=r}}function fse(e,t,n){var r=(e+="")=="transform"?dle:y9;return t==null?this.styleTween(e,lse(e,r)).on("end.style."+e,v9(e)):typeof t=="function"?this.styleTween(e,use(e,r,hk(this,"style."+e,t))).each(cse(this._id,e)):this.styleTween(e,sse(e,r,t),n).on("end.style."+e,null)}function dse(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function hse(e,t,n){var r,a;function l(){var u=t.apply(this,arguments);return u!==a&&(r=(a=u)&&dse(e,u,n)),r}return l._value=t,l}function pse(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,hse(e,t,n??""))}function mse(e){return function(){this.textContent=e}}function gse(e){return function(){var t=e(this);this.textContent=t??""}}function yse(e){return this.tween("text",typeof e=="function"?gse(hk(this,"text",e)):mse(e==null?"":e+""))}function vse(e){return function(t){this.textContent=e.call(this,t)}}function bse(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&vse(a)),t}return r._value=e,r}function xse(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,bse(e))}function Sse(){for(var e=this._name,t=this._id,n=b9(),r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)if(h=u[m]){var y=Tl(h,t);g2(h,e,n,m,u,{time:y.time+y.delay+y.duration,delay:0,duration:y.duration,ease:y.ease})}return new Fu(r,this._parents,e,n)}function wse(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(l,u){var d={value:u},h={value:function(){--a===0&&l()}};n.each(function(){var m=Rs(this,r),y=m.on;y!==e&&(t=(e=y).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(h)),m.on=t}),a===0&&l()})}var Ese=0;function Fu(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function b9(){return++Ese}var Gu=pv.prototype;Fu.prototype={constructor:Fu,select:rse,selectAll:ose,selectChild:Gu.selectChild,selectChildren:Gu.selectChildren,filter:qle,merge:Jle,selection:ise,transition:Sse,call:Gu.call,nodes:Gu.nodes,node:Gu.node,size:Gu.size,empty:Gu.empty,each:Gu.each,on:ese,attr:Ile,attrTween:Ple,style:fse,styleTween:pse,text:yse,textTween:xse,remove:nse,tween:Tle,delay:Fle,duration:$le,ease:Yle,easeVarying:Wle,end:wse,[Symbol.iterator]:Gu[Symbol.iterator]};function Cse(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _se={time:null,delay:0,duration:250,ease:Cse};function Ase(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Tse(e){var t,n;e instanceof Fu?(t=e._id,e=e._name):(t=b9(),(n=_se).time=sk(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&g2(h,e,t,m,u,n||Ase(h,t));return new Fu(r,this._parents,e,t)}pv.prototype.interrupt=Cle,pv.prototype.transition=Tse;const v2=e=>()=>e;function kse(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Uu(e,t,n){this.k=e,this.x=t,this.y=n}Uu.prototype={constructor:Uu,scale:function(e){return e===1?this:new Uu(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Uu(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var b2=new Uu(1,0,0);x9.prototype=Uu.prototype;function x9(e){for(;!e.__zoom;)if(!(e=e.parentNode))return b2;return e.__zoom}function pk(e){e.stopImmediatePropagation()}function Cv(e){e.preventDefault(),e.stopImmediatePropagation()}function Rse(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ose(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function S9(){return this.__zoom||b2}function Mse(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Nse(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dse(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function w9(){var e=Rse,t=Ose,n=Dse,r=Mse,a=Nse,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=u2,m=Qw("start","zoom","end"),y,v,S,w=500,A=150,E=0,k=10;function R(U){U.property("__zoom",S9).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",j).filter(a).on("touchstart.zoom",X).on("touchmove.zoom",ee).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}R.transform=function(U,te,V,W){var Q=U.selection?U.selection():U;Q.property("__zoom",S9),U!==Q?L(U,te,V,W):Q.interrupt().each(function(){P(this,arguments).event(W).start().zoom(null,typeof te=="function"?te.apply(this,arguments):te).end()})},R.scaleBy=function(U,te,V,W){R.scaleTo(U,function(){var Q=this.__zoom.k,ne=typeof te=="function"?te.apply(this,arguments):te;return Q*ne},V,W)},R.scaleTo=function(U,te,V,W){R.transform(U,function(){var Q=t.apply(this,arguments),ne=this.__zoom,B=V==null?I(Q):typeof V=="function"?V.apply(this,arguments):V,oe=ne.invert(B),se=typeof te=="function"?te.apply(this,arguments):te;return n(M(D(ne,se),B,oe),Q,u)},V,W)},R.translateBy=function(U,te,V,W){R.transform(U,function(){return n(this.__zoom.translate(typeof te=="function"?te.apply(this,arguments):te,typeof V=="function"?V.apply(this,arguments):V),t.apply(this,arguments),u)},null,W)},R.translateTo=function(U,te,V,W,Q){R.transform(U,function(){var ne=t.apply(this,arguments),B=this.__zoom,oe=W==null?I(ne):typeof W=="function"?W.apply(this,arguments):W;return n(b2.translate(oe[0],oe[1]).scale(B.k).translate(typeof te=="function"?-te.apply(this,arguments):-te,typeof V=="function"?-V.apply(this,arguments):-V),ne,u)},W,Q)};function D(U,te){return te=Math.max(l[0],Math.min(l[1],te)),te===U.k?U:new Uu(te,U.x,U.y)}function M(U,te,V){var W=te[0]-V[0]*U.k,Q=te[1]-V[1]*U.k;return W===U.x&&Q===U.y?U:new Uu(U.k,W,Q)}function I(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function L(U,te,V,W){U.on("start.zoom",function(){P(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,ne=arguments,B=P(Q,ne).event(W),oe=t.apply(Q,ne),se=V==null?I(oe):typeof V=="function"?V.apply(Q,ne):V,Y=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),he=Q.__zoom,ke=typeof te=="function"?te.apply(Q,ne):te,me=h(he.invert(se).concat(Y/he.k),ke.invert(se).concat(Y/ke.k));return function(Ee){if(Ee===1)Ee=ke;else{var xe=me(Ee),Be=Y/xe[2];Ee=new Uu(Be,se[0]-xe[0]*Be,se[1]-xe[1]*Be)}B.zoom(null,Ee)}})}function P(U,te,V){return!V&&U.__zooming||new G(U,te)}function G(U,te){this.that=U,this.args=te,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,te),this.taps=0}G.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,te){return this.mouse&&U!=="mouse"&&(this.mouse[1]=te.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=te.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=te.invert(this.touch1[0])),this.that.__zoom=te,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var te=Ha(this.that).datum();m.call(U,this.that,new kse(U,{sourceEvent:this.sourceEvent,target:R,transform:this.that.__zoom,dispatch:m}),te)}};function $(U,...te){if(!e.apply(this,arguments))return;var V=P(this,te).event(U),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,r.apply(this,arguments)))),ne=_l(U);if(V.wheel)(V.mouse[0][0]!==ne[0]||V.mouse[0][1]!==ne[1])&&(V.mouse[1]=W.invert(V.mouse[0]=ne)),clearTimeout(V.wheel);else{if(W.k===Q)return;V.mouse=[ne,W.invert(ne)],y2(this),V.start()}Cv(U),V.wheel=setTimeout(B,A),V.zoom("mouse",n(M(D(W,Q),V.mouse[0],V.mouse[1]),V.extent,u));function B(){V.wheel=null,V.end()}}function Z(U,...te){if(S||!e.apply(this,arguments))return;var V=U.currentTarget,W=P(this,te,!0).event(U),Q=Ha(U.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",Y,!0),ne=_l(U,V),B=U.clientX,oe=U.clientY;Uj(U.view),pk(U),W.mouse=[ne,this.__zoom.invert(ne)],y2(this),W.start();function se(he){if(Cv(he),!W.moved){var ke=he.clientX-B,me=he.clientY-oe;W.moved=ke*ke+me*me>E}W.event(he).zoom("mouse",n(M(W.that.__zoom,W.mouse[0]=_l(he,V),W.mouse[1]),W.extent,u))}function Y(he){Q.on("mousemove.zoom mouseup.zoom",null),$j(he.view,W.moved),Cv(he),W.event(he).end()}}function j(U,...te){if(e.apply(this,arguments)){var V=this.__zoom,W=_l(U.changedTouches?U.changedTouches[0]:U,this),Q=V.invert(W),ne=V.k*(U.shiftKey?.5:2),B=n(M(D(V,ne),W,Q),t.apply(this,te),u);Cv(U),d>0?Ha(this).transition().duration(d).call(L,B,W,U):Ha(this).call(R.transform,B,W,U)}}function X(U,...te){if(e.apply(this,arguments)){var V=U.touches,W=V.length,Q=P(this,te,U.changedTouches.length===W).event(U),ne,B,oe,se;for(pk(U),B=0;B<W;++B)oe=V[B],se=_l(oe,this),se=[se,this.__zoom.invert(se),oe.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==se[2]&&(Q.touch1=se,Q.taps=0):(Q.touch0=se,ne=!0,Q.taps=1+!!y);y&&(y=clearTimeout(y)),ne&&(Q.taps<2&&(v=se[0],y=setTimeout(function(){y=null},w)),y2(this),Q.start())}}function ee(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,Q=W.length,ne,B,oe,se;for(Cv(U),ne=0;ne<Q;++ne)B=W[ne],oe=_l(B,this),V.touch0&&V.touch0[2]===B.identifier?V.touch0[0]=oe:V.touch1&&V.touch1[2]===B.identifier&&(V.touch1[0]=oe);if(B=V.that.__zoom,V.touch1){var Y=V.touch0[0],he=V.touch0[1],ke=V.touch1[0],me=V.touch1[1],Ee=(Ee=ke[0]-Y[0])*Ee+(Ee=ke[1]-Y[1])*Ee,xe=(xe=me[0]-he[0])*xe+(xe=me[1]-he[1])*xe;B=D(B,Math.sqrt(Ee/xe)),oe=[(Y[0]+ke[0])/2,(Y[1]+ke[1])/2],se=[(he[0]+me[0])/2,(he[1]+me[1])/2]}else if(V.touch0)oe=V.touch0[0],se=V.touch0[1];else return;V.zoom("touch",n(M(B,oe,se),V.extent,u))}}function ae(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,Q=W.length,ne,B;for(pk(U),S&&clearTimeout(S),S=setTimeout(function(){S=null},w),ne=0;ne<Q;++ne)B=W[ne],V.touch0&&V.touch0[2]===B.identifier?delete V.touch0:V.touch1&&V.touch1[2]===B.identifier&&delete V.touch1;if(V.touch1&&!V.touch0&&(V.touch0=V.touch1,delete V.touch1),V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2&&(B=_l(B,this),Math.hypot(v[0]-B[0],v[1]-B[1])<k)){var oe=Ha(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return R.wheelDelta=function(U){return arguments.length?(r=typeof U=="function"?U:v2(+U),R):r},R.filter=function(U){return arguments.length?(e=typeof U=="function"?U:v2(!!U),R):e},R.touchable=function(U){return arguments.length?(a=typeof U=="function"?U:v2(!!U),R):a},R.extent=function(U){return arguments.length?(t=typeof U=="function"?U:v2([[+U[0][0],+U[0][1]],[+U[1][0],+U[1][1]]]),R):t},R.scaleExtent=function(U){return arguments.length?(l[0]=+U[0],l[1]=+U[1],R):[l[0],l[1]]},R.translateExtent=function(U){return arguments.length?(u[0][0]=+U[0][0],u[1][0]=+U[1][0],u[0][1]=+U[0][1],u[1][1]=+U[1][1],R):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},R.constrain=function(U){return arguments.length?(n=U,R):n},R.duration=function(U){return arguments.length?(d=+U,R):d},R.interpolate=function(U){return arguments.length?(h=U,R):h},R.on=function(){var U=m.on.apply(m,arguments);return U===m?R:U},R.clickDistance=function(U){return arguments.length?(E=(U=+U)*U,R):Math.sqrt(E)},R.tapDistance=function(U){return arguments.length?(k=+U,R):k},R}const Va={error001:()=>"[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:e=>`Node type "${e}" 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:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/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."},_v=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],E9=["Enter"," ","Escape"],C9={"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:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"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 Bm;(function(e){e.Strict="strict",e.Loose="loose"})(Bm||(Bm={}));var sh;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(sh||(sh={}));var Av;(function(e){e.Partial="partial",e.Full="full"})(Av||(Av={}));const _9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var xf;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xf||(xf={}));var x2;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(x2||(x2={}));var it;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(it||(it={}));const A9={[it.Left]:it.Right,[it.Right]:it.Left,[it.Top]:it.Bottom,[it.Bottom]:it.Top};function T9(e){return e===null?null:e?"valid":"invalid"}const k9=e=>"id"in e&&"source"in e&&"target"in e,Ise=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),mk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Tv=(e,t=[0,0])=>{const{width:n,height:r}=$u(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},zse=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):mk(a)?a:t.nodeLookup.get(a.id));const d=u?E2(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return S2(r,d)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return w2(n)},kv=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const a=E2(r);n=S2(n,a)}}),w2(n)},gk=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const d={...Ov(t,[n,r,a]),width:t.width/a,height:t.height/a},h=[];for(const m of e.values()){const{measured:y,selectable:v=!0,hidden:S=!1}=m;if(u&&!v||S)continue;const w=y.width??m.width??m.initialWidth??null,A=y.height??m.height??m.initialHeight??null,E=Rv(d,Pm(m)),k=(w??0)*(A??0),R=l&&E>0;(!m.internals.handleBounds||R||E>=k||m.dragging)&&h.push(m)}return h},jse=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Bse(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&(t?.includeHiddenNodes||!a.hidden)&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function Lse({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return Promise.resolve(!0);const d=Bse(e,u),h=kv(d),m=vk(h,t,n,u?.minZoom??a,u?.maxZoom??l,u?.padding??.1);return await r.setViewport(m,{duration:u?.duration,ease:u?.ease,interpolate:u?.interpolate}),Promise.resolve(!0)}function R9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),d=u.parentId?n.get(u.parentId):void 0,{x:h,y:m}=d?d.internals.positionAbsolute:{x:0,y:0},y=u.origin??r;let v=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!d)l?.("005",Va.error005());else{const w=d.measured.width,A=d.measured.height;w&&A&&(v=[[h,m],[h+w,m+A]])}else d&&Vm(u.extent)&&(v=[[u.extent[0][0]+h,u.extent[0][1]+m],[u.extent[1][0]+h,u.extent[1][1]+m]]);const S=Vm(v)?uh(t,v,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&l?.("015",Va.error015()),{position:{x:S.x-h+(u.measured.width??0)*y[0],y:S.y-m+(u.measured.height??0)*y[1]},positionAbsolute:S}}async function Pse({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(S=>S.id)),u=[];for(const S of n){if(S.deletable===!1)continue;const w=l.has(S.id),A=!w&&S.parentId&&u.find(E=>E.id===S.parentId);(w||A)&&u.push(S)}const d=new Set(t.map(S=>S.id)),h=r.filter(S=>S.deletable!==!1),y=jse(u,h);for(const S of h)d.has(S.id)&&!y.find(A=>A.id===S.id)&&y.push(S);if(!a)return{edges:y,nodes:u};const v=await a({nodes:u,edges:y});return typeof v=="boolean"?v?{edges:y,nodes:u}:{edges:[],nodes:[]}:v}const Lm=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),uh=(e={x:0,y:0},t,n)=>({x:Lm(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Lm(e.y,t[0][1],t[1][1]-(n?.height??0))});function O9(e,t,n){const{width:r,height:a}=$u(n),{x:l,y:u}=n.internals.positionAbsolute;return uh(e,[[l,u],[l+r,u+a]],t)}const M9=(e,t,n)=>e<t?Lm(Math.abs(e-t),1,t)/t:e>n?-Lm(Math.abs(e-n),1,t)/t:0,N9=(e,t,n=15,r=40)=>{const a=M9(e.x,r,t.width-r)*n,l=M9(e.y,r,t.height-r)*n;return[a,l]},S2=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),yk=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),w2=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Pm=(e,t=[0,0])=>{const{x:n,y:r}=mk(e)?e.internals.positionAbsolute:Tv(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},E2=(e,t=[0,0])=>{const{x:n,y:r}=mk(e)?e.internals.positionAbsolute:Tv(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},D9=(e,t)=>w2(S2(yk(e),yk(t))),Rv=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},I9=e=>kl(e.width)&&kl(e.height)&&kl(e.x)&&kl(e.y),kl=e=>!isNaN(e)&&isFinite(e),z9=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},C2=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ov=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const d={x:(e-n)/a,y:(t-r)/a};return l?C2(d,u):d},_2=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Hm(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Hse(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Hm(e,n),a=Hm(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Hm(e.top??e.y??0,n),a=Hm(e.bottom??e.y??0,n),l=Hm(e.left??e.x??0,t),u=Hm(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Vse(e,t,n,r,a,l){const{x:u,y:d}=_2(e,[t,n,r]),{x:h,y:m}=_2({x:e.x+e.width,y:e.y+e.height},[t,n,r]),y=a-h,v=l-m;return{left:Math.floor(u),top:Math.floor(d),right:Math.floor(y),bottom:Math.floor(v)}}const vk=(e,t,n,r,a,l)=>{const u=Hse(l,t,n),d=(t-u.x)/e.width,h=(n-u.y)/e.height,m=Math.min(d,h),y=Lm(m,r,a),v=e.x+e.width/2,S=e.y+e.height/2,w=t/2-v*y,A=n/2-S*y,E=Vse(e,w,A,y,t,n),k={left:Math.min(E.left-u.left,0),top:Math.min(E.top-u.top,0),right:Math.min(E.right-u.right,0),bottom:Math.min(E.bottom-u.bottom,0)};return{x:w-k.left+k.right,y:A-k.top+k.bottom,zoom:y}},A2=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Vm(e){return e!==void 0&&e!=="parent"}function $u(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function j9(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function B9(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const d=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*d[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*d[1]}return l}function L9(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Fse(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function Gse(e){return{...C9,...e||{}}}function Mv(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=Os(e),d=Ov({x:l-(a?.left??0),y:u-(a?.top??0)},r),{x:h,y:m}=n?C2(d,t):d;return{xSnapped:h,ySnapped:m,...d}}const bk=e=>({width:e.offsetWidth,height:e.offsetHeight}),P9=e=>e?.getRootNode?.()||window?.document,Use=["INPUT","SELECT","TEXTAREA"];function H9(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Use.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const V9=e=>"clientX"in e,Os=(e,t)=>{const n=V9(e),r=n?e.clientX:e.touches?.[0].clientX,a=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:a-(t?.top??0)}},F9=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const d=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(d.left-n.left)/r,y:(d.top-n.top)/r,...bk(u)}})};function G9({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d}){const h=e*.125+a*.375+u*.375+n*.125,m=t*.125+l*.375+d*.375+r*.125,y=Math.abs(h-e),v=Math.abs(m-t);return[h,m,y,v]}function T2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function U9({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case it.Left:return[t-T2(t-r,l),n];case it.Right:return[t+T2(r-t,l),n];case it.Top:return[t,n-T2(n-a,l)];case it.Bottom:return[t,n+T2(a-n,l)]}}function xk({sourceX:e,sourceY:t,sourcePosition:n=it.Bottom,targetX:r,targetY:a,targetPosition:l=it.Top,curvature:u=.25}){const[d,h]=U9({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[m,y]=U9({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[v,S,w,A]=G9({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:m,targetControlY:y});return[`M${e},${t} C${d},${h} ${m},${y} ${r},${a}`,v,S,w,A]}function $9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,u=Math.abs(r-t)/2,d=r<t?r+u:r-u;return[l,d,a,u]}function $se({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:a=!1}){if(r!==void 0)return r;const l=a&&n?1e3:0,u=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return l+u}function Xse({sourceNode:e,targetNode:t,width:n,height:r,transform:a}){const l=S2(E2(e),E2(t));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u={x:-a[0]/a[2],y:-a[1]/a[2],width:n/a[2],height:r/a[2]};return Rv(u,w2(l))>0}const Yse=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Zse=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Wse=(e,t)=>{if(!e.source||!e.target)return z9("006",Va.error006()),t;let n;return k9(e)?n={...e}:n={...e,id:Yse(e)},Zse(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function X9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,d]=$9({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,d]}const Y9={[it.Left]:{x:-1,y:0},[it.Right]:{x:1,y:0},[it.Top]:{x:0,y:-1},[it.Bottom]:{x:0,y:1}},qse=({source:e,sourcePosition:t=it.Bottom,target:n})=>t===it.Left||t===it.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Z9=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Jse({source:e,sourcePosition:t=it.Bottom,target:n,targetPosition:r=it.Top,center:a,offset:l,stepPosition:u}){const d=Y9[t],h=Y9[r],m={x:e.x+d.x*l,y:e.y+d.y*l},y={x:n.x+h.x*l,y:n.y+h.y*l},v=qse({source:m,sourcePosition:t,target:y}),S=v.x!==0?"x":"y",w=v[S];let A=[],E,k;const R={x:0,y:0},D={x:0,y:0},[,,M,I]=$9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(d[S]*h[S]===-1){S==="x"?(E=a.x??m.x+(y.x-m.x)*u,k=a.y??(m.y+y.y)/2):(E=a.x??(m.x+y.x)/2,k=a.y??m.y+(y.y-m.y)*u);const P=[{x:E,y:m.y},{x:E,y:y.y}],G=[{x:m.x,y:k},{x:y.x,y:k}];d[S]===w?A=S==="x"?P:G:A=S==="x"?G:P}else{const P=[{x:m.x,y:y.y}],G=[{x:y.x,y:m.y}];if(S==="x"?A=d.x===w?G:P:A=d.y===w?P:G,t===r){const ee=Math.abs(e[S]-n[S]);if(ee<=l){const ae=Math.min(l-1,l-ee);d[S]===w?R[S]=(m[S]>e[S]?-1:1)*ae:D[S]=(y[S]>n[S]?-1:1)*ae}}if(t!==r){const ee=S==="x"?"y":"x",ae=d[S]===h[ee],U=m[ee]>y[ee],te=m[ee]<y[ee];(d[S]===1&&(!ae&&U||ae&&te)||d[S]!==1&&(!ae&&te||ae&&U))&&(A=S==="x"?P:G)}const $={x:m.x+R.x,y:m.y+R.y},Z={x:y.x+D.x,y:y.y+D.y},j=Math.max(Math.abs($.x-A[0].x),Math.abs(Z.x-A[0].x)),X=Math.max(Math.abs($.y-A[0].y),Math.abs(Z.y-A[0].y));j>=X?(E=($.x+Z.x)/2,k=A[0].y):(E=A[0].x,k=($.y+Z.y)/2)}return[[e,{x:m.x+R.x,y:m.y+R.y},...A,{x:y.x+D.x,y:y.y+D.y},n],E,k,M,I]}function Qse(e,t,n,r){const a=Math.min(Z9(e,t)/2,Z9(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const m=e.x<n.x?-1:1,y=e.y<n.y?1:-1;return`L ${l+a*m},${u}Q ${l},${u} ${l},${u+a*y}`}const d=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${l},${u+a*h}Q ${l},${u} ${l+a*d},${u}`}function Sk({sourceX:e,sourceY:t,sourcePosition:n=it.Bottom,targetX:r,targetY:a,targetPosition:l=it.Top,borderRadius:u=5,centerX:d,centerY:h,offset:m=20,stepPosition:y=.5}){const[v,S,w,A,E]=Jse({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:d,y:h},offset:m,stepPosition:y});return[v.reduce((R,D,M)=>{let I="";return M>0&&M<v.length-1?I=Qse(v[M-1],D,v[M+1],u):I=`${M===0?"M":"L"}${D.x} ${D.y}`,R+=I,R},""),S,w,A,E]}function W9(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Kse(e){const{sourceNode:t,targetNode:n}=e;if(!W9(t)||!W9(n))return null;const r=t.internals.handleBounds||q9(t.handles),a=n.internals.handleBounds||q9(n.handles),l=J9(r?.source??[],e.sourceHandle),u=J9(e.connectionMode===Bm.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),e.targetHandle);if(!l||!u)return e.onError?.("008",Va.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const d=l?.position||it.Bottom,h=u?.position||it.Top,m=Nv(t,l,d),y=Nv(n,u,h);return{sourceX:m.x,sourceY:m.y,targetX:y.x,targetY:y.y,sourcePosition:d,targetPosition:h}}function q9(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Nv(e,t,n=it.Left,r=!1){const a=(t?.x??0)+e.internals.positionAbsolute.x,l=(t?.y??0)+e.internals.positionAbsolute.y,{width:u,height:d}=t??$u(e);if(r)return{x:a+u/2,y:l+d/2};switch(t?.position??n){case it.Top:return{x:a+u/2,y:l};case it.Right:return{x:a+u,y:l+d/2};case it.Bottom:return{x:a+u/2,y:l+d};case it.Left:return{x:a,y:l+d/2}}}function J9(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function wk(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function eue(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,d)=>([d.markerStart||r,d.markerEnd||a].forEach(h=>{if(h&&typeof h=="object"){const m=wk(h,t);l.has(m)||(u.push({id:m,color:h.color||n,...h}),l.add(m))}}),u),[]).sort((u,d)=>u.id.localeCompare(d.id))}const Ek={nodeOrigin:[0,0],nodeExtent:_v,elevateNodesOnSelect:!0,defaults:{}},tue={...Ek,checkEquality:!0};function Ck(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function nue(e,t,n){const r=Ck(Ek,n);for(const a of e.values())if(a.parentId)Ak(a,e,t,r);else{const l=Tv(a,r.nodeOrigin),u=Vm(a.extent)?a.extent:r.nodeExtent,d=uh(l,u,$u(a));a.internals.positionAbsolute=d}}function _k(e,t,n,r){const a=Ck(tue,r);let l=e.length>0;const u=new Map(t),d=a?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const h of e){let m=u.get(h.id);if(a.checkEquality&&h===m?.internals.userNode)t.set(h.id,m);else{const y=Tv(h,a.nodeOrigin),v=Vm(h.extent)?h.extent:a.nodeExtent,S=uh(y,v,$u(h));m={...a.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:S,handleBounds:h.measured?m?.internals.handleBounds:void 0,z:Q9(h,d),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(l=!1),h.parentId&&Ak(m,t,n,r)}return l}function rue(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Ak(e,t,n,r){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u}=Ck(Ek,r),d=e.parentId,h=t.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}rue(e,n);const m=a?1e3:0,{x:y,y:v,z:S}=oue(e,h,l,u,m),{positionAbsolute:w}=e.internals,A=y!==w.x||v!==w.y;(A||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:A?{x:y,y:v}:w,z:S}})}function Q9(e,t){return(kl(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function oue(e,t,n,r,a){const{x:l,y:u}=t.internals.positionAbsolute,d=$u(e),h=Tv(e,n),m=Vm(e.extent)?uh(h,e.extent,d):h;let y=uh({x:l+m.x,y:u+m.y},r,d);e.extent==="parent"&&(y=O9(y,d,t));const v=Q9(e,a),S=t.internals.z??0;return{x:y.x,y:y.y,z:S>=v?S+1:v}}function Tk(e,t,n,r=[0,0]){const a=[],l=new Map;for(const u of e){const d=t.get(u.parentId);if(!d)continue;const h=l.get(u.parentId)?.expandedRect??Pm(d),m=D9(h,u.rect);l.set(u.parentId,{expandedRect:m,parent:d})}return l.size>0&&l.forEach(({expandedRect:u,parent:d},h)=>{const m=d.internals.positionAbsolute,y=$u(d),v=d.origin??r,S=u.x<m.x?Math.round(Math.abs(m.x-u.x)):0,w=u.y<m.y?Math.round(Math.abs(m.y-u.y)):0,A=Math.max(y.width,Math.round(u.width)),E=Math.max(y.height,Math.round(u.height)),k=(A-y.width)*v[0],R=(E-y.height)*v[1];(S>0||w>0||k||R)&&(a.push({id:h,type:"position",position:{x:d.position.x-S+k,y:d.position.y-w+R}}),n.get(h)?.forEach(D=>{e.some(M=>M.id===D.id)||a.push({id:D.id,type:"position",position:{x:D.position.x+S,y:D.position.y+w}})})),(y.width<u.width||y.height<u.height||S||w)&&a.push({id:h,type:"dimensions",setAttributes:!0,dimensions:{width:A+(S?v[0]*S-k:0),height:E+(w?v[1]*w-R:0)}})}),a}function aue(e,t,n,r,a,l){const u=r?.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const h=[],m=window.getComputedStyle(u),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=[];for(const S of e.values()){const w=t.get(S.id);if(!w)continue;if(w.hidden){t.set(w.id,{...w,internals:{...w.internals,handleBounds:void 0}}),d=!0;continue}const A=bk(S.nodeElement),E=w.measured.width!==A.width||w.measured.height!==A.height;if(!!(A.width&&A.height&&(E||!w.internals.handleBounds||S.force))){const R=S.nodeElement.getBoundingClientRect(),D=Vm(w.extent)?w.extent:l;let{positionAbsolute:M}=w.internals;w.parentId&&w.extent==="parent"?M=O9(M,A,t.get(w.parentId)):D&&(M=uh(M,D,A));const I={...w,measured:A,internals:{...w.internals,positionAbsolute:M,handleBounds:{source:F9("source",S.nodeElement,R,y,w.id),target:F9("target",S.nodeElement,R,y,w.id)}}};t.set(w.id,I),w.parentId&&Ak(I,t,n,{nodeOrigin:a}),d=!0,E&&(h.push({id:w.id,type:"dimensions",dimensions:A}),w.expandParent&&w.parentId&&v.push({id:w.id,parentId:w.parentId,rect:Pm(I,a)}))}}if(v.length>0){const S=Tk(v,t,n,a);h.push(...S)}return{changes:h,updatedInternals:d}}async function iue({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r),d=!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2]);return Promise.resolve(d)}function K9(e,t,n,r,a,l){let u=a;const d=r.get(u)||new Map;r.set(u,d.set(n,t)),u=`${a}-${e}`;const h=r.get(u)||new Map;if(r.set(u,h.set(n,t)),l){u=`${a}-${e}-${l}`;const m=r.get(u)||new Map;r.set(u,m.set(n,t))}}function e6(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:d=null}=r,h={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:d},m=`${a}-${u}--${l}-${d}`,y=`${l}-${d}--${a}-${u}`;K9("source",h,y,e,a,u),K9("target",h,m,e,l,d),t.set(r.id,r)}}function t6(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:t6(n,t):!1}function n6(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function lue(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!t6(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const d=e.get(l);d&&a.set(l,{id:l,position:d.position||{x:0,y:0},distance:{x:n.x-d.internals.positionAbsolute.x,y:n.y-d.internals.positionAbsolute.y},extent:d.extent,parentId:d.parentId,origin:d.origin,expandParent:d.expandParent,internals:{positionAbsolute:d.internals.positionAbsolute||{x:0,y:0}},measured:{width:d.measured.width??0,height:d.measured.height??0}})}return a}function kk({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const a=[];for(const[u,d]of t){const h=n.get(u)?.internals.userNode;h&&a.push({...h,position:d.position,dragging:r})}if(!e)return[a[0],a];const l=n.get(e)?.internals.userNode;return[l?{...l,position:t.get(e)?.position||l.position,dragging:r}:a[0],a]}function sue({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,d=new Map,h=!1,m={x:0,y:0},y=null,v=!1,S=null,w=!1,A=!1;function E({noDragClassName:R,handleSelector:D,domNode:M,isSelectable:I,nodeId:L,nodeClickDistance:P=0}){S=Ha(M);function G({x:X,y:ee},ae){const{nodeLookup:U,nodeExtent:te,snapGrid:V,snapToGrid:W,nodeOrigin:Q,onNodeDrag:ne,onSelectionDrag:B,onError:oe,updateNodePositions:se}=t();l={x:X,y:ee};let Y=!1,he={x:0,y:0,x2:0,y2:0};if(d.size>1&&te){const ke=kv(d);he=yk(ke)}for(const[ke,me]of d){if(!U.has(ke))continue;let Ee={x:X-me.distance.x,y:ee-me.distance.y};W&&(Ee=C2(Ee,V));let xe=[[te[0][0],te[0][1]],[te[1][0],te[1][1]]];if(d.size>1&&te&&!me.extent){const{positionAbsolute:Ye}=me.internals,Re=Ye.x-he.x+te[0][0],Xe=Ye.x+me.measured.width-he.x2+te[1][0],We=Ye.y-he.y+te[0][1],At=Ye.y+me.measured.height-he.y2+te[1][1];xe=[[Re,We],[Xe,At]]}const{position:Be,positionAbsolute:He}=R9({nodeId:ke,nextPosition:Ee,nodeLookup:U,nodeExtent:xe,nodeOrigin:Q,onError:oe});Y=Y||me.position.x!==Be.x||me.position.y!==Be.y,me.position=Be,me.internals.positionAbsolute=He}if(A=A||Y,!!Y&&(se(d,!0),ae&&(r||ne||!L&&B))){const[ke,me]=kk({nodeId:L,dragItems:d,nodeLookup:U});r?.(ae,d,ke,me),ne?.(ae,ke,me),L||B?.(ae,me)}}async function $(){if(!y)return;const{transform:X,panBy:ee,autoPanSpeed:ae,autoPanOnNodeDrag:U}=t();if(!U){h=!1,cancelAnimationFrame(u);return}const[te,V]=N9(m,y,ae);(te!==0||V!==0)&&(l.x=(l.x??0)-te/X[2],l.y=(l.y??0)-V/X[2],await ee({x:te,y:V})&&G(l,null)),u=requestAnimationFrame($)}function Z(X){const{nodeLookup:ee,multiSelectionActive:ae,nodesDraggable:U,transform:te,snapGrid:V,snapToGrid:W,selectNodesOnDrag:Q,onNodeDragStart:ne,onSelectionDragStart:B,unselectNodesAndEdges:oe}=t();v=!0,(!Q||!I)&&!ae&&L&&(ee.get(L)?.selected||oe()),I&&Q&&L&&e?.(L);const se=Mv(X.sourceEvent,{transform:te,snapGrid:V,snapToGrid:W,containerBounds:y});if(l=se,d=lue(ee,U,se,L),d.size>0&&(n||ne||!L&&B)){const[Y,he]=kk({nodeId:L,dragItems:d,nodeLookup:ee});n?.(X.sourceEvent,d,Y,he),ne?.(X.sourceEvent,Y,he),L||B?.(X.sourceEvent,he)}}const j=Xj().clickDistance(P).on("start",X=>{const{domNode:ee,nodeDragThreshold:ae,transform:U,snapGrid:te,snapToGrid:V}=t();y=ee?.getBoundingClientRect()||null,w=!1,A=!1,ae===0&&Z(X),l=Mv(X.sourceEvent,{transform:U,snapGrid:te,snapToGrid:V,containerBounds:y}),m=Os(X.sourceEvent,y)}).on("drag",X=>{const{autoPanOnNodeDrag:ee,transform:ae,snapGrid:U,snapToGrid:te,nodeDragThreshold:V,nodeLookup:W}=t(),Q=Mv(X.sourceEvent,{transform:ae,snapGrid:U,snapToGrid:te,containerBounds:y});if((X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||L&&!W.has(L))&&(w=!0),!w){if(!h&&ee&&v&&(h=!0,$()),!v){const ne=Q.xSnapped-(l.x??0),B=Q.ySnapped-(l.y??0);Math.sqrt(ne*ne+B*B)>V&&Z(X)}(l.x!==Q.xSnapped||l.y!==Q.ySnapped)&&d&&v&&(m=Os(X.sourceEvent,y),G(Q,X.sourceEvent))}}).on("end",X=>{if(!(!v||w)&&(h=!1,v=!1,cancelAnimationFrame(u),d.size>0)){const{nodeLookup:ee,updateNodePositions:ae,onNodeDragStop:U,onSelectionDragStop:te}=t();if(A&&(ae(d,!1),A=!1),a||U||!L&&te){const[V,W]=kk({nodeId:L,dragItems:d,nodeLookup:ee,dragging:!1});a?.(X.sourceEvent,d,V,W),U?.(X.sourceEvent,V,W),L||te?.(X.sourceEvent,W)}}}).filter(X=>{const ee=X.target;return!X.button&&(!R||!n6(ee,`.${R}`,M))&&(!D||n6(ee,D,M))});S.call(j)}function k(){S?.on(".drag",null)}return{update:E,destroy:k}}function uue(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())Rv(a,Pm(l))>0&&r.push(l);return r}const cue=250;function fue(e,t,n,r){let a=[],l=1/0;const u=uue(e,n,t+cue);for(const d of u){const h=[...d.internals.handleBounds?.source??[],...d.internals.handleBounds?.target??[]];for(const m of h){if(r.nodeId===m.nodeId&&r.type===m.type&&r.id===m.id)continue;const{x:y,y:v}=Nv(d,m,m.position,!0),S=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(v-e.y,2));S>t||(S<l?(a=[{...m,x:y,y:v}],l=S):S===l&&a.push({...m,x:y,y:v}))}}if(!a.length)return null;if(a.length>1){const d=r.type==="source"?"target":"source";return a.find(h=>h.type===d)??a[0]}return a[0]}function r6(e,t,n,r,a,l=!1){const u=r.get(e);if(!u)return null;const d=a==="strict"?u.internals.handleBounds?.[t]:[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]],h=(n?d?.find(m=>m.id===n):d?.[0])??null;return h&&l?{...h,...Nv(u,h,h.position,!0)}:h}function o6(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function due(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const a6=()=>!0;function hue(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:d,nodeLookup:h,lib:m,autoPanOnConnect:y,flowId:v,panBy:S,cancelConnection:w,onConnectStart:A,onConnect:E,onConnectEnd:k,isValidConnection:R=a6,onReconnectEnd:D,updateConnection:M,getTransform:I,getFromHandle:L,autoPanSpeed:P,dragThreshold:G=1}){const $=P9(e.target);let Z=0,j;const{x:X,y:ee}=Os(e),ae=$?.elementFromPoint(X,ee),U=o6(l,ae),te=d?.getBoundingClientRect();let V=!1;if(!te||!U)return;const W=r6(a,U,r,h,t);if(!W)return;let Q=Os(e,te),ne=!1,B=null,oe=!1,se=null;function Y(){if(!y||!te)return;const[Ye,Re]=N9(Q,te,P);S({x:Ye,y:Re}),Z=requestAnimationFrame(Y)}const he={...W,nodeId:a,type:U,position:W.position},ke=h.get(a);let Ee={inProgress:!0,isValid:null,from:Nv(ke,he,it.Left,!0),fromHandle:he,fromPosition:he.position,fromNode:ke,to:Q,toHandle:null,toPosition:A9[he.position],toNode:null};function xe(){V=!0,M(Ee),A?.(e,{nodeId:a,handleId:r,handleType:U})}G===0&&xe();function Be(Ye){if(!V){const{x:At,y:Kt}=Os(Ye),qt=At-X,er=Kt-ee;if(!(qt*qt+er*er>G*G))return;xe()}if(!L()||!he){He(Ye);return}const Re=I();Q=Os(Ye,te),j=fue(Ov(Q,Re,!1,[1,1]),n,h,he),ne||(Y(),ne=!0);const Xe=i6(Ye,{handle:j,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:R,doc:$,lib:m,flowId:v,nodeLookup:h});se=Xe.handleDomNode,B=Xe.connection,oe=due(!!j,Xe.isValid);const We={...Ee,isValid:oe,to:Xe.toHandle&&oe?_2({x:Xe.toHandle.x,y:Xe.toHandle.y},Re):Q,toHandle:Xe.toHandle,toPosition:oe&&Xe.toHandle?Xe.toHandle.position:A9[he.position],toNode:Xe.toHandle?h.get(Xe.toHandle.nodeId):null};oe&&j&&Ee.toHandle&&We.toHandle&&Ee.toHandle.type===We.toHandle.type&&Ee.toHandle.nodeId===We.toHandle.nodeId&&Ee.toHandle.id===We.toHandle.id&&Ee.to.x===We.to.x&&Ee.to.y===We.to.y||(M(We),Ee=We)}function He(Ye){if(V){(j||se)&&B&&oe&&E?.(B);const{inProgress:Re,...Xe}=Ee,We={...Xe,toPosition:Ee.toHandle?Ee.toPosition:null};k?.(Ye,We),l&&D?.(Ye,We)}w(),cancelAnimationFrame(Z),ne=!1,oe=!1,B=null,se=null,$.removeEventListener("mousemove",Be),$.removeEventListener("mouseup",He),$.removeEventListener("touchmove",Be),$.removeEventListener("touchend",He)}$.addEventListener("mousemove",Be),$.addEventListener("mouseup",He),$.addEventListener("touchmove",Be),$.addEventListener("touchend",He)}function i6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:d,flowId:h,isValidConnection:m=a6,nodeLookup:y}){const v=l==="target",S=t?u.querySelector(`.${d}-flow__handle[data-id="${h}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:w,y:A}=Os(e),E=u.elementFromPoint(w,A),k=E?.classList.contains(`${d}-flow__handle`)?E:S,R={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const D=o6(void 0,k),M=k.getAttribute("data-nodeid"),I=k.getAttribute("data-handleid"),L=k.classList.contains("connectable"),P=k.classList.contains("connectableend");if(!M||!D)return R;const G={source:v?M:r,sourceHandle:v?I:a,target:v?r:M,targetHandle:v?a:I};R.connection=G;const Z=L&&P&&(n===Bm.Strict?v&&D==="source"||!v&&D==="target":M!==r||I!==a);R.isValid=Z&&m(G),R.toHandle=r6(M,D,I,y,n,!0)}return R}const Rk={onPointerDown:hue,isValid:i6};function pue({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=Ha(e);function l({translateExtent:d,width:h,height:m,zoomStep:y=10,pannable:v=!0,zoomable:S=!0,inversePan:w=!1}){const A=M=>{const I=n();if(M.sourceEvent.type!=="wheel"||!t)return;const L=-M.sourceEvent.deltaY*(M.sourceEvent.deltaMode===1?.05:M.sourceEvent.deltaMode?1:.002)*y,P=I[2]*Math.pow(2,L);t.scaleTo(P)};let E=[0,0];const k=M=>{(M.sourceEvent.type==="mousedown"||M.sourceEvent.type==="touchstart")&&(E=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY])},R=M=>{const I=n();if(M.sourceEvent.type!=="mousemove"&&M.sourceEvent.type!=="touchmove"||!t)return;const L=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY],P=[L[0]-E[0],L[1]-E[1]];E=L;const G=r()*Math.max(I[2],Math.log(I[2]))*(w?-1:1),$={x:I[0]-P[0]*G,y:I[1]-P[1]*G},Z=[[0,0],[h,m]];t.setViewportConstrained({x:$.x,y:$.y,zoom:I[2]},Z,d)},D=w9().on("start",k).on("zoom",v?R:null).on("zoom.wheel",S?A:null);a.call(D,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:_l}}const mue=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,k2=e=>({x:e.x,y:e.y,zoom:e.k}),Ok=({x:e,y:t,zoom:n})=>b2.translate(e,t).scale(n),Fm=(e,t)=>e.target.closest(`.${t}`),l6=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),gue=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mk=(e,t=0,n=gue,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},s6=e=>{const t=e.ctrlKey&&A2()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function yue({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:d,onPanZoom:h,onPanZoomEnd:m}){return y=>{if(Fm(y,t))return!1;y.preventDefault(),y.stopImmediatePropagation();const v=n.property("__zoom").k||1;if(y.ctrlKey&&u){const k=_l(y),R=s6(y),D=v*Math.pow(2,R);r.scaleTo(n,D,k,y);return}const S=y.deltaMode===1?20:1;let w=a===sh.Vertical?0:y.deltaX*S,A=a===sh.Horizontal?0:y.deltaY*S;!A2()&&y.shiftKey&&a!==sh.Vertical&&(w=y.deltaY*S,A=0),r.translateBy(n,-(w/v)*l,-(A/v)*l,{internal:!0});const E=k2(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,d?.(y,E)),e.isPanScrolling&&(h?.(y,E),e.panScrollTimeout=setTimeout(()=>{m?.(y,E),e.isPanScrolling=!1},150))}}function vue({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,d=Fm(r,e);if(r.ctrlKey&&l&&d&&r.preventDefault(),u||d)return null;r.preventDefault(),n.call(this,r,a)}}function bue({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const a=k2(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=a,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,a)}}function xue({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{e.usedRightMouseButton=!!(n&&l6(t,e.mouseButton??0)),l.sourceEvent?.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!l.sourceEvent?.internal&&a?.(l.sourceEvent,k2(l.transform))}}function Sue({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{if(!u.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,l&&l6(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a&&mue(e.prevViewport,u.transform))){const d=k2(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a?.(u.sourceEvent,d)},n?150:0)}}}function wue({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:d,noPanClassName:h,lib:m}){return y=>{const v=e||t,S=n&&y.ctrlKey;if(y.button===1&&y.type==="mousedown"&&(Fm(y,`${m}-flow__node`)||Fm(y,`${m}-flow__edge`)))return!0;if(!r&&!v&&!a&&!l&&!n||u||Fm(y,d)&&y.type==="wheel"||Fm(y,h)&&(y.type!=="wheel"||a&&y.type==="wheel"&&!e)||!n&&y.ctrlKey&&y.type==="wheel")return!1;if(!n&&y.type==="touchstart"&&y.touches?.length>1)return y.preventDefault(),!1;if(!v&&!a&&!S&&y.type==="wheel"||!r&&(y.type==="mousedown"||y.type==="touchstart")||Array.isArray(r)&&!r.includes(y.button)&&y.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(y.button)||!y.button||y.button<=1;return(!y.ctrlKey||y.type==="wheel")&&w}}function Eue({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:a,viewport:l,onPanZoom:u,onPanZoomStart:d,onPanZoomEnd:h,onDraggingChange:m}){const y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),S=w9().clickDistance(!kl(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(a),w=Ha(e).call(S);M({x:l.x,y:l.y,zoom:Lm(l.zoom,t,n)},[[0,0],[v.width,v.height]],a);const A=w.on("wheel.zoom"),E=w.on("dblclick.zoom");S.wheelDelta(s6);function k(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?bv:u2).transform(Mk(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function R({noWheelClassName:ee,noPanClassName:ae,onPaneContextMenu:U,userSelectionActive:te,panOnScroll:V,panOnDrag:W,panOnScrollMode:Q,panOnScrollSpeed:ne,preventScrolling:B,zoomOnPinch:oe,zoomOnScroll:se,zoomOnDoubleClick:Y,zoomActivationKeyPressed:he,lib:ke,onTransformChange:me}){te&&!y.isZoomingOrPanning&&D();const xe=V&&!he&&!te?yue({zoomPanValues:y,noWheelClassName:ee,d3Selection:w,d3Zoom:S,panOnScrollMode:Q,panOnScrollSpeed:ne,zoomOnPinch:oe,onPanZoomStart:d,onPanZoom:u,onPanZoomEnd:h}):vue({noWheelClassName:ee,preventScrolling:B,d3ZoomHandler:A});if(w.on("wheel.zoom",xe,{passive:!1}),!te){const He=bue({zoomPanValues:y,onDraggingChange:m,onPanZoomStart:d});S.on("start",He);const Ye=xue({zoomPanValues:y,panOnDrag:W,onPaneContextMenu:!!U,onPanZoom:u,onTransformChange:me});S.on("zoom",Ye);const Re=Sue({zoomPanValues:y,panOnDrag:W,panOnScroll:V,onPaneContextMenu:U,onPanZoomEnd:h,onDraggingChange:m});S.on("end",Re)}const Be=wue({zoomActivationKeyPressed:he,panOnDrag:W,zoomOnScroll:se,panOnScroll:V,zoomOnDoubleClick:Y,zoomOnPinch:oe,userSelectionActive:te,noPanClassName:ae,noWheelClassName:ee,lib:ke});S.filter(Be),Y?w.on("dblclick.zoom",E):w.on("dblclick.zoom",null)}function D(){S.on("zoom",null)}async function M(ee,ae,U){const te=Ok(ee),V=S?.constrain()(te,ae,U);return V&&await k(V),new Promise(W=>W(V))}async function I(ee,ae){const U=Ok(ee);return await k(U,ae),new Promise(te=>te(U))}function L(ee){if(w){const ae=Ok(ee),U=w.property("__zoom");(U.k!==ee.zoom||U.x!==ee.x||U.y!==ee.y)&&S?.transform(w,ae,null,{sync:!0})}}function P(){const ee=w?x9(w.node()):{x:0,y:0,k:1};return{x:ee.x,y:ee.y,zoom:ee.k}}function G(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?bv:u2).scaleTo(Mk(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function $(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?bv:u2).scaleBy(Mk(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function Z(ee){S?.scaleExtent(ee)}function j(ee){S?.translateExtent(ee)}function X(ee){const ae=!kl(ee)||ee<0?0:ee;S?.clickDistance(ae)}return{update:R,destroy:D,setViewport:I,setViewportConstrained:M,getViewport:P,scaleTo:G,scaleBy:$,setScaleExtent:Z,setTranslateExtent:j,syncViewport:L,setClickDistance:X}}var Gm;(function(e){e.Line="line",e.Handle="handle"})(Gm||(Gm={}));function Cue({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,d=n-r,h=[u>0?1:u<0?-1:0,d>0?1:d<0?-1:0];return u&&a&&(h[0]=h[0]*-1),d&&l&&(h[1]=h[1]*-1),h}function _ue(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function Sf(e,t){return Math.max(0,t-e)}function wf(e,t){return Math.max(0,e-t)}function R2(e,t,n){return Math.max(0,t-e,e-n)}function u6(e,t){return e?!t:t}function Aue(e,t,n,r,a,l,u,d){let{affectsX:h,affectsY:m}=t;const{isHorizontal:y,isVertical:v}=t,S=y&&v,{xSnapped:w,ySnapped:A}=n,{minWidth:E,maxWidth:k,minHeight:R,maxHeight:D}=r,{x:M,y:I,width:L,height:P,aspectRatio:G}=e;let $=Math.floor(y?w-e.pointerX:0),Z=Math.floor(v?A-e.pointerY:0);const j=L+(h?-$:$),X=P+(m?-Z:Z),ee=-l[0]*L,ae=-l[1]*P;let U=R2(j,E,k),te=R2(X,R,D);if(u){let Q=0,ne=0;h&&$<0?Q=Sf(M+$+ee,u[0][0]):!h&&$>0&&(Q=wf(M+j+ee,u[1][0])),m&&Z<0?ne=Sf(I+Z+ae,u[0][1]):!m&&Z>0&&(ne=wf(I+X+ae,u[1][1])),U=Math.max(U,Q),te=Math.max(te,ne)}if(d){let Q=0,ne=0;h&&$>0?Q=wf(M+$,d[0][0]):!h&&$<0&&(Q=Sf(M+j,d[1][0])),m&&Z>0?ne=wf(I+Z,d[0][1]):!m&&Z<0&&(ne=Sf(I+X,d[1][1])),U=Math.max(U,Q),te=Math.max(te,ne)}if(a){if(y){const Q=R2(j/G,R,D)*G;if(U=Math.max(U,Q),u){let ne=0;!h&&!m||h&&!m&&S?ne=wf(I+ae+j/G,u[1][1])*G:ne=Sf(I+ae+(h?$:-$)/G,u[0][1])*G,U=Math.max(U,ne)}if(d){let ne=0;!h&&!m||h&&!m&&S?ne=Sf(I+j/G,d[1][1])*G:ne=wf(I+(h?$:-$)/G,d[0][1])*G,U=Math.max(U,ne)}}if(v){const Q=R2(X*G,E,k)/G;if(te=Math.max(te,Q),u){let ne=0;!h&&!m||m&&!h&&S?ne=wf(M+X*G+ee,u[1][0])/G:ne=Sf(M+(m?Z:-Z)*G+ee,u[0][0])/G,te=Math.max(te,ne)}if(d){let ne=0;!h&&!m||m&&!h&&S?ne=Sf(M+X*G,d[1][0])/G:ne=wf(M+(m?Z:-Z)*G,d[0][0])/G,te=Math.max(te,ne)}}}Z=Z+(Z<0?te:-te),$=$+($<0?U:-U),a&&(S?j>X*G?Z=(u6(h,m)?-$:$)/G:$=(u6(h,m)?-Z:Z)*G:y?(Z=$/G,m=h):($=Z*G,h=m));const V=h?M+$:M,W=m?I+Z:I;return{width:L+(h?-$:$),height:P+(m?-Z:Z),x:l[0]*$*(h?-1:1)+V,y:l[1]*Z*(m?-1:1)+W}}const c6={width:0,height:0,x:0,y:0},Tue={...c6,pointerX:0,pointerY:0,aspectRatio:1};function kue(e){return[[0,0],[e.measured.width,e.measured.height]]}function Rue(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,d=n[0]*l,h=n[1]*u;return[[r-d,a-h],[r+l-d,a+u-h]]}function Oue({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=Ha(e);function u({controlPosition:h,boundaries:m,keepAspectRatio:y,resizeDirection:v,onResizeStart:S,onResize:w,onResizeEnd:A,shouldResize:E}){let k={...c6},R={...Tue};const D=_ue(h);let M,I=null,L=[],P,G,$;const Z=Xj().on("start",j=>{const{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,paneDomNode:V}=n();if(M=X.get(t),!M)return;I=V?.getBoundingClientRect()??null;const{xSnapped:W,ySnapped:Q}=Mv(j.sourceEvent,{transform:ee,snapGrid:ae,snapToGrid:U,containerBounds:I});k={width:M.measured.width??0,height:M.measured.height??0,x:M.position.x??0,y:M.position.y??0},R={...k,pointerX:W,pointerY:Q,aspectRatio:k.width/k.height},P=void 0,M.parentId&&(M.extent==="parent"||M.expandParent)&&(P=X.get(M.parentId),G=P&&M.extent==="parent"?kue(P):void 0),L=[],$=void 0;for(const[ne,B]of X)if(B.parentId===t&&(L.push({id:ne,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const oe=Rue(B,M,B.origin??te);$?$=[[Math.min(oe[0][0],$[0][0]),Math.min(oe[0][1],$[0][1])],[Math.max(oe[1][0],$[1][0]),Math.max(oe[1][1],$[1][1])]]:$=oe}S?.(j,{...k})}).on("drag",j=>{const{transform:X,snapGrid:ee,snapToGrid:ae,nodeOrigin:U}=n(),te=Mv(j.sourceEvent,{transform:X,snapGrid:ee,snapToGrid:ae,containerBounds:I}),V=[];if(!M)return;const{x:W,y:Q,width:ne,height:B}=k,oe={},se=M.origin??U,{width:Y,height:he,x:ke,y:me}=Aue(R,D,te,m,y,se,G,$),Ee=Y!==ne,xe=he!==B,Be=ke!==W&&Ee,He=me!==Q&&xe;if(!Be&&!He&&!Ee&&!xe)return;if((Be||He||se[0]===1||se[1]===1)&&(oe.x=Be?ke:k.x,oe.y=He?me:k.y,k.x=oe.x,k.y=oe.y,L.length>0)){const We=ke-W,At=me-Q;for(const Kt of L)Kt.position={x:Kt.position.x-We+se[0]*(Y-ne),y:Kt.position.y-At+se[1]*(he-B)},V.push(Kt)}if((Ee||xe)&&(oe.width=Ee&&(!v||v==="horizontal")?Y:k.width,oe.height=xe&&(!v||v==="vertical")?he:k.height,k.width=oe.width,k.height=oe.height),P&&M.expandParent){const We=se[0]*(oe.width??0);oe.x&&oe.x<We&&(k.x=We,R.x=R.x-(oe.x-We));const At=se[1]*(oe.height??0);oe.y&&oe.y<At&&(k.y=At,R.y=R.y-(oe.y-At))}const Ye=Cue({width:k.width,prevWidth:ne,height:k.height,prevHeight:B,affectsX:D.affectsX,affectsY:D.affectsY}),Re={...k,direction:Ye};E?.(j,Re)!==!1&&(w?.(j,Re),r(oe,V))}).on("end",j=>{A?.(j,{...k}),a?.({...k})});l.call(Z)}function d(){l.on(".drag",null)}return{update:u,destroy:d}}const{useDebugValue:Mue}=q,{useSyncExternalStoreWithSelector:Nue}=Bz,Due=e=>e;function f6(e,t=Due,n){const r=Nue(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Mue(r),r}const d6=(e,t)=>{const n=Rz(e),r=(a,l=t)=>f6(n,a,l);return Object.assign(r,n),r},Iue=(e,t)=>e?d6(e,t):d6;function Xn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const O2=q.createContext(null),zue=O2.Provider,h6=Va.error001();function Gt(e,t){const n=q.useContext(O2);if(n===null)throw new Error(h6);return f6(n,e,t)}function jn(){const e=q.useContext(O2);if(e===null)throw new Error(h6);return q.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const p6={display:"none"},jue={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},m6="react-flow__node-desc",g6="react-flow__edge-desc",Bue="react-flow__aria-live",Lue=e=>e.ariaLiveMessage,Pue=e=>e.ariaLabelConfig;function Hue({rfId:e}){const t=Gt(Lue);return T.jsx("div",{id:`${Bue}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:jue,children:t})}function Vue({rfId:e,disableKeyboardA11y:t}){const n=Gt(Pue);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${m6}-${e}`,style:p6,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${g6}-${e}`,style:p6,children:n["edge.a11yDescription.default"]}),!t&&T.jsx(Hue,{rfId:e})]})}const M2=q.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return T.jsx("div",{className:br(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});M2.displayName="Panel";function Fue({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:T.jsx(M2,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Gue=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},N2=e=>e.id;function Uue(e,t){return Xn(e.selectedNodes.map(N2),t.selectedNodes.map(N2))&&Xn(e.selectedEdges.map(N2),t.selectedEdges.map(N2))}function $ue({onSelectionChange:e}){const t=jn(),{selectedNodes:n,selectedEdges:r}=Gt(Gue,Uue);return q.useEffect(()=>{const a={nodes:n,edges:r};e?.(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const Xue=e=>!!e.onSelectionChangeHandlers;function Yue({onSelectionChange:e}){const t=Gt(Xue);return e||t?T.jsx($ue,{onSelectionChange:e}):null}const y6=[0,0],Zue={x:0,y:0,zoom:1},v6=[...["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","paneClickDistance","ariaLabelConfig"],"rfId"],Wue=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),b6={translateExtent:_v,nodeOrigin:y6,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function que(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:d,setDefaultNodesAndEdges:h,setPaneClickDistance:m}=Gt(Wue,Xn),y=jn();q.useEffect(()=>(h(e.defaultNodes,e.defaultEdges),()=>{v.current=b6,d()}),[]);const v=q.useRef(b6);return q.useEffect(()=>{for(const S of v6){const w=e[S],A=v.current[S];w!==A&&(typeof e[S]>"u"||(S==="nodes"?t(w):S==="edges"?n(w):S==="minZoom"?r(w):S==="maxZoom"?a(w):S==="translateExtent"?l(w):S==="nodeExtent"?u(w):S==="paneClickDistance"?m(w):S==="ariaLabelConfig"?y.setState({ariaLabelConfig:Gse(w)}):S==="fitView"?y.setState({fitViewQueued:w}):S==="fitViewOptions"?y.setState({fitViewOptions:w}):y.setState({[S]:w})))}v.current=e},v6.map(S=>e[S])),null}function x6(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Jue(e){const[t,n]=q.useState(e==="system"?null:e);return q.useEffect(()=>{if(e!=="system"){n(e);return}const r=x6(),a=()=>n(r?.matches?"dark":"light");return a(),r?.addEventListener("change",a),()=>{r?.removeEventListener("change",a)}},[e]),t!==null?t:x6()?.matches?"dark":"light"}const S6=typeof document<"u"?document:null;function Xu(e=null,t={target:S6,actInsideInputWithModifier:!0}){const[n,r]=q.useState(!1),a=q.useRef(!1),l=q.useRef(new Set([])),[u,d]=q.useMemo(()=>{if(e!==null){const m=(Array.isArray(e)?e:[e]).filter(v=>typeof v=="string").map(v=>v.replace("+",`
|
|
1077
|
+
`+l):r.stack=l}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=nh(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:l}=n;r!==void 0&&Jw.assertOptions(r,{silentJSONParsing:As.transitional(As.boolean),forcedJSONParsing:As.transitional(As.boolean),clarifyTimeoutError:As.transitional(As.boolean)},!1),a!=null&&(Te.isFunction(a)?n.paramsSerializer={serialize:a}:Jw.assertOptions(a,{encode:As.function,serialize:As.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Jw.assertOptions(n,{baseUrl:As.spelling("baseURL"),withXsrfToken:As.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let u=l&&Te.merge(l.common,l[n.method]);l&&Te.forEach(["delete","get","head","post","put","patch","common"],A=>{delete l[A]}),n.headers=la.concat(u,l);const d=[];let h=!0;this.interceptors.request.forEach(function(E){typeof E.runWhen=="function"&&E.runWhen(n)===!1||(h=h&&E.synchronous,d.unshift(E.fulfilled,E.rejected))});const m=[];this.interceptors.response.forEach(function(E){m.push(E.fulfilled,E.rejected)});let y,v=0,S;if(!h){const A=[Cj.bind(this),void 0];for(A.unshift(...d),A.push(...m),S=A.length,y=Promise.resolve(n);v<S;)y=y.then(A[v++],A[v++]);return y}S=d.length;let w=n;for(v=0;v<S;){const A=d[v++],E=d[v++];try{w=A(w)}catch(k){E.call(this,k);break}}try{y=Cj.call(this,w)}catch(A){return Promise.reject(A)}for(v=0,S=m.length;v<S;)y=y.then(m[v++],m[v++]);return y}getUri(t){t=nh(this.defaults,t);const n=mj(t.baseURL,t.url,t.allowAbsoluteUrls);return ij(n,t.params,t.paramsSerializer)}};Te.forEach(["delete","get","head","options"],function(t){rh.prototype[t]=function(n,r){return this.request(nh(r||{},{method:t,url:n,data:(r||{}).data}))}}),Te.forEach(["post","put","patch"],function(t){function n(r){return function(l,u,d){return this.request(nh(d||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:l,data:u}))}}rh.prototype[t]=n(),rh.prototype[t+"Form"]=n(!0)});let qoe=class Y8{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(l){n=l});const r=this;this.promise.then(a=>{if(!r._listeners)return;let l=r._listeners.length;for(;l-- >0;)r._listeners[l](a);r._listeners=null}),this.promise.then=a=>{let l;const u=new Promise(d=>{r.subscribe(d),l=d}).then(a);return u.cancel=function(){r.unsubscribe(l)},u},t(function(l,u,d){r.reason||(r.reason=new Nm(l,u,d),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Y8(function(a){t=a}),cancel:t}}};function Joe(e){return function(n){return e.apply(null,n)}}function Qoe(e){return Te.isObject(e)&&e.isAxiosError===!0}const WT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(WT).forEach(([e,t])=>{WT[t]=e});function Tj(e){const t=new rh(e),n=$z(rh.prototype.request,t);return Te.extend(n,rh.prototype,t,{allOwnKeys:!0}),Te.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return Tj(nh(e,a))},n}const lr=Tj(dv);lr.Axios=rh,lr.CanceledError=Nm,lr.CancelToken=qoe,lr.isCancel=fj,lr.VERSION=_j,lr.toFormData=$w,lr.AxiosError=Et,lr.Cancel=lr.CanceledError,lr.all=function(t){return Promise.all(t)},lr.spread=Joe,lr.isAxiosError=Qoe,lr.mergeConfig=nh,lr.AxiosHeaders=la,lr.formToJSON=e=>uj(Te.isHTMLForm(e)?new FormData(e):e),lr.getAdapter=Ej.getAdapter,lr.HttpStatusCode=WT,lr.default=lr;const{Axios:ESe,AxiosError:CSe,CanceledError:_Se,isCancel:ASe,CancelToken:TSe,VERSION:kSe,all:RSe,Cancel:OSe,isAxiosError:MSe,spread:NSe,toFormData:DSe,AxiosHeaders:ISe,HttpStatusCode:zSe,formToJSON:jSe,getAdapter:BSe,mergeConfig:LSe}=lr;class kj extends Rre{constructor(t){super(t),this._websocket=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=5e3,this._reconnect=!0,this._reconnect_timeout=void 0,this._url=t.url,this._reconnect_timeout=setTimeout(()=>{this.connect()},200),this._zustand&&this._zustand.auto_progress()}connect(){this._zustand?.logger.info("Connecting to websocket"),this.is_open=!1,this._websocket=new WebSocket(this._url),this._websocket.onopen=()=>{this.onopen()},this._websocket.onclose=()=>{this.onclose()},this._websocket.onerror=()=>{this.on_ws_error()},this._websocket.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):t.data instanceof Blob&&t.data.arrayBuffer().then(n=>{const r=new Uint8Array(n);this.getCommunicationManager().onbytes(r)})}}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}auto_reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this._zustand?.logger.info(`Attempting to reconnect in ${t} ms`),this._reconnect_timeout=setTimeout(()=>{this._websocket&&this._websocket.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this._zustand?.logger.warn("Maximum reconnect attempts reached. Giving up.")}async onmessage(t){try{const n=JSON.parse(t);this._zustand?.logger.debug(`Recieved data of length: ${t.length} and data"`,n),await this.getCommunicationManager().receive(n)}catch(n){console.error("Websocketworker: onmessage JSON.parse error",n,t);return}}get http_protocol(){return this.secure_url?"https":"http"}get secure_url(){return this._url.startsWith("wss")}get url_wo_protocol(){return this._url.substring(this.secure_url?6:5)}get http_url(){var t=this.http_protocol+"://"+this.url_wo_protocol;return t[t.length-1]!=="/"&&(t+="/"),t}get_io_subscription_url({node_id:t,io_id:n,stream:r}){let a=this.http_url+`node/${t}/io/${n}/value`;return r&&(a+="/stream"),a}async upload_file({files:t,onProgressCallback:n,root:r}){const a=`${this.http_url}upload/`,l=new FormData,u=Array.isArray(t)?t:Array.from(t);for(const d of u){const h=d.webkitRelativePath||d.name,m=r?`${r}/${h}`:h;l.append("file",d,m)}try{return(await lr.post(a,l,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:h=>{n&&n(h.loaded,h.total)}})).data.file}catch{throw new Error("Failed to upload file")}}async handle_large_message_hint({msg_id:t}){const n=this.http_url+"message/"+t,a=await(await fetch(n,{method:"GET",headers:{"Content-Type":"application/json","Access-Control-Allow-Origin":"*"}})).json();this.getCommunicationManager().receive(a)}onopen(){this._zustand?.logger.info("Websocket opened"),this.is_open=!0,this._zustand&&this._zustand.auto_progress(),this.reconnectAttempts=0,this.getSyncManager().stepwise_fullsync()}onclose(){this._zustand?.logger.info("Websocket closed"),super.onclose(),this._reconnect&&(this._zustand?.logger.info("Websocket closed,reconnecting"),this.auto_reconnect())}on_ws_error(){this._zustand?.logger.warn("Websocket error"),this._websocket?this._websocket.close():this.auto_reconnect()}async send_large_message(t){const n=`${this.http_url}message/`;await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:t})}async send(t){if(!this._websocket||this._websocket.readyState!==WebSocket.OPEN){this._zustand?.logger.warn("Websocket not connected");return}const n=JSON.stringify(t);if(new Blob([n]).size>1e6)return this._zustand?.logger.info("Data too large, sending via http"),await this.send_large_message(n);this._zustand?.logger.debug("Sending data",t),this._websocket.send(n)}async stop(){await super.stop(),this._reconnect=!1}close(){this._websocket&&this._websocket.close()}disconnect(){super.disconnect(),this._reconnect=!1,this._reconnect_timeout&&(clearTimeout(this._reconnect_timeout),this._reconnect_timeout=void 0),this.close()}async reconnect(){if(await super.reconnect(),this._reconnect=!0,this._websocket&&(this._zustand?.logger.info("Reconnecting"),(this._websocket.readyState===WebSocket.OPEN||this._websocket.readyState===WebSocket.CONNECTING)&&(this._websocket.readyState===WebSocket.CONNECTING&&await new Promise((t,n)=>{if(this._websocket===null)return;let r=setTimeout(()=>{n("Timeout@reconnect")},2e3);this._websocket.addEventListener("open",()=>{clearTimeout(r),t(null)},{once:!0}),this._websocket.readyState===WebSocket.OPEN&&(clearTimeout(r),t(null))}),this._websocket.readyState===WebSocket.OPEN))){this.getSyncManager().stepwise_fullsync();return}this.connect()}}class Koe{constructor(t,n){this.ws=null,this.reconnectAttempts=0,this.maxReconnectAttempts=999,this.initialTimeout=200,this.maxTimeout=2e3,n.logger.debug("Initializing worker manager"),this._wsuri=t,this.zustand=n,this.workers={},this.on_setWorker=r=>{this.zustand.set_worker(r)},this.connectionTimeout=setTimeout(()=>{this.connect()},200)}get wsuri(){return this._wsuri}get open(){return this.ws?.readyState===WebSocket.OPEN}connect(){this.zustand.set_progress({progress:0,message:"connecting to worker manager",status:"info",blocking:!0}),this.zustand.logger.info("Connecting to websocket:",this._wsuri),this.ws=new WebSocket(this._wsuri),this.ws.onopen=()=>{this.onopen()},this.ws.onclose=()=>{this.onclose()},this.ws.onerror=()=>{this.on_ws_error()},this.ws.onmessage=t=>{typeof t.data=="string"?this.onmessage(t.data):console.error("WorkerManager: onmessage event.data is not a string",typeof t.data)},this.connectionTimeout=setTimeout(()=>{this.ws?.readyState!==WebSocket.OPEN&&this.on_ws_error()},5e3)}on_ws_error(){console.warn("Websocket error"),this.ws?this.ws.close():this.reconnect()}onopen(){this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.zustand.auto_progress(),this.ws&&this.ws.send("worker_status");const t=window.localStorage.getItem("funcnodes__active_worker");t&&this.set_active(t)}onmessage(t){try{let n=JSON.parse(t);if(n.type==="worker_status"){const r={};for(let a of n.active)a.active=!0,r[a.uuid]=a;for(let a of n.inactive)a.active=!1,r[a.uuid]=a;this.zustand.workers.setState(r);return}else if(n.type==="set_worker"){if(n.data.type==="WSWorker"){let r="ws"+(n.data.ssl?"s":"")+"://"+n.data.host+":"+n.data.port;this.setWorker(this.workers[n.data.uuid]||new kj({url:r,zustand:this.zustand,uuid:n.data.uuid,on_sync_complete:this.zustand.options.on_sync_complete}))}else this.zustand.logger.error("WorkerManager: unknown worker type",n);return}else if(n.type==="progress"){this.zustand.set_progress(n);return}this.zustand.logger.error("WorkerManager: unknown message",n)}catch(n){console.error("WorkerManager: onmessage JSON.parse error",n,t);return}}setWorker(t){for(let n in this.workers)n!==t?.uuid&&this.workers[n].disconnect();t!==void 0&&(this.workers[t.uuid]=t,t.reconnect()),t?.uuid&&window.localStorage.setItem("funcnodes__active_worker",t?.uuid),this.zustand.worker!==void 0&&this.zustand.clear_all(),this.zustand.set_worker(t),this.on_setWorker(t)}async restart_worker(t){this.ws?.send(JSON.stringify({type:"restart_worker",workerid:t}))}calculateReconnectTimeout(){return Math.min(this.initialTimeout*Math.pow(2,this.reconnectAttempts),this.maxTimeout)}reconnect(){if(this.reconnectAttempts<this.maxReconnectAttempts){let t=this.calculateReconnectTimeout();this.zustand.logger.info(`Attempting to reconnect in ${t} ms`),setTimeout(()=>{this.ws&&this.ws.readyState===WebSocket.OPEN||(this.reconnectAttempts++,this.connect())},t)}else this.zustand.logger.warn("Maximum reconnect attempts reached. Giving up.")}onclose(){this.zustand.logger.warn("WorkerManager: onclose"),this.reconnect()}set_active(t){this.ws&&this.ws.send(JSON.stringify({type:"set_active",workerid:t}))}new_worker({name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}){t||(t=void 0),r||(r=!1),a||(a=!1),n||(n=void 0,r=!1,a=!1),this.ws&&this.ws.send(JSON.stringify({type:"new_worker",kwargs:{name:t,reference:n,copyLib:r,copyNS:a,in_venv:l}}))}remove(){for(let t in this.workers)this.workers[t].disconnect();this.connectionTimeout&&(clearTimeout(this.connectionTimeout),this.connectionTimeout=void 0),this.ws&&(this.ws.onclose=()=>{},this.ws.onerror=()=>{},this.ws.onmessage=()=>{},this.ws.onopen=()=>{},this.ws.close())}}const yo=()=>{const e=Wt();return e.worker?{...e.worker.api,worker:e.worker}:{node:void 0,group:void 0,edge:void 0,hooks:void 0,lib:void 0,worker:e.worker}},eae={id:"",debug:!1,useWorkerManager:!0,show_library:!0,header:{show:!0,showmenu:!0},flow:{minimap:!0,static:!1,minZoom:.1,maxZoom:5,allowFullScreen:!0,allowExpand:!0,showNodeSettings:!0},library:{show:!0}},Rj=["classic","metal","light","solarized","midnight","forest","scientific","neon","ocean","sunset"];function br(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=br(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var tae={value:()=>{}};function Qw(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Kw(n)}function Kw(e){this._=e}function nae(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",a=n.indexOf(".");if(a>=0&&(r=n.slice(a+1),n=n.slice(0,a)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Kw.prototype=Qw.prototype={constructor:Kw,on:function(e,t){var n=this._,r=nae(e+"",n),a,l=-1,u=r.length;if(arguments.length<2){for(;++l<u;)if((a=(e=r[l]).type)&&(a=rae(n[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<u;)if(a=(e=r[l]).type)n[a]=Oj(n[a],e.name,t);else if(t==null)for(a in n)n[a]=Oj(n[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Kw(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var n=new Array(a),r=0,a,l;r<a;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,a=l.length;r<a;++r)l[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],a=0,l=r.length;a<l;++a)r[a].value.apply(t,n)}};function rae(e,t){for(var n=0,r=e.length,a;n<r;++n)if((a=e[n]).name===t)return a.value}function Oj(e,t,n){for(var r=0,a=e.length;r<a;++r)if(e[r].name===t){e[r]=tae,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var qT="http://www.w3.org/1999/xhtml";const Mj={svg:"http://www.w3.org/2000/svg",xhtml:qT,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function e2(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Mj.hasOwnProperty(t)?{space:Mj[t],local:e}:e}function oae(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===qT&&t.documentElement.namespaceURI===qT?t.createElement(e):t.createElementNS(n,e)}}function aae(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Nj(e){var t=e2(e);return(t.local?aae:oae)(t)}function iae(){}function JT(e){return e==null?iae:function(){return this.querySelector(e)}}function lae(e){typeof e!="function"&&(e=JT(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=new Array(u),h,m,y=0;y<u;++y)(h=l[y])&&(m=e.call(h,h.__data__,y,l))&&("__data__"in h&&(m.__data__=h.__data__),d[y]=m);return new Pa(r,this._parents)}function sae(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function uae(){return[]}function Dj(e){return e==null?uae:function(){return this.querySelectorAll(e)}}function cae(e){return function(){return sae(e.apply(this,arguments))}}function fae(e){typeof e=="function"?e=cae(e):e=Dj(e);for(var t=this._groups,n=t.length,r=[],a=[],l=0;l<n;++l)for(var u=t[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&(r.push(e.call(h,h.__data__,m,u)),a.push(h));return new Pa(r,a)}function Ij(e){return function(){return this.matches(e)}}function zj(e){return function(t){return t.matches(e)}}var dae=Array.prototype.find;function hae(e){return function(){return dae.call(this.children,e)}}function pae(){return this.firstElementChild}function mae(e){return this.select(e==null?pae:hae(typeof e=="function"?e:zj(e)))}var gae=Array.prototype.filter;function yae(){return Array.from(this.children)}function vae(e){return function(){return gae.call(this.children,e)}}function bae(e){return this.selectAll(e==null?yae:vae(typeof e=="function"?e:zj(e)))}function xae(e){typeof e!="function"&&(e=Ij(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new Pa(r,this._parents)}function jj(e){return new Array(e.length)}function Sae(){return new Pa(this._enter||this._groups.map(jj),this._parents)}function t2(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}t2.prototype={constructor:t2,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function wae(e){return function(){return e}}function Eae(e,t,n,r,a,l){for(var u=0,d,h=t.length,m=l.length;u<m;++u)(d=t[u])?(d.__data__=l[u],r[u]=d):n[u]=new t2(e,l[u]);for(;u<h;++u)(d=t[u])&&(a[u]=d)}function Cae(e,t,n,r,a,l,u){var d,h,m=new Map,y=t.length,v=l.length,S=new Array(y),w;for(d=0;d<y;++d)(h=t[d])&&(S[d]=w=u.call(h,h.__data__,d,t)+"",m.has(w)?a[d]=h:m.set(w,h));for(d=0;d<v;++d)w=u.call(e,l[d],d,l)+"",(h=m.get(w))?(r[d]=h,h.__data__=l[d],m.delete(w)):n[d]=new t2(e,l[d]);for(d=0;d<y;++d)(h=t[d])&&m.get(S[d])===h&&(a[d]=h)}function _ae(e){return e.__data__}function Aae(e,t){if(!arguments.length)return Array.from(this,_ae);var n=t?Cae:Eae,r=this._parents,a=this._groups;typeof e!="function"&&(e=wae(e));for(var l=a.length,u=new Array(l),d=new Array(l),h=new Array(l),m=0;m<l;++m){var y=r[m],v=a[m],S=v.length,w=Tae(e.call(y,y&&y.__data__,m,r)),A=w.length,E=d[m]=new Array(A),k=u[m]=new Array(A),R=h[m]=new Array(S);n(y,v,E,k,R,w,t);for(var D=0,M=0,I,L;D<A;++D)if(I=E[D]){for(D>=M&&(M=D+1);!(L=k[M])&&++M<A;);I._next=L||null}}return u=new Pa(u,r),u._enter=d,u._exit=h,u}function Tae(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function kae(){return new Pa(this._exit||this._groups.map(jj),this._parents)}function Rae(e,t,n){var r=this.enter(),a=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),n==null?l.remove():n(l),r&&a?r.merge(a).order():a}function Oae(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,a=n.length,l=r.length,u=Math.min(a,l),d=new Array(a),h=0;h<u;++h)for(var m=n[h],y=r[h],v=m.length,S=d[h]=new Array(v),w,A=0;A<v;++A)(w=m[A]||y[A])&&(S[A]=w);for(;h<a;++h)d[h]=n[h];return new Pa(d,this._parents)}function Mae(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],a=r.length-1,l=r[a],u;--a>=0;)(u=r[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function Nae(e){e||(e=Dae);function t(v,S){return v&&S?e(v.__data__,S.__data__):!v-!S}for(var n=this._groups,r=n.length,a=new Array(r),l=0;l<r;++l){for(var u=n[l],d=u.length,h=a[l]=new Array(d),m,y=0;y<d;++y)(m=u[y])&&(h[y]=m);h.sort(t)}return new Pa(a,this._parents).order()}function Dae(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Iae(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function zae(){return Array.from(this)}function jae(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length;a<l;++a){var u=r[a];if(u)return u}return null}function Bae(){let e=0;for(const t of this)++e;return e}function Lae(){return!this.node()}function Pae(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var a=t[n],l=0,u=a.length,d;l<u;++l)(d=a[l])&&e.call(d,d.__data__,l,a);return this}function Hae(e){return function(){this.removeAttribute(e)}}function Vae(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fae(e,t){return function(){this.setAttribute(e,t)}}function Gae(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Uae(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function $ae(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Xae(e,t){var n=e2(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Vae:Hae:typeof t=="function"?n.local?$ae:Uae:n.local?Gae:Fae)(n,t))}function Bj(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Yae(e){return function(){this.style.removeProperty(e)}}function Zae(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Wae(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function qae(e,t,n){return arguments.length>1?this.each((t==null?Yae:typeof t=="function"?Wae:Zae)(e,t,n??"")):Dm(this.node(),e)}function Dm(e,t){return e.style.getPropertyValue(t)||Bj(e).getComputedStyle(e,null).getPropertyValue(t)}function Jae(e){return function(){delete this[e]}}function Qae(e,t){return function(){this[e]=t}}function Kae(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function eie(e,t){return arguments.length>1?this.each((t==null?Jae:typeof t=="function"?Kae:Qae)(e,t)):this.node()[e]}function Lj(e){return e.trim().split(/^|\s+/)}function QT(e){return e.classList||new Pj(e)}function Pj(e){this._node=e,this._names=Lj(e.getAttribute("class")||"")}Pj.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Hj(e,t){for(var n=QT(e),r=-1,a=t.length;++r<a;)n.add(t[r])}function Vj(e,t){for(var n=QT(e),r=-1,a=t.length;++r<a;)n.remove(t[r])}function tie(e){return function(){Hj(this,e)}}function nie(e){return function(){Vj(this,e)}}function rie(e,t){return function(){(t.apply(this,arguments)?Hj:Vj)(this,e)}}function oie(e,t){var n=Lj(e+"");if(arguments.length<2){for(var r=QT(this.node()),a=-1,l=n.length;++a<l;)if(!r.contains(n[a]))return!1;return!0}return this.each((typeof t=="function"?rie:t?tie:nie)(n,t))}function aie(){this.textContent=""}function iie(e){return function(){this.textContent=e}}function lie(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function sie(e){return arguments.length?this.each(e==null?aie:(typeof e=="function"?lie:iie)(e)):this.node().textContent}function uie(){this.innerHTML=""}function cie(e){return function(){this.innerHTML=e}}function fie(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function die(e){return arguments.length?this.each(e==null?uie:(typeof e=="function"?fie:cie)(e)):this.node().innerHTML}function hie(){this.nextSibling&&this.parentNode.appendChild(this)}function pie(){return this.each(hie)}function mie(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function gie(){return this.each(mie)}function yie(e){var t=typeof e=="function"?e:Nj(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function vie(){return null}function bie(e,t){var n=typeof e=="function"?e:Nj(e),r=t==null?vie:typeof t=="function"?t:JT(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function xie(){var e=this.parentNode;e&&e.removeChild(this)}function Sie(){return this.each(xie)}function wie(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Eie(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Cie(e){return this.select(e?Eie:wie)}function _ie(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Aie(e){return function(t){e.call(this,t,this.__data__)}}function Tie(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function kie(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,a=t.length,l;n<a;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function Rie(e,t,n){return function(){var r=this.__on,a,l=Aie(t);if(r){for(var u=0,d=r.length;u<d;++u)if((a=r[u]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=n),a.value=t;return}}this.addEventListener(e.type,l,n),a={type:e.type,name:e.name,value:t,listener:l,options:n},r?r.push(a):this.__on=[a]}}function Oie(e,t,n){var r=Tie(e+""),a,l=r.length,u;if(arguments.length<2){var d=this.node().__on;if(d){for(var h=0,m=d.length,y;h<m;++h)for(a=0,y=d[h];a<l;++a)if((u=r[a]).type===y.type&&u.name===y.name)return y.value}return}for(d=t?Rie:kie,a=0;a<l;++a)this.each(d(r[a],t,n));return this}function Fj(e,t,n){var r=Bj(e),a=r.CustomEvent;typeof a=="function"?a=new a(t,n):(a=r.document.createEvent("Event"),n?(a.initEvent(t,n.bubbles,n.cancelable),a.detail=n.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function Mie(e,t){return function(){return Fj(this,e,t)}}function Nie(e,t){return function(){return Fj(this,e,t.apply(this,arguments))}}function Die(e,t){return this.each((typeof t=="function"?Nie:Mie)(e,t))}function*Iie(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],a=0,l=r.length,u;a<l;++a)(u=r[a])&&(yield u)}var Gj=[null];function Pa(e,t){this._groups=e,this._parents=t}function pv(){return new Pa([[document.documentElement]],Gj)}function zie(){return this}Pa.prototype=pv.prototype={constructor:Pa,select:lae,selectAll:fae,selectChild:mae,selectChildren:bae,filter:xae,data:Aae,enter:Sae,exit:kae,join:Rae,merge:Oae,selection:zie,order:Mae,sort:Nae,call:Iae,nodes:zae,node:jae,size:Bae,empty:Lae,each:Pae,attr:Xae,style:qae,property:eie,classed:oie,text:sie,html:die,raise:pie,lower:gie,append:yie,insert:bie,remove:Sie,clone:Cie,datum:_ie,on:Oie,dispatch:Die,[Symbol.iterator]:Iie};function Ha(e){return typeof e=="string"?new Pa([[document.querySelector(e)]],[document.documentElement]):new Pa([[e]],Gj)}function jie(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _l(e,t){if(e=jie(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const Bie={passive:!1},mv={capture:!0,passive:!1};function KT(e){e.stopImmediatePropagation()}function Im(e){e.preventDefault(),e.stopImmediatePropagation()}function Uj(e){var t=e.document.documentElement,n=Ha(e).on("dragstart.drag",Im,mv);"onselectstart"in t?n.on("selectstart.drag",Im,mv):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function $j(e,t){var n=e.document.documentElement,r=Ha(e).on("dragstart.drag",null);t&&(r.on("click.drag",Im,mv),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const n2=e=>()=>e;function ek(e,{sourceEvent:t,subject:n,target:r,identifier:a,active:l,x:u,y:d,dx:h,dy:m,dispatch:y}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:d,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:y}})}ek.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Lie(e){return!e.ctrlKey&&!e.button}function Pie(){return this.parentNode}function Hie(e,t){return t??{x:e.x,y:e.y}}function Vie(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xj(){var e=Lie,t=Pie,n=Hie,r=Vie,a={},l=Qw("start","drag","end"),u=0,d,h,m,y,v=0;function S(I){I.on("mousedown.drag",w).filter(r).on("touchstart.drag",k).on("touchmove.drag",R,Bie).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function w(I,L){if(!(y||!e.call(this,I,L))){var P=M(this,t.call(this,I,L),I,L,"mouse");P&&(Ha(I.view).on("mousemove.drag",A,mv).on("mouseup.drag",E,mv),Uj(I.view),KT(I),m=!1,d=I.clientX,h=I.clientY,P("start",I))}}function A(I){if(Im(I),!m){var L=I.clientX-d,P=I.clientY-h;m=L*L+P*P>v}a.mouse("drag",I)}function E(I){Ha(I.view).on("mousemove.drag mouseup.drag",null),$j(I.view,m),Im(I),a.mouse("end",I)}function k(I,L){if(e.call(this,I,L)){var P=I.changedTouches,G=t.call(this,I,L),$=P.length,Z,j;for(Z=0;Z<$;++Z)(j=M(this,G,I,L,P[Z].identifier,P[Z]))&&(KT(I),j("start",I,P[Z]))}}function R(I){var L=I.changedTouches,P=L.length,G,$;for(G=0;G<P;++G)($=a[L[G].identifier])&&(Im(I),$("drag",I,L[G]))}function D(I){var L=I.changedTouches,P=L.length,G,$;for(y&&clearTimeout(y),y=setTimeout(function(){y=null},500),G=0;G<P;++G)($=a[L[G].identifier])&&(KT(I),$("end",I,L[G]))}function M(I,L,P,G,$,Z){var j=l.copy(),X=_l(Z||P,L),ee,ae,U;if((U=n.call(I,new ek("beforestart",{sourceEvent:P,target:S,identifier:$,active:u,x:X[0],y:X[1],dx:0,dy:0,dispatch:j}),G))!=null)return ee=U.x-X[0]||0,ae=U.y-X[1]||0,function te(V,W,Q){var ne=X,B;switch(V){case"start":a[$]=te,B=u++;break;case"end":delete a[$],--u;case"drag":X=_l(Q||W,L),B=u;break}j.call(V,I,new ek(V,{sourceEvent:W,subject:U,target:S,identifier:$,active:B,x:X[0]+ee,y:X[1]+ae,dx:X[0]-ne[0],dy:X[1]-ne[1],dispatch:j}),G)}}return S.filter=function(I){return arguments.length?(e=typeof I=="function"?I:n2(!!I),S):e},S.container=function(I){return arguments.length?(t=typeof I=="function"?I:n2(I),S):t},S.subject=function(I){return arguments.length?(n=typeof I=="function"?I:n2(I),S):n},S.touchable=function(I){return arguments.length?(r=typeof I=="function"?I:n2(!!I),S):r},S.on=function(){var I=l.on.apply(l,arguments);return I===l?S:I},S.clickDistance=function(I){return arguments.length?(v=(I=+I)*I,S):Math.sqrt(v)},S}function tk(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Yj(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function gv(){}var yv=.7,r2=1/yv,zm="\\s*([+-]?\\d+)\\s*",vv="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ts="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Fie=/^#([0-9a-f]{3,8})$/,Gie=new RegExp(`^rgb\\(${zm},${zm},${zm}\\)$`),Uie=new RegExp(`^rgb\\(${Ts},${Ts},${Ts}\\)$`),$ie=new RegExp(`^rgba\\(${zm},${zm},${zm},${vv}\\)$`),Xie=new RegExp(`^rgba\\(${Ts},${Ts},${Ts},${vv}\\)$`),Yie=new RegExp(`^hsl\\(${vv},${Ts},${Ts}\\)$`),Zie=new RegExp(`^hsla\\(${vv},${Ts},${Ts},${vv}\\)$`),Zj={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};tk(gv,oh,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wj,formatHex:Wj,formatHex8:Wie,formatHsl:qie,formatRgb:qj,toString:qj});function Wj(){return this.rgb().formatHex()}function Wie(){return this.rgb().formatHex8()}function qie(){return t9(this).formatHsl()}function qj(){return this.rgb().formatRgb()}function oh(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Fie.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Jj(t):n===3?new sa(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?o2(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?o2(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Gie.exec(e))?new sa(t[1],t[2],t[3],1):(t=Uie.exec(e))?new sa(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$ie.exec(e))?o2(t[1],t[2],t[3],t[4]):(t=Xie.exec(e))?o2(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Yie.exec(e))?e9(t[1],t[2]/100,t[3]/100,1):(t=Zie.exec(e))?e9(t[1],t[2]/100,t[3]/100,t[4]):Zj.hasOwnProperty(e)?Jj(Zj[e]):e==="transparent"?new sa(NaN,NaN,NaN,0):null}function Jj(e){return new sa(e>>16&255,e>>8&255,e&255,1)}function o2(e,t,n,r){return r<=0&&(e=t=n=NaN),new sa(e,t,n,r)}function Jie(e){return e instanceof gv||(e=oh(e)),e?(e=e.rgb(),new sa(e.r,e.g,e.b,e.opacity)):new sa}function nk(e,t,n,r){return arguments.length===1?Jie(e):new sa(e,t,n,r??1)}function sa(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tk(sa,nk,Yj(gv,{brighter(e){return e=e==null?r2:Math.pow(r2,e),new sa(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yv:Math.pow(yv,e),new sa(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new sa(ah(this.r),ah(this.g),ah(this.b),a2(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:Qj,formatHex:Qj,formatHex8:Qie,formatRgb:Kj,toString:Kj}));function Qj(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}`}function Qie(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}${ih((isNaN(this.opacity)?1:this.opacity)*255)}`}function Kj(){const e=a2(this.opacity);return`${e===1?"rgb(":"rgba("}${ah(this.r)}, ${ah(this.g)}, ${ah(this.b)}${e===1?")":`, ${e})`}`}function a2(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ah(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ih(e){return e=ah(e),(e<16?"0":"")+e.toString(16)}function e9(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Al(e,t,n,r)}function t9(e){if(e instanceof Al)return new Al(e.h,e.s,e.l,e.opacity);if(e instanceof gv||(e=oh(e)),!e)return new Al;if(e instanceof Al)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),l=Math.max(t,n,r),u=NaN,d=l-a,h=(l+a)/2;return d?(t===l?u=(n-r)/d+(n<r)*6:n===l?u=(r-t)/d+2:u=(t-n)/d+4,d/=h<.5?l+a:2-l-a,u*=60):d=h>0&&h<1?0:u,new Al(u,d,h,e.opacity)}function Kie(e,t,n,r){return arguments.length===1?t9(e):new Al(e,t,n,r??1)}function Al(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}tk(Al,Kie,Yj(gv,{brighter(e){return e=e==null?r2:Math.pow(r2,e),new Al(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yv:Math.pow(yv,e),new Al(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new sa(rk(e>=240?e-240:e+120,a,r),rk(e,a,r),rk(e<120?e+240:e-120,a,r),this.opacity)},clamp(){return new Al(n9(this.h),i2(this.s),i2(this.l),a2(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 e=a2(this.opacity);return`${e===1?"hsl(":"hsla("}${n9(this.h)}, ${i2(this.s)*100}%, ${i2(this.l)*100}%${e===1?")":`, ${e})`}`}}));function n9(e){return e=(e||0)%360,e<0?e+360:e}function i2(e){return Math.max(0,Math.min(1,e||0))}function rk(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const ok=e=>()=>e;function ele(e,t){return function(n){return e+n*t}}function tle(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function nle(e){return(e=+e)==1?r9:function(t,n){return n-t?tle(t,n,e):ok(isNaN(t)?n:t)}}function r9(e,t){var n=t-e;return n?ele(e,n):ok(isNaN(e)?t:e)}const l2=function e(t){var n=nle(t);function r(a,l){var u=n((a=nk(a)).r,(l=nk(l)).r),d=n(a.g,l.g),h=n(a.b,l.b),m=r9(a.opacity,l.opacity);return function(y){return a.r=u(y),a.g=d(y),a.b=h(y),a.opacity=m(y),a+""}}return r.gamma=e,r}(1);function rle(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),a;return function(l){for(a=0;a<n;++a)r[a]=e[a]*(1-l)+t[a]*l;return r}}function ole(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ale(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,a=new Array(r),l=new Array(n),u;for(u=0;u<r;++u)a[u]=bv(e[u],t[u]);for(;u<n;++u)l[u]=t[u];return function(d){for(u=0;u<r;++u)l[u]=a[u](d);return l}}function ile(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ks(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function lle(e,t){var n={},r={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?n[a]=bv(e[a],t[a]):r[a]=t[a];return function(l){for(a in n)r[a]=n[a](l);return r}}var ak=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ik=new RegExp(ak.source,"g");function sle(e){return function(){return e}}function ule(e){return function(t){return e(t)+""}}function o9(e,t){var n=ak.lastIndex=ik.lastIndex=0,r,a,l,u=-1,d=[],h=[];for(e=e+"",t=t+"";(r=ak.exec(e))&&(a=ik.exec(t));)(l=a.index)>n&&(l=t.slice(n,l),d[u]?d[u]+=l:d[++u]=l),(r=r[0])===(a=a[0])?d[u]?d[u]+=a:d[++u]=a:(d[++u]=null,h.push({i:u,x:ks(r,a)})),n=ik.lastIndex;return n<t.length&&(l=t.slice(n),d[u]?d[u]+=l:d[++u]=l),d.length<2?h[0]?ule(h[0].x):sle(t):(t=h.length,function(m){for(var y=0,v;y<t;++y)d[(v=h[y]).i]=v.x(m);return d.join("")})}function bv(e,t){var n=typeof t,r;return t==null||n==="boolean"?ok(t):(n==="number"?ks:n==="string"?(r=oh(t))?(t=r,l2):o9:t instanceof oh?l2:t instanceof Date?ile:ole(t)?rle:Array.isArray(t)?ale:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?lle:ks)(e,t)}var a9=180/Math.PI,lk={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function i9(e,t,n,r,a,l){var u,d,h;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(h=e*n+t*r)&&(n-=e*h,r-=t*h),(d=Math.sqrt(n*n+r*r))&&(n/=d,r/=d,h/=d),e*r<t*n&&(e=-e,t=-t,h=-h,u=-u),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*a9,skewX:Math.atan(h)*a9,scaleX:u,scaleY:d}}var s2;function cle(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?lk:i9(t.a,t.b,t.c,t.d,t.e,t.f)}function fle(e){return e==null||(s2||(s2=document.createElementNS("http://www.w3.org/2000/svg","g")),s2.setAttribute("transform",e),!(e=s2.transform.baseVal.consolidate()))?lk:(e=e.matrix,i9(e.a,e.b,e.c,e.d,e.e,e.f))}function l9(e,t,n,r){function a(m){return m.length?m.pop()+" ":""}function l(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push("translate(",null,t,null,n);A.push({i:E-4,x:ks(m,v)},{i:E-2,x:ks(y,S)})}else(v||S)&&w.push("translate("+v+t+S+n)}function u(m,y,v,S){m!==y?(m-y>180?y+=360:y-m>180&&(m+=360),S.push({i:v.push(a(v)+"rotate(",null,r)-2,x:ks(m,y)})):y&&v.push(a(v)+"rotate("+y+r)}function d(m,y,v,S){m!==y?S.push({i:v.push(a(v)+"skewX(",null,r)-2,x:ks(m,y)}):y&&v.push(a(v)+"skewX("+y+r)}function h(m,y,v,S,w,A){if(m!==v||y!==S){var E=w.push(a(w)+"scale(",null,",",null,")");A.push({i:E-4,x:ks(m,v)},{i:E-2,x:ks(y,S)})}else(v!==1||S!==1)&&w.push(a(w)+"scale("+v+","+S+")")}return function(m,y){var v=[],S=[];return m=e(m),y=e(y),l(m.translateX,m.translateY,y.translateX,y.translateY,v,S),u(m.rotate,y.rotate,v,S),d(m.skewX,y.skewX,v,S),h(m.scaleX,m.scaleY,y.scaleX,y.scaleY,v,S),m=y=null,function(w){for(var A=-1,E=S.length,k;++A<E;)v[(k=S[A]).i]=k.x(w);return v.join("")}}}var dle=l9(cle,"px, ","px)","deg)"),hle=l9(fle,", ",")",")"),ple=1e-12;function s9(e){return((e=Math.exp(e))+1/e)/2}function mle(e){return((e=Math.exp(e))-1/e)/2}function gle(e){return((e=Math.exp(2*e))-1)/(e+1)}const u2=function e(t,n,r){function a(l,u){var d=l[0],h=l[1],m=l[2],y=u[0],v=u[1],S=u[2],w=y-d,A=v-h,E=w*w+A*A,k,R;if(E<ple)R=Math.log(S/m)/t,k=function(G){return[d+G*w,h+G*A,m*Math.exp(t*G*R)]};else{var D=Math.sqrt(E),M=(S*S-m*m+r*E)/(2*m*n*D),I=(S*S-m*m-r*E)/(2*S*n*D),L=Math.log(Math.sqrt(M*M+1)-M),P=Math.log(Math.sqrt(I*I+1)-I);R=(P-L)/t,k=function(G){var $=G*R,Z=s9(L),j=m/(n*D)*(Z*gle(t*$+L)-mle(L));return[d+j*w,h+j*A,m*Z/s9(t*$+L)]}}return k.duration=R*1e3*t/Math.SQRT2,k}return a.rho=function(l){var u=Math.max(.001,+l),d=u*u,h=d*d;return e(u,d,h)},a}(Math.SQRT2,2,4);var jm=0,xv=0,Sv=0,u9=1e3,c2,wv,f2=0,lh=0,d2=0,Ev=typeof performance=="object"&&performance.now?performance:Date,c9=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function sk(){return lh||(c9(yle),lh=Ev.now()+d2)}function yle(){lh=0}function h2(){this._call=this._time=this._next=null}h2.prototype=f9.prototype={constructor:h2,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?sk():+n)+(t==null?0:+t),!this._next&&wv!==this&&(wv?wv._next=this:c2=this,wv=this),this._call=e,this._time=n,uk()},stop:function(){this._call&&(this._call=null,this._time=1/0,uk())}};function f9(e,t,n){var r=new h2;return r.restart(e,t,n),r}function vle(){sk(),++jm;for(var e=c2,t;e;)(t=lh-e._time)>=0&&e._call.call(void 0,t),e=e._next;--jm}function d9(){lh=(f2=Ev.now())+d2,jm=xv=0;try{vle()}finally{jm=0,xle(),lh=0}}function ble(){var e=Ev.now(),t=e-f2;t>u9&&(d2-=t,f2=e)}function xle(){for(var e,t=c2,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:c2=n);wv=e,uk(r)}function uk(e){if(!jm){xv&&(xv=clearTimeout(xv));var t=e-lh;t>24?(e<1/0&&(xv=setTimeout(d9,e-Ev.now()-d2)),Sv&&(Sv=clearInterval(Sv))):(Sv||(f2=Ev.now(),Sv=setInterval(ble,u9)),jm=1,c9(d9))}}function h9(e,t,n){var r=new h2;return t=t==null?0:+t,r.restart(a=>{r.stop(),e(a+t)},t,n),r}var Sle=Qw("start","end","cancel","interrupt"),wle=[],p9=0,m9=1,ck=2,p2=3,g9=4,fk=5,m2=6;function g2(e,t,n,r,a,l){var u=e.__transition;if(!u)e.__transition={};else if(n in u)return;Ele(e,n,{name:t,index:r,group:a,on:Sle,tween:wle,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:p9})}function dk(e,t){var n=Tl(e,t);if(n.state>p9)throw new Error("too late; already scheduled");return n}function Rs(e,t){var n=Tl(e,t);if(n.state>p2)throw new Error("too late; already running");return n}function Tl(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ele(e,t,n){var r=e.__transition,a;r[t]=n,n.timer=f9(l,0,n.time);function l(m){n.state=m9,n.timer.restart(u,n.delay,n.time),n.delay<=m&&u(m-n.delay)}function u(m){var y,v,S,w;if(n.state!==m9)return h();for(y in r)if(w=r[y],w.name===n.name){if(w.state===p2)return h9(u);w.state===g9?(w.state=m2,w.timer.stop(),w.on.call("interrupt",e,e.__data__,w.index,w.group),delete r[y]):+y<t&&(w.state=m2,w.timer.stop(),w.on.call("cancel",e,e.__data__,w.index,w.group),delete r[y])}if(h9(function(){n.state===p2&&(n.state=g9,n.timer.restart(d,n.delay,n.time),d(m))}),n.state=ck,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ck){for(n.state=p2,a=new Array(S=n.tween.length),y=0,v=-1;y<S;++y)(w=n.tween[y].value.call(e,e.__data__,n.index,n.group))&&(a[++v]=w);a.length=v+1}}function d(m){for(var y=m<n.duration?n.ease.call(null,m/n.duration):(n.timer.restart(h),n.state=fk,1),v=-1,S=a.length;++v<S;)a[v].call(e,y);n.state===fk&&(n.on.call("end",e,e.__data__,n.index,n.group),h())}function h(){n.state=m2,n.timer.stop(),delete r[t];for(var m in r)return;delete e.__transition}}function y2(e,t){var n=e.__transition,r,a,l=!0,u;if(n){t=t==null?null:t+"";for(u in n){if((r=n[u]).name!==t){l=!1;continue}a=r.state>ck&&r.state<fk,r.state=m2,r.timer.stop(),r.on.call(a?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[u]}l&&delete e.__transition}}function Cle(e){return this.each(function(){y2(this,e)})}function _le(e,t){var n,r;return function(){var a=Rs(this,e),l=a.tween;if(l!==n){r=n=l;for(var u=0,d=r.length;u<d;++u)if(r[u].name===t){r=r.slice(),r.splice(u,1);break}}a.tween=r}}function Ale(e,t,n){var r,a;if(typeof n!="function")throw new Error;return function(){var l=Rs(this,e),u=l.tween;if(u!==r){a=(r=u).slice();for(var d={name:t,value:n},h=0,m=a.length;h<m;++h)if(a[h].name===t){a[h]=d;break}h===m&&a.push(d)}l.tween=a}}function Tle(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Tl(this.node(),n).tween,a=0,l=r.length,u;a<l;++a)if((u=r[a]).name===e)return u.value;return null}return this.each((t==null?_le:Ale)(n,e,t))}function hk(e,t,n){var r=e._id;return e.each(function(){var a=Rs(this,r);(a.value||(a.value={}))[t]=n.apply(this,arguments)}),function(a){return Tl(a,r).value[t]}}function y9(e,t){var n;return(typeof t=="number"?ks:t instanceof oh?l2:(n=oh(t))?(t=n,l2):o9)(e,t)}function kle(e){return function(){this.removeAttribute(e)}}function Rle(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ole(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttribute(e);return u===a?null:u===r?l:l=t(r=u,n)}}function Mle(e,t,n){var r,a=n+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===a?null:u===r?l:l=t(r=u,n)}}function Nle(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function Dle(e,t,n){var r,a,l;return function(){var u,d=n(this),h;return d==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=d+"",u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d)))}}function Ile(e,t){var n=e2(e),r=n==="transform"?hle:y9;return this.attrTween(e,typeof t=="function"?(n.local?Dle:Nle)(n,r,hk(this,"attr."+e,t)):t==null?(n.local?Rle:kle)(n):(n.local?Mle:Ole)(n,r,t))}function zle(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jle(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ble(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&jle(e,l)),n}return a._value=t,a}function Lle(e,t){var n,r;function a(){var l=t.apply(this,arguments);return l!==r&&(n=(r=l)&&zle(e,l)),n}return a._value=t,a}function Ple(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=e2(e);return this.tween(n,(r.local?Ble:Lle)(r,t))}function Hle(e,t){return function(){dk(this,e).delay=+t.apply(this,arguments)}}function Vle(e,t){return t=+t,function(){dk(this,e).delay=t}}function Fle(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hle:Vle)(t,e)):Tl(this.node(),t).delay}function Gle(e,t){return function(){Rs(this,e).duration=+t.apply(this,arguments)}}function Ule(e,t){return t=+t,function(){Rs(this,e).duration=t}}function $le(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Gle:Ule)(t,e)):Tl(this.node(),t).duration}function Xle(e,t){if(typeof t!="function")throw new Error;return function(){Rs(this,e).ease=t}}function Yle(e){var t=this._id;return arguments.length?this.each(Xle(t,e)):Tl(this.node(),t).ease}function Zle(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Rs(this,e).ease=n}}function Wle(e){if(typeof e!="function")throw new Error;return this.each(Zle(this._id,e))}function qle(e){typeof e!="function"&&(e=Ij(e));for(var t=this._groups,n=t.length,r=new Array(n),a=0;a<n;++a)for(var l=t[a],u=l.length,d=r[a]=[],h,m=0;m<u;++m)(h=l[m])&&e.call(h,h.__data__,m,l)&&d.push(h);return new Fu(r,this._parents,this._name,this._id)}function Jle(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,a=n.length,l=Math.min(r,a),u=new Array(r),d=0;d<l;++d)for(var h=t[d],m=n[d],y=h.length,v=u[d]=new Array(y),S,w=0;w<y;++w)(S=h[w]||m[w])&&(v[w]=S);for(;d<r;++d)u[d]=t[d];return new Fu(u,this._parents,this._name,this._id)}function Qle(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Kle(e,t,n){var r,a,l=Qle(t)?dk:Rs;return function(){var u=l(this,e),d=u.on;d!==r&&(a=(r=d).copy()).on(t,n),u.on=a}}function ese(e,t){var n=this._id;return arguments.length<2?Tl(this.node(),n).on.on(e):this.each(Kle(n,e,t))}function tse(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function nse(){return this.on("end.remove",tse(this._id))}function rse(e){var t=this._name,n=this._id;typeof e!="function"&&(e=JT(e));for(var r=this._groups,a=r.length,l=new Array(a),u=0;u<a;++u)for(var d=r[u],h=d.length,m=l[u]=new Array(h),y,v,S=0;S<h;++S)(y=d[S])&&(v=e.call(y,y.__data__,S,d))&&("__data__"in y&&(v.__data__=y.__data__),m[S]=v,g2(m[S],t,n,S,m,Tl(y,n)));return new Fu(l,this._parents,t,n)}function ose(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Dj(e));for(var r=this._groups,a=r.length,l=[],u=[],d=0;d<a;++d)for(var h=r[d],m=h.length,y,v=0;v<m;++v)if(y=h[v]){for(var S=e.call(y,y.__data__,v,h),w,A=Tl(y,n),E=0,k=S.length;E<k;++E)(w=S[E])&&g2(w,t,n,E,S,A);l.push(S),u.push(y)}return new Fu(l,u,t,n)}var ase=pv.prototype.constructor;function ise(){return new ase(this._groups,this._parents)}function lse(e,t){var n,r,a;return function(){var l=Dm(this,e),u=(this.style.removeProperty(e),Dm(this,e));return l===u?null:l===n&&u===r?a:a=t(n=l,r=u)}}function v9(e){return function(){this.style.removeProperty(e)}}function sse(e,t,n){var r,a=n+"",l;return function(){var u=Dm(this,e);return u===a?null:u===r?l:l=t(r=u,n)}}function use(e,t,n){var r,a,l;return function(){var u=Dm(this,e),d=n(this),h=d+"";return d==null&&(h=d=(this.style.removeProperty(e),Dm(this,e))),u===h?null:u===r&&h===a?l:(a=h,l=t(r=u,d))}}function cse(e,t){var n,r,a,l="style."+t,u="end."+l,d;return function(){var h=Rs(this,e),m=h.on,y=h.value[l]==null?d||(d=v9(t)):void 0;(m!==n||a!==y)&&(r=(n=m).copy()).on(u,a=y),h.on=r}}function fse(e,t,n){var r=(e+="")=="transform"?dle:y9;return t==null?this.styleTween(e,lse(e,r)).on("end.style."+e,v9(e)):typeof t=="function"?this.styleTween(e,use(e,r,hk(this,"style."+e,t))).each(cse(this._id,e)):this.styleTween(e,sse(e,r,t),n).on("end.style."+e,null)}function dse(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function hse(e,t,n){var r,a;function l(){var u=t.apply(this,arguments);return u!==a&&(r=(a=u)&&dse(e,u,n)),r}return l._value=t,l}function pse(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,hse(e,t,n??""))}function mse(e){return function(){this.textContent=e}}function gse(e){return function(){var t=e(this);this.textContent=t??""}}function yse(e){return this.tween("text",typeof e=="function"?gse(hk(this,"text",e)):mse(e==null?"":e+""))}function vse(e){return function(t){this.textContent=e.call(this,t)}}function bse(e){var t,n;function r(){var a=e.apply(this,arguments);return a!==n&&(t=(n=a)&&vse(a)),t}return r._value=e,r}function xse(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,bse(e))}function Sse(){for(var e=this._name,t=this._id,n=b9(),r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)if(h=u[m]){var y=Tl(h,t);g2(h,e,n,m,u,{time:y.time+y.delay+y.duration,delay:0,duration:y.duration,ease:y.ease})}return new Fu(r,this._parents,e,n)}function wse(){var e,t,n=this,r=n._id,a=n.size();return new Promise(function(l,u){var d={value:u},h={value:function(){--a===0&&l()}};n.each(function(){var m=Rs(this,r),y=m.on;y!==e&&(t=(e=y).copy(),t._.cancel.push(d),t._.interrupt.push(d),t._.end.push(h)),m.on=t}),a===0&&l()})}var Ese=0;function Fu(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function b9(){return++Ese}var Gu=pv.prototype;Fu.prototype={constructor:Fu,select:rse,selectAll:ose,selectChild:Gu.selectChild,selectChildren:Gu.selectChildren,filter:qle,merge:Jle,selection:ise,transition:Sse,call:Gu.call,nodes:Gu.nodes,node:Gu.node,size:Gu.size,empty:Gu.empty,each:Gu.each,on:ese,attr:Ile,attrTween:Ple,style:fse,styleTween:pse,text:yse,textTween:xse,remove:nse,tween:Tle,delay:Fle,duration:$le,ease:Yle,easeVarying:Wle,end:wse,[Symbol.iterator]:Gu[Symbol.iterator]};function Cse(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var _se={time:null,delay:0,duration:250,ease:Cse};function Ase(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Tse(e){var t,n;e instanceof Fu?(t=e._id,e=e._name):(t=b9(),(n=_se).time=sk(),e=e==null?null:e+"");for(var r=this._groups,a=r.length,l=0;l<a;++l)for(var u=r[l],d=u.length,h,m=0;m<d;++m)(h=u[m])&&g2(h,e,t,m,u,n||Ase(h,t));return new Fu(r,this._parents,e,t)}pv.prototype.interrupt=Cle,pv.prototype.transition=Tse;const v2=e=>()=>e;function kse(e,{sourceEvent:t,target:n,transform:r,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:a}})}function Uu(e,t,n){this.k=e,this.x=t,this.y=n}Uu.prototype={constructor:Uu,scale:function(e){return e===1?this:new Uu(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Uu(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var b2=new Uu(1,0,0);x9.prototype=Uu.prototype;function x9(e){for(;!e.__zoom;)if(!(e=e.parentNode))return b2;return e.__zoom}function pk(e){e.stopImmediatePropagation()}function Cv(e){e.preventDefault(),e.stopImmediatePropagation()}function Rse(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ose(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function S9(){return this.__zoom||b2}function Mse(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Nse(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dse(e,t,n){var r=e.invertX(t[0][0])-n[0][0],a=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],u=e.invertY(t[1][1])-n[1][1];return e.translate(a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function w9(){var e=Rse,t=Ose,n=Dse,r=Mse,a=Nse,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],d=250,h=u2,m=Qw("start","zoom","end"),y,v,S,w=500,A=150,E=0,k=10;function R(U){U.property("__zoom",S9).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",j).filter(a).on("touchstart.zoom",X).on("touchmove.zoom",ee).on("touchend.zoom touchcancel.zoom",ae).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}R.transform=function(U,te,V,W){var Q=U.selection?U.selection():U;Q.property("__zoom",S9),U!==Q?L(U,te,V,W):Q.interrupt().each(function(){P(this,arguments).event(W).start().zoom(null,typeof te=="function"?te.apply(this,arguments):te).end()})},R.scaleBy=function(U,te,V,W){R.scaleTo(U,function(){var Q=this.__zoom.k,ne=typeof te=="function"?te.apply(this,arguments):te;return Q*ne},V,W)},R.scaleTo=function(U,te,V,W){R.transform(U,function(){var Q=t.apply(this,arguments),ne=this.__zoom,B=V==null?I(Q):typeof V=="function"?V.apply(this,arguments):V,oe=ne.invert(B),se=typeof te=="function"?te.apply(this,arguments):te;return n(M(D(ne,se),B,oe),Q,u)},V,W)},R.translateBy=function(U,te,V,W){R.transform(U,function(){return n(this.__zoom.translate(typeof te=="function"?te.apply(this,arguments):te,typeof V=="function"?V.apply(this,arguments):V),t.apply(this,arguments),u)},null,W)},R.translateTo=function(U,te,V,W,Q){R.transform(U,function(){var ne=t.apply(this,arguments),B=this.__zoom,oe=W==null?I(ne):typeof W=="function"?W.apply(this,arguments):W;return n(b2.translate(oe[0],oe[1]).scale(B.k).translate(typeof te=="function"?-te.apply(this,arguments):-te,typeof V=="function"?-V.apply(this,arguments):-V),ne,u)},W,Q)};function D(U,te){return te=Math.max(l[0],Math.min(l[1],te)),te===U.k?U:new Uu(te,U.x,U.y)}function M(U,te,V){var W=te[0]-V[0]*U.k,Q=te[1]-V[1]*U.k;return W===U.x&&Q===U.y?U:new Uu(U.k,W,Q)}function I(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function L(U,te,V,W){U.on("start.zoom",function(){P(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(W).end()}).tween("zoom",function(){var Q=this,ne=arguments,B=P(Q,ne).event(W),oe=t.apply(Q,ne),se=V==null?I(oe):typeof V=="function"?V.apply(Q,ne):V,Y=Math.max(oe[1][0]-oe[0][0],oe[1][1]-oe[0][1]),he=Q.__zoom,ke=typeof te=="function"?te.apply(Q,ne):te,me=h(he.invert(se).concat(Y/he.k),ke.invert(se).concat(Y/ke.k));return function(Ee){if(Ee===1)Ee=ke;else{var xe=me(Ee),Be=Y/xe[2];Ee=new Uu(Be,se[0]-xe[0]*Be,se[1]-xe[1]*Be)}B.zoom(null,Ee)}})}function P(U,te,V){return!V&&U.__zooming||new G(U,te)}function G(U,te){this.that=U,this.args=te,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,te),this.taps=0}G.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,te){return this.mouse&&U!=="mouse"&&(this.mouse[1]=te.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=te.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=te.invert(this.touch1[0])),this.that.__zoom=te,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var te=Ha(this.that).datum();m.call(U,this.that,new kse(U,{sourceEvent:this.sourceEvent,target:R,transform:this.that.__zoom,dispatch:m}),te)}};function $(U,...te){if(!e.apply(this,arguments))return;var V=P(this,te).event(U),W=this.__zoom,Q=Math.max(l[0],Math.min(l[1],W.k*Math.pow(2,r.apply(this,arguments)))),ne=_l(U);if(V.wheel)(V.mouse[0][0]!==ne[0]||V.mouse[0][1]!==ne[1])&&(V.mouse[1]=W.invert(V.mouse[0]=ne)),clearTimeout(V.wheel);else{if(W.k===Q)return;V.mouse=[ne,W.invert(ne)],y2(this),V.start()}Cv(U),V.wheel=setTimeout(B,A),V.zoom("mouse",n(M(D(W,Q),V.mouse[0],V.mouse[1]),V.extent,u));function B(){V.wheel=null,V.end()}}function Z(U,...te){if(S||!e.apply(this,arguments))return;var V=U.currentTarget,W=P(this,te,!0).event(U),Q=Ha(U.view).on("mousemove.zoom",se,!0).on("mouseup.zoom",Y,!0),ne=_l(U,V),B=U.clientX,oe=U.clientY;Uj(U.view),pk(U),W.mouse=[ne,this.__zoom.invert(ne)],y2(this),W.start();function se(he){if(Cv(he),!W.moved){var ke=he.clientX-B,me=he.clientY-oe;W.moved=ke*ke+me*me>E}W.event(he).zoom("mouse",n(M(W.that.__zoom,W.mouse[0]=_l(he,V),W.mouse[1]),W.extent,u))}function Y(he){Q.on("mousemove.zoom mouseup.zoom",null),$j(he.view,W.moved),Cv(he),W.event(he).end()}}function j(U,...te){if(e.apply(this,arguments)){var V=this.__zoom,W=_l(U.changedTouches?U.changedTouches[0]:U,this),Q=V.invert(W),ne=V.k*(U.shiftKey?.5:2),B=n(M(D(V,ne),W,Q),t.apply(this,te),u);Cv(U),d>0?Ha(this).transition().duration(d).call(L,B,W,U):Ha(this).call(R.transform,B,W,U)}}function X(U,...te){if(e.apply(this,arguments)){var V=U.touches,W=V.length,Q=P(this,te,U.changedTouches.length===W).event(U),ne,B,oe,se;for(pk(U),B=0;B<W;++B)oe=V[B],se=_l(oe,this),se=[se,this.__zoom.invert(se),oe.identifier],Q.touch0?!Q.touch1&&Q.touch0[2]!==se[2]&&(Q.touch1=se,Q.taps=0):(Q.touch0=se,ne=!0,Q.taps=1+!!y);y&&(y=clearTimeout(y)),ne&&(Q.taps<2&&(v=se[0],y=setTimeout(function(){y=null},w)),y2(this),Q.start())}}function ee(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,Q=W.length,ne,B,oe,se;for(Cv(U),ne=0;ne<Q;++ne)B=W[ne],oe=_l(B,this),V.touch0&&V.touch0[2]===B.identifier?V.touch0[0]=oe:V.touch1&&V.touch1[2]===B.identifier&&(V.touch1[0]=oe);if(B=V.that.__zoom,V.touch1){var Y=V.touch0[0],he=V.touch0[1],ke=V.touch1[0],me=V.touch1[1],Ee=(Ee=ke[0]-Y[0])*Ee+(Ee=ke[1]-Y[1])*Ee,xe=(xe=me[0]-he[0])*xe+(xe=me[1]-he[1])*xe;B=D(B,Math.sqrt(Ee/xe)),oe=[(Y[0]+ke[0])/2,(Y[1]+ke[1])/2],se=[(he[0]+me[0])/2,(he[1]+me[1])/2]}else if(V.touch0)oe=V.touch0[0],se=V.touch0[1];else return;V.zoom("touch",n(M(B,oe,se),V.extent,u))}}function ae(U,...te){if(this.__zooming){var V=P(this,te).event(U),W=U.changedTouches,Q=W.length,ne,B;for(pk(U),S&&clearTimeout(S),S=setTimeout(function(){S=null},w),ne=0;ne<Q;++ne)B=W[ne],V.touch0&&V.touch0[2]===B.identifier?delete V.touch0:V.touch1&&V.touch1[2]===B.identifier&&delete V.touch1;if(V.touch1&&!V.touch0&&(V.touch0=V.touch1,delete V.touch1),V.touch0)V.touch0[1]=this.__zoom.invert(V.touch0[0]);else if(V.end(),V.taps===2&&(B=_l(B,this),Math.hypot(v[0]-B[0],v[1]-B[1])<k)){var oe=Ha(this).on("dblclick.zoom");oe&&oe.apply(this,arguments)}}}return R.wheelDelta=function(U){return arguments.length?(r=typeof U=="function"?U:v2(+U),R):r},R.filter=function(U){return arguments.length?(e=typeof U=="function"?U:v2(!!U),R):e},R.touchable=function(U){return arguments.length?(a=typeof U=="function"?U:v2(!!U),R):a},R.extent=function(U){return arguments.length?(t=typeof U=="function"?U:v2([[+U[0][0],+U[0][1]],[+U[1][0],+U[1][1]]]),R):t},R.scaleExtent=function(U){return arguments.length?(l[0]=+U[0],l[1]=+U[1],R):[l[0],l[1]]},R.translateExtent=function(U){return arguments.length?(u[0][0]=+U[0][0],u[1][0]=+U[1][0],u[0][1]=+U[0][1],u[1][1]=+U[1][1],R):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},R.constrain=function(U){return arguments.length?(n=U,R):n},R.duration=function(U){return arguments.length?(d=+U,R):d},R.interpolate=function(U){return arguments.length?(h=U,R):h},R.on=function(){var U=m.on.apply(m,arguments);return U===m?R:U},R.clickDistance=function(U){return arguments.length?(E=(U=+U)*U,R):Math.sqrt(E)},R.tapDistance=function(U){return arguments.length?(k=+U,R):k},R}const Va={error001:()=>"[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:e=>`Node type "${e}" 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:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/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."},_v=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],E9=["Enter"," ","Escape"],C9={"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:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"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 Bm;(function(e){e.Strict="strict",e.Loose="loose"})(Bm||(Bm={}));var sh;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(sh||(sh={}));var Av;(function(e){e.Partial="partial",e.Full="full"})(Av||(Av={}));const _9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var xf;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xf||(xf={}));var x2;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(x2||(x2={}));var it;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(it||(it={}));const A9={[it.Left]:it.Right,[it.Right]:it.Left,[it.Top]:it.Bottom,[it.Bottom]:it.Top};function T9(e){return e===null?null:e?"valid":"invalid"}const k9=e=>"id"in e&&"source"in e&&"target"in e,Ise=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),mk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Tv=(e,t=[0,0])=>{const{width:n,height:r}=$u(e),a=e.origin??t,l=n*a[0],u=r*a[1];return{x:e.position.x-l,y:e.position.y-u}},zse=(e,t={nodeOrigin:[0,0]})=>{if(process.env.NODE_ENV==="development"&&!t.nodeLookup&&console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):mk(a)?a:t.nodeLookup.get(a.id));const d=u?E2(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return S2(r,d)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return w2(n)},kv=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const a=E2(r);n=S2(n,a)}}),w2(n)},gk=(e,t,[n,r,a]=[0,0,1],l=!1,u=!1)=>{const d={...Ov(t,[n,r,a]),width:t.width/a,height:t.height/a},h=[];for(const m of e.values()){const{measured:y,selectable:v=!0,hidden:S=!1}=m;if(u&&!v||S)continue;const w=y.width??m.width??m.initialWidth??null,A=y.height??m.height??m.initialHeight??null,E=Rv(d,Pm(m)),k=(w??0)*(A??0),R=l&&E>0;(!m.internals.handleBounds||R||E>=k||m.dragging)&&h.push(m)}return h},jse=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Bse(e,t){const n=new Map,r=t?.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&(t?.includeHiddenNodes||!a.hidden)&&(!r||r.has(a.id))&&n.set(a.id,a)}),n}async function Lse({nodes:e,width:t,height:n,panZoom:r,minZoom:a,maxZoom:l},u){if(e.size===0)return Promise.resolve(!0);const d=Bse(e,u),h=kv(d),m=vk(h,t,n,u?.minZoom??a,u?.maxZoom??l,u?.padding??.1);return await r.setViewport(m,{duration:u?.duration,ease:u?.ease,interpolate:u?.interpolate}),Promise.resolve(!0)}function R9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:a,onError:l}){const u=n.get(e),d=u.parentId?n.get(u.parentId):void 0,{x:h,y:m}=d?d.internals.positionAbsolute:{x:0,y:0},y=u.origin??r;let v=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!d)l?.("005",Va.error005());else{const w=d.measured.width,A=d.measured.height;w&&A&&(v=[[h,m],[h+w,m+A]])}else d&&Vm(u.extent)&&(v=[[u.extent[0][0]+h,u.extent[0][1]+m],[u.extent[1][0]+h,u.extent[1][1]+m]]);const S=Vm(v)?uh(t,v,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&l?.("015",Va.error015()),{position:{x:S.x-h+(u.measured.width??0)*y[0],y:S.y-m+(u.measured.height??0)*y[1]},positionAbsolute:S}}async function Pse({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:a}){const l=new Set(e.map(S=>S.id)),u=[];for(const S of n){if(S.deletable===!1)continue;const w=l.has(S.id),A=!w&&S.parentId&&u.find(E=>E.id===S.parentId);(w||A)&&u.push(S)}const d=new Set(t.map(S=>S.id)),h=r.filter(S=>S.deletable!==!1),y=jse(u,h);for(const S of h)d.has(S.id)&&!y.find(A=>A.id===S.id)&&y.push(S);if(!a)return{edges:y,nodes:u};const v=await a({nodes:u,edges:y});return typeof v=="boolean"?v?{edges:y,nodes:u}:{edges:[],nodes:[]}:v}const Lm=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),uh=(e={x:0,y:0},t,n)=>({x:Lm(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Lm(e.y,t[0][1],t[1][1]-(n?.height??0))});function O9(e,t,n){const{width:r,height:a}=$u(n),{x:l,y:u}=n.internals.positionAbsolute;return uh(e,[[l,u],[l+r,u+a]],t)}const M9=(e,t,n)=>e<t?Lm(Math.abs(e-t),1,t)/t:e>n?-Lm(Math.abs(e-n),1,t)/t:0,N9=(e,t,n=15,r=40)=>{const a=M9(e.x,r,t.width-r)*n,l=M9(e.y,r,t.height-r)*n;return[a,l]},S2=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),yk=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),w2=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Pm=(e,t=[0,0])=>{const{x:n,y:r}=mk(e)?e.internals.positionAbsolute:Tv(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},E2=(e,t=[0,0])=>{const{x:n,y:r}=mk(e)?e.internals.positionAbsolute:Tv(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},D9=(e,t)=>w2(S2(yk(e),yk(t))),Rv=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},I9=e=>kl(e.width)&&kl(e.height)&&kl(e.x)&&kl(e.y),kl=e=>!isNaN(e)&&isFinite(e),z9=(e,t)=>{process.env.NODE_ENV==="development"&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},C2=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ov=({x:e,y:t},[n,r,a],l=!1,u=[1,1])=>{const d={x:(e-n)/a,y:(t-r)/a};return l?C2(d,u):d},_2=({x:e,y:t},[n,r,a])=>({x:e*a+n,y:t*a+r});function Hm(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Hse(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Hm(e,n),a=Hm(e,t);return{top:r,right:a,bottom:r,left:a,x:a*2,y:r*2}}if(typeof e=="object"){const r=Hm(e.top??e.y??0,n),a=Hm(e.bottom??e.y??0,n),l=Hm(e.left??e.x??0,t),u=Hm(e.right??e.x??0,t);return{top:r,right:u,bottom:a,left:l,x:l+u,y:r+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Vse(e,t,n,r,a,l){const{x:u,y:d}=_2(e,[t,n,r]),{x:h,y:m}=_2({x:e.x+e.width,y:e.y+e.height},[t,n,r]),y=a-h,v=l-m;return{left:Math.floor(u),top:Math.floor(d),right:Math.floor(y),bottom:Math.floor(v)}}const vk=(e,t,n,r,a,l)=>{const u=Hse(l,t,n),d=(t-u.x)/e.width,h=(n-u.y)/e.height,m=Math.min(d,h),y=Lm(m,r,a),v=e.x+e.width/2,S=e.y+e.height/2,w=t/2-v*y,A=n/2-S*y,E=Vse(e,w,A,y,t,n),k={left:Math.min(E.left-u.left,0),top:Math.min(E.top-u.top,0),right:Math.min(E.right-u.right,0),bottom:Math.min(E.bottom-u.bottom,0)};return{x:w-k.left+k.right,y:A-k.top+k.bottom,zoom:y}},A2=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Vm(e){return e!==void 0&&e!=="parent"}function $u(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function j9(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function B9(e,t={width:0,height:0},n,r,a){const l={...e},u=r.get(n);if(u){const d=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*d[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*d[1]}return l}function L9(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Fse(){let e,t;return{promise:new Promise((r,a)=>{e=r,t=a}),resolve:e,reject:t}}function Gse(e){return{...C9,...e||{}}}function Mv(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:a}){const{x:l,y:u}=Os(e),d=Ov({x:l-(a?.left??0),y:u-(a?.top??0)},r),{x:h,y:m}=n?C2(d,t):d;return{xSnapped:h,ySnapped:m,...d}}const bk=e=>({width:e.offsetWidth,height:e.offsetHeight}),P9=e=>e?.getRootNode?.()||window?.document,Use=["INPUT","SELECT","TEXTAREA"];function H9(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Use.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const V9=e=>"clientX"in e,Os=(e,t)=>{const n=V9(e),r=n?e.clientX:e.touches?.[0].clientX,a=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:a-(t?.top??0)}},F9=(e,t,n,r,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const d=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(d.left-n.left)/r,y:(d.top-n.top)/r,...bk(u)}})};function G9({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:d}){const h=e*.125+a*.375+u*.375+n*.125,m=t*.125+l*.375+d*.375+r*.125,y=Math.abs(h-e),v=Math.abs(m-t);return[h,m,y,v]}function T2(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function U9({pos:e,x1:t,y1:n,x2:r,y2:a,c:l}){switch(e){case it.Left:return[t-T2(t-r,l),n];case it.Right:return[t+T2(r-t,l),n];case it.Top:return[t,n-T2(n-a,l)];case it.Bottom:return[t,n+T2(a-n,l)]}}function xk({sourceX:e,sourceY:t,sourcePosition:n=it.Bottom,targetX:r,targetY:a,targetPosition:l=it.Top,curvature:u=.25}){const[d,h]=U9({pos:n,x1:e,y1:t,x2:r,y2:a,c:u}),[m,y]=U9({pos:l,x1:r,y1:a,x2:e,y2:t,c:u}),[v,S,w,A]=G9({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:d,sourceControlY:h,targetControlX:m,targetControlY:y});return[`M${e},${t} C${d},${h} ${m},${y} ${r},${a}`,v,S,w,A]}function $9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const a=Math.abs(n-e)/2,l=n<e?n+a:n-a,u=Math.abs(r-t)/2,d=r<t?r+u:r-u;return[l,d,a,u]}function $se({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:a=!1}){if(r!==void 0)return r;const l=a&&n?1e3:0,u=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return l+u}function Xse({sourceNode:e,targetNode:t,width:n,height:r,transform:a}){const l=S2(E2(e),E2(t));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u={x:-a[0]/a[2],y:-a[1]/a[2],width:n/a[2],height:r/a[2]};return Rv(u,w2(l))>0}const Yse=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Zse=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Wse=(e,t)=>{if(!e.source||!e.target)return z9("006",Va.error006()),t;let n;return k9(e)?n={...e}:n={...e,id:Yse(e)},Zse(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function X9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[a,l,u,d]=$9({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,a,l,u,d]}const Y9={[it.Left]:{x:-1,y:0},[it.Right]:{x:1,y:0},[it.Top]:{x:0,y:-1},[it.Bottom]:{x:0,y:1}},qse=({source:e,sourcePosition:t=it.Bottom,target:n})=>t===it.Left||t===it.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Z9=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Jse({source:e,sourcePosition:t=it.Bottom,target:n,targetPosition:r=it.Top,center:a,offset:l,stepPosition:u}){const d=Y9[t],h=Y9[r],m={x:e.x+d.x*l,y:e.y+d.y*l},y={x:n.x+h.x*l,y:n.y+h.y*l},v=qse({source:m,sourcePosition:t,target:y}),S=v.x!==0?"x":"y",w=v[S];let A=[],E,k;const R={x:0,y:0},D={x:0,y:0},[,,M,I]=$9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(d[S]*h[S]===-1){S==="x"?(E=a.x??m.x+(y.x-m.x)*u,k=a.y??(m.y+y.y)/2):(E=a.x??(m.x+y.x)/2,k=a.y??m.y+(y.y-m.y)*u);const P=[{x:E,y:m.y},{x:E,y:y.y}],G=[{x:m.x,y:k},{x:y.x,y:k}];d[S]===w?A=S==="x"?P:G:A=S==="x"?G:P}else{const P=[{x:m.x,y:y.y}],G=[{x:y.x,y:m.y}];if(S==="x"?A=d.x===w?G:P:A=d.y===w?P:G,t===r){const ee=Math.abs(e[S]-n[S]);if(ee<=l){const ae=Math.min(l-1,l-ee);d[S]===w?R[S]=(m[S]>e[S]?-1:1)*ae:D[S]=(y[S]>n[S]?-1:1)*ae}}if(t!==r){const ee=S==="x"?"y":"x",ae=d[S]===h[ee],U=m[ee]>y[ee],te=m[ee]<y[ee];(d[S]===1&&(!ae&&U||ae&&te)||d[S]!==1&&(!ae&&te||ae&&U))&&(A=S==="x"?P:G)}const $={x:m.x+R.x,y:m.y+R.y},Z={x:y.x+D.x,y:y.y+D.y},j=Math.max(Math.abs($.x-A[0].x),Math.abs(Z.x-A[0].x)),X=Math.max(Math.abs($.y-A[0].y),Math.abs(Z.y-A[0].y));j>=X?(E=($.x+Z.x)/2,k=A[0].y):(E=A[0].x,k=($.y+Z.y)/2)}return[[e,{x:m.x+R.x,y:m.y+R.y},...A,{x:y.x+D.x,y:y.y+D.y},n],E,k,M,I]}function Qse(e,t,n,r){const a=Math.min(Z9(e,t)/2,Z9(t,n)/2,r),{x:l,y:u}=t;if(e.x===l&&l===n.x||e.y===u&&u===n.y)return`L${l} ${u}`;if(e.y===u){const m=e.x<n.x?-1:1,y=e.y<n.y?1:-1;return`L ${l+a*m},${u}Q ${l},${u} ${l},${u+a*y}`}const d=e.x<n.x?1:-1,h=e.y<n.y?-1:1;return`L ${l},${u+a*h}Q ${l},${u} ${l+a*d},${u}`}function Sk({sourceX:e,sourceY:t,sourcePosition:n=it.Bottom,targetX:r,targetY:a,targetPosition:l=it.Top,borderRadius:u=5,centerX:d,centerY:h,offset:m=20,stepPosition:y=.5}){const[v,S,w,A,E]=Jse({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:a},targetPosition:l,center:{x:d,y:h},offset:m,stepPosition:y});return[v.reduce((R,D,M)=>{let I="";return M>0&&M<v.length-1?I=Qse(v[M-1],D,v[M+1],u):I=`${M===0?"M":"L"}${D.x} ${D.y}`,R+=I,R},""),S,w,A,E]}function W9(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Kse(e){const{sourceNode:t,targetNode:n}=e;if(!W9(t)||!W9(n))return null;const r=t.internals.handleBounds||q9(t.handles),a=n.internals.handleBounds||q9(n.handles),l=J9(r?.source??[],e.sourceHandle),u=J9(e.connectionMode===Bm.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),e.targetHandle);if(!l||!u)return e.onError?.("008",Va.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const d=l?.position||it.Bottom,h=u?.position||it.Top,m=Nv(t,l,d),y=Nv(n,u,h);return{sourceX:m.x,sourceY:m.y,targetX:y.x,targetY:y.y,sourcePosition:d,targetPosition:h}}function q9(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Nv(e,t,n=it.Left,r=!1){const a=(t?.x??0)+e.internals.positionAbsolute.x,l=(t?.y??0)+e.internals.positionAbsolute.y,{width:u,height:d}=t??$u(e);if(r)return{x:a+u/2,y:l+d/2};switch(t?.position??n){case it.Top:return{x:a+u/2,y:l};case it.Right:return{x:a+u,y:l+d/2};case it.Bottom:return{x:a+u/2,y:l+d};case it.Left:return{x:a,y:l+d/2}}}function J9(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function wk(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function eue(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,d)=>([d.markerStart||r,d.markerEnd||a].forEach(h=>{if(h&&typeof h=="object"){const m=wk(h,t);l.has(m)||(u.push({id:m,color:h.color||n,...h}),l.add(m))}}),u),[]).sort((u,d)=>u.id.localeCompare(d.id))}const Ek={nodeOrigin:[0,0],nodeExtent:_v,elevateNodesOnSelect:!0,defaults:{}},tue={...Ek,checkEquality:!0};function Ck(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function nue(e,t,n){const r=Ck(Ek,n);for(const a of e.values())if(a.parentId)Ak(a,e,t,r);else{const l=Tv(a,r.nodeOrigin),u=Vm(a.extent)?a.extent:r.nodeExtent,d=uh(l,u,$u(a));a.internals.positionAbsolute=d}}function _k(e,t,n,r){const a=Ck(tue,r);let l=e.length>0;const u=new Map(t),d=a?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const h of e){let m=u.get(h.id);if(a.checkEquality&&h===m?.internals.userNode)t.set(h.id,m);else{const y=Tv(h,a.nodeOrigin),v=Vm(h.extent)?h.extent:a.nodeExtent,S=uh(y,v,$u(h));m={...a.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:S,handleBounds:h.measured?m?.internals.handleBounds:void 0,z:Q9(h,d),userNode:h}},t.set(h.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(l=!1),h.parentId&&Ak(m,t,n,r)}return l}function rue(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Ak(e,t,n,r){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u}=Ck(Ek,r),d=e.parentId,h=t.get(d);if(!h){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}rue(e,n);const m=a?1e3:0,{x:y,y:v,z:S}=oue(e,h,l,u,m),{positionAbsolute:w}=e.internals,A=y!==w.x||v!==w.y;(A||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:A?{x:y,y:v}:w,z:S}})}function Q9(e,t){return(kl(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function oue(e,t,n,r,a){const{x:l,y:u}=t.internals.positionAbsolute,d=$u(e),h=Tv(e,n),m=Vm(e.extent)?uh(h,e.extent,d):h;let y=uh({x:l+m.x,y:u+m.y},r,d);e.extent==="parent"&&(y=O9(y,d,t));const v=Q9(e,a),S=t.internals.z??0;return{x:y.x,y:y.y,z:S>=v?S+1:v}}function Tk(e,t,n,r=[0,0]){const a=[],l=new Map;for(const u of e){const d=t.get(u.parentId);if(!d)continue;const h=l.get(u.parentId)?.expandedRect??Pm(d),m=D9(h,u.rect);l.set(u.parentId,{expandedRect:m,parent:d})}return l.size>0&&l.forEach(({expandedRect:u,parent:d},h)=>{const m=d.internals.positionAbsolute,y=$u(d),v=d.origin??r,S=u.x<m.x?Math.round(Math.abs(m.x-u.x)):0,w=u.y<m.y?Math.round(Math.abs(m.y-u.y)):0,A=Math.max(y.width,Math.round(u.width)),E=Math.max(y.height,Math.round(u.height)),k=(A-y.width)*v[0],R=(E-y.height)*v[1];(S>0||w>0||k||R)&&(a.push({id:h,type:"position",position:{x:d.position.x-S+k,y:d.position.y-w+R}}),n.get(h)?.forEach(D=>{e.some(M=>M.id===D.id)||a.push({id:D.id,type:"position",position:{x:D.position.x+S,y:D.position.y+w}})})),(y.width<u.width||y.height<u.height||S||w)&&a.push({id:h,type:"dimensions",setAttributes:!0,dimensions:{width:A+(S?v[0]*S-k:0),height:E+(w?v[1]*w-R:0)}})}),a}function aue(e,t,n,r,a,l){const u=r?.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const h=[],m=window.getComputedStyle(u),{m22:y}=new window.DOMMatrixReadOnly(m.transform),v=[];for(const S of e.values()){const w=t.get(S.id);if(!w)continue;if(w.hidden){t.set(w.id,{...w,internals:{...w.internals,handleBounds:void 0}}),d=!0;continue}const A=bk(S.nodeElement),E=w.measured.width!==A.width||w.measured.height!==A.height;if(!!(A.width&&A.height&&(E||!w.internals.handleBounds||S.force))){const R=S.nodeElement.getBoundingClientRect(),D=Vm(w.extent)?w.extent:l;let{positionAbsolute:M}=w.internals;w.parentId&&w.extent==="parent"?M=O9(M,A,t.get(w.parentId)):D&&(M=uh(M,D,A));const I={...w,measured:A,internals:{...w.internals,positionAbsolute:M,handleBounds:{source:F9("source",S.nodeElement,R,y,w.id),target:F9("target",S.nodeElement,R,y,w.id)}}};t.set(w.id,I),w.parentId&&Ak(I,t,n,{nodeOrigin:a}),d=!0,E&&(h.push({id:w.id,type:"dimensions",dimensions:A}),w.expandParent&&w.parentId&&v.push({id:w.id,parentId:w.parentId,rect:Pm(I,a)}))}}if(v.length>0){const S=Tk(v,t,n,a);h.push(...S)}return{changes:h,updatedInternals:d}}async function iue({delta:e,panZoom:t,transform:n,translateExtent:r,width:a,height:l}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const u=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[a,l]],r),d=!!u&&(u.x!==n[0]||u.y!==n[1]||u.k!==n[2]);return Promise.resolve(d)}function K9(e,t,n,r,a,l){let u=a;const d=r.get(u)||new Map;r.set(u,d.set(n,t)),u=`${a}-${e}`;const h=r.get(u)||new Map;if(r.set(u,h.set(n,t)),l){u=`${a}-${e}-${l}`;const m=r.get(u)||new Map;r.set(u,m.set(n,t))}}function e6(e,t,n){e.clear(),t.clear();for(const r of n){const{source:a,target:l,sourceHandle:u=null,targetHandle:d=null}=r,h={edgeId:r.id,source:a,target:l,sourceHandle:u,targetHandle:d},m=`${a}-${u}--${l}-${d}`,y=`${l}-${d}--${a}-${u}`;K9("source",h,y,e,a,u),K9("target",h,m,e,l,d),t.set(r.id,r)}}function t6(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:t6(n,t):!1}function n6(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function lue(e,t,n,r){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===r)&&(!u.parentId||!t6(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const d=e.get(l);d&&a.set(l,{id:l,position:d.position||{x:0,y:0},distance:{x:n.x-d.internals.positionAbsolute.x,y:n.y-d.internals.positionAbsolute.y},extent:d.extent,parentId:d.parentId,origin:d.origin,expandParent:d.expandParent,internals:{positionAbsolute:d.internals.positionAbsolute||{x:0,y:0}},measured:{width:d.measured.width??0,height:d.measured.height??0}})}return a}function kk({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){const a=[];for(const[u,d]of t){const h=n.get(u)?.internals.userNode;h&&a.push({...h,position:d.position,dragging:r})}if(!e)return[a[0],a];const l=n.get(e)?.internals.userNode;return[l?{...l,position:t.get(e)?.position||l.position,dragging:r}:a[0],a]}function sue({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:a}){let l={x:null,y:null},u=0,d=new Map,h=!1,m={x:0,y:0},y=null,v=!1,S=null,w=!1,A=!1;function E({noDragClassName:R,handleSelector:D,domNode:M,isSelectable:I,nodeId:L,nodeClickDistance:P=0}){S=Ha(M);function G({x:X,y:ee},ae){const{nodeLookup:U,nodeExtent:te,snapGrid:V,snapToGrid:W,nodeOrigin:Q,onNodeDrag:ne,onSelectionDrag:B,onError:oe,updateNodePositions:se}=t();l={x:X,y:ee};let Y=!1,he={x:0,y:0,x2:0,y2:0};if(d.size>1&&te){const ke=kv(d);he=yk(ke)}for(const[ke,me]of d){if(!U.has(ke))continue;let Ee={x:X-me.distance.x,y:ee-me.distance.y};W&&(Ee=C2(Ee,V));let xe=[[te[0][0],te[0][1]],[te[1][0],te[1][1]]];if(d.size>1&&te&&!me.extent){const{positionAbsolute:Ye}=me.internals,Re=Ye.x-he.x+te[0][0],Xe=Ye.x+me.measured.width-he.x2+te[1][0],We=Ye.y-he.y+te[0][1],At=Ye.y+me.measured.height-he.y2+te[1][1];xe=[[Re,We],[Xe,At]]}const{position:Be,positionAbsolute:He}=R9({nodeId:ke,nextPosition:Ee,nodeLookup:U,nodeExtent:xe,nodeOrigin:Q,onError:oe});Y=Y||me.position.x!==Be.x||me.position.y!==Be.y,me.position=Be,me.internals.positionAbsolute=He}if(A=A||Y,!!Y&&(se(d,!0),ae&&(r||ne||!L&&B))){const[ke,me]=kk({nodeId:L,dragItems:d,nodeLookup:U});r?.(ae,d,ke,me),ne?.(ae,ke,me),L||B?.(ae,me)}}async function $(){if(!y)return;const{transform:X,panBy:ee,autoPanSpeed:ae,autoPanOnNodeDrag:U}=t();if(!U){h=!1,cancelAnimationFrame(u);return}const[te,V]=N9(m,y,ae);(te!==0||V!==0)&&(l.x=(l.x??0)-te/X[2],l.y=(l.y??0)-V/X[2],await ee({x:te,y:V})&&G(l,null)),u=requestAnimationFrame($)}function Z(X){const{nodeLookup:ee,multiSelectionActive:ae,nodesDraggable:U,transform:te,snapGrid:V,snapToGrid:W,selectNodesOnDrag:Q,onNodeDragStart:ne,onSelectionDragStart:B,unselectNodesAndEdges:oe}=t();v=!0,(!Q||!I)&&!ae&&L&&(ee.get(L)?.selected||oe()),I&&Q&&L&&e?.(L);const se=Mv(X.sourceEvent,{transform:te,snapGrid:V,snapToGrid:W,containerBounds:y});if(l=se,d=lue(ee,U,se,L),d.size>0&&(n||ne||!L&&B)){const[Y,he]=kk({nodeId:L,dragItems:d,nodeLookup:ee});n?.(X.sourceEvent,d,Y,he),ne?.(X.sourceEvent,Y,he),L||B?.(X.sourceEvent,he)}}const j=Xj().clickDistance(P).on("start",X=>{const{domNode:ee,nodeDragThreshold:ae,transform:U,snapGrid:te,snapToGrid:V}=t();y=ee?.getBoundingClientRect()||null,w=!1,A=!1,ae===0&&Z(X),l=Mv(X.sourceEvent,{transform:U,snapGrid:te,snapToGrid:V,containerBounds:y}),m=Os(X.sourceEvent,y)}).on("drag",X=>{const{autoPanOnNodeDrag:ee,transform:ae,snapGrid:U,snapToGrid:te,nodeDragThreshold:V,nodeLookup:W}=t(),Q=Mv(X.sourceEvent,{transform:ae,snapGrid:U,snapToGrid:te,containerBounds:y});if((X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1||L&&!W.has(L))&&(w=!0),!w){if(!h&&ee&&v&&(h=!0,$()),!v){const ne=Q.xSnapped-(l.x??0),B=Q.ySnapped-(l.y??0);Math.sqrt(ne*ne+B*B)>V&&Z(X)}(l.x!==Q.xSnapped||l.y!==Q.ySnapped)&&d&&v&&(m=Os(X.sourceEvent,y),G(Q,X.sourceEvent))}}).on("end",X=>{if(!(!v||w)&&(h=!1,v=!1,cancelAnimationFrame(u),d.size>0)){const{nodeLookup:ee,updateNodePositions:ae,onNodeDragStop:U,onSelectionDragStop:te}=t();if(A&&(ae(d,!1),A=!1),a||U||!L&&te){const[V,W]=kk({nodeId:L,dragItems:d,nodeLookup:ee,dragging:!1});a?.(X.sourceEvent,d,V,W),U?.(X.sourceEvent,V,W),L||te?.(X.sourceEvent,W)}}}).filter(X=>{const ee=X.target;return!X.button&&(!R||!n6(ee,`.${R}`,M))&&(!D||n6(ee,D,M))});S.call(j)}function k(){S?.on(".drag",null)}return{update:E,destroy:k}}function uue(e,t,n){const r=[],a={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const l of t.values())Rv(a,Pm(l))>0&&r.push(l);return r}const cue=250;function fue(e,t,n,r){let a=[],l=1/0;const u=uue(e,n,t+cue);for(const d of u){const h=[...d.internals.handleBounds?.source??[],...d.internals.handleBounds?.target??[]];for(const m of h){if(r.nodeId===m.nodeId&&r.type===m.type&&r.id===m.id)continue;const{x:y,y:v}=Nv(d,m,m.position,!0),S=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(v-e.y,2));S>t||(S<l?(a=[{...m,x:y,y:v}],l=S):S===l&&a.push({...m,x:y,y:v}))}}if(!a.length)return null;if(a.length>1){const d=r.type==="source"?"target":"source";return a.find(h=>h.type===d)??a[0]}return a[0]}function r6(e,t,n,r,a,l=!1){const u=r.get(e);if(!u)return null;const d=a==="strict"?u.internals.handleBounds?.[t]:[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]],h=(n?d?.find(m=>m.id===n):d?.[0])??null;return h&&l?{...h,...Nv(u,h,h.position,!0)}:h}function o6(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function due(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const a6=()=>!0;function hue(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:d,nodeLookup:h,lib:m,autoPanOnConnect:y,flowId:v,panBy:S,cancelConnection:w,onConnectStart:A,onConnect:E,onConnectEnd:k,isValidConnection:R=a6,onReconnectEnd:D,updateConnection:M,getTransform:I,getFromHandle:L,autoPanSpeed:P,dragThreshold:G=1}){const $=P9(e.target);let Z=0,j;const{x:X,y:ee}=Os(e),ae=$?.elementFromPoint(X,ee),U=o6(l,ae),te=d?.getBoundingClientRect();let V=!1;if(!te||!U)return;const W=r6(a,U,r,h,t);if(!W)return;let Q=Os(e,te),ne=!1,B=null,oe=!1,se=null;function Y(){if(!y||!te)return;const[Ye,Re]=N9(Q,te,P);S({x:Ye,y:Re}),Z=requestAnimationFrame(Y)}const he={...W,nodeId:a,type:U,position:W.position},ke=h.get(a);let Ee={inProgress:!0,isValid:null,from:Nv(ke,he,it.Left,!0),fromHandle:he,fromPosition:he.position,fromNode:ke,to:Q,toHandle:null,toPosition:A9[he.position],toNode:null};function xe(){V=!0,M(Ee),A?.(e,{nodeId:a,handleId:r,handleType:U})}G===0&&xe();function Be(Ye){if(!V){const{x:At,y:Kt}=Os(Ye),qt=At-X,er=Kt-ee;if(!(qt*qt+er*er>G*G))return;xe()}if(!L()||!he){He(Ye);return}const Re=I();Q=Os(Ye,te),j=fue(Ov(Q,Re,!1,[1,1]),n,h,he),ne||(Y(),ne=!0);const Xe=i6(Ye,{handle:j,connectionMode:t,fromNodeId:a,fromHandleId:r,fromType:u?"target":"source",isValidConnection:R,doc:$,lib:m,flowId:v,nodeLookup:h});se=Xe.handleDomNode,B=Xe.connection,oe=due(!!j,Xe.isValid);const We={...Ee,isValid:oe,to:Xe.toHandle&&oe?_2({x:Xe.toHandle.x,y:Xe.toHandle.y},Re):Q,toHandle:Xe.toHandle,toPosition:oe&&Xe.toHandle?Xe.toHandle.position:A9[he.position],toNode:Xe.toHandle?h.get(Xe.toHandle.nodeId):null};oe&&j&&Ee.toHandle&&We.toHandle&&Ee.toHandle.type===We.toHandle.type&&Ee.toHandle.nodeId===We.toHandle.nodeId&&Ee.toHandle.id===We.toHandle.id&&Ee.to.x===We.to.x&&Ee.to.y===We.to.y||(M(We),Ee=We)}function He(Ye){if(V){(j||se)&&B&&oe&&E?.(B);const{inProgress:Re,...Xe}=Ee,We={...Xe,toPosition:Ee.toHandle?Ee.toPosition:null};k?.(Ye,We),l&&D?.(Ye,We)}w(),cancelAnimationFrame(Z),ne=!1,oe=!1,B=null,se=null,$.removeEventListener("mousemove",Be),$.removeEventListener("mouseup",He),$.removeEventListener("touchmove",Be),$.removeEventListener("touchend",He)}$.addEventListener("mousemove",Be),$.addEventListener("mouseup",He),$.addEventListener("touchmove",Be),$.addEventListener("touchend",He)}function i6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:a,fromType:l,doc:u,lib:d,flowId:h,isValidConnection:m=a6,nodeLookup:y}){const v=l==="target",S=t?u.querySelector(`.${d}-flow__handle[data-id="${h}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:w,y:A}=Os(e),E=u.elementFromPoint(w,A),k=E?.classList.contains(`${d}-flow__handle`)?E:S,R={handleDomNode:k,isValid:!1,connection:null,toHandle:null};if(k){const D=o6(void 0,k),M=k.getAttribute("data-nodeid"),I=k.getAttribute("data-handleid"),L=k.classList.contains("connectable"),P=k.classList.contains("connectableend");if(!M||!D)return R;const G={source:v?M:r,sourceHandle:v?I:a,target:v?r:M,targetHandle:v?a:I};R.connection=G;const Z=L&&P&&(n===Bm.Strict?v&&D==="source"||!v&&D==="target":M!==r||I!==a);R.isValid=Z&&m(G),R.toHandle=r6(M,D,I,y,n,!0)}return R}const Rk={onPointerDown:hue,isValid:i6};function pue({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const a=Ha(e);function l({translateExtent:d,width:h,height:m,zoomStep:y=10,pannable:v=!0,zoomable:S=!0,inversePan:w=!1}){const A=M=>{const I=n();if(M.sourceEvent.type!=="wheel"||!t)return;const L=-M.sourceEvent.deltaY*(M.sourceEvent.deltaMode===1?.05:M.sourceEvent.deltaMode?1:.002)*y,P=I[2]*Math.pow(2,L);t.scaleTo(P)};let E=[0,0];const k=M=>{(M.sourceEvent.type==="mousedown"||M.sourceEvent.type==="touchstart")&&(E=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY])},R=M=>{const I=n();if(M.sourceEvent.type!=="mousemove"&&M.sourceEvent.type!=="touchmove"||!t)return;const L=[M.sourceEvent.clientX??M.sourceEvent.touches[0].clientX,M.sourceEvent.clientY??M.sourceEvent.touches[0].clientY],P=[L[0]-E[0],L[1]-E[1]];E=L;const G=r()*Math.max(I[2],Math.log(I[2]))*(w?-1:1),$={x:I[0]-P[0]*G,y:I[1]-P[1]*G},Z=[[0,0],[h,m]];t.setViewportConstrained({x:$.x,y:$.y,zoom:I[2]},Z,d)},D=w9().on("start",k).on("zoom",v?R:null).on("zoom.wheel",S?A:null);a.call(D,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:_l}}const mue=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,k2=e=>({x:e.x,y:e.y,zoom:e.k}),Ok=({x:e,y:t,zoom:n})=>b2.translate(e,t).scale(n),Fm=(e,t)=>e.target.closest(`.${t}`),l6=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),gue=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Mk=(e,t=0,n=gue,r=()=>{})=>{const a=typeof t=="number"&&t>0;return a||r(),a?e.transition().duration(t).ease(n).on("end",r):e},s6=e=>{const t=e.ctrlKey&&A2()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function yue({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:d,onPanZoom:h,onPanZoomEnd:m}){return y=>{if(Fm(y,t))return!1;y.preventDefault(),y.stopImmediatePropagation();const v=n.property("__zoom").k||1;if(y.ctrlKey&&u){const k=_l(y),R=s6(y),D=v*Math.pow(2,R);r.scaleTo(n,D,k,y);return}const S=y.deltaMode===1?20:1;let w=a===sh.Vertical?0:y.deltaX*S,A=a===sh.Horizontal?0:y.deltaY*S;!A2()&&y.shiftKey&&a!==sh.Vertical&&(w=y.deltaY*S,A=0),r.translateBy(n,-(w/v)*l,-(A/v)*l,{internal:!0});const E=k2(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,d?.(y,E)),e.isPanScrolling&&(h?.(y,E),e.panScrollTimeout=setTimeout(()=>{m?.(y,E),e.isPanScrolling=!1},150))}}function vue({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,a){const l=r.type==="wheel",u=!t&&l&&!r.ctrlKey,d=Fm(r,e);if(r.ctrlKey&&l&&d&&r.preventDefault(),u||d)return null;r.preventDefault(),n.call(this,r,a)}}function bue({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;const a=k2(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=a,r.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(r.sourceEvent,a)}}function xue({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:a}){return l=>{e.usedRightMouseButton=!!(n&&l6(t,e.mouseButton??0)),l.sourceEvent?.sync||r([l.transform.x,l.transform.y,l.transform.k]),a&&!l.sourceEvent?.internal&&a?.(l.sourceEvent,k2(l.transform))}}function Sue({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{if(!u.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,l&&l6(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,r(!1),a&&mue(e.prevViewport,u.transform))){const d=k2(u.transform);e.prevViewport=d,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a?.(u.sourceEvent,d)},n?150:0)}}}function wue({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:d,noPanClassName:h,lib:m}){return y=>{const v=e||t,S=n&&y.ctrlKey;if(y.button===1&&y.type==="mousedown"&&(Fm(y,`${m}-flow__node`)||Fm(y,`${m}-flow__edge`)))return!0;if(!r&&!v&&!a&&!l&&!n||u||Fm(y,d)&&y.type==="wheel"||Fm(y,h)&&(y.type!=="wheel"||a&&y.type==="wheel"&&!e)||!n&&y.ctrlKey&&y.type==="wheel")return!1;if(!n&&y.type==="touchstart"&&y.touches?.length>1)return y.preventDefault(),!1;if(!v&&!a&&!S&&y.type==="wheel"||!r&&(y.type==="mousedown"||y.type==="touchstart")||Array.isArray(r)&&!r.includes(y.button)&&y.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(y.button)||!y.button||y.button<=1;return(!y.ctrlKey||y.type==="wheel")&&w}}function Eue({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:a,viewport:l,onPanZoom:u,onPanZoomStart:d,onPanZoomEnd:h,onDraggingChange:m}){const y={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),S=w9().clickDistance(!kl(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(a),w=Ha(e).call(S);M({x:l.x,y:l.y,zoom:Lm(l.zoom,t,n)},[[0,0],[v.width,v.height]],a);const A=w.on("wheel.zoom"),E=w.on("dblclick.zoom");S.wheelDelta(s6);function k(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?bv:u2).transform(Mk(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function R({noWheelClassName:ee,noPanClassName:ae,onPaneContextMenu:U,userSelectionActive:te,panOnScroll:V,panOnDrag:W,panOnScrollMode:Q,panOnScrollSpeed:ne,preventScrolling:B,zoomOnPinch:oe,zoomOnScroll:se,zoomOnDoubleClick:Y,zoomActivationKeyPressed:he,lib:ke,onTransformChange:me}){te&&!y.isZoomingOrPanning&&D();const xe=V&&!he&&!te?yue({zoomPanValues:y,noWheelClassName:ee,d3Selection:w,d3Zoom:S,panOnScrollMode:Q,panOnScrollSpeed:ne,zoomOnPinch:oe,onPanZoomStart:d,onPanZoom:u,onPanZoomEnd:h}):vue({noWheelClassName:ee,preventScrolling:B,d3ZoomHandler:A});if(w.on("wheel.zoom",xe,{passive:!1}),!te){const He=bue({zoomPanValues:y,onDraggingChange:m,onPanZoomStart:d});S.on("start",He);const Ye=xue({zoomPanValues:y,panOnDrag:W,onPaneContextMenu:!!U,onPanZoom:u,onTransformChange:me});S.on("zoom",Ye);const Re=Sue({zoomPanValues:y,panOnDrag:W,panOnScroll:V,onPaneContextMenu:U,onPanZoomEnd:h,onDraggingChange:m});S.on("end",Re)}const Be=wue({zoomActivationKeyPressed:he,panOnDrag:W,zoomOnScroll:se,panOnScroll:V,zoomOnDoubleClick:Y,zoomOnPinch:oe,userSelectionActive:te,noPanClassName:ae,noWheelClassName:ee,lib:ke});S.filter(Be),Y?w.on("dblclick.zoom",E):w.on("dblclick.zoom",null)}function D(){S.on("zoom",null)}async function M(ee,ae,U){const te=Ok(ee),V=S?.constrain()(te,ae,U);return V&&await k(V),new Promise(W=>W(V))}async function I(ee,ae){const U=Ok(ee);return await k(U,ae),new Promise(te=>te(U))}function L(ee){if(w){const ae=Ok(ee),U=w.property("__zoom");(U.k!==ee.zoom||U.x!==ee.x||U.y!==ee.y)&&S?.transform(w,ae,null,{sync:!0})}}function P(){const ee=w?x9(w.node()):{x:0,y:0,k:1};return{x:ee.x,y:ee.y,zoom:ee.k}}function G(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?bv:u2).scaleTo(Mk(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function $(ee,ae){return w?new Promise(U=>{S?.interpolate(ae?.interpolate==="linear"?bv:u2).scaleBy(Mk(w,ae?.duration,ae?.ease,()=>U(!0)),ee)}):Promise.resolve(!1)}function Z(ee){S?.scaleExtent(ee)}function j(ee){S?.translateExtent(ee)}function X(ee){const ae=!kl(ee)||ee<0?0:ee;S?.clickDistance(ae)}return{update:R,destroy:D,setViewport:I,setViewportConstrained:M,getViewport:P,scaleTo:G,scaleBy:$,setScaleExtent:Z,setTranslateExtent:j,syncViewport:L,setClickDistance:X}}var Gm;(function(e){e.Line="line",e.Handle="handle"})(Gm||(Gm={}));function Cue({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:a,affectsY:l}){const u=e-t,d=n-r,h=[u>0?1:u<0?-1:0,d>0?1:d<0?-1:0];return u&&a&&(h[0]=h[0]*-1),d&&l&&(h[1]=h[1]*-1),h}function _ue(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:a}}function Sf(e,t){return Math.max(0,t-e)}function wf(e,t){return Math.max(0,e-t)}function R2(e,t,n){return Math.max(0,t-e,e-n)}function u6(e,t){return e?!t:t}function Aue(e,t,n,r,a,l,u,d){let{affectsX:h,affectsY:m}=t;const{isHorizontal:y,isVertical:v}=t,S=y&&v,{xSnapped:w,ySnapped:A}=n,{minWidth:E,maxWidth:k,minHeight:R,maxHeight:D}=r,{x:M,y:I,width:L,height:P,aspectRatio:G}=e;let $=Math.floor(y?w-e.pointerX:0),Z=Math.floor(v?A-e.pointerY:0);const j=L+(h?-$:$),X=P+(m?-Z:Z),ee=-l[0]*L,ae=-l[1]*P;let U=R2(j,E,k),te=R2(X,R,D);if(u){let Q=0,ne=0;h&&$<0?Q=Sf(M+$+ee,u[0][0]):!h&&$>0&&(Q=wf(M+j+ee,u[1][0])),m&&Z<0?ne=Sf(I+Z+ae,u[0][1]):!m&&Z>0&&(ne=wf(I+X+ae,u[1][1])),U=Math.max(U,Q),te=Math.max(te,ne)}if(d){let Q=0,ne=0;h&&$>0?Q=wf(M+$,d[0][0]):!h&&$<0&&(Q=Sf(M+j,d[1][0])),m&&Z>0?ne=wf(I+Z,d[0][1]):!m&&Z<0&&(ne=Sf(I+X,d[1][1])),U=Math.max(U,Q),te=Math.max(te,ne)}if(a){if(y){const Q=R2(j/G,R,D)*G;if(U=Math.max(U,Q),u){let ne=0;!h&&!m||h&&!m&&S?ne=wf(I+ae+j/G,u[1][1])*G:ne=Sf(I+ae+(h?$:-$)/G,u[0][1])*G,U=Math.max(U,ne)}if(d){let ne=0;!h&&!m||h&&!m&&S?ne=Sf(I+j/G,d[1][1])*G:ne=wf(I+(h?$:-$)/G,d[0][1])*G,U=Math.max(U,ne)}}if(v){const Q=R2(X*G,E,k)/G;if(te=Math.max(te,Q),u){let ne=0;!h&&!m||m&&!h&&S?ne=wf(M+X*G+ee,u[1][0])/G:ne=Sf(M+(m?Z:-Z)*G+ee,u[0][0])/G,te=Math.max(te,ne)}if(d){let ne=0;!h&&!m||m&&!h&&S?ne=Sf(M+X*G,d[1][0])/G:ne=wf(M+(m?Z:-Z)*G,d[0][0])/G,te=Math.max(te,ne)}}}Z=Z+(Z<0?te:-te),$=$+($<0?U:-U),a&&(S?j>X*G?Z=(u6(h,m)?-$:$)/G:$=(u6(h,m)?-Z:Z)*G:y?(Z=$/G,m=h):($=Z*G,h=m));const V=h?M+$:M,W=m?I+Z:I;return{width:L+(h?-$:$),height:P+(m?-Z:Z),x:l[0]*$*(h?-1:1)+V,y:l[1]*Z*(m?-1:1)+W}}const c6={width:0,height:0,x:0,y:0},Tue={...c6,pointerX:0,pointerY:0,aspectRatio:1};function kue(e){return[[0,0],[e.measured.width,e.measured.height]]}function Rue(e,t,n){const r=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,d=n[0]*l,h=n[1]*u;return[[r-d,a-h],[r+l-d,a+u-h]]}function Oue({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:a}){const l=Ha(e);function u({controlPosition:h,boundaries:m,keepAspectRatio:y,resizeDirection:v,onResizeStart:S,onResize:w,onResizeEnd:A,shouldResize:E}){let k={...c6},R={...Tue};const D=_ue(h);let M,I=null,L=[],P,G,$;const Z=Xj().on("start",j=>{const{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,paneDomNode:V}=n();if(M=X.get(t),!M)return;I=V?.getBoundingClientRect()??null;const{xSnapped:W,ySnapped:Q}=Mv(j.sourceEvent,{transform:ee,snapGrid:ae,snapToGrid:U,containerBounds:I});k={width:M.measured.width??0,height:M.measured.height??0,x:M.position.x??0,y:M.position.y??0},R={...k,pointerX:W,pointerY:Q,aspectRatio:k.width/k.height},P=void 0,M.parentId&&(M.extent==="parent"||M.expandParent)&&(P=X.get(M.parentId),G=P&&M.extent==="parent"?kue(P):void 0),L=[],$=void 0;for(const[ne,B]of X)if(B.parentId===t&&(L.push({id:ne,position:{...B.position},extent:B.extent}),B.extent==="parent"||B.expandParent)){const oe=Rue(B,M,B.origin??te);$?$=[[Math.min(oe[0][0],$[0][0]),Math.min(oe[0][1],$[0][1])],[Math.max(oe[1][0],$[1][0]),Math.max(oe[1][1],$[1][1])]]:$=oe}S?.(j,{...k})}).on("drag",j=>{const{transform:X,snapGrid:ee,snapToGrid:ae,nodeOrigin:U}=n(),te=Mv(j.sourceEvent,{transform:X,snapGrid:ee,snapToGrid:ae,containerBounds:I}),V=[];if(!M)return;const{x:W,y:Q,width:ne,height:B}=k,oe={},se=M.origin??U,{width:Y,height:he,x:ke,y:me}=Aue(R,D,te,m,y,se,G,$),Ee=Y!==ne,xe=he!==B,Be=ke!==W&&Ee,He=me!==Q&&xe;if(!Be&&!He&&!Ee&&!xe)return;if((Be||He||se[0]===1||se[1]===1)&&(oe.x=Be?ke:k.x,oe.y=He?me:k.y,k.x=oe.x,k.y=oe.y,L.length>0)){const We=ke-W,At=me-Q;for(const Kt of L)Kt.position={x:Kt.position.x-We+se[0]*(Y-ne),y:Kt.position.y-At+se[1]*(he-B)},V.push(Kt)}if((Ee||xe)&&(oe.width=Ee&&(!v||v==="horizontal")?Y:k.width,oe.height=xe&&(!v||v==="vertical")?he:k.height,k.width=oe.width,k.height=oe.height),P&&M.expandParent){const We=se[0]*(oe.width??0);oe.x&&oe.x<We&&(k.x=We,R.x=R.x-(oe.x-We));const At=se[1]*(oe.height??0);oe.y&&oe.y<At&&(k.y=At,R.y=R.y-(oe.y-At))}const Ye=Cue({width:k.width,prevWidth:ne,height:k.height,prevHeight:B,affectsX:D.affectsX,affectsY:D.affectsY}),Re={...k,direction:Ye};E?.(j,Re)!==!1&&(w?.(j,Re),r(oe,V))}).on("end",j=>{A?.(j,{...k}),a?.({...k})});l.call(Z)}function d(){l.on(".drag",null)}return{update:u,destroy:d}}const{useDebugValue:Mue}=q,{useSyncExternalStoreWithSelector:Nue}=Bz,Due=e=>e;function f6(e,t=Due,n){const r=Nue(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Mue(r),r}const d6=(e,t)=>{const n=Rz(e),r=(a,l=t)=>f6(n,a,l);return Object.assign(r,n),r},Iue=(e,t)=>e?d6(e,t):d6;function Xn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const O2=q.createContext(null),zue=O2.Provider,h6=Va.error001();function Gt(e,t){const n=q.useContext(O2);if(n===null)throw new Error(h6);return f6(n,e,t)}function jn(){const e=q.useContext(O2);if(e===null)throw new Error(h6);return q.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const p6={display:"none"},jue={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},m6="react-flow__node-desc",g6="react-flow__edge-desc",Bue="react-flow__aria-live",Lue=e=>e.ariaLiveMessage,Pue=e=>e.ariaLabelConfig;function Hue({rfId:e}){const t=Gt(Lue);return T.jsx("div",{id:`${Bue}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:jue,children:t})}function Vue({rfId:e,disableKeyboardA11y:t}){const n=Gt(Pue);return T.jsxs(T.Fragment,{children:[T.jsx("div",{id:`${m6}-${e}`,style:p6,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),T.jsx("div",{id:`${g6}-${e}`,style:p6,children:n["edge.a11yDescription.default"]}),!t&&T.jsx(Hue,{rfId:e})]})}const M2=q.forwardRef(({position:e="top-left",children:t,className:n,style:r,...a},l)=>{const u=`${e}`.split("-");return T.jsx("div",{className:br(["react-flow__panel",n,...u]),style:r,ref:l,...a,children:t})});M2.displayName="Panel";function Fue({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:T.jsx(M2,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:T.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Gue=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},N2=e=>e.id;function Uue(e,t){return Xn(e.selectedNodes.map(N2),t.selectedNodes.map(N2))&&Xn(e.selectedEdges.map(N2),t.selectedEdges.map(N2))}function $ue({onSelectionChange:e}){const t=jn(),{selectedNodes:n,selectedEdges:r}=Gt(Gue,Uue);return q.useEffect(()=>{const a={nodes:n,edges:r};e?.(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[n,r,e]),null}const Xue=e=>!!e.onSelectionChangeHandlers;function Yue({onSelectionChange:e}){const t=Gt(Xue);return e||t?T.jsx($ue,{onSelectionChange:e}):null}const y6=[0,0],Zue={x:0,y:0,zoom:1},v6=[...["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","paneClickDistance","ariaLabelConfig"],"rfId"],Wue=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),b6={translateExtent:_v,nodeOrigin:y6,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function que(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:d,setDefaultNodesAndEdges:h,setPaneClickDistance:m}=Gt(Wue,Xn),y=jn();q.useEffect(()=>(h(e.defaultNodes,e.defaultEdges),()=>{v.current=b6,d()}),[]);const v=q.useRef(b6);return q.useEffect(()=>{for(const S of v6){const w=e[S],A=v.current[S];w!==A&&(typeof e[S]>"u"||(S==="nodes"?t(w):S==="edges"?n(w):S==="minZoom"?r(w):S==="maxZoom"?a(w):S==="translateExtent"?l(w):S==="nodeExtent"?u(w):S==="paneClickDistance"?m(w):S==="ariaLabelConfig"?y.setState({ariaLabelConfig:Gse(w)}):S==="fitView"?y.setState({fitViewQueued:w}):S==="fitViewOptions"?y.setState({fitViewOptions:w}):y.setState({[S]:w})))}v.current=e},v6.map(S=>e[S])),null}function x6(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Jue(e){const[t,n]=q.useState(e==="system"?null:e);return q.useEffect(()=>{if(e!=="system"){n(e);return}const r=x6(),a=()=>n(r?.matches?"dark":"light");return a(),r?.addEventListener("change",a),()=>{r?.removeEventListener("change",a)}},[e]),t!==null?t:x6()?.matches?"dark":"light"}const S6=typeof document<"u"?document:null;function Xu(e=null,t={target:S6,actInsideInputWithModifier:!0}){const[n,r]=q.useState(!1),a=q.useRef(!1),l=q.useRef(new Set([])),[u,d]=q.useMemo(()=>{if(e!==null){const m=(Array.isArray(e)?e:[e]).filter(v=>typeof v=="string").map(v=>v.replace("+",`
|
|
1078
1078
|
`).replace(`
|
|
1079
1079
|
|
|
1080
1080
|
`,`
|
|
@@ -1082,7 +1082,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1082
1082
|
`)),y=m.reduce((v,S)=>v.concat(...S),[]);return[m,y]}return[[],[]]},[e]);return q.useEffect(()=>{const h=t?.target??S6,m=t?.actInsideInputWithModifier??!0;if(e!==null){const y=w=>{if(a.current=w.ctrlKey||w.metaKey||w.shiftKey||w.altKey,(!a.current||a.current&&!m)&&H9(w))return!1;const E=E6(w.code,d);if(l.current.add(w[E]),w6(u,l.current,!1)){const k=w.composedPath?.()?.[0]||w.target,R=k?.nodeName==="BUTTON"||k?.nodeName==="A";t.preventDefault!==!1&&(a.current||!R)&&w.preventDefault(),r(!0)}},v=w=>{const A=E6(w.code,d);w6(u,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(w[A]),w.key==="Meta"&&l.current.clear(),a.current=!1},S=()=>{l.current.clear(),r(!1)};return h?.addEventListener("keydown",y),h?.addEventListener("keyup",v),window.addEventListener("blur",S),window.addEventListener("contextmenu",S),()=>{h?.removeEventListener("keydown",y),h?.removeEventListener("keyup",v),window.removeEventListener("blur",S),window.removeEventListener("contextmenu",S)}}},[e,r]),n}function w6(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(a=>t.has(a)))}function E6(e,t){return t.includes(e)?"code":"key"}const Que=()=>{const e=jn();return q.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,a,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??r,y:t.y??a,zoom:t.zoom??l},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:a,minZoom:l,maxZoom:u,panZoom:d}=e.getState(),h=vk(t,r,a,l,u,n?.padding??.1);return d?(await d.setViewport(h,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:a,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:d,y:h}=u.getBoundingClientRect(),m={x:t.x-d,y:t.y-h},y=n.snapGrid??a,v=n.snapToGrid??l;return Ov(m,r,v,y)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:a,y:l}=r.getBoundingClientRect(),u=_2(t,n);return{x:u.x+a,y:u.y+l}}}),[])};function C6(e,t){const n=[],r=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const u=r.get(l.id);u?u.push(l):r.set(l.id,[l])}for(const l of t){const u=r.get(l.id);if(!u){n.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){n.push({...u[0].item});continue}const d={...l};for(const h of u)Kue(h,d);n.push(d)}return a.length&&a.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function Kue(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function Nk(e,t){return C6(e,t)}function _6(e,t){return C6(e,t)}function ch(e,t){return{id:e,type:"select",selected:t}}function Um(e,t=new Set,n=!1){const r=[];for(const[a,l]of e){const u=t.has(a);!(l.selected===void 0&&!u)&&l.selected!==u&&(n&&(l.selected=u),r.push(ch(l.id,u)))}return r}function A6({items:e=[],lookup:t}){const n=[],r=new Map(e.map(a=>[a.id,a]));for(const[a,l]of e.entries()){const u=t.get(l.id),d=u?.internals?.userNode??u;d!==void 0&&d!==l&&n.push({id:l.id,item:l,type:"replace"}),d===void 0&&n.push({item:l,type:"add",index:a})}for(const[a]of t)r.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function T6(e){return{id:e.id,type:"remove"}}const k6=e=>Ise(e),ece=e=>k9(e);function R6(e){return q.forwardRef(e)}const tce=typeof window<"u"?q.useLayoutEffect:q.useEffect;function O6(e){const[t,n]=q.useState(BigInt(0)),[r]=q.useState(()=>nce(()=>n(a=>a+BigInt(1))));return tce(()=>{const a=r.get();a.length&&(e(a),r.reset())},[t]),r}function nce(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const M6=q.createContext(null);function rce({children:e}){const t=jn(),n=q.useCallback(d=>{const{nodes:h=[],setNodes:m,hasDefaultNodes:y,onNodesChange:v,nodeLookup:S,fitViewQueued:w}=t.getState();let A=h;for(const k of d)A=typeof k=="function"?k(A):k;const E=A6({items:A,lookup:S});y&&m(A),E.length>0?v?.(E):w&&window.requestAnimationFrame(()=>{const{fitViewQueued:k,nodes:R,setNodes:D}=t.getState();k&&D(R)})},[]),r=O6(n),a=q.useCallback(d=>{const{edges:h=[],setEdges:m,hasDefaultEdges:y,onEdgesChange:v,edgeLookup:S}=t.getState();let w=h;for(const A of d)w=typeof A=="function"?A(w):A;y?m(w):v&&v(A6({items:w,lookup:S}))},[]),l=O6(a),u=q.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return T.jsx(M6.Provider,{value:u,children:e})}function oce(){const e=q.useContext(M6);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const ace=e=>!!e.panZoom;function fh(){const e=Que(),t=jn(),n=oce(),r=Gt(ace),a=q.useMemo(()=>{const l=v=>t.getState().nodeLookup.get(v),u=v=>{n.nodeQueue.push(v)},d=v=>{n.edgeQueue.push(v)},h=v=>{const{nodeLookup:S,nodeOrigin:w}=t.getState(),A=k6(v)?v:S.get(v.id),E=A.parentId?B9(A.position,A.measured,A.parentId,S,w):A.position,k={...A,position:E,width:A.measured?.width??A.width,height:A.measured?.height??A.height};return Pm(k)},m=(v,S,w={replace:!1})=>{u(A=>A.map(E=>{if(E.id===v){const k=typeof S=="function"?S(E):S;return w.replace&&k6(k)?k:{...E,...k}}return E}))},y=(v,S,w={replace:!1})=>{d(A=>A.map(E=>{if(E.id===v){const k=typeof S=="function"?S(E):S;return w.replace&&ece(k)?k:{...E,...k}}return E}))};return{getNodes:()=>t.getState().nodes.map(v=>({...v})),getNode:v=>l(v)?.internals.userNode,getInternalNode:l,getEdges:()=>{const{edges:v=[]}=t.getState();return v.map(S=>({...S}))},getEdge:v=>t.getState().edgeLookup.get(v),setNodes:u,setEdges:d,addNodes:v=>{const S=Array.isArray(v)?v:[v];n.nodeQueue.push(w=>[...w,...S])},addEdges:v=>{const S=Array.isArray(v)?v:[v];n.edgeQueue.push(w=>[...w,...S])},toObject:()=>{const{nodes:v=[],edges:S=[],transform:w}=t.getState(),[A,E,k]=w;return{nodes:v.map(R=>({...R})),edges:S.map(R=>({...R})),viewport:{x:A,y:E,zoom:k}}},deleteElements:async({nodes:v=[],edges:S=[]})=>{const{nodes:w,edges:A,onNodesDelete:E,onEdgesDelete:k,triggerNodeChanges:R,triggerEdgeChanges:D,onDelete:M,onBeforeDelete:I}=t.getState(),{nodes:L,edges:P}=await Pse({nodesToRemove:v,edgesToRemove:S,nodes:w,edges:A,onBeforeDelete:I}),G=P.length>0,$=L.length>0;if(G){const Z=P.map(T6);k?.(P),D(Z)}if($){const Z=L.map(T6);E?.(L),R(Z)}return($||G)&&M?.({nodes:L,edges:P}),{deletedNodes:L,deletedEdges:P}},getIntersectingNodes:(v,S=!0,w)=>{const A=I9(v),E=A?v:h(v),k=w!==void 0;return E?(w||t.getState().nodes).filter(R=>{const D=t.getState().nodeLookup.get(R.id);if(D&&!A&&(R.id===v.id||!D.internals.positionAbsolute))return!1;const M=Pm(k?R:D),I=Rv(M,E);return S&&I>0||I>=M.width*M.height||I>=E.width*E.height}):[]},isNodeIntersecting:(v,S,w=!0)=>{const E=I9(v)?v:h(v);if(!E)return!1;const k=Rv(E,S);return w&&k>0||k>=E.width*E.height},updateNode:m,updateNodeData:(v,S,w={replace:!1})=>{m(v,A=>{const E=typeof S=="function"?S(A):S;return w.replace?{...A,data:E}:{...A,data:{...A.data,...E}}},w)},updateEdge:y,updateEdgeData:(v,S,w={replace:!1})=>{y(v,A=>{const E=typeof S=="function"?S(A):S;return w.replace?{...A,data:E}:{...A,data:{...A.data,...E}}},w)},getNodesBounds:v=>{const{nodeLookup:S,nodeOrigin:w}=t.getState();return zse(v,{nodeLookup:S,nodeOrigin:w})},getHandleConnections:({type:v,id:S,nodeId:w})=>Array.from(t.getState().connectionLookup.get(`${w}-${v}${S?`-${S}`:""}`)?.values()??[]),getNodeConnections:({type:v,handleId:S,nodeId:w})=>Array.from(t.getState().connectionLookup.get(`${w}${v?S?`-${v}-${S}`:`-${v}`:""}`)?.values()??[]),fitView:async v=>{const S=t.getState().fitViewResolver??Fse();return t.setState({fitViewQueued:!0,fitViewOptions:v,fitViewResolver:S}),n.nodeQueue.push(w=>[...w]),S.promise}}},[]);return q.useMemo(()=>({...a,...e,viewportInitialized:r}),[r])}const N6=e=>e.selected,ice=typeof window<"u"?window:void 0;function lce({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=jn(),{deleteElements:r}=fh(),a=Xu(e,{actInsideInputWithModifier:!1}),l=Xu(t,{target:ice});q.useEffect(()=>{if(a){const{edges:u,nodes:d}=n.getState();r({nodes:d.filter(N6),edges:u.filter(N6)}),n.setState({nodesSelectionActive:!1})}},[a]),q.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function sce(e){const t=jn();q.useEffect(()=>{const n=()=>{if(!e.current)return!1;const r=bk(e.current);(r.height===0||r.width===0)&&t.getState().onError?.("004",Va.error004()),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const D2={position:"absolute",width:"100%",height:"100%",top:0,left:0},uce=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function cce({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=sh.Free,zoomOnDoubleClick:u=!0,panOnDrag:d=!0,defaultViewport:h,translateExtent:m,minZoom:y,maxZoom:v,zoomActivationKeyCode:S,preventScrolling:w=!0,children:A,noWheelClassName:E,noPanClassName:k,onViewportChange:R,isControlledViewport:D,paneClickDistance:M}){const I=jn(),L=q.useRef(null),{userSelectionActive:P,lib:G}=Gt(uce,Xn),$=Xu(S),Z=q.useRef();sce(L);const j=q.useCallback(X=>{R?.({x:X[0],y:X[1],zoom:X[2]}),D||I.setState({transform:X})},[R,D]);return q.useEffect(()=>{if(L.current){Z.current=Eue({domNode:L.current,minZoom:y,maxZoom:v,translateExtent:m,viewport:h,paneClickDistance:M,onDraggingChange:U=>I.setState({paneDragging:U}),onPanZoomStart:(U,te)=>{const{onViewportChangeStart:V,onMoveStart:W}=I.getState();W?.(U,te),V?.(te)},onPanZoom:(U,te)=>{const{onViewportChange:V,onMove:W}=I.getState();W?.(U,te),V?.(te)},onPanZoomEnd:(U,te)=>{const{onViewportChangeEnd:V,onMoveEnd:W}=I.getState();W?.(U,te),V?.(te)}});const{x:X,y:ee,zoom:ae}=Z.current.getViewport();return I.setState({panZoom:Z.current,transform:[X,ee,ae],domNode:L.current.closest(".react-flow")}),()=>{Z.current?.destroy()}}},[]),q.useEffect(()=>{Z.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:d,zoomActivationKeyPressed:$,preventScrolling:w,noPanClassName:k,userSelectionActive:P,noWheelClassName:E,lib:G,onTransformChange:j})},[e,t,n,r,a,l,u,d,$,w,k,P,E,G,j]),T.jsx("div",{className:"react-flow__renderer",ref:L,style:D2,children:A})}const fce=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function dce(){const{userSelectionActive:e,userSelectionRect:t}=Gt(fce,Xn);return e&&t?T.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Dk=(e,t)=>n=>{n.target===t.current&&e?.(n)},hce=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function pce({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Av.Full,panOnDrag:r,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:m,onPaneMouseEnter:y,onPaneMouseMove:v,onPaneMouseLeave:S,children:w}){const A=jn(),{userSelectionActive:E,elementsSelectable:k,dragging:R,connectionInProgress:D}=Gt(hce,Xn),M=k&&(e||E),I=q.useRef(null),L=q.useRef(),P=q.useRef(new Set),G=q.useRef(new Set),$=q.useRef(!1),Z=q.useRef(!1),j=W=>{if($.current||D){$.current=!1;return}d?.(W),A.getState().resetSelectedElements(),A.setState({nodesSelectionActive:!1})},X=W=>{if(Array.isArray(r)&&r?.includes(2)){W.preventDefault();return}h?.(W)},ee=m?W=>m(W):void 0,ae=W=>{const{resetSelectedElements:Q,domNode:ne}=A.getState();if(L.current=ne?.getBoundingClientRect(),!k||!e||W.button!==0||W.target!==I.current||!L.current)return;W.target?.setPointerCapture?.(W.pointerId),Z.current=!0,$.current=!1;const{x:B,y:oe}=Os(W.nativeEvent,L.current);Q(),A.setState({userSelectionRect:{width:0,height:0,startX:B,startY:oe,x:B,y:oe}}),l?.(W)},U=W=>{const{userSelectionRect:Q,transform:ne,nodeLookup:B,edgeLookup:oe,connectionLookup:se,triggerNodeChanges:Y,triggerEdgeChanges:he,defaultEdgeOptions:ke}=A.getState();if(!L.current||!Q)return;$.current=!0;const{x:me,y:Ee}=Os(W.nativeEvent,L.current),{startX:xe,startY:Be}=Q,He={startX:xe,startY:Be,x:me<xe?me:xe,y:Ee<Be?Ee:Be,width:Math.abs(me-xe),height:Math.abs(Ee-Be)},Ye=P.current,Re=G.current;P.current=new Set(gk(B,He,ne,n===Av.Partial,!0).map(We=>We.id)),G.current=new Set;const Xe=ke?.selectable??!0;for(const We of P.current){const At=se.get(We);if(At)for(const{edgeId:Kt}of At.values()){const qt=oe.get(Kt);qt&&(qt.selectable??Xe)&&G.current.add(Kt)}}if(!L9(Ye,P.current)){const We=Um(B,P.current,!0);Y(We)}if(!L9(Re,G.current)){const We=Um(oe,G.current);he(We)}A.setState({userSelectionRect:He,userSelectionActive:!0,nodesSelectionActive:!1})},te=W=>{if(W.button!==0||!Z.current)return;W.target?.releasePointerCapture?.(W.pointerId);const{userSelectionRect:Q}=A.getState();!E&&Q&&W.target===I.current&&j?.(W),A.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:P.current.size>0}),u?.(W),(t||a)&&($.current=!1),Z.current=!1},V=r===!0||Array.isArray(r)&&r.includes(0);return T.jsxs("div",{className:br(["react-flow__pane",{draggable:V,dragging:R,selection:e}]),onClick:M?void 0:Dk(j,I),onContextMenu:Dk(X,I),onWheel:Dk(ee,I),onPointerEnter:M?void 0:y,onPointerDown:M?ae:v,onPointerMove:M?U:v,onPointerUp:M?te:void 0,onPointerLeave:S,ref:I,style:D2,children:[w,T.jsx(dce,{})]})}function Ik({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:d,onError:h}=t.getState(),m=d.get(e);if(!m){h?.("012",Va.error012(e));return}t.setState({nodesSelectionActive:!1}),m.selected?(n||m.selected&&u)&&(l({nodes:[m],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):a([e])}function D6({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:a,isSelectable:l,nodeClickDistance:u}){const d=jn(),[h,m]=q.useState(!1),y=q.useRef();return q.useEffect(()=>{y.current=sue({getStoreItems:()=>d.getState(),onNodeMouseDown:v=>{Ik({id:v,store:d,nodeRef:e})},onDragStart:()=>{m(!0)},onDragStop:()=>{m(!1)}})},[]),q.useEffect(()=>{if(t)y.current?.destroy();else if(e.current)return y.current?.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:u}),()=>{y.current?.destroy()}},[n,r,t,l,e,a]),h}const mce=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function I6(){const e=jn();return q.useCallback(n=>{const{nodeExtent:r,snapToGrid:a,snapGrid:l,nodesDraggable:u,onError:d,updateNodePositions:h,nodeLookup:m,nodeOrigin:y}=e.getState(),v=new Map,S=mce(u),w=a?l[0]:5,A=a?l[1]:5,E=n.direction.x*w*n.factor,k=n.direction.y*A*n.factor;for(const[,R]of m){if(!S(R))continue;let D={x:R.internals.positionAbsolute.x+E,y:R.internals.positionAbsolute.y+k};a&&(D=C2(D,l));const{position:M,positionAbsolute:I}=R9({nodeId:R.id,nextPosition:D,nodeLookup:m,nodeExtent:r,nodeOrigin:y,onError:d});R.position=M,R.internals.positionAbsolute=I,v.set(R.id,R)}h(v)},[])}const zk=q.createContext(null),gce=zk.Provider;zk.Consumer;const z6=()=>q.useContext(zk),yce=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),vce=(e,t,n)=>r=>{const{connectionClickStartHandle:a,connectionMode:l,connection:u}=r,{fromHandle:d,toHandle:h,isValid:m}=u,y=h?.nodeId===e&&h?.id===t&&h?.type===n;return{connectingFrom:d?.nodeId===e&&d?.id===t&&d?.type===n,connectingTo:y,clickConnecting:a?.nodeId===e&&a?.id===t&&a?.type===n,isPossibleEndHandle:l===Bm.Strict?d?.type!==n:e!==d?.nodeId||t!==d?.id,connectionInProcess:!!d,clickConnectionInProcess:!!a,valid:y&&m}};function bce({type:e="source",position:t=it.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:u,onConnect:d,children:h,className:m,onMouseDown:y,onTouchStart:v,...S},w){const A=u||null,E=e==="target",k=jn(),R=z6(),{connectOnClick:D,noPanClassName:M,rfId:I}=Gt(yce,Xn),{connectingFrom:L,connectingTo:P,clickConnecting:G,isPossibleEndHandle:$,connectionInProcess:Z,clickConnectionInProcess:j,valid:X}=Gt(vce(R,A,e),Xn);R||k.getState().onError?.("010",Va.error010());const ee=te=>{const{defaultEdgeOptions:V,onConnect:W,hasDefaultEdges:Q}=k.getState(),ne={...V,...te};if(Q){const{edges:B,setEdges:oe}=k.getState();oe(Wse(ne,B))}W?.(ne),d?.(ne)},ae=te=>{if(!R)return;const V=V9(te.nativeEvent);if(a&&(V&&te.button===0||!V)){const W=k.getState();Rk.onPointerDown(te.nativeEvent,{autoPanOnConnect:W.autoPanOnConnect,connectionMode:W.connectionMode,connectionRadius:W.connectionRadius,domNode:W.domNode,nodeLookup:W.nodeLookup,lib:W.lib,isTarget:E,handleId:A,nodeId:R,flowId:W.rfId,panBy:W.panBy,cancelConnection:W.cancelConnection,onConnectStart:W.onConnectStart,onConnectEnd:W.onConnectEnd,updateConnection:W.updateConnection,onConnect:ee,isValidConnection:n||W.isValidConnection,getTransform:()=>k.getState().transform,getFromHandle:()=>k.getState().connection.fromHandle,autoPanSpeed:W.autoPanSpeed,dragThreshold:W.connectionDragThreshold})}V?y?.(te):v?.(te)},U=te=>{const{onClickConnectStart:V,onClickConnectEnd:W,connectionClickStartHandle:Q,connectionMode:ne,isValidConnection:B,lib:oe,rfId:se,nodeLookup:Y,connection:he}=k.getState();if(!R||!Q&&!a)return;if(!Q){V?.(te.nativeEvent,{nodeId:R,handleId:A,handleType:e}),k.setState({connectionClickStartHandle:{nodeId:R,type:e,id:A}});return}const ke=P9(te.target),me=n||B,{connection:Ee,isValid:xe}=Rk.isValid(te.nativeEvent,{handle:{nodeId:R,id:A,type:e},connectionMode:ne,fromNodeId:Q.nodeId,fromHandleId:Q.id||null,fromType:Q.type,isValidConnection:me,flowId:se,doc:ke,lib:oe,nodeLookup:Y});xe&&Ee&&ee(Ee);const Be=structuredClone(he);delete Be.inProgress,Be.toPosition=Be.toHandle?Be.toHandle.position:null,W?.(te,Be),k.setState({connectionClickStartHandle:null})};return T.jsx("div",{"data-handleid":A,"data-nodeid":R,"data-handlepos":t,"data-id":`${I}-${R}-${A}-${e}`,className:br(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",M,m,{source:!E,target:E,connectable:r,connectablestart:a,connectableend:l,clickconnecting:G,connectingfrom:L,connectingto:P,valid:X,connectionindicator:r&&(!Z||$)&&(Z||j?l:a)}]),onMouseDown:ae,onTouchStart:ae,onClick:D?U:void 0,ref:w,...S,children:h})}const Dv=q.memo(R6(bce));function xce({data:e,isConnectable:t,sourcePosition:n=it.Bottom}){return T.jsxs(T.Fragment,{children:[e?.label,T.jsx(Dv,{type:"source",position:n,isConnectable:t})]})}function Sce({data:e,isConnectable:t,targetPosition:n=it.Top,sourcePosition:r=it.Bottom}){return T.jsxs(T.Fragment,{children:[T.jsx(Dv,{type:"target",position:n,isConnectable:t}),e?.label,T.jsx(Dv,{type:"source",position:r,isConnectable:t})]})}function wce(){return null}function Ece({data:e,isConnectable:t,targetPosition:n=it.Top}){return T.jsxs(T.Fragment,{children:[T.jsx(Dv,{type:"target",position:n,isConnectable:t}),e?.label]})}const I2={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},j6={input:xce,default:Sce,output:Ece,group:wce};function Cce(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const _ce=e=>{const{width:t,height:n,x:r,y:a}=kv(e.nodeLookup,{filter:l=>!!l.selected});return{width:kl(t)?t:null,height:kl(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${a}px)`}};function Ace({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=jn(),{width:a,height:l,transformString:u,userSelectionActive:d}=Gt(_ce,Xn),h=I6(),m=q.useRef(null);if(q.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),D6({nodeRef:m}),d||!a||!l)return null;const y=e?S=>{const w=r.getState().nodes.filter(A=>A.selected);e(S,w)}:void 0,v=S=>{Object.prototype.hasOwnProperty.call(I2,S.key)&&(S.preventDefault(),h({direction:I2[S.key],factor:S.shiftKey?4:1}))};return T.jsx("div",{className:br(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:T.jsx("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:n?void 0:-1,onKeyDown:n?void 0:v,style:{width:a,height:l}})})}const B6=typeof window<"u"?window:void 0,Tce=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function L6({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:d,deleteKeyCode:h,selectionKeyCode:m,selectionOnDrag:y,selectionMode:v,onSelectionStart:S,onSelectionEnd:w,multiSelectionKeyCode:A,panActivationKeyCode:E,zoomActivationKeyCode:k,elementsSelectable:R,zoomOnScroll:D,zoomOnPinch:M,panOnScroll:I,panOnScrollSpeed:L,panOnScrollMode:P,zoomOnDoubleClick:G,panOnDrag:$,defaultViewport:Z,translateExtent:j,minZoom:X,maxZoom:ee,preventScrolling:ae,onSelectionContextMenu:U,noWheelClassName:te,noPanClassName:V,disableKeyboardA11y:W,onViewportChange:Q,isControlledViewport:ne}){const{nodesSelectionActive:B,userSelectionActive:oe}=Gt(Tce),se=Xu(m,{target:B6}),Y=Xu(E,{target:B6}),he=Y||$,ke=Y||I,me=y&&he!==!0,Ee=se||oe||me;return lce({deleteKeyCode:h,multiSelectionKeyCode:A}),T.jsx(cce,{onPaneContextMenu:l,elementsSelectable:R,zoomOnScroll:D,zoomOnPinch:M,panOnScroll:ke,panOnScrollSpeed:L,panOnScrollMode:P,zoomOnDoubleClick:G,panOnDrag:!se&&he,defaultViewport:Z,translateExtent:j,minZoom:X,maxZoom:ee,zoomActivationKeyCode:k,preventScrolling:ae,noWheelClassName:te,noPanClassName:V,onViewportChange:Q,isControlledViewport:ne,paneClickDistance:d,children:T.jsxs(pce,{onSelectionStart:S,onSelectionEnd:w,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:he,isSelecting:!!Ee,selectionMode:v,selectionKeyPressed:se,selectionOnDrag:me,children:[e,B&&T.jsx(Ace,{onSelectionContextMenu:U,noPanClassName:V,disableKeyboardA11y:W})]})})}L6.displayName="FlowRenderer";const kce=q.memo(L6),Rce=e=>t=>e?gk(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Oce(e){return Gt(q.useCallback(Rce(e),[e]),Xn)}const Mce=e=>e.updateNodeInternals;function Nce(){const e=Gt(Mce),[t]=q.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(a=>{const l=a.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:a.target,force:!0})}),e(r)}));return q.useEffect(()=>()=>{t?.disconnect()},[t]),t}function Dce({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const a=jn(),l=q.useRef(null),u=q.useRef(null),d=q.useRef(e.sourcePosition),h=q.useRef(e.targetPosition),m=q.useRef(t),y=n&&!!e.internals.handleBounds;return q.useEffect(()=>{l.current&&!e.hidden&&(!y||u.current!==l.current)&&(u.current&&r?.unobserve(u.current),r?.observe(l.current),u.current=l.current)},[y,e.hidden]),q.useEffect(()=>()=>{u.current&&(r?.unobserve(u.current),u.current=null)},[]),q.useEffect(()=>{if(l.current){const v=m.current!==t,S=d.current!==e.sourcePosition,w=h.current!==e.targetPosition;(v||S||w)&&(m.current=t,d.current=e.sourcePosition,h.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function Ice({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:a,onContextMenu:l,onDoubleClick:u,nodesDraggable:d,elementsSelectable:h,nodesConnectable:m,nodesFocusable:y,resizeObserver:v,noDragClassName:S,noPanClassName:w,disableKeyboardA11y:A,rfId:E,nodeTypes:k,nodeClickDistance:R,onError:D}){const{node:M,internals:I,isParent:L}=Gt(xe=>{const Be=xe.nodeLookup.get(e),He=xe.parentLookup.has(e);return{node:Be,internals:Be.internals,isParent:He}},Xn);let P=M.type||"default",G=k?.[P]||j6[P];G===void 0&&(D?.("003",Va.error003(P)),P="default",G=k?.default||j6.default);const $=!!(M.draggable||d&&typeof M.draggable>"u"),Z=!!(M.selectable||h&&typeof M.selectable>"u"),j=!!(M.connectable||m&&typeof M.connectable>"u"),X=!!(M.focusable||y&&typeof M.focusable>"u"),ee=jn(),ae=j9(M),U=Dce({node:M,nodeType:P,hasDimensions:ae,resizeObserver:v}),te=D6({nodeRef:U,disabled:M.hidden||!$,noDragClassName:S,handleSelector:M.dragHandle,nodeId:e,isSelectable:Z,nodeClickDistance:R}),V=I6();if(M.hidden)return null;const W=$u(M),Q=Cce(M),ne=Z||$||t||n||r||a,B=n?xe=>n(xe,{...I.userNode}):void 0,oe=r?xe=>r(xe,{...I.userNode}):void 0,se=a?xe=>a(xe,{...I.userNode}):void 0,Y=l?xe=>l(xe,{...I.userNode}):void 0,he=u?xe=>u(xe,{...I.userNode}):void 0,ke=xe=>{const{selectNodesOnDrag:Be,nodeDragThreshold:He}=ee.getState();Z&&(!Be||!$||He>0)&&Ik({id:e,store:ee,nodeRef:U}),t&&t(xe,{...I.userNode})},me=xe=>{if(!(H9(xe.nativeEvent)||A)){if(E9.includes(xe.key)&&Z){const Be=xe.key==="Escape";Ik({id:e,store:ee,unselect:Be,nodeRef:U})}else if($&&M.selected&&Object.prototype.hasOwnProperty.call(I2,xe.key)){xe.preventDefault();const{ariaLabelConfig:Be}=ee.getState();ee.setState({ariaLiveMessage:Be["node.a11yDescription.ariaLiveMessage"]({direction:xe.key.replace("Arrow","").toLowerCase(),x:~~I.positionAbsolute.x,y:~~I.positionAbsolute.y})}),V({direction:I2[xe.key],factor:xe.shiftKey?4:1})}}},Ee=()=>{if(A||!U.current?.matches(":focus-visible"))return;const{transform:xe,width:Be,height:He,autoPanOnNodeFocus:Ye,setCenter:Re}=ee.getState();if(!Ye)return;gk(new Map([[e,M]]),{x:0,y:0,width:Be,height:He},xe,!0).length>0||Re(M.position.x+W.width/2,M.position.y+W.height/2,{zoom:xe[2]})};return T.jsx("div",{className:br(["react-flow__node",`react-flow__node-${P}`,{[w]:$},M.className,{selected:M.selected,selectable:Z,parent:L,draggable:$,dragging:te}]),ref:U,style:{zIndex:I.z,transform:`translate(${I.positionAbsolute.x}px,${I.positionAbsolute.y}px)`,pointerEvents:ne?"all":"none",visibility:ae?"visible":"hidden",...M.style,...Q},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:oe,onMouseLeave:se,onContextMenu:Y,onClick:ke,onDoubleClick:he,onKeyDown:X?me:void 0,tabIndex:X?0:void 0,onFocus:X?Ee:void 0,role:M.ariaRole??(X?"group":void 0),"aria-roledescription":"node","aria-describedby":A?void 0:`${m6}-${E}`,"aria-label":M.ariaLabel,...M.domAttributes,children:T.jsx(gce,{value:e,children:T.jsx(G,{id:e,data:M.data,type:P,positionAbsoluteX:I.positionAbsolute.x,positionAbsoluteY:I.positionAbsolute.y,selected:M.selected??!1,selectable:Z,draggable:$,deletable:M.deletable??!0,isConnectable:j,sourcePosition:M.sourcePosition,targetPosition:M.targetPosition,dragging:te,dragHandle:M.dragHandle,zIndex:I.z,parentId:M.parentId,...W})})})}const zce=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function P6(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,onError:l}=Gt(zce,Xn),u=Oce(e.onlyRenderVisibleElements),d=Nce();return T.jsx("div",{className:"react-flow__nodes",style:D2,children:u.map(h=>T.jsx(Ice,{id:h,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:d,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:l},h))})}P6.displayName="NodeRenderer";const jce=q.memo(P6);function Bce(e){return Gt(q.useCallback(n=>{if(!e)return n.edges.map(a=>a.id);const r=[];if(n.width&&n.height)for(const a of n.edges){const l=n.nodeLookup.get(a.source),u=n.nodeLookup.get(a.target);l&&u&&Xse({sourceNode:l,targetNode:u,width:n.width,height:n.height,transform:n.transform})&&r.push(a.id)}return r},[e]),Xn)}const Lce=({color:e="none",strokeWidth:t=1})=>T.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Pce=({color:e="none",strokeWidth:t=1})=>T.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),H6={[x2.Arrow]:Lce,[x2.ArrowClosed]:Pce};function Hce(e){const t=jn();return q.useMemo(()=>Object.prototype.hasOwnProperty.call(H6,e)?H6[e]:(t.getState().onError?.("009",Va.error009(e)),null),[e])}const Vce=({id:e,type:t,color:n,width:r=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:d="auto-start-reverse"})=>{const h=Hce(t);return h?T.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:d,refX:"0",refY:"0",children:T.jsx(h,{color:n,strokeWidth:u})}):null},V6=({defaultColor:e,rfId:t})=>{const n=Gt(l=>l.edges),r=Gt(l=>l.defaultEdgeOptions),a=q.useMemo(()=>eue(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return a.length?T.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:T.jsx("defs",{children:a.map(l=>T.jsx(Vce,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};V6.displayName="MarkerDefinitions";var Fce=q.memo(V6);function F6({x:e,y:t,label:n,labelStyle:r,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:d=2,children:h,className:m,...y}){const[v,S]=q.useState({x:1,y:0,width:0,height:0}),w=br(["react-flow__edge-textwrapper",m]),A=q.useRef(null);return q.useEffect(()=>{if(A.current){const E=A.current.getBBox();S({x:E.x,y:E.y,width:E.width,height:E.height})}},[n]),n?T.jsxs("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:w,visibility:v.width?"visible":"hidden",...y,children:[a&&T.jsx("rect",{width:v.width+2*u[0],x:-u[0],y:-u[1],height:v.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:d,ry:d}),T.jsx("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:A,style:r,children:n}),h]}):null}F6.displayName="EdgeText";const Gce=q.memo(F6);function Iv({path:e,labelX:t,labelY:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h,interactionWidth:m=20,...y}){return T.jsxs(T.Fragment,{children:[T.jsx("path",{...y,d:e,fill:"none",className:br(["react-flow__edge-path",y.className])}),m&&T.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:m,className:"react-flow__edge-interaction"}),r&&kl(t)&&kl(n)?T.jsx(Gce,{x:t,y:n,label:r,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:h}):null]})}function G6({pos:e,x1:t,y1:n,x2:r,y2:a}){return e===it.Left||e===it.Right?[.5*(t+r),n]:[t,.5*(n+a)]}function U6({sourceX:e,sourceY:t,sourcePosition:n=it.Bottom,targetX:r,targetY:a,targetPosition:l=it.Top}){const[u,d]=G6({pos:n,x1:e,y1:t,x2:r,y2:a}),[h,m]=G6({pos:l,x1:r,y1:a,x2:e,y2:t}),[y,v,S,w]=G9({sourceX:e,sourceY:t,targetX:r,targetY:a,sourceControlX:u,sourceControlY:d,targetControlX:h,targetControlY:m});return[`M${e},${t} C${u},${d} ${h},${m} ${r},${a}`,y,v,S,w]}function $6(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u,targetPosition:d,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:k,interactionWidth:R})=>{const[D,M,I]=U6({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:d}),L=e.isInternal?void 0:t;return T.jsx(Iv,{id:L,path:D,labelX:M,labelY:I,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:k,interactionWidth:R})})}const Uce=$6({isInternal:!1}),X6=$6({isInternal:!0});Uce.displayName="SimpleBezierEdge",X6.displayName="SimpleBezierEdgeInternal";function Y6(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,sourcePosition:w=it.Bottom,targetPosition:A=it.Top,markerEnd:E,markerStart:k,pathOptions:R,interactionWidth:D})=>{const[M,I,L]=Sk({sourceX:n,sourceY:r,sourcePosition:w,targetX:a,targetY:l,targetPosition:A,borderRadius:R?.borderRadius,offset:R?.offset,stepPosition:R?.stepPosition}),P=e.isInternal?void 0:t;return T.jsx(Iv,{id:P,path:M,labelX:I,labelY:L,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,markerEnd:E,markerStart:k,interactionWidth:D})})}const Z6=Y6({isInternal:!1}),W6=Y6({isInternal:!0});Z6.displayName="SmoothStepEdge",W6.displayName="SmoothStepEdgeInternal";function q6(e){return q.memo(({id:t,...n})=>{const r=e.isInternal?void 0:t;return T.jsx(Z6,{...n,id:r,pathOptions:q.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const $ce=q6({isInternal:!1}),J6=q6({isInternal:!0});$ce.displayName="StepEdge",J6.displayName="StepEdgeInternal";function Q6(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,markerEnd:w,markerStart:A,interactionWidth:E})=>{const[k,R,D]=X9({sourceX:n,sourceY:r,targetX:a,targetY:l}),M=e.isInternal?void 0:t;return T.jsx(Iv,{id:M,path:k,labelX:R,labelY:D,label:u,labelStyle:d,labelShowBg:h,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:v,style:S,markerEnd:w,markerStart:A,interactionWidth:E})})}const Xce=Q6({isInternal:!1}),K6=Q6({isInternal:!0});Xce.displayName="StraightEdge",K6.displayName="StraightEdgeInternal";function eB(e){return q.memo(({id:t,sourceX:n,sourceY:r,targetX:a,targetY:l,sourcePosition:u=it.Bottom,targetPosition:d=it.Top,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:k,pathOptions:R,interactionWidth:D})=>{const[M,I,L]=xk({sourceX:n,sourceY:r,sourcePosition:u,targetX:a,targetY:l,targetPosition:d,curvature:R?.curvature}),P=e.isInternal?void 0:t;return T.jsx(Iv,{id:P,path:M,labelX:I,labelY:L,label:h,labelStyle:m,labelShowBg:y,labelBgStyle:v,labelBgPadding:S,labelBgBorderRadius:w,style:A,markerEnd:E,markerStart:k,interactionWidth:D})})}const Yce=eB({isInternal:!1}),tB=eB({isInternal:!0});Yce.displayName="BezierEdge",tB.displayName="BezierEdgeInternal";const nB={default:tB,straight:K6,step:J6,smoothstep:W6,simplebezier:X6},rB={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Zce=(e,t,n)=>n===it.Left?e-t:n===it.Right?e+t:e,Wce=(e,t,n)=>n===it.Top?e-t:n===it.Bottom?e+t:e,oB="react-flow__edgeupdater";function aB({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:a,onMouseEnter:l,onMouseOut:u,type:d}){return T.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:u,className:br([oB,`${oB}-${d}`]),cx:Zce(t,r,e),cy:Wce(n,r,e),r,stroke:"transparent",fill:"transparent"})}function qce({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:a,targetX:l,targetY:u,sourcePosition:d,targetPosition:h,onReconnect:m,onReconnectStart:y,onReconnectEnd:v,setReconnecting:S,setUpdateHover:w}){const A=jn(),E=(I,L)=>{if(I.button!==0)return;const{autoPanOnConnect:P,domNode:G,isValidConnection:$,connectionMode:Z,connectionRadius:j,lib:X,onConnectStart:ee,onConnectEnd:ae,cancelConnection:U,nodeLookup:te,rfId:V,panBy:W,updateConnection:Q}=A.getState(),ne=L.type==="target",B=(Y,he)=>{S(!1),v?.(Y,n,L.type,he)},oe=Y=>m?.(n,Y),se=(Y,he)=>{S(!0),y?.(I,n,L.type),ee?.(Y,he)};Rk.onPointerDown(I.nativeEvent,{autoPanOnConnect:P,connectionMode:Z,connectionRadius:j,domNode:G,handleId:L.id,nodeId:L.nodeId,nodeLookup:te,isTarget:ne,edgeUpdaterType:L.type,lib:X,flowId:V,cancelConnection:U,panBy:W,isValidConnection:$,onConnect:oe,onConnectStart:se,onConnectEnd:ae,onReconnectEnd:B,updateConnection:Q,getTransform:()=>A.getState().transform,getFromHandle:()=>A.getState().connection.fromHandle,dragThreshold:A.getState().connectionDragThreshold})},k=I=>E(I,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),R=I=>E(I,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),D=()=>w(!0),M=()=>w(!1);return T.jsxs(T.Fragment,{children:[(e===!0||e==="source")&&T.jsx(aB,{position:d,centerX:r,centerY:a,radius:t,onMouseDown:k,onMouseEnter:D,onMouseOut:M,type:"source"}),(e===!0||e==="target")&&T.jsx(aB,{position:h,centerX:l,centerY:u,radius:t,onMouseDown:R,onMouseEnter:D,onMouseOut:M,type:"target"})]})}function Jce({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:a,onDoubleClick:l,onContextMenu:u,onMouseEnter:d,onMouseMove:h,onMouseLeave:m,reconnectRadius:y,onReconnect:v,onReconnectStart:S,onReconnectEnd:w,rfId:A,edgeTypes:E,noPanClassName:k,onError:R,disableKeyboardA11y:D}){let M=Gt(Re=>Re.edgeLookup.get(e));const I=Gt(Re=>Re.defaultEdgeOptions);M=I?{...I,...M}:M;let L=M.type||"default",P=E?.[L]||nB[L];P===void 0&&(R?.("011",Va.error011(L)),L="default",P=E?.default||nB.default);const G=!!(M.focusable||t&&typeof M.focusable>"u"),$=typeof v<"u"&&(M.reconnectable||n&&typeof M.reconnectable>"u"),Z=!!(M.selectable||r&&typeof M.selectable>"u"),j=q.useRef(null),[X,ee]=q.useState(!1),[ae,U]=q.useState(!1),te=jn(),{zIndex:V,sourceX:W,sourceY:Q,targetX:ne,targetY:B,sourcePosition:oe,targetPosition:se}=Gt(q.useCallback(Re=>{const Xe=Re.nodeLookup.get(M.source),We=Re.nodeLookup.get(M.target);if(!Xe||!We)return{zIndex:M.zIndex,...rB};const At=Kse({id:e,sourceNode:Xe,targetNode:We,sourceHandle:M.sourceHandle||null,targetHandle:M.targetHandle||null,connectionMode:Re.connectionMode,onError:R});return{zIndex:$se({selected:M.selected,zIndex:M.zIndex,sourceNode:Xe,targetNode:We,elevateOnSelect:Re.elevateEdgesOnSelect}),...At||rB}},[M.source,M.target,M.sourceHandle,M.targetHandle,M.selected,M.zIndex]),Xn),Y=q.useMemo(()=>M.markerStart?`url('#${wk(M.markerStart,A)}')`:void 0,[M.markerStart,A]),he=q.useMemo(()=>M.markerEnd?`url('#${wk(M.markerEnd,A)}')`:void 0,[M.markerEnd,A]);if(M.hidden||W===null||Q===null||ne===null||B===null)return null;const ke=Re=>{const{addSelectedEdges:Xe,unselectNodesAndEdges:We,multiSelectionActive:At}=te.getState();Z&&(te.setState({nodesSelectionActive:!1}),M.selected&&At?(We({nodes:[],edges:[M]}),j.current?.blur()):Xe([e])),a&&a(Re,M)},me=l?Re=>{l(Re,{...M})}:void 0,Ee=u?Re=>{u(Re,{...M})}:void 0,xe=d?Re=>{d(Re,{...M})}:void 0,Be=h?Re=>{h(Re,{...M})}:void 0,He=m?Re=>{m(Re,{...M})}:void 0,Ye=Re=>{if(!D&&E9.includes(Re.key)&&Z){const{unselectNodesAndEdges:Xe,addSelectedEdges:We}=te.getState();Re.key==="Escape"?(j.current?.blur(),Xe({edges:[M]})):We([e])}};return T.jsx("svg",{style:{zIndex:V},children:T.jsxs("g",{className:br(["react-flow__edge",`react-flow__edge-${L}`,M.className,k,{selected:M.selected,animated:M.animated,inactive:!Z&&!a,updating:X,selectable:Z}]),onClick:ke,onDoubleClick:me,onContextMenu:Ee,onMouseEnter:xe,onMouseMove:Be,onMouseLeave:He,onKeyDown:G?Ye:void 0,tabIndex:G?0:void 0,role:M.ariaRole??(G?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":M.ariaLabel===null?void 0:M.ariaLabel||`Edge from ${M.source} to ${M.target}`,"aria-describedby":G?`${g6}-${A}`:void 0,ref:j,...M.domAttributes,children:[!ae&&T.jsx(P,{id:e,source:M.source,target:M.target,type:M.type,selected:M.selected,animated:M.animated,selectable:Z,deletable:M.deletable??!0,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,sourceX:W,sourceY:Q,targetX:ne,targetY:B,sourcePosition:oe,targetPosition:se,data:M.data,style:M.style,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerStart:Y,markerEnd:he,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth}),$&&T.jsx(qce,{edge:M,isReconnectable:$,reconnectRadius:y,onReconnect:v,onReconnectStart:S,onReconnectEnd:w,sourceX:W,sourceY:Q,targetX:ne,targetY:B,sourcePosition:oe,targetPosition:se,setUpdateHover:ee,setReconnecting:U})]})})}const Qce=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function iB({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:a,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:d,onEdgeMouseMove:h,onEdgeMouseLeave:m,onEdgeClick:y,reconnectRadius:v,onEdgeDoubleClick:S,onReconnectStart:w,onReconnectEnd:A,disableKeyboardA11y:E}){const{edgesFocusable:k,edgesReconnectable:R,elementsSelectable:D,onError:M}=Gt(Qce,Xn),I=Bce(t);return T.jsxs("div",{className:"react-flow__edges",children:[T.jsx(Fce,{defaultColor:e,rfId:n}),I.map(L=>T.jsx(Jce,{id:L,edgesFocusable:k,edgesReconnectable:R,elementsSelectable:D,noPanClassName:a,onReconnect:l,onContextMenu:u,onMouseEnter:d,onMouseMove:h,onMouseLeave:m,onClick:y,reconnectRadius:v,onDoubleClick:S,onReconnectStart:w,onReconnectEnd:A,rfId:n,onError:M,edgeTypes:r,disableKeyboardA11y:E},L))]})}iB.displayName="EdgeRenderer";const Kce=q.memo(iB),efe=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function tfe({children:e}){const t=Gt(efe);return T.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function nfe(e){const t=fh(),n=q.useRef(!1);q.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const rfe=e=>e.panZoom?.syncViewport;function ofe(e){const t=Gt(rfe),n=jn();return q.useEffect(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function afe(e){return e.connection.inProgress?{...e.connection,to:Ov(e.connection.to,e.transform)}:{...e.connection}}function ife(e){return afe}function lfe(e){const t=ife();return Gt(t,Xn)}const sfe=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function ufe({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:a,width:l,height:u,isValid:d,inProgress:h}=Gt(sfe,Xn);return!(l&&a&&h)?null:T.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:T.jsx("g",{className:br(["react-flow__connection",T9(d)]),children:T.jsx(lB,{style:t,type:n,CustomComponent:r,isValid:d})})})}const lB=({style:e,type:t=xf.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:a,from:l,fromNode:u,fromHandle:d,fromPosition:h,to:m,toNode:y,toHandle:v,toPosition:S}=lfe();if(!a)return;if(n)return T.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:d,fromX:l.x,fromY:l.y,toX:m.x,toY:m.y,fromPosition:h,toPosition:S,connectionStatus:T9(r),toNode:y,toHandle:v});let w="";const A={sourceX:l.x,sourceY:l.y,sourcePosition:h,targetX:m.x,targetY:m.y,targetPosition:S};switch(t){case xf.Bezier:[w]=xk(A);break;case xf.SimpleBezier:[w]=U6(A);break;case xf.Step:[w]=Sk({...A,borderRadius:0});break;case xf.SmoothStep:[w]=Sk(A);break;default:[w]=X9(A)}return T.jsx("path",{d:w,fill:"none",className:"react-flow__connection-path",style:e})};lB.displayName="ConnectionLine";const cfe={};function sB(e=cfe){const t=q.useRef(e),n=jn();q.useEffect(()=>{if(process.env.NODE_ENV==="development"){const r=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const a of r)if(t.current[a]!==e[a]){n.getState().onError?.("002",Va.error002());break}t.current=e}},[e])}function ffe(){const e=jn(),t=q.useRef(!1);q.useEffect(()=>{if(process.env.NODE_ENV==="development"&&!t.current){const n=document.querySelector(".react-flow__pane");n&&window.getComputedStyle(n).zIndex!=="1"&&e.getState().onError?.("013",Va.error013("react")),t.current=!0}},[])}function uB({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:m,onNodeContextMenu:y,onSelectionContextMenu:v,onSelectionStart:S,onSelectionEnd:w,connectionLineType:A,connectionLineStyle:E,connectionLineComponent:k,connectionLineContainerStyle:R,selectionKeyCode:D,selectionOnDrag:M,selectionMode:I,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:G,deleteKeyCode:$,onlyRenderVisibleElements:Z,elementsSelectable:j,defaultViewport:X,translateExtent:ee,minZoom:ae,maxZoom:U,preventScrolling:te,defaultMarkerColor:V,zoomOnScroll:W,zoomOnPinch:Q,panOnScroll:ne,panOnScrollSpeed:B,panOnScrollMode:oe,zoomOnDoubleClick:se,panOnDrag:Y,onPaneClick:he,onPaneMouseEnter:ke,onPaneMouseMove:me,onPaneMouseLeave:Ee,onPaneScroll:xe,onPaneContextMenu:Be,paneClickDistance:He,nodeClickDistance:Ye,onEdgeContextMenu:Re,onEdgeMouseEnter:Xe,onEdgeMouseMove:We,onEdgeMouseLeave:At,reconnectRadius:Kt,onReconnect:qt,onReconnectStart:er,onReconnectEnd:da,noDragClassName:xo,noWheelClassName:So,noPanClassName:ut,disableKeyboardA11y:wo,nodeExtent:qu,rfId:Ol,viewport:Oe,onViewportChange:Le}){return sB(e),sB(t),ffe(),nfe(n),ofe(Oe),T.jsx(kce,{onPaneClick:he,onPaneMouseEnter:ke,onPaneMouseMove:me,onPaneMouseLeave:Ee,onPaneContextMenu:Be,onPaneScroll:xe,paneClickDistance:He,deleteKeyCode:$,selectionKeyCode:D,selectionOnDrag:M,selectionMode:I,onSelectionStart:S,onSelectionEnd:w,multiSelectionKeyCode:L,panActivationKeyCode:P,zoomActivationKeyCode:G,elementsSelectable:j,zoomOnScroll:W,zoomOnPinch:Q,zoomOnDoubleClick:se,panOnScroll:ne,panOnScrollSpeed:B,panOnScrollMode:oe,panOnDrag:Y,defaultViewport:X,translateExtent:ee,minZoom:ae,maxZoom:U,onSelectionContextMenu:v,preventScrolling:te,noDragClassName:xo,noWheelClassName:So,noPanClassName:ut,disableKeyboardA11y:wo,onViewportChange:Le,isControlledViewport:!!Oe,children:T.jsxs(tfe,{children:[T.jsx(Kce,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:qt,onReconnectStart:er,onReconnectEnd:da,onlyRenderVisibleElements:Z,onEdgeContextMenu:Re,onEdgeMouseEnter:Xe,onEdgeMouseMove:We,onEdgeMouseLeave:At,reconnectRadius:Kt,defaultMarkerColor:V,noPanClassName:ut,disableKeyboardA11y:wo,rfId:Ol}),T.jsx(ufe,{style:E,type:A,component:k,containerStyle:R}),T.jsx("div",{className:"react-flow__edgelabel-renderer"}),T.jsx(jce,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:d,onNodeMouseMove:h,onNodeMouseLeave:m,onNodeContextMenu:y,nodeClickDistance:Ye,onlyRenderVisibleElements:Z,noPanClassName:ut,noDragClassName:xo,disableKeyboardA11y:wo,nodeExtent:qu,rfId:Ol}),T.jsx("div",{className:"react-flow__viewport-portal"})]})})}uB.displayName="GraphView";const dfe=q.memo(uB),cB=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:h=.5,maxZoom:m=2,nodeOrigin:y,nodeExtent:v}={})=>{const S=new Map,w=new Map,A=new Map,E=new Map,k=r??t??[],R=n??e??[],D=y??[0,0],M=v??_v;e6(A,E,k);const I=_k(R,S,w,{nodeOrigin:D,nodeExtent:M,elevateNodesOnSelect:!1});let L=[0,0,1];if(u&&a&&l){const P=kv(S,{filter:j=>!!((j.width||j.initialWidth)&&(j.height||j.initialHeight))}),{x:G,y:$,zoom:Z}=vk(P,a,l,h,m,d?.padding??.1);L=[G,$,Z]}return{rfId:"1",width:0,height:0,transform:L,nodes:R,nodesInitialized:I,nodeLookup:S,parentLookup:w,edges:k,edgeLookup:E,connectionLookup:A,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:h,maxZoom:m,translateExtent:_v,nodeExtent:M,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Bm.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:D,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:d,fitViewResolver:null,connection:{..._9},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:z9,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:C9}},hfe=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:y,nodeExtent:v})=>Iue((S,w)=>{async function A(){const{nodeLookup:E,panZoom:k,fitViewOptions:R,fitViewResolver:D,width:M,height:I,minZoom:L,maxZoom:P}=w();k&&(await Lse({nodes:E,width:M,height:I,panZoom:k,minZoom:L,maxZoom:P},R),D?.resolve(!0),S({fitViewResolver:null}))}return{...cB({nodes:e,edges:t,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:m,nodeOrigin:y,nodeExtent:v,defaultNodes:n,defaultEdges:r}),setNodes:E=>{const{nodeLookup:k,parentLookup:R,nodeOrigin:D,elevateNodesOnSelect:M,fitViewQueued:I}=w(),L=_k(E,k,R,{nodeOrigin:D,nodeExtent:v,elevateNodesOnSelect:M,checkEquality:!0});I&&L?(A(),S({nodes:E,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0})):S({nodes:E,nodesInitialized:L})},setEdges:E=>{const{connectionLookup:k,edgeLookup:R}=w();e6(k,R,E),S({edges:E})},setDefaultNodesAndEdges:(E,k)=>{if(E){const{setNodes:R}=w();R(E),S({hasDefaultNodes:!0})}if(k){const{setEdges:R}=w();R(k),S({hasDefaultEdges:!0})}},updateNodeInternals:E=>{const{triggerNodeChanges:k,nodeLookup:R,parentLookup:D,domNode:M,nodeOrigin:I,nodeExtent:L,debug:P,fitViewQueued:G}=w(),{changes:$,updatedInternals:Z}=aue(E,R,D,M,I,L);Z&&(nue(R,D,{nodeOrigin:I,nodeExtent:L}),G?(A(),S({fitViewQueued:!1,fitViewOptions:void 0})):S({}),$?.length>0&&(P&&console.log("React Flow: trigger node changes",$),k?.($)))},updateNodePositions:(E,k=!1)=>{const R=[],D=[],{nodeLookup:M,triggerNodeChanges:I}=w();for(const[L,P]of E){const G=M.get(L),$=!!(G?.expandParent&&G?.parentId&&P?.position),Z={id:L,type:"position",position:$?{x:Math.max(0,P.position.x),y:Math.max(0,P.position.y)}:P.position,dragging:k};$&&G.parentId&&R.push({id:L,parentId:G.parentId,rect:{...P.internals.positionAbsolute,width:P.measured.width??0,height:P.measured.height??0}}),D.push(Z)}if(R.length>0){const{parentLookup:L,nodeOrigin:P}=w(),G=Tk(R,M,L,P);D.push(...G)}I(D)},triggerNodeChanges:E=>{const{onNodesChange:k,setNodes:R,nodes:D,hasDefaultNodes:M,debug:I}=w();if(E?.length){if(M){const L=Nk(E,D);R(L)}I&&console.log("React Flow: trigger node changes",E),k?.(E)}},triggerEdgeChanges:E=>{const{onEdgesChange:k,setEdges:R,edges:D,hasDefaultEdges:M,debug:I}=w();if(E?.length){if(M){const L=_6(E,D);R(L)}I&&console.log("React Flow: trigger edge changes",E),k?.(E)}},addSelectedNodes:E=>{const{multiSelectionActive:k,edgeLookup:R,nodeLookup:D,triggerNodeChanges:M,triggerEdgeChanges:I}=w();if(k){const L=E.map(P=>ch(P,!0));M(L);return}M(Um(D,new Set([...E]),!0)),I(Um(R))},addSelectedEdges:E=>{const{multiSelectionActive:k,edgeLookup:R,nodeLookup:D,triggerNodeChanges:M,triggerEdgeChanges:I}=w();if(k){const L=E.map(P=>ch(P,!0));I(L);return}I(Um(R,new Set([...E]))),M(Um(D,new Set,!0))},unselectNodesAndEdges:({nodes:E,edges:k}={})=>{const{edges:R,nodes:D,nodeLookup:M,triggerNodeChanges:I,triggerEdgeChanges:L}=w(),P=E||D,G=k||R,$=P.map(j=>{const X=M.get(j.id);return X&&(X.selected=!1),ch(j.id,!1)}),Z=G.map(j=>ch(j.id,!1));I($),L(Z)},setMinZoom:E=>{const{panZoom:k,maxZoom:R}=w();k?.setScaleExtent([E,R]),S({minZoom:E})},setMaxZoom:E=>{const{panZoom:k,minZoom:R}=w();k?.setScaleExtent([R,E]),S({maxZoom:E})},setTranslateExtent:E=>{w().panZoom?.setTranslateExtent(E),S({translateExtent:E})},setPaneClickDistance:E=>{w().panZoom?.setClickDistance(E)},resetSelectedElements:()=>{const{edges:E,nodes:k,triggerNodeChanges:R,triggerEdgeChanges:D,elementsSelectable:M}=w();if(!M)return;const I=k.reduce((P,G)=>G.selected?[...P,ch(G.id,!1)]:P,[]),L=E.reduce((P,G)=>G.selected?[...P,ch(G.id,!1)]:P,[]);R(I),D(L)},setNodeExtent:E=>{const{nodes:k,nodeLookup:R,parentLookup:D,nodeOrigin:M,elevateNodesOnSelect:I,nodeExtent:L}=w();E[0][0]===L[0][0]&&E[0][1]===L[0][1]&&E[1][0]===L[1][0]&&E[1][1]===L[1][1]||(_k(k,R,D,{nodeOrigin:M,nodeExtent:E,elevateNodesOnSelect:I,checkEquality:!1}),S({nodeExtent:E}))},panBy:E=>{const{transform:k,width:R,height:D,panZoom:M,translateExtent:I}=w();return iue({delta:E,panZoom:M,transform:k,translateExtent:I,width:R,height:D})},setCenter:async(E,k,R)=>{const{width:D,height:M,maxZoom:I,panZoom:L}=w();if(!L)return Promise.resolve(!1);const P=typeof R?.zoom<"u"?R.zoom:I;return await L.setViewport({x:D/2-E*P,y:M/2-k*P,zoom:P},{duration:R?.duration,ease:R?.ease,interpolate:R?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{S({connection:{..._9}})},updateConnection:E=>{S({connection:E})},reset:()=>S({...cB()})}},Object.is);function pfe({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:a,initialHeight:l,initialMinZoom:u,initialMaxZoom:d,initialFitViewOptions:h,fitView:m,nodeOrigin:y,nodeExtent:v,children:S}){const[w]=q.useState(()=>hfe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:a,height:l,fitView:m,minZoom:u,maxZoom:d,fitViewOptions:h,nodeOrigin:y,nodeExtent:v}));return T.jsx(zue,{value:w,children:T.jsx(rce,{children:S})})}function mfe({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:a,width:l,height:u,fitView:d,fitViewOptions:h,minZoom:m,maxZoom:y,nodeOrigin:v,nodeExtent:S}){return q.useContext(O2)?T.jsx(T.Fragment,{children:e}):T.jsx(pfe,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:a,initialWidth:l,initialHeight:u,fitView:d,initialFitViewOptions:h,initialMinZoom:m,initialMaxZoom:y,nodeOrigin:v,nodeExtent:S,children:e})}const gfe={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function yfe({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:a,nodeTypes:l,edgeTypes:u,onNodeClick:d,onEdgeClick:h,onInit:m,onMove:y,onMoveStart:v,onMoveEnd:S,onConnect:w,onConnectStart:A,onConnectEnd:E,onClickConnectStart:k,onClickConnectEnd:R,onNodeMouseEnter:D,onNodeMouseMove:M,onNodeMouseLeave:I,onNodeContextMenu:L,onNodeDoubleClick:P,onNodeDragStart:G,onNodeDrag:$,onNodeDragStop:Z,onNodesDelete:j,onEdgesDelete:X,onDelete:ee,onSelectionChange:ae,onSelectionDragStart:U,onSelectionDrag:te,onSelectionDragStop:V,onSelectionContextMenu:W,onSelectionStart:Q,onSelectionEnd:ne,onBeforeDelete:B,connectionMode:oe,connectionLineType:se=xf.Bezier,connectionLineStyle:Y,connectionLineComponent:he,connectionLineContainerStyle:ke,deleteKeyCode:me="Backspace",selectionKeyCode:Ee="Shift",selectionOnDrag:xe=!1,selectionMode:Be=Av.Full,panActivationKeyCode:He="Space",multiSelectionKeyCode:Ye=A2()?"Meta":"Control",zoomActivationKeyCode:Re=A2()?"Meta":"Control",snapToGrid:Xe,snapGrid:We,onlyRenderVisibleElements:At=!1,selectNodesOnDrag:Kt,nodesDraggable:qt,autoPanOnNodeFocus:er,nodesConnectable:da,nodesFocusable:xo,nodeOrigin:So=y6,edgesFocusable:ut,edgesReconnectable:wo,elementsSelectable:qu=!0,defaultViewport:Ol=Zue,minZoom:Oe=.5,maxZoom:Le=2,translateExtent:tt=_v,preventScrolling:st=!0,nodeExtent:Bt,defaultMarkerColor:Xr="#b1b1b7",zoomOnScroll:Ua=!0,zoomOnPinch:Sr=!0,panOnScroll:Mr=!1,panOnScrollSpeed:Yn=.5,panOnScrollMode:An=sh.Free,zoomOnDoubleClick:sr=!0,panOnDrag:en=!0,onPaneClick:vi,onPaneMouseEnter:Ml,onPaneMouseMove:bi,onPaneMouseLeave:Nl,onPaneScroll:tg,onPaneContextMenu:Ju,paneClickDistance:Is=0,nodeClickDistance:Go=0,children:Tf,onReconnect:ng,onReconnectStart:ab,onReconnectEnd:Zn,onEdgeContextMenu:tr,onEdgeDoubleClick:Nr,onEdgeMouseEnter:zs,onEdgeMouseMove:kf,onEdgeMouseLeave:rg,reconnectRadius:Rf=10,onNodesChange:og,onEdgesChange:qe,noDragClassName:Qu="nodrag",noWheelClassName:ur="nowheel",noPanClassName:xi="nopan",fitView:js,fitViewOptions:ha,connectOnClick:Wn,attributionPosition:Ku,proOptions:no,defaultEdgeOptions:Si,elevateNodesOnSelect:wi,elevateEdgesOnSelect:ag,disableKeyboardA11y:ec=!1,autoPanOnConnect:bh,autoPanOnNodeDrag:ig,autoPanSpeed:$a,connectionRadius:tc,isValidConnection:pa,onError:Of,style:xh,id:Ei,nodeDragThreshold:Dr,connectionDragThreshold:Ci,viewport:Dl,onViewportChange:Sh,width:wr,height:nc,colorMode:wh="light",debug:_i,onScroll:Ai,ariaLabelConfig:Bs,...ib},Eo){const Ls=Ei||"1",Mf=Jue(wh),rc=q.useCallback(Ti=>{Ti.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Ai?.(Ti)},[Ai]);return T.jsx("div",{"data-testid":"rf__wrapper",...ib,onScroll:rc,style:{...xh,...gfe},ref:Eo,className:br(["react-flow",a,Mf]),id:Ei,role:"application",children:T.jsxs(mfe,{nodes:e,edges:t,width:wr,height:nc,fitView:js,fitViewOptions:ha,minZoom:Oe,maxZoom:Le,nodeOrigin:So,nodeExtent:Bt,children:[T.jsx(dfe,{onInit:m,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:D,onNodeMouseMove:M,onNodeMouseLeave:I,onNodeContextMenu:L,onNodeDoubleClick:P,nodeTypes:l,edgeTypes:u,connectionLineType:se,connectionLineStyle:Y,connectionLineComponent:he,connectionLineContainerStyle:ke,selectionKeyCode:Ee,selectionOnDrag:xe,selectionMode:Be,deleteKeyCode:me,multiSelectionKeyCode:Ye,panActivationKeyCode:He,zoomActivationKeyCode:Re,onlyRenderVisibleElements:At,defaultViewport:Ol,translateExtent:tt,minZoom:Oe,maxZoom:Le,preventScrolling:st,zoomOnScroll:Ua,zoomOnPinch:Sr,zoomOnDoubleClick:sr,panOnScroll:Mr,panOnScrollSpeed:Yn,panOnScrollMode:An,panOnDrag:en,onPaneClick:vi,onPaneMouseEnter:Ml,onPaneMouseMove:bi,onPaneMouseLeave:Nl,onPaneScroll:tg,onPaneContextMenu:Ju,paneClickDistance:Is,nodeClickDistance:Go,onSelectionContextMenu:W,onSelectionStart:Q,onSelectionEnd:ne,onReconnect:ng,onReconnectStart:ab,onReconnectEnd:Zn,onEdgeContextMenu:tr,onEdgeDoubleClick:Nr,onEdgeMouseEnter:zs,onEdgeMouseMove:kf,onEdgeMouseLeave:rg,reconnectRadius:Rf,defaultMarkerColor:Xr,noDragClassName:Qu,noWheelClassName:ur,noPanClassName:xi,rfId:Ls,disableKeyboardA11y:ec,nodeExtent:Bt,viewport:Dl,onViewportChange:Sh}),T.jsx(que,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:w,onConnectStart:A,onConnectEnd:E,onClickConnectStart:k,onClickConnectEnd:R,nodesDraggable:qt,autoPanOnNodeFocus:er,nodesConnectable:da,nodesFocusable:xo,edgesFocusable:ut,edgesReconnectable:wo,elementsSelectable:qu,elevateNodesOnSelect:wi,elevateEdgesOnSelect:ag,minZoom:Oe,maxZoom:Le,nodeExtent:Bt,onNodesChange:og,onEdgesChange:qe,snapToGrid:Xe,snapGrid:We,connectionMode:oe,translateExtent:tt,connectOnClick:Wn,defaultEdgeOptions:Si,fitView:js,fitViewOptions:ha,onNodesDelete:j,onEdgesDelete:X,onDelete:ee,onNodeDragStart:G,onNodeDrag:$,onNodeDragStop:Z,onSelectionDrag:te,onSelectionDragStart:U,onSelectionDragStop:V,onMove:y,onMoveStart:v,onMoveEnd:S,noPanClassName:xi,nodeOrigin:So,rfId:Ls,autoPanOnConnect:bh,autoPanOnNodeDrag:ig,autoPanSpeed:$a,onError:Of,connectionRadius:tc,isValidConnection:pa,selectNodesOnDrag:Kt,nodeDragThreshold:Dr,connectionDragThreshold:Ci,onBeforeDelete:B,paneClickDistance:Is,debug:_i,ariaLabelConfig:Bs}),T.jsx(Yue,{onSelectionChange:ae}),Tf,T.jsx(Fue,{proOptions:no,position:Ku}),T.jsx(Vue,{rfId:Ls,disableKeyboardA11y:ec})]})})}var vfe=R6(yfe);function bfe({dimensions:e,lineWidth:t,variant:n,className:r}){return T.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:br(["react-flow__background-pattern",n,r])})}function xfe({radius:e,className:t}){return T.jsx("circle",{cx:e,cy:e,r:e,className:br(["react-flow__background-pattern","dots",t])})}var Po;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Po||(Po={}));const Sfe={[Po.Dots]:1,[Po.Lines]:1,[Po.Cross]:6},wfe=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function fB({id:e,variant:t=Po.Dots,gap:n=20,size:r,lineWidth:a=1,offset:l=0,color:u,bgColor:d,style:h,className:m,patternClassName:y}){const v=q.useRef(null),{transform:S,patternId:w}=Gt(wfe,Xn),A=r||Sfe[t],E=t===Po.Dots,k=t===Po.Cross,R=Array.isArray(n)?n:[n,n],D=[R[0]*S[2]||1,R[1]*S[2]||1],M=A*S[2],I=Array.isArray(l)?l:[l,l],L=k?[M,M]:D,P=[I[0]*S[2]||1+L[0]/2,I[1]*S[2]||1+L[1]/2],G=`${w}${e||""}`;return T.jsxs("svg",{className:br(["react-flow__background",m]),style:{...h,...D2,"--xy-background-color-props":d,"--xy-background-pattern-color-props":u},ref:v,"data-testid":"rf__background",children:[T.jsx("pattern",{id:G,x:S[0]%D[0],y:S[1]%D[1],width:D[0],height:D[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${P[0]},-${P[1]})`,children:E?T.jsx(xfe,{radius:M/2,className:y}):T.jsx(bfe,{dimensions:L,lineWidth:a,variant:t,className:y})}),T.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${G})`})]})}fB.displayName="Background";const Efe=q.memo(fB);function Cfe(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:T.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function _fe(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:T.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Afe(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:T.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 Tfe(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.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 kfe(){return T.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:T.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 z2({children:e,className:t,...n}){return T.jsx("button",{type:"button",className:br(["react-flow__controls-button",t]),...n,children:e})}const Rfe=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function dB({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:u,onFitView:d,onInteractiveChange:h,className:m,children:y,position:v="bottom-left",orientation:S="vertical","aria-label":w}){const A=jn(),{isInteractive:E,minZoomReached:k,maxZoomReached:R,ariaLabelConfig:D}=Gt(Rfe,Xn),{zoomIn:M,zoomOut:I,fitView:L}=fh(),P=()=>{M(),l?.()},G=()=>{I(),u?.()},$=()=>{L(a),d?.()},Z=()=>{A.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),h?.(!E)},j=S==="horizontal"?"horizontal":"vertical";return T.jsxs(M2,{className:br(["react-flow__controls",j,m]),position:v,style:e,"data-testid":"rf__controls","aria-label":w??D["controls.ariaLabel"],children:[t&&T.jsxs(T.Fragment,{children:[T.jsx(z2,{onClick:P,className:"react-flow__controls-zoomin",title:D["controls.zoomIn.ariaLabel"],"aria-label":D["controls.zoomIn.ariaLabel"],disabled:R,children:T.jsx(Cfe,{})}),T.jsx(z2,{onClick:G,className:"react-flow__controls-zoomout",title:D["controls.zoomOut.ariaLabel"],"aria-label":D["controls.zoomOut.ariaLabel"],disabled:k,children:T.jsx(_fe,{})})]}),n&&T.jsx(z2,{className:"react-flow__controls-fitview",onClick:$,title:D["controls.fitView.ariaLabel"],"aria-label":D["controls.fitView.ariaLabel"],children:T.jsx(Afe,{})}),r&&T.jsx(z2,{className:"react-flow__controls-interactive",onClick:Z,title:D["controls.interactive.ariaLabel"],"aria-label":D["controls.interactive.ariaLabel"],children:E?T.jsx(kfe,{}):T.jsx(Tfe,{})}),y]})}dB.displayName="Controls",q.memo(dB);function Ofe({id:e,x:t,y:n,width:r,height:a,style:l,color:u,strokeColor:d,strokeWidth:h,className:m,borderRadius:y,shapeRendering:v,selected:S,onClick:w}){const{background:A,backgroundColor:E}=l||{},k=u||A||E;return T.jsx("rect",{className:br(["react-flow__minimap-node",{selected:S},m]),x:t,y:n,rx:y,ry:y,width:r,height:a,style:{fill:k,stroke:d,strokeWidth:h},shapeRendering:v,onClick:w?R=>w(R,e):void 0})}const Mfe=q.memo(Ofe),Nfe=e=>e.nodes.map(t=>t.id),jk=e=>e instanceof Function?e:()=>e;function Dfe({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:a,nodeComponent:l=Mfe,onClick:u}){const d=Gt(Nfe,Xn),h=jk(t),m=jk(e),y=jk(n),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return T.jsx(T.Fragment,{children:d.map(S=>T.jsx(zfe,{id:S,nodeColorFunc:h,nodeStrokeColorFunc:m,nodeClassNameFunc:y,nodeBorderRadius:r,nodeStrokeWidth:a,NodeComponent:l,onClick:u,shapeRendering:v},S))})}function Ife({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:d,onClick:h}){const{node:m,x:y,y:v,width:S,height:w}=Gt(A=>{const{internals:E}=A.nodeLookup.get(e),k=E.userNode,{x:R,y:D}=E.positionAbsolute,{width:M,height:I}=$u(k);return{node:k,x:R,y:D,width:M,height:I}},Xn);return!m||m.hidden||!j9(m)?null:T.jsx(d,{x:y,y:v,width:S,height:w,style:m.style,selected:!!m.selected,className:r(m),color:t(m),borderRadius:a,strokeColor:n(m),strokeWidth:l,shapeRendering:u,onClick:h,id:m.id})}const zfe=q.memo(Ife);var jfe=q.memo(Dfe);const Bfe=200,Lfe=150,Pfe=e=>!e.hidden,Hfe=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?D9(kv(e.nodeLookup,{filter:Pfe}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Vfe="react-flow__minimap-desc";function hB({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:d,bgColor:h,maskColor:m,maskStrokeColor:y,maskStrokeWidth:v,position:S="bottom-right",onClick:w,onNodeClick:A,pannable:E=!1,zoomable:k=!1,ariaLabel:R,inversePan:D,zoomStep:M=10,offsetScale:I=5}){const L=jn(),P=q.useRef(null),{boundingRect:G,viewBB:$,rfId:Z,panZoom:j,translateExtent:X,flowWidth:ee,flowHeight:ae,ariaLabelConfig:U}=Gt(Hfe,Xn),te=e?.width??Bfe,V=e?.height??Lfe,W=G.width/te,Q=G.height/V,ne=Math.max(W,Q),B=ne*te,oe=ne*V,se=I*ne,Y=G.x-(B-G.width)/2-se,he=G.y-(oe-G.height)/2-se,ke=B+se*2,me=oe+se*2,Ee=`${Vfe}-${Z}`,xe=q.useRef(0),Be=q.useRef();xe.current=ne,q.useEffect(()=>{if(P.current&&j)return Be.current=pue({domNode:P.current,panZoom:j,getTransform:()=>L.getState().transform,getViewScale:()=>xe.current}),()=>{Be.current?.destroy()}},[j]),q.useEffect(()=>{Be.current?.update({translateExtent:X,width:ee,height:ae,inversePan:D,pannable:E,zoomStep:M,zoomable:k})},[E,k,D,M,X,ee,ae]);const He=w?Xe=>{const[We,At]=Be.current?.pointer(Xe)||[0,0];w(Xe,{x:We,y:At})}:void 0,Ye=A?q.useCallback((Xe,We)=>{const At=L.getState().nodeLookup.get(We).internals.userNode;A(Xe,At)},[]):void 0,Re=R??U["minimap.ariaLabel"];return T.jsx(M2,{position:S,style:{...e,"--xy-minimap-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-background-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-stroke-color-props":typeof y=="string"?y:void 0,"--xy-minimap-mask-stroke-width-props":typeof v=="number"?v*ne:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:br(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:T.jsxs("svg",{width:te,height:V,viewBox:`${Y} ${he} ${ke} ${me}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Ee,ref:P,onClick:He,children:[Re&&T.jsx("title",{id:Ee,children:Re}),T.jsx(jfe,{onClick:Ye,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:d}),T.jsx("path",{className:"react-flow__minimap-mask",d:`M${Y-se},${he-se}h${ke+se*2}v${me+se*2}h${-ke-se*2}z
|
|
1083
1083
|
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}hB.displayName="MiniMap";const Ffe=q.memo(hB),Gfe=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Ufe={[Gm.Line]:"right",[Gm.Handle]:"bottom-right"};function $fe({nodeId:e,position:t,variant:n=Gm.Handle,className:r,style:a=void 0,children:l,color:u,minWidth:d=10,minHeight:h=10,maxWidth:m=Number.MAX_VALUE,maxHeight:y=Number.MAX_VALUE,keepAspectRatio:v=!1,resizeDirection:S,autoScale:w=!0,shouldResize:A,onResizeStart:E,onResize:k,onResizeEnd:R}){const D=z6(),M=typeof e=="string"?e:D,I=jn(),L=q.useRef(null),P=n===Gm.Handle,G=Gt(q.useCallback(Gfe(P&&w),[P,w]),Xn),$=q.useRef(null),Z=t??Ufe[n];q.useEffect(()=>{if(!(!L.current||!M))return $.current||($.current=Oue({domNode:L.current,nodeId:M,getStoreItems:()=>{const{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,domNode:V}=I.getState();return{nodeLookup:X,transform:ee,snapGrid:ae,snapToGrid:U,nodeOrigin:te,paneDomNode:V}},onChange:(X,ee)=>{const{triggerNodeChanges:ae,nodeLookup:U,parentLookup:te,nodeOrigin:V}=I.getState(),W=[],Q={x:X.x,y:X.y},ne=U.get(M);if(ne&&ne.expandParent&&ne.parentId){const B=ne.origin??V,oe=X.width??ne.measured.width??0,se=X.height??ne.measured.height??0,Y={id:ne.id,parentId:ne.parentId,rect:{width:oe,height:se,...B9({x:X.x??ne.position.x,y:X.y??ne.position.y},{width:oe,height:se},ne.parentId,U,B)}},he=Tk([Y],U,te,V);W.push(...he),Q.x=X.x?Math.max(B[0]*oe,X.x):void 0,Q.y=X.y?Math.max(B[1]*se,X.y):void 0}if(Q.x!==void 0&&Q.y!==void 0){const B={id:M,type:"position",position:{...Q}};W.push(B)}if(X.width!==void 0&&X.height!==void 0){const oe={id:M,type:"dimensions",resizing:!0,setAttributes:S?S==="horizontal"?"width":"height":!0,dimensions:{width:X.width,height:X.height}};W.push(oe)}for(const B of ee){const oe={...B,type:"position"};W.push(oe)}ae(W)},onEnd:({width:X,height:ee})=>{const ae={id:M,type:"dimensions",resizing:!1,dimensions:{width:X,height:ee}};I.getState().triggerNodeChanges([ae])}})),$.current.update({controlPosition:Z,boundaries:{minWidth:d,minHeight:h,maxWidth:m,maxHeight:y},keepAspectRatio:v,resizeDirection:S,onResizeStart:E,onResize:k,onResizeEnd:R,shouldResize:A}),()=>{$.current?.destroy()}},[Z,d,h,m,y,v,E,k,R,A]);const j=Z.split("-");return T.jsx("div",{className:br(["react-flow__resize-control","nodrag",...j,n,r]),ref:L,style:{...a,scale:G,...u&&{[P?"backgroundColor":"borderColor"]:u}},children:l})}q.memo($fe);function Xfe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const{useRef:Yfe}=q;function Bk(e){const t=Yfe();return n=>{const r=e(n);return Xfe(t.current,r)?t.current:t.current=r}}const Zfe=()=>{const{group:e}=yo();return async(t,n)=>{if(e)return await e.group_nodes(t,n)}},Wfe=()=>{const{group:e}=yo();return async t=>{if(e)for(const n of t)await e.remove_group(n)}},qfe=({data:e})=>{const t=e?.group?.id||e?.id,n=Wfe(),r=z.useCallback(a=>{a.stopPropagation(),t&&n([t])},[t,n]);return T.jsxs("div",{className:"fn-group",children:[T.jsx("button",{className:"fn-group-remove",title:"Remove group",onClick:r,children:T.jsx(cw,{})}),"Group"]})},Lk=z.memo(({value:e})=>{const t=e?.toString()??"",n=Math.round(3*t.length/4);return T.jsx("div",{children:T.jsxs("pre",{children:["Bytes(",n,")"]})})}),pB=z.memo(({value:e})=>typeof e!="string"?T.jsx("div",{children:"Invalid SVG"}):T.jsx(_ne,{value:e})),mB=({value:e,preValue:t,onLoaded:n})=>{const[r,a]=z.useState(t?.toString()||e?.toString());return z.useEffect(()=>{if(e===t||e==null)return;const u=new Image,d=e.toString();return u.onload=()=>{n?.(),a(d)},u.src=d,()=>{u.onload=null}},[e,t,n]),r===void 0?T.jsx(T.Fragment,{}):typeof r!="string"?(console.error("ImageRenderer: value is not a string",r),T.jsx(T.Fragment,{})):r.startsWith("data:")||r.startsWith("blob:")?T.jsx(Ane,{src:r}):T.jsx(Cne,{value:r,format:"jpeg"})},Jfe=z.memo(({value:e})=>{let t="";try{t=JSON.stringify(e)}catch{}return T.jsx("div",{children:T.jsx("pre",{children:t})})}),j2=({value:e})=>T.jsx(sne,{data:e}),gB=z.memo(({value:e})=>{if(typeof e!="object"||e==null)return T.jsx("div",{children:"Invalid Table"});if(!("columns"in e&&"index"in e&&"data"in e))return T.jsx("div",{children:"Invalid Table"});if(!Array.isArray(e.columns)||!Array.isArray(e.index)||!Array.isArray(e.data)||!e.data.every(n=>Array.isArray(n)))return T.jsx("div",{children:"Invalid Table"});const t={columns:e.columns||[],index:e.index||[],data:e.data||[]};return T.jsx(O3,{tabledata:t})}),B2=e=>T.jsx(Jfe,{...e}),L2=j2,Pk={string:B2,str:B2,table:gB,image:mB,svg:pB,dict:j2,bytes:Lk},Qfe={bytes:()=>{const e=Bn(),{full:t,preview:n}=e.valuestore(),r=JSON.stringify(t?.value||n?.value)||"";return`Bytes(${Math.round(3*r.length/4)})`}},zv=e=>({value:t,preValue:n,onLoaded:r})=>T.jsx(e,{value:t,preValue:n,onLoaded:r}),Ho=(e,t=void 0,n={})=>({})=>{const r=Bn(),{full:a,preview:l}=r.valuestore(),d=(a===void 0?l:a)?.value||t;return T.jsx(e,{value:d,...n})},Hk=e=>({})=>T.jsx(e,{}),Vk=(e,t=void 0)=>({})=>{const n=Bn(),{full:r,preview:a}=n.valuestore(),u=(r===void 0?a:r)?.value||t;return T.jsx(e,{value:u})},Kfe={...Object.fromEntries(Object.entries(Pk).map(([e,t])=>[e,t?zv(t):void 0]))},yB=zv(j2),vB={...Object.fromEntries(Object.entries(Pk).map(([e,t])=>[e,t?Ho(t):void 0])),string:Ho(B2),str:Ho(B2),table:Ho(gB,void 0,{pageSize:10}),image:Ho(mB),svg:Ho(pB,""),dict:Ho(j2,"{}"),bytes:Ho(Lk,"")},ede={...Object.fromEntries(Object.entries(vB).map(([e,t])=>[e,t?Hk(t):void 0]))},tde=()=>{const e=Bn(),{preview:t,full:n}=e.valuestore();let r=(JSON.stringify(n||t)||"").replace(/\\n/g,`
|
|
1084
1084
|
`);return r.length>63&&(r=r.slice(0,60)+"..."),T.jsx("div",{children:r})},nde={},rde=({inputconverter:e})=>{const t=Bn(),{preview:n}=t.valuestore(),r=t.use(),a=n?.value===void 0,l=z.useRef(null),u=dh(r);z.useEffect(()=>{l.current&&(l.current.indeterminate=a)},[l,a]);const d=z.useCallback(h=>{let m=h.target.checked;try{m=e[0](h.target.checked)}catch{}u(m)},[u,e]);return T.jsx("input",{ref:l,type:"checkbox",className:"styledcheckbox booleaninput",checked:!!e[1](n?.value),onChange:d,disabled:r.connected})},ode=({})=>{const e=Bn(),t=Wt(),n=e.use(),{preview:r,full:a}=e.valuestore(),l=a===void 0?r?.value:a.value,u=dh(n),d=typeof l=="string"||Array.isArray(l)&&l.every(S=>typeof S=="number")?l:void 0,h=n.value_options?.colorspace||"hex",m=z.useCallback(S=>{let w="<NoValue>";S&&(S[h]?w=S[h]():w=S.hex()),S===null&&(w=null);try{w=w}catch{}u(w)},[u,h]);let y=!1;typeof n.type!="string"&&"anyOf"in n.type&&n.type.anyOf!==void 0&&(y=n.type.anyOf.some(S=>S==="None"));const v=t.local_state(()=>t.reactflowRef);return T.jsx(lK,{onChange:m,inicolordata:d,allow_null:y,inicolorspace:h,portalContainer:v})};function bB(e,[t,n]){return Math.min(n,Math.max(t,e))}var ade=z.createContext(void 0);function P2(e){const t=z.useContext(ade);return e||t||"ltr"}function ide(e){const t=z.useRef({value:e,previous:e});return z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xB=["PageUp","PageDown"],SB=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],wB={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},$m="Slider",[Fk,lde,sde]=zw($m),[EB,USe]=gs($m,[sde]),[ude,H2]=EB($m),CB=z.forwardRef((e,t)=>{const{name:n,min:r=0,max:a=100,step:l=1,orientation:u="horizontal",disabled:d=!1,minStepsBetweenThumbs:h=0,defaultValue:m=[r],value:y,onValueChange:v=()=>{},onValueCommit:S=()=>{},inverted:w=!1,form:A,...E}=e,k=z.useRef(new Set),R=z.useRef(0),M=u==="horizontal"?cde:fde,[I=[],L]=cf({prop:y,defaultProp:m,onChange:X=>{[...k.current][R.current]?.focus(),v(X)}}),P=z.useRef(I);function G(X){const ee=gde(I,X);j(X,ee)}function $(X){j(X,R.current)}function Z(){const X=P.current[R.current];I[R.current]!==X&&S(I)}function j(X,ee,{commit:ae}={commit:!1}){const U=xde(l),te=Sde(Math.round((X-r)/l)*l+r,U),V=bB(te,[r,a]);L((W=[])=>{const Q=pde(W,V,ee);if(bde(Q,h*l)){R.current=Q.indexOf(V);const ne=String(Q)!==String(W);return ne&&ae&&S(Q),ne?Q:W}else return W})}return T.jsx(ude,{scope:e.__scopeSlider,name:n,disabled:d,min:r,max:a,valueIndexToChangeRef:R,thumbs:k.current,values:I,orientation:u,form:A,children:T.jsx(Fk.Provider,{scope:e.__scopeSlider,children:T.jsx(Fk.Slot,{scope:e.__scopeSlider,children:T.jsx(M,{"aria-disabled":d,"data-disabled":d?"":void 0,...E,ref:t,onPointerDown:Ke(E.onPointerDown,()=>{d||(P.current=I)}),min:r,max:a,inverted:w,onSlideStart:d?void 0:G,onSlideMove:d?void 0:$,onSlideEnd:d?void 0:Z,onHomeKeyDown:()=>!d&&j(r,0,{commit:!0}),onEndKeyDown:()=>!d&&j(a,I.length-1,{commit:!0}),onStepKeyDown:({event:X,direction:ee})=>{if(!d){const te=xB.includes(X.key)||X.shiftKey&&SB.includes(X.key)?10:1,V=R.current,W=I[V],Q=l*te*ee;j(W+Q,V,{commit:!0})}}})})})})});CB.displayName=$m;var[_B,AB]=EB($m,{startEdge:"left",endEdge:"right",size:"width",direction:1}),cde=z.forwardRef((e,t)=>{const{min:n,max:r,dir:a,inverted:l,onSlideStart:u,onSlideMove:d,onSlideEnd:h,onStepKeyDown:m,...y}=e,[v,S]=z.useState(null),w=bn(t,M=>S(M)),A=z.useRef(void 0),E=P2(a),k=E==="ltr",R=k&&!l||!k&&l;function D(M){const I=A.current||v.getBoundingClientRect(),L=[0,I.width],G=$k(L,R?[n,r]:[r,n]);return A.current=I,G(M-I.left)}return T.jsx(_B,{scope:e.__scopeSlider,startEdge:R?"left":"right",endEdge:R?"right":"left",direction:R?1:-1,size:"width",children:T.jsx(TB,{dir:E,"data-orientation":"horizontal",...y,ref:w,style:{...y.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:M=>{const I=D(M.clientX);u?.(I)},onSlideMove:M=>{const I=D(M.clientX);d?.(I)},onSlideEnd:()=>{A.current=void 0,h?.()},onStepKeyDown:M=>{const L=wB[R?"from-left":"from-right"].includes(M.key);m?.({event:M,direction:L?-1:1})}})})}),fde=z.forwardRef((e,t)=>{const{min:n,max:r,inverted:a,onSlideStart:l,onSlideMove:u,onSlideEnd:d,onStepKeyDown:h,...m}=e,y=z.useRef(null),v=bn(t,y),S=z.useRef(void 0),w=!a;function A(E){const k=S.current||y.current.getBoundingClientRect(),R=[0,k.height],M=$k(R,w?[r,n]:[n,r]);return S.current=k,M(E-k.top)}return T.jsx(_B,{scope:e.__scopeSlider,startEdge:w?"bottom":"top",endEdge:w?"top":"bottom",size:"height",direction:w?1:-1,children:T.jsx(TB,{"data-orientation":"vertical",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:E=>{const k=A(E.clientY);l?.(k)},onSlideMove:E=>{const k=A(E.clientY);u?.(k)},onSlideEnd:()=>{S.current=void 0,d?.()},onStepKeyDown:E=>{const R=wB[w?"from-bottom":"from-top"].includes(E.key);h?.({event:E,direction:R?-1:1})}})})}),TB=z.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:l,onHomeKeyDown:u,onEndKeyDown:d,onStepKeyDown:h,...m}=e,y=H2($m,n);return T.jsx(It.span,{...m,ref:t,onKeyDown:Ke(e.onKeyDown,v=>{v.key==="Home"?(u(v),v.preventDefault()):v.key==="End"?(d(v),v.preventDefault()):xB.concat(SB).includes(v.key)&&(h(v),v.preventDefault())}),onPointerDown:Ke(e.onPointerDown,v=>{const S=v.target;S.setPointerCapture(v.pointerId),v.preventDefault(),y.thumbs.has(S)?S.focus():r(v)}),onPointerMove:Ke(e.onPointerMove,v=>{v.target.hasPointerCapture(v.pointerId)&&a(v)}),onPointerUp:Ke(e.onPointerUp,v=>{const S=v.target;S.hasPointerCapture(v.pointerId)&&(S.releasePointerCapture(v.pointerId),l(v))})})}),kB="SliderTrack",RB=z.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=H2(kB,n);return T.jsx(It.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});RB.displayName=kB;var Gk="SliderRange",OB=z.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,a=H2(Gk,n),l=AB(Gk,n),u=z.useRef(null),d=bn(t,u),h=a.values.length,m=a.values.map(S=>DB(S,a.min,a.max)),y=h>1?Math.min(...m):0,v=100-Math.max(...m);return T.jsx(It.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:d,style:{...e.style,[l.startEdge]:y+"%",[l.endEdge]:v+"%"}})});OB.displayName=Gk;var Uk="SliderThumb",MB=z.forwardRef((e,t)=>{const n=lde(e.__scopeSlider),[r,a]=z.useState(null),l=bn(t,d=>a(d)),u=z.useMemo(()=>r?n().findIndex(d=>d.ref.current===r):-1,[n,r]);return T.jsx(dde,{...e,ref:l,index:u})}),dde=z.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:a,...l}=e,u=H2(Uk,n),d=AB(Uk,n),[h,m]=z.useState(null),y=bn(t,D=>m(D)),v=h?u.form||!!h.closest("form"):!0,S=NI(h),w=u.values[r],A=w===void 0?0:DB(w,u.min,u.max),E=mde(r,u.values.length),k=S?.[d.size],R=k?yde(k,A,d.direction):0;return z.useEffect(()=>{if(h)return u.thumbs.add(h),()=>{u.thumbs.delete(h)}},[h,u.thumbs]),T.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${A}% + ${R}px)`},children:[T.jsx(Fk.ItemSlot,{scope:e.__scopeSlider,children:T.jsx(It.span,{role:"slider","aria-label":e["aria-label"]||E,"aria-valuemin":u.min,"aria-valuenow":w,"aria-valuemax":u.max,"aria-orientation":u.orientation,"data-orientation":u.orientation,"data-disabled":u.disabled?"":void 0,tabIndex:u.disabled?void 0:0,...l,ref:y,style:w===void 0?{display:"none"}:e.style,onFocus:Ke(e.onFocus,()=>{u.valueIndexToChangeRef.current=r})})}),v&&T.jsx(NB,{name:a??(u.name?u.name+(u.values.length>1?"[]":""):void 0),form:u.form,value:w},r)]})});MB.displayName=Uk;var hde="RadioBubbleInput",NB=z.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const a=z.useRef(null),l=bn(a,r),u=ide(t);return z.useEffect(()=>{const d=a.current;if(!d)return;const h=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(h,"value").set;if(u!==t&&y){const v=new Event("input",{bubbles:!0});y.call(d,t),d.dispatchEvent(v)}},[u,t]),T.jsx(It.input,{style:{display:"none"},...n,ref:l,defaultValue:t})});NB.displayName=hde;function pde(e=[],t,n){const r=[...e];return r[n]=t,r.sort((a,l)=>a-l)}function DB(e,t,n){const l=100/(n-t)*(e-t);return bB(l,[0,100])}function mde(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function gde(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),r=Math.min(...n);return n.indexOf(r)}function yde(e,t,n){const r=e/2,l=$k([0,50],[0,r]);return(r-l(t)*n)*n}function vde(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function bde(e,t){if(t>0){const n=vde(e);return Math.min(...n)>=t}return!0}function $k(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function xde(e){return(String(e).split(".")[1]||"").length}function Sde(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var wde=CB,Ede=RB,Cde=OB,_de=MB;function Ade(e){return e===0?0:Math.abs(e)<1e-12?e:Number(e.toPrecision(12))}const IB=({inputconverter:e,parser:t=n=>parseFloat(n)})=>{const n=Bn(),{preview:r}=n.valuestore(),a=n.use(),l=dh(a),[u,d]=z.useState(e[1](r?.value));z.useEffect(()=>{d(e[1](r?.value))},[r]);const h=z.useCallback(w=>{w=t(parseFloat(w.toString()).toString()),isNaN(w)?(w="<NoValue>",d("")):(a.value_options?.min!==void 0&&w<a.value_options.min&&(w=a.value_options.min),a.value_options?.max!==void 0&&w>a.value_options.max&&(w=a.value_options.max),w=Ade(w),d(w.toString()));try{w=e[0](w)}catch{}w!==r?.value&&l(w)},[a,e,l]),m=z.useCallback(w=>{h(w.target.value)},[h]);let y=a.connected?e[1](r?.value):u;y===void 0&&(y=a.value_options?.min),y===void 0&&(y=a.value_options?.max),y===void 0&&(y=""),y===null&&(y="");let v=null,S=1;return a.value_options?.step!==void 0?S=a.value_options.step:a.value_options?.max!==void 0&&a.value_options?.min!==void 0&&(S=(a.value_options?.max-a.value_options?.min)/1e3),a.value_options?.max!==void 0&&a.value_options?.min!==void 0&&!a.connected&&(v=T.jsx("div",{style:{minWidth:"6.25rem"},className:"SliderContainer",children:T.jsxs(wde,{className:"SliderRoot",value:[y===void 0?a.value_options?.min:y],min:a.value_options?.min,max:a.value_options?.max,step:S,disabled:a.connected,onValueCommit:w=>{isNaN(w[0])||h(w[0])},onValueChange:w=>{isNaN(w[0])||d(w[0].toString())},onKeyDown:w=>{["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(w.key)&&w.stopPropagation()},children:[T.jsx(Ede,{className:"SliderTrack",children:T.jsx(Cde,{className:"SliderRange"})}),T.jsx(_de,{className:"SliderThumb"})]})})),T.jsxs(T.Fragment,{children:[v,T.jsx("input",{type:"text",className:"nodedatainput styledinput numberinput",value:y,onChange:w=>d(w.target.value),onBlur:m,step:S,onKeyDown:w=>{if(!(w.ctrlKey||w.metaKey)){if(w.key==="ArrowUp"){w.shiftKey&&(S*=10);let A=(parseFloat(y)||0)+S;h(A);return}if(w.key==="ArrowDown"){w.shiftKey&&(S*=10);let A=(parseFloat(y)||0)-S;h(A);return}!/^[0-9.eE+-]$/.test(w.key)&&!["Backspace","ArrowLeft","ArrowRight","Delete","Tab"].includes(w.key)&&w.preventDefault()}},disabled:a.connected,min:a.value_options?.min,max:a.value_options?.max})]})},Tde=({inputconverter:e})=>IB({inputconverter:e,parser:parseFloat}),kde=({inputconverter:e})=>IB({inputconverter:e,parser:parseInt}),Rde=e=>e,Ode=e=>parseFloat(e),Mde=e=>!!e,Nde=e=>e==="null"?null:e,Dde=e=>e==="nuinputconvertermber"?Ode:e==="boolean"?Mde:e==="undefined"?Nde:Rde,jv=({inputconverter:e,parser:t})=>{const n=Bn(),r=n.use(),{preview:a,full:l}=n.valuestore(),u=l===void 0?a?.value:l.value,d=dh(r);let h=r.value_options?.options||[];Array.isArray(h)&&(h={type:"enum",values:h,keys:h.map(E=>E===null?"None":E.toString()),nullable:!1}),h.type!=="enum"&&(h={type:"enum",values:Object.values(h),keys:Object.keys(h),nullable:!1}),h=h,h.nullable&&!h.values.includes(null)&&!h.keys.includes("None")&&(h.values.unshift(null),h.keys.unshift("None"));const m=[];for(let E=0;E<h.values.length;E++){const k=h.values[E]===null||h.values[E]===void 0?"undefined":typeof h.values[E];let R=h.values[E];R===null&&(R="null"),R===void 0&&(R="undefined"),m.push([h.keys[E],R.toString(),k])}const y=z.useCallback(({value:E,datatype:k})=>{let D=(t||Dde(k))(E);try{D=e[0](E)}catch{}d(D)},[r,e,d]);let v=u;v===null&&(v="null"),v===void 0&&(v="undefined");const S=m.find(E=>E[1]===v.toString());let w;S!==void 0&&(w={value:S[1],label:S[0],datatype:S[2]});const A=m.map(E=>({value:E[1],label:E[0],datatype:E[2]}));return T.jsx(Ute,{className:"nodedatainput styleddropdown",options:A,defaultValue:w,onChange:E=>{if(E===null){y({value:"<NoValue>",datatype:"string"});return}y(E)}})},zB=({inputconverter:e})=>{const t=Bn(),{preview:n,full:r}=t.valuestore(),a=t.use(),l=r===void 0?n?.value:r?.value,u=dh(a),[d,h]=z.useState(e[1](l));z.useEffect(()=>{h(e[1](l))},[l]);const m=z.useCallback(w=>{let A=w.target.value;A||(A="<NoValue>");try{A=e[0](A)}catch{}A!==l&&u(A)},[u,e,l]);let y=a.connected?e[1](l):d;y==null&&(y=""),y=y.toString();const v=(y.toString().match(/\n/g)||[]).length,S=Math.max(...y.split(`
|
|
1085
|
-
`).map(w=>w.length),0);return T.jsx("textarea",{className:"nodedatainput styledinput stringinput",value:y,onChange:w=>h(w.target.value),onBlur:w=>{m(w)},disabled:a.connected,rows:v+1,cols:S+1})},Ms={Inputrenderer:{float:Tde,int:kde,bool:rde,string:zB,str:zB,color:ode,select:jv,enum:jv,bytes:Vk(Lk,"")},Outputrenderer:nde,HandlePreviewRenderer:ede,DataOverlayRenderer:Kfe,DataPreviewViewRenderer:vB,DataViewRenderer:Pk,InLineRenderer:Qfe,NodeRenderer:{},NodeHooks:{}},Ide=(e,t)=>{const n=t.options||{},r=n.overwrite===void 0?!0:n.overwrite;switch(t.type){case"EXTEND_INPUT_RENDER":return!r&&e.Inputrenderer[t.payload.type]?e:{...e,Inputrenderer:{...e.Inputrenderer,[t.payload.type]:t.payload.component}};case"EXTEND_FROM_PLUGIN":{let u=!1;const d=[[t.payload.plugin.input_renderers||{},e.Inputrenderer],[t.payload.plugin.output_renderers||{},e.Outputrenderer],[t.payload.plugin.handle_preview_renderers||{},e.HandlePreviewRenderer],[t.payload.plugin.data_overlay_renderers||{},e.DataOverlayRenderer],[t.payload.plugin.data_preview_renderers||{},e.DataPreviewViewRenderer],[t.payload.plugin.data_view_renderers||{},e.DataViewRenderer],[t.payload.plugin.node_renderers||{},e.NodeRenderer],[t.payload.plugin.node_hooks||{},e.NodeHooks]];for(const[m,y]of d){if(Object.keys(m).length>0){if(r)u=!0;else for(const v in m)if(!y[v]){u=!0;break}}if(u)break}if(!u)return e;const h={...e};return d.forEach(([m,y])=>{Object.assign(y,m)}),h}default:const l={EXTEND_OUTPUT_RENDER:"Outputrenderer",EXTEND_HANDLE_PREVIEW_RENDER:"HandlePreviewRenderer",EXTEND_DATA_OVERLAY_RENDER:"DataOverlayRenderer",EXTEND_DATA_PREVIEW_RENDER:"DataPreviewViewRenderer",EXTEND_DATA_VIEW_RENDER:"DataViewRenderer",EXTEND_NODE_CONTEXT_EXTENDER:"NodeContextExtenders",EXTEND_NODE_RENDERER:"NodeRenderer",EXTEND_NODE_HOOKS:"NodeHooks"}[t.type];if(l){const u=e[l];return!r&&u[t.payload.type]?e:{...e,[l]:{...u,[t.payload.type]:t.payload.component}}}return e}},zde=({children:e,plugins:t,fnrf_zst:n})=>{const[r,a]=q.useReducer(Ide,Ms),l=(A,E,k)=>{a({type:"EXTEND_INPUT_RENDER",payload:{type:A,component:E},options:k})},u=(A,E,k)=>{a({type:"EXTEND_OUTPUT_RENDER",payload:{type:A,component:E},options:k})},d=(A,E,k)=>{a({type:"EXTEND_HANDLE_PREVIEW_RENDER",payload:{type:A,component:E},options:k})},h=(A,E,k)=>{a({type:"EXTEND_DATA_OVERLAY_RENDER",payload:{type:A,component:E},options:k})},m=(A,E,k)=>{a({type:"EXTEND_DATA_PREVIEW_RENDER",payload:{type:A,component:E},options:k})},y=(A,E,k)=>{a({type:"EXTEND_DATA_VIEW_RENDER",payload:{type:A,component:E},options:k})},v=(A,E,k)=>{a({type:"EXTEND_NODE_RENDERER",payload:{type:A,component:E},options:k})},S=(A,E,k)=>{a({type:"EXTEND_NODE_HOOKS",payload:{type:A,component:E},options:k})},w=(A,E)=>{a({type:"EXTEND_FROM_PLUGIN",payload:{plugin:A},options:E})};return q.useEffect(()=>{for(const A in t){const E=t[A];if(!E)continue;const k=E.renderpluginfactory;k&&w(k({React:z,fnrf_zst:n,NodeContext:V2}))}},[t]),T.jsx(Yu.Provider,{value:{Inputrenderer:r.Inputrenderer,Outputrenderer:r.Outputrenderer,HandlePreviewRenderer:r.HandlePreviewRenderer,DataOverlayRenderer:r.DataOverlayRenderer,DataPreviewViewRenderer:r.DataPreviewViewRenderer,DataViewRenderer:r.DataViewRenderer,InLineRenderer:r.InLineRenderer,NodeRenderer:r.NodeRenderer,NodeHooks:r.NodeHooks,extendNodeRenderer:v,extendInputRenderMapping:l,extendOutputRenderMapping:u,extendHandlePreviewRenderMapping:d,extendDataOverlayRenderMapping:h,extendDataPreviewRenderMapping:m,extendDataViewRenderMapping:y,extendNodeHooks:S,extendFromPlugin:w},children:e})},Yu=q.createContext({Inputrenderer:Ms.Inputrenderer,Outputrenderer:Ms.Outputrenderer,HandlePreviewRenderer:Ms.HandlePreviewRenderer,DataOverlayRenderer:Ms.DataOverlayRenderer,DataPreviewViewRenderer:Ms.DataPreviewViewRenderer,DataViewRenderer:Ms.DataViewRenderer,InLineRenderer:Ms.InLineRenderer,NodeRenderer:Ms.NodeRenderer,NodeHooks:Ms.NodeHooks,extendInputRenderMapping:(e,t,n)=>{},extendOutputRenderMapping:(e,t,n)=>{},extendHandlePreviewRenderMapping:(e,t,n)=>{},extendDataOverlayRenderMapping:(e,t,n)=>{},extendDataPreviewRenderMapping:(e,t,n)=>{},extendDataViewRenderMapping:(e,t,n)=>{},extendNodeRenderer:(e,t,n)=>{},extendNodeHooks:(e,t,n)=>{},extendFromPlugin:(e,t)=>{}}),jB=e=>{const t=Wt(),{DataOverlayRenderer:n,DataViewRenderer:r}=q.useContext(Yu);if(e===void 0)return;const a=t.render_options(),[l]=hh(e,a.typemap||{});return l?n[l]?n[l]:r[l]?zv(r[l]):yB:yB},jde=e=>{const t=Wt(),n=jB(e),{DataPreviewViewRenderer:r,DataViewRenderer:a}=q.useContext(Yu),l=t.render_options();if(e===void 0)return[void 0,n];const[u]=hh(e,l.typemap||{});return u?r[u]?[r[u],n]:a[u]?[Ho(a[u]),n]:[Ho(L2),n]:[Ho(L2),n]},Bde=e=>{const n=Wt().render_options(),{HandlePreviewRenderer:r,DataPreviewViewRenderer:a}=q.useContext(Yu),l=jB(e);let u;if(e){const[d]=hh(e,n.typemap||{});d?r[d]?u=r[d]:a[d]?u=a[d]:u=Ho(L2):u=Ho(L2)}return[u,l]},Lde=e=>{const[t,n]=q.useState(!1),r=e.use(a=>a.in_trigger);return q.useEffect(()=>{let a;return r&&!t?n(!0):t&&(a=setTimeout(()=>n(!1),200)),()=>clearTimeout(a)},[r,t]),{visualTrigger:t,nodestore:e}},V2=z.createContext({}),ua=()=>q.useContext(V2),Ef=z.createContext(void 0);function Bn(e){if(e)return ua().io_stores.get(e);{const t=q.useContext(Ef);if(!t)throw new Error("IOContext not set");return t}}function dh(e){const{node:t}=yo();if(e||(e=Bn().use()),typeof e=="string"&&(e=Bn(e)?.use(),!e))throw new Error(`No IO found for ${e}`);if(!e)throw new Error("No IO found");return z.useCallback((r,a)=>{console.log("io value set",r),t?.set_io_value({nid:e.node,ioid:e.id,value:r,set_default:a??e.render_options.set_default})},[e,t])}function BB(e){const{node:t}=yo();let n,r;if(!e){const u=Bn().useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}if(typeof e=="string"){const l=Bn(e);if(!l)throw new Error(`No IO found for ${e}`);const u=l.useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}else{if(!e)throw new Error("No IO found");n=e.id,r=e.node}return z.useCallback(l=>{t?.set_io_value_options({nid:r,ioid:n,values:l.values??l.keys,keys:l.keys,nullable:l.nullable??!1})},[t,n,r])}function LB(e){return Bn(e)?.valuestore()}function Bv(e){const t=Bn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=yo();return z.useCallback(()=>a?.get_io_full_value({nid:n,ioid:r}),[a,n,r])}function Xk(e){const t=Bn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=yo();return z.useCallback(u=>{a?.update_io_options({nid:n,ioid:r,options:{hidden:u}})},[a,n,r])}const PB=({iostore:e,Component:t})=>{const[n,r]=z.useState(void 0),[a,l]=z.useState(void 0),{full:u}=e.valuestore(),d=Bv();z.useEffect(()=>{u===void 0?d?.():l(u.value)},[u,d]);const h=()=>{a!==void 0&&r(a)};return T.jsx(t,{value:a,preValue:n,onLoaded:h})},HB=({Component:e})=>T.jsx(e,{}),hh=(e,t)=>VB(e.render_options?.type??"any",t),VB=(e,t)=>{if(typeof e=="string")return e in t?[t[e],e]:[e,e];if("allOf"in e&&e.allOf!==void 0)return[void 0,void 0];if("anyOf"in e&&e.anyOf!==void 0){const n=e.anyOf.map(r=>VB(r||"any",t));for(const r of n)switch(r[0]){case"bool":return["bool",r[1]];case"enum":return["enum",r[1]];case"float":return["float",r[1]];case"int":return["int",r[1]];case"string":return["string",r[1]];case"str":return["string",r[1]]}return[void 0,void 0]}return!("type"in e)||e.type===void 0?[void 0,void 0]:e.type==="enum"?["enum","enum"]:[void 0,void 0]},Yk=({typestring:e,preview:t,...n})=>{const[r,a]=q.useState(!1),[l,u]=q.useState(!1),d=Wt(),h=Bn(),m=h.use(),y=Bv(),[v,S]=Bde(m),w=d.local_state(()=>d.reactflowRef);return T.jsxs(t5,{open:r||l,onOpenChange:u,children:[T.jsx(n5,{asChild:!0,children:T.jsx(Dv,{id:m.id,"data-type":e,...n})}),T.jsx(r5,{container:w,children:T.jsxs(o5,{className:"iotooltipcontent",sideOffset:5,avoidCollisions:!0,collisionBoundary:w,collisionPadding:10,onOpenAutoFocus:A=>A.preventDefault(),onCloseAutoFocus:A=>A.preventDefault(),children:[T.jsxs("div",{className:"iotooltip_container",children:[T.jsxs("div",{className:"iotooltip_header",children:[r?T.jsx(pJ,{onClick:()=>a(!1)}):T.jsx(hJ,{onClick:()=>a(!0)}),S&&T.jsx(Iu,{title:m.full_id,trigger:T.jsx(rI,{}),onOpenChange:A=>{A&&y?.(),a(A)},children:T.jsx(PB,{Component:S,iostore:h})})]}),v?T.jsx(HB,{Component:v}):`no preview available for "${e}"`]}),T.jsx(WQ,{className:"iotooltipcontentarrow"})]})})]})},Xm={"":[e=>e,e=>e],str_to_json:[e=>JSON.parse(e),e=>typeof e=="string"?e:JSON.stringify(e)],str_to_list:[e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{try{return JSON.parse("["+e+"]")}catch{}}throw new Error("Invalid list")},e=>JSON.stringify(e)]},Pde=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Wt().render_options(),l=Bn().use(),[u,d]=hh(l,r.typemap||{}),{Inputrenderer:h}=q.useContext(Yu),m=u?l.value_options?.options?jv:h[u]:void 0,y=Xm[(d&&r.inputconverter?.[d])??""]||Xm[""],{keys:v}=FA(),S=w=>{v.has("s")&&(e&&e("inputs/"+l.id),t&&t(!0),w.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeinput","data-type":u,onClick:S,children:[T.jsx(Yk,{typestring:u,position:it.Left,type:"target"}),T.jsxs("div",{className:"inner_nodeio",children:[m&&T.jsx("div",{className:"iovaluefield nodrag","data-type":u,children:T.jsx(m,{inputconverter:y})}),T.jsx("div",{className:"ioname",children:l.name})]}),T.jsx(Yk,{typestring:u,position:it.Right,type:"source"})]})},Hde=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Wt().render_options(),l=Bn().use(),[u]=hh(l,r.typemap||{}),{Outputrenderer:d}=q.useContext(Yu),{keys:h}=FA(),m=u?d[u]:void 0,y=v=>{h.has("s")&&(e&&e("outputs/"+l.id),t&&t(!0),v.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeoutput","data-type":u,onClick:y,children:[T.jsx(Yk,{typestring:u,position:it.Right,type:"source"}),T.jsxs("div",{className:"inner_nodeio",children:[T.jsx("div",{className:"ioname",children:l.name}),m?T.jsx("div",{className:"iovaluefield nodrag",children:T.jsx(m,{})}):T.jsx("div",{className:"iovaluefield",children:T.jsx(tde,{})})]})]})},Vde=()=>{const t=Wt().render_options(),r=Bn().use(),a=Xk(),[l,u]=hh(r,t.typemap||{}),{Inputrenderer:d}=z.useContext(Yu),h=l?r.value_options?.options?jv:d[l]:void 0,m=Xm[(u&&t.inputconverter?.[u])??""]||Xm[""];return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:r.name}),h&&T.jsx(h,{inputconverter:m}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:r.connected,onChange:y=>{a?.(y.target.checked)},checked:r.hidden})]})})]})},Fde=()=>{const t=Bn().use(),n=Xk();return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:t.name}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:t.connected,onChange:r=>{n?.(r.target.checked)},checked:t.hidden})]})})]})},FB=({})=>{const e=Wt(),{node:t}=yo(),r=Bn().use(),a=e.render_options(),l=Xk(),[u,d]=z.useState(r.name);z.useEffect(()=>d(r.name),[r.name]);const h=z.useCallback(E=>d(E.target.value),[]),m=z.useCallback(()=>{u!==r.name&&t?.update_io_options({nid:r.node,ioid:r.id,options:{name:u}})},[r,t,u]),[y,v]=hh(r,a.typemap||{}),S=Xm[(v&&a.inputconverter?.[v])??""]||Xm[""],{Inputrenderer:w}=z.useContext(Yu),A=y?r.value_options?.options?jv:w[y]:void 0;return T.jsxs("div",{className:"nodesettings-io-entry funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-name-${r.id}`,children:"Name:"}),T.jsx("input",{id:`io-name-${r.id}`,type:"text",value:u,onChange:h,onBlur:m,className:"styledinput"})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"ID:"}),T.jsx("span",{children:r.id})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value:"}),A&&T.jsx(A,{inputconverter:S})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Type:"}),T.jsx("pre",{children:JSON.stringify(r.type,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-hidden-${r.id}`,children:"Hidden:"}),T.jsx("input",{id:`io-hidden-${r.id}`,type:"checkbox",checked:r.hidden,onChange:E=>l?.(E.target.checked),className:"styledcheckbox",disabled:r.connected&&r.is_input})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value Options:"}),T.jsx("pre",{children:JSON.stringify(r.value_options,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Render Options:"}),T.jsx("pre",{className:"code-display",children:JSON.stringify(r.render_options,null,2)})]}),r.is_input&&T.jsxs(T.Fragment,{children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Does Trigger:"}),T.jsx("span",{children:String(r.does_trigger)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Required:"}),T.jsx("span",{children:String(r.required)})]})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Emit Value Set:"}),T.jsx("span",{children:String(r.emit_value_set)})]}),T.jsx("hr",{})]})},Zk={xxs:0,xs:320,s:480,m:768,l:960,xl:1280,xxl:1920},Gde=Object.entries(Zk).sort(([,e],[,t])=>t-e),GB=z.createContext(void 0),Ude=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},$de=e=>{for(const[t,n]of Gde)if(e>=n)return t;return"xxs"},UB=z.memo(z.forwardRef((e,t)=>{const{className:n,children:r,...a}=e,[l,u]=z.useState({wKey:"m",w:0,h:0}),d=z.useRef(null);z.useImperativeHandle(t,()=>d.current,[]);const h=z.useCallback(y=>{const v=y.width,S=y.height,w=$de(v);u(A=>A.wKey===w&&A.w===v&&A.h===S?A:{wKey:w,w:v,h:S})},[]),m=z.useMemo(()=>Ude(h,16),[h]);return z.useEffect(()=>{const y=d.current;if(!y)return;const v=new ResizeObserver(S=>{const w=S[0];w&&m(w.contentRect)});return h(y.getBoundingClientRect()),v.observe(y),()=>{v.disconnect()}},[h,m]),T.jsx(GB.Provider,{value:l,children:T.jsx("div",{ref:d,className:`size-context w-${l.wKey} ${n||""}`.trim(),...a,children:r})})}));UB.displayName="SizeContextContainer";const Xde=()=>{const e=z.useContext(GB);if(!e)throw new Error("useSizeContext must be used within a SizeContextContainerContext");return e},Yde=(e,t)=>e===t?!1:e===""?!0:Zk[e]<Zk[t],Zde=e=>{const{wKey:t}=Xde();return Yde(t,e)},$B=(e,t,n="",r="")=>{const a=[];return typeof e=="string"?a.push(`${t}-${e}`):typeof e=="boolean"?a.push(e?n:r):e&&typeof e=="object"&&Object.entries(e).forEach(([l,u])=>{if(typeof u=="string")a.push(l===""?`${t}-${u}`:`${l}-${t}-${u}`);else if(typeof u=="boolean"){const d=u?n:r;d&&a.push(l===""?d:`${l}-${d}`)}}),a.filter(Boolean).join(" ")},Cf=z.memo(({direction:e,className:t="",children:n,wrap:r=!1,grow:a=!1,...l})=>{const u="float-container",d=$B(e,"direction"),h=$B(a,"","grow","no-grow"),y=[u,d,h,typeof r=="boolean"&&r?"flex-wrap":"",t].filter(Boolean).join(" ");return T.jsx("div",{className:y,...l,children:n})});Cf.displayName="FloatContainer";const Wde={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"◀"}),right:e=>T.jsx(T.Fragment,{children:"▶"})},qde={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"▶"}),right:e=>T.jsx(T.Fragment,{children:"◀"})},Wk=z.memo(({direction:e,expanded:t=!0,children:n,className:r,maxSize:a="18.75rem",expanderSize:l="2rem",containerStyle:u,style:d,containerClassName:h,expandIcons:m,collapseIcons:y,onExpandChange:v,...S})=>{const[w,A]=z.useState(t);z.useEffect(()=>{A(t)},[t]);const E=z.useCallback(()=>{A(j=>{const X=!j;return v?.(X),X})},[v]),k=z.useCallback(j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),E())},[E]),R=e==="right"||e==="left",D=e==="left"||e==="up",M=w?y?.[e]||qde[e]:m?.[e]||Wde[e],I=`${e} ${w?"expanded":"collapsed"}`,L=z.useMemo(()=>({[R?"width":"height"]:w?a:l}),[R,w,a,l]),P=z.useMemo(()=>({[R?"width":"height"]:w?a:0}),[R,w,a]),G=z.useMemo(()=>({[R?"width":"height"]:l}),[R,l]),$=T.jsx("div",{className:`expanding_container_content ${I} ${r||""}`.trim(),style:{...d,...P},...S,children:n}),Z=T.jsx("div",{className:`expanding_container_expander ${I}`,onClick:E,onKeyDown:k,style:G,role:"button",tabIndex:0,"aria-label":`${w?"Collapse":"Expand"} ${e}`,children:T.jsx(M,{})});return T.jsxs("div",{className:`expanding_container ${I} ${h||""}`,style:{...u,...L},children:[D?Z:$,D?$:Z]})});Wk.displayName="ExpandingContainer";const Jde=({nodestore:e})=>{const t=e.use();return T.jsx(V2.Provider,{value:e,children:T.jsxs("div",{className:"nodesettings_content",children:[T.jsx("div",{className:"nodesettings_section",children:T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:"Name"}),T.jsx("div",{children:T.jsx(tR,{})})]})}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Inputs"}),t.inputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ef.Provider,{value:r,children:T.jsx(Vde,{})},n)})]}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Outputs"}),t.outputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ef.Provider,{value:r,children:T.jsx(Fde,{})},n)})]})]})})},Qde=()=>{const e=Wt(),t=e.local_state(r=>r.selected_nodes);if(t.length===0)return T.jsx("div",{children:"Node Settings"});if(t.length>1)return T.jsx("div",{children:"Multiple Nodes Selected"});const n=e.nodespace.get_node(t[0]);return n?T.jsx(Jde,{nodestore:n}):T.jsx("div",{children:"Node not found"})},Kde=()=>{const e=Wt(),t=e.local_settings(r=>r.view_settings.expand_node_props),n=r=>{e.update_view_settings({expand_node_props:r})};return T.jsx(Wk,{direction:"left",expanded:t===void 0?!1:t,containerClassName:"pos-right pos-top bg1 h-12",className:"nodesettings_content",onExpandChange:n,collapseIcons:{up:uw,down:Q0,left:J0,right:sw},expandIcons:{up:Q0,down:uw,left:sw,right:J0},children:T.jsx(Qde,{})})};var qk="rovingFocusGroup.onEntryFocus",ehe={bubbles:!1,cancelable:!0},Lv="RovingFocusGroup",[Jk,XB,the]=zw(Lv),[nhe,F2]=gs(Lv,[the]),[rhe,ohe]=nhe(Lv),YB=z.forwardRef((e,t)=>T.jsx(Jk.Provider,{scope:e.__scopeRovingFocusGroup,children:T.jsx(Jk.Slot,{scope:e.__scopeRovingFocusGroup,children:T.jsx(ahe,{...e,ref:t})})}));YB.displayName=Lv;var ahe=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=e,S=z.useRef(null),w=bn(t,S),A=P2(l),[E,k]=cf({prop:u,defaultProp:d??null,onChange:h,caller:Lv}),[R,D]=z.useState(!1),M=aa(m),I=XB(n),L=z.useRef(!1),[P,G]=z.useState(0);return z.useEffect(()=>{const $=S.current;if($)return $.addEventListener(qk,M),()=>$.removeEventListener(qk,M)},[M]),T.jsx(rhe,{scope:n,orientation:r,dir:A,loop:a,currentTabStopId:E,onItemFocus:z.useCallback($=>k($),[k]),onItemShiftTab:z.useCallback(()=>D(!0),[]),onFocusableItemAdd:z.useCallback(()=>G($=>$+1),[]),onFocusableItemRemove:z.useCallback(()=>G($=>$-1),[]),children:T.jsx(It.div,{tabIndex:R||P===0?-1:0,"data-orientation":r,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:Ke(e.onMouseDown,()=>{L.current=!0}),onFocus:Ke(e.onFocus,$=>{const Z=!L.current;if($.target===$.currentTarget&&Z&&!R){const j=new CustomEvent(qk,ehe);if($.currentTarget.dispatchEvent(j),!j.defaultPrevented){const X=I().filter(V=>V.focusable),ee=X.find(V=>V.active),ae=X.find(V=>V.id===E),te=[ee,ae,...X].filter(Boolean).map(V=>V.ref.current);qB(te,y)}}L.current=!1}),onBlur:Ke(e.onBlur,()=>D(!1))})})}),ZB="RovingFocusGroupItem",WB=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:l,children:u,...d}=e,h=ys(),m=l||h,y=ohe(ZB,n),v=y.currentTabStopId===m,S=XB(n),{onFocusableItemAdd:w,onFocusableItemRemove:A,currentTabStopId:E}=y;return z.useEffect(()=>{if(r)return w(),()=>A()},[r,w,A]),T.jsx(Jk.ItemSlot,{scope:n,id:m,focusable:r,active:a,children:T.jsx(It.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:t,onMouseDown:Ke(e.onMouseDown,k=>{r?y.onItemFocus(m):k.preventDefault()}),onFocus:Ke(e.onFocus,()=>y.onItemFocus(m)),onKeyDown:Ke(e.onKeyDown,k=>{if(k.key==="Tab"&&k.shiftKey){y.onItemShiftTab();return}if(k.target!==k.currentTarget)return;const R=she(k,y.orientation,y.dir);if(R!==void 0){if(k.metaKey||k.ctrlKey||k.altKey||k.shiftKey)return;k.preventDefault();let M=S().filter(I=>I.focusable).map(I=>I.ref.current);if(R==="last")M.reverse();else if(R==="prev"||R==="next"){R==="prev"&&M.reverse();const I=M.indexOf(k.currentTarget);M=y.loop?uhe(M,I+1):M.slice(I+1)}setTimeout(()=>qB(M))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:E!=null}):u})})});WB.displayName=ZB;var ihe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lhe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function she(e,t,n){const r=lhe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ihe[r]}function qB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function uhe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var JB=YB,QB=WB,G2="Tabs",[che,ZSe]=gs(G2,[F2]),KB=F2(),[fhe,Qk]=che(G2),eL=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:h="automatic",...m}=e,y=P2(d),[v,S]=cf({prop:r,onChange:a,defaultProp:l??"",caller:G2});return T.jsx(fhe,{scope:n,baseId:ys(),value:v,onValueChange:S,orientation:u,dir:y,activationMode:h,children:T.jsx(It.div,{dir:y,"data-orientation":u,...m,ref:t})})});eL.displayName=G2;var tL="TabsList",nL=z.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,l=Qk(tL,n),u=KB(n);return T.jsx(JB,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:r,children:T.jsx(It.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});nL.displayName=tL;var rL="TabsTrigger",oL=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...l}=e,u=Qk(rL,n),d=KB(n),h=lL(u.baseId,r),m=sL(u.baseId,r),y=r===u.value;return T.jsx(QB,{asChild:!0,...d,focusable:!a,active:y,children:T.jsx(It.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":m,"data-state":y?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:h,...l,ref:t,onMouseDown:Ke(e.onMouseDown,v=>{!a&&v.button===0&&v.ctrlKey===!1?u.onValueChange(r):v.preventDefault()}),onKeyDown:Ke(e.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&u.onValueChange(r)}),onFocus:Ke(e.onFocus,()=>{const v=u.activationMode!=="manual";!y&&!a&&v&&u.onValueChange(r)})})})});oL.displayName=rL;var aL="TabsContent",iL=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:l,...u}=e,d=Qk(aL,n),h=lL(d.baseId,r),m=sL(d.baseId,r),y=r===d.value,v=z.useRef(y);return z.useEffect(()=>{const S=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(S)},[]),T.jsx(yl,{present:a||y,children:({present:S})=>T.jsx(It.div,{"data-state":y?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!S,id:m,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:v.current?"0s":void 0},children:S&&l})})});iL.displayName=aL;function lL(e,t){return`${e}-trigger-${t}`}function sL(e,t){return`${e}-content-${t}`}var Kk=eL,eR=nL,Pv=oL,Hv=iL;const dhe=({})=>{const e=Wt(),t=ua(),{description:n,id:r,node_id:a,node_name:l,reset_inputs_on_trigger:u}=t.useShallow(v=>({description:v.description,id:v.id,node_id:v.node_id,node_name:v.node_name,reset_inputs_on_trigger:v.reset_inputs_on_trigger})),[d,h]=z.useState(n||"");z.useEffect(()=>h(n||""),[n]);const m=v=>h(v.target.value),y=()=>{d!==(n||"")&&e.on_node_action({type:"update",from_remote:!1,id:r,node:{description:d}})};return T.jsxs("div",{className:"nodesettings-section funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-name-${r}`,children:"Name:"}),T.jsx(tR,{})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Instance ID:"}),T.jsx("span",{children:r})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type ID:"}),T.jsx("span",{children:a})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type Name:"}),T.jsx("span",{children:l})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-desc-${r}`,children:"Description:"}),T.jsx("textarea",{id:`node-desc-${r}`,value:d,onChange:m,onBlur:y,className:"styledinput",rows:3})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Reset Inputs on Trigger:"}),T.jsx("input",{type:"checkbox",checked:u,onChange:v=>{e.on_node_action({type:"update",from_remote:!1,id:r,node:{reset_inputs_on_trigger:v.target.checked}})},className:"styledcheckbox"})]})]})},hhe=({splitnodesettingsPath:e=[]})=>{const t=ua(),n=t.use(r=>r.inputs);return T.jsxs(Kk,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx(eR,{className:"nodesettings-tabs-list","aria-label":"Manage node inputs",children:n.map(r=>T.jsx(Pv,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(Hv,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ef.Provider,{value:a,children:T.jsx(FB,{})})},r)})]})},phe=({splitnodesettingsPath:e=[]})=>{const t=ua(),n=t.use(r=>r.outputs);return T.jsxs(Kk,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx(eR,{className:"nodesettings-tabs-list","aria-label":"Manage node outputs",children:n.map(r=>T.jsx(Pv,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(Hv,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ef.Provider,{value:a,children:T.jsx(FB,{})})},r)})]})},mhe=({nodeSettingsPath:e})=>{const t=e.split("/")||["general"];return T.jsxs(Kk,{defaultValue:t[0]||"general",className:"nodesettings-tabs funcnodes-control-root",children:[T.jsxs(eR,{className:"nodesettings-tabs-list","aria-label":"Manage node settings",children:[T.jsx(Pv,{value:"general",className:"nodesettings-tabs-trigger",children:"General"}),T.jsx(Pv,{value:"inputs",className:"nodesettings-tabs-trigger",children:"Inputs"}),T.jsx(Pv,{value:"outputs",className:"nodesettings-tabs-trigger",children:"Outputs"})]}),T.jsx(Hv,{value:"general",className:"nodesettings-tabs-content",children:T.jsx(dhe,{})}),T.jsx(Hv,{value:"inputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(hhe,{splitnodesettingsPath:t.slice(1)})}),T.jsx(Hv,{value:"outputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(phe,{splitnodesettingsPath:t.slice(1)})})]})},ghe=z.memo(({isOpen:e,onOpenChange:t,nodeSettingsPath:n})=>{const a=ua().use(l=>l.id);return T.jsx(Iu,{title:`Node Settings: ${a}`,open:e,onOpenChange:t,dialogClassName:"nodesettings-dialog",children:T.jsx(mhe,{nodeSettingsPath:n})})}),yhe=z.memo(({toogleShowSettings:e})=>{const t=Wt(),{node:n}=yo(),r=ua(),{id:a,description:l,node_name:u}=r.useShallow(h=>({id:h.id,description:h.description,node_name:h.node_name})),d=z.useCallback(()=>{t.on_node_action({type:"trigger",from_remote:!1,id:a})},[t,a]);return T.jsxs("div",{className:"nodeheader",title:l||u,children:[T.jsxs("div",{className:"nodeheader_element",children:[T.jsx(gJ,{fontSize:"inherit",className:"triggerbutton nodeheaderbutton ",onClick:d}),T.jsx(mJ,{fontSize:"inherit",className:"nodestatusbutton nodeheaderbutton",onClick:async()=>{n&&console.log("nodestatus",await n.get_node_status(a))}}),T.jsx(vJ,{fontSize:"inherit",className:"nodesettingsbutton nodeheaderbutton",onClick:()=>{e?.()}})]}),T.jsx("div",{className:"nodeheader_element nodeheader_title",children:T.jsx("div",{className:"nodeheader_title_text",children:u})}),T.jsx("div",{className:"nodeheader_element",children:T.jsx(K0,{fontSize:"inherit"})})]})}),vhe=z.memo(({iostore:e})=>{const t=e.use(),r=ua().use(d=>d.render_options),a=Bv(t.id),[l,u]=jde(t);return T.jsx("div",{className:"nodrag nodedatabody","data-src":r?.data?.src||"",children:l&&t&&T.jsx(Ef.Provider,{value:e,children:T.jsx(Iu,{title:t.full_id,trigger:T.jsx("div",{className:"nodedatabutton",children:T.jsx(HB,{Component:l})}),onOpenChange:d=>{d&&a?.()},children:u&&T.jsx(PB,{Component:u,iostore:e})})})})}),bhe=z.memo(({setShowSettings:e,setNodeSettingsPath:t})=>{const n=ua(),{render_options:r,outputs:a,inputs:l}=n.useShallow(d=>({render_options:d.render_options,outputs:d.outputs,inputs:d.inputs})),u=r?.data?.src?n.io_stores.get(r?.data?.src):void 0;return T.jsxs("div",{className:"nodebody nowheel ",children:[a.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ef.Provider,{value:h,children:T.jsx(Hde,{setNodeSettingsPath:t,setShowSettings:e})},d)}),u&&T.jsx(vhe,{iostore:u}),l.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ef.Provider,{value:h,children:T.jsx(Pde,{setNodeSettingsPath:t,setShowSettings:e})},d)})]})}),tR=()=>{const e=ua(),{original_name:t,id:n}=e.useShallow(h=>({original_name:h.name,id:h.id})),[r,a]=q.useState(t);q.useEffect(()=>{a(t)},[t]);const l=Wt(),u=h=>{a(h.target.value)},d=h=>{const m=h.target.value;m!==t&&l.on_node_action({type:"update",from_remote:!1,id:n,node:{name:m}})};return T.jsx("input",{className:"nodename_input",value:r,onChange:u,onBlur:d})},xhe=()=>{const t=ua().use(n=>n.progress);return t?T.jsx(fne,{state:t,className:"nodeprogress"}):null},She=z.memo(()=>{const t=ua().use(n=>n.error);return T.jsxs("div",{className:"nodefooter",children:[t&&T.jsx("div",{className:"nodeerror",children:t}),T.jsx(xhe,{})]})}),whe=()=>{const e=ua(),{collapsed:t,error:n,node_id:r}=e.useShallow(A=>({collapsed:A.properties["frontend:collapsed"]||!1,error:A.error,node_id:A.node_id})),{visualTrigger:a}=Lde(e),[l,u]=q.useState(!1),[d,h]=q.useState(""),{keys:m}=FA(),v=z.useContext(Yu).NodeHooks[r]??[],S=z.useCallback(()=>{u(A=>!A)},[]),w=A=>{m.has("s")&&!l&&(h(""),u(!0),A.stopPropagation())};return T.jsxs("div",{className:"innernode"+(a?" intrigger":"")+(n?" error":""),onClick:w,children:[T.jsx(yhe,{toogleShowSettings:S}),T.jsx(tR,{}),t?null:T.jsx(bhe,{setNodeSettingsPath:h,setShowSettings:u}),T.jsx(She,{}),T.jsx(ghe,{isOpen:l,onOpenChange:u,nodeSettingsPath:d}),v.map((A,E)=>T.jsx(z.Fragment,{children:T.jsx(A,{})},E))]})},Ehe=z.memo(({data:e})=>T.jsx(V2.Provider,{value:e.nodestore,children:T.jsx(whe,{})}),(e,t)=>e.data.nodestore===t.data.nodestore),Che=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:a,sourcePosition:l,targetPosition:u,data:d,...h})=>{const[m]=xk({sourceX:t,sourceY:n,sourcePosition:l,targetX:r,targetY:a,targetPosition:u});return T.jsx(T.Fragment,{children:T.jsx(Iv,{id:e,path:m,...h})})},_he={default:Ehe,group:qfe},Ahe={default:Che},The=e=>({nodes:e.getNodes(),edges:e.getEdges(),onNodesChange:e.onNodesChange,onEdgesChange:e.onEdgesChange,onConnect:e.onConnect}),nR=e=>{const t=new Set,n=e.filter(a=>a.type==="group");n.forEach(a=>{t.add(a.id)});const r=e.filter(a=>!t.has(a.id));return{group_nodes:n,default_nodes:r}};function rR(e){const t=new Map(e.map(u=>[u.id,u])),n=new Map,r=[];for(const u of e)if(n.has(u.id)||n.set(u.id,[]),u.parentId&&t.has(u.parentId)){const d=t.get(u.parentId);if(d){const h=n.get(d.id)||[];h.push(u),n.set(d.id,h)}else r.push(u)}else r.push(u);const a=[];function l(u){a.push(u);const d=n.get(u.id)||[];for(const h of d)l(h)}for(const u of r)l(u);if(a.length!==e.length){console.warn("Sorting mismatch: Not all nodes could be placed. Check for circular dependencies or missing parents.");const u=new Set(a.map(d=>d.id));e.forEach(d=>{u.has(d.id)||a.push(d)})}return a}const uL=()=>{const{getNodes:e}=fh();return{getNodes:e,getSelectedNodes:a=>(a===void 0&&(a=e()),a.filter(l=>l.selected)),getSplitNodes:a=>{a===void 0&&(a=e());const{group_nodes:l,default_nodes:u}=nR(a);return{group_nodes:l,default_nodes:u}},getSortedNodes:a=>(a===void 0&&(a=e()),rR(a))}},cL=(e,t)=>{const n=e.getState(),{new_obj:r,change:a}=Ud(n,t);a&&e.setState(r)},fL=e=>mi(e);function dL(e){return e!=null&&typeof e=="object"&&"id"in e&&typeof e.id=="string"}const hL=e=>{let t=e.io??{},n=e.io_order,r=[];const a={};if(n===void 0)if(Array.isArray(t)){const l=t.filter(dL);r=l.map(u=>u.id);for(const u of l)a[u.id]=u}else{r=Object.keys(t);for(const l in t)t[l]!==void 0&&(a[l]=t[l])}else if(r=n,Array.isArray(t)){const l=t.filter(dL);for(const u of l)a[u.id]=u,r.includes(u.id)||r.push(u.id)}else for(const l in t)t[l]!==void 0&&(a[l]=t[l]),r.includes(l)||r.push(l);return{...e,io_order:r,io:a}},khe={id:"dummy",node_id:"dummy",node_name:"dummy",properties:{"frontend:size":[200,100],"frontend:pos":[NaN,NaN],"frontend:collapsed":!1},io:{},io_order:[],name:"dummy",in_trigger:!1,reset_inputs_on_trigger:!1,progress:{ascii:!1,elapsed:0,initial:0,n:0,prefix:"idle",unit:"it",unit_divisor:1e3,unit_scale:!1}},Rhe={id:"dummy",name:"dummy",node:"dummy",full_id:"dummy",type:"any",value:void 0,is_input:!1,connected:!1,does_trigger:!0,fullvalue:void 0,render_options:{set_default:!0,type:"any"},hidden:!1,emit_value_set:!0,required:!1},Ohe=n_(khe),Mhe=n_(Rhe),Nhe=e=>{const t=e.io_order;if(t===void 0)throw new Error("Node must have io_order");return{...e,inputs:Object.keys(e.io).filter(r=>e.io[r].is_input),outputs:Object.keys(e.io).filter(r=>!e.io[r].is_input),io_order:t}},Dhe=e=>(e.value==="<NoValue>"&&(e.value=void 0),e.fullvalue==="<NoValue>"&&(e.fullvalue=void 0),e.hidden===void 0&&(e.hidden=!1),[{...e},e.value,e.fullvalue]),Ihe=e=>{if(!e.id)throw new Error("Node must have an id");const t=Ohe(e);return Nhe(t)},zhe=(e,t)=>{const n=e.getState(),r={},a=hL(t),l=Object.keys(a);for(const u of l)switch(u){case"id":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"node_id":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"node_name":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"name":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"in_trigger":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"error":{a[u]!==n[u]&&(r[u]=a[u]);break}case"render_options":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"io_order":{const[d,h]=((m,y)=>y===void 0?[m,!1]:[y,!t_(m,y)])(n[u],a[u]);h&&(r[u]=d.filter(m=>m!==void 0));break}case"io":{const d=a[u];if(d===void 0)break;for(const h in d){const m=e.io_stores.get(h);if(!m){console.error("io key not found in oldvalue:",h);continue}m.update(d[h])}break}case"progress":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"description":{r[u]=a[u];break}case"properties":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"status":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"reset_inputs_on_trigger":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}default:try{XM(u,a[u])}catch(d){console.error(d)}}Object.keys(r).length>0&&e.setState(r)},jhe=(e,t)=>{const n=e.getState(),r={},a={},l=Object.keys(t);for(const u of l)switch(u){case"name":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"id":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"connected":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"does_trigger":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"hidden":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"full_id":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"is_input":break;case"node":break;case"type":break;case"value":{a.preview=t[u];break}case"fullvalue":{a.full=t[u];break}case"render_options":{const[d,h]=em(n[u],t[u]);h&&(r[u]=d);break}case"value_options":{const[d,h]=em(n[u],t[u]);h&&(r[u]=d);break}case"valuepreview_type":{r[u]=t[u];break}case"emit_value_set":{r[u]=t[u];break}case"default":{r[u]=t[u];break}case"required":{r[u]=t[u];break}default:try{XM(u,t[u])}catch(d){console.error(d)}}Object.keys(a).length>0&&e.updateValueStore(a),Object.keys(r).length>0&&e.setState(r)},Bhe=e=>{if(!e.id)throw new Error("IO must have an id but is missing for "+JSON.stringify(e));e.name===void 0&&(e.name=e.id);const t=Mhe(e);return(t.render_options.type==="any"||t.render_options.type===void 0)&&(t.render_options.type=t.type),Dhe(t)},Lhe=(e,t)=>{let n;const[r,a,l]=Bhe(t);return n={io_state:fL((u,d)=>r),use:u=>u?n.io_state(u):n.io_state(),useShallow:u=>n.io_state(Bk(u)),getState:()=>n.io_state.getState(),setState:u=>{n.io_state.setState(u)},update:u=>{jhe(n,u)},valuestore:mi((u,d)=>{let h=a;h==="<NoValue>"&&(h=void 0),!(h instanceof El)&&h!==void 0&&(h=Vu.fromObject(h));let m=l;return m==="<NoValue>"&&(m=void 0),!(m instanceof El)&&m!==void 0&&(m=Vu.fromObject(m)),{preview:h,full:m}}),updateValueStore:u=>{n.valuestore.setState(d=>(d.preview&&typeof d.preview.dispose=="function"&&d.preview.dispose(),d.full&&typeof d.full.dispose=="function"&&d.full.dispose(),u.preview!==void 0&&u.full===void 0&&(u.full=void 0,d.full=void 0),u.preview!==void 0&&!(u.preview instanceof El)&&(u.preview=Vu.fromObject(u.preview)),u.full!==void 0&&!(u.full instanceof El)&&(u.full=Vu.fromObject(u.full)),{...d,...u}))},node:e,serialize:()=>{const u=n.io_state.getState(),d=n.valuestore.getState();return{...u,value:d.preview,fullvalue:d.full,render_options:u.render_options,valuepreview_type:u.valuepreview_type,emit_value_set:u.emit_value_set}}},n},Phe=e=>{const t={use:l=>l?r.node_state(l):r.node_state(),useShallow:l=>r.node_state(Bk(l)),io_stores:new Map,getState:()=>r.node_state.getState(),setState:l=>{r.node_state.setState(l)},update:l=>{zhe(r,l)},serialize:()=>({...r.node_state.getState(),io:Object.fromEntries(Array.from(r.io_stores.entries()).map(([d,h])=>[d,h.serialize()]))})},n=hL(e),r={...t,node_state:fL((l,u)=>Ihe(n))},a=n.io;return Object.entries(a).forEach(([l,u])=>{u!==void 0&&r.io_stores.set(l,Lhe(n.id,u))}),r},Hhe=()=>{const e=Wt();return{onSelectionChange:q.useCallback(({nodes:n,edges:r})=>{const{group_nodes:a,default_nodes:l}=nR(n),u=e.local_state.getState();e.local_state.setState({...u,selected_nodes:l.map(d=>d.id),selected_edges:r.map(d=>d.id),selected_groups:a.map(d=>d.id)})},[e])}},Vhe=()=>{const e=fh(),t=Wt();return t.rf_instance=e,T.jsx(T.Fragment,{})},Fhe=()=>{const e=Wt(),{getEdges:t}=fh(),{getSelectedNodes:n}=uL();return{copySelectedNodes:q.useCallback(()=>{const a=t(),l=n();if(l.length===0)return;const u={nodes:[],edges:[]};for(const m of l){const y=e.nodespace.get_node(m.id,!1);y&&u.nodes.push(y.serialize())}const d=new Set(l.map(m=>m.id)),h=a.filter(m=>d.has(m.source)&&d.has(m.target));for(const m of h)!m.sourceHandle||!m.targetHandle||u.edges.push({src_nid:m.source,src_ioid:m.sourceHandle,trg_nid:m.target,trg_ioid:m.targetHandle});navigator.clipboard.writeText(JSON.stringify(u))},[n,t,e])}},Ghe=()=>{const e=Xu("Delete"),t=Xu(["Meta+c","Control+c","Strg+c"]),n=Xu(["Control+g","Meta+g"]),r=Xu(["Control+Alt+g","Meta+Alt+g"]),a=Zfe(),{getEdges:l}=fh(),{getNodes:u,getSelectedNodes:d,getSplitNodes:h}=uL(),{copySelectedNodes:m}=Fhe(),{node:y,group:v,edge:S}=yo();return q.useEffect(()=>{if(e){const w=l().filter(R=>R.selected);for(const R of w)!R.source||!R.target||!R.sourceHandle||!R.targetHandle||S?.remove_edge({src_nid:R.source,src_ioid:R.sourceHandle,trg_nid:R.target,trg_ioid:R.targetHandle});const A=d(),{group_nodes:E,default_nodes:k}=h(A);for(const R of k)y?.remove_node(R.id);for(const R of E)v?.remove_group(R.id)}},[e,u,l,y,v,S]),q.useEffect(()=>{t&&m()},[t,m]),q.useEffect(()=>{if(n){const w=d(),{group_nodes:A,default_nodes:E}=h(w);w.length>0&&a(E.map(k=>k.id),A.map(k=>k.id))}},[n,u]),q.useEffect(()=>{if(r){console.log("ungroupPressed");const w=d(),{group_nodes:A}=h(w);A.forEach(E=>{v?.remove_group(E.id)})}},[r,u]),T.jsx(T.Fragment,{})},Uhe=()=>{const{node:e,edge:t}=yo(),n=Wt();return z.useCallback(async(a,l)=>{try{if(!a||!e||!t)return;const u=JSON.parse(a);if(!u||!n.worker||!u.nodes)return;const d=[0,0];for(const m of u.nodes)d[0]+=m.properties["frontend:pos"][0],d[1]+=m.properties["frontend:pos"][1];d[0]/=u.nodes.length,d[1]/=u.nodes.length;const h=[];for(const m of u.nodes){const y={id:m.node_id,src_id:m.id,position:[m.properties["frontend:pos"][0]-d[0],m.properties["frontend:pos"][1]-d[1]]};h.push(y)}for(const m of h){const y=await e.add_node(m.id);!y||!n.nodespace.get_node(y.id,!1)||(m.new_id=y.id,l([{id:y.id,type:"position",position:{x:m.position[0]+y.properties["frontend:pos"][0],y:m.position[1]+y.properties["frontend:pos"][1]}}]))}for(const m of u.edges){const y=h.find(S=>S.src_id===m.src_nid),v=h.find(S=>S.src_id===m.trg_nid);!y||!v||!y.new_id||!v.new_id||t.add_edge({src_nid:y.new_id,src_ioid:m.src_ioid,trg_nid:v.new_id,trg_ioid:m.trg_ioid})}}catch(u){console.error("Failed to process pasted data:",u)}},[e,t,n])},$he=(e,t)=>{const n=e.properties||{};n["frontend:size"]||(n["frontend:size"]=[200,100]);const r=n["frontend:pos"];if(!r||r.length!==2||isNaN(r[0])||r[0]===null||isNaN(r[1])||r[1]===null)if(!t||!t.rf_instance||t.reactflowRef===null)n["frontend:pos"]=[0,0];else{const l=t.reactflowRef.getBoundingClientRect(),u=l.left+l.width/2,d=l.top+l.height/2,h=t.rf_instance.screenToFlowPosition({x:u,y:d});n["frontend:pos"]=[h.x-n["frontend:size"][0]/2,h.y-n["frontend:size"][0]/2]}n["frontend:collapsed"]||(n["frontend:collapsed"]=!1),e.properties=n},Xhe=(e,t)=>{const n=e.getState();if($he(n,t),n.id===void 0)throw new Error("Node must have an id");const r={nodestore:e};return{position:{x:n.properties["frontend:pos"][0],y:n.properties["frontend:pos"][1]},data:r,type:"default",zIndex:1003,...n}},pL={default:Po.Dots,metal:Po.Cross,light:Po.Dots,solarized:Po.Dots,midnight:Po.Dots,forest:Po.Dots,scientific:Po.Lines},Yhe=e=>{const t=Wt(),n=q.useRef(null),{colorTheme:r}=lI(),{onSelectionChange:a}=Hhe(),l=ore();z.useEffect(()=>{t.getStateManager().toaster=l},[]),q.useEffect(()=>{t.reactflowRef=n.current},[n]);const{nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y}=t.useReactFlowStore(Bk(The)),v=Uhe(),S=q.useCallback(w=>{const A=n.current;if(!A)return;let E=w.target,k=0;for(;E&&E.parentElement&&E!==A;)k++,E=E.parentElement;t.logger.debug(`onPasteCapture: ${k} steps to reactflow`),k<=2&&v(w.clipboardData.getData("text/plain"),h)},[v,h,t.logger]);return T.jsx("div",{className:"reactflowlayer",children:T.jsxs(vfe,{onPasteCapture:S,nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y,nodeTypes:_he,edgeTypes:Ahe,minZoom:e.minZoom,maxZoom:e.maxZoom,fitView:!0,onSelectionChange:a,ref:n,panOnDrag:!e.static,children:[T.jsx(Vhe,{}),T.jsx(Ghe,{}),T.jsx(Efe,{color:"#888",gap:24,size:2,variant:pL[r]||pL.default,patternClassName:"fn-background-pattern"}),e.minimap&&T.jsx(Ffe,{nodeStrokeWidth:3,pannable:!e.static,zoomable:!e.static,zoomStep:3})]})})},Zhe=({on_node_change:e,on_edge_change:t,on_connect:n})=>{const r=e||(d=>{}),a=t||(d=>{}),l=n||(d=>{});return mi((d,h)=>({_nodes:[],_edges:[],_nodes_map:new Map,update_nodes:m=>{m=rR(m),d({_nodes:m,_nodes_map:new Map(m.map(y=>[y.id,y]))})},partial_update_nodes:m=>{const y=h(),v=y._nodes,S=new Map(v.map(w=>[w.id,w]));for(const w of m)S.set(w.id,w);y.update_nodes(Array.from(S.values()))},update_edges:m=>{d({_edges:m})},onNodesChange:m=>{const y=h();y.update_nodes(Nk(m,y._nodes)),r(m)},onEdgesChange:m=>{d({_edges:_6(m,h()._edges)}),a(m)},onConnect:m=>{m.source==null||m.target==null||l(m)},getNode:m=>h()._nodes_map.get(m),getNodes:()=>h()._nodes,getEdges:()=>h()._edges}))},Whe=()=>{const t=Wt().progress_state();return T.jsxs("div",{className:"statusbar",children:[T.jsx("span",{className:"statusbar-progressbar",style:{width:Math.min(100,100*t.progress)+"%"}}),T.jsx("span",{className:"statusbar-message",children:t.message})]})},U2=!1;var oR=["Enter"," "],qhe=["ArrowDown","PageUp","Home"],mL=["ArrowUp","PageDown","End"],Jhe=[...qhe,...mL],Qhe={ltr:[...oR,"ArrowRight"],rtl:[...oR,"ArrowLeft"]},Khe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Vv="Menu",[Fv,epe,tpe]=zw(Vv),[ph,gL]=gs(Vv,[tpe,xw,F2]),Gv=xw(),yL=F2(),[vL,mh]=ph(Vv),[npe,Uv]=ph(Vv),bL=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:l,modal:u=!0}=e,d=Gv(t),[h,m]=z.useState(null),y=z.useRef(!1),v=aa(l),S=P2(a);return z.useEffect(()=>{const w=()=>{y.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>y.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),T.jsx(rT,{...d,children:T.jsx(vL,{scope:t,open:n,onOpenChange:v,content:h,onContentChange:m,children:T.jsx(npe,{scope:t,onClose:z.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:S,modal:u,children:r})})})};bL.displayName=Vv;var rpe="MenuAnchor",aR=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Gv(n);return T.jsx(oT,{...a,...r,ref:t})});aR.displayName=rpe;var ope="MenuPortal",[WSe,xL]=ph(ope,{forceMount:void 0}),gi="MenuContent",[ape,iR]=ph(gi),SL=z.forwardRef((e,t)=>{const n=xL(gi,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=mh(gi,e.__scopeMenu),u=Uv(gi,e.__scopeMenu);return T.jsx(Fv.Provider,{scope:e.__scopeMenu,children:T.jsx(yl,{present:r||l.open,children:T.jsx(Fv.Slot,{scope:e.__scopeMenu,children:u.modal?T.jsx(ipe,{...a,ref:t}):T.jsx(lpe,{...a,ref:t})})})})}),ipe=z.forwardRef((e,t)=>{const n=mh(gi,e.__scopeMenu),r=z.useRef(null),a=bn(t,r);return z.useEffect(()=>{const l=r.current;if(l)return K_(l)},[]),T.jsx(lR,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ke(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lpe=z.forwardRef((e,t)=>{const n=mh(gi,e.__scopeMenu);return T.jsx(lR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),spe=dm("MenuContent.ScrollLock"),lR=z.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,disableOutsideScroll:A,...E}=e,k=mh(gi,n),R=Uv(gi,n),D=Gv(n),M=yL(n),I=epe(n),[L,P]=z.useState(null),G=z.useRef(null),$=bn(t,G,k.onContentChange),Z=z.useRef(0),j=z.useRef(""),X=z.useRef(0),ee=z.useRef(null),ae=z.useRef("right"),U=z.useRef(0),te=A?GS:z.Fragment,V=A?{as:spe,allowPinchZoom:!0}:void 0,W=ne=>{const B=j.current+ne,oe=I().filter(Ee=>!Ee.disabled),se=document.activeElement,Y=oe.find(Ee=>Ee.ref.current===se)?.textValue,he=oe.map(Ee=>Ee.textValue),ke=xpe(he,B,Y),me=oe.find(Ee=>Ee.textValue===ke)?.ref.current;(function Ee(xe){j.current=xe,window.clearTimeout(Z.current),xe!==""&&(Z.current=window.setTimeout(()=>Ee(""),1e3))})(B),me&&setTimeout(()=>me.focus())};z.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Y_();const Q=z.useCallback(ne=>ae.current===ee.current?.side&&wpe(ne,ee.current?.area),[]);return T.jsx(ape,{scope:n,searchRef:j,onItemEnter:z.useCallback(ne=>{Q(ne)&&ne.preventDefault()},[Q]),onItemLeave:z.useCallback(ne=>{Q(ne)||(G.current?.focus(),P(null))},[Q]),onTriggerLeave:z.useCallback(ne=>{Q(ne)&&ne.preventDefault()},[Q]),pointerGraceTimerRef:X,onPointerGraceIntentChange:z.useCallback(ne=>{ee.current=ne},[]),children:T.jsx(te,{...V,children:T.jsx(IS,{asChild:!0,trapped:a,onMountAutoFocus:Ke(l,ne=>{ne.preventDefault(),G.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:T.jsx(G0,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,children:T.jsx(JB,{asChild:!0,...M,dir:R.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:P,onEntryFocus:Ke(h,ne=>{R.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:T.jsx(FI,{role:"menu","aria-orientation":"vertical","data-state":PL(k.open),"data-radix-menu-content":"",dir:R.dir,...D,...E,ref:$,style:{outline:"none",...E.style},onKeyDown:Ke(E.onKeyDown,ne=>{const oe=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,se=ne.ctrlKey||ne.altKey||ne.metaKey,Y=ne.key.length===1;oe&&(ne.key==="Tab"&&ne.preventDefault(),!se&&Y&&W(ne.key));const he=G.current;if(ne.target!==he||!Jhe.includes(ne.key))return;ne.preventDefault();const me=I().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);mL.includes(ne.key)&&me.reverse(),vpe(me)}),onBlur:Ke(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(Z.current),j.current="")}),onPointerMove:Ke(e.onPointerMove,Xv(ne=>{const B=ne.target,oe=U.current!==ne.clientX;if(ne.currentTarget.contains(B)&&oe){const se=ne.clientX>U.current?"right":"left";ae.current=se,U.current=ne.clientX}}))})})})})})})});SL.displayName=gi;var upe="MenuGroup",sR=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(It.div,{role:"group",...r,ref:t})});sR.displayName=upe;var cpe="MenuLabel",wL=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(It.div,{...r,ref:t})});wL.displayName=cpe;var $2="MenuItem",EL="menu.itemSelect",X2=z.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,l=z.useRef(null),u=Uv($2,e.__scopeMenu),d=iR($2,e.__scopeMenu),h=bn(t,l),m=z.useRef(!1),y=()=>{const v=l.current;if(!n&&v){const S=new CustomEvent(EL,{bubbles:!0,cancelable:!0});v.addEventListener(EL,w=>r?.(w),{once:!0}),F_(v,S),S.defaultPrevented?m.current=!1:u.onClose()}};return T.jsx(CL,{...a,ref:h,disabled:n,onClick:Ke(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),m.current=!0},onPointerUp:Ke(e.onPointerUp,v=>{m.current||v.currentTarget?.click()}),onKeyDown:Ke(e.onKeyDown,v=>{const S=d.searchRef.current!=="";n||S&&v.key===" "||oR.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});X2.displayName=$2;var CL=z.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...l}=e,u=iR($2,n),d=yL(n),h=z.useRef(null),m=bn(t,h),[y,v]=z.useState(!1),[S,w]=z.useState("");return z.useEffect(()=>{const A=h.current;A&&w((A.textContent??"").trim())},[l.children]),T.jsx(Fv.ItemSlot,{scope:n,disabled:r,textValue:a??S,children:T.jsx(QB,{asChild:!0,...d,focusable:!r,children:T.jsx(It.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:m,onPointerMove:Ke(e.onPointerMove,Xv(A=>{r?u.onItemLeave(A):(u.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ke(e.onPointerLeave,Xv(A=>u.onItemLeave(A))),onFocus:Ke(e.onFocus,()=>v(!0)),onBlur:Ke(e.onBlur,()=>v(!1))})})})}),fpe="MenuCheckboxItem",_L=z.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return T.jsx(OL,{scope:e.__scopeMenu,checked:n,children:T.jsx(X2,{role:"menuitemcheckbox","aria-checked":Y2(n)?"mixed":n,...a,ref:t,"data-state":fR(n),onSelect:Ke(a.onSelect,()=>r?.(Y2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_L.displayName=fpe;var AL="MenuRadioGroup",[dpe,hpe]=ph(AL,{value:void 0,onValueChange:()=>{}}),TL=z.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,l=aa(r);return T.jsx(dpe,{scope:e.__scopeMenu,value:n,onValueChange:l,children:T.jsx(sR,{...a,ref:t})})});TL.displayName=AL;var kL="MenuRadioItem",RL=z.forwardRef((e,t)=>{const{value:n,...r}=e,a=hpe(kL,e.__scopeMenu),l=n===a.value;return T.jsx(OL,{scope:e.__scopeMenu,checked:l,children:T.jsx(X2,{role:"menuitemradio","aria-checked":l,...r,ref:t,"data-state":fR(l),onSelect:Ke(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});RL.displayName=kL;var uR="MenuItemIndicator",[OL,ppe]=ph(uR,{checked:!1}),ML=z.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,l=ppe(uR,n);return T.jsx(yl,{present:r||Y2(l.checked)||l.checked===!0,children:T.jsx(It.span,{...a,ref:t,"data-state":fR(l.checked)})})});ML.displayName=uR;var mpe="MenuSeparator",NL=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(It.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});NL.displayName=mpe;var gpe="MenuArrow",DL=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Gv(n);return T.jsx(GI,{...a,...r,ref:t})});DL.displayName=gpe;var cR="MenuSub",[ype,IL]=ph(cR),zL=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,l=mh(cR,t),u=Gv(t),[d,h]=z.useState(null),[m,y]=z.useState(null),v=aa(a);return z.useEffect(()=>(l.open===!1&&v(!1),()=>v(!1)),[l.open,v]),T.jsx(rT,{...u,children:T.jsx(vL,{scope:t,open:r,onOpenChange:v,content:m,onContentChange:y,children:T.jsx(ype,{scope:t,contentId:ys(),triggerId:ys(),trigger:d,onTriggerChange:h,children:n})})})};zL.displayName=cR;var $v="MenuSubTrigger",jL=z.forwardRef((e,t)=>{const n=mh($v,e.__scopeMenu),r=Uv($v,e.__scopeMenu),a=IL($v,e.__scopeMenu),l=iR($v,e.__scopeMenu),u=z.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},y=z.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return z.useEffect(()=>y,[y]),z.useEffect(()=>{const v=d.current;return()=>{window.clearTimeout(v),h(null)}},[d,h]),T.jsx(aR,{asChild:!0,...m,children:T.jsx(CL,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":PL(n.open),...e,ref:DS(t,a.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ke(e.onPointerMove,Xv(v=>{l.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),y()},100))})),onPointerLeave:Ke(e.onPointerLeave,Xv(v=>{y();const S=n.content?.getBoundingClientRect();if(S){const w=n.content?.dataset.side,A=w==="right",E=A?-5:5,k=S[A?"left":"right"],R=S[A?"right":"left"];l.onPointerGraceIntentChange({area:[{x:v.clientX+E,y:v.clientY},{x:k,y:S.top},{x:R,y:S.top},{x:R,y:S.bottom},{x:k,y:S.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(v),v.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Ke(e.onKeyDown,v=>{const S=l.searchRef.current!=="";e.disabled||S&&v.key===" "||Qhe[r.dir].includes(v.key)&&(n.onOpenChange(!0),n.content?.focus(),v.preventDefault())})})})});jL.displayName=$v;var BL="MenuSubContent",LL=z.forwardRef((e,t)=>{const n=xL(gi,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=mh(gi,e.__scopeMenu),u=Uv(gi,e.__scopeMenu),d=IL(BL,e.__scopeMenu),h=z.useRef(null),m=bn(t,h);return T.jsx(Fv.Provider,{scope:e.__scopeMenu,children:T.jsx(yl,{present:r||l.open,children:T.jsx(Fv.Slot,{scope:e.__scopeMenu,children:T.jsx(lR,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&h.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:Ke(e.onFocusOutside,y=>{y.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Ke(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:Ke(e.onKeyDown,y=>{const v=y.currentTarget.contains(y.target),S=Khe[u.dir].includes(y.key);v&&S&&(l.onOpenChange(!1),d.trigger?.focus(),y.preventDefault())})})})})})});LL.displayName=BL;function PL(e){return e?"open":"closed"}function Y2(e){return e==="indeterminate"}function fR(e){return Y2(e)?"indeterminate":e?"checked":"unchecked"}function vpe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function bpe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function xpe(e,t,n){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=bpe(e,Math.max(l,0));a.length===1&&(u=u.filter(m=>m!==n));const h=u.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function Spe(e,t){const{x:n,y:r}=e;let a=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],m=d.x,y=d.y,v=h.x,S=h.y;y>r!=S>r&&n<(v-m)*(r-y)/(S-y)+m&&(a=!a)}return a}function wpe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Spe(n,t)}function Xv(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Epe=bL,Cpe=aR,_pe=SL,Ape=sR,Tpe=wL,kpe=X2,Rpe=_L,Ope=TL,Mpe=RL,Npe=ML,Dpe=NL,Ipe=DL,zpe=zL,jpe=jL,Bpe=LL,Z2="DropdownMenu",[Lpe,qSe]=gs(Z2,[gL]),Vo=gL(),[Ppe,HL]=Lpe(Z2),VL=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=Vo(t),m=z.useRef(null),[y,v]=cf({prop:a,defaultProp:l??!1,onChange:u,caller:Z2});return T.jsx(Ppe,{scope:t,triggerId:ys(),triggerRef:m,contentId:ys(),open:y,onOpenChange:v,onOpenToggle:z.useCallback(()=>v(S=>!S),[v]),modal:d,children:T.jsx(Epe,{...h,open:y,onOpenChange:v,dir:r,modal:d,children:n})})};VL.displayName=Z2;var FL="DropdownMenuTrigger",GL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,l=HL(FL,n),u=Vo(n);return T.jsx(Cpe,{asChild:!0,...u,children:T.jsx(It.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:DS(t,l.triggerRef),onPointerDown:Ke(e.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Ke(e.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});GL.displayName=FL;var UL="DropdownMenuContent",$L=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=HL(UL,n),l=Vo(n),u=z.useRef(!1);return T.jsx(_pe,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...r,ref:t,onCloseAutoFocus:Ke(e.onCloseAutoFocus,d=>{u.current||a.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Ke(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,y=h.button===2||m;(!a.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$L.displayName=UL;var Hpe="DropdownMenuGroup",XL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Ape,{...a,...r,ref:t})});XL.displayName=Hpe;var Vpe="DropdownMenuLabel",Fpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Tpe,{...a,...r,ref:t})});Fpe.displayName=Vpe;var Gpe="DropdownMenuItem",YL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(kpe,{...a,...r,ref:t})});YL.displayName=Gpe;var Upe="DropdownMenuCheckboxItem",$pe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Rpe,{...a,...r,ref:t})});$pe.displayName=Upe;var Xpe="DropdownMenuRadioGroup",ZL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Ope,{...a,...r,ref:t})});ZL.displayName=Xpe;var Ype="DropdownMenuRadioItem",WL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Mpe,{...a,...r,ref:t})});WL.displayName=Ype;var Zpe="DropdownMenuItemIndicator",Wpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Npe,{...a,...r,ref:t})});Wpe.displayName=Zpe;var qpe="DropdownMenuSeparator",Jpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Dpe,{...a,...r,ref:t})});Jpe.displayName=qpe;var Qpe="DropdownMenuArrow",Kpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Ipe,{...a,...r,ref:t})});Kpe.displayName=Qpe;var eme=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:a,defaultOpen:l}=e,u=Vo(t),[d,h]=cf({prop:r,defaultProp:l??!1,onChange:a,caller:"DropdownMenuSub"});return T.jsx(zpe,{...u,open:d,onOpenChange:h,children:n})},tme="DropdownMenuSubTrigger",qL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(jpe,{...a,...r,ref:t})});qL.displayName=tme;var nme="DropdownMenuSubContent",JL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Bpe,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});JL.displayName=nme;var dR=VL,hR=GL,pR=$L,mR=XL,Zu=YL,rme=ZL,ome=WL,ame=eme,ime=qL,lme=JL;const sme=({trigger:e,setOpen:t,open:n})=>{const[r,a]=q.useState(""),[l,u]=q.useState(!0),d=Wt();return d.options.useWorkerManager?T.jsxs(Iu,{setOpen:t,open:n,trigger:e,title:"New Worker",description:"Create a new worker",children:[T.jsxs("div",{children:["Name:",T.jsx("br",{}),T.jsx("input",{className:"styledinput",onChange:h=>{a(h.currentTarget.value)},value:r}),T.jsxs("div",{style:{marginTop:8},children:[T.jsx("input",{type:"checkbox",id:"inVenvCheckbox",checked:l,onChange:h=>u(h.currentTarget.checked)}),T.jsx("label",{htmlFor:"inVenvCheckbox",style:{marginLeft:4},children:"Create in new virtual environment"})]})]}),T.jsx("div",{children:r&&T.jsx("div",{children:T.jsx("button",{className:"styledbtn",onClick:()=>{d.workermanager?.new_worker({name:r,in_venv:l}),t(!1)},children:"Create"})})})]}):null},ume=({trigger:e,setOpen:t,open:n})=>{const r=Wt(),[a,l]=q.useState(!1),u=r.workers(),d=r.worker?.uuid,h=(d?u[d]?.name:void 0)||d||"worker",m=async()=>{if(!r.worker)return;const y=await r.worker.export({withFiles:a});d7(y,h+".fnw","application/zip"),t(!1)};return T.jsx(Iu,{setOpen:t,open:n,trigger:e,title:"Export Worker",description:"Export the worker as a .fnw file",children:T.jsxs("div",{children:[T.jsxs("div",{children:[T.jsx("input",{type:"checkbox",className:"styledcheckbox",checked:a,onChange:y=>{l(y.currentTarget.checked)}}),"Include Files"]}),T.jsx("button",{className:"styledbtn",onClick:m,children:"Export"})]})})},cme=()=>{const e=Wt(),t=e.workers(),[n,r]=q.useState(!1),[a,l]=q.useState(!1),u=w=>{w!=="__select__"&&e.workers&&e.workermanager&&t[w]&&(!t[w].active&&!window.confirm("this is an inactive worker, selecting it will start it, continue?")||e.workermanager.set_active(w))},d=async()=>{if(!e.worker||!window.confirm("Updateing the worker might replace the current nodespace, continue?"))return;const A=await m7(".fnw");e.worker.update_from_export(A)},h=e.options.useWorkerManager&&e.workermanager&&e.workermanager.open||U2,m=h&&Object.keys(t).length>0,y=e.worker&&e.worker.is_open,v=y&&h;return h||y?T.jsxs(T.Fragment,{children:[T.jsxs(dR,{children:[T.jsx(hR,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Cf,{direction:"row",children:["Worker ",T.jsx(VA,{className:"m-x-s"})]})})}),T.jsx(pR,{className:"headermenucontent funcnodescontainer",children:T.jsxs(mR,{children:[m&&T.jsxs(ame,{children:[T.jsx(ime,{className:"headermenuitem submenuitem",children:T.jsxs(Cf,{direction:"row",children:["Select",T.jsx(J0,{})]})}),T.jsx(lme,{className:"headermenucontent funcnodescontainer",sideOffset:2,alignOffset:-5,children:T.jsx(rme,{value:e.worker?.uuid,onValueChange:w=>{u(w)},children:Object.keys(t).sort((w,A)=>{if(t[w].active&&!t[A].active)return-1;if(!t[w].active&&t[A].active)return 1;const E=t[w].name||w,k=t[A].name||A;return E.localeCompare(k)}).map(w=>T.jsx(ome,{className:"headermenuitem workerselectoption"+(t[w]?.active?" active":" inactive")+" headermenuitem",value:w,disabled:w===e.worker?.uuid,children:t[w]?.name||w},w))})})]}),y&&T.jsxs(T.Fragment,{children:[v&&T.jsx(Zu,{className:"headermenuitem",onClick:()=>{if(e.worker){if(!e.workermanager)return e.logger.error("no workermanager");e.workermanager?.restart_worker(e.worker.uuid)}},children:"Restart"}),T.jsx(Zu,{className:"headermenuitem",onClick:()=>{e.worker&&e.worker.stop()},children:"Stop"}),T.jsx(Zu,{className:"headermenuitem",onClick:()=>l(!0),children:"Export"}),T.jsx(Zu,{className:"headermenuitem",onClick:d,children:"Update"})]}),h&&T.jsx(T.Fragment,{children:T.jsx(Zu,{className:"headermenuitem",onClick:()=>r(!0),children:"New"})})]})})]}),T.jsx(sme,{open:n,setOpen:r}),T.jsx(ume,{open:a,setOpen:l})]}):null},fme=()=>{const e=Wt(),t=()=>{window.confirm("Are you sure you want to start a new flow?")&&e.worker?.clear()},n=async()=>{const a=await e.worker?.save();if(!a)return;const l=new Blob([JSON.stringify(a)],{type:"application/json"}),u=URL.createObjectURL(l),d=document.createElement("a");d.href=u,d.download="flow.json",d.click(),URL.revokeObjectURL(u),d.remove()},r=async()=>{const a=document.createElement("input");a.type="file",a.accept=".json",a.onchange=async l=>{const u=l.target.files?.[0];if(!u)return;const d=new FileReader;d.onload=async h=>{const m=h.target?.result;if(!m)return;const y=JSON.parse(m);await e.worker?.load(y)},d.readAsText(u)},a.click()};return T.jsx(T.Fragment,{children:T.jsxs(dR,{children:[T.jsx(hR,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Cf,{direction:"row",children:["Nodespace ",T.jsx(VA,{className:"m-x-s"})]})})}),T.jsx(pR,{className:"headermenucontent funcnodescontainer",children:T.jsxs(mR,{children:[T.jsx(Zu,{className:"headermenuitem",onClick:t,children:"New"}),T.jsx(Zu,{className:"headermenuitem",onClick:n,children:"Save"}),T.jsx(Zu,{className:"headermenuitem",onClick:r,children:"Load"})]})})]})})},dme=({theme:e,selected:t})=>T.jsxs("div",{style:{width:80,height:54,borderRadius:"var(--fn-border-radius-s, 8px)",border:t?"2.5px solid #1976d2":"1.5px solid #bbb",boxShadow:t?"0 0 0 2px #1976d2":"0 1px 4px #0002",background:"var(--fn-app-background)",display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-start",position:"relative",overflow:"hidden",transition:"border 0.2s, box-shadow 0.2s"},"fn-data-color-theme":e,children:[T.jsx("div",{style:{height:10,background:"var(--fn-primary-color)",borderBottom:"1px solid var(--fn-neutral-element-border)"}}),T.jsxs("div",{style:{display:"flex",flex:1},children:[T.jsx("div",{style:{width:12,background:"var(--fn-surface-elevation-low, var(--fn-container-background))",borderRight:"1px solid var(--fn-neutral-element-border)"}}),T.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--fn-container-background)"},children:T.jsxs("div",{style:{width:22,height:14,borderRadius:"var(--fn-border-radius-xs, 4px)",background:"var(--fn-node-background)",border:"1px solid var(--fn-node-header-color)",boxShadow:"0 1px 2px #0002",display:"flex",flexDirection:"column"},children:[T.jsx("div",{style:{height:5,background:"var(--fn-node-header-color)",borderTopLeftRadius:"var(--fn-border-radius-xs, 4px)",borderTopRightRadius:"var(--fn-border-radius-xs, 4px)"}}),T.jsx("div",{style:{flex:1,background:"transparent"}})]})})]}),T.jsx("span",{style:{position:"absolute",bottom:2,right:4,fontSize:9,color:"var(--fn-text-color-neutral)",opacity:.7,textTransform:"capitalize",fontWeight:600,pointerEvents:"none"},children:e}),t&&T.jsx("span",{style:{position:"absolute",top:2,left:6,fontSize:14,color:"#1976d2",fontWeight:900,pointerEvents:"none"},"aria-label":"Selected",children:"✓"})]}),hme=()=>{const{colorTheme:e,setColorTheme:t}=lI(),[n,r]=z.useState(null),[a,l]=z.useState(null),u=h=>{h!==e&&(l(e),t(h),r(h))},d=h=>{n===h&&a&&a!==h&&t(a),r(null),l(null)};return T.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[T.jsx("div",{style:{marginBottom:8,fontWeight:500},children:"Theme:"}),T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(80px, 1fr))",gap:16,justifyItems:"center"},children:Rj.map(h=>T.jsx("button",{onClick:()=>{t(h),r(null),l(null)},onMouseEnter:()=>u(h),onMouseLeave:()=>d(h),style:{background:"none",border:"none",padding:0,cursor:"pointer",outline:"none",borderRadius:8},"aria-label":`Select ${h} theme`,children:T.jsx(dme,{theme:h,selected:e===h})},h))})]})},pme=()=>{const[e,t]=z.useState(!1),n=()=>{t(!0)};return T.jsxs(T.Fragment,{children:[T.jsxs(dR,{children:[T.jsx(hR,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Cf,{direction:"row",children:["Settings ",T.jsx(VA,{className:"m-x-s"})]})})}),T.jsx(pR,{className:"headermenucontent funcnodescontainer",children:T.jsx(mR,{children:T.jsx(Zu,{className:"headermenuitem",onClick:n,children:"Appearance"})})})]}),T.jsx(Iu,{open:e,setOpen:t,title:"Appearance",description:"Change the color theme.",closebutton:!0,children:T.jsx(hme,{})})]})},mme=({...e})=>{const t=Wt(),n=t.workerstate();return Object.keys(e).length>0&&t.logger.debug("headerprops",e),T.jsxs(Cf,{className:"funcnodesreactflowheader",direction:"row",wrap:!0,children:[T.jsx(Cf,{className:"headerelement m-w-6",grow:{"":!0,m:!1},children:T.jsx(Whe,{})}),(e.showmenu||U2)&&T.jsxs(Cf,{direction:"row",wrap:!0,children:[T.jsx("div",{className:"headerelement",children:T.jsx(cme,{})}),(t.worker&&n.is_open||U2)&&T.jsx("div",{className:"headerelement",children:T.jsx(fme,{})}),T.jsx("div",{className:"headerelement",children:T.jsx(pme,{})})]})]})},QL=({item:e})=>{const{node:t}=yo(),n=z.useCallback(()=>{t?.add_node(e.node_id)},[e.node_id,t]),r=z.useCallback(a=>{a.detail===2&&n()},[n]);return T.jsx("div",{className:"libnodeentry",onClick:r,title:e.description,children:e.node_name||e.node_id})},KL=(e,t)=>{const n=e.nodes?.some(a=>a.node_id.toLowerCase().includes(t.toLowerCase()))??!1,r=e.subshelves?.some(a=>KL(a,t))??!1;return n||r},gR=({item:e,filter:t,parentkey:n})=>{const[r,a]=q.useState(!1),l=()=>a(!r),u=e.nodes?.filter(h=>h.node_id.toLowerCase().includes(t.toLowerCase())),d=r||t.length>0;return KL(e,t)?T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:l,style:{cursor:"pointer"},title:e.description,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(d?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(d?"open":"close"),children:T.jsxs("div",{className:"libnodecontainer_inner",children:[u&&T.jsx(T.Fragment,{children:u.map(h=>T.jsx(QL,{item:h},h.node_id))}),e.subshelves&&T.jsx(T.Fragment,{children:e.subshelves.map(h=>T.jsx(gR,{item:h,filter:t,parentkey:n+h.name},n+h.name))})]})}),T.jsx("hr",{})]}):T.jsx(T.Fragment,{})},gme=({filter:e,setFilter:t})=>T.jsxs("div",{className:"libfilter",children:[T.jsx(yJ,{fontSize:"inherit"}),T.jsx("input",{type:"text",placeholder:"Filter",value:e,onChange:n=>{t(n.target.value)}}),e&&T.jsx(cw,{fontSize:"inherit",onClick:()=>{t("")}})]}),yme=({children:e})=>{const[t,n]=q.useState(""),r=Wt(),[a,l]=q.useState(!0),[u,d]=q.useState(!0),[h,m]=q.useState(!0),[y,v]=q.useState({installed:[],available:[],active:[]}),[S,w]=q.useState(!1),{lib:A}=yo(),E=$=>{$&&(r.worker===void 0||!r.worker.is_open||A?.get_available_modules().then(Z=>{v(Z)}))};if(!r.worker)return T.jsx(T.Fragment,{});const k=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),R=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),D=z.useCallback($=>{w(!1),A?.remove_lib($.name)},[A]),M=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),I=z.useCallback($=>$.filter(Z=>Z.name.toLowerCase().includes(t.toLowerCase())||Z.description.toLowerCase().includes(t.toLowerCase())),[t]),L=I(y.available),P=I(y.installed),G=I(y.active);return T.jsxs(Iu,{title:"Manage Library",trigger:e,description:"Add or remove libraries to the current worker.",onOpenChange:E,open:S,setOpen:w,children:[T.jsx("input",{className:"filter-input styledinput",type:"text",placeholder:"Filter modules...",value:t,onChange:$=>n($.target.value)}),T.jsxs("div",{className:"packagelist",style:{maxHeight:"70%",overflow:"auto"},children:[P.length>0&&T.jsx("h3",{onClick:()=>{m(!h)},children:"Installed"}),h&&P.map($=>T.jsx(I1e,{availableModule:$,on_add:k},$.name+$.source)),L.length>0&&T.jsx("h3",{onClick:()=>{d(!u)},children:"Available"}),u&&L.map($=>T.jsx(z1e,{availableModule:$,on_add:R},$.name+$.source)),G.length>0&&T.jsx("h3",{onClick:()=>{l(!a)},children:"Active"}),a&&G.map($=>T.jsx(D1e,{availableModule:$,on_remove:D,on_update:M},$.name+$.source))]})]})},yR=({availableModule:e})=>T.jsxs("div",{className:"module-links",children:[e.homepage&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",children:"Homepage"})}),e.source&&e.homepage&&" | ",e.source&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.source,target:"_blank",rel:"noopener noreferrer",children:"Source"})})]});function JSe(){}function QSe(){}function vme(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const bme=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xme=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Sme={};function eP(e,t){return(Sme.jsx?xme:bme).test(e)}const wme=/[ \t\n\f\r]/g;function Eme(e){return typeof e=="object"?e.type==="text"?tP(e.value):!1:tP(e)}function tP(e){return e.replace(wme,"")===""}class Yv{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Yv.prototype.normal={},Yv.prototype.property={},Yv.prototype.space=void 0;function nP(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Yv(n,r,t)}function vR(e){return e.toLowerCase()}class ca{constructor(t,n){this.attribute=n,this.property=t}}ca.prototype.attribute="",ca.prototype.booleanish=!1,ca.prototype.boolean=!1,ca.prototype.commaOrSpaceSeparated=!1,ca.prototype.commaSeparated=!1,ca.prototype.defined=!1,ca.prototype.mustUseProperty=!1,ca.prototype.number=!1,ca.prototype.overloadedBoolean=!1,ca.prototype.property="",ca.prototype.spaceSeparated=!1,ca.prototype.space=void 0;let Cme=0;const _t=gh(),xr=gh(),bR=gh(),Ve=gh(),_n=gh(),Ym=gh(),Fa=gh();function gh(){return 2**++Cme}const xR=Object.freeze(Object.defineProperty({__proto__:null,boolean:_t,booleanish:xr,commaOrSpaceSeparated:Fa,commaSeparated:Ym,number:Ve,overloadedBoolean:bR,spaceSeparated:_n},Symbol.toStringTag,{value:"Module"})),SR=Object.keys(xR);class wR extends ca{constructor(t,n,r,a){let l=-1;if(super(t,n),rP(this,"space",a),typeof r=="number")for(;++l<SR.length;){const u=SR[l];rP(this,SR[l],(r&xR[u])===xR[u])}}}wR.prototype.defined=!0;function rP(e,t,n){n&&(e[t]=n)}function Zm(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const l=new wR(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[vR(r)]=r,n[vR(l.attribute)]=r}return new Yv(t,n,e.space)}const oP=Zm({properties:{ariaActiveDescendant:null,ariaAtomic:xr,ariaAutoComplete:null,ariaBusy:xr,ariaChecked:xr,ariaColCount:Ve,ariaColIndex:Ve,ariaColSpan:Ve,ariaControls:_n,ariaCurrent:null,ariaDescribedBy:_n,ariaDetails:null,ariaDisabled:xr,ariaDropEffect:_n,ariaErrorMessage:null,ariaExpanded:xr,ariaFlowTo:_n,ariaGrabbed:xr,ariaHasPopup:null,ariaHidden:xr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_n,ariaLevel:Ve,ariaLive:null,ariaModal:xr,ariaMultiLine:xr,ariaMultiSelectable:xr,ariaOrientation:null,ariaOwns:_n,ariaPlaceholder:null,ariaPosInSet:Ve,ariaPressed:xr,ariaReadOnly:xr,ariaRelevant:null,ariaRequired:xr,ariaRoleDescription:_n,ariaRowCount:Ve,ariaRowIndex:Ve,ariaRowSpan:Ve,ariaSelected:xr,ariaSetSize:Ve,ariaSort:null,ariaValueMax:Ve,ariaValueMin:Ve,ariaValueNow:Ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function aP(e,t){return t in e?e[t]:t}function iP(e,t){return aP(e,t.toLowerCase())}const _me=Zm({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ym,acceptCharset:_n,accessKey:_n,action:null,allow:null,allowFullScreen:_t,allowPaymentRequest:_t,allowUserMedia:_t,alt:null,as:null,async:_t,autoCapitalize:null,autoComplete:_n,autoFocus:_t,autoPlay:_t,blocking:_n,capture:null,charSet:null,checked:_t,cite:null,className:_n,cols:Ve,colSpan:null,content:null,contentEditable:xr,controls:_t,controlsList:_n,coords:Ve|Ym,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_t,defer:_t,dir:null,dirName:null,disabled:_t,download:bR,draggable:xr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_t,formTarget:null,headers:_n,height:Ve,hidden:bR,high:Ve,href:null,hrefLang:null,htmlFor:_n,httpEquiv:_n,id:null,imageSizes:null,imageSrcSet:null,inert:_t,inputMode:null,integrity:null,is:null,isMap:_t,itemId:null,itemProp:_n,itemRef:_n,itemScope:_t,itemType:_n,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_t,low:Ve,manifest:null,max:null,maxLength:Ve,media:null,method:null,min:null,minLength:Ve,multiple:_t,muted:_t,name:null,nonce:null,noModule:_t,noValidate:_t,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_t,optimum:Ve,pattern:null,ping:_n,placeholder:null,playsInline:_t,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_t,referrerPolicy:null,rel:_n,required:_t,reversed:_t,rows:Ve,rowSpan:Ve,sandbox:_n,scope:null,scoped:_t,seamless:_t,selected:_t,shadowRootClonable:_t,shadowRootDelegatesFocus:_t,shadowRootMode:null,shape:null,size:Ve,sizes:null,slot:null,span:Ve,spellCheck:xr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ve,step:null,style:null,tabIndex:Ve,target:null,title:null,translate:null,type:null,typeMustMatch:_t,useMap:null,value:xr,width:Ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_n,axis:null,background:null,bgColor:null,border:Ve,borderColor:null,bottomMargin:Ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_t,declare:_t,event:null,face:null,frame:null,frameBorder:null,hSpace:Ve,leftMargin:Ve,link:null,longDesc:null,lowSrc:null,marginHeight:Ve,marginWidth:Ve,noResize:_t,noHref:_t,noShade:_t,noWrap:_t,object:null,profile:null,prompt:null,rev:null,rightMargin:Ve,rules:null,scheme:null,scrolling:xr,standby:null,summary:null,text:null,topMargin:Ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ve,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_t,disableRemotePlayback:_t,prefix:null,property:null,results:Ve,security:null,unselectable:null},space:"html",transform:iP}),Ame=Zm({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Fa,accentHeight:Ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ve,amplitude:Ve,arabicForm:null,ascent:Ve,attributeName:null,attributeType:null,azimuth:Ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ve,by:null,calcMode:null,capHeight:Ve,className:_n,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ve,diffuseConstant:Ve,direction:null,display:null,dur:null,divisor:Ve,dominantBaseline:null,download:_t,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ve,enableBackground:null,end:null,event:null,exponent:Ve,externalResourcesRequired:null,fill:null,fillOpacity:Ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ym,g2:Ym,glyphName:Ym,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ve,horizOriginX:Ve,horizOriginY:Ve,id:null,ideographic:Ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ve,k:Ve,k1:Ve,k2:Ve,k3:Ve,k4:Ve,kernelMatrix:Fa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ve,overlineThickness:Ve,paintOrder:null,panose1:null,path:null,pathLength:Ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_n,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ve,pointsAtY:Ve,pointsAtZ:Ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Fa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Fa,rev:Fa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Fa,requiredFeatures:Fa,requiredFonts:Fa,requiredFormats:Fa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ve,specularExponent:Ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ve,strikethroughThickness:Ve,string:null,stroke:null,strokeDashArray:Fa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ve,strokeOpacity:Ve,strokeWidth:null,style:null,surfaceScale:Ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Fa,tabIndex:Ve,tableValues:null,target:null,targetX:Ve,targetY:Ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Fa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ve,underlineThickness:Ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ve,values:null,vAlphabetic:Ve,vMathematical:Ve,vectorEffect:null,vHanging:Ve,vIdeographic:Ve,version:null,vertAdvY:Ve,vertOriginX:Ve,vertOriginY:Ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:aP}),lP=Zm({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),sP=Zm({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:iP}),uP=Zm({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Tme={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},kme=/[A-Z]/g,cP=/-[a-z]/g,Rme=/^data[-\w.:]+$/i;function Ome(e,t){const n=vR(t);let r=t,a=ca;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Rme.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(cP,Nme);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!cP.test(l)){let u=l.replace(kme,Mme);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=wR}return new a(r,t)}function Mme(e){return"-"+e.toLowerCase()}function Nme(e){return e.charAt(1).toUpperCase()}const Dme=nP([oP,_me,lP,sP,uP],"html"),ER=nP([oP,Ame,lP,sP,uP],"svg");function Ime(e){return e.join(" ").trim()}var Wm={},CR,fP;function zme(){if(fP)return CR;fP=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,h=`
|
|
1085
|
+
`).map(w=>w.length),0);return T.jsx("textarea",{className:"nodedatainput styledinput stringinput",value:y,onChange:w=>h(w.target.value),onBlur:w=>{m(w)},disabled:a.connected,rows:v+1,cols:S+1})},Ms={Inputrenderer:{float:Tde,int:kde,bool:rde,string:zB,str:zB,color:ode,select:jv,enum:jv,bytes:Vk(Lk,"")},Outputrenderer:nde,HandlePreviewRenderer:ede,DataOverlayRenderer:Kfe,DataPreviewViewRenderer:vB,DataViewRenderer:Pk,InLineRenderer:Qfe,NodeRenderer:{},NodeHooks:{}},Ide=(e,t)=>{const n=t.options||{},r=n.overwrite===void 0?!0:n.overwrite;switch(t.type){case"EXTEND_INPUT_RENDER":return!r&&e.Inputrenderer[t.payload.type]?e:{...e,Inputrenderer:{...e.Inputrenderer,[t.payload.type]:t.payload.component}};case"EXTEND_FROM_PLUGIN":{let u=!1;const d=[[t.payload.plugin.input_renderers||{},e.Inputrenderer],[t.payload.plugin.output_renderers||{},e.Outputrenderer],[t.payload.plugin.handle_preview_renderers||{},e.HandlePreviewRenderer],[t.payload.plugin.data_overlay_renderers||{},e.DataOverlayRenderer],[t.payload.plugin.data_preview_renderers||{},e.DataPreviewViewRenderer],[t.payload.plugin.data_view_renderers||{},e.DataViewRenderer],[t.payload.plugin.node_renderers||{},e.NodeRenderer],[t.payload.plugin.node_hooks||{},e.NodeHooks]];for(const[m,y]of d){if(Object.keys(m).length>0){if(r)u=!0;else for(const v in m)if(!y[v]){u=!0;break}}if(u)break}if(!u)return e;const h={...e};return d.forEach(([m,y])=>{Object.assign(y,m)}),h}default:const l={EXTEND_OUTPUT_RENDER:"Outputrenderer",EXTEND_HANDLE_PREVIEW_RENDER:"HandlePreviewRenderer",EXTEND_DATA_OVERLAY_RENDER:"DataOverlayRenderer",EXTEND_DATA_PREVIEW_RENDER:"DataPreviewViewRenderer",EXTEND_DATA_VIEW_RENDER:"DataViewRenderer",EXTEND_NODE_CONTEXT_EXTENDER:"NodeContextExtenders",EXTEND_NODE_RENDERER:"NodeRenderer",EXTEND_NODE_HOOKS:"NodeHooks"}[t.type];if(l){const u=e[l];return!r&&u[t.payload.type]?e:{...e,[l]:{...u,[t.payload.type]:t.payload.component}}}return e}},zde=({children:e,plugins:t,fnrf_zst:n})=>{const[r,a]=q.useReducer(Ide,Ms),l=(A,E,k)=>{a({type:"EXTEND_INPUT_RENDER",payload:{type:A,component:E},options:k})},u=(A,E,k)=>{a({type:"EXTEND_OUTPUT_RENDER",payload:{type:A,component:E},options:k})},d=(A,E,k)=>{a({type:"EXTEND_HANDLE_PREVIEW_RENDER",payload:{type:A,component:E},options:k})},h=(A,E,k)=>{a({type:"EXTEND_DATA_OVERLAY_RENDER",payload:{type:A,component:E},options:k})},m=(A,E,k)=>{a({type:"EXTEND_DATA_PREVIEW_RENDER",payload:{type:A,component:E},options:k})},y=(A,E,k)=>{a({type:"EXTEND_DATA_VIEW_RENDER",payload:{type:A,component:E},options:k})},v=(A,E,k)=>{a({type:"EXTEND_NODE_RENDERER",payload:{type:A,component:E},options:k})},S=(A,E,k)=>{a({type:"EXTEND_NODE_HOOKS",payload:{type:A,component:E},options:k})},w=(A,E)=>{a({type:"EXTEND_FROM_PLUGIN",payload:{plugin:A},options:E})};return q.useEffect(()=>{for(const A in t){const E=t[A];if(!E)continue;const k=E.renderpluginfactory;k&&w(k({React:z,fnrf_zst:n,NodeContext:V2}))}},[t]),T.jsx(Yu.Provider,{value:{Inputrenderer:r.Inputrenderer,Outputrenderer:r.Outputrenderer,HandlePreviewRenderer:r.HandlePreviewRenderer,DataOverlayRenderer:r.DataOverlayRenderer,DataPreviewViewRenderer:r.DataPreviewViewRenderer,DataViewRenderer:r.DataViewRenderer,InLineRenderer:r.InLineRenderer,NodeRenderer:r.NodeRenderer,NodeHooks:r.NodeHooks,extendNodeRenderer:v,extendInputRenderMapping:l,extendOutputRenderMapping:u,extendHandlePreviewRenderMapping:d,extendDataOverlayRenderMapping:h,extendDataPreviewRenderMapping:m,extendDataViewRenderMapping:y,extendNodeHooks:S,extendFromPlugin:w},children:e})},Yu=q.createContext({Inputrenderer:Ms.Inputrenderer,Outputrenderer:Ms.Outputrenderer,HandlePreviewRenderer:Ms.HandlePreviewRenderer,DataOverlayRenderer:Ms.DataOverlayRenderer,DataPreviewViewRenderer:Ms.DataPreviewViewRenderer,DataViewRenderer:Ms.DataViewRenderer,InLineRenderer:Ms.InLineRenderer,NodeRenderer:Ms.NodeRenderer,NodeHooks:Ms.NodeHooks,extendInputRenderMapping:(e,t,n)=>{},extendOutputRenderMapping:(e,t,n)=>{},extendHandlePreviewRenderMapping:(e,t,n)=>{},extendDataOverlayRenderMapping:(e,t,n)=>{},extendDataPreviewRenderMapping:(e,t,n)=>{},extendDataViewRenderMapping:(e,t,n)=>{},extendNodeRenderer:(e,t,n)=>{},extendNodeHooks:(e,t,n)=>{},extendFromPlugin:(e,t)=>{}}),jB=e=>{const t=Wt(),{DataOverlayRenderer:n,DataViewRenderer:r}=q.useContext(Yu);if(e===void 0)return;const a=t.render_options(),[l]=hh(e,a.typemap||{});return l?n[l]?n[l]:r[l]?zv(r[l]):yB:yB},jde=e=>{const t=Wt(),n=jB(e),{DataPreviewViewRenderer:r,DataViewRenderer:a}=q.useContext(Yu),l=t.render_options();if(e===void 0)return[void 0,n];const[u]=hh(e,l.typemap||{});return u?r[u]?[r[u],n]:a[u]?[Ho(a[u]),n]:[Ho(L2),n]:[Ho(L2),n]},Bde=e=>{const n=Wt().render_options(),{HandlePreviewRenderer:r,DataPreviewViewRenderer:a}=q.useContext(Yu),l=jB(e);let u;if(e){const[d]=hh(e,n.typemap||{});d?r[d]?u=r[d]:a[d]?u=a[d]:u=Ho(L2):u=Ho(L2)}return[u,l]},Lde=e=>{const[t,n]=q.useState(!1),r=e.use(a=>a.in_trigger);return q.useEffect(()=>{let a;return r&&!t?n(!0):t&&(a=setTimeout(()=>n(!1),200)),()=>clearTimeout(a)},[r,t]),{visualTrigger:t,nodestore:e}},V2=z.createContext({}),ua=()=>q.useContext(V2),Ef=z.createContext(void 0);function Bn(e){if(e)return ua().io_stores.get(e);{const t=q.useContext(Ef);if(!t)throw new Error("IOContext not set");return t}}function dh(e){const{node:t}=yo();if(e||(e=Bn().use()),typeof e=="string"&&(e=Bn(e)?.use(),!e))throw new Error(`No IO found for ${e}`);if(!e)throw new Error("No IO found");return z.useCallback((r,a)=>{t?.set_io_value({nid:e.node,ioid:e.id,value:r,set_default:a??e.render_options.set_default})},[e,t])}function BB(e){const{node:t}=yo();let n,r;if(!e){const u=Bn().useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}if(typeof e=="string"){const l=Bn(e);if(!l)throw new Error(`No IO found for ${e}`);const u=l.useShallow(d=>({io_id:d.id,node_id:d.node}));n=u.io_id,r=u.node_id}else{if(!e)throw new Error("No IO found");n=e.id,r=e.node}return z.useCallback(l=>{t?.set_io_value_options({nid:r,ioid:n,values:l.values??l.keys,keys:l.keys,nullable:l.nullable??!1})},[t,n,r])}function LB(e){return Bn(e)?.valuestore()}function Bv(e){const t=Bn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=yo();return z.useCallback(()=>a?.get_io_full_value({nid:n,ioid:r}),[a,n,r])}function Xk(e){const t=Bn(e);if(!t)return;const{node:n,id:r}=t.useShallow(u=>({node:u.node,id:u.id})),{node:a}=yo();return z.useCallback(u=>{a?.update_io_options({nid:n,ioid:r,options:{hidden:u}})},[a,n,r])}const PB=({iostore:e,Component:t})=>{const[n,r]=z.useState(void 0),[a,l]=z.useState(void 0),{full:u}=e.valuestore(),d=Bv();z.useEffect(()=>{u===void 0?d?.():l(u.value)},[u,d]);const h=()=>{a!==void 0&&r(a)};return T.jsx(t,{value:a,preValue:n,onLoaded:h})},HB=({Component:e})=>T.jsx(e,{}),hh=(e,t)=>VB(e.render_options?.type??"any",t),VB=(e,t)=>{if(typeof e=="string")return e in t?[t[e],e]:[e,e];if("allOf"in e&&e.allOf!==void 0)return[void 0,void 0];if("anyOf"in e&&e.anyOf!==void 0){const n=e.anyOf.map(r=>VB(r||"any",t));for(const r of n)switch(r[0]){case"bool":return["bool",r[1]];case"enum":return["enum",r[1]];case"float":return["float",r[1]];case"int":return["int",r[1]];case"string":return["string",r[1]];case"str":return["string",r[1]]}return[void 0,void 0]}return!("type"in e)||e.type===void 0?[void 0,void 0]:e.type==="enum"?["enum","enum"]:[void 0,void 0]},Yk=({typestring:e,preview:t,...n})=>{const[r,a]=q.useState(!1),[l,u]=q.useState(!1),d=Wt(),h=Bn(),m=h.use(),y=Bv(),[v,S]=Bde(m),w=d.local_state(()=>d.reactflowRef);return T.jsxs(t5,{open:r||l,onOpenChange:u,children:[T.jsx(n5,{asChild:!0,children:T.jsx(Dv,{id:m.id,"data-type":e,...n})}),T.jsx(r5,{container:w,children:T.jsxs(o5,{className:"iotooltipcontent",sideOffset:5,avoidCollisions:!0,collisionBoundary:w,collisionPadding:10,onOpenAutoFocus:A=>A.preventDefault(),onCloseAutoFocus:A=>A.preventDefault(),children:[T.jsxs("div",{className:"iotooltip_container",children:[T.jsxs("div",{className:"iotooltip_header",children:[r?T.jsx(pJ,{onClick:()=>a(!1)}):T.jsx(hJ,{onClick:()=>a(!0)}),S&&T.jsx(Iu,{title:m.full_id,trigger:T.jsx(rI,{}),onOpenChange:A=>{A&&y?.(),a(A)},children:T.jsx(PB,{Component:S,iostore:h})})]}),v?T.jsx(HB,{Component:v}):`no preview available for "${e}"`]}),T.jsx(WQ,{className:"iotooltipcontentarrow"})]})})]})},Xm={"":[e=>e,e=>e],str_to_json:[e=>JSON.parse(e),e=>typeof e=="string"?e:JSON.stringify(e)],str_to_list:[e=>{try{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{try{return JSON.parse("["+e+"]")}catch{}}throw new Error("Invalid list")},e=>JSON.stringify(e)]},Pde=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Wt().render_options(),l=Bn().use(),[u,d]=hh(l,r.typemap||{}),{Inputrenderer:h}=q.useContext(Yu),m=u?l.value_options?.options?jv:h[u]:void 0,y=Xm[(d&&r.inputconverter?.[d])??""]||Xm[""],{keys:v}=FA(),S=w=>{v.has("s")&&(e&&e("inputs/"+l.id),t&&t(!0),w.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeinput","data-type":u,onClick:S,children:[T.jsx(Yk,{typestring:u,position:it.Left,type:"target"}),T.jsxs("div",{className:"inner_nodeio",children:[m&&T.jsx("div",{className:"iovaluefield nodrag","data-type":u,children:T.jsx(m,{inputconverter:y})}),T.jsx("div",{className:"ioname",children:l.name})]}),T.jsx(Yk,{typestring:u,position:it.Right,type:"source"})]})},Hde=({setNodeSettingsPath:e,setShowSettings:t})=>{const r=Wt().render_options(),l=Bn().use(),[u]=hh(l,r.typemap||{}),{Outputrenderer:d}=q.useContext(Yu),{keys:h}=FA(),m=u?d[u]:void 0,y=v=>{h.has("s")&&(e&&e("outputs/"+l.id),t&&t(!0),v.stopPropagation())};return l.hidden?null:T.jsxs("div",{className:"nodeoutput","data-type":u,onClick:y,children:[T.jsx(Yk,{typestring:u,position:it.Right,type:"source"}),T.jsxs("div",{className:"inner_nodeio",children:[T.jsx("div",{className:"ioname",children:l.name}),m?T.jsx("div",{className:"iovaluefield nodrag",children:T.jsx(m,{})}):T.jsx("div",{className:"iovaluefield",children:T.jsx(tde,{})})]})]})},Vde=()=>{const t=Wt().render_options(),r=Bn().use(),a=Xk(),[l,u]=hh(r,t.typemap||{}),{Inputrenderer:d}=z.useContext(Yu),h=l?r.value_options?.options?jv:d[l]:void 0,m=Xm[(u&&t.inputconverter?.[u])??""]||Xm[""];return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:r.name}),h&&T.jsx(h,{inputconverter:m}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:r.connected,onChange:y=>{a?.(y.target.checked)},checked:r.hidden})]})})]})},Fde=()=>{const t=Bn().use(),n=Xk();return T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:t.name}),T.jsx("div",{children:T.jsxs("label",{children:["hidden:",T.jsx("input",{className:"styledcheckbox",type:"checkbox",disabled:t.connected,onChange:r=>{n?.(r.target.checked)},checked:t.hidden})]})})]})},FB=({})=>{const e=Wt(),{node:t}=yo(),r=Bn().use(),a=e.render_options(),l=Xk(),[u,d]=z.useState(r.name);z.useEffect(()=>d(r.name),[r.name]);const h=z.useCallback(E=>d(E.target.value),[]),m=z.useCallback(()=>{u!==r.name&&t?.update_io_options({nid:r.node,ioid:r.id,options:{name:u}})},[r,t,u]),[y,v]=hh(r,a.typemap||{}),S=Xm[(v&&a.inputconverter?.[v])??""]||Xm[""],{Inputrenderer:w}=z.useContext(Yu),A=y?r.value_options?.options?jv:w[y]:void 0;return T.jsxs("div",{className:"nodesettings-io-entry funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-name-${r.id}`,children:"Name:"}),T.jsx("input",{id:`io-name-${r.id}`,type:"text",value:u,onChange:h,onBlur:m,className:"styledinput"})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"ID:"}),T.jsx("span",{children:r.id})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value:"}),A&&T.jsx(A,{inputconverter:S})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Type:"}),T.jsx("pre",{children:JSON.stringify(r.type,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`io-hidden-${r.id}`,children:"Hidden:"}),T.jsx("input",{id:`io-hidden-${r.id}`,type:"checkbox",checked:r.hidden,onChange:E=>l?.(E.target.checked),className:"styledcheckbox",disabled:r.connected&&r.is_input})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Value Options:"}),T.jsx("pre",{children:JSON.stringify(r.value_options,null,2)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Render Options:"}),T.jsx("pre",{className:"code-display",children:JSON.stringify(r.render_options,null,2)})]}),r.is_input&&T.jsxs(T.Fragment,{children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Does Trigger:"}),T.jsx("span",{children:String(r.does_trigger)})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Required:"}),T.jsx("span",{children:String(r.required)})]})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Emit Value Set:"}),T.jsx("span",{children:String(r.emit_value_set)})]}),T.jsx("hr",{})]})},Zk={xxs:0,xs:320,s:480,m:768,l:960,xl:1280,xxl:1920},Gde=Object.entries(Zk).sort(([,e],[,t])=>t-e),GB=z.createContext(void 0),Ude=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},$de=e=>{for(const[t,n]of Gde)if(e>=n)return t;return"xxs"},UB=z.memo(z.forwardRef((e,t)=>{const{className:n,children:r,...a}=e,[l,u]=z.useState({wKey:"m",w:0,h:0}),d=z.useRef(null);z.useImperativeHandle(t,()=>d.current,[]);const h=z.useCallback(y=>{const v=y.width,S=y.height,w=$de(v);u(A=>A.wKey===w&&A.w===v&&A.h===S?A:{wKey:w,w:v,h:S})},[]),m=z.useMemo(()=>Ude(h,16),[h]);return z.useEffect(()=>{const y=d.current;if(!y)return;const v=new ResizeObserver(S=>{const w=S[0];w&&m(w.contentRect)});return h(y.getBoundingClientRect()),v.observe(y),()=>{v.disconnect()}},[h,m]),T.jsx(GB.Provider,{value:l,children:T.jsx("div",{ref:d,className:`size-context w-${l.wKey} ${n||""}`.trim(),...a,children:r})})}));UB.displayName="SizeContextContainer";const Xde=()=>{const e=z.useContext(GB);if(!e)throw new Error("useSizeContext must be used within a SizeContextContainerContext");return e},Yde=(e,t)=>e===t?!1:e===""?!0:Zk[e]<Zk[t],Zde=e=>{const{wKey:t}=Xde();return Yde(t,e)},$B=(e,t,n="",r="")=>{const a=[];return typeof e=="string"?a.push(`${t}-${e}`):typeof e=="boolean"?a.push(e?n:r):e&&typeof e=="object"&&Object.entries(e).forEach(([l,u])=>{if(typeof u=="string")a.push(l===""?`${t}-${u}`:`${l}-${t}-${u}`);else if(typeof u=="boolean"){const d=u?n:r;d&&a.push(l===""?d:`${l}-${d}`)}}),a.filter(Boolean).join(" ")},Cf=z.memo(({direction:e,className:t="",children:n,wrap:r=!1,grow:a=!1,...l})=>{const u="float-container",d=$B(e,"direction"),h=$B(a,"","grow","no-grow"),y=[u,d,h,typeof r=="boolean"&&r?"flex-wrap":"",t].filter(Boolean).join(" ");return T.jsx("div",{className:y,...l,children:n})});Cf.displayName="FloatContainer";const Wde={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"◀"}),right:e=>T.jsx(T.Fragment,{children:"▶"})},qde={up:e=>T.jsx(T.Fragment,{children:"▲"}),down:e=>T.jsx(T.Fragment,{children:"▼"}),left:e=>T.jsx(T.Fragment,{children:"▶"}),right:e=>T.jsx(T.Fragment,{children:"◀"})},Wk=z.memo(({direction:e,expanded:t=!0,children:n,className:r,maxSize:a="18.75rem",expanderSize:l="2rem",containerStyle:u,style:d,containerClassName:h,expandIcons:m,collapseIcons:y,onExpandChange:v,...S})=>{const[w,A]=z.useState(t);z.useEffect(()=>{A(t)},[t]);const E=z.useCallback(()=>{A(j=>{const X=!j;return v?.(X),X})},[v]),k=z.useCallback(j=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),E())},[E]),R=e==="right"||e==="left",D=e==="left"||e==="up",M=w?y?.[e]||qde[e]:m?.[e]||Wde[e],I=`${e} ${w?"expanded":"collapsed"}`,L=z.useMemo(()=>({[R?"width":"height"]:w?a:l}),[R,w,a,l]),P=z.useMemo(()=>({[R?"width":"height"]:w?a:0}),[R,w,a]),G=z.useMemo(()=>({[R?"width":"height"]:l}),[R,l]),$=T.jsx("div",{className:`expanding_container_content ${I} ${r||""}`.trim(),style:{...d,...P},...S,children:n}),Z=T.jsx("div",{className:`expanding_container_expander ${I}`,onClick:E,onKeyDown:k,style:G,role:"button",tabIndex:0,"aria-label":`${w?"Collapse":"Expand"} ${e}`,children:T.jsx(M,{})});return T.jsxs("div",{className:`expanding_container ${I} ${h||""}`,style:{...u,...L},children:[D?Z:$,D?$:Z]})});Wk.displayName="ExpandingContainer";const Jde=({nodestore:e})=>{const t=e.use();return T.jsx(V2.Provider,{value:e,children:T.jsxs("div",{className:"nodesettings_content",children:[T.jsx("div",{className:"nodesettings_section",children:T.jsxs("div",{className:"nodesettings_component",children:[T.jsx("div",{children:"Name"}),T.jsx("div",{children:T.jsx(tR,{})})]})}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Inputs"}),t.inputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ef.Provider,{value:r,children:T.jsx(Vde,{})},n)})]}),T.jsxs("div",{className:"nodesettings_section",children:[T.jsx("div",{children:"Outputs"}),t.outputs.map(n=>{const r=e.io_stores.get(n);if(r)return T.jsx(Ef.Provider,{value:r,children:T.jsx(Fde,{})},n)})]})]})})},Qde=()=>{const e=Wt(),t=e.local_state(r=>r.selected_nodes);if(t.length===0)return T.jsx("div",{children:"Node Settings"});if(t.length>1)return T.jsx("div",{children:"Multiple Nodes Selected"});const n=e.nodespace.get_node(t[0]);return n?T.jsx(Jde,{nodestore:n}):T.jsx("div",{children:"Node not found"})},Kde=()=>{const e=Wt(),t=e.local_settings(r=>r.view_settings.expand_node_props),n=r=>{e.update_view_settings({expand_node_props:r})};return T.jsx(Wk,{direction:"left",expanded:t===void 0?!1:t,containerClassName:"pos-right pos-top bg1 h-12",className:"nodesettings_content",onExpandChange:n,collapseIcons:{up:uw,down:Q0,left:J0,right:sw},expandIcons:{up:Q0,down:uw,left:sw,right:J0},children:T.jsx(Qde,{})})};var qk="rovingFocusGroup.onEntryFocus",ehe={bubbles:!1,cancelable:!0},Lv="RovingFocusGroup",[Jk,XB,the]=zw(Lv),[nhe,F2]=gs(Lv,[the]),[rhe,ohe]=nhe(Lv),YB=z.forwardRef((e,t)=>T.jsx(Jk.Provider,{scope:e.__scopeRovingFocusGroup,children:T.jsx(Jk.Slot,{scope:e.__scopeRovingFocusGroup,children:T.jsx(ahe,{...e,ref:t})})}));YB.displayName=Lv;var ahe=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:h,onEntryFocus:m,preventScrollOnEntryFocus:y=!1,...v}=e,S=z.useRef(null),w=bn(t,S),A=P2(l),[E,k]=cf({prop:u,defaultProp:d??null,onChange:h,caller:Lv}),[R,D]=z.useState(!1),M=aa(m),I=XB(n),L=z.useRef(!1),[P,G]=z.useState(0);return z.useEffect(()=>{const $=S.current;if($)return $.addEventListener(qk,M),()=>$.removeEventListener(qk,M)},[M]),T.jsx(rhe,{scope:n,orientation:r,dir:A,loop:a,currentTabStopId:E,onItemFocus:z.useCallback($=>k($),[k]),onItemShiftTab:z.useCallback(()=>D(!0),[]),onFocusableItemAdd:z.useCallback(()=>G($=>$+1),[]),onFocusableItemRemove:z.useCallback(()=>G($=>$-1),[]),children:T.jsx(It.div,{tabIndex:R||P===0?-1:0,"data-orientation":r,...v,ref:w,style:{outline:"none",...e.style},onMouseDown:Ke(e.onMouseDown,()=>{L.current=!0}),onFocus:Ke(e.onFocus,$=>{const Z=!L.current;if($.target===$.currentTarget&&Z&&!R){const j=new CustomEvent(qk,ehe);if($.currentTarget.dispatchEvent(j),!j.defaultPrevented){const X=I().filter(V=>V.focusable),ee=X.find(V=>V.active),ae=X.find(V=>V.id===E),te=[ee,ae,...X].filter(Boolean).map(V=>V.ref.current);qB(te,y)}}L.current=!1}),onBlur:Ke(e.onBlur,()=>D(!1))})})}),ZB="RovingFocusGroupItem",WB=z.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:l,children:u,...d}=e,h=ys(),m=l||h,y=ohe(ZB,n),v=y.currentTabStopId===m,S=XB(n),{onFocusableItemAdd:w,onFocusableItemRemove:A,currentTabStopId:E}=y;return z.useEffect(()=>{if(r)return w(),()=>A()},[r,w,A]),T.jsx(Jk.ItemSlot,{scope:n,id:m,focusable:r,active:a,children:T.jsx(It.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:t,onMouseDown:Ke(e.onMouseDown,k=>{r?y.onItemFocus(m):k.preventDefault()}),onFocus:Ke(e.onFocus,()=>y.onItemFocus(m)),onKeyDown:Ke(e.onKeyDown,k=>{if(k.key==="Tab"&&k.shiftKey){y.onItemShiftTab();return}if(k.target!==k.currentTarget)return;const R=she(k,y.orientation,y.dir);if(R!==void 0){if(k.metaKey||k.ctrlKey||k.altKey||k.shiftKey)return;k.preventDefault();let M=S().filter(I=>I.focusable).map(I=>I.ref.current);if(R==="last")M.reverse();else if(R==="prev"||R==="next"){R==="prev"&&M.reverse();const I=M.indexOf(k.currentTarget);M=y.loop?uhe(M,I+1):M.slice(I+1)}setTimeout(()=>qB(M))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:E!=null}):u})})});WB.displayName=ZB;var ihe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lhe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function she(e,t,n){const r=lhe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ihe[r]}function qB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function uhe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var JB=YB,QB=WB,G2="Tabs",[che,ZSe]=gs(G2,[F2]),KB=F2(),[fhe,Qk]=che(G2),eL=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:a,defaultValue:l,orientation:u="horizontal",dir:d,activationMode:h="automatic",...m}=e,y=P2(d),[v,S]=cf({prop:r,onChange:a,defaultProp:l??"",caller:G2});return T.jsx(fhe,{scope:n,baseId:ys(),value:v,onValueChange:S,orientation:u,dir:y,activationMode:h,children:T.jsx(It.div,{dir:y,"data-orientation":u,...m,ref:t})})});eL.displayName=G2;var tL="TabsList",nL=z.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...a}=e,l=Qk(tL,n),u=KB(n);return T.jsx(JB,{asChild:!0,...u,orientation:l.orientation,dir:l.dir,loop:r,children:T.jsx(It.div,{role:"tablist","aria-orientation":l.orientation,...a,ref:t})})});nL.displayName=tL;var rL="TabsTrigger",oL=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:a=!1,...l}=e,u=Qk(rL,n),d=KB(n),h=lL(u.baseId,r),m=sL(u.baseId,r),y=r===u.value;return T.jsx(QB,{asChild:!0,...d,focusable:!a,active:y,children:T.jsx(It.button,{type:"button",role:"tab","aria-selected":y,"aria-controls":m,"data-state":y?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:h,...l,ref:t,onMouseDown:Ke(e.onMouseDown,v=>{!a&&v.button===0&&v.ctrlKey===!1?u.onValueChange(r):v.preventDefault()}),onKeyDown:Ke(e.onKeyDown,v=>{[" ","Enter"].includes(v.key)&&u.onValueChange(r)}),onFocus:Ke(e.onFocus,()=>{const v=u.activationMode!=="manual";!y&&!a&&v&&u.onValueChange(r)})})})});oL.displayName=rL;var aL="TabsContent",iL=z.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:a,children:l,...u}=e,d=Qk(aL,n),h=lL(d.baseId,r),m=sL(d.baseId,r),y=r===d.value,v=z.useRef(y);return z.useEffect(()=>{const S=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(S)},[]),T.jsx(yl,{present:a||y,children:({present:S})=>T.jsx(It.div,{"data-state":y?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":h,hidden:!S,id:m,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:v.current?"0s":void 0},children:S&&l})})});iL.displayName=aL;function lL(e,t){return`${e}-trigger-${t}`}function sL(e,t){return`${e}-content-${t}`}var Kk=eL,eR=nL,Pv=oL,Hv=iL;const dhe=({})=>{const e=Wt(),t=ua(),{description:n,id:r,node_id:a,node_name:l,reset_inputs_on_trigger:u}=t.useShallow(v=>({description:v.description,id:v.id,node_id:v.node_id,node_name:v.node_name,reset_inputs_on_trigger:v.reset_inputs_on_trigger})),[d,h]=z.useState(n||"");z.useEffect(()=>h(n||""),[n]);const m=v=>h(v.target.value),y=()=>{d!==(n||"")&&e.on_node_action({type:"update",from_remote:!1,id:r,node:{description:d}})};return T.jsxs("div",{className:"nodesettings-section funcnodes-control-group",children:[T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-name-${r}`,children:"Name:"}),T.jsx(tR,{})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Instance ID:"}),T.jsx("span",{children:r})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type ID:"}),T.jsx("span",{children:a})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Node Type Name:"}),T.jsx("span",{children:l})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{htmlFor:`node-desc-${r}`,children:"Description:"}),T.jsx("textarea",{id:`node-desc-${r}`,value:d,onChange:m,onBlur:y,className:"styledinput",rows:3})]}),T.jsxs("div",{className:"funcnodes-control-row",children:[T.jsx("label",{children:"Reset Inputs on Trigger:"}),T.jsx("input",{type:"checkbox",checked:u,onChange:v=>{e.on_node_action({type:"update",from_remote:!1,id:r,node:{reset_inputs_on_trigger:v.target.checked}})},className:"styledcheckbox"})]})]})},hhe=({splitnodesettingsPath:e=[]})=>{const t=ua(),n=t.use(r=>r.inputs);return T.jsxs(Kk,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx(eR,{className:"nodesettings-tabs-list","aria-label":"Manage node inputs",children:n.map(r=>T.jsx(Pv,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(Hv,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ef.Provider,{value:a,children:T.jsx(FB,{})})},r)})]})},phe=({splitnodesettingsPath:e=[]})=>{const t=ua(),n=t.use(r=>r.outputs);return T.jsxs(Kk,{defaultValue:e[0]||n[0],className:"nodesettings-tabs funcnodes-control-root",children:[T.jsx(eR,{className:"nodesettings-tabs-list","aria-label":"Manage node outputs",children:n.map(r=>T.jsx(Pv,{value:r,className:"nodesettings-tabs-trigger",children:r},r))}),n.map(r=>{const a=t.io_stores.get(r);return T.jsx(Hv,{value:r,className:"nodesettings-tabs-content nodesettings-io-list",children:a&&T.jsx(Ef.Provider,{value:a,children:T.jsx(FB,{})})},r)})]})},mhe=({nodeSettingsPath:e})=>{const t=e.split("/")||["general"];return T.jsxs(Kk,{defaultValue:t[0]||"general",className:"nodesettings-tabs funcnodes-control-root",children:[T.jsxs(eR,{className:"nodesettings-tabs-list","aria-label":"Manage node settings",children:[T.jsx(Pv,{value:"general",className:"nodesettings-tabs-trigger",children:"General"}),T.jsx(Pv,{value:"inputs",className:"nodesettings-tabs-trigger",children:"Inputs"}),T.jsx(Pv,{value:"outputs",className:"nodesettings-tabs-trigger",children:"Outputs"})]}),T.jsx(Hv,{value:"general",className:"nodesettings-tabs-content",children:T.jsx(dhe,{})}),T.jsx(Hv,{value:"inputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(hhe,{splitnodesettingsPath:t.slice(1)})}),T.jsx(Hv,{value:"outputs",className:"nodesettings-tabs-content nodesettings-io-list",children:T.jsx(phe,{splitnodesettingsPath:t.slice(1)})})]})},ghe=z.memo(({isOpen:e,onOpenChange:t,nodeSettingsPath:n})=>{const a=ua().use(l=>l.id);return T.jsx(Iu,{title:`Node Settings: ${a}`,open:e,onOpenChange:t,dialogClassName:"nodesettings-dialog",children:T.jsx(mhe,{nodeSettingsPath:n})})}),yhe=z.memo(({toogleShowSettings:e})=>{const t=Wt(),{node:n}=yo(),r=ua(),{id:a,description:l,node_name:u}=r.useShallow(h=>({id:h.id,description:h.description,node_name:h.node_name})),d=z.useCallback(()=>{t.on_node_action({type:"trigger",from_remote:!1,id:a})},[t,a]);return T.jsxs("div",{className:"nodeheader",title:l||u,children:[T.jsxs("div",{className:"nodeheader_element",children:[T.jsx(gJ,{fontSize:"inherit",className:"triggerbutton nodeheaderbutton ",onClick:d}),T.jsx(mJ,{fontSize:"inherit",className:"nodestatusbutton nodeheaderbutton",onClick:async()=>{n&&console.log("nodestatus",await n.get_node_status(a))}}),T.jsx(vJ,{fontSize:"inherit",className:"nodesettingsbutton nodeheaderbutton",onClick:()=>{e?.()}})]}),T.jsx("div",{className:"nodeheader_element nodeheader_title",children:T.jsx("div",{className:"nodeheader_title_text",children:u})}),T.jsx("div",{className:"nodeheader_element",children:T.jsx(K0,{fontSize:"inherit"})})]})}),vhe=z.memo(({iostore:e})=>{const t=e.use(),r=ua().use(d=>d.render_options),a=Bv(t.id),[l,u]=jde(t);return T.jsx("div",{className:"nodrag nodedatabody","data-src":r?.data?.src||"",children:l&&t&&T.jsx(Ef.Provider,{value:e,children:T.jsx(Iu,{title:t.full_id,trigger:T.jsx("div",{className:"nodedatabutton",children:T.jsx(HB,{Component:l})}),onOpenChange:d=>{d&&a?.()},children:u&&T.jsx(PB,{Component:u,iostore:e})})})})}),bhe=z.memo(({setShowSettings:e,setNodeSettingsPath:t})=>{const n=ua(),{render_options:r,outputs:a,inputs:l}=n.useShallow(d=>({render_options:d.render_options,outputs:d.outputs,inputs:d.inputs})),u=r?.data?.src?n.io_stores.get(r?.data?.src):void 0;return T.jsxs("div",{className:"nodebody nowheel ",children:[a.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ef.Provider,{value:h,children:T.jsx(Hde,{setNodeSettingsPath:t,setShowSettings:e})},d)}),u&&T.jsx(vhe,{iostore:u}),l.map(d=>{const h=n.io_stores.get(d);if(h)return T.jsx(Ef.Provider,{value:h,children:T.jsx(Pde,{setNodeSettingsPath:t,setShowSettings:e})},d)})]})}),tR=()=>{const e=ua(),{original_name:t,id:n}=e.useShallow(h=>({original_name:h.name,id:h.id})),[r,a]=q.useState(t);q.useEffect(()=>{a(t)},[t]);const l=Wt(),u=h=>{a(h.target.value)},d=h=>{const m=h.target.value;m!==t&&l.on_node_action({type:"update",from_remote:!1,id:n,node:{name:m}})};return T.jsx("input",{className:"nodename_input",value:r,onChange:u,onBlur:d})},xhe=()=>{const t=ua().use(n=>n.progress);return t?T.jsx(fne,{state:t,className:"nodeprogress"}):null},She=z.memo(()=>{const t=ua().use(n=>n.error);return T.jsxs("div",{className:"nodefooter",children:[t&&T.jsx("div",{className:"nodeerror",children:t}),T.jsx(xhe,{})]})}),whe=()=>{const e=ua(),{collapsed:t,error:n,node_id:r}=e.useShallow(A=>({collapsed:A.properties["frontend:collapsed"]||!1,error:A.error,node_id:A.node_id})),{visualTrigger:a}=Lde(e),[l,u]=q.useState(!1),[d,h]=q.useState(""),{keys:m}=FA(),v=z.useContext(Yu).NodeHooks[r]??[],S=z.useCallback(()=>{u(A=>!A)},[]),w=A=>{m.has("s")&&!l&&(h(""),u(!0),A.stopPropagation())};return T.jsxs("div",{className:"innernode"+(a?" intrigger":"")+(n?" error":""),onClick:w,children:[T.jsx(yhe,{toogleShowSettings:S}),T.jsx(tR,{}),t?null:T.jsx(bhe,{setNodeSettingsPath:h,setShowSettings:u}),T.jsx(She,{}),T.jsx(ghe,{isOpen:l,onOpenChange:u,nodeSettingsPath:d}),v.map((A,E)=>T.jsx(z.Fragment,{children:T.jsx(A,{})},E))]})},Ehe=z.memo(({data:e})=>T.jsx(V2.Provider,{value:e.nodestore,children:T.jsx(whe,{})}),(e,t)=>e.data.nodestore===t.data.nodestore),Che=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:a,sourcePosition:l,targetPosition:u,data:d,...h})=>{const[m]=xk({sourceX:t,sourceY:n,sourcePosition:l,targetX:r,targetY:a,targetPosition:u});return T.jsx(T.Fragment,{children:T.jsx(Iv,{id:e,path:m,...h})})},_he={default:Ehe,group:qfe},Ahe={default:Che},The=e=>({nodes:e.getNodes(),edges:e.getEdges(),onNodesChange:e.onNodesChange,onEdgesChange:e.onEdgesChange,onConnect:e.onConnect}),nR=e=>{const t=new Set,n=e.filter(a=>a.type==="group");n.forEach(a=>{t.add(a.id)});const r=e.filter(a=>!t.has(a.id));return{group_nodes:n,default_nodes:r}};function rR(e){const t=new Map(e.map(u=>[u.id,u])),n=new Map,r=[];for(const u of e)if(n.has(u.id)||n.set(u.id,[]),u.parentId&&t.has(u.parentId)){const d=t.get(u.parentId);if(d){const h=n.get(d.id)||[];h.push(u),n.set(d.id,h)}else r.push(u)}else r.push(u);const a=[];function l(u){a.push(u);const d=n.get(u.id)||[];for(const h of d)l(h)}for(const u of r)l(u);if(a.length!==e.length){console.warn("Sorting mismatch: Not all nodes could be placed. Check for circular dependencies or missing parents.");const u=new Set(a.map(d=>d.id));e.forEach(d=>{u.has(d.id)||a.push(d)})}return a}const uL=()=>{const{getNodes:e}=fh();return{getNodes:e,getSelectedNodes:a=>(a===void 0&&(a=e()),a.filter(l=>l.selected)),getSplitNodes:a=>{a===void 0&&(a=e());const{group_nodes:l,default_nodes:u}=nR(a);return{group_nodes:l,default_nodes:u}},getSortedNodes:a=>(a===void 0&&(a=e()),rR(a))}},cL=(e,t)=>{const n=e.getState(),{new_obj:r,change:a}=Ud(n,t);a&&e.setState(r)},fL=e=>mi(e);function dL(e){return e!=null&&typeof e=="object"&&"id"in e&&typeof e.id=="string"}const hL=e=>{let t=e.io??{},n=e.io_order,r=[];const a={};if(n===void 0)if(Array.isArray(t)){const l=t.filter(dL);r=l.map(u=>u.id);for(const u of l)a[u.id]=u}else{r=Object.keys(t);for(const l in t)t[l]!==void 0&&(a[l]=t[l])}else if(r=n,Array.isArray(t)){const l=t.filter(dL);for(const u of l)a[u.id]=u,r.includes(u.id)||r.push(u.id)}else for(const l in t)t[l]!==void 0&&(a[l]=t[l]),r.includes(l)||r.push(l);return{...e,io_order:r,io:a}},khe={id:"dummy",node_id:"dummy",node_name:"dummy",properties:{"frontend:size":[200,100],"frontend:pos":[NaN,NaN],"frontend:collapsed":!1},io:{},io_order:[],name:"dummy",in_trigger:!1,reset_inputs_on_trigger:!1,progress:{ascii:!1,elapsed:0,initial:0,n:0,prefix:"idle",unit:"it",unit_divisor:1e3,unit_scale:!1}},Rhe={id:"dummy",name:"dummy",node:"dummy",full_id:"dummy",type:"any",value:void 0,is_input:!1,connected:!1,does_trigger:!0,fullvalue:void 0,render_options:{set_default:!0,type:"any"},hidden:!1,emit_value_set:!0,required:!1},Ohe=n_(khe),Mhe=n_(Rhe),Nhe=e=>{const t=e.io_order;if(t===void 0)throw new Error("Node must have io_order");return{...e,inputs:Object.keys(e.io).filter(r=>e.io[r].is_input),outputs:Object.keys(e.io).filter(r=>!e.io[r].is_input),io_order:t}},Dhe=e=>(e.value==="<NoValue>"&&(e.value=void 0),e.fullvalue==="<NoValue>"&&(e.fullvalue=void 0),e.hidden===void 0&&(e.hidden=!1),[{...e},e.value,e.fullvalue]),Ihe=e=>{if(!e.id)throw new Error("Node must have an id");const t=Ohe(e);return Nhe(t)},zhe=(e,t)=>{const n=e.getState(),r={},a=hL(t),l=Object.keys(a);for(const u of l)switch(u){case"id":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"node_id":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"node_name":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"name":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"in_trigger":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}case"error":{a[u]!==n[u]&&(r[u]=a[u]);break}case"render_options":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"io_order":{const[d,h]=((m,y)=>y===void 0?[m,!1]:[y,!t_(m,y)])(n[u],a[u]);h&&(r[u]=d.filter(m=>m!==void 0));break}case"io":{const d=a[u];if(d===void 0)break;for(const h in d){const m=e.io_stores.get(h);if(!m){console.error("io key not found in oldvalue:",h);continue}m.update(d[h])}break}case"progress":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"description":{r[u]=a[u];break}case"properties":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"status":{const[d,h]=em(n[u],a[u]);h&&(r[u]=d);break}case"reset_inputs_on_trigger":{const[d,h]=ci(n[u],a[u]);h&&(r[u]=d);break}default:try{XM(u,a[u])}catch(d){console.error(d)}}Object.keys(r).length>0&&e.setState(r)},jhe=(e,t)=>{const n=e.getState(),r={},a={},l=Object.keys(t);for(const u of l)switch(u){case"name":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"id":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"connected":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"does_trigger":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"hidden":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"full_id":{const[d,h]=ci(n[u],t[u]);h&&(r[u]=d);break}case"is_input":break;case"node":break;case"type":break;case"value":{a.preview=t[u];break}case"fullvalue":{a.full=t[u];break}case"render_options":{const[d,h]=em(n[u],t[u]);h&&(r[u]=d);break}case"value_options":{const[d,h]=em(n[u],t[u]);h&&(r[u]=d);break}case"valuepreview_type":{r[u]=t[u];break}case"emit_value_set":{r[u]=t[u];break}case"default":{r[u]=t[u];break}case"required":{r[u]=t[u];break}default:try{XM(u,t[u])}catch(d){console.error(d)}}Object.keys(a).length>0&&e.updateValueStore(a),Object.keys(r).length>0&&e.setState(r)},Bhe=e=>{if(!e.id)throw new Error("IO must have an id but is missing for "+JSON.stringify(e));e.name===void 0&&(e.name=e.id);const t=Mhe(e);return(t.render_options.type==="any"||t.render_options.type===void 0)&&(t.render_options.type=t.type),Dhe(t)},Lhe=(e,t)=>{let n;const[r,a,l]=Bhe(t);return n={io_state:fL((u,d)=>r),use:u=>u?n.io_state(u):n.io_state(),useShallow:u=>n.io_state(Bk(u)),getState:()=>n.io_state.getState(),setState:u=>{n.io_state.setState(u)},update:u=>{jhe(n,u)},valuestore:mi((u,d)=>{let h=a;h==="<NoValue>"&&(h=void 0),!(h instanceof El)&&h!==void 0&&(h=Vu.fromObject(h));let m=l;return m==="<NoValue>"&&(m=void 0),!(m instanceof El)&&m!==void 0&&(m=Vu.fromObject(m)),{preview:h,full:m}}),updateValueStore:u=>{n.valuestore.setState(d=>(d.preview&&typeof d.preview.dispose=="function"&&d.preview.dispose(),d.full&&typeof d.full.dispose=="function"&&d.full.dispose(),u.preview!==void 0&&u.full===void 0&&(u.full=void 0,d.full=void 0),u.preview!==void 0&&!(u.preview instanceof El)&&(u.preview=Vu.fromObject(u.preview)),u.full!==void 0&&!(u.full instanceof El)&&(u.full=Vu.fromObject(u.full)),{...d,...u}))},node:e,serialize:()=>{const u=n.io_state.getState(),d=n.valuestore.getState();return{...u,value:d.preview,fullvalue:d.full,render_options:u.render_options,valuepreview_type:u.valuepreview_type,emit_value_set:u.emit_value_set}}},n},Phe=e=>{const t={use:l=>l?r.node_state(l):r.node_state(),useShallow:l=>r.node_state(Bk(l)),io_stores:new Map,getState:()=>r.node_state.getState(),setState:l=>{r.node_state.setState(l)},update:l=>{zhe(r,l)},serialize:()=>({...r.node_state.getState(),io:Object.fromEntries(Array.from(r.io_stores.entries()).map(([d,h])=>[d,h.serialize()]))})},n=hL(e),r={...t,node_state:fL((l,u)=>Ihe(n))},a=n.io;return Object.entries(a).forEach(([l,u])=>{u!==void 0&&r.io_stores.set(l,Lhe(n.id,u))}),r},Hhe=()=>{const e=Wt();return{onSelectionChange:q.useCallback(({nodes:n,edges:r})=>{const{group_nodes:a,default_nodes:l}=nR(n),u=e.local_state.getState();e.local_state.setState({...u,selected_nodes:l.map(d=>d.id),selected_edges:r.map(d=>d.id),selected_groups:a.map(d=>d.id)})},[e])}},Vhe=()=>{const e=fh(),t=Wt();return t.rf_instance=e,T.jsx(T.Fragment,{})},Fhe=()=>{const e=Wt(),{getEdges:t}=fh(),{getSelectedNodes:n}=uL();return{copySelectedNodes:q.useCallback(()=>{const a=t(),l=n();if(l.length===0)return;const u={nodes:[],edges:[]};for(const m of l){const y=e.nodespace.get_node(m.id,!1);y&&u.nodes.push(y.serialize())}const d=new Set(l.map(m=>m.id)),h=a.filter(m=>d.has(m.source)&&d.has(m.target));for(const m of h)!m.sourceHandle||!m.targetHandle||u.edges.push({src_nid:m.source,src_ioid:m.sourceHandle,trg_nid:m.target,trg_ioid:m.targetHandle});navigator.clipboard.writeText(JSON.stringify(u))},[n,t,e])}},Ghe=()=>{const e=Xu("Delete"),t=Xu(["Meta+c","Control+c","Strg+c"]),n=Xu(["Control+g","Meta+g"]),r=Xu(["Control+Alt+g","Meta+Alt+g"]),a=Zfe(),{getEdges:l}=fh(),{getNodes:u,getSelectedNodes:d,getSplitNodes:h}=uL(),{copySelectedNodes:m}=Fhe(),{node:y,group:v,edge:S}=yo();return q.useEffect(()=>{if(e){const w=l().filter(R=>R.selected);for(const R of w)!R.source||!R.target||!R.sourceHandle||!R.targetHandle||S?.remove_edge({src_nid:R.source,src_ioid:R.sourceHandle,trg_nid:R.target,trg_ioid:R.targetHandle});const A=d(),{group_nodes:E,default_nodes:k}=h(A);for(const R of k)y?.remove_node(R.id);for(const R of E)v?.remove_group(R.id)}},[e,u,l,y,v,S]),q.useEffect(()=>{t&&m()},[t,m]),q.useEffect(()=>{if(n){const w=d(),{group_nodes:A,default_nodes:E}=h(w);w.length>0&&a(E.map(k=>k.id),A.map(k=>k.id))}},[n,u]),q.useEffect(()=>{if(r){const w=d(),{group_nodes:A}=h(w);A.forEach(E=>{v?.remove_group(E.id)})}},[r,u]),T.jsx(T.Fragment,{})},Uhe=()=>{const{node:e,edge:t}=yo(),n=Wt();return z.useCallback(async(a,l)=>{try{if(!a||!e||!t)return;const u=JSON.parse(a);if(!u||!n.worker||!u.nodes)return;const d=[0,0];for(const m of u.nodes)d[0]+=m.properties["frontend:pos"][0],d[1]+=m.properties["frontend:pos"][1];d[0]/=u.nodes.length,d[1]/=u.nodes.length;const h=[];for(const m of u.nodes){const y={id:m.node_id,src_id:m.id,position:[m.properties["frontend:pos"][0]-d[0],m.properties["frontend:pos"][1]-d[1]]};h.push(y)}for(const m of h){const y=await e.add_node(m.id);!y||!n.nodespace.get_node(y.id,!1)||(m.new_id=y.id,l([{id:y.id,type:"position",position:{x:m.position[0]+y.properties["frontend:pos"][0],y:m.position[1]+y.properties["frontend:pos"][1]}}]))}for(const m of u.edges){const y=h.find(S=>S.src_id===m.src_nid),v=h.find(S=>S.src_id===m.trg_nid);!y||!v||!y.new_id||!v.new_id||t.add_edge({src_nid:y.new_id,src_ioid:m.src_ioid,trg_nid:v.new_id,trg_ioid:m.trg_ioid})}}catch(u){console.error("Failed to process pasted data:",u)}},[e,t,n])},$he=(e,t)=>{const n=e.properties||{};n["frontend:size"]||(n["frontend:size"]=[200,100]);const r=n["frontend:pos"];if(!r||r.length!==2||isNaN(r[0])||r[0]===null||isNaN(r[1])||r[1]===null)if(!t||!t.rf_instance||t.reactflowRef===null)n["frontend:pos"]=[0,0];else{const l=t.reactflowRef.getBoundingClientRect(),u=l.left+l.width/2,d=l.top+l.height/2,h=t.rf_instance.screenToFlowPosition({x:u,y:d});n["frontend:pos"]=[h.x-n["frontend:size"][0]/2,h.y-n["frontend:size"][0]/2]}n["frontend:collapsed"]||(n["frontend:collapsed"]=!1),e.properties=n},Xhe=(e,t)=>{const n=e.getState();if($he(n,t),n.id===void 0)throw new Error("Node must have an id");const r={nodestore:e};return{position:{x:n.properties["frontend:pos"][0],y:n.properties["frontend:pos"][1]},data:r,type:"default",zIndex:1003,...n}},pL={default:Po.Dots,metal:Po.Cross,light:Po.Dots,solarized:Po.Dots,midnight:Po.Dots,forest:Po.Dots,scientific:Po.Lines},Yhe=e=>{const t=Wt(),n=q.useRef(null),{colorTheme:r}=lI(),{onSelectionChange:a}=Hhe(),l=ore();z.useEffect(()=>{t.getStateManager().toaster=l},[]),q.useEffect(()=>{t.reactflowRef=n.current},[n]);const{nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y}=t.useReactFlowStore(Bk(The)),v=Uhe(),S=q.useCallback(w=>{const A=n.current;if(!A)return;let E=w.target,k=0;for(;E&&E.parentElement&&E!==A;)k++,E=E.parentElement;t.logger.debug(`onPasteCapture: ${k} steps to reactflow`),k<=2&&v(w.clipboardData.getData("text/plain"),h)},[v,h,t.logger]);return T.jsx("div",{className:"reactflowlayer",children:T.jsxs(vfe,{onPasteCapture:S,nodes:u,edges:d,onNodesChange:h,onEdgesChange:m,onConnect:y,nodeTypes:_he,edgeTypes:Ahe,minZoom:e.minZoom,maxZoom:e.maxZoom,fitView:!0,onSelectionChange:a,ref:n,panOnDrag:!e.static,children:[T.jsx(Vhe,{}),T.jsx(Ghe,{}),T.jsx(Efe,{color:"#888",gap:24,size:2,variant:pL[r]||pL.default,patternClassName:"fn-background-pattern"}),e.minimap&&T.jsx(Ffe,{nodeStrokeWidth:3,pannable:!e.static,zoomable:!e.static,zoomStep:3})]})})},Zhe=({on_node_change:e,on_edge_change:t,on_connect:n})=>{const r=e||(d=>{}),a=t||(d=>{}),l=n||(d=>{});return mi((d,h)=>({_nodes:[],_edges:[],_nodes_map:new Map,update_nodes:m=>{m=rR(m),d({_nodes:m,_nodes_map:new Map(m.map(y=>[y.id,y]))})},partial_update_nodes:m=>{const y=h(),v=y._nodes,S=new Map(v.map(w=>[w.id,w]));for(const w of m)S.set(w.id,w);y.update_nodes(Array.from(S.values()))},update_edges:m=>{d({_edges:m})},onNodesChange:m=>{const y=h();y.update_nodes(Nk(m,y._nodes)),r(m)},onEdgesChange:m=>{d({_edges:_6(m,h()._edges)}),a(m)},onConnect:m=>{m.source==null||m.target==null||l(m)},getNode:m=>h()._nodes_map.get(m),getNodes:()=>h()._nodes,getEdges:()=>h()._edges}))},Whe=()=>{const t=Wt().progress_state();return T.jsxs("div",{className:"statusbar",children:[T.jsx("span",{className:"statusbar-progressbar",style:{width:Math.min(100,100*t.progress)+"%"}}),T.jsx("span",{className:"statusbar-message",children:t.message})]})},U2=!1;var oR=["Enter"," "],qhe=["ArrowDown","PageUp","Home"],mL=["ArrowUp","PageDown","End"],Jhe=[...qhe,...mL],Qhe={ltr:[...oR,"ArrowRight"],rtl:[...oR,"ArrowLeft"]},Khe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Vv="Menu",[Fv,epe,tpe]=zw(Vv),[ph,gL]=gs(Vv,[tpe,xw,F2]),Gv=xw(),yL=F2(),[vL,mh]=ph(Vv),[npe,Uv]=ph(Vv),bL=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:a,onOpenChange:l,modal:u=!0}=e,d=Gv(t),[h,m]=z.useState(null),y=z.useRef(!1),v=aa(l),S=P2(a);return z.useEffect(()=>{const w=()=>{y.current=!0,document.addEventListener("pointerdown",A,{capture:!0,once:!0}),document.addEventListener("pointermove",A,{capture:!0,once:!0})},A=()=>y.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",A,{capture:!0}),document.removeEventListener("pointermove",A,{capture:!0})}},[]),T.jsx(rT,{...d,children:T.jsx(vL,{scope:t,open:n,onOpenChange:v,content:h,onContentChange:m,children:T.jsx(npe,{scope:t,onClose:z.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:S,modal:u,children:r})})})};bL.displayName=Vv;var rpe="MenuAnchor",aR=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Gv(n);return T.jsx(oT,{...a,...r,ref:t})});aR.displayName=rpe;var ope="MenuPortal",[WSe,xL]=ph(ope,{forceMount:void 0}),gi="MenuContent",[ape,iR]=ph(gi),SL=z.forwardRef((e,t)=>{const n=xL(gi,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=mh(gi,e.__scopeMenu),u=Uv(gi,e.__scopeMenu);return T.jsx(Fv.Provider,{scope:e.__scopeMenu,children:T.jsx(yl,{present:r||l.open,children:T.jsx(Fv.Slot,{scope:e.__scopeMenu,children:u.modal?T.jsx(ipe,{...a,ref:t}):T.jsx(lpe,{...a,ref:t})})})})}),ipe=z.forwardRef((e,t)=>{const n=mh(gi,e.__scopeMenu),r=z.useRef(null),a=bn(t,r);return z.useEffect(()=>{const l=r.current;if(l)return K_(l)},[]),T.jsx(lR,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ke(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lpe=z.forwardRef((e,t)=>{const n=mh(gi,e.__scopeMenu);return T.jsx(lR,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),spe=dm("MenuContent.ScrollLock"),lR=z.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:h,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,disableOutsideScroll:A,...E}=e,k=mh(gi,n),R=Uv(gi,n),D=Gv(n),M=yL(n),I=epe(n),[L,P]=z.useState(null),G=z.useRef(null),$=bn(t,G,k.onContentChange),Z=z.useRef(0),j=z.useRef(""),X=z.useRef(0),ee=z.useRef(null),ae=z.useRef("right"),U=z.useRef(0),te=A?GS:z.Fragment,V=A?{as:spe,allowPinchZoom:!0}:void 0,W=ne=>{const B=j.current+ne,oe=I().filter(Ee=>!Ee.disabled),se=document.activeElement,Y=oe.find(Ee=>Ee.ref.current===se)?.textValue,he=oe.map(Ee=>Ee.textValue),ke=xpe(he,B,Y),me=oe.find(Ee=>Ee.textValue===ke)?.ref.current;(function Ee(xe){j.current=xe,window.clearTimeout(Z.current),xe!==""&&(Z.current=window.setTimeout(()=>Ee(""),1e3))})(B),me&&setTimeout(()=>me.focus())};z.useEffect(()=>()=>window.clearTimeout(Z.current),[]),Y_();const Q=z.useCallback(ne=>ae.current===ee.current?.side&&wpe(ne,ee.current?.area),[]);return T.jsx(ape,{scope:n,searchRef:j,onItemEnter:z.useCallback(ne=>{Q(ne)&&ne.preventDefault()},[Q]),onItemLeave:z.useCallback(ne=>{Q(ne)||(G.current?.focus(),P(null))},[Q]),onTriggerLeave:z.useCallback(ne=>{Q(ne)&&ne.preventDefault()},[Q]),pointerGraceTimerRef:X,onPointerGraceIntentChange:z.useCallback(ne=>{ee.current=ne},[]),children:T.jsx(te,{...V,children:T.jsx(IS,{asChild:!0,trapped:a,onMountAutoFocus:Ke(l,ne=>{ne.preventDefault(),G.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:T.jsx(G0,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:m,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:S,onDismiss:w,children:T.jsx(JB,{asChild:!0,...M,dir:R.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:P,onEntryFocus:Ke(h,ne=>{R.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:T.jsx(FI,{role:"menu","aria-orientation":"vertical","data-state":PL(k.open),"data-radix-menu-content":"",dir:R.dir,...D,...E,ref:$,style:{outline:"none",...E.style},onKeyDown:Ke(E.onKeyDown,ne=>{const oe=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,se=ne.ctrlKey||ne.altKey||ne.metaKey,Y=ne.key.length===1;oe&&(ne.key==="Tab"&&ne.preventDefault(),!se&&Y&&W(ne.key));const he=G.current;if(ne.target!==he||!Jhe.includes(ne.key))return;ne.preventDefault();const me=I().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);mL.includes(ne.key)&&me.reverse(),vpe(me)}),onBlur:Ke(e.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(Z.current),j.current="")}),onPointerMove:Ke(e.onPointerMove,Xv(ne=>{const B=ne.target,oe=U.current!==ne.clientX;if(ne.currentTarget.contains(B)&&oe){const se=ne.clientX>U.current?"right":"left";ae.current=se,U.current=ne.clientX}}))})})})})})})});SL.displayName=gi;var upe="MenuGroup",sR=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(It.div,{role:"group",...r,ref:t})});sR.displayName=upe;var cpe="MenuLabel",wL=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(It.div,{...r,ref:t})});wL.displayName=cpe;var $2="MenuItem",EL="menu.itemSelect",X2=z.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,l=z.useRef(null),u=Uv($2,e.__scopeMenu),d=iR($2,e.__scopeMenu),h=bn(t,l),m=z.useRef(!1),y=()=>{const v=l.current;if(!n&&v){const S=new CustomEvent(EL,{bubbles:!0,cancelable:!0});v.addEventListener(EL,w=>r?.(w),{once:!0}),F_(v,S),S.defaultPrevented?m.current=!1:u.onClose()}};return T.jsx(CL,{...a,ref:h,disabled:n,onClick:Ke(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),m.current=!0},onPointerUp:Ke(e.onPointerUp,v=>{m.current||v.currentTarget?.click()}),onKeyDown:Ke(e.onKeyDown,v=>{const S=d.searchRef.current!=="";n||S&&v.key===" "||oR.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});X2.displayName=$2;var CL=z.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...l}=e,u=iR($2,n),d=yL(n),h=z.useRef(null),m=bn(t,h),[y,v]=z.useState(!1),[S,w]=z.useState("");return z.useEffect(()=>{const A=h.current;A&&w((A.textContent??"").trim())},[l.children]),T.jsx(Fv.ItemSlot,{scope:n,disabled:r,textValue:a??S,children:T.jsx(QB,{asChild:!0,...d,focusable:!r,children:T.jsx(It.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...l,ref:m,onPointerMove:Ke(e.onPointerMove,Xv(A=>{r?u.onItemLeave(A):(u.onItemEnter(A),A.defaultPrevented||A.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ke(e.onPointerLeave,Xv(A=>u.onItemLeave(A))),onFocus:Ke(e.onFocus,()=>v(!0)),onBlur:Ke(e.onBlur,()=>v(!1))})})})}),fpe="MenuCheckboxItem",_L=z.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return T.jsx(OL,{scope:e.__scopeMenu,checked:n,children:T.jsx(X2,{role:"menuitemcheckbox","aria-checked":Y2(n)?"mixed":n,...a,ref:t,"data-state":fR(n),onSelect:Ke(a.onSelect,()=>r?.(Y2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});_L.displayName=fpe;var AL="MenuRadioGroup",[dpe,hpe]=ph(AL,{value:void 0,onValueChange:()=>{}}),TL=z.forwardRef((e,t)=>{const{value:n,onValueChange:r,...a}=e,l=aa(r);return T.jsx(dpe,{scope:e.__scopeMenu,value:n,onValueChange:l,children:T.jsx(sR,{...a,ref:t})})});TL.displayName=AL;var kL="MenuRadioItem",RL=z.forwardRef((e,t)=>{const{value:n,...r}=e,a=hpe(kL,e.__scopeMenu),l=n===a.value;return T.jsx(OL,{scope:e.__scopeMenu,checked:l,children:T.jsx(X2,{role:"menuitemradio","aria-checked":l,...r,ref:t,"data-state":fR(l),onSelect:Ke(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});RL.displayName=kL;var uR="MenuItemIndicator",[OL,ppe]=ph(uR,{checked:!1}),ML=z.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,l=ppe(uR,n);return T.jsx(yl,{present:r||Y2(l.checked)||l.checked===!0,children:T.jsx(It.span,{...a,ref:t,"data-state":fR(l.checked)})})});ML.displayName=uR;var mpe="MenuSeparator",NL=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return T.jsx(It.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});NL.displayName=mpe;var gpe="MenuArrow",DL=z.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=Gv(n);return T.jsx(GI,{...a,...r,ref:t})});DL.displayName=gpe;var cR="MenuSub",[ype,IL]=ph(cR),zL=e=>{const{__scopeMenu:t,children:n,open:r=!1,onOpenChange:a}=e,l=mh(cR,t),u=Gv(t),[d,h]=z.useState(null),[m,y]=z.useState(null),v=aa(a);return z.useEffect(()=>(l.open===!1&&v(!1),()=>v(!1)),[l.open,v]),T.jsx(rT,{...u,children:T.jsx(vL,{scope:t,open:r,onOpenChange:v,content:m,onContentChange:y,children:T.jsx(ype,{scope:t,contentId:ys(),triggerId:ys(),trigger:d,onTriggerChange:h,children:n})})})};zL.displayName=cR;var $v="MenuSubTrigger",jL=z.forwardRef((e,t)=>{const n=mh($v,e.__scopeMenu),r=Uv($v,e.__scopeMenu),a=IL($v,e.__scopeMenu),l=iR($v,e.__scopeMenu),u=z.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:h}=l,m={__scopeMenu:e.__scopeMenu},y=z.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return z.useEffect(()=>y,[y]),z.useEffect(()=>{const v=d.current;return()=>{window.clearTimeout(v),h(null)}},[d,h]),T.jsx(aR,{asChild:!0,...m,children:T.jsx(CL,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":PL(n.open),...e,ref:DS(t,a.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ke(e.onPointerMove,Xv(v=>{l.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),y()},100))})),onPointerLeave:Ke(e.onPointerLeave,Xv(v=>{y();const S=n.content?.getBoundingClientRect();if(S){const w=n.content?.dataset.side,A=w==="right",E=A?-5:5,k=S[A?"left":"right"],R=S[A?"right":"left"];l.onPointerGraceIntentChange({area:[{x:v.clientX+E,y:v.clientY},{x:k,y:S.top},{x:R,y:S.top},{x:R,y:S.bottom},{x:k,y:S.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(v),v.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Ke(e.onKeyDown,v=>{const S=l.searchRef.current!=="";e.disabled||S&&v.key===" "||Qhe[r.dir].includes(v.key)&&(n.onOpenChange(!0),n.content?.focus(),v.preventDefault())})})})});jL.displayName=$v;var BL="MenuSubContent",LL=z.forwardRef((e,t)=>{const n=xL(gi,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,l=mh(gi,e.__scopeMenu),u=Uv(gi,e.__scopeMenu),d=IL(BL,e.__scopeMenu),h=z.useRef(null),m=bn(t,h);return T.jsx(Fv.Provider,{scope:e.__scopeMenu,children:T.jsx(yl,{present:r||l.open,children:T.jsx(Fv.Slot,{scope:e.__scopeMenu,children:T.jsx(lR,{id:d.contentId,"aria-labelledby":d.triggerId,...a,ref:m,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:y=>{u.isUsingKeyboardRef.current&&h.current?.focus(),y.preventDefault()},onCloseAutoFocus:y=>y.preventDefault(),onFocusOutside:Ke(e.onFocusOutside,y=>{y.target!==d.trigger&&l.onOpenChange(!1)}),onEscapeKeyDown:Ke(e.onEscapeKeyDown,y=>{u.onClose(),y.preventDefault()}),onKeyDown:Ke(e.onKeyDown,y=>{const v=y.currentTarget.contains(y.target),S=Khe[u.dir].includes(y.key);v&&S&&(l.onOpenChange(!1),d.trigger?.focus(),y.preventDefault())})})})})})});LL.displayName=BL;function PL(e){return e?"open":"closed"}function Y2(e){return e==="indeterminate"}function fR(e){return Y2(e)?"indeterminate":e?"checked":"unchecked"}function vpe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function bpe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function xpe(e,t,n){const a=t.length>1&&Array.from(t).every(m=>m===t[0])?t[0]:t,l=n?e.indexOf(n):-1;let u=bpe(e,Math.max(l,0));a.length===1&&(u=u.filter(m=>m!==n));const h=u.find(m=>m.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function Spe(e,t){const{x:n,y:r}=e;let a=!1;for(let l=0,u=t.length-1;l<t.length;u=l++){const d=t[l],h=t[u],m=d.x,y=d.y,v=h.x,S=h.y;y>r!=S>r&&n<(v-m)*(r-y)/(S-y)+m&&(a=!a)}return a}function wpe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Spe(n,t)}function Xv(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Epe=bL,Cpe=aR,_pe=SL,Ape=sR,Tpe=wL,kpe=X2,Rpe=_L,Ope=TL,Mpe=RL,Npe=ML,Dpe=NL,Ipe=DL,zpe=zL,jpe=jL,Bpe=LL,Z2="DropdownMenu",[Lpe,qSe]=gs(Z2,[gL]),Vo=gL(),[Ppe,HL]=Lpe(Z2),VL=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:a,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,h=Vo(t),m=z.useRef(null),[y,v]=cf({prop:a,defaultProp:l??!1,onChange:u,caller:Z2});return T.jsx(Ppe,{scope:t,triggerId:ys(),triggerRef:m,contentId:ys(),open:y,onOpenChange:v,onOpenToggle:z.useCallback(()=>v(S=>!S),[v]),modal:d,children:T.jsx(Epe,{...h,open:y,onOpenChange:v,dir:r,modal:d,children:n})})};VL.displayName=Z2;var FL="DropdownMenuTrigger",GL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=e,l=HL(FL,n),u=Vo(n);return T.jsx(Cpe,{asChild:!0,...u,children:T.jsx(It.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:DS(t,l.triggerRef),onPointerDown:Ke(e.onPointerDown,d=>{!r&&d.button===0&&d.ctrlKey===!1&&(l.onOpenToggle(),l.open||d.preventDefault())}),onKeyDown:Ke(e.onKeyDown,d=>{r||(["Enter"," "].includes(d.key)&&l.onOpenToggle(),d.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(d.key)&&d.preventDefault())})})})});GL.displayName=FL;var UL="DropdownMenuContent",$L=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=HL(UL,n),l=Vo(n),u=z.useRef(!1);return T.jsx(_pe,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...r,ref:t,onCloseAutoFocus:Ke(e.onCloseAutoFocus,d=>{u.current||a.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Ke(e.onInteractOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0,y=h.button===2||m;(!a.modal||y)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$L.displayName=UL;var Hpe="DropdownMenuGroup",XL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Ape,{...a,...r,ref:t})});XL.displayName=Hpe;var Vpe="DropdownMenuLabel",Fpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Tpe,{...a,...r,ref:t})});Fpe.displayName=Vpe;var Gpe="DropdownMenuItem",YL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(kpe,{...a,...r,ref:t})});YL.displayName=Gpe;var Upe="DropdownMenuCheckboxItem",$pe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Rpe,{...a,...r,ref:t})});$pe.displayName=Upe;var Xpe="DropdownMenuRadioGroup",ZL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Ope,{...a,...r,ref:t})});ZL.displayName=Xpe;var Ype="DropdownMenuRadioItem",WL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Mpe,{...a,...r,ref:t})});WL.displayName=Ype;var Zpe="DropdownMenuItemIndicator",Wpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Npe,{...a,...r,ref:t})});Wpe.displayName=Zpe;var qpe="DropdownMenuSeparator",Jpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Dpe,{...a,...r,ref:t})});Jpe.displayName=qpe;var Qpe="DropdownMenuArrow",Kpe=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Ipe,{...a,...r,ref:t})});Kpe.displayName=Qpe;var eme=e=>{const{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:a,defaultOpen:l}=e,u=Vo(t),[d,h]=cf({prop:r,defaultProp:l??!1,onChange:a,caller:"DropdownMenuSub"});return T.jsx(zpe,{...u,open:d,onOpenChange:h,children:n})},tme="DropdownMenuSubTrigger",qL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(jpe,{...a,...r,ref:t})});qL.displayName=tme;var nme="DropdownMenuSubContent",JL=z.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Vo(n);return T.jsx(Bpe,{...a,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});JL.displayName=nme;var dR=VL,hR=GL,pR=$L,mR=XL,Zu=YL,rme=ZL,ome=WL,ame=eme,ime=qL,lme=JL;const sme=({trigger:e,setOpen:t,open:n})=>{const[r,a]=q.useState(""),[l,u]=q.useState(!0),d=Wt();return d.options.useWorkerManager?T.jsxs(Iu,{setOpen:t,open:n,trigger:e,title:"New Worker",description:"Create a new worker",children:[T.jsxs("div",{children:["Name:",T.jsx("br",{}),T.jsx("input",{className:"styledinput",onChange:h=>{a(h.currentTarget.value)},value:r}),T.jsxs("div",{style:{marginTop:8},children:[T.jsx("input",{type:"checkbox",id:"inVenvCheckbox",checked:l,onChange:h=>u(h.currentTarget.checked)}),T.jsx("label",{htmlFor:"inVenvCheckbox",style:{marginLeft:4},children:"Create in new virtual environment"})]})]}),T.jsx("div",{children:r&&T.jsx("div",{children:T.jsx("button",{className:"styledbtn",onClick:()=>{d.workermanager?.new_worker({name:r,in_venv:l}),t(!1)},children:"Create"})})})]}):null},ume=({trigger:e,setOpen:t,open:n})=>{const r=Wt(),[a,l]=q.useState(!1),u=r.workers(),d=r.worker?.uuid,h=(d?u[d]?.name:void 0)||d||"worker",m=async()=>{if(!r.worker)return;const y=await r.worker.export({withFiles:a});d7(y,h+".fnw","application/zip"),t(!1)};return T.jsx(Iu,{setOpen:t,open:n,trigger:e,title:"Export Worker",description:"Export the worker as a .fnw file",children:T.jsxs("div",{children:[T.jsxs("div",{children:[T.jsx("input",{type:"checkbox",className:"styledcheckbox",checked:a,onChange:y=>{l(y.currentTarget.checked)}}),"Include Files"]}),T.jsx("button",{className:"styledbtn",onClick:m,children:"Export"})]})})},cme=()=>{const e=Wt(),t=e.workers(),[n,r]=q.useState(!1),[a,l]=q.useState(!1),u=w=>{w!=="__select__"&&e.workers&&e.workermanager&&t[w]&&(!t[w].active&&!window.confirm("this is an inactive worker, selecting it will start it, continue?")||e.workermanager.set_active(w))},d=async()=>{if(!e.worker||!window.confirm("Updateing the worker might replace the current nodespace, continue?"))return;const A=await m7(".fnw");e.worker.update_from_export(A)},h=e.options.useWorkerManager&&e.workermanager&&e.workermanager.open||U2,m=h&&Object.keys(t).length>0,y=e.worker&&e.worker.is_open,v=y&&h;return h||y?T.jsxs(T.Fragment,{children:[T.jsxs(dR,{children:[T.jsx(hR,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Cf,{direction:"row",children:["Worker ",T.jsx(VA,{className:"m-x-s"})]})})}),T.jsx(pR,{className:"headermenucontent funcnodescontainer",children:T.jsxs(mR,{children:[m&&T.jsxs(ame,{children:[T.jsx(ime,{className:"headermenuitem submenuitem",children:T.jsxs(Cf,{direction:"row",children:["Select",T.jsx(J0,{})]})}),T.jsx(lme,{className:"headermenucontent funcnodescontainer",sideOffset:2,alignOffset:-5,children:T.jsx(rme,{value:e.worker?.uuid,onValueChange:w=>{u(w)},children:Object.keys(t).sort((w,A)=>{if(t[w].active&&!t[A].active)return-1;if(!t[w].active&&t[A].active)return 1;const E=t[w].name||w,k=t[A].name||A;return E.localeCompare(k)}).map(w=>T.jsx(ome,{className:"headermenuitem workerselectoption"+(t[w]?.active?" active":" inactive")+" headermenuitem",value:w,disabled:w===e.worker?.uuid,children:t[w]?.name||w},w))})})]}),y&&T.jsxs(T.Fragment,{children:[v&&T.jsx(Zu,{className:"headermenuitem",onClick:()=>{if(e.worker){if(!e.workermanager)return e.logger.error("no workermanager");e.workermanager?.restart_worker(e.worker.uuid)}},children:"Restart"}),T.jsx(Zu,{className:"headermenuitem",onClick:()=>{e.worker&&e.worker.stop()},children:"Stop"}),T.jsx(Zu,{className:"headermenuitem",onClick:()=>l(!0),children:"Export"}),T.jsx(Zu,{className:"headermenuitem",onClick:d,children:"Update"})]}),h&&T.jsx(T.Fragment,{children:T.jsx(Zu,{className:"headermenuitem",onClick:()=>r(!0),children:"New"})})]})})]}),T.jsx(sme,{open:n,setOpen:r}),T.jsx(ume,{open:a,setOpen:l})]}):null},fme=()=>{const e=Wt(),t=()=>{window.confirm("Are you sure you want to start a new flow?")&&e.worker?.clear()},n=async()=>{const a=await e.worker?.save();if(!a)return;const l=new Blob([JSON.stringify(a)],{type:"application/json"}),u=URL.createObjectURL(l),d=document.createElement("a");d.href=u,d.download="flow.json",d.click(),URL.revokeObjectURL(u),d.remove()},r=async()=>{const a=document.createElement("input");a.type="file",a.accept=".json",a.onchange=async l=>{const u=l.target.files?.[0];if(!u)return;const d=new FileReader;d.onload=async h=>{const m=h.target?.result;if(!m)return;const y=JSON.parse(m);await e.worker?.load(y)},d.readAsText(u)},a.click()};return T.jsx(T.Fragment,{children:T.jsxs(dR,{children:[T.jsx(hR,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Cf,{direction:"row",children:["Nodespace ",T.jsx(VA,{className:"m-x-s"})]})})}),T.jsx(pR,{className:"headermenucontent funcnodescontainer",children:T.jsxs(mR,{children:[T.jsx(Zu,{className:"headermenuitem",onClick:t,children:"New"}),T.jsx(Zu,{className:"headermenuitem",onClick:n,children:"Save"}),T.jsx(Zu,{className:"headermenuitem",onClick:r,children:"Load"})]})})]})})},dme=({theme:e,selected:t})=>T.jsxs("div",{style:{width:80,height:54,borderRadius:"var(--fn-border-radius-s, 8px)",border:t?"2.5px solid #1976d2":"1.5px solid #bbb",boxShadow:t?"0 0 0 2px #1976d2":"0 1px 4px #0002",background:"var(--fn-app-background)",display:"flex",flexDirection:"column",alignItems:"stretch",justifyContent:"flex-start",position:"relative",overflow:"hidden",transition:"border 0.2s, box-shadow 0.2s"},"fn-data-color-theme":e,children:[T.jsx("div",{style:{height:10,background:"var(--fn-primary-color)",borderBottom:"1px solid var(--fn-neutral-element-border)"}}),T.jsxs("div",{style:{display:"flex",flex:1},children:[T.jsx("div",{style:{width:12,background:"var(--fn-surface-elevation-low, var(--fn-container-background))",borderRight:"1px solid var(--fn-neutral-element-border)"}}),T.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--fn-container-background)"},children:T.jsxs("div",{style:{width:22,height:14,borderRadius:"var(--fn-border-radius-xs, 4px)",background:"var(--fn-node-background)",border:"1px solid var(--fn-node-header-color)",boxShadow:"0 1px 2px #0002",display:"flex",flexDirection:"column"},children:[T.jsx("div",{style:{height:5,background:"var(--fn-node-header-color)",borderTopLeftRadius:"var(--fn-border-radius-xs, 4px)",borderTopRightRadius:"var(--fn-border-radius-xs, 4px)"}}),T.jsx("div",{style:{flex:1,background:"transparent"}})]})})]}),T.jsx("span",{style:{position:"absolute",bottom:2,right:4,fontSize:9,color:"var(--fn-text-color-neutral)",opacity:.7,textTransform:"capitalize",fontWeight:600,pointerEvents:"none"},children:e}),t&&T.jsx("span",{style:{position:"absolute",top:2,left:6,fontSize:14,color:"#1976d2",fontWeight:900,pointerEvents:"none"},"aria-label":"Selected",children:"✓"})]}),hme=()=>{const{colorTheme:e,setColorTheme:t}=lI(),[n,r]=z.useState(null),[a,l]=z.useState(null),u=h=>{h!==e&&(l(e),t(h),r(h))},d=h=>{n===h&&a&&a!==h&&t(a),r(null),l(null)};return T.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:[T.jsx("div",{style:{marginBottom:8,fontWeight:500},children:"Theme:"}),T.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(80px, 1fr))",gap:16,justifyItems:"center"},children:Rj.map(h=>T.jsx("button",{onClick:()=>{t(h),r(null),l(null)},onMouseEnter:()=>u(h),onMouseLeave:()=>d(h),style:{background:"none",border:"none",padding:0,cursor:"pointer",outline:"none",borderRadius:8},"aria-label":`Select ${h} theme`,children:T.jsx(dme,{theme:h,selected:e===h})},h))})]})},pme=()=>{const[e,t]=z.useState(!1),n=()=>{t(!0)};return T.jsxs(T.Fragment,{children:[T.jsxs(dR,{children:[T.jsx(hR,{asChild:!0,children:T.jsx("button",{className:"styledbtn",children:T.jsxs(Cf,{direction:"row",children:["Settings ",T.jsx(VA,{className:"m-x-s"})]})})}),T.jsx(pR,{className:"headermenucontent funcnodescontainer",children:T.jsx(mR,{children:T.jsx(Zu,{className:"headermenuitem",onClick:n,children:"Appearance"})})})]}),T.jsx(Iu,{open:e,setOpen:t,title:"Appearance",description:"Change the color theme.",closebutton:!0,children:T.jsx(hme,{})})]})},mme=({...e})=>{const t=Wt(),n=t.workerstate();return Object.keys(e).length>0&&t.logger.debug("headerprops",e),T.jsxs(Cf,{className:"funcnodesreactflowheader",direction:"row",wrap:!0,children:[T.jsx(Cf,{className:"headerelement m-w-6",grow:{"":!0,m:!1},children:T.jsx(Whe,{})}),(e.showmenu||U2)&&T.jsxs(Cf,{direction:"row",wrap:!0,children:[T.jsx("div",{className:"headerelement",children:T.jsx(cme,{})}),(t.worker&&n.is_open||U2)&&T.jsx("div",{className:"headerelement",children:T.jsx(fme,{})}),T.jsx("div",{className:"headerelement",children:T.jsx(pme,{})})]})]})},QL=({item:e})=>{const{node:t}=yo(),n=z.useCallback(()=>{t?.add_node(e.node_id)},[e.node_id,t]),r=z.useCallback(a=>{a.detail===2&&n()},[n]);return T.jsx("div",{className:"libnodeentry",onClick:r,title:e.description,children:e.node_name||e.node_id})},KL=(e,t)=>{const n=e.nodes?.some(a=>a.node_id.toLowerCase().includes(t.toLowerCase()))??!1,r=e.subshelves?.some(a=>KL(a,t))??!1;return n||r},gR=({item:e,filter:t,parentkey:n})=>{const[r,a]=q.useState(!1),l=()=>a(!r),u=e.nodes?.filter(h=>h.node_id.toLowerCase().includes(t.toLowerCase())),d=r||t.length>0;return KL(e,t)?T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:l,style:{cursor:"pointer"},title:e.description,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(d?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(d?"open":"close"),children:T.jsxs("div",{className:"libnodecontainer_inner",children:[u&&T.jsx(T.Fragment,{children:u.map(h=>T.jsx(QL,{item:h},h.node_id))}),e.subshelves&&T.jsx(T.Fragment,{children:e.subshelves.map(h=>T.jsx(gR,{item:h,filter:t,parentkey:n+h.name},n+h.name))})]})}),T.jsx("hr",{})]}):T.jsx(T.Fragment,{})},gme=({filter:e,setFilter:t})=>T.jsxs("div",{className:"libfilter",children:[T.jsx(yJ,{fontSize:"inherit"}),T.jsx("input",{type:"text",placeholder:"Filter",value:e,onChange:n=>{t(n.target.value)}}),e&&T.jsx(cw,{fontSize:"inherit",onClick:()=>{t("")}})]}),yme=({children:e})=>{const[t,n]=q.useState(""),r=Wt(),[a,l]=q.useState(!0),[u,d]=q.useState(!0),[h,m]=q.useState(!0),[y,v]=q.useState({installed:[],available:[],active:[]}),[S,w]=q.useState(!1),{lib:A}=yo(),E=$=>{$&&(r.worker===void 0||!r.worker.is_open||A?.get_available_modules().then(Z=>{v(Z)}))};if(!r.worker)return T.jsx(T.Fragment,{});const k=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),R=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),D=z.useCallback($=>{w(!1),A?.remove_lib($.name)},[A]),M=z.useCallback(($,Z)=>{w(!1),A?.add_lib($.name,Z)},[A]),I=z.useCallback($=>$.filter(Z=>Z.name.toLowerCase().includes(t.toLowerCase())||Z.description.toLowerCase().includes(t.toLowerCase())),[t]),L=I(y.available),P=I(y.installed),G=I(y.active);return T.jsxs(Iu,{title:"Manage Library",trigger:e,description:"Add or remove libraries to the current worker.",onOpenChange:E,open:S,setOpen:w,children:[T.jsx("input",{className:"filter-input styledinput",type:"text",placeholder:"Filter modules...",value:t,onChange:$=>n($.target.value)}),T.jsxs("div",{className:"packagelist",style:{maxHeight:"70%",overflow:"auto"},children:[P.length>0&&T.jsx("h3",{onClick:()=>{m(!h)},children:"Installed"}),h&&P.map($=>T.jsx(I1e,{availableModule:$,on_add:k},$.name+$.source)),L.length>0&&T.jsx("h3",{onClick:()=>{d(!u)},children:"Available"}),u&&L.map($=>T.jsx(z1e,{availableModule:$,on_add:R},$.name+$.source)),G.length>0&&T.jsx("h3",{onClick:()=>{l(!a)},children:"Active"}),a&&G.map($=>T.jsx(D1e,{availableModule:$,on_remove:D,on_update:M},$.name+$.source))]})]})},yR=({availableModule:e})=>T.jsxs("div",{className:"module-links",children:[e.homepage&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.homepage,target:"_blank",rel:"noopener noreferrer",children:"Homepage"})}),e.source&&e.homepage&&" | ",e.source&&T.jsx(T.Fragment,{children:T.jsx("a",{href:e.source,target:"_blank",rel:"noopener noreferrer",children:"Source"})})]});function JSe(){}function QSe(){}function vme(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const bme=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,xme=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Sme={};function eP(e,t){return(Sme.jsx?xme:bme).test(e)}const wme=/[ \t\n\f\r]/g;function Eme(e){return typeof e=="object"?e.type==="text"?tP(e.value):!1:tP(e)}function tP(e){return e.replace(wme,"")===""}class Yv{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Yv.prototype.normal={},Yv.prototype.property={},Yv.prototype.space=void 0;function nP(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Yv(n,r,t)}function vR(e){return e.toLowerCase()}class ca{constructor(t,n){this.attribute=n,this.property=t}}ca.prototype.attribute="",ca.prototype.booleanish=!1,ca.prototype.boolean=!1,ca.prototype.commaOrSpaceSeparated=!1,ca.prototype.commaSeparated=!1,ca.prototype.defined=!1,ca.prototype.mustUseProperty=!1,ca.prototype.number=!1,ca.prototype.overloadedBoolean=!1,ca.prototype.property="",ca.prototype.spaceSeparated=!1,ca.prototype.space=void 0;let Cme=0;const _t=gh(),xr=gh(),bR=gh(),Ve=gh(),_n=gh(),Ym=gh(),Fa=gh();function gh(){return 2**++Cme}const xR=Object.freeze(Object.defineProperty({__proto__:null,boolean:_t,booleanish:xr,commaOrSpaceSeparated:Fa,commaSeparated:Ym,number:Ve,overloadedBoolean:bR,spaceSeparated:_n},Symbol.toStringTag,{value:"Module"})),SR=Object.keys(xR);class wR extends ca{constructor(t,n,r,a){let l=-1;if(super(t,n),rP(this,"space",a),typeof r=="number")for(;++l<SR.length;){const u=SR[l];rP(this,SR[l],(r&xR[u])===xR[u])}}}wR.prototype.defined=!0;function rP(e,t,n){n&&(e[t]=n)}function Zm(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const l=new wR(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(l.mustUseProperty=!0),t[r]=l,n[vR(r)]=r,n[vR(l.attribute)]=r}return new Yv(t,n,e.space)}const oP=Zm({properties:{ariaActiveDescendant:null,ariaAtomic:xr,ariaAutoComplete:null,ariaBusy:xr,ariaChecked:xr,ariaColCount:Ve,ariaColIndex:Ve,ariaColSpan:Ve,ariaControls:_n,ariaCurrent:null,ariaDescribedBy:_n,ariaDetails:null,ariaDisabled:xr,ariaDropEffect:_n,ariaErrorMessage:null,ariaExpanded:xr,ariaFlowTo:_n,ariaGrabbed:xr,ariaHasPopup:null,ariaHidden:xr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:_n,ariaLevel:Ve,ariaLive:null,ariaModal:xr,ariaMultiLine:xr,ariaMultiSelectable:xr,ariaOrientation:null,ariaOwns:_n,ariaPlaceholder:null,ariaPosInSet:Ve,ariaPressed:xr,ariaReadOnly:xr,ariaRelevant:null,ariaRequired:xr,ariaRoleDescription:_n,ariaRowCount:Ve,ariaRowIndex:Ve,ariaRowSpan:Ve,ariaSelected:xr,ariaSetSize:Ve,ariaSort:null,ariaValueMax:Ve,ariaValueMin:Ve,ariaValueNow:Ve,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function aP(e,t){return t in e?e[t]:t}function iP(e,t){return aP(e,t.toLowerCase())}const _me=Zm({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ym,acceptCharset:_n,accessKey:_n,action:null,allow:null,allowFullScreen:_t,allowPaymentRequest:_t,allowUserMedia:_t,alt:null,as:null,async:_t,autoCapitalize:null,autoComplete:_n,autoFocus:_t,autoPlay:_t,blocking:_n,capture:null,charSet:null,checked:_t,cite:null,className:_n,cols:Ve,colSpan:null,content:null,contentEditable:xr,controls:_t,controlsList:_n,coords:Ve|Ym,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_t,defer:_t,dir:null,dirName:null,disabled:_t,download:bR,draggable:xr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_t,formTarget:null,headers:_n,height:Ve,hidden:bR,high:Ve,href:null,hrefLang:null,htmlFor:_n,httpEquiv:_n,id:null,imageSizes:null,imageSrcSet:null,inert:_t,inputMode:null,integrity:null,is:null,isMap:_t,itemId:null,itemProp:_n,itemRef:_n,itemScope:_t,itemType:_n,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_t,low:Ve,manifest:null,max:null,maxLength:Ve,media:null,method:null,min:null,minLength:Ve,multiple:_t,muted:_t,name:null,nonce:null,noModule:_t,noValidate:_t,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_t,optimum:Ve,pattern:null,ping:_n,placeholder:null,playsInline:_t,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_t,referrerPolicy:null,rel:_n,required:_t,reversed:_t,rows:Ve,rowSpan:Ve,sandbox:_n,scope:null,scoped:_t,seamless:_t,selected:_t,shadowRootClonable:_t,shadowRootDelegatesFocus:_t,shadowRootMode:null,shape:null,size:Ve,sizes:null,slot:null,span:Ve,spellCheck:xr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ve,step:null,style:null,tabIndex:Ve,target:null,title:null,translate:null,type:null,typeMustMatch:_t,useMap:null,value:xr,width:Ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:_n,axis:null,background:null,bgColor:null,border:Ve,borderColor:null,bottomMargin:Ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_t,declare:_t,event:null,face:null,frame:null,frameBorder:null,hSpace:Ve,leftMargin:Ve,link:null,longDesc:null,lowSrc:null,marginHeight:Ve,marginWidth:Ve,noResize:_t,noHref:_t,noShade:_t,noWrap:_t,object:null,profile:null,prompt:null,rev:null,rightMargin:Ve,rules:null,scheme:null,scrolling:xr,standby:null,summary:null,text:null,topMargin:Ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ve,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_t,disableRemotePlayback:_t,prefix:null,property:null,results:Ve,security:null,unselectable:null},space:"html",transform:iP}),Ame=Zm({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Fa,accentHeight:Ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ve,amplitude:Ve,arabicForm:null,ascent:Ve,attributeName:null,attributeType:null,azimuth:Ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ve,by:null,calcMode:null,capHeight:Ve,className:_n,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ve,diffuseConstant:Ve,direction:null,display:null,dur:null,divisor:Ve,dominantBaseline:null,download:_t,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ve,enableBackground:null,end:null,event:null,exponent:Ve,externalResourcesRequired:null,fill:null,fillOpacity:Ve,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ym,g2:Ym,glyphName:Ym,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ve,horizOriginX:Ve,horizOriginY:Ve,id:null,ideographic:Ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ve,k:Ve,k1:Ve,k2:Ve,k3:Ve,k4:Ve,kernelMatrix:Fa,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ve,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ve,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ve,overlineThickness:Ve,paintOrder:null,panose1:null,path:null,pathLength:Ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:_n,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ve,pointsAtY:Ve,pointsAtZ:Ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Fa,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Fa,rev:Fa,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Fa,requiredFeatures:Fa,requiredFonts:Fa,requiredFormats:Fa,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ve,specularExponent:Ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ve,strikethroughThickness:Ve,string:null,stroke:null,strokeDashArray:Fa,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ve,strokeOpacity:Ve,strokeWidth:null,style:null,surfaceScale:Ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Fa,tabIndex:Ve,tableValues:null,target:null,targetX:Ve,targetY:Ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Fa,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ve,underlineThickness:Ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ve,values:null,vAlphabetic:Ve,vMathematical:Ve,vectorEffect:null,vHanging:Ve,vIdeographic:Ve,version:null,vertAdvY:Ve,vertOriginX:Ve,vertOriginY:Ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:aP}),lP=Zm({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),sP=Zm({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:iP}),uP=Zm({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Tme={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},kme=/[A-Z]/g,cP=/-[a-z]/g,Rme=/^data[-\w.:]+$/i;function Ome(e,t){const n=vR(t);let r=t,a=ca;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Rme.test(t)){if(t.charAt(4)==="-"){const l=t.slice(5).replace(cP,Nme);r="data"+l.charAt(0).toUpperCase()+l.slice(1)}else{const l=t.slice(4);if(!cP.test(l)){let u=l.replace(kme,Mme);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=wR}return new a(r,t)}function Mme(e){return"-"+e.toLowerCase()}function Nme(e){return e.charAt(1).toUpperCase()}const Dme=nP([oP,_me,lP,sP,uP],"html"),ER=nP([oP,Ame,lP,sP,uP],"svg");function Ime(e){return e.join(" ").trim()}var Wm={},CR,fP;function zme(){if(fP)return CR;fP=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,h=`
|
|
1086
1086
|
`,m="/",y="*",v="",S="comment",w="declaration";CR=function(E,k){if(typeof E!="string")throw new TypeError("First argument must be a string");if(!E)return[];k=k||{};var R=1,D=1;function M(ae){var U=ae.match(t);U&&(R+=U.length);var te=ae.lastIndexOf(h);D=~te?ae.length-te:D+ae.length}function I(){var ae={line:R,column:D};return function(U){return U.position=new L(ae),$(),U}}function L(ae){this.start=ae,this.end={line:R,column:D},this.source=k.source}L.prototype.content=E;function P(ae){var U=new Error(k.source+":"+R+":"+D+": "+ae);if(U.reason=ae,U.filename=k.source,U.line=R,U.column=D,U.source=E,!k.silent)throw U}function G(ae){var U=ae.exec(E);if(U){var te=U[0];return M(te),E=E.slice(te.length),U}}function $(){G(n)}function Z(ae){var U;for(ae=ae||[];U=j();)U!==!1&&ae.push(U);return ae}function j(){var ae=I();if(!(m!=E.charAt(0)||y!=E.charAt(1))){for(var U=2;v!=E.charAt(U)&&(y!=E.charAt(U)||m!=E.charAt(U+1));)++U;if(U+=2,v===E.charAt(U-1))return P("End of comment missing");var te=E.slice(2,U-2);return D+=2,M(te),E=E.slice(U),D+=2,ae({type:S,comment:te})}}function X(){var ae=I(),U=G(r);if(U){if(j(),!G(a))return P("property missing ':'");var te=G(l),V=ae({type:w,property:A(U[0].replace(e,v)),value:te?A(te[0].replace(e,v)):v});return G(u),V}}function ee(){var ae=[];Z(ae);for(var U;U=X();)U!==!1&&(ae.push(U),Z(ae));return ae}return $(),ee()};function A(E){return E?E.replace(d,v):v}return CR}var dP;function jme(){if(dP)return Wm;dP=1;var e=Wm&&Wm.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Wm,"__esModule",{value:!0}),Wm.default=n;var t=e(zme());function n(r,a){var l=null;if(!r||typeof r!="string")return l;var u=(0,t.default)(r),d=typeof a=="function";return u.forEach(function(h){if(h.type==="declaration"){var m=h.property,y=h.value;d?a(m,y,h):y&&(l=l||{},l[m]=y)}}),l}return Wm}var Zv={},hP;function Bme(){if(hP)return Zv;hP=1,Object.defineProperty(Zv,"__esModule",{value:!0}),Zv.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(m){return!m||n.test(m)||e.test(m)},u=function(m,y){return y.toUpperCase()},d=function(m,y){return"".concat(y,"-")},h=function(m,y){return y===void 0&&(y={}),l(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(a,d):m=m.replace(r,d),m.replace(t,u))};return Zv.camelCase=h,Zv}var Wv,pP;function Lme(){if(pP)return Wv;pP=1;var e=Wv&&Wv.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(jme()),n=Bme();function r(a,l){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(d,h){d&&h&&(u[(0,n.camelCase)(d,l)]=h)}),u}return r.default=r,Wv=r,Wv}var Pme=Lme();const Hme=Xx(Pme),mP=gP("end"),_R=gP("start");function gP(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Vme(e){const t=_R(e),n=mP(e);if(t&&n)return{start:t,end:n}}function qv(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yP(e.position):"start"in e||"end"in e?yP(e):"line"in e||"column"in e?AR(e):""}function AR(e){return vP(e&&e.line)+":"+vP(e&&e.column)}function yP(e){return AR(e&&e.start)+"-"+AR(e&&e.end)}function vP(e){return e&&typeof e=="number"?e:1}class vo extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let a="",l={},u=!1;if(n&&("line"in n&&"column"in n?l={place:n}:"start"in n&&"end"in n?l={place:n}:"type"in n?l={ancestors:[n],place:n.position}:l={...n}),typeof t=="string"?a=t:!l.cause&&t&&(u=!0,a=t.message,l.cause=t),!l.ruleId&&!l.source&&typeof r=="string"){const h=r.indexOf(":");h===-1?l.ruleId=r:(l.source=r.slice(0,h),l.ruleId=r.slice(h+1))}if(!l.place&&l.ancestors&&l.ancestors){const h=l.ancestors[l.ancestors.length-1];h&&(l.place=h.position)}const d=l.place&&"start"in l.place?l.place.start:l.place;this.ancestors=l.ancestors||void 0,this.cause=l.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file,this.message=a,this.line=d?d.line:void 0,this.name=qv(l.place)||"1:1",this.place=l.place||void 0,this.reason=this.message,this.ruleId=l.ruleId||void 0,this.source=l.source||void 0,this.stack=u&&l.cause&&typeof l.cause.stack=="string"?l.cause.stack:"",this.actual,this.expected,this.note,this.url}}vo.prototype.file="",vo.prototype.name="",vo.prototype.reason="",vo.prototype.message="",vo.prototype.stack="",vo.prototype.column=void 0,vo.prototype.line=void 0,vo.prototype.ancestors=void 0,vo.prototype.cause=void 0,vo.prototype.fatal=void 0,vo.prototype.place=void 0,vo.prototype.ruleId=void 0,vo.prototype.source=void 0;const TR={}.hasOwnProperty,Fme=new Map,Gme=/[A-Z]/g,Ume=new Set(["table","tbody","thead","tfoot","tr"]),$me=new Set(["td","th"]),bP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Xme(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ege(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Kme(n,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ER:Dme,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},l=xP(a,e,void 0);return l&&typeof l!="string"?l:a.create(e,a.Fragment,{children:l||void 0},void 0)}function xP(e,t,n){if(t.type==="element")return Yme(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Zme(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return qme(e,t,n);if(t.type==="mdxjsEsm")return Wme(e,t);if(t.type==="root")return Jme(e,t,n);if(t.type==="text")return Qme(e,t)}function Yme(e,t,n){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=ER,e.schema=a),e.ancestors.push(t);const l=wP(e,t.tagName,!1),u=tge(e,t);let d=RR(e,t);return Ume.has(t.tagName)&&(d=d.filter(function(h){return typeof h=="string"?!Eme(h):!0})),SP(e,u,l,t),kR(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function Zme(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Jv(e,t.position)}function Wme(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Jv(e,t.position)}function qme(e,t,n){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=ER,e.schema=a),e.ancestors.push(t);const l=t.name===null?e.Fragment:wP(e,t.name,!0),u=nge(e,t),d=RR(e,t);return SP(e,u,l,t),kR(u,d),e.ancestors.pop(),e.schema=r,e.create(t,l,u,n)}function Jme(e,t,n){const r={};return kR(r,RR(e,t)),e.create(t,e.Fragment,r,n)}function Qme(e,t){return t.value}function SP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function kR(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Kme(e,t,n){return r;function r(a,l,u,d){const m=Array.isArray(u.children)?n:t;return d?m(l,u,d):m(l,u)}}function ege(e,t){return n;function n(r,a,l,u){const d=Array.isArray(l.children),h=_R(r);return t(a,l,u,d,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function tge(e,t){const n={};let r,a;for(a in t.properties)if(a!=="children"&&TR.call(t.properties,a)){const l=rge(e,a,t.properties[a]);if(l){const[u,d]=l;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&$me.has(t.tagName)?r=d:n[u]=d}}if(r){const l=n.style||(n.style={});l[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function nge(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const d=u.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else Jv(e,t.position);else{const a=r.name;let l;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const d=r.value.data.estree.body[0];d.type,l=e.evaluater.evaluateExpression(d.expression)}else Jv(e,t.position);else l=r.value===null?!0:r.value;n[a]=l}return n}function RR(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:Fme;for(;++r<t.children.length;){const l=t.children[r];let u;if(e.passKeys){const h=l.type==="element"?l.tagName:l.type==="mdxJsxFlowElement"||l.type==="mdxJsxTextElement"?l.name:void 0;if(h){const m=a.get(h)||0;u=h+"-"+m,a.set(h,m+1)}}const d=xP(e,l,u);d!==void 0&&n.push(d)}return n}function rge(e,t,n){const r=Ome(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?vme(n):Ime(n)),r.property==="style"){let a=typeof n=="object"?n:oge(e,String(n));return e.stylePropertyNameCase==="css"&&(a=age(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&r.space?Tme[r.property]||r.property:r.attribute,n]}}function oge(e,t){try{return Hme(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,a=new vo("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=bP+"#cannot-parse-style-attribute",a}}function wP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let l=-1,u;for(;++l<a.length;){const d=eP(a[l])?{type:"Identifier",name:a[l]}:{type:"Literal",value:a[l]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(l&&d.type==="Literal"),optional:!1}:d}r=u}else r=eP(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return TR.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);Jv(e)}function Jv(e,t){const n=new vo("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=bP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function age(e){const t={};let n;for(n in e)TR.call(e,n)&&(t[ige(n)]=e[n]);return t}function ige(e){let t=e.replace(Gme,lge);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function lge(e){return"-"+e.toLowerCase()}const OR={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},sge={};function MR(e,t){const n=sge,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return EP(e,r,a)}function EP(e,t,n){if(uge(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return CP(e.children,t,n)}return Array.isArray(e)?CP(e,t,n):""}function CP(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=EP(e[a],t,n);return r.join("")}function uge(e){return!!(e&&typeof e=="object")}const _P=document.createElement("i");function NR(e){const t="&"+e+";";_P.innerHTML=t;const n=_P.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ga(e,t,n,r){const a=e.length;let l=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,r.length<1e4)u=Array.from(r),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);l<r.length;)u=r.slice(l,l+1e4),u.unshift(t,0),e.splice(...u),l+=1e4,t+=1e4}function yi(e,t){return e.length>0?(Ga(e,e.length,0,t),e):t}const AP={}.hasOwnProperty;function TP(e){const t={};let n=-1;for(;++n<e.length;)cge(t,e[n]);return t}function cge(e,t){let n;for(n in t){const a=(AP.call(e,n)?e[n]:void 0)||(e[n]={}),l=t[n];let u;if(l)for(u in l){AP.call(a,u)||(a[u]=[]);const d=l[u];fge(a[u],Array.isArray(d)?d:d?[d]:[])}}}function fge(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ga(e,0,0,r)}function kP(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Rl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Fo=_f(/[A-Za-z]/),bo=_f(/[\dA-Za-z]/),dge=_f(/[#-'*+\--9=?A-Z^-~]/);function W2(e){return e!==null&&(e<32||e===127)}const DR=_f(/\d/),hge=_f(/[\dA-Fa-f]/),pge=_f(/[!-/:-@[-`{-~]/);function ft(e){return e!==null&&e<-2}function xn(e){return e!==null&&(e<0||e===32)}function jt(e){return e===-2||e===-1||e===32}const q2=_f(new RegExp("\\p{P}|\\p{S}","u")),yh=_f(/\s/);function _f(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function qm(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const l=e.charCodeAt(n);let u="";if(l===37&&bo(e.charCodeAt(n+1))&&bo(e.charCodeAt(n+2)))a=2;else if(l<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(l))||(u=String.fromCharCode(l));else if(l>55295&&l<57344){const d=e.charCodeAt(n+1);l<56320&&d>56319&&d<57344?(u=String.fromCharCode(l,d),a=1):u="�"}else u=String.fromCharCode(l);u&&(t.push(e.slice(r,n),encodeURIComponent(u)),r=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Ut(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let l=0;return u;function u(h){return jt(h)?(e.enter(n),d(h)):t(h)}function d(h){return jt(h)&&l++<a?(e.consume(h),d):(e.exit(n),t(h))}}const mge={tokenize:gge};function gge(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let n;return t;function r(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Ut(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),l(d)}function l(d){const h=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=h),n=h,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return ft(d)?(e.consume(d),e.exit("chunkText"),l):(e.consume(d),u)}}const yge={tokenize:vge},RP={tokenize:bge};function vge(e){const t=this,n=[];let r=0,a,l,u;return d;function d(M){if(r<n.length){const I=n[r];return t.containerState=I[1],e.attempt(I[0].continuation,h,m)(M)}return m(M)}function h(M){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&D();const I=t.events.length;let L=I,P;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){P=t.events[L][1].end;break}R(r);let G=I;for(;G<t.events.length;)t.events[G][1].end={...P},G++;return Ga(t.events,L+1,0,t.events.slice(I)),t.events.length=G,m(M)}return d(M)}function m(M){if(r===n.length){if(!a)return S(M);if(a.currentConstruct&&a.currentConstruct.concrete)return A(M);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(RP,y,v)(M)}function y(M){return a&&D(),R(r),S(M)}function v(M){return t.parser.lazy[t.now().line]=r!==n.length,u=t.now().offset,A(M)}function S(M){return t.containerState={},e.attempt(RP,w,A)(M)}function w(M){return r++,n.push([t.currentConstruct,t.containerState]),S(M)}function A(M){if(M===null){a&&D(),R(0),e.consume(M);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:l}),E(M)}function E(M){if(M===null){k(e.exit("chunkFlow"),!0),R(0),e.consume(M);return}return ft(M)?(e.consume(M),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,d):(e.consume(M),E)}function k(M,I){const L=t.sliceStream(M);if(I&&L.push(null),M.previous=l,l&&(l.next=M),l=M,a.defineSkip(M.start),a.write(L),t.parser.lazy[M.start.line]){let P=a.events.length;for(;P--;)if(a.events[P][1].start.offset<u&&(!a.events[P][1].end||a.events[P][1].end.offset>u))return;const G=t.events.length;let $=G,Z,j;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(Z){j=t.events[$][1].end;break}Z=!0}for(R(r),P=G;P<t.events.length;)t.events[P][1].end={...j},P++;Ga(t.events,$+1,0,t.events.slice(G)),t.events.length=P}}function R(M){let I=n.length;for(;I-- >M;){const L=n[I];t.containerState=L[1],L[0].exit.call(t,e)}n.length=M}function D(){a.write([null]),l=void 0,a=void 0,t.containerState._closeFlow=void 0}}function bge(e,t,n){return Ut(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Jm(e){if(e===null||xn(e)||yh(e))return 1;if(q2(e))return 2}function J2(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const l=e[a].resolveAll;l&&!r.includes(l)&&(t=l(t,n),r.push(l))}return t}const IR={name:"attention",resolveAll:xge,tokenize:Sge};function xge(e,t){let n=-1,r,a,l,u,d,h,m,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;h=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const v={...e[r][1].end},S={...e[n][1].start};OP(v,-h),OP(S,h),u={type:h>1?"strongSequence":"emphasisSequence",start:v,end:{...e[r][1].end}},d={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:S},l={type:h>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},a={type:h>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[r][1].end={...u.start},e[n][1].start={...d.end},m=[],e[r][1].end.offset-e[r][1].start.offset&&(m=yi(m,[["enter",e[r][1],t],["exit",e[r][1],t]])),m=yi(m,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",l,t]]),m=yi(m,J2(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),m=yi(m,[["exit",l,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,m=yi(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,Ga(e,r-1,n-r+3,m),n=r+m.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Sge(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Jm(r);let l;return u;function u(h){return l=h,e.enter("attentionSequence"),d(h)}function d(h){if(h===l)return e.consume(h),d;const m=e.exit("attentionSequence"),y=Jm(h),v=!y||y===2&&a||n.includes(h),S=!a||a===2&&y||n.includes(r);return m._open=!!(l===42?v:v&&(a||!S)),m._close=!!(l===42?S:S&&(y||!v)),t(h)}}function OP(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const wge={name:"autolink",tokenize:Ege};function Ege(e,t,n){let r=0;return a;function a(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),l}function l(w){return Fo(w)?(e.consume(w),u):w===64?n(w):m(w)}function u(w){return w===43||w===45||w===46||bo(w)?(r=1,d(w)):m(w)}function d(w){return w===58?(e.consume(w),r=0,h):(w===43||w===45||w===46||bo(w))&&r++<32?(e.consume(w),d):(r=0,m(w))}function h(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||W2(w)?n(w):(e.consume(w),h)}function m(w){return w===64?(e.consume(w),y):dge(w)?(e.consume(w),m):n(w)}function y(w){return bo(w)?v(w):n(w)}function v(w){return w===46?(e.consume(w),r=0,y):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):S(w)}function S(w){if((w===45||bo(w))&&r++<63){const A=w===45?S:v;return e.consume(w),A}return n(w)}}const Qv={partial:!0,tokenize:Cge};function Cge(e,t,n){return r;function r(l){return jt(l)?Ut(e,a,"linePrefix")(l):a(l)}function a(l){return l===null||ft(l)?t(l):n(l)}}const MP={continuation:{tokenize:Age},exit:Tge,name:"blockQuote",tokenize:_ge};function _ge(e,t,n){const r=this;return a;function a(u){if(u===62){const d=r.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),l}return n(u)}function l(u){return jt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function Age(e,t,n){const r=this;return a;function a(u){return jt(u)?Ut(e,l,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):l(u)}function l(u){return e.attempt(MP,t,n)(u)}}function Tge(e){e.exit("blockQuote")}const NP={name:"characterEscape",tokenize:kge};function kge(e,t,n){return r;function r(l){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(l),e.exit("escapeMarker"),a}function a(l){return pge(l)?(e.enter("characterEscapeValue"),e.consume(l),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(l)}}const DP={name:"characterReference",tokenize:Rge};function Rge(e,t,n){const r=this;let a=0,l,u;return d;function d(v){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),h}function h(v){return v===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(v),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),l=31,u=bo,y(v))}function m(v){return v===88||v===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(v),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),l=6,u=hge,y):(e.enter("characterReferenceValue"),l=7,u=DR,y(v))}function y(v){if(v===59&&a){const S=e.exit("characterReferenceValue");return u===bo&&!NR(r.sliceSerialize(S))?n(v):(e.enter("characterReferenceMarker"),e.consume(v),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(v)&&a++<l?(e.consume(v),y):n(v)}}const IP={partial:!0,tokenize:Mge},zP={concrete:!0,name:"codeFenced",tokenize:Oge};function Oge(e,t,n){const r=this,a={partial:!0,tokenize:L};let l=0,u=0,d;return h;function h(P){return m(P)}function m(P){const G=r.events[r.events.length-1];return l=G&&G[1].type==="linePrefix"?G[2].sliceSerialize(G[1],!0).length:0,d=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(P)}function y(P){return P===d?(u++,e.consume(P),y):u<3?n(P):(e.exit("codeFencedFenceSequence"),jt(P)?Ut(e,v,"whitespace")(P):v(P))}function v(P){return P===null||ft(P)?(e.exit("codeFencedFence"),r.interrupt?t(P):e.check(IP,E,I)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(P))}function S(P){return P===null||ft(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),v(P)):jt(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ut(e,w,"whitespace")(P)):P===96&&P===d?n(P):(e.consume(P),S)}function w(P){return P===null||ft(P)?v(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),A(P))}function A(P){return P===null||ft(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),v(P)):P===96&&P===d?n(P):(e.consume(P),A)}function E(P){return e.attempt(a,I,k)(P)}function k(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),R}function R(P){return l>0&&jt(P)?Ut(e,D,"linePrefix",l+1)(P):D(P)}function D(P){return P===null||ft(P)?e.check(IP,E,I)(P):(e.enter("codeFlowValue"),M(P))}function M(P){return P===null||ft(P)?(e.exit("codeFlowValue"),D(P)):(e.consume(P),M)}function I(P){return e.exit("codeFenced"),t(P)}function L(P,G,$){let Z=0;return j;function j(te){return P.enter("lineEnding"),P.consume(te),P.exit("lineEnding"),X}function X(te){return P.enter("codeFencedFence"),jt(te)?Ut(P,ee,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(te):ee(te)}function ee(te){return te===d?(P.enter("codeFencedFenceSequence"),ae(te)):$(te)}function ae(te){return te===d?(Z++,P.consume(te),ae):Z>=u?(P.exit("codeFencedFenceSequence"),jt(te)?Ut(P,U,"whitespace")(te):U(te)):$(te)}function U(te){return te===null||ft(te)?(P.exit("codeFencedFence"),G(te)):$(te)}}}function Mge(e,t,n){const r=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}const zR={name:"codeIndented",tokenize:Dge},Nge={partial:!0,tokenize:Ige};function Dge(e,t,n){const r=this;return a;function a(m){return e.enter("codeIndented"),Ut(e,l,"linePrefix",5)(m)}function l(m){const y=r.events[r.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?u(m):n(m)}function u(m){return m===null?h(m):ft(m)?e.attempt(Nge,u,h)(m):(e.enter("codeFlowValue"),d(m))}function d(m){return m===null||ft(m)?(e.exit("codeFlowValue"),u(m)):(e.consume(m),d)}function h(m){return e.exit("codeIndented"),t(m)}}function Ige(e,t,n){const r=this;return a;function a(u){return r.parser.lazy[r.now().line]?n(u):ft(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):Ut(e,l,"linePrefix",5)(u)}function l(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):ft(u)?a(u):n(u)}}const zge={name:"codeText",previous:Bge,resolve:jge,tokenize:Lge};function jge(e){let t=e.length-4,n=3,r,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function Bge(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Lge(e,t,n){let r=0,a,l;return u;function u(v){return e.enter("codeText"),e.enter("codeTextSequence"),d(v)}function d(v){return v===96?(e.consume(v),r++,d):(e.exit("codeTextSequence"),h(v))}function h(v){return v===null?n(v):v===32?(e.enter("space"),e.consume(v),e.exit("space"),h):v===96?(l=e.enter("codeTextSequence"),a=0,y(v)):ft(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),h):(e.enter("codeTextData"),m(v))}function m(v){return v===null||v===32||v===96||ft(v)?(e.exit("codeTextData"),h(v)):(e.consume(v),m)}function y(v){return v===96?(e.consume(v),a++,y):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(v)):(l.type="codeTextData",m(v))}}class Pge{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const a=n||0;this.setCursor(Math.trunc(t));const l=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&Kv(this.left,r),l.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Kv(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Kv(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Kv(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Kv(this.left,n.reverse())}}}function Kv(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function jP(e){const t={};let n=-1,r,a,l,u,d,h,m;const y=new Pge(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(r=y.get(n),n&&r[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(h=r[1]._tokenizer.events,l=0,l<h.length&&h[l][1].type==="lineEndingBlank"&&(l+=2),l<h.length&&h[l][1].type==="content"))for(;++l<h.length&&h[l][1].type!=="content";)h[l][1].type==="chunkText"&&(h[l][1]._isInFirstContentOfListItem=!0,l++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Hge(y,n)),n=t[n],m=!0);else if(r[1]._container){for(l=n,a=void 0;l--;)if(u=y.get(l),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(y.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=l);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(r[1].end={...y.get(a)[1].start},d=y.slice(a,n),d.unshift(r),y.splice(a,n-a+1,d))}}return Ga(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function Hge(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const l=[];let u=n._tokenizer;u||(u=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,h=[],m={};let y,v,S=-1,w=n,A=0,E=0;const k=[E];for(;w;){for(;e.get(++a)[1]!==w;);l.push(a),w._tokenizer||(y=r.sliceStream(w),w.next||y.push(null),v&&u.defineSkip(w.start),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(y),w._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),v=w,w=w.next}for(w=n;++S<d.length;)d[S][0]==="exit"&&d[S-1][0]==="enter"&&d[S][1].type===d[S-1][1].type&&d[S][1].start.line!==d[S][1].end.line&&(E=S+1,k.push(E),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(u.events=[],w?(w._tokenizer=void 0,w.previous=void 0):k.pop(),S=k.length;S--;){const R=d.slice(k[S],k[S+1]),D=l.pop();h.push([D,D+R.length-1]),e.splice(D,2,R)}for(h.reverse(),S=-1;++S<h.length;)m[A+h[S][0]]=A+h[S][1],A+=h[S][1]-h[S][0]-1;return m}const Vge={resolve:Gge,tokenize:Uge},Fge={partial:!0,tokenize:$ge};function Gge(e){return jP(e),e}function Uge(e,t){let n;return r;function r(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(d)}function a(d){return d===null?l(d):ft(d)?e.check(Fge,u,l)(d):(e.consume(d),a)}function l(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function u(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function $ge(e,t,n){const r=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Ut(e,l,"linePrefix")}function l(u){if(u===null||ft(u))return n(u);const d=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(r.parser.constructs.flow,n,t)(u)}}function BP(e,t,n,r,a,l,u,d,h){const m=h||Number.POSITIVE_INFINITY;let y=0;return v;function v(R){return R===60?(e.enter(r),e.enter(a),e.enter(l),e.consume(R),e.exit(l),S):R===null||R===32||R===41||W2(R)?n(R):(e.enter(r),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),E(R))}function S(R){return R===62?(e.enter(l),e.consume(R),e.exit(l),e.exit(a),e.exit(r),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),w(R))}function w(R){return R===62?(e.exit("chunkString"),e.exit(d),S(R)):R===null||R===60||ft(R)?n(R):(e.consume(R),R===92?A:w)}function A(R){return R===60||R===62||R===92?(e.consume(R),w):w(R)}function E(R){return!y&&(R===null||R===41||xn(R))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(r),t(R)):y<m&&R===40?(e.consume(R),y++,E):R===41?(e.consume(R),y--,E):R===null||R===32||R===40||W2(R)?n(R):(e.consume(R),R===92?k:E)}function k(R){return R===40||R===41||R===92?(e.consume(R),E):E(R)}}function LP(e,t,n,r,a,l){const u=this;let d=0,h;return m;function m(w){return e.enter(r),e.enter(a),e.consume(w),e.exit(a),e.enter(l),y}function y(w){return d>999||w===null||w===91||w===93&&!h||w===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?n(w):w===93?(e.exit(l),e.enter(a),e.consume(w),e.exit(a),e.exit(r),t):ft(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),v(w))}function v(w){return w===null||w===91||w===93||ft(w)||d++>999?(e.exit("chunkString"),y(w)):(e.consume(w),h||(h=!jt(w)),w===92?S:v)}function S(w){return w===91||w===92||w===93?(e.consume(w),d++,v):v(w)}}function PP(e,t,n,r,a,l){let u;return d;function d(S){return S===34||S===39||S===40?(e.enter(r),e.enter(a),e.consume(S),e.exit(a),u=S===40?41:S,h):n(S)}function h(S){return S===u?(e.enter(a),e.consume(S),e.exit(a),e.exit(r),t):(e.enter(l),m(S))}function m(S){return S===u?(e.exit(l),h(u)):S===null?n(S):ft(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),Ut(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(S))}function y(S){return S===u||S===null||ft(S)?(e.exit("chunkString"),m(S)):(e.consume(S),S===92?v:y)}function v(S){return S===u||S===92?(e.consume(S),y):y(S)}}function eb(e,t){let n;return r;function r(a){return ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r):jt(a)?Ut(e,r,n?"linePrefix":"lineSuffix")(a):t(a)}}const Xge={name:"definition",tokenize:Zge},Yge={partial:!0,tokenize:Wge};function Zge(e,t,n){const r=this;let a;return l;function l(w){return e.enter("definition"),u(w)}function u(w){return LP.call(r,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function d(w){return a=Rl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),h):n(w)}function h(w){return xn(w)?eb(e,m)(w):m(w)}function m(w){return BP(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function y(w){return e.attempt(Yge,v,v)(w)}function v(w){return jt(w)?Ut(e,S,"whitespace")(w):S(w)}function S(w){return w===null||ft(w)?(e.exit("definition"),r.parser.defined.push(a),t(w)):n(w)}}function Wge(e,t,n){return r;function r(d){return xn(d)?eb(e,a)(d):n(d)}function a(d){return PP(e,l,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function l(d){return jt(d)?Ut(e,u,"whitespace")(d):u(d)}function u(d){return d===null||ft(d)?t(d):n(d)}}const qge={name:"hardBreakEscape",tokenize:Jge};function Jge(e,t,n){return r;function r(l){return e.enter("hardBreakEscape"),e.consume(l),a}function a(l){return ft(l)?(e.exit("hardBreakEscape"),t(l)):n(l)}}const Qge={name:"headingAtx",resolve:Kge,tokenize:eye};function Kge(e,t){let n=e.length-2,r=3,a,l;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(a={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},l={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ga(e,r,n-r+1,[["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t]])),e}function eye(e,t,n){let r=0;return a;function a(y){return e.enter("atxHeading"),l(y)}function l(y){return e.enter("atxHeadingSequence"),u(y)}function u(y){return y===35&&r++<6?(e.consume(y),u):y===null||xn(y)?(e.exit("atxHeadingSequence"),d(y)):n(y)}function d(y){return y===35?(e.enter("atxHeadingSequence"),h(y)):y===null||ft(y)?(e.exit("atxHeading"),t(y)):jt(y)?Ut(e,d,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function h(y){return y===35?(e.consume(y),h):(e.exit("atxHeadingSequence"),d(y))}function m(y){return y===null||y===35||xn(y)?(e.exit("atxHeadingText"),d(y)):(e.consume(y),m)}}const tye=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],HP=["pre","script","style","textarea"],nye={concrete:!0,name:"htmlFlow",resolveTo:aye,tokenize:iye},rye={partial:!0,tokenize:sye},oye={partial:!0,tokenize:lye};function aye(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function iye(e,t,n){const r=this;let a,l,u,d,h;return m;function m(Y){return y(Y)}function y(Y){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(Y),v}function v(Y){return Y===33?(e.consume(Y),S):Y===47?(e.consume(Y),l=!0,E):Y===63?(e.consume(Y),a=3,r.interrupt?t:B):Fo(Y)?(e.consume(Y),u=String.fromCharCode(Y),k):n(Y)}function S(Y){return Y===45?(e.consume(Y),a=2,w):Y===91?(e.consume(Y),a=5,d=0,A):Fo(Y)?(e.consume(Y),a=4,r.interrupt?t:B):n(Y)}function w(Y){return Y===45?(e.consume(Y),r.interrupt?t:B):n(Y)}function A(Y){const he="CDATA[";return Y===he.charCodeAt(d++)?(e.consume(Y),d===he.length?r.interrupt?t:ee:A):n(Y)}function E(Y){return Fo(Y)?(e.consume(Y),u=String.fromCharCode(Y),k):n(Y)}function k(Y){if(Y===null||Y===47||Y===62||xn(Y)){const he=Y===47,ke=u.toLowerCase();return!he&&!l&&HP.includes(ke)?(a=1,r.interrupt?t(Y):ee(Y)):tye.includes(u.toLowerCase())?(a=6,he?(e.consume(Y),R):r.interrupt?t(Y):ee(Y)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(Y):l?D(Y):M(Y))}return Y===45||bo(Y)?(e.consume(Y),u+=String.fromCharCode(Y),k):n(Y)}function R(Y){return Y===62?(e.consume(Y),r.interrupt?t:ee):n(Y)}function D(Y){return jt(Y)?(e.consume(Y),D):j(Y)}function M(Y){return Y===47?(e.consume(Y),j):Y===58||Y===95||Fo(Y)?(e.consume(Y),I):jt(Y)?(e.consume(Y),M):j(Y)}function I(Y){return Y===45||Y===46||Y===58||Y===95||bo(Y)?(e.consume(Y),I):L(Y)}function L(Y){return Y===61?(e.consume(Y),P):jt(Y)?(e.consume(Y),L):M(Y)}function P(Y){return Y===null||Y===60||Y===61||Y===62||Y===96?n(Y):Y===34||Y===39?(e.consume(Y),h=Y,G):jt(Y)?(e.consume(Y),P):$(Y)}function G(Y){return Y===h?(e.consume(Y),h=null,Z):Y===null||ft(Y)?n(Y):(e.consume(Y),G)}function $(Y){return Y===null||Y===34||Y===39||Y===47||Y===60||Y===61||Y===62||Y===96||xn(Y)?L(Y):(e.consume(Y),$)}function Z(Y){return Y===47||Y===62||jt(Y)?M(Y):n(Y)}function j(Y){return Y===62?(e.consume(Y),X):n(Y)}function X(Y){return Y===null||ft(Y)?ee(Y):jt(Y)?(e.consume(Y),X):n(Y)}function ee(Y){return Y===45&&a===2?(e.consume(Y),V):Y===60&&a===1?(e.consume(Y),W):Y===62&&a===4?(e.consume(Y),oe):Y===63&&a===3?(e.consume(Y),B):Y===93&&a===5?(e.consume(Y),ne):ft(Y)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(rye,se,ae)(Y)):Y===null||ft(Y)?(e.exit("htmlFlowData"),ae(Y)):(e.consume(Y),ee)}function ae(Y){return e.check(oye,U,se)(Y)}function U(Y){return e.enter("lineEnding"),e.consume(Y),e.exit("lineEnding"),te}function te(Y){return Y===null||ft(Y)?ae(Y):(e.enter("htmlFlowData"),ee(Y))}function V(Y){return Y===45?(e.consume(Y),B):ee(Y)}function W(Y){return Y===47?(e.consume(Y),u="",Q):ee(Y)}function Q(Y){if(Y===62){const he=u.toLowerCase();return HP.includes(he)?(e.consume(Y),oe):ee(Y)}return Fo(Y)&&u.length<8?(e.consume(Y),u+=String.fromCharCode(Y),Q):ee(Y)}function ne(Y){return Y===93?(e.consume(Y),B):ee(Y)}function B(Y){return Y===62?(e.consume(Y),oe):Y===45&&a===2?(e.consume(Y),B):ee(Y)}function oe(Y){return Y===null||ft(Y)?(e.exit("htmlFlowData"),se(Y)):(e.consume(Y),oe)}function se(Y){return e.exit("htmlFlow"),t(Y)}}function lye(e,t,n){const r=this;return a;function a(u){return ft(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),l):n(u)}function l(u){return r.parser.lazy[r.now().line]?n(u):t(u)}}function sye(e,t,n){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Qv,t,n)}}const uye={name:"htmlText",tokenize:cye};function cye(e,t,n){const r=this;let a,l,u;return d;function d(B){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(B),h}function h(B){return B===33?(e.consume(B),m):B===47?(e.consume(B),L):B===63?(e.consume(B),M):Fo(B)?(e.consume(B),$):n(B)}function m(B){return B===45?(e.consume(B),y):B===91?(e.consume(B),l=0,A):Fo(B)?(e.consume(B),D):n(B)}function y(B){return B===45?(e.consume(B),w):n(B)}function v(B){return B===null?n(B):B===45?(e.consume(B),S):ft(B)?(u=v,W(B)):(e.consume(B),v)}function S(B){return B===45?(e.consume(B),w):v(B)}function w(B){return B===62?V(B):B===45?S(B):v(B)}function A(B){const oe="CDATA[";return B===oe.charCodeAt(l++)?(e.consume(B),l===oe.length?E:A):n(B)}function E(B){return B===null?n(B):B===93?(e.consume(B),k):ft(B)?(u=E,W(B)):(e.consume(B),E)}function k(B){return B===93?(e.consume(B),R):E(B)}function R(B){return B===62?V(B):B===93?(e.consume(B),R):E(B)}function D(B){return B===null||B===62?V(B):ft(B)?(u=D,W(B)):(e.consume(B),D)}function M(B){return B===null?n(B):B===63?(e.consume(B),I):ft(B)?(u=M,W(B)):(e.consume(B),M)}function I(B){return B===62?V(B):M(B)}function L(B){return Fo(B)?(e.consume(B),P):n(B)}function P(B){return B===45||bo(B)?(e.consume(B),P):G(B)}function G(B){return ft(B)?(u=G,W(B)):jt(B)?(e.consume(B),G):V(B)}function $(B){return B===45||bo(B)?(e.consume(B),$):B===47||B===62||xn(B)?Z(B):n(B)}function Z(B){return B===47?(e.consume(B),V):B===58||B===95||Fo(B)?(e.consume(B),j):ft(B)?(u=Z,W(B)):jt(B)?(e.consume(B),Z):V(B)}function j(B){return B===45||B===46||B===58||B===95||bo(B)?(e.consume(B),j):X(B)}function X(B){return B===61?(e.consume(B),ee):ft(B)?(u=X,W(B)):jt(B)?(e.consume(B),X):Z(B)}function ee(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),a=B,ae):ft(B)?(u=ee,W(B)):jt(B)?(e.consume(B),ee):(e.consume(B),U)}function ae(B){return B===a?(e.consume(B),a=void 0,te):B===null?n(B):ft(B)?(u=ae,W(B)):(e.consume(B),ae)}function U(B){return B===null||B===34||B===39||B===60||B===61||B===96?n(B):B===47||B===62||xn(B)?Z(B):(e.consume(B),U)}function te(B){return B===47||B===62||xn(B)?Z(B):n(B)}function V(B){return B===62?(e.consume(B),e.exit("htmlTextData"),e.exit("htmlText"),t):n(B)}function W(B){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),Q}function Q(B){return jt(B)?Ut(e,ne,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):ne(B)}function ne(B){return e.enter("htmlTextData"),u(B)}}const jR={name:"labelEnd",resolveAll:pye,resolveTo:mye,tokenize:gye},fye={tokenize:yye},dye={tokenize:vye},hye={tokenize:bye};function pye(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==n.length&&Ga(e,0,e.length,n),e}function mye(e,t){let n=e.length,r=0,a,l,u,d;for(;n--;)if(a=e[n][1],l){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(l=n,a.type!=="labelLink")){r=2;break}}else a.type==="labelEnd"&&(u=n);const h={type:e[l][1].type==="labelLink"?"link":"image",start:{...e[l][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[l][1].start},end:{...e[u][1].end}},y={type:"labelText",start:{...e[l+r+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",h,t],["enter",m,t]],d=yi(d,e.slice(l+1,l+r+3)),d=yi(d,[["enter",y,t]]),d=yi(d,J2(t.parser.constructs.insideSpan.null,e.slice(l+r+4,u-3),t)),d=yi(d,[["exit",y,t],e[u-2],e[u-1],["exit",m,t]]),d=yi(d,e.slice(u+1)),d=yi(d,[["exit",h,t]]),Ga(e,l,e.length,d),e}function gye(e,t,n){const r=this;let a=r.events.length,l,u;for(;a--;)if((r.events[a][1].type==="labelImage"||r.events[a][1].type==="labelLink")&&!r.events[a][1]._balanced){l=r.events[a][1];break}return d;function d(S){return l?l._inactive?v(S):(u=r.parser.defined.includes(Rl(r.sliceSerialize({start:l.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),h):n(S)}function h(S){return S===40?e.attempt(fye,y,u?y:v)(S):S===91?e.attempt(dye,y,u?m:v)(S):u?y(S):v(S)}function m(S){return e.attempt(hye,y,v)(S)}function y(S){return t(S)}function v(S){return l._balanced=!0,n(S)}}function yye(e,t,n){return r;function r(v){return e.enter("resource"),e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),a}function a(v){return xn(v)?eb(e,l)(v):l(v)}function l(v){return v===41?y(v):BP(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(v)}function u(v){return xn(v)?eb(e,h)(v):y(v)}function d(v){return n(v)}function h(v){return v===34||v===39||v===40?PP(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(v):y(v)}function m(v){return xn(v)?eb(e,y)(v):y(v)}function y(v){return v===41?(e.enter("resourceMarker"),e.consume(v),e.exit("resourceMarker"),e.exit("resource"),t):n(v)}}function vye(e,t,n){const r=this;return a;function a(d){return LP.call(r,e,l,u,"reference","referenceMarker","referenceString")(d)}function l(d){return r.parser.defined.includes(Rl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function u(d){return n(d)}}function bye(e,t,n){return r;function r(l){return e.enter("reference"),e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),a}function a(l){return l===93?(e.enter("referenceMarker"),e.consume(l),e.exit("referenceMarker"),e.exit("reference"),t):n(l)}}const xye={name:"labelStartImage",resolveAll:jR.resolveAll,tokenize:Sye};function Sye(e,t,n){const r=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),l}function l(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):n(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(d):t(d)}}const wye={name:"labelStartLink",resolveAll:jR.resolveAll,tokenize:Eye};function Eye(e,t,n){const r=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(u):t(u)}}const BR={name:"lineEnding",tokenize:Cye};function Cye(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ut(e,t,"linePrefix")}}const Q2={name:"thematicBreak",tokenize:_ye};function _ye(e,t,n){let r=0,a;return l;function l(m){return e.enter("thematicBreak"),u(m)}function u(m){return a=m,d(m)}function d(m){return m===a?(e.enter("thematicBreakSequence"),h(m)):r>=3&&(m===null||ft(m))?(e.exit("thematicBreak"),t(m)):n(m)}function h(m){return m===a?(e.consume(m),r++,h):(e.exit("thematicBreakSequence"),jt(m)?Ut(e,d,"whitespace")(m):d(m))}}const fa={continuation:{tokenize:Rye},exit:Mye,name:"list",tokenize:kye},Aye={partial:!0,tokenize:Nye},Tye={partial:!0,tokenize:Oye};function kye(e,t,n){const r=this,a=r.events[r.events.length-1];let l=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return d;function d(w){const A=r.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(A==="listUnordered"?!r.containerState.marker||w===r.containerState.marker:DR(w)){if(r.containerState.type||(r.containerState.type=A,e.enter(A,{_container:!0})),A==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Q2,n,m)(w):m(w);if(!r.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(w)}return n(w)}function h(w){return DR(w)&&++u<10?(e.consume(w),h):(!r.interrupt||u<2)&&(r.containerState.marker?w===r.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),m(w)):n(w)}function m(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||w,e.check(Qv,r.interrupt?n:y,e.attempt(Aye,S,v))}function y(w){return r.containerState.initialBlankLine=!0,l++,S(w)}function v(w){return jt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),S):n(w)}function S(w){return r.containerState.size=l+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function Rye(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Qv,a,l);function a(d){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ut(e,t,"listItemIndent",r.containerState.size+1)(d)}function l(d){return r.containerState.furtherBlankLines||!jt(d)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,u(d)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Tye,t,u)(d))}function u(d){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ut(e,e.attempt(fa,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function Oye(e,t,n){const r=this;return Ut(e,a,"listItemIndent",r.containerState.size+1);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===r.containerState.size?t(l):n(l)}}function Mye(e){e.exit(this.containerState.type)}function Nye(e,t,n){const r=this;return Ut(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(l){const u=r.events[r.events.length-1];return!jt(l)&&u&&u[1].type==="listItemPrefixWhitespace"?t(l):n(l)}}const VP={name:"setextUnderline",resolveTo:Dye,tokenize:Iye};function Dye(e,t){let n=e.length,r,a,l;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!l&&e[n][1].type==="definition"&&(l=n);const u={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(e.splice(a,0,["enter",u,t]),e.splice(l+1,0,["exit",e[r][1],t]),e[r][1].end={...e[l][1].end}):e[r][1]=u,e.push(["exit",u,t]),e}function Iye(e,t,n){const r=this;let a;return l;function l(m){let y=r.events.length,v;for(;y--;)if(r.events[y][1].type!=="lineEnding"&&r.events[y][1].type!=="linePrefix"&&r.events[y][1].type!=="content"){v=r.events[y][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||v)?(e.enter("setextHeadingLine"),a=m,u(m)):n(m)}function u(m){return e.enter("setextHeadingLineSequence"),d(m)}function d(m){return m===a?(e.consume(m),d):(e.exit("setextHeadingLineSequence"),jt(m)?Ut(e,h,"lineSuffix")(m):h(m))}function h(m){return m===null||ft(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const zye={tokenize:jye};function jye(e){const t=this,n=e.attempt(Qv,r,e.attempt(this.parser.constructs.flowInitial,a,Ut(e,e.attempt(this.parser.constructs.flow,a,e.attempt(Vge,a)),"linePrefix")));return n;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEndingBlank"),e.consume(l),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Bye={resolveAll:GP()},Lye=FP("string"),Pye=FP("text");function FP(e){return{resolveAll:GP(e==="text"?Hye:void 0),tokenize:t};function t(n){const r=this,a=this.parser.constructs[e],l=n.attempt(a,u,d);return u;function u(y){return m(y)?l(y):d(y)}function d(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),h}function h(y){return m(y)?(n.exit("data"),l(y)):(n.consume(y),h)}function m(y){if(y===null)return!0;const v=a[y];let S=-1;if(v)for(;++S<v.length;){const w=v[S];if(!w.previous||w.previous.call(r,r.previous))return!0}return!1}}}function GP(e){return t;function t(n,r){let a=-1,l;for(;++a<=n.length;)l===void 0?n[a]&&n[a][1].type==="data"&&(l=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==l+2&&(n[l][1].end=n[a-1][1].end,n.splice(l+2,a-l-2),a=l+2),l=void 0);return e?e(n,r):n}}function Hye(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],a=t.sliceStream(r);let l=a.length,u=-1,d=0,h;for(;l--;){const m=a[l];if(typeof m=="string"){for(u=m.length;m.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(m===-2)h=!0,d++;else if(m!==-1){l++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const m={type:n===e.length||h||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:r.start._bufferIndex+u,_index:r.start._index+l,line:r.end.line,column:r.end.column-d,offset:r.end.offset-d},end:{...r.end}};r.end={...m.start},r.start.offset===r.end.offset?Object.assign(r,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const Vye=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:{91:Xge},disable:{null:[]},document:{42:fa,43:fa,45:fa,48:fa,49:fa,50:fa,51:fa,52:fa,53:fa,54:fa,55:fa,56:fa,57:fa,62:MP},flow:{35:Qge,42:Q2,45:[VP,Q2],60:nye,61:VP,95:Q2,96:zP,126:zP},flowInitial:{[-2]:zR,[-1]:zR,32:zR},insideSpan:{null:[IR,Bye]},string:{38:DP,92:NP},text:{[-5]:BR,[-4]:BR,[-3]:BR,33:xye,38:DP,42:IR,60:[wge,uye],91:wye,92:[qge,NP],93:jR,95:IR,96:zge}},Symbol.toStringTag,{value:"Module"}));function Fye(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},l=[];let u=[],d=[];const h={attempt:G(L),check:G(P),consume:D,enter:M,exit:I,interrupt:G(P,{interrupt:!0})},m={code:null,containerState:{},defineSkip:E,events:[],now:A,parser:e,previous:null,sliceSerialize:S,sliceStream:w,write:v};let y=t.tokenize.call(m,h);return t.resolveAll&&l.push(t),m;function v(X){return u=yi(u,X),k(),u[u.length-1]!==null?[]:($(t,0),m.events=J2(l,m.events,m),m.events)}function S(X,ee){return Uye(w(X),ee)}function w(X){return Gye(u,X)}function A(){const{_bufferIndex:X,_index:ee,line:ae,column:U,offset:te}=r;return{_bufferIndex:X,_index:ee,line:ae,column:U,offset:te}}function E(X){a[X.line]=X.column,j()}function k(){let X;for(;r._index<u.length;){const ee=u[r._index];if(typeof ee=="string")for(X=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===X&&r._bufferIndex<ee.length;)R(ee.charCodeAt(r._bufferIndex));else R(ee)}}function R(X){y=y(X)}function D(X){ft(X)?(r.line++,r.column=1,r.offset+=X===-3?2:1,j()):X!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===u[r._index].length&&(r._bufferIndex=-1,r._index++)),m.previous=X}function M(X,ee){const ae=ee||{};return ae.type=X,ae.start=A(),m.events.push(["enter",ae,m]),d.push(ae),ae}function I(X){const ee=d.pop();return ee.end=A(),m.events.push(["exit",ee,m]),ee}function L(X,ee){$(X,ee.from)}function P(X,ee){ee.restore()}function G(X,ee){return ae;function ae(U,te,V){let W,Q,ne,B;return Array.isArray(U)?se(U):"tokenize"in U?se([U]):oe(U);function oe(me){return Ee;function Ee(xe){const Be=xe!==null&&me[xe],He=xe!==null&&me.null,Ye=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(He)?He:He?[He]:[]];return se(Ye)(xe)}}function se(me){return W=me,Q=0,me.length===0?V:Y(me[Q])}function Y(me){return Ee;function Ee(xe){return B=Z(),ne=me,me.partial||(m.currentConstruct=me),me.name&&m.parser.constructs.disable.null.includes(me.name)?ke():me.tokenize.call(ee?Object.assign(Object.create(m),ee):m,h,he,ke)(xe)}}function he(me){return X(ne,B),te}function ke(me){return B.restore(),++Q<W.length?Y(W[Q]):V}}}function $(X,ee){X.resolveAll&&!l.includes(X)&&l.push(X),X.resolve&&Ga(m.events,ee,m.events.length-ee,X.resolve(m.events.slice(ee),m)),X.resolveTo&&(m.events=X.resolveTo(m.events,m))}function Z(){const X=A(),ee=m.previous,ae=m.currentConstruct,U=m.events.length,te=Array.from(d);return{from:U,restore:V};function V(){r=X,m.previous=ee,m.currentConstruct=ae,m.events.length=U,d=te,j()}}function j(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function Gye(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,l=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(r,l)];else{if(u=e.slice(n,a),r>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(r):u.shift()}l>0&&u.push(e[a].slice(0,l))}return u}function Uye(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const l=e[n];let u;if(typeof l=="string")u=l;else switch(l){case-5:{u="\r";break}case-4:{u=`
|
|
1087
1087
|
`;break}case-3:{u=`\r
|
|
1088
1088
|
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(l)}a=l===-2,r.push(u)}return r.join("")}function $ye(e){const r={constructs:TP([Vye,...(e||{}).extensions||[]]),content:a(mge),defined:[],document:a(yge),flow:a(zye),lazy:{},string:a(Lye),text:a(Pye)};return r;function a(l){return u;function u(d){return Fye(r,l,d)}}}function Xye(e){for(;!jP(e););return e}const UP=/[\0\t\n\r]/g;function Yye(){let e=1,t="",n=!0,r;return a;function a(l,u,d){const h=[];let m,y,v,S,w;for(l=t+(typeof l=="string"?l.toString():new TextDecoder(u||void 0).decode(l)),v=0,t="",n&&(l.charCodeAt(0)===65279&&v++,n=void 0);v<l.length;){if(UP.lastIndex=v,m=UP.exec(l),S=m&&m.index!==void 0?m.index:l.length,w=l.charCodeAt(S),!m){t=l.slice(v);break}if(w===10&&v===S&&r)h.push(-3),r=void 0;else switch(r&&(h.push(-5),r=void 0),v<S&&(h.push(l.slice(v,S)),e+=S-v),w){case 0:{h.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,h.push(-2);e++<y;)h.push(-1);break}case 10:{h.push(-4),e=1;break}default:r=!0,e=1}v=S+1}return d&&(r&&h.push(-5),t&&h.push(t),h.push(null)),h}}const Zye=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Wye(e){return e.replace(Zye,qye)}function qye(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),l=a===120||a===88;return kP(n.slice(l?2:1),l?16:10)}return NR(n)||e}const $P={}.hasOwnProperty;function Jye(e,t,n){return typeof t!="string"&&(n=t,t=void 0),Qye(n)(Xye($ye(n).document().write(Yye()(e,t,!0))))}function Qye(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(da),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:l(At),blockQuote:l(He),characterEscape:Z,characterReference:Z,codeFenced:l(Ye),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(Ye,u),codeText:l(Re,u),codeTextData:Z,data:Z,codeFlowValue:Z,definition:l(Xe),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(We),hardBreakEscape:l(Kt),hardBreakTrailing:l(Kt),htmlFlow:l(qt,u),htmlFlowData:Z,htmlText:l(qt,u),htmlTextData:Z,image:l(er),label:u,link:l(da),listItem:l(So),listItemValue:S,listOrdered:l(xo,v),listUnordered:l(xo),paragraph:l(ut),reference:Y,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(At),strong:l(wo),thematicBreak:l(Ol)},exit:{atxHeading:h(),atxHeadingSequence:L,autolink:h(),autolinkEmail:Be,autolinkProtocol:xe,blockQuote:h(),characterEscapeValue:j,characterReferenceMarkerHexadecimal:ke,characterReferenceMarkerNumeric:ke,characterReferenceValue:me,characterReference:Ee,codeFenced:h(k),codeFencedFence:E,codeFencedFenceInfo:w,codeFencedFenceMeta:A,codeFlowValue:j,codeIndented:h(R),codeText:h(te),codeTextData:j,data:j,definition:h(),definitionDestinationString:I,definitionLabelString:D,definitionTitleString:M,emphasis:h(),hardBreakEscape:h(ee),hardBreakTrailing:h(ee),htmlFlow:h(ae),htmlFlowData:j,htmlText:h(U),htmlTextData:j,image:h(W),label:ne,labelText:Q,lineEnding:X,link:h(V),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:he,resourceDestinationString:B,resourceTitleString:oe,resource:se,setextHeading:h($),setextHeadingLineSequence:G,setextHeadingText:P,strong:h(),thematicBreak:h()}};XP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Oe){let Le={type:"root",children:[]};const tt={stack:[Le],tokenStack:[],config:t,enter:d,exit:m,buffer:u,resume:y,data:n},st=[];let Bt=-1;for(;++Bt<Oe.length;)if(Oe[Bt][1].type==="listOrdered"||Oe[Bt][1].type==="listUnordered")if(Oe[Bt][0]==="enter")st.push(Bt);else{const Xr=st.pop();Bt=a(Oe,Xr,Bt)}for(Bt=-1;++Bt<Oe.length;){const Xr=t[Oe[Bt][0]];$P.call(Xr,Oe[Bt][1].type)&&Xr[Oe[Bt][1].type].call(Object.assign({sliceSerialize:Oe[Bt][2].sliceSerialize},tt),Oe[Bt][1])}if(tt.tokenStack.length>0){const Xr=tt.tokenStack[tt.tokenStack.length-1];(Xr[1]||YP).call(tt,void 0,Xr[0])}for(Le.position={start:Af(Oe.length>0?Oe[0][1].start:{line:1,column:1,offset:0}),end:Af(Oe.length>0?Oe[Oe.length-2][1].end:{line:1,column:1,offset:0})},Bt=-1;++Bt<t.transforms.length;)Le=t.transforms[Bt](Le)||Le;return Le}function a(Oe,Le,tt){let st=Le-1,Bt=-1,Xr=!1,Ua,Sr,Mr,Yn;for(;++st<=tt;){const An=Oe[st];switch(An[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{An[0]==="enter"?Bt++:Bt--,Yn=void 0;break}case"lineEndingBlank":{An[0]==="enter"&&(Ua&&!Yn&&!Bt&&!Mr&&(Mr=st),Yn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Yn=void 0}if(!Bt&&An[0]==="enter"&&An[1].type==="listItemPrefix"||Bt===-1&&An[0]==="exit"&&(An[1].type==="listUnordered"||An[1].type==="listOrdered")){if(Ua){let sr=st;for(Sr=void 0;sr--;){const en=Oe[sr];if(en[1].type==="lineEnding"||en[1].type==="lineEndingBlank"){if(en[0]==="exit")continue;Sr&&(Oe[Sr][1].type="lineEndingBlank",Xr=!0),en[1].type="lineEnding",Sr=sr}else if(!(en[1].type==="linePrefix"||en[1].type==="blockQuotePrefix"||en[1].type==="blockQuotePrefixWhitespace"||en[1].type==="blockQuoteMarker"||en[1].type==="listItemIndent"))break}Mr&&(!Sr||Mr<Sr)&&(Ua._spread=!0),Ua.end=Object.assign({},Sr?Oe[Sr][1].start:An[1].end),Oe.splice(Sr||st,0,["exit",Ua,An[2]]),st++,tt++}if(An[1].type==="listItemPrefix"){const sr={type:"listItem",_spread:!1,start:Object.assign({},An[1].start),end:void 0};Ua=sr,Oe.splice(st,0,["enter",sr,An[2]]),st++,tt++,Mr=void 0,Yn=!0}}}return Oe[Le][1]._spread=Xr,tt}function l(Oe,Le){return tt;function tt(st){d.call(this,Oe(st),st),Le&&Le.call(this,st)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(Oe,Le,tt){this.stack[this.stack.length-1].children.push(Oe),this.stack.push(Oe),this.tokenStack.push([Le,tt||void 0]),Oe.position={start:Af(Le.start),end:void 0}}function h(Oe){return Le;function Le(tt){Oe&&Oe.call(this,tt),m.call(this,tt)}}function m(Oe,Le){const tt=this.stack.pop(),st=this.tokenStack.pop();if(st)st[0].type!==Oe.type&&(Le?Le.call(this,Oe,st[0]):(st[1]||YP).call(this,Oe,st[0]));else throw new Error("Cannot close `"+Oe.type+"` ("+qv({start:Oe.start,end:Oe.end})+"): it’s not open");tt.position.end=Af(Oe.end)}function y(){return MR(this.stack.pop())}function v(){this.data.expectingFirstListItemValue=!0}function S(Oe){if(this.data.expectingFirstListItemValue){const Le=this.stack[this.stack.length-2];Le.start=Number.parseInt(this.sliceSerialize(Oe),10),this.data.expectingFirstListItemValue=void 0}}function w(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.lang=Oe}function A(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.meta=Oe}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe.replace(/(\r?\n|\r)$/g,"")}function D(Oe){const Le=this.resume(),tt=this.stack[this.stack.length-1];tt.label=Le,tt.identifier=Rl(this.sliceSerialize(Oe)).toLowerCase()}function M(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.title=Oe}function I(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.url=Oe}function L(Oe){const Le=this.stack[this.stack.length-1];if(!Le.depth){const tt=this.sliceSerialize(Oe).length;Le.depth=tt}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function G(Oe){const Le=this.stack[this.stack.length-1];Le.depth=this.sliceSerialize(Oe).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(Oe){const tt=this.stack[this.stack.length-1].children;let st=tt[tt.length-1];(!st||st.type!=="text")&&(st=qu(),st.position={start:Af(Oe.start),end:void 0},tt.push(st)),this.stack.push(st)}function j(Oe){const Le=this.stack.pop();Le.value+=this.sliceSerialize(Oe),Le.position.end=Af(Oe.end)}function X(Oe){const Le=this.stack[this.stack.length-1];if(this.data.atHardBreak){const tt=Le.children[Le.children.length-1];tt.position.end=Af(Oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Le.type)&&(Z.call(this,Oe),j.call(this,Oe))}function ee(){this.data.atHardBreak=!0}function ae(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe}function U(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe}function te(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.value=Oe}function V(){const Oe=this.stack[this.stack.length-1];if(this.data.inReference){const Le=this.data.referenceType||"shortcut";Oe.type+="Reference",Oe.referenceType=Le,delete Oe.url,delete Oe.title}else delete Oe.identifier,delete Oe.label;this.data.referenceType=void 0}function W(){const Oe=this.stack[this.stack.length-1];if(this.data.inReference){const Le=this.data.referenceType||"shortcut";Oe.type+="Reference",Oe.referenceType=Le,delete Oe.url,delete Oe.title}else delete Oe.identifier,delete Oe.label;this.data.referenceType=void 0}function Q(Oe){const Le=this.sliceSerialize(Oe),tt=this.stack[this.stack.length-2];tt.label=Wye(Le),tt.identifier=Rl(Le).toLowerCase()}function ne(){const Oe=this.stack[this.stack.length-1],Le=this.resume(),tt=this.stack[this.stack.length-1];if(this.data.inReference=!0,tt.type==="link"){const st=Oe.children;tt.children=st}else tt.alt=Le}function B(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.url=Oe}function oe(){const Oe=this.resume(),Le=this.stack[this.stack.length-1];Le.title=Oe}function se(){this.data.inReference=void 0}function Y(){this.data.referenceType="collapsed"}function he(Oe){const Le=this.resume(),tt=this.stack[this.stack.length-1];tt.label=Le,tt.identifier=Rl(this.sliceSerialize(Oe)).toLowerCase(),this.data.referenceType="full"}function ke(Oe){this.data.characterReferenceType=Oe.type}function me(Oe){const Le=this.sliceSerialize(Oe),tt=this.data.characterReferenceType;let st;tt?(st=kP(Le,tt==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):st=NR(Le);const Bt=this.stack[this.stack.length-1];Bt.value+=st}function Ee(Oe){const Le=this.stack.pop();Le.position.end=Af(Oe.end)}function xe(Oe){j.call(this,Oe);const Le=this.stack[this.stack.length-1];Le.url=this.sliceSerialize(Oe)}function Be(Oe){j.call(this,Oe);const Le=this.stack[this.stack.length-1];Le.url="mailto:"+this.sliceSerialize(Oe)}function He(){return{type:"blockquote",children:[]}}function Ye(){return{type:"code",lang:null,meta:null,value:""}}function Re(){return{type:"inlineCode",value:""}}function Xe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function We(){return{type:"emphasis",children:[]}}function At(){return{type:"heading",depth:0,children:[]}}function Kt(){return{type:"break"}}function qt(){return{type:"html",value:""}}function er(){return{type:"image",title:null,url:"",alt:null}}function da(){return{type:"link",title:null,url:"",children:[]}}function xo(Oe){return{type:"list",ordered:Oe.type==="listOrdered",start:null,spread:Oe._spread,children:[]}}function So(Oe){return{type:"listItem",spread:Oe._spread,checked:null,children:[]}}function ut(){return{type:"paragraph",children:[]}}function wo(){return{type:"strong",children:[]}}function qu(){return{type:"text",value:""}}function Ol(){return{type:"thematicBreak"}}}function Af(e){return{line:e.line,column:e.column,offset:e.offset}}function XP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?XP(e,r):Kye(e,r)}}function Kye(e,t){let n;for(n in t)if($P.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function YP(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+qv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qv({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+qv({start:t.start,end:t.end})+") is still open")}function e0e(e){const t=this;t.parser=n;function n(r){return Jye(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function t0e(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function n0e(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -1112,7 +1112,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1112
1112
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:S,table:u,tableCell:h,tableRow:d}};function u(w,A,E,k){return m(y(w,E,k),w.align)}function d(w,A,E,k){const R=v(w,E,k),D=m([R]);return D.slice(0,D.indexOf(`
|
|
1113
1113
|
`))}function h(w,A,E,k){const R=E.enter("tableCell"),D=E.enter("phrasing"),M=E.containerPhrasing(w,{...k,before:l,after:l});return D(),R(),M}function m(w,A){return ibe(w,{align:A,alignDelimiters:r,padding:n,stringLength:a})}function y(w,A,E){const k=w.children;let R=-1;const D=[],M=A.enter("table");for(;++R<k.length;)D[R]=v(k[R],A,E);return M(),D}function v(w,A,E){const k=w.children;let R=-1;const D=[],M=A.enter("tableRow");for(;++R<k.length;)D[R]=h(k[R],w,A,E);return M(),D}function S(w,A,E){let k=zH.inlineCode(w,A,E);return E.stack.includes("tableCell")&&(k=k.replace(/\|/g,"\\$&")),k}}function Ybe(){return{exit:{taskListCheckValueChecked:BH,taskListCheckValueUnchecked:BH,paragraph:Wbe}}}function Zbe(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:qbe}}}function BH(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Wbe(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const a=t.children;let l=-1,u;for(;++l<a.length;){const d=a[l];if(d.type==="paragraph"){u=d;break}}u===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function qbe(e,t,n,r){const a=e.children[0],l=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=n.createTracker(r);l&&d.move(u);let h=zH.listItem(e,t,n,{...r,...d.current()});return l&&(h=h.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),h;function m(y){return y+u}}function Jbe(){return[Rve(),qve(),ebe(),Hbe(),Ybe()]}function Qbe(e){return{extensions:[Ove(),Jve(e),tbe(),Xbe(e),Zbe()]}}const Kbe={tokenize:a1e,partial:!0},LH={tokenize:i1e,partial:!0},PH={tokenize:l1e,partial:!0},HH={tokenize:s1e,partial:!0},e1e={tokenize:u1e,partial:!0},VH={name:"wwwAutolink",tokenize:r1e,previous:GH},FH={name:"protocolAutolink",tokenize:o1e,previous:UH},Wu={name:"emailAutolink",tokenize:n1e,previous:$H},Ds={};function t1e(){return{text:Ds}}let vh=48;for(;vh<123;)Ds[vh]=Wu,vh++,vh===58?vh=65:vh===91&&(vh=97);Ds[43]=Wu,Ds[45]=Wu,Ds[46]=Wu,Ds[95]=Wu,Ds[72]=[Wu,FH],Ds[104]=[Wu,FH],Ds[87]=[Wu,VH],Ds[119]=[Wu,VH];function n1e(e,t,n){const r=this;let a,l;return u;function u(v){return!sO(v)||!$H.call(r,r.previous)||uO(r.events)?n(v):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(v))}function d(v){return sO(v)?(e.consume(v),d):v===64?(e.consume(v),h):n(v)}function h(v){return v===46?e.check(e1e,y,m)(v):v===45||v===95||bo(v)?(l=!0,e.consume(v),h):y(v)}function m(v){return e.consume(v),a=!0,h}function y(v){return l&&a&&Fo(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(v)):n(v)}}function r1e(e,t,n){const r=this;return a;function a(u){return u!==87&&u!==119||!GH.call(r,r.previous)||uO(r.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Kbe,e.attempt(LH,e.attempt(PH,l),n),n)(u))}function l(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function o1e(e,t,n){const r=this;let a="",l=!1;return u;function u(v){return(v===72||v===104)&&UH.call(r,r.previous)&&!uO(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(v),e.consume(v),d):n(v)}function d(v){if(Fo(v)&&a.length<5)return a+=String.fromCodePoint(v),e.consume(v),d;if(v===58){const S=a.toLowerCase();if(S==="http"||S==="https")return e.consume(v),h}return n(v)}function h(v){return v===47?(e.consume(v),l?m:(l=!0,h)):n(v)}function m(v){return v===null||W2(v)||xn(v)||yh(v)||q2(v)?n(v):e.attempt(LH,e.attempt(PH,y),n)(v)}function y(v){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(v)}}function a1e(e,t,n){let r=0;return a;function a(u){return(u===87||u===119)&&r<3?(r++,e.consume(u),a):u===46&&r===3?(e.consume(u),l):n(u)}function l(u){return u===null?n(u):t(u)}}function i1e(e,t,n){let r,a,l;return u;function u(m){return m===46||m===95?e.check(HH,h,d)(m):m===null||xn(m)||yh(m)||m!==45&&q2(m)?h(m):(l=!0,e.consume(m),u)}function d(m){return m===95?r=!0:(a=r,r=void 0),e.consume(m),u}function h(m){return a||r||!l?n(m):t(m)}}function l1e(e,t){let n=0,r=0;return a;function a(u){return u===40?(n++,e.consume(u),a):u===41&&r<n?l(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(HH,t,l)(u):u===null||xn(u)||yh(u)?t(u):(e.consume(u),a)}function l(u){return u===41&&r++,e.consume(u),a}}function s1e(e,t,n){return r;function r(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),r):d===38?(e.consume(d),l):d===93?(e.consume(d),a):d===60||d===null||xn(d)||yh(d)?t(d):n(d)}function a(d){return d===null||d===40||d===91||xn(d)||yh(d)?t(d):r(d)}function l(d){return Fo(d)?u(d):n(d)}function u(d){return d===59?(e.consume(d),r):Fo(d)?(e.consume(d),u):n(d)}}function u1e(e,t,n){return r;function r(l){return e.consume(l),a}function a(l){return bo(l)?n(l):t(l)}}function GH(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||xn(e)}function UH(e){return!Fo(e)}function $H(e){return!(e===47||sO(e))}function sO(e){return e===43||e===45||e===46||e===95||bo(e)}function uO(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const c1e={tokenize:v1e,partial:!0};function f1e(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:m1e,continuation:{tokenize:g1e},exit:y1e}},text:{91:{name:"gfmFootnoteCall",tokenize:p1e},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:d1e,resolveTo:h1e}}}}function d1e(e,t,n){const r=this;let a=r.events.length;const l=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let u;for(;a--;){const h=r.events[a][1];if(h.type==="labelImage"){u=h;break}if(h.type==="gfmFootnoteCall"||h.type==="labelLink"||h.type==="label"||h.type==="image"||h.type==="link")break}return d;function d(h){if(!u||!u._balanced)return n(h);const m=Rl(r.sliceSerialize({start:u.end,end:r.now()}));return m.codePointAt(0)!==94||!l.includes(m.slice(1))?n(h):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),t(h))}}function h1e(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const l={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},l.start),end:Object.assign({},l.end)},d=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",l,t],["enter",u,t],["exit",u,t],["exit",l,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...d),e}function p1e(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l=0,u;return d;function d(v){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),h}function h(v){return v!==94?n(v):(e.enter("gfmFootnoteCallMarker"),e.consume(v),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(v){if(l>999||v===93&&!u||v===null||v===91||xn(v))return n(v);if(v===93){e.exit("chunkString");const S=e.exit("gfmFootnoteCallString");return a.includes(Rl(r.sliceSerialize(S)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(v),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(v)}return xn(v)||(u=!0),l++,e.consume(v),v===92?y:m}function y(v){return v===91||v===92||v===93?(e.consume(v),l++,m):m(v)}}function m1e(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let l,u=0,d;return h;function h(A){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(A),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(A){return A===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(A),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(A)}function y(A){if(u>999||A===93&&!d||A===null||A===91||xn(A))return n(A);if(A===93){e.exit("chunkString");const E=e.exit("gfmFootnoteDefinitionLabelString");return l=Rl(r.sliceSerialize(E)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(A),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return xn(A)||(d=!0),u++,e.consume(A),A===92?v:y}function v(A){return A===91||A===92||A===93?(e.consume(A),u++,y):y(A)}function S(A){return A===58?(e.enter("definitionMarker"),e.consume(A),e.exit("definitionMarker"),a.includes(l)||a.push(l),Ut(e,w,"gfmFootnoteDefinitionWhitespace")):n(A)}function w(A){return t(A)}}function g1e(e,t,n){return e.check(Qv,t,e.attempt(c1e,t,n))}function y1e(e){e.exit("gfmFootnoteDefinition")}function v1e(e,t,n){const r=this;return Ut(e,a,"gfmFootnoteDefinitionIndent",5);function a(l){const u=r.events[r.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(l):n(l)}}function b1e(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:l,resolveAll:a};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(u,d){let h=-1;for(;++h<u.length;)if(u[h][0]==="enter"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._close){let m=h;for(;m--;)if(u[m][0]==="exit"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._open&&u[h][1].end.offset-u[h][1].start.offset===u[m][1].end.offset-u[m][1].start.offset){u[h][1].type="strikethroughSequence",u[m][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},u[m][1].start),end:Object.assign({},u[h][1].end)},v={type:"strikethroughText",start:Object.assign({},u[m][1].end),end:Object.assign({},u[h][1].start)},S=[["enter",y,d],["enter",u[m][1],d],["exit",u[m][1],d],["enter",v,d]],w=d.parser.constructs.insideSpan.null;w&&Ga(S,S.length,0,J2(w,u.slice(m+1,h),d)),Ga(S,S.length,0,[["exit",v,d],["enter",u[h][1],d],["exit",u[h][1],d],["exit",y,d]]),Ga(u,m-1,h-m+3,S),h=m+S.length-2;break}}for(h=-1;++h<u.length;)u[h][1].type==="strikethroughSequenceTemporary"&&(u[h][1].type="data");return u}function l(u,d,h){const m=this.previous,y=this.events;let v=0;return S;function S(A){return m===126&&y[y.length-1][1].type!=="characterEscape"?h(A):(u.enter("strikethroughSequenceTemporary"),w(A))}function w(A){const E=Jm(m);if(A===126)return v>1?h(A):(u.consume(A),v++,w);if(v<2&&!n)return h(A);const k=u.exit("strikethroughSequenceTemporary"),R=Jm(A);return k._open=!R||R===2&&!!E,k._close=!E||E===2&&!!R,d(A)}}}class x1e{constructor(){this.map=[]}add(t,n,r){S1e(this,t,n,r)}consume(t){if(this.map.sort(function(l,u){return l[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const l of a)t.push(l);a=r.pop()}this.map.length=0}}function S1e(e,t,n,r){let a=0;if(!(n===0&&r.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...r);return}a+=1}e.map.push([t,n,r])}}function w1e(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const l=r.length-1;r[l]=r[l]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function E1e(){return{flow:{null:{name:"table",tokenize:C1e,resolveAll:_1e}}}}function C1e(e,t,n){const r=this;let a=0,l=0,u;return d;function d(j){let X=r.events.length-1;for(;X>-1;){const U=r.events[X][1].type;if(U==="lineEnding"||U==="linePrefix")X--;else break}const ee=X>-1?r.events[X][1].type:null,ae=ee==="tableHead"||ee==="tableRow"?P:h;return ae===P&&r.parser.lazy[r.now().line]?n(j):ae(j)}function h(j){return e.enter("tableHead"),e.enter("tableRow"),m(j)}function m(j){return j===124||(u=!0,l+=1),y(j)}function y(j){return j===null?n(j):ft(j)?l>1?(l=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),w):n(j):jt(j)?Ut(e,y,"whitespace")(j):(l+=1,u&&(u=!1,a+=1),j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),u=!0,y):(e.enter("data"),v(j)))}function v(j){return j===null||j===124||xn(j)?(e.exit("data"),y(j)):(e.consume(j),j===92?S:v)}function S(j){return j===92||j===124?(e.consume(j),v):v(j)}function w(j){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(j):(e.enter("tableDelimiterRow"),u=!1,jt(j)?Ut(e,A,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):A(j))}function A(j){return j===45||j===58?k(j):j===124?(u=!0,e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),E):L(j)}function E(j){return jt(j)?Ut(e,k,"whitespace")(j):k(j)}function k(j){return j===58?(l+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),R):j===45?(l+=1,R(j)):j===null||ft(j)?I(j):L(j)}function R(j){return j===45?(e.enter("tableDelimiterFiller"),D(j)):L(j)}function D(j){return j===45?(e.consume(j),D):j===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(j),e.exit("tableDelimiterMarker"),M):(e.exit("tableDelimiterFiller"),M(j))}function M(j){return jt(j)?Ut(e,I,"whitespace")(j):I(j)}function I(j){return j===124?A(j):j===null||ft(j)?!u||a!==l?L(j):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(j)):L(j)}function L(j){return n(j)}function P(j){return e.enter("tableRow"),G(j)}function G(j){return j===124?(e.enter("tableCellDivider"),e.consume(j),e.exit("tableCellDivider"),G):j===null||ft(j)?(e.exit("tableRow"),t(j)):jt(j)?Ut(e,G,"whitespace")(j):(e.enter("data"),$(j))}function $(j){return j===null||j===124||xn(j)?(e.exit("data"),G(j)):(e.consume(j),j===92?Z:$)}function Z(j){return j===92||j===124?(e.consume(j),$):$(j)}}function _1e(e,t){let n=-1,r=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],d=!1,h=0,m,y,v;const S=new x1e;for(;++n<e.length;){const w=e[n],A=w[1];w[0]==="enter"?A.type==="tableHead"?(d=!1,h!==0&&(XH(S,t,h,m,y),y=void 0,h=0),m={type:"table",start:Object.assign({},A.start),end:Object.assign({},A.end)},S.add(n,0,[["enter",m,t]])):A.type==="tableRow"||A.type==="tableDelimiterRow"?(r=!0,v=void 0,l=[0,0,0,0],u=[0,n+1,0,0],d&&(d=!1,y={type:"tableBody",start:Object.assign({},A.start),end:Object.assign({},A.end)},S.add(n,0,[["enter",y,t]])),a=A.type==="tableDelimiterRow"?2:y?3:1):a&&(A.type==="data"||A.type==="tableDelimiterMarker"||A.type==="tableDelimiterFiller")?(r=!1,u[2]===0&&(l[1]!==0&&(u[0]=u[1],v=sE(S,t,l,a,void 0,v),l=[0,0,0,0]),u[2]=n)):A.type==="tableCellDivider"&&(r?r=!1:(l[1]!==0&&(u[0]=u[1],v=sE(S,t,l,a,void 0,v)),l=u,u=[l[1],n,0,0])):A.type==="tableHead"?(d=!0,h=n):A.type==="tableRow"||A.type==="tableDelimiterRow"?(h=n,l[1]!==0?(u[0]=u[1],v=sE(S,t,l,a,n,v)):u[1]!==0&&(v=sE(S,t,u,a,n,v)),a=0):a&&(A.type==="data"||A.type==="tableDelimiterMarker"||A.type==="tableDelimiterFiller")&&(u[3]=n)}for(h!==0&&XH(S,t,h,m,y),S.consume(t.events),n=-1;++n<t.events.length;){const w=t.events[n];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=w1e(t.events,n))}return e}function sE(e,t,n,r,a,l){const u=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(l.end=Object.assign({},Km(t.events,n[0])),e.add(n[0],0,[["exit",l,t]]));const h=Km(t.events,n[1]);if(l={type:u,start:Object.assign({},h),end:Object.assign({},h)},e.add(n[1],0,[["enter",l,t]]),n[2]!==0){const m=Km(t.events,n[2]),y=Km(t.events,n[3]),v={type:d,start:Object.assign({},m),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",v,t]]),r!==2){const S=t.events[n[2]],w=t.events[n[3]];if(S[1].end=Object.assign({},w[1].end),S[1].type="chunkText",S[1].contentType="text",n[3]>n[2]+1){const A=n[2]+1,E=n[3]-n[2]-1;e.add(A,E,[])}}e.add(n[3]+1,0,[["exit",v,t]])}return a!==void 0&&(l.end=Object.assign({},Km(t.events,a)),e.add(a,0,[["exit",l,t]]),l=void 0),l}function XH(e,t,n,r,a){const l=[],u=Km(t.events,n);a&&(a.end=Object.assign({},u),l.push(["exit",a,t])),r.end=Object.assign({},u),l.push(["exit",r,t]),e.add(n+1,0,l)}function Km(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const A1e={name:"tasklistCheck",tokenize:k1e};function T1e(){return{text:{91:A1e}}}function k1e(e,t,n){const r=this;return a;function a(h){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(h):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),l)}function l(h){return xn(h)?(e.enter("taskListCheckValueUnchecked"),e.consume(h),e.exit("taskListCheckValueUnchecked"),u):h===88||h===120?(e.enter("taskListCheckValueChecked"),e.consume(h),e.exit("taskListCheckValueChecked"),u):n(h)}function u(h){return h===93?(e.enter("taskListCheckMarker"),e.consume(h),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(h)}function d(h){return ft(h)?t(h):jt(h)?e.check({tokenize:R1e},t,n)(h):n(h)}}function R1e(e,t,n){return Ut(e,r,"whitespace");function r(a){return a===null?n(a):t(a)}}function O1e(e){return TP([t1e(),f1e(),b1e(e),E1e(),T1e()])}const M1e={};function N1e(e){const t=this,n=e||M1e,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),l=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),u=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(O1e(n)),l.push(Jbe()),u.push(Qbe(n))}const cO=({availableModule:e})=>{const[t,n]=q.useState(!1),r=()=>n(!t),a=150,l=e.description.length>a?e.description.substring(0,a)+"...":e.description;return T.jsxs("div",{className:"module-description",children:[T.jsx(bve,{remarkPlugins:[N1e],children:t?e.description.replace(/\\n/g,`
|
|
1114
1114
|
`):l.replace(/\\n/g,`
|
|
1115
|
-
`)}),e.description.length>a&&T.jsx("button",{onClick:r,className:"toggle-description",children:t?"Show less":"Show more"})]})},YH=[">=","==","<=","<",">"],uE=">=",fO=({availableModule:e,on_change:t})=>{const[n,r]=q.useState(e.version||"latest"),[a,l]=q.useState(uE),u=h=>{const m=h.target.value;r(m),t(m!=="latest"?a+m:m)},d=h=>{h.target.value!==a&&YH.includes(h.target.value)&&(l(h.target.value),n!=="latest"&&t(h.target.value+n))};return e.releases&&!e.releases.includes(n)&&e.releases.unshift(n),T.jsxs(T.Fragment,{children:[T.jsx("select",{value:a,onChange:d,children:YH.map(h=>T.jsx("option",{value:h,children:h},h))}),T.jsx("select",{onChange:u,value:n,children:e.releases&&e.releases.map(h=>T.jsx("option",{value:h,children:h},h))})]})},D1e=({availableModule:e,on_remove:t,on_update:n})=>{const[r,a]=q.useState(uE+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(yR,{availableModule:e}),T.jsx(cO,{availableModule:e}),T.jsxs("div",{children:[T.jsx(fO,{availableModule:e,on_change:a}),T.jsx("button",{className:"update-button",disabled:r===e.version,onClick:()=>{n(e,r)},children:"Update"}),T.jsx("button",{className:"remove-button",onClick:()=>{t(e)},children:"Remove"})]})]})},I1e=({availableModule:e,on_add:t})=>{const[n,r]=q.useState(uE+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(yR,{availableModule:e}),T.jsx(cO,{availableModule:e}),T.jsxs("div",{children:[T.jsx(fO,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},z1e=({availableModule:e,on_add:t})=>{const[n,r]=q.useState(uE+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name}),T.jsx(yR,{availableModule:e}),T.jsx(cO,{availableModule:e}),T.jsxs("div",{children:[T.jsx(fO,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},j1e=({ins:e})=>{const[t,n]=q.useState(e.name),r=Wt(),{lib:a}=yo(),l=()=>{r.worker&&a?.remove_external_worker(e.uuid,e.nodeclassid)},u=()=>{r.worker&&(r.worker.update_external_worker(e.uuid,e.nodeclassid,{name:t}),e.name=t)};return T.jsx(T.Fragment,{children:T.jsx(Iu,{title:e.name,description:"Settings for"+e.name,trigger:T.jsx("div",{children:"Settings"}),buttons:[{text:"Save",onClick:u,close:!0},{text:"Delete",onClick:l,close:!0}],children:T.jsx("div",{children:T.jsxs("div",{children:[T.jsx("label",{htmlFor:"name",children:"Name: "}),T.jsx("input",{type:"text",name:"name",value:t,onChange:d=>n(d.target.value),className:"styledinput"})]})})})})},B1e=({ins:e,lib:t,filter:n="",parentkey:r})=>{const[a,l]=q.useState(!1),u=()=>l(!a),d=t?.nodes?.filter(h=>h.node_id.toLowerCase().includes(n.toLowerCase()));return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:e.name,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",title:e.uuid,children:T.jsx(j1e,{ins:e})}),t&&T.jsxs(T.Fragment,{children:[d&&T.jsx(T.Fragment,{children:d.map(h=>T.jsx(QL,{item:h},r+h.node_id))}),t.subshelves.map(h=>T.jsx(gR,{item:h,filter:n,parentkey:r+h.name},r+h.name))]})]})})})]})},L1e=({item:e,mod:t,lib:n})=>{const{lib:r}=yo(),[a,l]=q.useState(!1),u=()=>l(!a),d=z.useCallback(()=>{r?.add_external_worker({module:t,cls_module:e.module,cls_name:e.class_name})},[r,t,e]),h=y=>{y.detail===2&&d()},m=e.name||e.module+"."+e.class_name;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:m,children:[T.jsx("div",{className:"shelftitle_text",children:m}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",onClick:h,title:e.name,children:"New Instance"}),e.instances.map(y=>T.jsx(B1e,{ins:y,lib:n?.subshelves.find(v=>v.name===y.uuid),parentkey:y.uuid},y.uuid))]})})})]})},P1e=({externalworkermod:e,lib:t})=>{const[n,r]=q.useState(!1),a=()=>r(!n),l=n;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:a,style:{cursor:"pointer"},title:e.module,children:[T.jsx("div",{className:"shelftitle_text",children:e.module}),T.jsx("div",{className:"expandicon "+(l?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(l?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:e.worker_classes.map(u=>T.jsx(L1e,{item:u,mod:e.module,lib:t},u.module+u.class_name))})}),T.jsx("hr",{})]})},H1e=()=>{const e=Wt(),t=e.lib.libstate(),n=Wt(),r=n.local_settings(m=>m.view_settings.expand_lib),a=m=>{n.update_view_settings({expand_lib:m})},l=Zde("m"),[u,d]=q.useState(""),h=e.worker?.state(m=>m.is_open)??!1;return T.jsx(Wk,{maxSize:l?"100%":"18.75rem",direction:l?"down":"right",containerClassName:"pos-left pos-top bg1 h-12",onExpandChange:a,expanded:r===void 0?!0:r,collapseIcons:{up:uw,down:Q0,left:J0,right:sw},expandIcons:{up:Q0,down:uw,left:sw,right:J0},children:T.jsxs("div",{className:"libcontainer",children:[T.jsxs("div",{className:"library",children:[T.jsx("div",{className:"libtitle",children:"Lib"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx(gme,{filter:u,setFilter:d}),T.jsx("div",{className:"vscrollcontainer",children:t.lib.shelves.filter(m=>m.name!=="_external_worker").map(m=>T.jsx(gR,{item:m,filter:u,parentkey:m.name},m.name))}),T.jsx("hr",{}),T.jsx("div",{className:"libtitle",children:"External Worker"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx("div",{className:"vscrollcontainer",children:t.external_worker?.map(m=>T.jsx(P1e,{externalworkermod:m,lib:t.lib.shelves.find(y=>y.name==="_external_worker")},m.module))}),T.jsx("hr",{})]}),h&&T.jsx("div",{className:"addlib",children:T.jsx(yme,{children:T.jsx("button",{children:"Manage Libraries"})})})]})})},V1e=({fnrf_zst:e,header:t,flow:n,library:r})=>{const[a,l]=q.useState(e.options.worker),u=z.useRef(null);e.workermanager&&(e.workermanager.on_setWorker=l),e.set_worker(a),z.useEffect(()=>{e.auto_progress()},[]),z.useEffect(()=>{e.local_state.setState({funcnodescontainerRef:u.current})},[u]);const d=e.plugins();return T.jsx(zde,{plugins:d,fnrf_zst:e,children:T.jsx(SJ,{children:T.jsx(oI.Provider,{value:e,children:T.jsx(af,{asChild:!0,children:T.jsx(Cu,{asChild:!0,children:T.jsx(UB,{style:{height:"100%",width:"100%",display:"flex",flexDirection:"column",flex:1},children:T.jsxs("div",{ref:u,className:"funcnodesreactflowcontainer funcnodescontainer",children:[t.show&&T.jsx(mme,{...t}),T.jsxs("div",{className:"funcnodesreactflowbody",children:[T.jsx(Yhe,{...n}),a&&r.show&&T.jsx(H1e,{}),a&&n.showNodeSettings&&T.jsx(Kde,{})]}),T.jsxs("div",{className:"funcnodesflaotingmenu",children:[T.jsx(Cu.OutFullScreen,{children:n.allowExpand&&T.jsxs(af.Trigger,{children:[T.jsx(af.Expanded,{children:T.jsx(fJ,{size:"xl",style:{padding:"4px"}})}),T.jsx(af.Collapsed,{children:T.jsx(dJ,{size:"xl",style:{padding:"4px"}})})]})}),n.allowFullScreen&&T.jsxs(Cu.Trigger,{children:[T.jsx(Cu.OutFullScreen,{children:T.jsx(rI,{size:"xl",style:{padding:"4px"}})}),T.jsx(Cu.InFullScreen,{children:T.jsx(cJ,{size:"xl",style:{padding:"4px"}})})]})]})]})})})})})})})};class eg{constructor(t){this.context=t}get nodespaceManager(){return this.context.rf.getNodespaceManager()}get libManager(){return this.context.rf.getLibManager()}get workerManager(){return this.context.rf.getWorkerManager()}get stateManager(){return this.context.rf.getStateManager()}get pluginManager(){return this.context.rf.getPluginManager()}get reactFlowManager(){return this.context.rf.getReactFlowManager()}}const ZH=({src_nid:e,src_ioid:t,trg_nid:n,trg_ioid:r})=>[`${e}:${t}`,`${n}:${r}`].sort().join("--"),F1e=({})=>{const e=new Map;return{nodesstates:e,get_node:(t,n=!0)=>{const r=e.get(t);if(!r&&n){const a=e.keys();throw new Error(`Node ${t} not found, available nodes: ${Array.from(a)}`)}return r}}};class G1e extends eg{constructor(t){super(t),this.on_node_action=n=>{switch(n.type){case"add":return this._add_node(n);case"update":return this._update_node(n);case"delete":return this._delete_node(n);case"error":return this._error_action(n);case"trigger":return this._trigger_action(n);default:this.context.rf.logger.error("Unknown node action",n);return}},this.on_edge_action=n=>{const r=this.reactFlowManager.useReactFlowStore.getState();switch(n.type){case"add":if(n.from_remote){const a=r.getEdges(),l=ZH(n);if(a.some(d=>d.id===l))return;const u={id:l,source:n.src_nid,target:n.trg_nid,sourceHandle:n.src_ioid,targetHandle:n.trg_ioid,className:"funcnodes-edge animated",zIndex:1003};this.context.rf.logger.info("Adding edge",u),r.update_edges([...a,u]),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;case"delete":if(n.from_remote){const a=r.getEdges(),l=ZH(n);this.context.rf.logger.info("Deleting edge",l);const u=a.filter(d=>d.id!==l);r.update_edges(u),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;default:this.context.rf.logger.error("Unknown edge action",n)}},this.on_group_action=n=>{switch(n.type){case"set":return this._set_groups(n.groups);case"update":return this._update_group(n);default:this.context.rf.logger.error("Unknown group action",n)}},this.clear_all=()=>{this.workerManager.worker?.disconnect(),this.workerManager.set_worker(void 0),this.workerManager.workermanager?.setWorker(void 0),this.libManager.lib.libstate.getState().set({lib:{shelves:[]},external_worker:[]}),this.nodespace.nodesstates.clear(),this.reactFlowManager.useReactFlowStore.getState().update_nodes([]),this.reactFlowManager.useReactFlowStore.getState().update_edges([]),this.stateManager.auto_progress()},this.center_node=n=>{if(!this.reactFlowManager.rf_instance)return;n=Array.isArray(n)?n:[n];const r=this.reactFlowManager.useReactFlowStore.getState().getNodes().filter(a=>n.includes(a.id));r.length>0&&this.reactFlowManager.rf_instance?.fitView({padding:.2,nodes:r})},this.auto_resize_group=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n);if(a===void 0||a.type!=="group")return;const l=a.data.group.node_ids.map(y=>r.getNode(y)).filter(y=>y!==void 0),u=a.data.group.child_groups.map(y=>r.getNode(y)).filter(y=>y!==void 0),d=[...l,...u],h=this.reactFlowManager.rf_instance?.getNodesBounds(d);if(h===void 0)return;const m={...a,position:{x:h.x,y:h.y},height:h.height,width:h.width};m.data.group.position=[h.x,h.y],r.partial_update_nodes([m])},this.change_group_position=n=>{if(n.position===void 0)return;const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const l=[...a.data.group.node_ids,...a.data.group.child_groups],u=this.reactFlowManager.rf_instance?.getNodesBounds(l);if(u===void 0)return;const d=n.position.x-u?.x,h=n.position.y-u?.y,m=[];for(const y of l){const v=r.getNode(y);v!==void 0&&m.push({id:y,type:"position",position:{x:v.position.x+d,y:v.position.y+h}})}r.onNodesChange(m)},this.change_fn_node_position=n=>{n.position!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:pos":[n.position.x,n.position.y]}},from_remote:!1})},this.change_group_dimensions=n=>{if(n.dimensions===void 0)return;const a=this.reactFlowManager.useReactFlowStore.getState().getNode(n.id);a!==void 0&&this.reactFlowManager.useReactFlowStore.getState().partial_update_nodes(Nk([n],[a]))},this.change_fn_node_dimensions=n=>{n.dimensions!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:size":[n.dimensions.width,n.dimensions.height]}},from_remote:!1})},this._update_group=n=>{if(n.from_remote){const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const{new_obj:l,change:u}=Ud(a.data.group,n.group);u&&(a.data.group=l),r.partial_update_nodes([a])}else this.workerManager.worker&&this.workerManager.worker.api.group.locally_update_group(n)},this._set_groups=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),{default_nodes:a}=nR(r.getNodes()),l=[...a],u={};for(const h in n){const m=n[h];for(const v of m.node_ids)u[v]=h;for(const v of m.child_groups)u[v]=h;m.position===void 0&&(m.position=[0,0]);const y={id:h,type:"group",data:{group:n[h],id:h},position:{x:m.position[0],y:m.position[1]},zIndex:2};m.parent_group&&(y.data.groupID=m.parent_group),l.push(y)}for(const h of l)h.id in u?h.data.groupID=u[h.id]:h.data.groupID=void 0;const d=rR(l);r.update_nodes(d);for(const h of d.reverse())h.type==="group"&&this.auto_resize_group(h.id)},this._add_node=n=>{this.context.rf.logger.info("add node",n);const r=this.reactFlowManager.useReactFlowStore.getState();if(n.from_remote){let a=this.nodespace.get_node(n.node.id,!1);if(a)return;if(!a)try{a=Phe(n.node),this.nodespace.nodesstates.set(n.node.id,a)}catch(h){this.context.rf.logger.error(`Failed to create node store ${h}`);return}const l=a.getState();this.context.rf.logger.info("Add node",l.id,l.name);const u=Xhe(a,this.context.rf),d=[...r.getNodes(),u];this.reactFlowManager.useReactFlowStore.getState().update_nodes(d);for(const h of u.io_order)this.workerManager.worker?.api.node.get_io_value({nid:u.id,ioid:h});return setTimeout(()=>{this.workerManager.worker?.api.hooks.call_hooks("node_added",{node:l.id})},0),l}},this._update_node=n=>{if(Object.keys(n.node).length===0){this.context.rf.logger.error("Node update is empty",new Error(JSON.stringify(n)));return}if(n.node.in_trigger&&(n.node.error=void 0),n.from_remote){const r=this.nodespace.get_node(n.id,!1);if(!r){console.error("Node not found to update",n.id);return}return r.update(n.node),r.getState()}else this.workerManager.worker&&this.workerManager.worker.api.node.locally_update_node(n)},this._delete_node=n=>{this.context.rf.logger.info("Deleting node",n.id),n.from_remote?this.reactFlowManager.useReactFlowStore.getState().onNodesChange([{type:"remove",id:n.id}]):this.workerManager.worker?.api.node.remove_node(n.id)},this._error_action=n=>(this.context.rf.logger.error("Error",new Error(JSON.stringify(n))),this.on_node_action({type:"update",id:n.id,node:{in_trigger:!1,error:n.error},from_remote:!0})),this._trigger_action=n=>{if(n.from_remote)return this.on_node_action({type:"update",id:n.id,node:{in_trigger:!0,error:void 0},from_remote:!0});this.workerManager.worker?.api.node.trigger_node(n.id)},this.nodespace=F1e({})}center_all(){this.reactFlowManager.rf_instance?.fitView({padding:.2})}}const U1e=()=>({libstate:mi((e,t)=>({lib:{shelves:[]},external_worker:[],set:n=>e(r=>({...r,...n})),get_lib:()=>t().lib,get_external_worker:()=>t().external_worker}))});class $1e extends eg{constructor(t){super(t),this.lib=U1e()}}class X1e extends eg{constructor(t){super(t),this.workers=mi((n,r)=>({})),this.workerstate=mi((n,r)=>({is_open:!1}))}set_worker(t){t!==this.worker&&(this._unsubscribeFromWorker&&(this._unsubscribeFromWorker(),this._unsubscribeFromWorker=void 0),t&&(this._unsubscribeFromWorker=t.state.subscribe(n=>{this.workerstate.setState(n)}),this.workerstate.setState(t.state.getState())),this.worker=t,t?.set_zustand(this.context.rf))}}class Y1e extends eg{constructor(t){super(t),this.progress_state=mi((n,r)=>({message:"please select worker",status:"info",progress:0,blocking:!1})),this.local_settings=mi((n,r)=>({view_settings:{expand_node_props:!1,expand_lib:!1}})),this.local_state=mi((n,r)=>({selected_nodes:[],selected_edges:[],selected_groups:[],funcnodescontainerRef:null}))}set_progress(t){if(t.message==="")return this.auto_progress();const n=this.progress_state.getState(),{new_obj:r,change:a}=Ud(n,t);a&&this.progress_state.setState(r)}auto_progress(){const t=this.workerManager.workermanager,n=this.workerManager.worker;if(t!==void 0&&!t.open)return this.set_progress({progress:0,message:"connecting to worker manager",status:"error",blocking:!1});if(n===void 0)return this.set_progress({progress:0,message:"please select worker",status:"error",blocking:!1});if(!n.is_open)return this.set_progress({progress:0,message:"connecting to worker",status:"info",blocking:!0});this.set_progress({progress:1,message:"running",status:"info",blocking:!1})}update_view_settings(t){cL(this.local_settings,{view_settings:t})}}const dO="1.0.0",Z1e=["1"],W1e=e=>{if(!e.v.toString().includes(".")||!Z1e.includes(e.v.toString().split(".")[0]))throw new Error(`Unsupported version: ${e.v}`);return{...e,v:dO}};class q1e extends eg{constructor(t){super(t),this.plugins=mi((n,r)=>({})),this.render_options=mi((n,r)=>({}))}add_plugin(t,n){if(console.log("add_plugin",t,n),n!==void 0)try{const r=W1e(n);this.plugins.setState(a=>({...a,[t]:r}))}catch(r){r instanceof Error?this.context.rf.logger.error(`Error loading plugin ${t}`,r):this.context.rf.logger.error(`Error loading plugin ${t}`,new Error(String(r))),this.stateManager.toaster?.error({title:"Error",description:`Error loading plugin ${t}: ${r instanceof Error?r.message:String(r)}`,duration:5e3})}}update_render_options(t){cL(this.render_options,t)}async add_packed_plugin(t,n){if(n.js)for(const r of n.js){const a=document.createElement("script");a.text=atob(r),document.body.appendChild(a)}if(n.css)for(const r of n.css){const a=document.createElement("style");a.innerHTML=atob(r),document.head.appendChild(a)}if(n.module!==void 0){const r=atob(n.module);try{const l=await new Function("React","FuncNodesReactFlow",`
|
|
1115
|
+
`)}),e.description.length>a&&T.jsx("button",{onClick:r,className:"toggle-description",children:t?"Show less":"Show more"})]})},YH=[">=","==","<=","<",">"],uE=">=",fO=({availableModule:e,on_change:t})=>{const[n,r]=q.useState(e.version||"latest"),[a,l]=q.useState(uE),u=h=>{const m=h.target.value;r(m),t(m!=="latest"?a+m:m)},d=h=>{h.target.value!==a&&YH.includes(h.target.value)&&(l(h.target.value),n!=="latest"&&t(h.target.value+n))};return e.releases&&!e.releases.includes(n)&&e.releases.unshift(n),T.jsxs(T.Fragment,{children:[T.jsx("select",{value:a,onChange:d,children:YH.map(h=>T.jsx("option",{value:h,children:h},h))}),T.jsx("select",{onChange:u,value:n,children:e.releases&&e.releases.map(h=>T.jsx("option",{value:h,children:h},h))})]})},D1e=({availableModule:e,on_remove:t,on_update:n})=>{const[r,a]=q.useState(uE+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(yR,{availableModule:e}),T.jsx(cO,{availableModule:e}),T.jsxs("div",{children:[T.jsx(fO,{availableModule:e,on_change:a}),T.jsx("button",{className:"update-button",disabled:r===e.version,onClick:()=>{n(e,r)},children:"Update"}),T.jsx("button",{className:"remove-button",onClick:()=>{t(e)},children:"Remove"})]})]})},I1e=({availableModule:e,on_add:t})=>{const[n,r]=q.useState(uE+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name+(e.version?` (${e.version})`:"")}),T.jsx(yR,{availableModule:e}),T.jsx(cO,{availableModule:e}),T.jsxs("div",{children:[T.jsx(fO,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},z1e=({availableModule:e,on_add:t})=>{const[n,r]=q.useState(uE+e.version||"latest");return T.jsxs("div",{className:"addable-module",children:[T.jsx("div",{className:"module-name",children:e.name}),T.jsx(yR,{availableModule:e}),T.jsx(cO,{availableModule:e}),T.jsxs("div",{children:[T.jsx(fO,{availableModule:e,on_change:r}),T.jsx("button",{className:"add-button",onClick:()=>{t(e,n)},children:"Add"})]})]})},j1e=({ins:e})=>{const[t,n]=q.useState(e.name),r=Wt(),{lib:a}=yo(),l=()=>{r.worker&&a?.remove_external_worker(e.uuid,e.nodeclassid)},u=()=>{r.worker&&(r.worker.update_external_worker(e.uuid,e.nodeclassid,{name:t}),e.name=t)};return T.jsx(T.Fragment,{children:T.jsx(Iu,{title:e.name,description:"Settings for"+e.name,trigger:T.jsx("div",{children:"Settings"}),buttons:[{text:"Save",onClick:u,close:!0},{text:"Delete",onClick:l,close:!0}],children:T.jsx("div",{children:T.jsxs("div",{children:[T.jsx("label",{htmlFor:"name",children:"Name: "}),T.jsx("input",{type:"text",name:"name",value:t,onChange:d=>n(d.target.value),className:"styledinput"})]})})})})},B1e=({ins:e,lib:t,filter:n="",parentkey:r})=>{const[a,l]=q.useState(!1),u=()=>l(!a),d=t?.nodes?.filter(h=>h.node_id.toLowerCase().includes(n.toLowerCase()));return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:e.name,children:[T.jsx("div",{className:"shelftitle_text",children:e.name}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",title:e.uuid,children:T.jsx(j1e,{ins:e})}),t&&T.jsxs(T.Fragment,{children:[d&&T.jsx(T.Fragment,{children:d.map(h=>T.jsx(QL,{item:h},r+h.node_id))}),t.subshelves.map(h=>T.jsx(gR,{item:h,filter:n,parentkey:r+h.name},r+h.name))]})]})})})]})},L1e=({item:e,mod:t,lib:n})=>{const{lib:r}=yo(),[a,l]=q.useState(!1),u=()=>l(!a),d=z.useCallback(()=>{r?.add_external_worker({module:t,cls_module:e.module,cls_name:e.class_name})},[r,t,e]),h=y=>{y.detail===2&&d()},m=e.name||e.module+"."+e.class_name;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:u,style:{cursor:"pointer"},title:m,children:[T.jsx("div",{className:"shelftitle_text",children:m}),T.jsx("div",{className:"expandicon "+(a?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(a?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:a&&T.jsxs(T.Fragment,{children:[T.jsx("div",{className:"libnodeentry",onClick:h,title:e.name,children:"New Instance"}),e.instances.map(y=>T.jsx(B1e,{ins:y,lib:n?.subshelves.find(v=>v.name===y.uuid),parentkey:y.uuid},y.uuid))]})})})]})},P1e=({externalworkermod:e,lib:t})=>{const[n,r]=q.useState(!1),a=()=>r(!n),l=n;return T.jsxs("div",{className:"shelfcontainer",children:[T.jsxs("div",{className:"shelftitle",onClick:a,style:{cursor:"pointer"},title:e.module,children:[T.jsx("div",{className:"shelftitle_text",children:e.module}),T.jsx("div",{className:"expandicon "+(l?"open":"close"),children:T.jsx(K0,{})})]}),T.jsx("div",{className:"libnodecontainer "+(l?"open":"close"),children:T.jsx("div",{className:"libnodecontainer_inner",children:e.worker_classes.map(u=>T.jsx(L1e,{item:u,mod:e.module,lib:t},u.module+u.class_name))})}),T.jsx("hr",{})]})},H1e=()=>{const e=Wt(),t=e.lib.libstate(),n=Wt(),r=n.local_settings(m=>m.view_settings.expand_lib),a=m=>{n.update_view_settings({expand_lib:m})},l=Zde("m"),[u,d]=q.useState(""),h=e.worker?.state(m=>m.is_open)??!1;return T.jsx(Wk,{maxSize:l?"100%":"18.75rem",direction:l?"down":"right",containerClassName:"pos-left pos-top bg1 h-12",onExpandChange:a,expanded:r===void 0?!0:r,collapseIcons:{up:uw,down:Q0,left:J0,right:sw},expandIcons:{up:Q0,down:uw,left:sw,right:J0},children:T.jsxs("div",{className:"libcontainer",children:[T.jsxs("div",{className:"library",children:[T.jsx("div",{className:"libtitle",children:"Lib"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx(gme,{filter:u,setFilter:d}),T.jsx("div",{className:"vscrollcontainer",children:t.lib.shelves.filter(m=>m.name!=="_external_worker").map(m=>T.jsx(gR,{item:m,filter:u,parentkey:m.name},m.name))}),T.jsx("hr",{}),T.jsx("div",{className:"libtitle",children:"External Worker"}),T.jsx("hr",{className:"hr_prominent"}),T.jsx("div",{className:"vscrollcontainer",children:t.external_worker?.map(m=>T.jsx(P1e,{externalworkermod:m,lib:t.lib.shelves.find(y=>y.name==="_external_worker")},m.module))}),T.jsx("hr",{})]}),h&&T.jsx("div",{className:"addlib",children:T.jsx(yme,{children:T.jsx("button",{children:"Manage Libraries"})})})]})})},V1e=({fnrf_zst:e,header:t,flow:n,library:r})=>{const[a,l]=q.useState(e.options.worker||e.getWorkerManager().worker),u=z.useRef(null);e.workermanager&&(e.workermanager.on_setWorker=l),z.useEffect(()=>{e.auto_progress()},[]),z.useEffect(()=>{e.local_state.setState({funcnodescontainerRef:u.current})},[u]);const d=e.plugins();return T.jsx(zde,{plugins:d,fnrf_zst:e,children:T.jsx(SJ,{children:T.jsx(oI.Provider,{value:e,children:T.jsx(af,{asChild:!0,children:T.jsx(Cu,{asChild:!0,children:T.jsx(UB,{style:{height:"100%",width:"100%",display:"flex",flexDirection:"column",flex:1},children:T.jsxs("div",{ref:u,className:"funcnodesreactflowcontainer funcnodescontainer",children:[t.show&&T.jsx(mme,{...t}),T.jsxs("div",{className:"funcnodesreactflowbody",children:[T.jsx(Yhe,{...n}),a&&r.show&&T.jsx(H1e,{}),a&&n.showNodeSettings&&T.jsx(Kde,{})]}),T.jsxs("div",{className:"funcnodesflaotingmenu",children:[T.jsx(Cu.OutFullScreen,{children:n.allowExpand&&T.jsxs(af.Trigger,{children:[T.jsx(af.Expanded,{children:T.jsx(fJ,{size:"xl",style:{padding:"4px"}})}),T.jsx(af.Collapsed,{children:T.jsx(dJ,{size:"xl",style:{padding:"4px"}})})]})}),n.allowFullScreen&&T.jsxs(Cu.Trigger,{children:[T.jsx(Cu.OutFullScreen,{children:T.jsx(rI,{size:"xl",style:{padding:"4px"}})}),T.jsx(Cu.InFullScreen,{children:T.jsx(cJ,{size:"xl",style:{padding:"4px"}})})]})]})]})})})})})})})};class eg{constructor(t){this.context=t}get nodespaceManager(){return this.context.rf.getNodespaceManager()}get libManager(){return this.context.rf.getLibManager()}get workerManager(){return this.context.rf.getWorkerManager()}get stateManager(){return this.context.rf.getStateManager()}get pluginManager(){return this.context.rf.getPluginManager()}get reactFlowManager(){return this.context.rf.getReactFlowManager()}}const ZH=({src_nid:e,src_ioid:t,trg_nid:n,trg_ioid:r})=>[`${e}:${t}`,`${n}:${r}`].sort().join("--"),F1e=({})=>{const e=new Map;return{nodesstates:e,get_node:(t,n=!0)=>{const r=e.get(t);if(!r&&n){const a=e.keys();throw new Error(`Node ${t} not found, available nodes: ${Array.from(a)}`)}return r}}};class G1e extends eg{constructor(t){super(t),this.on_node_action=n=>{switch(n.type){case"add":return this._add_node(n);case"update":return this._update_node(n);case"delete":return this._delete_node(n);case"error":return this._error_action(n);case"trigger":return this._trigger_action(n);default:this.context.rf.logger.error("Unknown node action",n);return}},this.on_edge_action=n=>{const r=this.reactFlowManager.useReactFlowStore.getState();switch(n.type){case"add":if(n.from_remote){const a=r.getEdges(),l=ZH(n);if(a.some(d=>d.id===l))return;const u={id:l,source:n.src_nid,target:n.trg_nid,sourceHandle:n.src_ioid,targetHandle:n.trg_ioid,className:"funcnodes-edge animated",zIndex:1003};this.context.rf.logger.info("Adding edge",u),r.update_edges([...a,u]),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;case"delete":if(n.from_remote){const a=r.getEdges(),l=ZH(n);this.context.rf.logger.info("Deleting edge",l);const u=a.filter(d=>d.id!==l);r.update_edges(u),this.workerManager.worker?.api.node.get_remote_node_state(n.src_nid),this.workerManager.worker?.api.node.get_remote_node_state(n.trg_nid)}break;default:this.context.rf.logger.error("Unknown edge action",n)}},this.on_group_action=n=>{switch(n.type){case"set":return this._set_groups(n.groups);case"update":return this._update_group(n);default:this.context.rf.logger.error("Unknown group action",n)}},this.clear_all=()=>{this.context.rf.logger.debug("Clearing all nodespace"),this.workerManager.worker?.disconnect(),this.workerManager.set_worker(void 0),this.workerManager.workermanager?.setWorker(void 0),this.libManager.lib.libstate.getState().set({lib:{shelves:[]},external_worker:[]}),this.nodespace.nodesstates.clear(),this.reactFlowManager.useReactFlowStore.getState().update_nodes([]),this.reactFlowManager.useReactFlowStore.getState().update_edges([]),this.stateManager.auto_progress()},this.center_node=n=>{if(!this.reactFlowManager.rf_instance)return;n=Array.isArray(n)?n:[n];const r=this.reactFlowManager.useReactFlowStore.getState().getNodes().filter(a=>n.includes(a.id));r.length>0&&this.reactFlowManager.rf_instance?.fitView({padding:.2,nodes:r})},this.auto_resize_group=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n);if(a===void 0||a.type!=="group")return;const l=a.data.group.node_ids.map(y=>r.getNode(y)).filter(y=>y!==void 0),u=a.data.group.child_groups.map(y=>r.getNode(y)).filter(y=>y!==void 0),d=[...l,...u],h=this.reactFlowManager.rf_instance?.getNodesBounds(d);if(h===void 0)return;const m={...a,position:{x:h.x,y:h.y},height:h.height,width:h.width};m.data.group.position=[h.x,h.y],r.partial_update_nodes([m])},this.change_group_position=n=>{if(n.position===void 0)return;const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const l=[...a.data.group.node_ids,...a.data.group.child_groups],u=this.reactFlowManager.rf_instance?.getNodesBounds(l);if(u===void 0)return;const d=n.position.x-u?.x,h=n.position.y-u?.y,m=[];for(const y of l){const v=r.getNode(y);v!==void 0&&m.push({id:y,type:"position",position:{x:v.position.x+d,y:v.position.y+h}})}r.onNodesChange(m)},this.change_fn_node_position=n=>{n.position!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:pos":[n.position.x,n.position.y]}},from_remote:!1})},this.change_group_dimensions=n=>{if(n.dimensions===void 0)return;const a=this.reactFlowManager.useReactFlowStore.getState().getNode(n.id);a!==void 0&&this.reactFlowManager.useReactFlowStore.getState().partial_update_nodes(Nk([n],[a]))},this.change_fn_node_dimensions=n=>{n.dimensions!==void 0&&this.on_node_action({type:"update",id:n.id,node:{properties:{"frontend:size":[n.dimensions.width,n.dimensions.height]}},from_remote:!1})},this._update_group=n=>{if(n.from_remote){const r=this.reactFlowManager.useReactFlowStore.getState(),a=r.getNode(n.id);if(a===void 0||a.type!=="group")return;const{new_obj:l,change:u}=Ud(a.data.group,n.group);u&&(a.data.group=l),r.partial_update_nodes([a])}else this.workerManager.worker&&this.workerManager.worker.api.group.locally_update_group(n)},this._set_groups=n=>{const r=this.reactFlowManager.useReactFlowStore.getState(),{default_nodes:a}=nR(r.getNodes()),l=[...a],u={};for(const h in n){const m=n[h];for(const v of m.node_ids)u[v]=h;for(const v of m.child_groups)u[v]=h;m.position===void 0&&(m.position=[0,0]);const y={id:h,type:"group",data:{group:n[h],id:h},position:{x:m.position[0],y:m.position[1]},zIndex:2};m.parent_group&&(y.data.groupID=m.parent_group),l.push(y)}for(const h of l)h.id in u?h.data.groupID=u[h.id]:h.data.groupID=void 0;const d=rR(l);r.update_nodes(d);for(const h of d.reverse())h.type==="group"&&this.auto_resize_group(h.id)},this._add_node=n=>{this.context.rf.logger.info("add node",n);const r=this.reactFlowManager.useReactFlowStore.getState();if(n.from_remote){let a=this.nodespace.get_node(n.node.id,!1);if(a)return;if(!a)try{a=Phe(n.node),this.nodespace.nodesstates.set(n.node.id,a)}catch(h){this.context.rf.logger.error(`Failed to create node store ${h}`);return}const l=a.getState();this.context.rf.logger.info("Add node",l.id,l.name);const u=Xhe(a,this.context.rf),d=[...r.getNodes(),u];this.reactFlowManager.useReactFlowStore.getState().update_nodes(d);for(const h of u.io_order)this.workerManager.worker?.api.node.get_io_value({nid:u.id,ioid:h});return setTimeout(()=>{this.workerManager.worker?.api.hooks.call_hooks("node_added",{node:l.id})},0),l}},this._update_node=n=>{if(Object.keys(n.node).length===0){this.context.rf.logger.error("Node update is empty",new Error(JSON.stringify(n)));return}if(n.node.in_trigger&&(n.node.error=void 0),n.from_remote){const r=this.nodespace.get_node(n.id,!1);if(!r){console.error("Node not found to update",n.id);return}return r.update(n.node),r.getState()}else this.workerManager.worker&&this.workerManager.worker.api.node.locally_update_node(n)},this._sync_nodes=()=>{const n=this.reactFlowManager.useReactFlowStore.getState().getNodes(),r=this.nodespace.nodesstates;for(const a of r.keys())n.some(l=>l.id===a)||r.delete(a)},this._delete_node=n=>{this.context.rf.logger.info("Deleting node",n.id),n.from_remote?(this.reactFlowManager.useReactFlowStore.getState().onNodesChange([{type:"remove",id:n.id}]),this._sync_nodes()):this.workerManager.worker?.api.node.remove_node(n.id)},this._error_action=n=>(this.context.rf.logger.error("Error",new Error(JSON.stringify(n))),this.on_node_action({type:"update",id:n.id,node:{in_trigger:!1,error:n.error},from_remote:!0})),this._trigger_action=n=>{if(n.from_remote)return this.on_node_action({type:"update",id:n.id,node:{in_trigger:!0,error:void 0},from_remote:!0});this.workerManager.worker?.api.node.trigger_node(n.id)},this.nodespace=F1e({})}center_all(){this.reactFlowManager.rf_instance?.fitView({padding:.2})}}const U1e=()=>({libstate:mi((e,t)=>({lib:{shelves:[]},external_worker:[],set:n=>e(r=>({...r,...n})),get_lib:()=>t().lib,get_external_worker:()=>t().external_worker}))});class $1e extends eg{constructor(t){super(t),this.lib=U1e()}}class X1e extends eg{constructor(t){super(t),t.rf.logger.debug("Initializing worker manager handler"),this.workers=mi((n,r)=>({})),this.workerstate=mi((n,r)=>({is_open:!1}))}set_worker(t){t!==this.worker&&(this._unsubscribeFromWorker&&(this._unsubscribeFromWorker(),this._unsubscribeFromWorker=void 0),t?(this.context.rf.logger.debug("Setting worker in worker manager"),this._unsubscribeFromWorker=t.state.subscribe(n=>{this.workerstate.setState(n)}),this.workerstate.setState(t.state.getState())):this.context.rf.logger.debug("Removing worker in worker manager"),this.worker=t,t?.set_zustand(this.context.rf))}}class Y1e extends eg{constructor(t){super(t),this.progress_state=mi((n,r)=>({message:"please select worker",status:"info",progress:0,blocking:!1})),this.local_settings=mi((n,r)=>({view_settings:{expand_node_props:!1,expand_lib:!1}})),this.local_state=mi((n,r)=>({selected_nodes:[],selected_edges:[],selected_groups:[],funcnodescontainerRef:null}))}set_progress(t){if(t.message==="")return this.auto_progress();const n=this.progress_state.getState(),{new_obj:r,change:a}=Ud(n,t);a&&this.progress_state.setState(r)}auto_progress(){const t=this.workerManager.workermanager,n=this.workerManager.worker;if(t!==void 0&&!t.open)return this.set_progress({progress:0,message:"connecting to worker manager",status:"error",blocking:!1});if(n===void 0)return this.set_progress({progress:0,message:"please select worker",status:"error",blocking:!1});if(!n.is_open)return this.set_progress({progress:0,message:"connecting to worker",status:"info",blocking:!0});this.set_progress({progress:1,message:"running",status:"info",blocking:!1})}update_view_settings(t){cL(this.local_settings,{view_settings:t})}}const dO="1.0.0",Z1e=["1"],W1e=e=>{if(!e.v.toString().includes(".")||!Z1e.includes(e.v.toString().split(".")[0]))throw new Error(`Unsupported version: ${e.v}`);return{...e,v:dO}};class q1e extends eg{constructor(t){super(t),this.plugins=mi((n,r)=>({})),this.render_options=mi((n,r)=>({}))}add_plugin(t,n){if(n!==void 0)try{const r=W1e(n);this.plugins.setState(a=>({...a,[t]:r}))}catch(r){r instanceof Error?this.context.rf.logger.error(`Error loading plugin ${t}`,r):this.context.rf.logger.error(`Error loading plugin ${t}`,new Error(String(r))),this.stateManager.toaster?.error({title:"Error",description:`Error loading plugin ${t}: ${r instanceof Error?r.message:String(r)}`,duration:5e3})}}update_render_options(t){cL(this.render_options,t)}async add_packed_plugin(t,n){if(n.js)for(const r of n.js){const a=document.createElement("script");a.text=atob(r),document.body.appendChild(a)}if(n.css)for(const r of n.css){const a=document.createElement("style");a.innerHTML=atob(r),document.head.appendChild(a)}if(n.module!==void 0){const r=atob(n.module);try{const l=await new Function("React","FuncNodesReactFlow",`
|
|
1116
1116
|
return (async () => {
|
|
1117
1117
|
${r}
|
|
1118
1118
|
return FuncNodesPlugin;
|