@wfgraph/client 2.2.2 → 2.2.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.
|
@@ -83,19 +83,19 @@ function useAtomValueWithDelay<Value>(
|
|
|
83
83
|
body[${kz}] {
|
|
84
84
|
${Tle}: ${s}px;
|
|
85
85
|
}
|
|
86
|
-
`},Az=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Wle=function(){Y.useEffect(function(){return document.body.setAttribute(kz,(Az()+1).toString()),function(){var e=Az()-1;e<=0?document.body.removeAttribute(kz):document.body.setAttribute(kz,e.toString())}},[])},Gle=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Wle();var a=Y.useMemo(function(){return Vle(i)},[i]);return Y.createElement(Hle,{styles:Ule(a,!t,i,n?``:`!important`)})},jz=!1;if(typeof window<`u`)try{var Mz=Object.defineProperty({},"passive",{get:function(){return jz=!0,!0}});window.addEventListener(`test`,Mz,Mz),window.removeEventListener(`test`,Mz,Mz)}catch{jz=!1}var Nz=jz?{passive:!1}:!1,
|
|
86
|
+
`},Az=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Wle=function(){Y.useEffect(function(){return document.body.setAttribute(kz,(Az()+1).toString()),function(){var e=Az()-1;e<=0?document.body.removeAttribute(kz):document.body.setAttribute(kz,e.toString())}},[])},Gle=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Wle();var a=Y.useMemo(function(){return Vle(i)},[i]);return Y.createElement(Hle,{styles:Ule(a,!t,i,n?``:`!important`)})},jz=!1;if(typeof window<`u`)try{var Mz=Object.defineProperty({},"passive",{get:function(){return jz=!0,!0}});window.addEventListener(`test`,Mz,Mz),window.removeEventListener(`test`,Mz,Mz)}catch{jz=!1}var Nz=jz?{passive:!1}:!1,Kle=function(e){return e.tagName===`TEXTAREA`},Pz=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Kle(e)&&n[t]===`visible`)},Fz=function(e){return Pz(e,`overflowY`)},Iz=function(e){return Pz(e,`overflowX`)},Lz=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),Bz(e,r)){var i=Vz(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Rz=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},zz=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},Bz=function(e,t){return e===`v`?Fz(t):Iz(t)},Vz=function(e,t){return e===`v`?Rz(t):zz(t)},Hz=function(e,t){return e===`h`&&t===`rtl`?-1:1},Uz=function(e,t,n,r,i){var a=Hz(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=Vz(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&Bz(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},Wz=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Gz=function(e){return[e.deltaX,e.deltaY]},Kz=function(e){return e&&`current`in e?e.current:e},qz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jz=function(e){return`
|
|
87
87
|
.block-interactivity-${e} {pointer-events: none;}
|
|
88
88
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
89
|
-
`},Xz=0,Zz=[];function Qz(e){var t=Y.useRef([]),n=Y.useRef([0,0]),r=Y.useRef(),i=Y.useState(Xz++)[0],a=Y.useState(Dz)[0],o=Y.useRef(e);Y.useEffect(function(){o.current=e},[e]),Y.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Cle([e.lockRef.current],(e.shards||[]).map(qz),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=Y.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Gz(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Rz(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Rz(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Wz(h,t,e,h===`h`?s:c,!0)},[]),c=Y.useCallback(function(e){var n=e;if(!(!Zz.length||Zz[Zz.length-1]!==a)){var r=`deltaY`in n?Kz(n):Gz(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Jz(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(qz).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=Y.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:$z(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=Y.useCallback(function(e){n.current=Gz(e),r.current=void 0},[]),d=Y.useCallback(function(t){l(t.type,Kz(t),t.target,s(t,e.lockRef.current))},[]),f=Y.useCallback(function(t){l(t.type,Gz(t),t.target,s(t,e.lockRef.current))},[]);Y.useEffect(function(){return Zz.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Nz),document.addEventListener(`touchmove`,c,Nz),document.addEventListener(`touchstart`,u,Nz),function(){Zz=Zz.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Nz),document.removeEventListener(`touchmove`,c,Nz),document.removeEventListener(`touchstart`,u,Nz)}},[]);var p=e.removeScrollBar,m=e.inert;return Y.createElement(Y.Fragment,null,m?Y.createElement(a,{styles:Yz(i)}):null,p?Y.createElement(Gle,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function $z(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var eB=Mle(Cz,Qz),tB=Y.forwardRef(function(e,t){return Y.createElement(Tz,gz({},e,{ref:t,sideCar:eB}))});tB.classNames=Tz.classNames;var nB=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},rB=new WeakMap,iB=new WeakMap,aB={},oB=0,sB=function(e){return e&&(e.host||sB(e.parentNode))},cB=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=sB(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},lB=function(e,t,n,r){var i=cB(t,Array.isArray(e)?e:[e]);aB[n]||(aB[n]=new WeakMap);var a=aB[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(rB.get(e)||0)+1,l=(a.get(e)||0)+1;rB.set(e,c),a.set(e,l),o.push(e),c===1&&i&&iB.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),oB++,function(){o.forEach(function(e){var t=rB.get(e)-1,i=a.get(e)-1;rB.set(e,t),a.set(e,i),t||(iB.has(e)||e.removeAttribute(r),iB.delete(e)),i||e.removeAttribute(n)}),oB--,oB||(rB=new WeakMap,rB=new WeakMap,iB=new WeakMap,aB={})}},uB=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||nB(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),lB(r,i,n,`aria-hidden`)):function(){return null}},dB=Object.defineProperty,fB=(e,t)=>dB(e,`name`,{value:t,configurable:!0}),pB=`Dialog`,[mB,Kle]=lR(pB),[hB,gB]=mB(pB),_B=fB(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=Y.useRef(null),c=Y.useRef(null),[l,u]=_R({prop:r,defaultProp:i??!1,onChange:a,caller:pB}),[d,f]=Y.useState(0),[p,m]=Y.useState(0);return(0,X.jsx)(hB,{scope:t,triggerRef:s,contentRef:c,contentId:fR(),titleId:fR(),descriptionId:fR(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:Y.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),vB=`DialogTrigger`,yB=Y.forwardRef(fB(function(e,t){let{__scopeDialog:n,...r}=e,i=gB(vB,n),a=sR(t,i.triggerRef);return(0,X.jsx)(AR.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":zB(i.open),...r,ref:a,onClick:eR(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),bB=`DialogPortal`,[xB,SB]=mB(bB,{forceMount:void 0}),CB=fB(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=gB(bB,t);return(0,X.jsx)(xB,{scope:t,forceMount:n,children:Y.Children.map(r,e=>(0,X.jsx)(az,{present:n||a.open,children:(0,X.jsx)(yle,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),wB=`DialogOverlay`,TB=Y.forwardRef(fB(function(e,t){let n=SB(wB,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=gB(wB,e.__scopeDialog);return a.modal?(0,X.jsx)(az,{present:r||a.open,children:(0,X.jsx)(DB,{...i,ref:t})}):null},`DialogOverlay`)),EB=SR(`DialogOverlay.RemoveScroll`),DB=Y.forwardRef(fB(function(e,t){let{__scopeDialog:n,...r}=e,i=gB(wB,n),a=sR(t,LR());return(0,X.jsx)(tB,{as:EB,allowPinchZoom:!0,shards:[i.contentRef],children:(0,X.jsx)(AR.div,{"data-state":zB(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),OB=`DialogContent`,kB=Y.forwardRef(fB(function(e,t){let n=SB(OB,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=gB(OB,e.__scopeDialog);return(0,X.jsx)(az,{present:r||a.open,children:a.modal?(0,X.jsx)(AB,{...i,ref:t}):(0,X.jsx)(jB,{...i,ref:t})})},`DialogContent`)),AB=Y.forwardRef(fB(function(e,t){let n=gB(OB,e.__scopeDialog),r=Y.useRef(null),i=sR(t,n.contentRef,r);return Y.useEffect(()=>{let e=r.current;if(e)return uB(e)},[]),(0,X.jsx)(MB,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:eR(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:eR(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:eR(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),jB=Y.forwardRef(fB(function(e,t){let n=gB(OB,e.__scopeDialog),r=Y.useRef(!1),i=Y.useRef(!1);return(0,X.jsx)(MB,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),MB=Y.forwardRef(fB(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=gB(OB,n);return mz(),(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(_le,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(mle,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":zB(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),NB=`DialogTitle`,PB=Y.forwardRef(fB(function(e,t){let{__scopeDialog:n,...r}=e,i=gB(NB,n),{setTitleCount:a}=i;return dR(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,X.jsx)(AR.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),FB=`DialogDescription`,IB=Y.forwardRef(fB(function(e,t){let{__scopeDialog:n,...r}=e,i=gB(FB,n),{setDescriptionCount:a}=i;return dR(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,X.jsx)(AR.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),LB=`DialogClose`,RB=Y.forwardRef(fB(function(e,t){let{__scopeDialog:n,...r}=e,i=gB(LB,n);return(0,X.jsx)(AR.button,{type:`button`,...r,ref:t,onClick:eR(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function zB(e){return e?`open`:`closed`}fB(zB,`getState`);function BB(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var VB=Y.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:`bottom`,shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),HB=()=>{let e=Y.useContext(VB);if(!e)throw Error(`useDrawerContext must be used within a Drawer.Root`);return e};BB(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
89
|
+
`},Yz=0,Xz=[];function Zz(e){var t=Y.useRef([]),n=Y.useRef([0,0]),r=Y.useRef(),i=Y.useState(Yz++)[0],a=Y.useState(Dz)[0],o=Y.useRef(e);Y.useEffect(function(){o.current=e},[e]),Y.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Cle([e.lockRef.current],(e.shards||[]).map(Kz),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=Y.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Wz(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Lz(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Lz(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return Uz(h,t,e,h===`h`?s:c,!0)},[]),c=Y.useCallback(function(e){var n=e;if(!(!Xz.length||Xz[Xz.length-1]!==a)){var r=`deltaY`in n?Gz(n):Wz(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&qz(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Kz).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=Y.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Qz(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=Y.useCallback(function(e){n.current=Wz(e),r.current=void 0},[]),d=Y.useCallback(function(t){l(t.type,Gz(t),t.target,s(t,e.lockRef.current))},[]),f=Y.useCallback(function(t){l(t.type,Wz(t),t.target,s(t,e.lockRef.current))},[]);Y.useEffect(function(){return Xz.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Nz),document.addEventListener(`touchmove`,c,Nz),document.addEventListener(`touchstart`,u,Nz),function(){Xz=Xz.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Nz),document.removeEventListener(`touchmove`,c,Nz),document.removeEventListener(`touchstart`,u,Nz)}},[]);var p=e.removeScrollBar,m=e.inert;return Y.createElement(Y.Fragment,null,m?Y.createElement(a,{styles:Jz(i)}):null,p?Y.createElement(Gle,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Qz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var $z=Mle(Cz,Zz),eB=Y.forwardRef(function(e,t){return Y.createElement(Tz,gz({},e,{ref:t,sideCar:$z}))});eB.classNames=Tz.classNames;var tB=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},nB=new WeakMap,rB=new WeakMap,iB={},aB=0,oB=function(e){return e&&(e.host||oB(e.parentNode))},sB=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=oB(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},cB=function(e,t,n,r){var i=sB(t,Array.isArray(e)?e:[e]);iB[n]||(iB[n]=new WeakMap);var a=iB[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(nB.get(e)||0)+1,l=(a.get(e)||0)+1;nB.set(e,c),a.set(e,l),o.push(e),c===1&&i&&rB.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),aB++,function(){o.forEach(function(e){var t=nB.get(e)-1,i=a.get(e)-1;nB.set(e,t),a.set(e,i),t||(rB.has(e)||e.removeAttribute(r),rB.delete(e)),i||e.removeAttribute(n)}),aB--,aB||(nB=new WeakMap,nB=new WeakMap,rB=new WeakMap,iB={})}},lB=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||tB(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),cB(r,i,n,`aria-hidden`)):function(){return null}},uB=Object.defineProperty,dB=(e,t)=>uB(e,`name`,{value:t,configurable:!0}),fB=`Dialog`,[pB,qle]=lR(fB),[mB,hB]=pB(fB),gB=dB(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=Y.useRef(null),c=Y.useRef(null),[l,u]=_R({prop:r,defaultProp:i??!1,onChange:a,caller:fB}),[d,f]=Y.useState(0),[p,m]=Y.useState(0);return(0,X.jsx)(mB,{scope:t,triggerRef:s,contentRef:c,contentId:fR(),titleId:fR(),descriptionId:fR(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:Y.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),_B=`DialogTrigger`,vB=Y.forwardRef(dB(function(e,t){let{__scopeDialog:n,...r}=e,i=hB(_B,n),a=sR(t,i.triggerRef);return(0,X.jsx)(AR.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":RB(i.open),...r,ref:a,onClick:eR(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),yB=`DialogPortal`,[bB,xB]=pB(yB,{forceMount:void 0}),SB=dB(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=hB(yB,t);return(0,X.jsx)(bB,{scope:t,forceMount:n,children:Y.Children.map(r,e=>(0,X.jsx)(az,{present:n||a.open,children:(0,X.jsx)(yle,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),CB=`DialogOverlay`,wB=Y.forwardRef(dB(function(e,t){let n=xB(CB,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hB(CB,e.__scopeDialog);return a.modal?(0,X.jsx)(az,{present:r||a.open,children:(0,X.jsx)(EB,{...i,ref:t})}):null},`DialogOverlay`)),TB=SR(`DialogOverlay.RemoveScroll`),EB=Y.forwardRef(dB(function(e,t){let{__scopeDialog:n,...r}=e,i=hB(CB,n),a=sR(t,LR());return(0,X.jsx)(eB,{as:TB,allowPinchZoom:!0,shards:[i.contentRef],children:(0,X.jsx)(AR.div,{"data-state":RB(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),DB=`DialogContent`,OB=Y.forwardRef(dB(function(e,t){let n=xB(DB,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=hB(DB,e.__scopeDialog);return(0,X.jsx)(az,{present:r||a.open,children:a.modal?(0,X.jsx)(kB,{...i,ref:t}):(0,X.jsx)(AB,{...i,ref:t})})},`DialogContent`)),kB=Y.forwardRef(dB(function(e,t){let n=hB(DB,e.__scopeDialog),r=Y.useRef(null),i=sR(t,n.contentRef,r);return Y.useEffect(()=>{let e=r.current;if(e)return lB(e)},[]),(0,X.jsx)(jB,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:eR(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:eR(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:eR(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),AB=Y.forwardRef(dB(function(e,t){let n=hB(DB,e.__scopeDialog),r=Y.useRef(!1),i=Y.useRef(!1);return(0,X.jsx)(jB,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),jB=Y.forwardRef(dB(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=hB(DB,n);return mz(),(0,X.jsx)(X.Fragment,{children:(0,X.jsx)(_le,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,X.jsx)(mle,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":RB(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),MB=`DialogTitle`,NB=Y.forwardRef(dB(function(e,t){let{__scopeDialog:n,...r}=e,i=hB(MB,n),{setTitleCount:a}=i;return dR(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,X.jsx)(AR.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),PB=`DialogDescription`,FB=Y.forwardRef(dB(function(e,t){let{__scopeDialog:n,...r}=e,i=hB(PB,n),{setDescriptionCount:a}=i;return dR(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,X.jsx)(AR.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),IB=`DialogClose`,LB=Y.forwardRef(dB(function(e,t){let{__scopeDialog:n,...r}=e,i=hB(IB,n);return(0,X.jsx)(AR.button,{type:`button`,...r,ref:t,onClick:eR(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function RB(e){return e?`open`:`closed`}dB(RB,`getState`);function zB(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var BB=Y.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:`bottom`,shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),VB=()=>{let e=Y.useContext(BB);if(!e)throw Error(`useDrawerContext must be used within a Drawer.Root`);return e};zB(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
90
90
|
[data-state=closed]
|
|
91
|
-
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function UB(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function WB(){return YB(/^Mac/)}function GB(){return YB(/^iPhone/)}function KB(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function qB(){return YB(/^iPad/)||WB()&&navigator.maxTouchPoints>1}function JB(){return GB()||qB()}function YB(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var XB=24,ZB=typeof window<`u`?Y.useLayoutEffect:Y.useEffect;function QB(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var $B=typeof document<`u`&&window.visualViewport;function eV(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function tV(e){for(eV(e)&&(e=e.parentElement);e&&!eV(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var nV=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),rV=0,iV;function aV(e={}){let{isDisabled:t}=e;ZB(()=>{if(!t)return rV++,rV===1&&JB()&&(iV=oV()),()=>{rV--,rV===0&&iV?.()}},[t])}function oV(){let e,t=0,n=n=>{e=tV(n.target),(e!==document.documentElement||e!==document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;uV(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;uV(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,$B&&($B.height<window.innerHeight?requestAnimationFrame(()=>{lV(t)}):$B.addEventListener(`resize`,()=>lV(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=QB(sV(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=QB(cV(document,`touchstart`,n,{passive:!1,capture:!0}),cV(document,`touchmove`,r,{passive:!1,capture:!0}),cV(document,`touchend`,i,{passive:!1,capture:!0}),cV(document,`focus`,a,!0),cV(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function sV(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function cV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function lV(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=tV(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+XB&&(t.scrollTop+=r-n)}e=t.parentElement}}function uV(e){return e instanceof HTMLInputElement&&!nV.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function dV(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function fV(...e){return t=>e.forEach(e=>dV(e,t))}function pV(...e){return Y.useCallback(fV(...e),e)}var mV=new WeakMap;function hV(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&mV.set(e,r)}function gV(e,t){if(!e||!(e instanceof HTMLElement))return;let n=mV.get(e);n&&(e.style[t]=n[t])}var _V=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function vV(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[_V(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[_V(t)?5:4]):null)}function yV(e){return 8*(Math.log(e+1)-2)}function bV(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var xV={DURATION:.5,EASE:[.32,.72,0,1]},SV=.4,CV=.25,wV=100,TV=8,EV=16,DV=26,OV=`vaul-dragging`;function kV(e){let t=Y.useRef(e);return Y.useEffect(()=>{t.current=e}),Y.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function AV({defaultProp:e,onChange:t}){let n=Y.useState(e),[r]=n,i=Y.useRef(r),a=kV(t);return Y.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function jV({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=AV({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=kV(n);return[o,Y.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function MV({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=jV({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=Y.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);Y.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=Y.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=Y.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=Y.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),_V(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=Y.useMemo(()=>h===null?null:_?.[h],[_,h]),y=Y.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),hV(r.current,{transition:`transform ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`,transform:_V(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?hV(i.current,{transition:`opacity ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`,opacity:`0`}):hV(i.current,{transition:`opacity ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);Y.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&hV(i.current,{transition:`opacity ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=_V(s)?window.innerHeight:window.innerWidth;if(r>SV&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||hV(r.current,{transform:_V(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function NV(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=HB(),a=Y.useRef(null),o=(0,Y.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-DV)/window.innerWidth}Y.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&bV(document.body,{background:`black`}),bV(t,{transformOrigin:_V(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${xV.DURATION}s`,transitionTimingFunction:`cubic-bezier(${xV.EASE.join(`,`)})`});let n=bV(t,{borderRadius:`${TV}px`,overflow:`hidden`,..._V(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},xV.DURATION*1e3)}}},[t,n,o])}var PV=null;function FV({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=Y.useState(()=>typeof window<`u`?window.location.href:``),c=Y.useRef(0),l=Y.useCallback(()=>{if(KB()&&PV===null&&e&&!a){PV={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=Y.useCallback(()=>{if(KB()&&PV!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,PV),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),PV=null}},[o]);return Y.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),Y.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),Y.useEffect(()=>{n||!r||(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function IV({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=CV,scrollLockTimeout:l=wV,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:O=!1}){let[k=!1,A]=jV({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&de(),setTimeout(()=>{E?.(e)},xV.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[j,M]=Y.useState(!1),[N,P]=Y.useState(!1),[F,I]=Y.useState(!1),L=Y.useRef(null),R=Y.useRef(null),z=Y.useRef(null),B=Y.useRef(null),V=Y.useRef(null),H=Y.useRef(!1),U=Y.useRef(null),W=Y.useRef(0),G=Y.useRef(!1),K=Y.useRef(!x),q=Y.useRef(0),J=Y.useRef(null),ee=Y.useRef(J.current?.getBoundingClientRect().height||0),te=Y.useRef(J.current?.getBoundingClientRect().width||0),ne=Y.useRef(0),{activeSnapPoint:re,activeSnapPointIndex:ie,setActiveSnapPoint:ae,onRelease:oe,snapPointsOffset:se,onDrag:ce,shouldFade:le,getPercentageDragged:ue}=MV({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:J,fadeFromIndex:f,overlayRef:L,onSnapPointChange:Y.useCallback(e=>{a&&e===se.length-1&&(R.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});aV({isDisabled:!k||N||!g||F||!j||!T||!S});let{restorePositionSetting:de}=FV({isOpen:k,modal:g,nested:v??!1,hasBeenOpened:j,preventScrollRestoration:w,noBodyStyles:y});function fe(){return(window.innerWidth-DV)/window.innerWidth}function pe(e){!u&&!a||J.current&&!J.current.contains(e.target)||(ee.current=J.current?.getBoundingClientRect().height||0,te.current=J.current?.getBoundingClientRect().width||0,P(!0),z.current=new Date,JB()&&window.addEventListener(`touchend`,()=>H.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),W.current=_V(b)?e.pageY:e.pageX)}function me(e,t){let n=e,r=window.getSelection()?.toString(),i=J.current?vV(J.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(R.current&&a.getTime()-R.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(V.current&&a.getTime()-V.current.getTime()<l&&i===0||t)return V.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return V.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function he(e){if(J.current&&N){let t=b===`bottom`||b===`right`?1:-1,n=(W.current-(_V(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&ie===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?ee.current:te.current),p=ue(c,i);if(p!==null&&(d=p),s&&d>=1||!H.current&&!me(e.target,i))return;if(J.current.classList.add(OV),H.current=!0,hV(J.current,{transition:`none`}),hV(L.current,{transition:`none`}),a&&ce({draggedDistance:n}),i&&!a){let e=yV(n),r=Math.min(e*-1,0)*t;hV(J.current,{transform:_V(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((le||f&&ie===f-1)&&(r?.(e,d),hV(L.current,{opacity:`${m}`,transition:`none`},!0)),l&&L.current&&o){let e=Math.min(fe()+d*(1-fe()),1),t=8-d*8,n=Math.max(0,14-d*14);hV(l,{borderRadius:`${t}px`,transform:_V(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;hV(J.current,{transform:_V(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}Y.useEffect(()=>{window.requestAnimationFrame(()=>{K.current=!0})},[]),Y.useEffect(()=>{var e;function t(){if(!J.current||!T)return;let e=document.activeElement;if(uV(e)||G.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=J.current.getBoundingClientRect().height||0,i=r>t*.8;ne.current||=r;let o=J.current.getBoundingClientRect().top;if(Math.abs(q.current-n)>60&&(G.current=!G.current),a&&a.length>0&&se&&ie){let e=se[ie]||0;n+=e}if(q.current=n,r>e||G.current){let t=J.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:DV)),h?J.current.style.height=`${t-Math.max(n,0)}px`:J.current.style.height=`${Math.max(r,e-o)}px`}else UB()||(J.current.style.height=`${ne.current}px`);a&&a.length>0&&!G.current?J.current.style.bottom=`0px`:J.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[ie,a,se]);function ge(e){ve(),_?.(),e||A(!1),setTimeout(()=>{a&&ae(a[0])},xV.DURATION*1e3)}function _e(){if(!J.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=vV(J.current,b);hV(J.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`}),hV(L.current,{transition:`opacity ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&k&&hV(e,{borderRadius:`${TV}px`,overflow:`hidden`,..._V(b)?{transform:`scale(${fe()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${fe()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${xV.DURATION}s`,transitionTimingFunction:`cubic-bezier(${xV.EASE.join(`,`)})`},!0)}function ve(){!N||!J.current||(J.current.classList.remove(OV),H.current=!1,P(!1),B.current=new Date)}function ye(e){if(!N||!J.current)return;J.current.classList.remove(OV),H.current=!1,P(!1),B.current=new Date;let t=vV(J.current,b);if(!e||!me(e.target,!1)||!t||Number.isNaN(t)||z.current===null)return;let n=B.current.getTime()-z.current.getTime(),r=W.current-(_V(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(I(!0),setTimeout(()=>{I(!1)},200)),a){oe({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:ge,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){_e(),i?.(e,!0);return}if(o>SV){ge(),i?.(e,!1);return}let s=Math.min(J.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(J.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){ge(),i?.(e,!1);return}i?.(e,!0),_e()}Y.useEffect(()=>(k&&(hV(document.documentElement,{scrollBehavior:`auto`}),R.current=new Date),()=>{gV(document.documentElement,`scrollBehavior`)}),[k]);function be(e){let t=e?(window.innerWidth-EV)/window.innerWidth:1,n=e?-16:0;U.current&&window.clearTimeout(U.current),hV(J.current,{transition:`transform ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`,transform:_V(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&J.current&&(U.current=setTimeout(()=>{let e=vV(J.current,b);hV(J.current,{transition:`none`,transform:_V(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function xe(e,t){if(t<0)return;let n=(window.innerWidth-EV)/window.innerWidth,r=n+t*(1-n),i=-16+t*EV;hV(J.current,{transform:_V(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function Se(e,t){let n=_V(b)?window.innerHeight:window.innerWidth,r=t?(n-EV)/n:1,i=t?-16:0;t&&hV(J.current,{transition:`transform ${xV.DURATION}s cubic-bezier(${xV.EASE.join(`,`)})`,transform:_V(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return Y.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),Y.createElement(_B,{defaultOpen:x,onOpenChange:e=>{!u&&!e||(e?M(!0):ge(!0),A(e))},open:k},Y.createElement(VB.Provider,{value:{activeSnapPoint:re,snapPoints:a,setActiveSnapPoint:ae,drawerRef:J,overlayRef:L,onOpenChange:t,onPress:pe,onRelease:ye,onDrag:he,dismissible:u,shouldAnimate:K,handleOnly:d,isOpen:k,isDragging:N,shouldFade:le,closeDrawer:ge,onNestedDrag:xe,onNestedOpenChange:be,onNestedRelease:Se,keyboardIsOpen:G,modal:g,snapPointsOffset:se,activeSnapPointIndex:ie,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:O}},n))}var LV=Y.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=HB(),l=pV(t,n),u=r&&r.length>0;if(!s)return null;let d=Y.useCallback(e=>i(e),[i]);return Y.createElement(TB,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});LV.displayName=`Drawer.Overlay`;var RV=Y.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=HB(),[b,x]=Y.useState(!1),S=pV(i,a),C=Y.useRef(null),w=Y.useRef(null),T=Y.useRef(!1),E=h&&h.length>0;NV();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};Y.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function O(e){C.current=null,T.current=!1,s(e)}return Y.createElement(kB,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),O(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&O(w.current)}})});RV.displayName=`Drawer.Content`;var zV=250,BV=120,VV=Y.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=HB(),m=Y.useRef(null),h=Y.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},BV)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},zV)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return Y.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},Y.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});VV.displayName=`Drawer.Handle`;function HV({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=HB();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return Y.createElement(IV,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function UV(e){let t=HB(),{container:n=t.container,...r}=e;return Y.createElement(CB,{container:n,...r})}var WV={Root:IV,NestedRoot:HV,Content:RV,Overlay:LV,Trigger:yB,Portal:UV,Handle:VV,Close:RB,Title:PB,Description:IB},GV=Y.createContext(void 0);function KV(e){let t=Y.useContext(GV);if(!e&&t===void 0)throw Error(Gg(27));return t}var qV=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),JV={"data-starting-style":``},YV={"data-ending-style":``},XV={transitionStatus(e){return e===`starting`?JV:e===`ending`?YV:null}};(function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=qV.startingStyle]=`startingStyle`,e[e.endingStyle=qV.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e})({});var ZV={"data-popup-open":``},QV={"data-popup-open":``,"data-pressed":``},$V={"data-open":``},eH={"data-closed":``},tH={"data-anchor-hidden":``},nH={open(e){return e?ZV:null}},rH={open(e){return e?QV:null}},iH={open(e){return e?$V:eH},anchorHidden(e){return e?tH:null}},aH={...iH,...XV},oH=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=KV(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return o_(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:aH,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),sH=`none`,cH=`trigger-press`,lH=`trigger-hover`,uH=`trigger-focus`,dH=`outside-press`,fH=`item-press`,pH=`close-press`,mH=`input-change`,hH=`input-clear`,gH=`input-press`,_H=`focus-out`,vH=`escape-key`,yH=`list-navigation`,bH=`keyboard`,xH=`pointer`,SH=`cancel-open`,CH=`sibling-open`,wH=`disabled`,TH=`imperative-action`,EH=`window-resize`;function DH(e,t,n,r){let i=!1,a=!1,o=r??a_;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function OH(e,t,n){let r=n??a_;return{reason:e,event:t??new Event(`base-ui`),...r}}var kH=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=KV(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Xg({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,DH(pH,e.nativeEvent))}return o_(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),AH=0;function jH(e,t=`mui`){let[n,r]=Y.useState(e),i=e||n;return Y.useEffect(()=>{n??(AH+=1,r(`${t}-${AH}`))},[n,t]),i}var MH=wg.useId;function NH(e,t){if(MH!==void 0){let n=MH();return e??(t?`${t}-${n}`:n)}return jH(e,t)}function PH(e){return NH(e,`base-ui`)}var FH=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=KV(),c=PH(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),o_(`p`,e,{ref:t,props:[{id:c},o]})});function IH(e){Y.useEffect(e,i_)}var LH=0,RH=class e{static create(){return new e}currentId=LH;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=LH,t()},e)}isStarted(){return this.currentId!==LH}clear=()=>{this.currentId!==LH&&(clearTimeout(this.currentId),this.currentId=LH)};disposeEffect=()=>this.clear};function zH(){let e=Eg(RH.create).current;return IH(e.disposeEffect),e}function BH(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:VH,platform:HH,maxTouchPoints:UH}=BH(),WH=VH.toLowerCase(),GH=HH.toLowerCase(),KH=/^i(os$|p)/.test(GH)||GH===`macintel`&&UH>1,qH=`android`,JH=GH===qH||WH.includes(qH),YH=!KH&&GH.startsWith(`mac`);GH.startsWith(`win`),!JH&&/^(linux|chrome os)/.test(GH);var XH=YH||KH,ZH=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),QH=!ZH&&WH.includes(`firefox`);!ZH&&WH.includes(`chrom`);var $H=XH,eU=/jsdom|happydom/.test(WH);function tU(e){e.preventDefault(),e.stopPropagation()}function nU(e){return`nativeEvent`in e}function rU(e){return e.pointerType===``&&e.isTrusted?!0:JH&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function iU(e){return eU?!1:!JH&&e.width===0&&e.height===0||JH&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function aU(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function oU(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var sU=`data-base-ui-focusable`,cU=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,lU=`ArrowLeft`,uU=`ArrowRight`,dU=`ArrowUp`,fU=`ArrowDown`;function pU(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function mU(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&og(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function hU(e){return`composedPath`in e?e.composedPath()[0]:e.target}function gU(e,t){if(!ig(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(mU(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function _U(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function vU(e){return e.matches(`html,body`)}function yU(e){return ag(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function bU(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${cU}`)!=null}function xU(e){return e?e.getAttribute(`role`)===`combobox`&&yU(e):!1}function SU(e){if(!e||eU)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function CU(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function wU(e,t){return t!=null&&!aU(t)?0:typeof e==`function`?e():e}function TU(e,t,n){let r=wU(e,n);return typeof r==`number`?r:r?.[t]}function EU(e){return typeof e==`function`?e():e}function DU(e,t){return t||e===`click`||e===`mousedown`}function OU(e){return e?.includes(`mouse`)&&e!==`mousedown`}var kU=Y.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new RH,currentIdRef:{current:null},currentContextRef:{current:null}});function AU(e,t){e.current=t.current}function jU(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Y.useRef(n),a=Y.useRef(n),o=Y.useRef(null),s=Y.useRef(null),c=zH();return Mg(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:TU(i.current,`open`),close:TU(n,`close`)}},[n,o,i,a]),(0,X.jsx)(kU.Provider,{value:Y.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function MU(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Y.useContext(kU),[f,p]=Y.useState(!1),m=Y.useRef(n);return Mg(()=>{m.current=n},[n]),Mg(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),Mg(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:TU(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,DH(sH))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),Mg(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,AU(o,c),d.clear()}},[l,a,o,i,c,d]),Y.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function NU(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function PU(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function FU(e){let t=Eg(IU,e).current;return t.next=e,Mg(t.effect),t}function IU(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var LU=null;globalThis.requestAnimationFrame;var RU=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},zU=class e{static create(){return new e}static request(e){return RU.request(e)}static cancel(e){return RU.cancel(e)}currentId=LU;request(e){this.cancel(),this.currentId=RU.request(()=>{this.currentId=LU,e()})}cancel=()=>{this.currentId!==LU&&(RU.cancel(this.currentId),this.currentId=LU)};disposeEffect=()=>this.cancel};function BU(){let e=Eg(zU.create).current;return IH(e.disposeEffect),e}var VU={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},HU={...VU,position:`fixed`,top:0,left:0},UU={...VU,position:`absolute`},WU=Y.forwardRef(function(e,t){let[n,r]=Y.useState();Mg(()=>{$H&&ZH&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:HU,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),GU=Math.min,KU=Math.max,qU=Math.round,JU=Math.floor,YU=e=>({x:e,y:e}),XU={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ZU(e,t,n){return KU(e,GU(t,n))}function QU(e,t){return typeof e==`function`?e(t):e}function $U(e){return e.split(`-`)[0]}function eW(e){return e.split(`-`)[1]}function tW(e){return e===`x`?`y`:`x`}function nW(e){return e===`y`?`height`:`width`}function rW(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function iW(e){return tW(rW(e))}function aW(e,t,n){n===void 0&&(n=!1);let r=eW(e),i=iW(e),a=nW(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=mW(o)),[o,mW(o)]}function oW(e){let t=mW(e);return[sW(e),t,sW(t)]}function sW(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var cW=[`left`,`right`],lW=[`right`,`left`],uW=[`top`,`bottom`],dW=[`bottom`,`top`];function fW(e,t,n){switch(e){case`top`:case`bottom`:return n?t?lW:cW:t?cW:lW;case`left`:case`right`:return t?uW:dW;default:return[]}}function pW(e,t,n,r){let i=eW(e),a=fW($U(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(sW)))),a}function mW(e){let t=$U(e);return XU[t]+e.slice(t.length)}function hW(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function gW(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:hW(e)}function _W(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function vW(e,t,n){return Math.floor(e/t)!==n}function yW(e,t){return t<0||t>=e.length}function bW(e,t){return SW(e.current,{disabledIndices:t})}function xW(e,t){return SW(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function SW(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&wW(e,a,r));return a}function CW(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1),r=i(t,u,n[o][e]??n[o][0]);o=a[r]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!wW(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=JU(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!wW(e,r,s))return r}};d&&tU(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=SW(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=SW(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}yW(e,f)&&(f=u)}if(n===`both`){let n=JU(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&tU(t),u%o===o-1?r&&(f=SW(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=SW(e,{startingIndex:u,disabledIndices:s}),r&&vW(f,o,n)&&(f=SW(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),vW(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&tU(t),u%o===0?r&&(f=SW(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=SW(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&vW(f,o,n)&&(f=SW(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),vW(f,o,n)&&(f=u));let c=JU(l/o)===n;yW(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:SW(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function wW(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!EW(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function TW(e){return e.visibility===`hidden`||e.visibility===`collapse`}function EW(e,t=e?vg(e):null){return!e||!e.isConnected||!t||TW(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var DW=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function OW(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return og(n)?n.host:null}function kW(e){for(let t of Array.from(e.children))if(eg(t)===`summary`)return t;return null}function AW(e,t){let n=kW(t);return!!n&&(e===n||mU(n,e))}function jW(e){let t=e?eg(e):``;return e!=null&&e.matches(DW)&&(t!==`summary`||e.parentElement!=null&&eg(e.parentElement)===`details`&&kW(e.parentElement)===e)&&(t!==`details`||kW(e)==null)&&(t!==`input`||e.type!==`hidden`)}function MW(e){if(!jW(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=OW(t)){let n=t!==e,r=eg(t)===`slot`;if(t.hasAttribute(`inert`)||n&&eg(t)===`details`&&!t.open&&!AW(e,t)||t.hasAttribute(`hidden`)||!r&&!NW(t,n))return!1}return!0}function NW(e,t){let n=vg(e);return t?n.display!==`none`:EW(e,n)}function PW(e){let t=e.tabIndex;if(t<0){let t=eg(e);if(t===`details`||t===`audio`||t===`video`||ag(e)&&e.isContentEditable)return 0}return t}function FW(e){if(eg(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function IW(e,t){let n=FW(e);if(!n)return!0;let r=t.find(e=>{let t=FW(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=FW(e);return t?.name===n.name&&t.form===n.form})===n}function LW(e){if(ag(e)&&eg(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return ag(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function RW(e,t){LW(e).forEach(e=>{jW(e)&&t.push(e),RW(e,t)})}function zW(e,t,n){LW(e).forEach(e=>{ag(e)&&e.matches(t)&&n.push(e),zW(e,t,n)})}function BW(e){return MW(e)&&PW(e)>=0}function VW(e){let t=[];return RW(e,t),t.filter(MW)}function HW(e){let t=VW(e);return t.filter(e=>PW(e)>=0&&IW(e,t))}function UW(e,t){let n=HW(e),r=n.length;if(r===0)return;let i=pU(Jg(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function WW(e){return UW(Jg(e).body,1)||e}function GW(e){return UW(Jg(e).body,-1)||e}function KW(e,t){if(!e)return null;let n=HW(Jg(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function qW(e){return KW(e,1)}function JW(e){return KW(e,-1)}function YW(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!mU(n,r)}function XW(e){HW(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function ZW(e){let t=[];zW(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function QW(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...QW(e,t.id,n)])}function $W(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function eG(e){return`data-base-ui-${e}`}var tG=0;function nG(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(tG);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),r_;let o=requestAnimationFrame(a);return tG=o,()=>{tG===o&&(cancelAnimationFrame(o),tG=0)}}var rG={inert:new WeakMap,"aria-hidden":new WeakMap},iG=`data-base-ui-inert`,aG={inert:new WeakSet,"aria-hidden":new WeakSet},oG=new WeakMap,sG=0;function cG(e){return aG[e]}function lG(e){return e?og(e)?e.host:lG(e.parentNode):null}var uG=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=lG(t);return e.contains(n)?n:null}).filter(e=>e!=null),dG=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},fG=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{eg(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function pG(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=uG(t,e),l=i?fG(t,dG(c),new Set(c)):[],u=[],d=[];if(a){let e=rG[a],n=cG(a);s=n,o=e;let r=uG(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);fG(t,dG(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(oG.get(e)||0)+1;oG.set(e,t),d.push(e),t===1&&e.setAttribute(iG,``)}),sG+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(oG.get(e)||0)-1;oG.set(e,t),t||e.removeAttribute(iG)}),--sG,sG||(rG.inert=new WeakMap,rG[`aria-hidden`]=new WeakMap,aG.inert=new WeakSet,aG[`aria-hidden`]=new WeakSet,oG=new WeakMap)}}function mG(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Jg(e[0]).body;return pG(e,a,n,r,{mark:i})}var hG={style:{transition:`none`}},gG={fallbackAxisSide:`none`},_G={fallbackAxisSide:`end`},vG={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},yG=Y.createContext(null),bG=()=>Y.useContext(yG),xG=eG(`portal`);function SG(e={}){let{ref:t,container:n,componentProps:r=a_,elementProps:i}=e,a=NH(),o=bG()?.portalNode,[s,c]=Y.useState(null),[l,u]=Y.useState(null),d=kg(e=>{e!==null&&u(e)}),f=Y.useRef(null);Mg(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(rg(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=o_(`div`,r,{ref:[t,d],props:[{id:a,[xG]:``},i]}),m=s&&p?Xi.createPortal(p,s):null;return{node:l,nodeId:Y.isValidElement(p)?p.props.id:void 0,subtree:m}}var CG=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,...s}=e,{node:c,nodeId:l,subtree:u}=SG({container:o,ref:t,componentProps:e,elementProps:s}),d=Y.useRef(null),f=Y.useRef(null),p=Y.useRef(null),m=Y.useRef(null),[h,g]=Y.useState(null),_=Y.useRef(!1),v=h?.modal,y=h?.open,b=!!h&&!h.modal&&h.open&&!!c;Y.useEffect(()=>{if(!c||v)return;function e(e){c&&e.relatedTarget&&YW(e)&&(e.type===`focusin`?_.current&&=(ZW(c),!1):(XW(c),_.current=!0))}return PU(NU(c,`focusin`,e,!0),NU(c,`focusout`,e,!0))},[c,v]),Mg(()=>{!c||y!==!0||!_.current||(ZW(c),_.current=!1)},[y,c]);let x=Y.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:g}),[c]);return(0,X.jsxs)(Y.Fragment,{children:[u,(0,X.jsxs)(yG.Provider,{value:x,children:[b&&c&&(0,X.jsx)(WU,{"data-type":`outside`,ref:d,onFocus:e=>{YW(e,c)?p.current?.focus():GW(h?h.domReference:null)?.focus()}}),b&&c&&(0,X.jsx)(`span`,{"aria-owns":l,style:vG}),c&&Xi.createPortal(a,c),b&&c&&(0,X.jsx)(WU,{"data-type":`outside`,ref:f,onFocus:e=>{YW(e,c)?m.current?.focus():(WW(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,DH(`focus-out`,e.nativeEvent)))}})]})]})});function wG(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var TG=class{nodesRef={current:[]};events=wG();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},EG=Y.createContext(null),DG=Y.createContext(null),OG=()=>Y.useContext(EG)?.id||null,kG=e=>{let t=Y.useContext(DG);return e??t};function AG(e){let t=NH(),n=kG(e),r=OG();return Mg(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function jG(e){let{children:t,id:n}=e,r=OG();return(0,X.jsx)(EG.Provider,{value:Y.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function MG(e){let{children:t,externalTree:n}=e,r=Eg(()=>n??new TG).current;return(0,X.jsx)(DG.Provider,{value:r,children:t})}function NG(e){return e==null?e:`current`in e?e.current:e}function PG(e,t){let n=tg(hU(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var FG=20,IG=[];function LG(){IG=IG.filter(e=>e.deref()?.isConnected)}function RG(e){LG(),e&&eg(e)!==`body`&&(IG.push(new WeakRef(e)),IG.length>FG&&(IG=IG.slice(-20)))}function zG(){return LG(),IG[IG.length-1]?.deref()}function BG(e){return e?BW(e)?e:HW(e)[0]||e:null}function VG(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=VW(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return BW(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function HG(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=kg(()=>b.current.floatingContext?.nodeId),S=i===!1,C=xU(_)&&S,w=FU(i),T=FU(a),E=FU(l),D=FU(g),O=kG(p),k=bG(),A=Y.useRef(!1),j=Y.useRef(!1),M=Y.useRef(!1),N=Y.useRef(null),P=Y.useRef(``),F=Y.useRef(``),I=Y.useRef(null),L=Y.useRef(null),R=Qg(I,f,k?.beforeInsideRef),z=Qg(L,k?.afterInsideRef),B=zH(),V=zH(),H=BU(),U=k!=null,W=CU(v),G=kg((e=W)=>e?HW(e):[]),K=kg(()=>m?.().filter(e=>e!=null)??[]);Y.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&mU(W,pU(Jg(W)))&&G().length===0&&!C&&tU(e)}return NU(Jg(W),`keydown`,e)},[r,W,s,C,G]),Y.useEffect(()=>{if(r||!g)return;let e=Jg(W);function t(){M.current=!1}function n(e){let t=hU(e),n=K(),r=mU(v,t)||mU(_,t)||mU(k?.portalNode,t)||n.some(e=>e===t||mU(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,V.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return PU(NU(e,`pointerdown`,n,!0),NU(e,`pointerup`,t,!0),NU(e,`pointercancel`,t,!0),NU(e,`keydown`,i,!0),t)},[r,v,_,W,g,k,V,K]),Y.useEffect(()=>{if(r||!c)return;let e=Jg(W);function t(){j.current=!0,V.start(0,()=>{j.current=!1})}function n(e){let t=hU(e);BW(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=hU(t);s&&n==null&&i!=null&&mU(v,i)&&RG(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=K(),f=n?.hasAttribute(eG(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,NG(d),NG(u)].includes(n),p=!(mU(_,n)||mU(v,n)||mU(n,v)||mU(k?.portalNode,n)||l.some(e=>e===n||mU(e,n))||c.hasMatchingElement(e=>mU(e,n))||f||O&&(QW(O.nodesRef.current,a).find(e=>mU(e.context?.elements.floating,n)||mU(e.context?.elements.domReference,n))||$W(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,CU(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&W&&VG(W),o&&r!==_&&!EW(i)&&pU(e)===e.body){if(ag(W)&&(W.focus(),o===`popup`)){H.request(()=>{W.focus()});return}let e=G(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||W;ag(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!j.current&&(C||n!==zG())&&(A.current=!0,h.setOpen(!1,DH(_H,t)))})}function a(){M.current||(b.current.insideReactTree=!0,B.start(0,()=>{b.current.insideReactTree=!1}))}let l=ag(_)?_:null;if(!(!v&&!l))return PU(l&&NU(l,`focusout`,i),l&&NU(l,`pointerdown`,t),v&&NU(v,`focusin`,n),v&&NU(v,`focusout`,i),v&&k&&NU(v,`focusout`,a,!0))},[r,_,v,W,s,O,k,h,c,o,G,C,x,b,B,V,H,u,d,K]),Y.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${eG(`portal`)}]`)||[]),t=(O?$W(O.nodesRef.current,x()):[]).find(e=>xU(e.context?.elements.domReference||null))?.context?.elements.domReference,n=mG([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...K(),t,NG(d),NG(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=mG([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,K]),Mg(()=>{if(!g||r||!ag(W))return;P.current=``,F.current=``;let e=Jg(W),t=pU(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||mU(W,t))return;let i=null,a=()=>(i??=G(W),i[0]||W),o;o=r===!0||r===null?a():NG(r),o||=a();let s=mU(W,pU(e));nG(o,{preventScroll:o===W,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=pU(e);return!(t!==o&&mU(W,t))}})})},[r,g,W,G,w,E,D]),Mg(()=>{if(r||!W)return;let e=Jg(W),t=pU(e),n=E.current==null;RG(t);function i(e){if(e.open||(P.current=PG(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(rU(e.nativeEvent)||iU(e.nativeEvent))A.current=!1;else{let e=!1;Jg(W).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&eg(t)!==`body`?t:null,s=n?o||a:a||o;return s||=zG()||null,typeof i==`boolean`?s:NG(i)||s||null}return()=>{y.off(`openchange`,i);let t=pU(e),n=K(),r=mU(v,t)||n.some(e=>e===t||mU(e,t))||O&&QW(O.nodesRef.current,x(),!1).some(e=>mU(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=BG(c),i=typeof o!=`boolean`;if(o&&!A.current&&ag(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,W,T,E,y,O,_,x,K]),Mg(()=>{if(!ZH||g||!v)return;let e=pU(Jg(v));!ag(e)||!yU(e)||mU(v,e)&&e.blur()},[g,v]),Mg(()=>{if(!(r||!k))return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),Mg(()=>{if(!(r||!W))return VG(W),()=>{queueMicrotask(LG)}},[r,W]);let q=!r&&(!s||!C)&&(U||s);return(0,X.jsxs)(Y.Fragment,{children:[q&&(0,X.jsx)(WU,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=G();nG(e[e.length-1])}else k?.portalNode&&(A.current=!1,YW(e,k.portalNode)?WW(_)?.focus():NG(d??k.beforeOutsideRef)?.focus())}}),n,q&&(0,X.jsx)(WU,{"data-type":`inside`,ref:z,onFocus:e=>{s?nG(G()[0]):k?.portalNode&&(c&&(A.current=!0),YW(e,k.portalNode)?GW(_)?.focus():NG(u??k.afterOutsideRef)?.focus())}})]})}function UG(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=cH}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Y.useRef(void 0),f=BU(),p=zH(),m=Y.useMemo(()=>{function e(e,t,n,r){let i=DH(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=aU(e.pointerType,!0)&&iU(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||aU(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=hU(o);if(yU(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}aU(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Y.useMemo(()=>n?{reference:m}:a_,[n,m])}function WG(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function GG(e){return e!=null&&e.clientX!=null}function KG(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Y.useRef(!1),u=Y.useRef(null),[d,f]=Y.useState(),[p,m]=Y.useState([]),h=kg(e=>{i.set(`positionReference`,e)}),g=kg((e,t,n)=>{l.current||c.current.openEvent&&!GG(c.current.openEvent)||i.set(`positionReference`,WG(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=kg(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=aU(d)?o:a;Y.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=tg(o);function r(t){let n=hU(t);mU(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||GG(c.current.openEvent)?u.current=NU(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),Y.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Y.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Y.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=Y.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return Y.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function qG(){return!1}function JG(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function YG(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=qG,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=kG(c),m=kg(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=kg(()=>a),{escapeKey:v,outsidePress:y}=JG(s),b=Y.useRef(!1),x=Y.useRef(!1),S=Y.useRef(!1),C=Y.useRef(!1),w=Y.useRef(``),T=Y.useRef(null),E=zH(),D=zH(),O=kg(()=>{D.clear(),f.current.insideReactTree=!1}),k=kg(e=>{let t=f.current.floatingContext?.nodeId;return(p?QW(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),A=kg(e=>_U(e,l.select(`floatingElement`))||_U(e,l.select(`domReferenceElement`))),j=kg(e=>{o()&&l.setOpen(!1,DH(cH,e.nativeEvent))}),M=kg(e=>{if(!u||!n||!r||e.key!==`Escape`||C.current||!v&&k(`__escapeKeyBubbles`))return;let t=DH(vH,nU(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),N=kg(()=>{f.current.insideReactTree=!0,D.start(0,O)}),P=kg(e=>{if(!u||!n||e.button!==0)return;let t=hU(e.nativeEvent);mU(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,x.current=!1))}),F=kg(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});Y.useEffect(()=>{if(!u||!n)return O;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new RH,t=new RH;function i(){e.clear(),C.current=!0}function a(){e.start(ZH?5:0,()=>{C.current=!1})}function o(){S.current=!0,t.start(0,()=>{S.current=!1})}function s(){b.current=!1,x.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=p&&QW(p.nodesRef.current,t).some(t=>_U(e,t.context?.elements.floating));return A(e)||n}function j(e){if(m(e)){e.type!==`click`&&!A(e)&&(t.clear(),S.current=!1),O();return}if(f.current.insideReactTree){O();return}let n=hU(e),r=`[${eG(`inert`)}]`,i=ig(n)?n.getRootNode():null,a=Array.from((og(i)?i:Jg(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>mU(e,n))))return;let s=ig(n)?n:null;for(;s&&!_g(s);){let e=bg(s);if(_g(e)||!ig(e))break;s=e}if(!(a.length&&ig(n)&&!vU(n)&&!mU(n,l.select(`floatingElement`))&&a.every(e=>!mU(s,e)))){if(ag(n)&&!(`touches`in e)){let t=_g(n),r=vg(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(c()===`intentional`&&S.current){t.clear(),S.current=!1;return}typeof h==`function`&&!h(e)||k(`__outsidePressBubbles`)||(l.setOpen(!1,DH(dH,e)),O())}}}function N(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||A(e)||j(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||A(e))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=hU(e);if(!n)return;let r=NU(n,e.type,()=>{t(e),r()})}function I(e){w.current=`touch`,F(e,P)}function L(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?N(e):j(e)})}function R(e){if(!b.current)return;let n=x.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!D(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,O())}}}function z(e){if(c()!==`sloppy`||!T.current||A(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(j(e),E.clear(),T.current=null)}function B(e){F(e,z)}function V(e){c()!==`sloppy`||!T.current||A(e)||(T.current.dismissOnTouchEnd&&j(e),E.clear(),T.current=null)}function H(e){F(e,V)}let U=Jg(d),W=PU(r&&PU(NU(U,`keydown`,M),NU(U,`compositionstart`,i),NU(U,`compositionend`,a)),g&&PU(NU(U,`click`,L,!0),NU(U,`pointerdown`,L,!0),NU(U,`pointerup`,R,!0),NU(U,`pointercancel`,R,!0),NU(U,`mousedown`,L,!0),NU(U,`mouseup`,R,!0),NU(U,`touchstart`,I,!0),NU(U,`touchmove`,B,!0),NU(U,`touchend`,H,!0)));return()=>{W(),e.clear(),t.clear(),s(),S.current=!1,O()}},[f,d,r,g,h,u,n,v,y,M,O,_,k,A,p,l,E]);let I=Y.useMemo(()=>({onKeyDown:M,onPointerDown:j,onClick:j}),[M,j]),L=Y.useMemo(()=>({onKeyDown:M,onPointerDown:F,onMouseDown:F,onClickCapture:N,onMouseDownCapture(e){N(),P(e)},onPointerDownCapture(e){N(),P(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,P,F]);return Y.useMemo(()=>n?{reference:I,floating:L,trigger:I}:{},[n,I,L])}function XG(e,t,n){let{reference:r,floating:i}=e,a=rW(t),o=iW(t),s=nW(o),c=$U(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=eW(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ZG(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=QU(t,e),p=gW(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_W(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_W(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var QG=50,$G=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ZG},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=XG(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<QG&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=XG(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},eK=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=QU(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=$U(r),_=rW(o),v=$U(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[mW(o)]:oW(o)),x=p!==`none`;!d&&x&&b.push(...pW(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=aW(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===rW(t)||T.every(e=>rW(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=rW(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},tK=new Set([`left`,`top`]);async function nK(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=$U(n),s=eW(n),c=rW(n)===`y`,l=tK.has(o)?-1:1,u=a&&c?-1:1,d=QU(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var rK=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await nK(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},iK=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=QU(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=rW(i),p=tW(f),m=u[p],h=u[f],g=(e,t)=>ZU(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},aK=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=QU(e,t),u={x:n,y:r},d=rW(i),f=tW(d),p=u[f],m=u[d],h=QU(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=tK.has($U(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},oK=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=QU(e,t),c=await i.detectOverflow(t,s),l=$U(n),u=eW(n),d=rW(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=GU(p-c[m],g),y=GU(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*KU(c.left,c.right):S=p-2*KU(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function sK(e){let t=vg(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ag(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=qU(n)!==a||qU(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function cK(e){return ig(e)?e:e.contextElement}function lK(e){let t=cK(e);if(!ag(t))return YU(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=sK(t),o=(a?qU(n.width):n.width)/r,s=(a?qU(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var uK=YU(0);function dK(e){let t=tg(e);return!gg()||!t.visualViewport?uK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function fK(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===tg(e)}function pK(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=cK(e),o=YU(1);t&&(r?ig(r)&&(o=lK(r)):o=lK(e));let s=fK(a,n,r)?dK(a):YU(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=tg(a),t=ig(r)?tg(r):r,n=e,i=Cg(n);for(;i&&t!==n;){let e=lK(i),t=i.getBoundingClientRect(),r=vg(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=tg(i),i=Cg(n)}}return _W({width:u,height:d,x:c,y:l})}function mK(e,t){let n=yg(e).scrollLeft;return t?t.left+n:pK(ng(e)).left+n}function hK(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-mK(e,n),y:n.top+t.scrollTop}}function gK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ng(r),s=t?lg(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=YU(1),u=YU(0),d=ag(r);if((d||!a)&&((eg(r)!==`body`||sg(o))&&(c=yg(r)),d)){let e=pK(r);l=lK(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?hK(o,c):YU(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function _K(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function vK(e){let t=yg(e),n=e.ownerDocument.body,r=KU(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=KU(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+mK(e),o=-t.scrollTop;return vg(n).direction===`rtl`&&(a+=KU(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var yK=25;function bK(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=tg(e),a=ng(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!gg()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(mK(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=yK&&(s-=o)}return{width:s,height:c,x:l,y:u}}function xK(e,t){let n=pK(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=lK(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function SK(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=bK(e,n,t);else if(t===`document`)r=vK(ng(e));else if(ig(t))r=xK(t,n);else{let n=dK(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _W(r)}function CK(e,t){let n=t.get(e);if(n)return n;let r=Sg(e,[],!1).filter(e=>ig(e)&&eg(e)!==`body`),i=null,a=vg(e).position===`fixed`,o=a?bg(e):e;for(;ig(o)&&!_g(o);){let e=vg(o),t=mg(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=bg(o)}return t.set(e,r),r}function wK(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?lg(t)?[]:CK(t,this._c):[].concat(n),r],o=SK(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=SK(t,a[e],i);s=KU(n.top,s),c=GU(n.right,c),l=GU(n.bottom,l),u=KU(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function TK(e){let{width:t,height:n}=sK(e);return{width:t,height:n}}function EK(e,t,n){let r=ag(t),i=ng(t),a=n===`fixed`,o=pK(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=YU(0);if((r||!a)&&((eg(t)!==`body`||sg(i))&&(s=yg(t)),r)){let e=pK(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=mK(i));let l=i&&!r&&!a?hK(i,s):YU(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function DK(e){return vg(e).position===`static`}function OK(e,t){if(!ag(e)||vg(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ng(e)===n&&(n=n.ownerDocument.body),n}function kK(e,t){let n=tg(e);if(lg(e))return n;if(!ag(e)){let t=bg(e);for(;t&&!_g(t);){if(ig(t)&&!DK(t))return t;t=bg(t)}return n}let r=OK(e,t);for(;r&&cg(r)&&DK(r);)r=OK(r,t);return r&&_g(r)&&DK(r)&&!mg(r)?n:r||hg(e)||n}var AK=async function(e){let t=this.getOffsetParent||kK,n=this.getDimensions,r=await n(e.floating);return{reference:EK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function jK(e){return vg(e).direction===`rtl`}var MK={convertOffsetParentRelativeRectToViewportRelativeRect:gK,getDocumentElement:ng,getClippingRect:wK,getOffsetParent:kK,getElementRects:AK,getClientRects:_K,getDimensions:TK,getScale:lK,isElement:ig,isRTL:jK};function NK(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function PK(e,t,n){let r=null,i,a=ng(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=JU(d),h=JU(a.clientWidth-(u+f)),g=JU(a.clientHeight-(d+p)),_=JU(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:KU(0,GU(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!NK(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=tg(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function FK(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=cK(e),u=i||a?[...l?Sg(l):[],...t?Sg(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?PK(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?pK(e):null;c&&g();function g(){let t=pK(e);h&&!NK(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var IK=rK,LK=iK,RK=eK,zK=oK,BK=aK,VK=(e,t,n)=>{let r=new Map,i=n??{},a={...MK,...i.platform,_c:r};return $G(e,t,{...i,platform:a})},HK=typeof document<`u`?Y.useLayoutEffect:function(){};function UK(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!UK(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!UK(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function WK(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function GK(e,t){let n=WK(e);return Math.round(t*n)/n}function KK(e){let t=Y.useRef(e);return HK(()=>{t.current=e}),t}function qK(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Y.useState(r);UK(f,r)||p(r);let[m,h]=Y.useState(null),[g,_]=Y.useState(null),v=Y.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Y.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Y.useRef(null),C=Y.useRef(null),w=Y.useRef(u),T=c!=null,E=KK(c),D=KK(i),O=KK(l),k=Y.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),VK(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!UK(w.current,t)&&(w.current=t,Xi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);HK(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Y.useRef(!1);HK(()=>(A.current=!0,()=>{A.current=!1}),[]),HK(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Y.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Y.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Y.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=GK(M.floating,u.x),r=GK(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...WK(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Y.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var JK=(e,t)=>{let n=IK(e);return{name:n.name,fn:n.fn,options:[e,t]}},YK=(e,t)=>{let n=LK(e);return{name:n.name,fn:n.fn,options:[e,t]}},XK=(e,t)=>({fn:BK(e).fn,options:[e,t]}),ZK=(e,t)=>{let n=RK(e);return{name:n.name,fn:n.fn,options:[e,t]}},QK=(e,t)=>{let n=zK(e);return{name:n.name,fn:n.fn,options:[e,t]}},$K=[],eq=void 0;function tq(){return eq}function nq(e){$K.push(e)}function rq(e){let t=(t,n)=>{let r=Eg(aq).current,i;try{eq=r;for(let e of $K)e.before(r);i=e(t,n);for(let e of $K)e.after(r);r.didInitialize=!0}finally{eq=void 0}return i};return t.displayName=e.displayName||e.name,t}function iq(e){return Y.forwardRef(rq(e))}function aq(){return{didInitialize:!1}}var oq=Ni(),sq=t_(19)?lq:uq;function $(e,t,n,r,i){return sq(e,t,n,r,i)}function cq(e,t,n,r,i){let a=Y.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,oq.useSyncExternalStore)(e.subscribe,a,a)}nq({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,oq.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function lq(e,t,n,r,i){let a=tq();if(!a)return cq(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function uq(e,t,n,r,i){return(0,Fi.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var dq=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return $(this,e,t,n,r)}},fq=class extends dq{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Y.useDebugValue(e);let n=this;Mg(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Mg(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Mg(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Y.useDebugValue(e);let n=this,r=t!==void 0;Mg(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return Y.useDebugValue(e),$(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Y.useDebugValue(e);let n=kg(t??r_);this.context[e]=n}useStateSetter(e){let t=Y.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},pq={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},mq=class extends fq{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:wG(),nested:n,triggerElements:i},pq),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&oU(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function hq(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=Y.useRef(null);r===void 0&&f.current===null&&(f.current=new mq({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),Mg(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};ig(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function gq(e,t=!1,n=!1){let[r,i]=Y.useState(e&&t?`idle`:void 0),[a,o]=Y.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Mg(()=>{if(!e&&a&&r!==`ending`&&n){let e=zU.request(()=>{i(`ending`)});return()=>{zU.cancel(e)}}},[e,a,r,n]),Mg(()=>{if(!e||t)return;let n=zU.request(()=>{i(void 0)});return()=>{zU.cancel(n)}},[t,e]),Mg(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=zU.request(()=>{i(`idle`)});return()=>{zU.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function _q(e,t=!1){let n=BU();return kg((r,i=null)=>{n.cancel();let a=NG(e);if(a==null)return;let o=a,s=()=>{Xi.flushSync(r)};if(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{i?.aborted||s()},()=>{if(!i?.aborted){if(o.getAnimations().some(e=>e.pending||e.playState!==`finished`)){c();return}s()}})}if(t){let e=`data-starting-style`;if(!o.hasAttribute(e)){n.request(c);return}let t=new MutationObserver(()=>{o.hasAttribute(e)||(t.disconnect(),c())});t.observe(o,{attributes:!0,attributeFilter:[e]}),i?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}n.request(c)})}function vq(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=kg(i),o=_q(r,n);Y.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var yq={tabIndex:-1,[sU]:``};function bq(e){return t=>t!==`touch`||e.current}function xq(e,t=!1){let n=NH(),r=OG()!=null,i=Eg(()=>e(n,r)).current;return hq({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function Sq({handle:e,store:t}){return Mg(()=>e.attachStore(t),[e,t]),null}function Cq(e,t){let n=Y.useRef(null),r=Y.useRef(null);return Y.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function wq(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function Tq(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Eq(e,t,n,r={}){let i=n.reason,a=i===lH,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=Tq(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),wq(i,t,n.trigger,c()),e.update(i)};a?Xi.flushSync(l):l()}function Dq(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Cq(e,n),o=kg(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){n.update({activeTriggerElement:t,...i?r:null});return}a==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})}),s=Y.useCallback(e=>{a(e),e&&o(e)},[a,o]);return Mg(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Oq(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Y.useRef(null),i=e.useState(`open`);Mg(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=DH(sH);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function kq(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=gq(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=kg(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return vq({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function Aq(e,t){e.useSyncedValues(t),Mg(()=>()=>{e.update({activeTriggerProps:a_,inactiveTriggerProps:a_,popupProps:a_})},[e])}function jq(e,t){Mg(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Mg(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var Mq=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Nq(){return new mq({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Mq,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Pq(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Nq(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:a_,inactiveTriggerProps:a_,popupProps:a_}}function Fq(e,t,n=!1){return new mq({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var Iq=e=>e.triggerIdProp??e.activeTriggerId,Lq=e=>e.openProp??e.open,Rq=e=>(e.popupElement?.id??e.floatingId)||void 0;function zq(e,t){return t!==void 0&&Lq(e)&&Iq(e)===t}function Bq(e,t){return zq(e,t)?!0:t!==void 0&&Lq(e)&&Iq(e)==null&&e.triggerCount===1}var Vq={open:Lq,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Iq,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Rq,isTriggerActive:(e,t)=>t!==void 0&&Iq(e)===t,isOpenedByTrigger:(e,t)=>zq(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Iq(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>Bq(e,t)?Rq(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Hq(e){let t=Y.useCallback(t=>e===void 0?r_:e.subscribeStore(t),[e]),n=Y.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,oq.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Uq(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=NH(),a=OG()!=null,o=Eg(()=>new mq({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Mq,floatingId:i,syncOnly:!1,nested:a})).current;return Mg(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ig(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Wq(e){return Gq(e,e.rootContext)}function Gq(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Y.useState(null),[d,f]=Y.useState(void 0),[p,m]=Y.useState(void 0),h=Y.useRef(null),g=kG(r),_=Y.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=qK({...e,elements:{..._,...l&&{reference:l}}}),y=ig(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Y.useCallback(e=>{let t=ig(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Y.useCallback(e=>{(ig(e)||e===null)&&(h.current=e,f(e)),(ig(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!ig(e))&&v.refs.setReference(e)},[v.refs,f]),C=Y.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Y.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Y.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Y.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return Mg(()=>{o&&(h.current=o)},[o]),Mg(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Y.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Kq=YH&&ZH;function qq(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Y.useRef(!1),c=Y.useRef(null),l=Y.useRef(!0),u=zH();Y.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=tg(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&ag(e)&&e===pU(Jg(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return PU(NU(t,`blur`,r),Kq&&NU(t,`keydown`,a,!0),Kq&&NU(t,`pointerdown`,o,!0))},[i,n]),Y.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);ig(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Y.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=hU(t.nativeEvent);if(ig(a)){if(Kq&&!t.relatedTarget){if(!l.current&&!yU(a))return}else if(!SU(a))return}let o=gU(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,DH(uH,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,DH(uH,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=ig(n)&&n.hasAttribute(eG(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=pU(Jg(e));!n&&t===e||mU(o.current.floatingContext?.refs.floating.current,t)||mU(e,t)||a||gU(n??t,i.context.triggerElements)||i.setOpen(!1,DH(uH,r))})}}},[o,r,i,u]);return Y.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var Jq=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new RH,this.restTimeout=new RH,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Yq=new WeakMap;function Xq(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Yq.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Yq.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Zq(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Yq.get(n);a&&a!==e&&Xq(a),Xq(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Yq.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Qq(e){let t=e.context.dataRef.current,n=Eg(()=>t.hoverInteractionState??Jq.create()).current;return t.hoverInteractionState||=n,IH(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function $q(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=kG(),d=OG(),f=Qq(a),p=zH(),m=kg(()=>DU(l.current.openEvent?.type,f.interactedInside)),h=kg(()=>OU(l.current.openEvent?.type)),g=kg(()=>{Xq(f)});Mg(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Y.useEffect(()=>g,[g]),Mg(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&ig(c)&&s){let e=c,t=s,n=Jg(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return Zq(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Y.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&QW(u.nodesRef.current,d).length>0)}function t(e){let t=TU(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,DH(lH,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=hU(e);if(!bU(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(gU(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&ig(o)&&QW(u.nodesRef.current,r,!1).some(e=>mU(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,DH(lH,t)),u.events.emit(`floating.closed`,t)})}let y=s;return PU(y&&NU(y,`mouseenter`,c),y&&NU(y,`mouseleave`,_),y&&NU(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var eJ={current:null};function tJ(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=eJ,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=kG(l),y=Qq(h),b=Y.useRef(!1),x=FU(i),S=FU(r),C=FU(o),w=FU(n),T=FU(p),E=FU(f),D=kg(()=>DU(g.current.openEvent?.type,y.interactedInside)),O=kg(()=>T.current?.()!==!1),k=kg((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!mU(e,t);if(!ig(n))return!1;let i=n;return r.hasMatchingElement(e=>mU(e,i))&&(!e||!mU(e,i))}),A=kg(()=>{y.handler&&=(Jg(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=kg(()=>{Xq(y)});return u&&(y.handleCloseOptions=x.current?.__options),Y.useEffect(()=>A,[A]),Y.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===lH,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Y.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=TU(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,DH(lH,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,DH(lH,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!ig(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!aU(y.pointerType))return;let t=EU(C.current),n=TU(S.current,`open`,y.pointerType),r=hU(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(ig(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(mU(e,r)){s=e;break}}ig(i)&&ig(o)&&!h.context.triggerElements.hasElement(i)&&mU(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&ig(s)&&ig(o)&&mU(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,DH(lH,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,DH(lH,e,s))}):g&&O()&&h.setOpen(!0,DH(lH,e,s)))}function i(t){if(D()){j();return}A();let n=Jg(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!gU(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!mU(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){mU(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?NU(t,`mouseout`,o):void 0;return s?PU(NU(t,`mousemove`,r,{once:!0}),NU(t,`mouseenter`,r),NU(t,`mouseleave`,i),l):PU(NU(t,`mouseenter`,r),NU(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),Y.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!aU(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;Zq(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=EU(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,DH(lH,t,n))}y.pointerType===`touch`?Xi.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var nJ=`Escape`;function rJ(e){return ZH&&e.movementX===0&&e.movementY===0}function iJ(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function aJ(e,t){return iJ(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function oJ(e,t,n){return iJ(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function sJ(e,t,n){return iJ(t,n?e===lU:e===uU,e===fU)}function cJ(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===nJ:iJ(t,n?e===uU:e===lU,e===dU)}function lJ(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=CU(T),k=xU(E),A=FU(O),j=OG(),M=kG(b),N=Y.useRef(f),P=Y.useRef(o??-1),F=Y.useRef(null),I=Y.useRef(!0),L=kg(e=>{i(P.current===-1?null:P.current,e)}),R=Y.useRef(!!T),z=Y.useRef(w),B=Y.useRef(!1),V=Y.useRef(!1),H=Y.useRef(null),U=FU(h),W=FU(w),G=FU(o),K=FU(y),q=BU(),J=BU(),ee=kg(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):H.current=nG(e,{sync:B.current,preventScroll:!0})}let t=n.current[P.current],r=V.current;t&&e(t),(B.current?e=>e():e=>q.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),oe&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Mg(()=>{D.current.orientation=g},[D,g]),Mg(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(V.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),Mg(()=>{if(a){if(!w){B.current=!1;return}if(T){if(r==null){if(B.current=!1,G.current!=null)return;if(R.current&&(P.current=-1,ee()),(!z.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>J.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||oJ(F.current,g,u)||l?bW(n):xW(n),F.current=null,L())};t()}}else yW(n.current,r)||(P.current=r,ee(),V.current=!1)}}},[a,w,T,r,G,l,n,g,u,L,ee,J]),Mg(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=pU(Jg(E??t??null)),r=e.some(e=>e.context&&mU(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),Mg(()=>{z.current=w,R.current=!!T}),Mg(()=>{w||(F.current=null,N.current=f)},[w,f]);let te=r!=null,ne=kg(e=>{if(!W.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),re=kg(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ie=kg(()=>bW(n,U.current)),ae=kg(e=>{if(I.current=!1,B.current=!0,e.which===229||!W.current&&e.currentTarget===A.current)return;if(l&&cJ(e.key,g,u,S)){aJ(e.key,re())||tU(e),C.setOpen(!1,DH(yH,e.nativeEvent)),ag(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=bW(n,h),i=xW(n,h);if(k||(e.key===`Home`&&(tU(e),P.current=r,L(e)),e.key===`End`&&(tU(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(aJ(e.key,g)){if(tU(e),w&&!d&&pU(e.currentTarget.ownerDocument)===e.currentTarget){P.current=oJ(e.key,g,u)?r:i,L(e);return}oJ(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(B.current=!1,P.current=r):P.current=SW(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,SW(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(B.current=!1,P.current=i):P.current=SW(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,SW(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),yW(n.current,P.current)&&(P.current=-1),L(e)}}),oe=Y.useMemo(()=>({onFocus(e){B.current=!0,ne(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){rJ(e)||(B.current=!0,V.current=!1,p&&ne(e))},onPointerLeave(e){if(!W.current||!I.current||e.pointerType===`touch`)return;B.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&K.current&&(H.current?.(),H.current=null,P.current=-1,L(e),!d)){let e=A.current,t=pU(Jg(e));e&&mU(e,t)&&e.focus({preventScroll:!0})}}}),[ne,W,A,p,n,L,K,d]),se=Y.useMemo(()=>d&&w&&te&&{"aria-activedescendant":`${v}-${r}`},[d,w,te,v,r]),ce=Y.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...k?{}:se,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=hU(e.nativeEvent);if(t&&!mU(A.current,t))return;tU(e),C.setOpen(!1,DH(_H,e.nativeEvent)),ag(E)&&E.focus();return}ae(e)},onPointerMove(e){rJ(e)||(I.current=!0)}}),[se,ae,A,g,k,C,w,d,E]),le=Y.useMemo(()=>{function e(e){C.setOpen(!0,DH(yH,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&rU(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&iU(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=sJ(t.key,re(),u),a=aJ(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return ae(t);if(!(!n&&!m&&r)){if(o){let e=aJ(t.key,re());F.current=l&&e?null:t.key}if(l){i&&(tU(t),n?(P.current=ie(),L(t)):e(t));return}a&&(G.current!=null&&(P.current=G.current),tU(t),!n&&m?e(t):ae(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[ae,f,ie,l,L,C,m,g,re,u,G,d]),ue=Y.useMemo(()=>({...se,...le}),[se,le]);return Y.useMemo(()=>a?{reference:ue,floating:ce,item:oe,trigger:le}:{},[a,ue,ce,le,oe])}function uJ(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=zH(),m=Y.useRef(``),h=Y.useRef(u??i??-1),g=Y.useRef(null),_=kg(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!EW(n)||n?.matches(`:disabled`)?!1:o==null||!wW(i_,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(tU(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(tU(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=kg(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);mU(n,t)||mU(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});Mg(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Y.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Y.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var dJ=.1,fJ=dJ*dJ,pJ=.5;function mJ(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function hJ(e,t,n,r,i,a,o,s,c,l){let u=!1;return mJ(e,t,n,r,i,a)&&(u=!u),mJ(e,t,i,a,o,s)&&(u=!u),mJ(e,t,o,s,c,l)&&(u=!u),mJ(e,t,c,l,n,r)&&(u=!u),u}function gJ(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function _J(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function vJ(e={}){let{blockPointerEvents:t=!1}=e,n=new RH,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*fJ;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=hU(r),g=r.type===`mouseleave`,_=mU(u,h),v=mU(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ig(r.relatedTarget)&&mU(u,r.relatedTarget))return;function y(){return!!(s&&QW(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=_J(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=_J(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=_J(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=_J(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!gJ(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?pJ/2:pJ*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+pJ+1,o=C||T?S.bottom-pJ:S.top,s=C?T?S.bottom-pJ:S.top:S.bottom-pJ;M=hJ(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?pJ/2:pJ*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-pJ,o=C||T?S.top+pJ:S.bottom,s=C?T?S.top+pJ:S.bottom:S.top+pJ;M=hJ(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?pJ/2:pJ*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+pJ+1,o=w||E?S.right-pJ:S.left,s=w?E?S.right-pJ:S.left:S.right-pJ;M=hJ(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?pJ/2:pJ*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-pJ,o=w||E?S.left+pJ:S.right,s=w?E?S.left+pJ:S.right:S.left+pJ;M=hJ(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var yJ=Y.createContext(void 0);function bJ(){let e=Y.useContext(yJ);if(e===void 0)throw Error(Gg(26));return e}var xJ=`ArrowUp`,SJ=`ArrowDown`,CJ=`ArrowLeft`,wJ=`ArrowRight`,TJ=new Set([xJ,SJ,CJ,wJ,`Home`,`End`]),EJ=`Shift`,DJ=[EJ,`Control`,`Alt`,`Meta`];function OJ(e){return ag(e)&&e.tagName===`INPUT`}function kJ(e){return!!(OJ(e)&&e.selectionStart!=null||ag(e)&&e.tagName===`TEXTAREA`)}function AJ(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=jJ(e,t,`left`),a=MJ(e),o=MJ(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=jJ(e,t,`top`),r=MJ(e),i=MJ(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function jJ(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function MJ(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var NJ={...iH,...XV,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},PJ=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=KV(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);bJ(),vq({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?bq(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=o_(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...yq,hidden:!m,onKeyDown(e){TJ.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:NJ});return(0,X.jsx)(HG,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function FJ(e){return t_(19)?e:e?`true`:void 0}var IJ=Y.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,X.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),LJ=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=KV(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(yJ.Provider,{value:n,children:(0,X.jsxs)(CG,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)(IJ,{ref:i.context.internalBackdropRef,inert:FJ(!s)}),e.children]})}):null}),RJ={},zJ={},BJ=``;function VJ(e,t){return sg(e)?e:t}function HJ(e,t,n){return/hidden|clip/.test(e.getComputedStyle(VJ(t,n)).overflowY)}function UJ(e){if(typeof document>`u`)return!1;let t=Jg(e);return tg(t).innerWidth-t.documentElement.clientWidth>0}function WJ(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Jg(e),n=t.documentElement,r=t.body,i=VJ(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function GJ(e){let t=Jg(e),n=t.documentElement,r=t.body,i=VJ(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function KJ(e){let t=Jg(e),n=t.documentElement,r=t.body,i=tg(n),a=0,o=0,s=!1,c=zU.create();if(ZH&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,RJ={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},BJ=n.style.scrollBehavior,zJ={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=VJ(n,r);if(s=WJ(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,RJ),Object.assign(r.style,zJ),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=BJ)}function d(){u(),c.request(l)}l();let f=NU(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var qJ=new class{lockCount=0;restore=null;timeoutLock=RH.create();timeoutUnlock=RH.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Jg(e),n=t.documentElement,r=t.body,i=tg(n);if(HJ(i,n,r)){let t=new i.MutationObserver(()=>{HJ(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=KH||!UJ(e);this.restore=a?GJ(e):KJ(e)}};function JJ(e=!0,t=null){Mg(()=>{if(e)return qJ.acquire(t)},[e,t])}function YJ({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Y.useState(0),[u,d]=Y.useState(0),f=c===0,p=YG(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=hU(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||mU(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return JJ(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),Mg(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),Aq(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var XJ={...Vq,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},ZJ=class extends fq{constructor(e,t,n){let r=new Mq,i=QJ(e,r,t,n);super(i,$J(r),XJ)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};wq(n,e,t.trigger),this.update(n)}};function QJ(e,t,n,r=!1){let i={...Pq(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=Fq(t,n,r),i}function $J(e){return{popupRef:Y.createRef(),backdropRef:Y.createRef(),internalBackdropRef:Y.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function eY(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=KV(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=xq((e,t)=>new ZJ({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);jq(b,x),Oq(b);let{forceUnmount:w}=kq(x,b);Y.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,DH(TH))}),[w,b]);let T=x||S;return(0,X.jsxs)(GV.Provider,{value:b,children:[u&&(0,X.jsx)(Sq,{handle:u,store:b}),T&&(0,X.jsx)(YJ,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}function tY(e){return eY(`dialog`,e)}var nY=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=bJ(),c=KV(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`transitionStatus`),f=c.useState(`nestedOpenDialogCount`),p=c.useState(`mounted`),m=c.useStateSetter(`viewportElement`);return o_(`div`,e,{enabled:s||p,state:{open:l,nested:u,transitionStatus:d,nestedDialogOpen:f>0},ref:[t,m],stateAttributesMapping:NJ,props:[{role:`presentation`,hidden:!p,style:{pointerEvents:l?void 0:`none`},children:a},o]})}),rY=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=KV(),c=PH(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),o_(`h2`,e,{ref:t,props:[{id:c},o]})});function iY(e){let t=Y.useRef(``),n=Y.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Y.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function aY(e,t){let n=Y.useRef(e),r=kg(t);Mg(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function oY(e,t){let{onClick:n,onPointerDown:r}=iY(kg((n,r)=>{(typeof e==`function`?e():e)||t(r||(KH?`touch`:``))}));return Y.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function sY(e){let[t,n]=Y.useState(null),r=oY(e,n);return aY(e,t=>{t&&!e&&n(null)}),Y.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function cY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(tY,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function lY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(LJ,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function uY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`data-[starting-style]:fade-in-0 data-[ending-style]:fade-out-0 fixed inset-0 z-50 bg-foreground/50 data-[closed]:animate-out data-[open]:animate-in`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(oH,{className:i,"data-slot":`dialog-overlay`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function dY(e){let t=(0,Z.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,showCloseButton:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0||a,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(uY,{}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 grid w-full max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[closed]:animate-out data-[open]:animate-in`,r),t[6]=r,t[7]=c);let l;t[8]===o?l=t[9]:(l=o&&(0,X.jsxs)(kH,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,"data-slot":`dialog-close`,children:[(0,X.jsx)(hy,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[8]=o,t[9]=l);let u;return t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==l?(u=(0,X.jsxs)(lY,{"data-slot":`dialog-portal`,children:[s,(0,X.jsx)(nY,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:(0,X.jsxs)(PJ,{className:c,"data-slot":`dialog-content`,...i,children:[n,l]})})]}),t[10]=n,t[11]=i,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function fY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`dialog-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold text-lg leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(rY,{className:i,"data-slot":`dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(FH,{className:i,"data-slot":`dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function gY(e){let t=(0,Z.c)(3),n=(0,Y.useRef)(e),r;t[0]===e?r=t[1]:(r=()=>{n.current=e},t[0]=e,t[1]=r),(0,Y.useInsertionEffect)(r);let i;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(...e)=>{let t=e;return n.current(...t)},t[2]=i):i=t[2],i}function _Y(e,t,n,r){let i=(0,Z.c)(10),a=r?.enabled??!0,o=r?.capture??!1,s=r?.deferAttach??!1,c;i[0]===n?c=i[1]:(c=e=>n(e),i[0]=n,i[1]=c);let l=gY(c),u,d;i[2]!==o||i[3]!==s||i[4]!==a||i[5]!==l||i[6]!==e||i[7]!==t?(u=()=>{if(!a)return;let n=e=>l(e);if(!s)return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=setTimeout(()=>{e.addEventListener(t,n,o)},0);return()=>{clearTimeout(r),e.removeEventListener(t,n,o)}},d=[e,t,a,o,s,l],i[2]=o,i[3]=s,i[4]=a,i[5]=l,i[6]=e,i[7]=t,i[8]=u,i[9]=d):(u=i[8],d=i[9]),(0,Y.useEffect)(u,d)}function vY(e,t){let n=(0,Z.c)(7),r;n[0]===t?r=n[1]:(r=()=>t(),n[0]=t,n[1]=r);let i=gY(r),a;n[2]===i?a=n[3]:(a=()=>{i()},n[2]=i,n[3]=a);let o;n[4]!==e||n[5]!==i?(o=[e,i],n[4]=e,n[5]=i,n[6]=o):o=n[6],(0,Y.useEffect)(a,o)}function yY(e,t){let n=(0,Z.c)(7),r;n[0]===t?r=n[1]:(r=()=>t(),n[0]=t,n[1]=r);let i=gY(r),a;n[2]===i?a=n[3]:(a=()=>{let e=setTimeout(()=>i(),0);return()=>clearTimeout(e)},n[2]=i,n[3]=a);let o;n[4]!==e||n[5]!==i?(o=[e,i],n[4]=e,n[5]=i,n[6]=o):o=n[6],(0,Y.useEffect)(a,o)}function bY(e,t){let n=(0,Z.c)(4),[r,i]=(0,Y.useState)(e),a,o;return n[0]!==t||n[1]!==e?(a=()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Y.useEffect)(a,o),r}function xY(e,t){let n=(0,Z.c)(6),r;n[0]===e?r=n[1]:(r=()=>e(),n[0]=e,n[1]=r);let i=gY(r),a,o;n[2]!==t||n[3]!==i?(a=()=>{if(t===null)return;let e=setInterval(()=>i(),t);return()=>clearInterval(e)},o=[t,i],n[2]=t,n[3]=i,n[4]=a,n[5]=o):(a=n[4],o=n[5]),(0,Y.useEffect)(a,o)}function SY(e){let t=(0,Z.c)(1),{intervalMs:n,enabled:r}=e,[i,a]=(0,Y.useState)(CY),o;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>a(Date.now()),t[0]=o):o=t[0],xY(o,r?n:null),i}function CY(){return Date.now()}function wY(e,t){let n=(0,Z.c)(4),[r,i]=(0,Y.useState)(0),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!t){i(0);return}let n=e.current?.offsetHeight??0;n>0&&i(n)},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Y.useLayoutEffect)(a,o),r}var TY=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[contenteditable="true"]`;function EY(e){return Array.from(e.querySelectorAll(TY)).filter(e=>e.offsetWidth>0||e.offsetHeight>0||e===document.activeElement)}function DY(e,t){let n=(0,Z.c)(8),r=(0,Y.useRef)(null),i,a;n[0]!==t||n[1]!==e?(i=()=>{let n=t?e.current:null;return n&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null,n.contains(document.activeElement)||(EY(n)[0]??n).focus()),()=>{r.current?.focus(),r.current=null}},a=[e,t],n[0]=t,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,Y.useEffect)(i,a);let o;n[4]===e?o=n[5]:(o=t=>{let n=e.current;if(t.key!==`Tab`||!n)return;let r=EY(n);if(r.length===0){t.preventDefault();return}let i=r[0],a=r.at(-1),o=document.activeElement;n.contains(o)?t.shiftKey&&o===i?(t.preventDefault(),a?.focus()):!t.shiftKey&&o===a&&(t.preventDefault(),i.focus()):(t.preventDefault(),(t.shiftKey?a:i)?.focus())},n[4]=e,n[5]=o);let s=gY(o),c;n[6]===t?c=n[7]:(c={enabled:t},n[6]=t,n[7]=c),_Y(document,`keydown`,s,c)}var OY=768;function kY(e){let t=window.matchMedia(`(max-width: 767px)`);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function AY(){return window.innerWidth<OY}function jY(){return(0,Y.useSyncExternalStore)(kY,AY)}var MY=(0,Y.createContext)(null);function NY(){return`overlay-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function PY(e,t,n){return{id:NY(),component:e,props:t??{},options:n??{}}}function FY(e){let t=(0,Z.c)(13),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Y.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(e,t,n)=>{let r=PY(e,t,n);return a(e=>{for(let t of e)t.options.onClose?.();return[r]}),r.id},t[1]=o):o=t[1];let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t,n)=>{let r=PY(e,t,n);return a(e=>[...e,r]),r.id},t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a(LY)},t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(e,t,n)=>{let r=PY(e,t,n);return a(e=>e.length===0?[r]:(e.at(-1)?.options.onClose?.(),[...e.slice(0,-1),r])),r.id},t[4]=f):f=t[4];let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{a(IY)},t[5]=m):m=t[5];let h=m,g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{a(t=>{let n=t.findIndex(t=>t.id===e);if(n===-1)return t;for(let e=n;e<t.length;e++)t[e].options.onClose?.();return t.slice(0,n)})},t[6]=g):g=t[6];let _=g,v=i.length>0,y;t[7]!==i||t[8]!==v?(y={stack:i,open:s,push:l,pop:d,replace:p,closeAll:h,close:_,hasOverlays:v,depth:i.length},t[7]=i,t[8]=v,t[9]=y):y=t[9];let b=y,x;return t[10]!==n||t[11]!==b?(x=(0,X.jsx)(MY.Provider,{value:b,children:n}),t[10]=n,t[11]=b,t[12]=x):x=t[12],x}function IY(e){for(let t of e)t.options.onClose?.();return[]}function LY(e){return e.length<=1?(e[0]?.options.onClose?.(),[]):(e.at(-1)?.options.onClose?.(),e.slice(0,-1))}function RY(){let e=(0,Y.useContext)(MY);if(!e)throw Error(`useOverlay must be used within an OverlayProvider`);return e}function zY(e){let t=(0,Z.c)(8),{stack:n}=RY(),r;t[0]===e?r=t[1]:(r=t=>t.id===e,t[0]=e,t[1]=r);let i=n.findIndex(r),a=i===0,o=i===n.length-1,s=i>0,c;return t[2]!==i||t[3]!==n.length||t[4]!==a||t[5]!==o||t[6]!==s?(c={index:i,isFirst:a,isLast:o,depth:n.length,showBackButton:s},t[2]=i,t[3]=n.length,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}var BY={type:`spring`,stiffness:400,damping:35,mass:.8},VY={type:`spring`,stiffness:350,damping:30,mass:.8},HY={hidden:{opacity:0,scale:.95},visible:{opacity:1,scale:1,transition:{type:`spring`,stiffness:400,damping:30}},exit:{opacity:0,scale:.95,transition:{duration:.15,ease:[.4,0,1,1]}}};function UY(e,t){return e?`0%`:t?`-35%`:`100%`}function WY(){let e=(0,Z.c)(22),{stack:t,closeAll:n,pop:r}=RY(),i=XL(),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null),s=t.length>0,c=t,l=c.length-1,u=wY(a,s),d;e[0]===t?d=e[1]:(d=t.at(-1),e[0]=t,e[1]=d);let f=d,p;e[2]===i?p=e[3]:(p=i?{duration:.01}:BY,e[2]=i,e[3]=p);let m=p,h;e[4]!==n||e[5]!==f?.options.closeOnBackdropClick?(h=()=>{f?.options.closeOnBackdropClick!==!1&&n()},e[4]=n,e[5]=f?.options.closeOnBackdropClick,e[6]=h):h=e[6],f?.options.closeOnBackdropClick;let g=h,_;e[7]!==f?.options.closeOnEscape||e[8]!==r?(_=e=>{e.key===`Escape`&&f?.options.closeOnEscape!==!1&&r()},e[7]=f?.options.closeOnEscape,e[8]=r,e[9]=_):_=e[9],f?.options.closeOnEscape;let v=_,y;if(e[10]===s?y=e[11]:(y={enabled:s},e[10]=s,e[11]=y),_Y(document,`keydown`,v,y),DY(o,s),!s)return null;let b;e[12]!==l||e[13]!==f||e[14]!==g||e[15]!==s||e[16]!==u||e[17]!==c||e[18]!==m?(b=s&&(0,X.jsx)(cY,{modal:!1,open:!0,children:(0,X.jsxs)(lY,{keepMounted:!0,children:[(0,X.jsx)(ZL.div,{animate:{opacity:1},className:`fixed inset-0 z-50 bg-foreground/60`,exit:{opacity:0},initial:{opacity:0},onClick:g,transition:{duration:.2}}),(0,X.jsx)(ZL.div,{animate:`visible`,"aria-labelledby":f?`overlay-title-${f.id}`:void 0,"aria-modal":`true`,className:`fixed top-1/2 left-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 px-4`,exit:`exit`,initial:`hidden`,ref:o,role:`dialog`,variants:HY,children:(0,X.jsx)(sL,{children:(0,X.jsx)(ZL.div,{className:`relative flex max-h-[calc(100dvh-2rem)] flex-col overflow-hidden rounded-xl border bg-card shadow-lg ring-1 ring-border`,layout:`position`,style:{minHeight:u>0?u:`auto`},transition:BY,children:(0,X.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,ref:a,children:c.map((e,t)=>{let n=t===l,r=t<l,i=n&&c.length>1?{x:`100%`,scale:1,opacity:1}:!1;return(0,X.jsx)(ZL.div,{animate:{x:UY(n,r),scale:n?1:.94,opacity:+!!n},"aria-hidden":!n,className:Q(`w-full`,n?`relative flex min-h-0 flex-col`:`pointer-events-none absolute inset-0`),initial:i,transition:m,children:(0,X.jsx)(e.component,{overlayId:e.id,...e.props})},e.id)})})})})})]})}),e[12]=l,e[13]=f,e[14]=g,e[15]=s,e[16]=u,e[17]=c,e[18]=m,e[19]=b):b=e[19];let x;return e[20]===b?x=e[21]:(x=(0,X.jsx)(Ose,{children:b}),e[20]=b,e[21]=x),x}function GY(){let e=(0,Z.c)(40),{stack:t,closeAll:n,pop:r}=RY(),i=XL(),a=(0,Y.useRef)(null),o=t.length>0,s=t,c=s.length-1,l=wY(a,o),u;e[0]===t?u=e[1]:(u=t.at(-1),e[0]=t,e[1]=u);let d=u,f;e[2]===i?f=e[3]:(f=i?{duration:.01}:BY,e[2]=i,e[3]=f);let p=f,m;e[4]!==d?.options.closeOnEscape||e[5]!==r?(m=e=>{e.key===`Escape`&&d?.options.closeOnEscape!==!1&&r()},e[4]=d?.options.closeOnEscape,e[5]=r,e[6]=m):m=e[6],d?.options.closeOnEscape;let h=m,g;e[7]===o?g=e[8]:(g={enabled:o},e[7]=o,e[8]=g),_Y(document,`keydown`,h,g);let _;e[9]===n?_=e[10]:(_=e=>{e||n()},e[9]=n,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(WV.Overlay,{className:`fixed inset-0 z-50 bg-black/60`}),e[11]=v):v=e[11];let y=d?`overlay-title-${d.id}`:void 0,b;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=Q(`fixed inset-x-0 bottom-0 z-50 flex max-h-[90vh] flex-col`,`rounded-t-xl border-t bg-card shadow-lg`),e[12]=b):b=e[12];let x=d?.options.title||`Overlay`,S;e[13]===x?S=e[14]:(S=(0,X.jsx)(WV.Title,{className:`sr-only`,children:x}),e[13]=x,e[14]=S);let C;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(`div`,{className:`mx-auto mt-3 h-1.5 w-12 shrink-0 rounded-full bg-muted-foreground/20`}),e[15]=C):C=e[15];let w=l>0?l:`auto`,T;e[16]===w?T=e[17]:(T={minHeight:w},e[16]=w,e[17]=T);let E;if(e[18]!==c||e[19]!==s||e[20]!==p){let t;e[22]!==c||e[23]!==s.length||e[24]!==p?(t=(e,t)=>{let n=t===c,r=t<c,i=n&&s.length>1?{x:`100%`,scale:1,opacity:1}:!1;return(0,X.jsx)(ZL.div,{animate:{x:UY(n,r),scale:n?1:.94,opacity:+!!n},"aria-hidden":!n,className:Q(`w-full`,n?`relative`:`pointer-events-none absolute inset-0`),initial:i,transition:p,children:(0,X.jsx)(e.component,{overlayId:e.id,...e.props})},e.id)},e[22]=c,e[23]=s.length,e[24]=p,e[25]=t):t=e[25],E=s.map(t),e[18]=c,e[19]=s,e[20]=p,e[21]=E}else E=e[21];let D;e[26]===E?D=e[27]:(D=(0,X.jsx)(`div`,{className:`relative`,ref:a,children:E}),e[26]=E,e[27]=D);let O;e[28]!==T||e[29]!==D?(O=(0,X.jsx)(sL,{children:(0,X.jsx)(ZL.div,{className:`relative flex-1 overflow-hidden`,layout:`position`,style:T,transition:VY,children:D})}),e[28]=T,e[29]=D,e[30]=O):O=e[30];let k;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(`div`,{className:`h-safe-area-inset-bottom`}),e[31]=k):k=e[31];let A;e[32]!==O||e[33]!==y||e[34]!==S?(A=(0,X.jsxs)(WV.Portal,{children:[v,(0,X.jsxs)(WV.Content,{"aria-labelledby":y,className:b,children:[S,C,O,k]})]}),e[32]=O,e[33]=y,e[34]=S,e[35]=A):A=e[35];let j;return e[36]!==o||e[37]!==A||e[38]!==_?(j=(0,X.jsx)(WV.Root,{onOpenChange:_,open:o,children:A}),e[36]=o,e[37]=A,e[38]=_,e[39]=j):j=e[39],j}function KY(){let e=(0,Z.c)(2);if(jY()){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(GY,{}),e[0]=t):t=e[0],t}let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(WY,{}),e[1]=t):t=e[1],t}function qY(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(KY,{}),e[0]=t):t=e[0],t}var JY=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},YY=[`light`,`dark`],XY=`(prefers-color-scheme: dark)`,ZY=typeof window>`u`,QY=Y.createContext(void 0),$Y={setTheme:e=>{},themes:[]},eX=()=>Y.useContext(QY)??$Y,tX=e=>Y.useContext(QY)?Y.createElement(Y.Fragment,null,e.children):Y.createElement(rX,{...e}),nX=[`light`,`dark`],rX=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i=`theme`,themes:a=nX,defaultTheme:o=n?`system`:`light`,attribute:s=`data-theme`,value:c,children:l,nonce:u,scriptProps:d})=>{let[f,p]=Y.useState(()=>aX(i,o)),[m,h]=Y.useState(()=>f===`system`?sX():f),g=c?Object.values(c):a,_=Y.useCallback(e=>{let i=e;if(!i)return;e===`system`&&n&&(i=sX());let a=c?c[i]:i,l=t?oX(u):null,d=document.documentElement,f=e=>{e===`class`?(d.classList.remove(...g),a&&d.classList.add(a)):e.startsWith(`data-`)&&(a?d.setAttribute(e,a):d.removeAttribute(e))};if(Array.isArray(s)?s.forEach(f):f(s),r){let e=YY.includes(o)?o:null,t=YY.includes(i)?i:e;d.style.colorScheme=t}l?.()},[u]),v=Y.useCallback(e=>{let t=typeof e==`function`?e(f):e;p(t);try{localStorage.setItem(i,t)}catch{}},[f]),y=Y.useCallback(t=>{let r=sX(t);h(r),f===`system`&&n&&!e&&_(`system`)},[f,e]);Y.useEffect(()=>{let e=window.matchMedia(XY);return e.addListener(y),y(e),()=>e.removeListener(y)},[y]),Y.useEffect(()=>{let e=e=>{e.key===i&&(e.newValue?p(e.newValue):v(o))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[v]),Y.useEffect(()=>{_(e??f)},[e,f]);let b=Y.useMemo(()=>({theme:f,setTheme:v,forcedTheme:e,resolvedTheme:f===`system`?m:f,themes:n?[...a,`system`]:a,systemTheme:n?m:void 0}),[f,v,e,m,n,a]);return Y.createElement(QY.Provider,{value:b},Y.createElement(iX,{forcedTheme:e,storageKey:i,attribute:s,enableSystem:n,enableColorScheme:r,defaultTheme:o,value:c,themes:a,nonce:u,scriptProps:d}),l)},iX=Y.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return Y.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${JY.toString()})(${u})`}})}),aX=(e,t)=>{if(ZY)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},oX=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},sX=e=>(e||=window.matchMedia(XY),e.matches?`dark`:`light`);function cX(e){let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,X.jsx)(tX,{...r,children:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var lX={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},uX=e=>e===`light`||e===`dark`||e===`system`?e:`system`,dX=e=>{let t=(0,Z.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=eX(),i=r===void 0?`system`:r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,X.jsx)(ste,{className:`size-4`}),info:(0,X.jsx)(gte,{className:`size-4`}),warning:(0,X.jsx)(py,{className:`size-4`}),error:(0,X.jsx)(Cte,{className:`size-4`}),loading:(0,X.jsx)(ay,{className:`size-4 animate-spin`})},t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=uX(i),t[3]=i,t[4]=o);let s;return t[5]!==n||t[6]!==o?(s=(0,X.jsx)(pne,{className:`toaster group`,icons:a,style:lX,theme:o,...n}),t[5]=n,t[6]=o,t[7]=s):s=t[7],s};function fX(e){let t=(0,Z.c)(8),{action:n}=e,r=n.disabled||n.loading,i=n.variant??`default`,a;t[0]===n.loading?a=t[1]:(a=n.loading&&(0,X.jsx)(ay,{className:`mr-2 size-4 animate-spin`}),t[0]=n.loading,t[1]=a);let o;return t[2]!==n.label||t[3]!==n.onClick||t[4]!==r||t[5]!==i||t[6]!==a?(o=(0,X.jsxs)(zv,{disabled:r,onClick:n.onClick,variant:i,children:[a,n.label]}),t[2]=n.label,t[3]=n.onClick,t[4]=r,t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function pX(e){let t=(0,Z.c)(17),{actions:n,className:r,children:i}=e;if(i){let e;t[0]===r?e=t[1]:(e=Q(`flex flex-col-reverse gap-2 p-6 pt-4 sm:flex-row sm:justify-end`,r),t[0]=r,t[1]=e);let n;return t[2]!==i||t[3]!==e?(n=(0,X.jsx)(`div`,{className:e,children:i}),t[2]=i,t[3]=e,t[4]=n):n=t[4],n}if(!n||n.length===0)return null;let a,o,s;if(t[5]!==n||t[6]!==r){let e=n.filter(yX),i=n.filter(vX),c=n.filter(_X),l=e.length>0,u=i.length>0||c.length>0,d=l&&u?`sm:justify-between`:`sm:justify-end`;t[10]!==r||t[11]!==d?(a=Q(`flex flex-col-reverse gap-2 p-6 pt-4 sm:flex-row`,d,r),t[10]=r,t[11]=d,t[12]=a):a=t[12],o=l&&(0,X.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row`,children:e.map(gX)}),s=u&&(0,X.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row`,children:[i.map(hX),c.map(mX)]}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s}else a=t[7],o=t[8],s=t[9];let c;return t[13]!==a||t[14]!==o||t[15]!==s?(c=(0,X.jsxs)(`div`,{className:a,children:[o,s]}),t[13]=a,t[14]=o,t[15]=s,t[16]=c):c=t[16],c}function mX(e){return(0,X.jsx)(fX,{action:e},e.label)}function hX(e){return(0,X.jsx)(fX,{action:e},e.label)}function gX(e){return(0,X.jsx)(fX,{action:e},e.label)}function _X(e){return!e.variant||e.variant==="default"||e.variant===`destructive`}function vX(e){return e.variant===`outline`||e.variant===`secondary`}function yX(e){return e.variant===`ghost`}function bX(e){let t=(0,Z.c)(27),{title:n,description:r,showBackButton:i,showCloseButton:a,onBack:o,onClose:s,className:c,overlayId:l}=e,u=a===void 0||a,{pop:d,closeAll:f}=RY(),p=i??!1,m;t[0]!==o||t[1]!==d?(m=()=>{o?o():d()},t[0]=o,t[1]=d,t[2]=m):m=t[2];let h=m,g;t[3]!==f||t[4]!==s?(g=()=>{s?s():f()},t[3]=f,t[4]=s,t[5]=g):g=t[5];let _=g,v;t[6]===c?v=t[7]:(v=Q(`relative flex flex-col gap-1.5 p-6 pb-0`,c),t[6]=c,t[7]=v);let y;t[8]!==h||t[9]!==p?(y=p&&(0,X.jsx)(zv,{"aria-label":`Go back`,className:`ml-[-8px] size-8 shrink-0`,onClick:h,size:`icon`,variant:`ghost`,children:(0,X.jsx)(Yv,{className:`size-5`})}),t[8]=h,t[9]=p,t[10]=y):y=t[10];let b;t[11]!==l||t[12]!==n?(b=n&&(0,X.jsx)(`h2`,{className:`flex-1 font-semibold text-base leading-none`,id:l?`overlay-title-${l}`:void 0,children:n}),t[11]=l,t[12]=n,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==u?(x=u&&(0,X.jsx)(zv,{"aria-label":`Close`,className:`absolute top-4 right-4 size-8 shrink-0 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,onClick:_,size:`icon`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})}),t[14]=_,t[15]=u,t[16]=x):x=t[16];let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,X.jsxs)(`div`,{className:`flex min-h-8 items-center gap-2`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[21]=r,t[22]=C);let w;return t[23]!==v||t[24]!==S||t[25]!==C?(w=(0,X.jsxs)(`div`,{className:v,children:[S,C]}),t[23]=v,t[24]=S,t[25]=C,t[26]=w):w=t[26],w}function xX(e){let t=(0,Z.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({overlayId:n,showBackButton:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showBackButton:a}=zY(n),o=i??a,s;return t[4]!==n||t[5]!==r||t[6]!==o?(s=(0,X.jsx)(bX,{...r,overlayId:n,showBackButton:o}),t[4]=n,t[5]=r,t[6]=o,t[7]=s):s=t[7],s}function SX(e){let t=(0,Z.c)(15),{overlayId:n,title:r,description:i,actions:a,children:o,className:s}=e,c;t[0]===s?c=t[1]:(c=Q(`flex min-h-0 flex-col`,s),t[0]=s,t[1]=c);let l;t[2]!==i||t[3]!==n||t[4]!==r?(l=(r||i)&&(0,X.jsx)(xX,{description:i,overlayId:n,title:r}),t[2]=i,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===o?u=t[7]:(u=o&&(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:o}),t[6]=o,t[7]=u);let d;t[8]===a?d=t[9]:(d=(0,X.jsx)(pX,{actions:a}),t[8]=a,t[9]=d);let f;return t[10]!==c||t[11]!==l||t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`div`,{className:c,children:[l,u,d]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d,t[14]=f):f=t[14],f}function CX(e){let t=(0,Z.c)(31),{overlayId:n,title:r,message:i,confirmLabel:a,cancelLabel:o,confirmVariant:s,destructive:c,onConfirm:l,onCancel:u}=e,d=r===void 0?`Confirm`:r,f=a===void 0?`Confirm`:a,p=o===void 0?`Cancel`:o,m=s===void 0?`default`:s,h=c!==void 0&&c,{pop:g}=RY(),_;t[0]!==u||t[1]!==g?(_=()=>{u?.(),g()},t[0]=u,t[1]=g,t[2]=_):_=t[2];let v=_,y;t[3]!==l||t[4]!==g?(y=async()=>{await l(),g()},t[3]=l,t[4]=g,t[5]=y):y=t[5];let b=y,x;t[6]!==p||t[7]!==v?(x={label:p,variant:`outline`,onClick:v},t[6]=p,t[7]=v,t[8]=x):x=t[8];let S=h?`destructive`:m,C;t[9]!==f||t[10]!==b||t[11]!==S?(C={label:f,variant:S,onClick:b},t[9]=f,t[10]=b,t[11]=S,t[12]=C):C=t[12];let w;t[13]!==C||t[14]!==x?(w=[x,C],t[13]=C,t[14]=x,t[15]=w):w=t[15];let T=w,E;t[16]===h?E=t[17]:(E=h&&(0,X.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-destructive/10`,children:(0,X.jsx)(py,{className:`size-5 text-destructive`})}),t[16]=h,t[17]=E);let D=h&&`pt-2`,O;t[18]===D?O=t[19]:(O=Q(`text-muted-foreground text-sm`,D),t[18]=D,t[19]=O);let k;t[20]!==i||t[21]!==O?(k=(0,X.jsx)(`p`,{className:O,children:i}),t[20]=i,t[21]=O,t[22]=k):k=t[22];let A;t[23]!==E||t[24]!==k?(A=(0,X.jsxs)(`div`,{className:`flex gap-4`,children:[E,k]}),t[23]=E,t[24]=k,t[25]=A):A=t[25];let j;return t[26]!==T||t[27]!==n||t[28]!==A||t[29]!==d?(j=(0,X.jsx)(SX,{actions:T,overlayId:n,title:d,children:A}),t[26]=T,t[27]=n,t[28]=A,t[29]=d,t[30]=j):j=t[30],j}function wX(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 lg:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a||t[8]!==i?(o=(0,X.jsx)(`input`,{className:a,"data-slot":`input`,type:i,...r}),t[6]=r,t[7]=a,t[8]=i,t[9]=o):o=t[9],o}function TX(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`label`,{className:i,"data-slot":`label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function EX(e){return Array.isArray(e)?e:e==null?[]:[e]}var DX=class extends Error{constructor(...e){super(...e),this.name=`AbortError`}};function OX(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}function kX(e){return!e||typeof e!=`object`?!1:`next`in e&&typeof e.next==`function`&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]==`function`}var AX=Symbol.asyncDispose??Symbol.for(`asyncDispose`),jX=class{isDone=!1;isExecuteComplete=!1;cleanup;next;constructor(e,t){this.cleanup=t,this.next=OX(async()=>{if(this.isDone)return{done:!0,value:void 0};let t;try{let t=await e();return t.done&&(this.isDone=!0),t}catch(e){throw t={value:e},this.isDone=!0,e}finally{this.isDone&&!this.isExecuteComplete&&(this.isExecuteComplete=!0,await this.cleanup(t?{kind:`error`,error:t.value}:{kind:`success`}))}})}async return(e){return this.isDone=!0,this.isExecuteComplete||(this.isExecuteComplete=!0,await this.cleanup({kind:`cancelled`})),{done:!0,value:e}}async throw(e){throw this.isDone=!0,this.isExecuteComplete||(this.isExecuteComplete=!0,await this.cleanup({kind:`cancelled`,error:e})),e}async[AX](){this.isDone=!0,this.isExecuteComplete||(this.isExecuteComplete=!0,await this.cleanup({kind:`cancelled`}))}[Symbol.asyncIterator](){return this}};function MX(e){if(e)return JSON.parse(e)}function NX(e){return JSON.stringify(e)}function PX(e){if(!e)return!1;let t=typeof e;return t===`object`||t===`function`}var FX=new WeakMap;function IX(e,t,{bind:n=!0}={}){let r=Reflect.get(e,t);if(!n||typeof r!=`function`)return r;let i=FX.get(r);i||FX.set(r,i=new WeakMap);let a=i.get(e);return a||i.set(e,a=r.bind(e)),a}function LX(e){try{return decodeURIComponent(e)}catch{return e}}function RX(e){return e[0]??{}}var zX=`orpc`;function BX(e){return e instanceof Error&&e.name.includes(`Abort`)}function VX(e){let t;return()=>{if(t)return t.result;let n=e();return t={result:n},n}}function HX(e){return`/${e.map(encodeURIComponent).join(`/`)}`}var UX=2,WX=Symbol.for(`ORPC_OPENTELEMETRY_CONFIG`);function GX(){return globalThis[WX]}function KX(e){let t=GX()?.tracer;if(!t)return;let{name:n,context:r,...i}=typeof e==`string`?{name:e}:e;return t.startSpan(n,i,r)}function qX(e,t){if(!e)return;let n=JX(t);e.recordException(n),BX(t)||e.setStatus({code:UX,message:n.message})}function JX(e){if(e instanceof Error){let t={message:e.message,name:e.name,stack:e.stack};return`code`in e&&(typeof e.code==`string`||typeof e.code==`number`)&&(t.code=e.code),t}return{message:String(e)}}async function YX(e,t){let n=GX()?.tracer;if(!n)return t();typeof e==`string`&&(e={name:e});let r=async e=>{try{return await t(e)}catch(t){throw qX(e,t),t}finally{e.end()}};return e.context?n.startActiveSpan(e.name,e,e.context,r):n.startActiveSpan(e.name,e,r)}async function XX(e,t){let n=GX();if(!e||!n)return t();let r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function ZX(e,{runWith:t,mapResult:n,mapError:r,onError:i,onFinish:a}){t??=e=>e();let o;return new jX(async()=>{try{let r;try{r=await t(()=>e.next()),o=r.done}catch(e){throw o=!0,e}return n?await n(r):r}catch(e){throw await i?.(e),r?await r(e):e}},async n=>{try{if(!o)try{await t(async()=>e.return?.())}catch(e){throw await i?.(e),e}}finally{await a?.()}})}function QX(e,t){let n=VX(()=>KX(e));return ZX(t,{runWith:e=>XX(n(),e),mapResult(e){return n()?.addEvent(e.done?`completed`:`yielded`),e},onError(e){qX(n(),e)},onFinish(){n()?.end()}})}function $X(e,...t){return typeof e==`function`?e(...t):e}function eZ(e,t){return new Proxy(typeof e==`function`?t:e,{get(n,r){return IX(r in t?t:$X(e),r)},has(n,r){return Reflect.has(t,r)||Reflect.has($X(e),r)}})}function tZ(e){return PX(e)?Object.getPrototypeOf(e)?.constructor:null}function nZ(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function rZ(e,t){let n=e;for(let e of t){if(!PX(n)||!Object.hasOwn(n,e))return;n=n[e]}return n}var iZ=(()=>{let e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function aZ(e){let t=new iZ,n=e;for(;n&&n!==Object.prototype;){for(let r of Object.getOwnPropertyNames(n)){if(r===`constructor`||r in t)continue;let n=e[r];typeof n==`function`&&(t[r]=n.bind(e))}for(let r of Object.getOwnPropertySymbols(n)){if(r in t)continue;let n=e[r];typeof n==`function`&&(t[r]=n.bind(e))}n=Object.getPrototypeOf(n)}return t}function oZ(e,t,n){if(!e?.length)return n(t);let r=(t,i)=>{let a=e[i];return a?a({...t,next:(e=t)=>r(e,i+1)}):n(t)};return r(t,0)}function sZ(e){let t=e.length,n=new Map;for(let r=0;r<t;r++){let t=e[r],i=n.get(t.name);i===void 0?n.set(t.name,[r]):i.push(r)}let r=Array.from({length:t},()=>new Set);for(let i=0;i<t;i++){let t=e[i],a=t.before;if(a!==void 0)for(let e of a){let t=n.get(e);if(t!==void 0)for(let e of t){let t=r[e];t!==void 0&&t.add(i)}}let o=t.after;if(o!==void 0){let e=r[i];if(e!==void 0)for(let t of o){let r=n.get(t);if(r!==void 0)for(let t of r)e.add(t)}}}let i=[],a=new Set,o=new Set;function s(t){if(o.has(t))return;if(a.has(t)){let n=e[t],r=n===void 0?`unknown`:n.name;throw Error(`Circular dependency detected involving plugin "${r}"`)}a.add(t);let n=r[t];if(n!==void 0)for(let e of n)s(e);a.delete(t),o.add(t);let c=e[t];c!==void 0&&i.push(c)}for(let e=0;e<t;e++)s(e);return i}var cZ=class extends TypeError{},lZ=class extends TypeError{},uZ=class extends Error{constructor(e,t={}){super(t?.message??`Error Event`,t),this.data=e}},dZ=/\r\n|[\n\r]/,fZ=/(?:\r\n|\r(?!\n)|\n)(?:\r\n|\r(?!\n)|\n)/,pZ=/^\s/;function mZ(e){let t=e.split(dZ),n={};for(let e of t){let t=e.indexOf(`:`),r=t===-1?e:e.slice(0,t),i=t===-1?``:e.slice(t+1).replace(pZ,``);if(t===0)n.comments??=[],n.comments.push(i);else if(r===`data`)n.data===void 0?n.data=i:n.data+=`
|
|
92
|
-
${i}`;else if(r===`event`)n.event=i;else if(r===`id`)n.id=i;else if(r===`retry`){let e=Number.parseInt(i);Number.isInteger(e)&&e>=0&&e.toString()===i&&(n.retry=e)}}return n}var
|
|
93
|
-
`)&&(e=e.slice(1)),this.trailingCR=e.endsWith(`\r`),this.incomplete+=e;let t=this.incomplete.split(
|
|
94
|
-
`}return t}function
|
|
95
|
-
`;return t}function
|
|
96
|
-
`),e.retry!==void 0&&(
|
|
97
|
-
`),e.id!==void 0&&(
|
|
98
|
-
`),t+=
|
|
99
|
-
`,t}var EZ=Symbol.for(`STANDARDSERVER_EVENT_META`),DZ=Symbol.for(`STANDARDSERVER_EVENT_SOURCE`);function OZ(e,t){let n;if(t.id!==void 0&&(yZ(t.id),n??={},n.id=t.id),t.retry!==void 0&&(xZ(t.retry),n??={},n.retry=t.retry),t.comments!==void 0){for(let e of t.comments)SZ(e);n??={},n.comments=t.comments}return n?new Proxy(e,{get(e,t,r){return t===DZ?e:t===EZ?n:IX(e,t)}}):e}function kZ(e){if(!PX(e))return[e,void 0];let t=e[EZ];return[e[DZ]??e,t]}function AZ(e){if(PX(e))return e[EZ]}function jZ(e){return`inline; filename="${e.replace(/[^\x20-\x7E]/g,`_`).replace(/"/g,`\\"`)}"; filename*=utf-8''${encodeURIComponent(e).replace(/['()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)))}`}function MZ(e){let t=e.match(/filename\*=(UTF-8'')?([^;]*)/i);if(t&&typeof t[2]==`string`)return LX(t[2]);let n=e.match(/filename="((?:\\"|[^"])*)"/i);if(n&&typeof n[1]==`string`)return n[1].replace(/\\"/g,`"`)}function NZ(e,t){let n={...e};for(let e in t)Array.isArray(t[e])?n[e]=[...EX(n[e]),...t[e]]:t[e]!==void 0&&(n[e]=Array.isArray(n[e])?[...n[e],t[e]]:n[e]===void 0?t[e]:[n[e],t[e]]);return n}function PZ(e){let t=e.indexOf(`#`),n=e.indexOf(`?`),r=n!==-1&&(t===-1||n<t),i=r?n:t===-1?e.length:t,a=t===-1?e.length:t;return[e.slice(0,i),r?e.slice(n,a):void 0,t===-1?void 0:e.slice(t)]}var FZ={BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_SUPPORTED:405,NOT_ACCEPTABLE:406,TIMEOUT:408,CONFLICT:409,GONE:410,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,UNSUPPORTED_MEDIA_TYPE:415,UNPROCESSABLE_CONTENT:422,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504},IZ,LZ=class e extends Error{static{let t=Symbol.for(`ORPC_ERROR_CONSTRUCTORS`);globalThis[t]??=new WeakSet,IZ=globalThis[t],IZ.add(e)}name=`ORPCError`;defined=!1;inferable=!1;code;data;constructor(e,...t){let n=RX(t),r=n.message??e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `);super(r,n),this.code=e,this.data=n.data}toJSON(){return{defined:this.defined,inferable:this.inferable,code:this.code,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(!IZ.has(this))return super[Symbol.hasInstance](e);let t=tZ(e);return t&&IZ.has(t)?!0:super[Symbol.hasInstance](e)}};function RZ(e){return e instanceof LZ?e:new LZ(`INTERNAL_SERVER_ERROR`,{cause:e})}function zZ(e){if(!nZ(e))return!1;let t=[`defined`,`inferable`,`code`,`message`,`data`];return!Object.keys(e).some(e=>!t.includes(e))&&`defined`in e&&typeof e.defined==`boolean`&&`inferable`in e&&typeof e.inferable==`boolean`&&`code`in e&&typeof e.code==`string`&&`message`in e&&typeof e.message==`string`}function BZ(e,t={}){let n=new LZ(e.code,{...e,...t});return n.defined=e.defined,n.inferable=e.inferable,n}function VZ(e,{mapResult:t,mapError:n,...r}){return ZX(e,{...r,mapResult:t&&(async e=>{let n=await t(e);if(n.value!==e.value){let t=AZ(e.value);if(t&&PX(n.value))return{done:n.done,value:OZ(n.value,t)}}return n}),mapError:n&&(async e=>{let t=await n(e);if(t!==e){let n=AZ(e);if(n&&PX(t))return OZ(t,n)}return t})})}var HZ=/^\/(.*)\/([a-z]*)$/,UZ={undefined:{condition(e){return e===void 0},serialize(){return null},deserialize(){},isTerminal:!0},bigint:{condition(e){return typeof e==`bigint`},serialize(e){return e.toString()},deserialize(e){return BigInt(e)},isTerminal:!0},date:{condition(e){return e instanceof Date},serialize(e){return Number.isNaN(e.getTime())?null:e.toISOString()},deserialize(e){return new Date(e??`Invalid Date`)},isTerminal:!0},nan:{condition(e){return typeof e==`number`&&Number.isNaN(e)},serialize(){return null},deserialize(){return NaN},isTerminal:!0},url:{condition(e){return e instanceof URL},serialize(e){return e.toString()},deserialize(e){return new URL(e)},isTerminal:!0},regexp:{condition(e){return e instanceof RegExp},serialize(e){return e.toString()},deserialize(e){let[,t,n]=e.match(HZ);return new RegExp(t,n)},isTerminal:!0},set:{condition(e){return e instanceof Set},serialize(e){return Array.from(e)},deserialize(e){return new Set(e)}},map:{condition(e){return e instanceof Map},serialize(e){return Array.from(e.entries())},deserialize(e){return new Map(e)}}},WZ=class{handlers;omitUndefinedProperties;constructor(e={}){this.handlers={...UZ,...e.handlers},this.omitUndefinedProperties=e.omitUndefinedProperties!==!1}serialize(e){let[t,n,r,i]=this.serializeValue(e,[],[],[],[]),a=n.length===0?void 0:n;return r.length===0?{json:t,meta:a}:{json:t,meta:a,maps:r,blobs:i}}serializeValue(e,t,n,r,i){for(let a in this.handlers){let o=this.handlers[a];if(o&&o.condition(e)){let s=o.serialize(e);if(o.isTerminal)return n.push([a,...t]),[s,n,r,i];let c=this.serializeValue(s,t,n,r,i);return n.push([a,...t]),c}}if(e instanceof Blob)return r.push(t),i.push(e),[e,n,r,i];if(Array.isArray(e))return[e.map((e,a)=>this.serializeValue(e,[...t,a],n,r,i)[0]),n,r,i];if(nZ(e)){let a={};for(let o in e){let s=e[o];(o!==`toJSON`||typeof s!=`function`)&&(s===void 0&&this.omitUndefinedProperties||(a[o]=this.serializeValue(s,[...t,o],n,r,i)[0]))}return[a,n,r,i]}return[e,n,r,i]}deserialize(e){let t={data:e.json};return e.blobs?.length&&e.maps.forEach((n,r)=>{let i=t,a=`data`;n.forEach(e=>{if(i=i[a],a=e,!Object.hasOwn(i,a))throw Error(`Security error: Invalid serialized data. Segment "${a}" does not exist.`)}),i[a]=e.blobs[r]}),e.meta?.forEach(e=>{let n=e[0],r=t,i=`data`;for(let t=1;t<e.length;t++)if(r=r[i],i=e[t],!Object.hasOwn(r,i))throw Error(`Security error: Invalid serialized data. Segment "${i}" does not exist.`);r[i]=this.handlers[n].deserialize(r[i])}),t.data}},GZ=class{jsonSerializer;defaultSerializeOptions;constructor(e={}){this.jsonSerializer=new WZ(e),this.defaultSerializeOptions=e.serialize}serialize(e,t={}){return e===void 0||e instanceof ReadableStream||e instanceof Blob?e:kX(e)?VZ(e,{mapResult:e=>e.value===void 0?e:{done:e.done,value:this.serializeValue(e.value,t)},mapError:e=>new uZ(this.serializeValue(RZ(e).toJSON(),{...t,useFormDataForBlobFields:!1}),{cause:e})}):this.serializeValue(e,t)}serializeValue(e,t){let n=t.useFormDataForBlobFields??this.defaultSerializeOptions?.useFormDataForBlobFields??!0,{json:r,meta:i,maps:a,blobs:o}=this.jsonSerializer.serialize(e);if(!n||!o?.length)return{json:r,meta:i};let s=new FormData;return s.set(`data`,NX({json:r,meta:i,maps:a})),o.forEach((e,t)=>{s.set(t.toString(),e)}),s}deserialize(e){return e===void 0||e instanceof ReadableStream||e instanceof Blob?e:kX(e)?VZ(e,{mapResult:e=>e.value===void 0?e:{done:e.done,value:this.deserializeValue(e.value)},mapError:e=>{if(!(e instanceof uZ))return e;let t=this.deserializeValue(e.data);return zZ(t)?BZ(t,{cause:e}):new uZ(t,{cause:e})}}):this.deserializeValue(e)}deserializeValue(e){if(!(e instanceof FormData))return this.jsonSerializer.deserialize(e);let t=JSON.parse(e.get(`data`)),n=[];for(let[t,r]of e)r instanceof Blob&&(n[Number(t)]=r);return this.jsonSerializer.deserialize({...t,blobs:n})}},KZ=new Set([`then`,`bind`,`valueOf`,`toString`,`toJSON`]);function qZ(e){return{...e,context:e.context??{}}}function JZ(e){return[e[0],qZ(e[1]??{})]}function YZ(e,{path:t=[],...n}={}){return new Proxy((...r)=>{let[i,a]=JZ(r);return oZ([...EX(n.interceptors),...EX(n.scoped?.interceptors)],{...a,input:i,path:t},({path:t,input:n,...r})=>e.call(t,n,r))},{get(r,i){if(typeof i!=`string`||KZ.has(i))return IX(r,i);let a=n.scoped===void 0?void 0:n.scoped[i];return YZ(e,{...n,path:[...t,i],scoped:a})}})}var XZ=class{constructor(e=[]){this.plugins=e,this.plugins=sZ(e)}name=`~composite`;init(e){for(let t of this.plugins)t.init&&(e=t.init(e));return e}initProcedureOptions(e,t){for(let n of this.plugins)n.initProcedureOptions&&(t=n.initProcedureOptions(e,t));return t}};function ZZ(e,t={}){return[...t.prefix===void 0?[]:[t.prefix],e,{...t.input===void 0?{}:{input:t.input},...t.type===void 0?{}:{type:t.type},...t.fnOptions===void 0?{}:{fnOptions:t.fnOptions}}]}function QZ(e){return async t=>{let n=await e(t),r;for await(let e of n)t.signal?.throwIfAborted(),r={chunk:e},t.client.setQueryData(t.queryKey,e);if(!r)throw TypeError(`Live query for ${NX(t.queryKey)} did not yield any data. Ensure the query function returns an AsyncIterable with at least one chunk.`);return r.chunk}}var $Z=class{constructor(e,t){this.path=e,this.options=t}key(e={}){return ZZ(this.path,{...e,prefix:this.options.prefix})}};function eQ(e,{refetchMode:t=`reset`,maxChunks:n=1/0}={}){return async r=>{let i=r.client.getQueryCache().find({queryKey:r.queryKey,exact:!0}),a=!!i&&i.state.data!==void 0;a&&(t===`reset`?i.setState({status:`pending`,data:void 0,error:null,fetchStatus:`fetching`}):r.client.setQueryData(r.queryKey,(e=[])=>tQ(e,n)));let o=[],s=await e(r),c=!a||t!==`replace`;r.client.setQueryData(r.queryKey,(e=[])=>tQ(e,n));for await(let e of s){if(r.signal.aborted)throw r.signal.reason;o.push(e),o=tQ(o,n),c&&r.client.setQueryData(r.queryKey,(t=[])=>tQ([...t,e],n))}c||r.client.setQueryData(r.queryKey,o);let l=r.client.getQueryData(r.queryKey);return l?tQ(l,n):o}}function tQ(e,t){return e.length<=t?e:e.slice(e.length-t)}var nQ=Symbol.for(`ORPC_TANSTACK_QUERY_OPERATION_CONTEXT`),rQ=[`queryInterceptors`,`streamedInterceptors`,`liveInterceptors`,`infiniteInterceptors`,`mutationInterceptors`],iQ=[`queryKey`,`queryOptions`,`streamedKey`,`streamedOptions`,`liveKey`,`liveOptions`,`infiniteKey`,`infiniteOptions`,`mutationKey`,`mutationOptions`];function aQ(e){if(!PX(e))return!1;for(let t in e)if(e[t]!==void 0){if(t===`prefix`){if(typeof e[t]!=`string`)return!1}else if(rQ.includes(t)){if(!Array.isArray(e[t])||e[t].some(e=>typeof e!=`function`))return!1}else if(iQ.includes(t)&&!PX(e[t]))return!1}return!0}function oQ(e,t){if(typeof e!=`function`&&typeof t!=`function`)return{...e,...t};let n=typeof e==`function`?e:t=>({...e,...t}),r=typeof t==`function`?t:e=>({...t,...e});return e=>r(n(e))}function sQ(e,t){let n={...e,...t};for(let r of rQ){let i=e[r],a=t[r];i&&a&&(n[r]=[...i,...a])}for(let r of iQ){let i=e[r],a=t[r];i&&a&&(n[r]=oQ(i,a))}return n}var cQ=class extends $Z{call;constructor(e,t,n={}){super(e,n),this.call=t}queryKey(...e){let t=RX(e);return typeof this.options.queryKey==`function`?t=this.options.queryKey(t):this.options.queryKey&&(t={...this.options.queryKey,...t}),t.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`query`,input:t.input})}queryOptions(...e){let t=RX(e);typeof this.options.queryOptions==`function`?t=this.options.queryOptions(t):this.options.queryOptions&&(t={...this.options.queryOptions,...t});let n=this.queryKey(t);return{...t,queryKey:n,queryFn:e=>oZ(this.options.queryInterceptors,{path:this.path,context:{[nQ]:{key:n,type:`query`},...t.context},input:t.input,fnContext:e},({context:e,input:n,fnContext:r})=>{if(n===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(r):this.call(n,{signal:r.signal,context:e})}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}streamedKey(...e){let t=RX(e);return typeof this.options.streamedKey==`function`?t=this.options.streamedKey(t):this.options.streamedKey&&(t={...this.options.streamedKey,...t}),t.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`streamed`,input:t.input,fnOptions:t.queryFnOptions})}streamedOptions(...e){let t=RX(e);typeof this.options.streamedOptions==`function`?t=this.options.streamedOptions(t):this.options.streamedOptions&&(t={...this.options.streamedOptions,...t});let n=this.streamedKey(t);return{...t,queryKey:n,queryFn:e=>oZ(EX(this.options.streamedInterceptors),{path:this.path,context:{[nQ]:{key:n,type:`streamed`},...t.context},input:t.input,fnContext:e},({context:e,fnContext:n,input:r})=>{if(r===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(n):eQ(async t=>{let n=await this.call(r,{signal:t.signal,context:e});if(!kX(n))throw Error(`streamedQuery requires an AsyncIteratorObject output`);return n},t.queryFnOptions)(n)}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}liveKey(...e){let t=RX(e);return typeof this.options.liveKey==`function`?t=this.options.liveKey(t):this.options.liveKey&&(t={...this.options.liveKey,...t}),t.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`live`,input:t.input})}liveOptions(...e){let t=RX(e);typeof this.options.liveOptions==`function`?t=this.options.liveOptions(t):this.options.liveOptions&&(t={...this.options.liveOptions,...t});let n=this.liveKey(t);return{...t,queryKey:n,queryFn:e=>oZ(EX(this.options.liveInterceptors),{path:this.path,context:{[nQ]:{key:n,type:`live`},...t.context},input:t.input,fnContext:e},({fnContext:e,input:n,context:r})=>{if(n===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(e):QZ(async e=>{let t=await this.call(n,{signal:e.signal,context:r});if(!kX(t))throw Error(`liveQuery requires an AsyncIteratorObject output`);return t})(e)}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}infiniteKey(e){return typeof this.options.infiniteKey==`function`?e=this.options.infiniteKey(e):this.options.infiniteKey&&(e={...this.options.infiniteKey,...e}),e.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`infinite`,input:e.input===B?B:e.input(e.initialPageParam)})}infiniteOptions(e){typeof this.options.infiniteOptions==`function`?e=this.options.infiniteOptions(e):this.options.infiniteOptions&&(e={...this.options.infiniteOptions,...e});let t=this.infiniteKey(e);return{...e,queryKey:t,queryFn:n=>oZ(EX(this.options.infiniteInterceptors),{path:this.path,context:{[nQ]:{key:t,type:`infinite`},...e.context},input:e.input===B?B:e.input(n.pageParam),fnContext:n},({context:t,input:n,fnContext:r})=>{if(n===B||e.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return e.queryFn?e.queryFn(r):this.call(n,{signal:r.signal,context:t})}),...e.input===B||e.queryFn===B?{enabled:!1}:{}}}mutationKey(e={}){return typeof this.options.mutationKey==`function`?e=this.options.mutationKey(e):this.options.mutationKey&&(e={...this.options.mutationKey,...e}),e.mutationKey??ZZ(this.path,{prefix:this.options.prefix,type:`mutation`})}mutationOptions(...e){let t=RX(e);typeof this.options.mutationOptions==`function`?t=this.options.mutationOptions(t):this.options.mutationOptions&&(t={...this.options.mutationOptions,...t});let n=this.mutationKey(t);return{...t,mutationKey:n,mutationFn:(e,r)=>oZ(EX(this.options.mutationInterceptors),{path:this.path,context:{[nQ]:{key:n,type:`mutation`},...t.context},fnContext:r,input:e},({input:e,fnContext:n,context:r})=>t.mutationFn?t.mutationFn(e,n):this.call(e,{context:r}))}}};function lQ(e,t={}){let n=new XZ(t.plugins);return t=n.init(t),uQ(e,t,n)}function uQ(e,t,n){let r=EX(t.path),i=typeof e==`function`&&(t.scoped===void 0||aQ(t.scoped))?aZ(new cQ(r,e,n.initProcedureOptions(r,sQ({prefix:t.prefix,queryInterceptors:t.queryInterceptors,streamedInterceptors:t.streamedInterceptors,liveInterceptors:t.liveInterceptors,infiniteInterceptors:t.infiniteInterceptors,mutationInterceptors:t.mutationInterceptors},t.scoped??{})))):aZ(new $Z(r,t));return new Proxy(i,{get(i,a){let o=IX(i,a),s=e[a];if(typeof a!=`string`||KZ.has(a)||!PX(s))return o;let c=uQ(s,{...t,path:[...r,a],scoped:rZ(t.scoped,[a])},n);return typeof o==`function`?new Proxy(o,{get(e,t){return typeof t!=`string`||KZ.has(t)?IX(e,t):IX(c,t)}}):c}})}function dQ(e){let t=(e?.pipeThrough(new TextDecoderStream).pipeThrough(new gZ))?.getReader(),n=!1;return new jX(async()=>{for(;;){if(t===void 0)return{done:!0,value:void 0};let{done:e,value:r}=await t.read();if(e){if(n)throw new DX(`Stream was cancelled`);return{done:!0,value:void 0}}switch(r.event){case`message`:{let e=MX(r.data);return PX(e)&&(e=OZ(e,r)),{done:!1,value:e}}case`error`:{let e=new uZ(MX(r.data));throw e=OZ(e,r),e}case`close`:{let e=MX(r.data);return PX(e)&&(e=OZ(e,r)),{done:!0,value:e}}}}},async e=>{e.kind===`cancelled`&&(n=!0),await t?.cancel()})}function fQ(e,t={}){let n=t.keepAlive?.enabled??!0,r=t.keepAlive?.interval??15e3,i=t.keepAlive?.comment??``,a=t.initialComment?.enabled??!0,o=t.initialComment?.comment??``,s=t.emptyCloseEventEnabled??!0,c=!1,l;return new ReadableStream({start(e){a&&e.enqueue(TZ({comments:[o]}))},async pull(t){try{n&&(l=setInterval(()=>{t.enqueue(TZ({comments:[i]}))},r));let a=await e.next();if(clearInterval(l),c)return;let[o,u]=kZ(a.value);if(!a.done||o!==void 0||u!==void 0||s){let e=a.done?`close`:`message`;t.enqueue(TZ({...u,event:e,data:NX(o)}))}a.done&&t.close()}catch(e){if(clearInterval(l),c)return;e instanceof uZ?(t.enqueue(TZ({...AZ(e),event:`error`,data:NX(e.data)})),t.close()):t.error(e)}},async cancel(){c=!0,clearInterval(l),await e.return?.()}}).pipeThrough(new TextEncoderStream)}async function pQ(e,t){let n=t?.hint??e.headers.get(`standard-server`),r=e.headers.get(`content-type`)?.split(`;`)[0]?.trim(),i=e.headers.get(`content-length`);if(n!==`none`&&(n!==null||r!==void 0||i!==`0`&&i!==null)&&(n!==null||e.body!==null)){if(e.bodyUsed)throw TypeError(`Failed to read body: body stream already read`);if(n===`json`||n===null&&r===`application/json`)return MX(await e.text());if(n===`form-data`||n===null&&r===`multipart/form-data`)return await e.formData();if(n===`url-search-params`||n===null&&r===`application/x-www-form-urlencoded`){let t=await e.text();return new URLSearchParams(t)}if(n===`event-stream`||n===null&&r===`text/event-stream`)return dQ(e.body);if(n===`file`||n===null&&i!==null){let t=e.headers.get(`content-disposition`),n=t===null?void 0:MZ(t),r=await e.blob();return new File([r],n??`blob`,{type:r.type})}return e.body??new ReadableStream({start(e){e.close()}})}}function mQ(e,t,n={}){return t={...t},e instanceof ReadableStream?(t[`standard-server`]??=`octet-stream`,t[`content-type`]??=`application/octet-stream`,[e,t]):e instanceof Blob?(t[`standard-server`]??=`file`,t[`content-type`]=e.type,t[`content-disposition`]??=jZ(e instanceof File?e.name:`blob`),Number.isFinite(e.size)?(t[`content-length`]=e.size.toString(),[e,t]):[e.stream(),t]):(t[`standard-server`]=void 0,t[`content-length`]=void 0,e===void 0?(t[`content-type`]=void 0,[void 0,t]):e instanceof FormData||e instanceof URLSearchParams?(t[`content-type`]=void 0,[e,t]):kX(e)?(t[`content-type`]=`text/event-stream`,[fQ(e,n.eventStream),t]):(t[`content-type`]=`application/json`,[NX(e),t]))}function hQ(e){let t={};return e.forEach((e,n)=>{Array.isArray(t[n])?t[n].push(e):t[n]===void 0?t[n]=e:t[n]=[t[n],e]}),t}function gQ(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.append(n,r);return t}function _Q(e){return{resolveBody:t=>pQ(e,{hint:t}),status:e.status,get headers(){let t=hQ(e.headers);return Object.defineProperty(this,"headers",{value:t,writable:!0}),t},set headers(e){Object.defineProperty(this,"headers",{value:e,writable:!0})}}}var vQ=class{name=`~composite`;plugins;constructor(e=[]){this.plugins=sZ(e)}init(e){for(let t of this.plugins)t.init&&(e=t.init(e));return e}},yQ=class{constructor(e,t,n={}){this.codec=e,this.transport=t,n=new vQ(n.plugins).init(n),this.interceptors=n.interceptors,this.transportInterceptors=n.transportInterceptors}interceptors;transportInterceptors;call(e,t,n){return YX(`${zX}.${e.join(`/`)}`,r=>(r?.setAttribute(`rpc.system`,zX),r?.setAttribute(`rpc.method`,e.join(`.`)),kX(t)&&(t=eZ(t,QX(`consume_async_iterator_object_input`,t))),oZ(this.interceptors,{...n,path:e,input:t},async({path:e,input:t,...n})=>{let i=GX(),a,o=i?.trace.getActiveSpan()??r;o&&i&&(a=i.trace.setSpan(i.context.active(),o));let s=await YX({name:`encode_input`,context:a},()=>this.codec.encodeInput(t,e,n));if(a&&i?.propagation){let e={...s.headers};i.propagation.inject(a,e),s={...s,headers:e}}let c=await oZ(this.transportInterceptors,{...n,path:e,request:s},({path:e,request:t,...n})=>{let r,a=i?.trace.getActiveSpan()??o;return a&&i&&(r=i.trace.setSpan(i.context.active(),a)),YX({name:`send_request`,context:r},()=>this.transport.send(t,e,n))}),l=await YX({name:`decode_response`,context:a},()=>this.codec.decodeResponse(c,e,n));if(l.kind===`error`)throw l.error;let u=l.output;return kX(u)?eZ(u,QX(`consume_async_iterator_object_output`,u)):u})))}},bQ=/\/$/,xQ=class{baseUrl;maxUrlLength;fallbackMethod;expectedMethod;headers;serializer;constructor(e){this.baseUrl=e.url??`/`,this.maxUrlLength=e.maxUrlLength??2083,this.fallbackMethod=e.fallbackMethod??`POST`,this.expectedMethod=e.method??this.fallbackMethod,this.headers=e.headers??{},this.serializer=e.serializer??new GZ}async encodeInput(e,t,n){let r=SQ(await $X(this.headers,n,t,e));n.lastEventId!==void 0&&(r=NZ(r,{"last-event-id":n.lastEventId}));let i=await $X(this.expectedMethod,n,t,e),[a,o,s]=PZ(await $X(this.baseUrl,n,t,e)),c=`${a.replace(bQ,``)}${HX(t)}`,l=this.serializer.serialize(e);if(i===`GET`&&!(l instanceof Blob)&&!(l instanceof ReadableStream)&&!(l instanceof FormData)&&!kX(l)){let a=await $X(this.maxUrlLength,n,t,e),u=new URLSearchParams(o);u.append(`data`,NX(l)??``);let d=`${c}?${u}${s??``}`;if(d.length<=a)return{body:void 0,method:i,headers:r,url:d,signal:n.signal}}return{url:`${c}${o??``}${s??``}`,method:i===`GET`?this.fallbackMethod:i,headers:r,body:l,signal:n.signal}}async decodeResponse(e){let t=e.status<400,n=await e.resolveBody(),r=await(async()=>{try{return this.serializer.deserialize(n)}catch(e){throw Error(`Invalid RPC response format.`,{cause:e})}})();return t?{kind:`output`,output:r}:zZ(r)?{kind:`error`,error:BZ(r)}:{kind:`error`,error:new LZ(`MALFORMED_ORPC_ERROR_RESPONSE`,{data:{headers:e.headers,status:e.status,body:r}})}}};function SQ(e){return typeof e.forEach==`function`?hQ(e):e}var CQ=class{constructor(e=[]){this.plugins=e,this.plugins=sZ(e)}name=`~composite/fetch-link-transport`;initFetchLinkTransportOptions(e){for(let t of this.plugins)t.initFetchLinkTransportOptions&&(e=t.initFetchLinkTransportOptions(e));return e}},wQ=VX(()=>{try{let e;return new Request(`https://example.com`,{method:`POST`,body:new ReadableStream,get duplex(){return e=`half`,`half`}}),e}catch{return}}),TQ=class{origin;fetch;toFetchRequestOptions;fetchInterceptors;constructor(e){e=new CQ(e.plugins).initFetchLinkTransportOptions(e),this.origin=e.origin,this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=e.toFetchRequest,this.fetchInterceptors=e.fetchInterceptors}async send(e,t,n){let r=await $X(this.origin,n,t);r?.endsWith(`/`)&&(r=r.slice(0,-1));let i=`${r??``}${e.url}`,[a,o]=mQ(e.body,e.headers,this.toFetchRequestOptions),s={body:a,headers:gQ(o),method:e.method,signal:n.signal,redirect:`manual`};if(a instanceof ReadableStream){let e=wQ();e!==void 0&&(s.duplex=e)}return _Q(await oZ(this.fetchInterceptors,{...n,url:i,path:t,init:s},({url:e,path:t,init:n,...r})=>this.fetch(e,n,r,t)))}},EQ=class extends yQ{constructor(e){let t=new xQ(e),n=new TQ(e);super(t,n,e)}};function DQ(e){return e==null}function OQ(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let a=r[i],o=e[a];t(o,a)||(n[a]=o)}return n}function kQ(e){if(typeof e==`string`)return e.trim()||void 0}function AQ(e){return Array.isArray(e)?e.flatMap(e=>{let t=kQ(e);return t?[t]:[]}):[]}function jQ(e,t=`Request failed`){let n=kQ(e);if(n)return n;if(typeof e!=`object`||!e)return t;let r=e,i=kQ(r.error)??kQ(r.message)??kQ(r.details)??t;if(r.code===`integration_validation_failed`){let e=AQ(r.invalidIntegrationIds);if(e.length>0)return`${i} (invalid integration IDs: ${e.join(`, `)})`}return i}var MQ=s(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function NQ(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var PQ=NQ;typeof Object.assign==`function`&&(PQ=Object.assign);function FQ(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function IQ(e){return typeof e==`object`&&!!e}function LQ(e){let t;for(t in e)return!1;return!0}function RQ(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function zQ(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function BQ(e){return!(!IQ(e)||e.attributes&&!Array.isArray(e.attributes))}function VQ(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function HQ(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function UQ(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var WQ=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},GQ=class e extends WQ{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},KQ=class e extends WQ{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},qQ=class e extends WQ{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function JQ(e,t){this.key=e,this.attributes=t,this.clear()}JQ.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function YQ(e,t){this.key=e,this.attributes=t,this.clear()}YQ.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function XQ(e,t){this.key=e,this.attributes=t,this.clear()}XQ.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function ZQ(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}ZQ.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},ZQ.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},ZQ.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},ZQ.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var QQ=0,$Q=1,e$=2,t$=3;function n$(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===QQ){if(s=e._nodes.get(r),!s)throw new KQ(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===t$){if(i=``+i,c=e._edges.get(i),!c)throw new KQ(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new KQ(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new KQ(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===$Q?c.source:c.target,l=i,u=a}return[s,l,u]}function r$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);return a.attributes[o]}}function i$(e,t,n){e.prototype[t]=function(e,r){let[i]=n$(this,t,n,e,r);return i.attributes}}function a$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function o$(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=n$(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function s$(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=n$(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new GQ(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function c$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function l$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);if(!IQ(o))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function u$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);if(!IQ(o))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return PQ(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function d$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);if(typeof o!=`function`)throw new GQ(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var f$=[{name:e=>`get${e}Attribute`,attacher:r$},{name:e=>`get${e}Attributes`,attacher:i$},{name:e=>`has${e}Attribute`,attacher:a$},{name:e=>`set${e}Attribute`,attacher:o$},{name:e=>`update${e}Attribute`,attacher:s$},{name:e=>`remove${e}Attribute`,attacher:c$},{name:e=>`replace${e}Attributes`,attacher:l$},{name:e=>`merge${e}Attributes`,attacher:u$},{name:e=>`update${e}Attributes`,attacher:d$}];function p$(e){f$.forEach(function({name:t,attacher:n}){n(e,t(`Node`),QQ),n(e,t(`Source`),$Q),n(e,t(`Target`),e$),n(e,t(`Opposite`),t$)})}function m$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function h$(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=``+e,a=``+arguments[1];if(r=FQ(this,i,a,n),!r)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function g$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function _$(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=FQ(this,o,s,n),!a)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function v$(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=FQ(this,o,s,n),!a)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new GQ(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function y$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function b$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!IQ(r))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function x$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!IQ(r))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return PQ(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function S$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new GQ(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var C$=[{name:e=>`get${e}Attribute`,attacher:m$},{name:e=>`get${e}Attributes`,attacher:h$},{name:e=>`has${e}Attribute`,attacher:g$},{name:e=>`set${e}Attribute`,attacher:_$},{name:e=>`update${e}Attribute`,attacher:v$},{name:e=>`remove${e}Attribute`,attacher:y$},{name:e=>`replace${e}Attributes`,attacher:b$},{name:e=>`merge${e}Attributes`,attacher:x$},{name:e=>`update${e}Attributes`,attacher:S$}];function w$(e){C$.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var T$=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function E$(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function D$(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function O$(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function k$(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function A$(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function j$(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function M$(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function N$(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function P$(e,t){if(e.size===0)return UQ();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function F$(e,t,n,r,i,a){let o=t?D$:E$,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function I$(e,t,n,r){let i=[];return F$(!1,e,t,n,r,function(e){i.push(e)}),i}function L$(e,t,n){let r=UQ();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=HQ(r,O$(n.in))),t!==`in`&&n.out!==void 0&&(r=HQ(r,O$(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=HQ(r,O$(n.undirected))),r}function R$(e,t,n,r,i,a,o){let s=n?A$:k$,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function z$(e,t,n,r,i){let a=[];return R$(!1,e,t,n,r,i,function(e){a.push(e)}),a}function B$(e,t,n,r){let i=UQ();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=HQ(i,j$(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=HQ(i,j$(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=HQ(i,j$(n.undirected,r))),i}function V$(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return M$(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new KQ(`Graph.${n}: could not find the "${e}" node in the graph.`);return I$(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new KQ(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${n}: could not find the "${t}" target node in the graph.`);return z$(r,this.multi,i,a,t)}throw new GQ(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function H$(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r===`mixed`||this.type===`mixed`||r===this.type){if(arguments.length===1)return n=e,N$(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return F$(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new KQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return R$(!1,r,this.multi,i,o,t,n)}throw new GQ(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new GQ(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new GQ(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function U$(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,N$(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return F$(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new KQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return R$(!0,r,this.multi,i,o,t,n)}throw new GQ(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function W$(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return UQ();if(!arguments.length)return P$(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return L$(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return B$(r,i,n,t)}throw new GQ(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function G$(e){T$.forEach(t=>{V$(e,t),H$(e,t),U$(e,t),W$(e,t)})}var K$=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function q$(){this.A=null,this.B=null}q$.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},q$.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function J$(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function Y$(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return J$(e,null,r,r.undirected,i);if(typeof n==`string`)return J$(e,null,r,r[n],i)}let a=new q$,o;if(t!==`undirected`){if(n!==`out`){if(o=J$(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=J$(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=J$(e,a,r,r.undirected,i),e&&o))return o}function X$(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return Y$(!1,e,t,n,function(e){r.push(e)}),r}function Z$(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Q$(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Z$(null,n,n.undirected);if(typeof t==`string`)return Z$(null,n,n[t])}let r=UQ(),i=new q$;return e!==`undirected`&&(t!==`out`&&(r=HQ(r,Z$(i,n,n.in))),t!==`in`&&(r=HQ(r,Z$(i,n,n.out)))),e!==`directed`&&(r=HQ(r,Z$(i,n,n.undirected))),r}function $$(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new KQ(`Graph.${n}: could not find the "${e}" node in the graph.`);return X$(r===`mixed`?this.type:r,i,t)}}function e1(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);Y$(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new GQ(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function t1(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new KQ(`Graph.${o}: could not find the "${e}" node in the graph.`);return Y$(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function n1(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return UQ();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return Q$(r===`mixed`?this.type:r,i,t)}}function r1(e){K$.forEach(t=>{$$(e,t),e1(e,t),t1(e,t),n1(e,t)})}function i1(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function a1(e,t){let n={key:e};return LQ(t.attributes)||(n.attributes=PQ({},t.attributes)),n}function o1(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return LQ(n.attributes)||(r.attributes=PQ({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function s1(e){if(!IQ(e))throw new GQ(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new GQ(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!IQ(e.attributes)||e.attributes===null))throw new GQ(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function c1(e){if(!IQ(e))throw new GQ(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new GQ(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new GQ(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!IQ(e.attributes)||e.attributes===null))throw new GQ(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new GQ(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var qle=VQ(),Jle=new Set([`directed`,`undirected`,`mixed`]),l1=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),Yle=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],Xle={allowSelfLoops:!0,multi:!1,type:`mixed`};function Zle(e,t,n){if(n&&!IQ(n))throw new GQ(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new qQ(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function u1(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function d1(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new qQ(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new qQ(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!IQ(s))throw new GQ(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new qQ(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new KQ(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new KQ(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new qQ(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new qQ(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let d=new ZQ(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function Qle(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new qQ(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new qQ(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new GQ(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!IQ(s))throw new GQ(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new qQ(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new qQ(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else PQ(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new qQ(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=u1(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=u1(e,o,{}),g=!0),f=new ZQ(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function f1(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var p1=class e extends MQ.EventEmitter{constructor(e){if(super(),e=PQ({},Xle,e),typeof e.multi!=`boolean`)throw new GQ(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Jle.has(e.type))throw new GQ(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new GQ(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?JQ:e.type===`directed`?YQ:XQ;RQ(this,`NodeDataClass`,t);let n=`geid_`+qle()+`_`,r=0;RQ(this,`_attributes`,{}),RQ(this,`_nodes`,new Map),RQ(this,`_edges`,new Map),RQ(this,`_directedSize`,0),RQ(this,`_undirectedSize`,0),RQ(this,`_directedSelfLoopCount`,0),RQ(this,`_undirectedSelfLoopCount`,0),RQ(this,`_edgeKeyGenerator`,()=>{let e;do e=n+r++;while(this._edges.has(e));return e}),RQ(this,`_options`,e),l1.forEach(e=>RQ(this,e,this[e])),zQ(this,`order`,()=>this._nodes.size),zQ(this,`size`,()=>this._edges.size),zQ(this,`directedSize`,()=>this._directedSize),zQ(this,`undirectedSize`,()=>this._undirectedSize),zQ(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),zQ(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),zQ(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),zQ(this,`multi`,this._options.multi),zQ(this,`type`,this._options.type),zQ(this,`allowSelfLoops`,this._options.allowSelfLoops),zQ(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new GQ(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new GQ(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new GQ(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new qQ(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new qQ(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new qQ(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`directed`&&t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new KQ(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new KQ(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new KQ(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Zle(this,e,t).key}mergeNode(e,t){if(t&&!IQ(t))throw new GQ(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(PQ(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new GQ(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do f1(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do f1(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do f1(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=FQ(this,e,n,this.type),!t)throw new KQ(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new KQ(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return f1(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new qQ(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new qQ(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=FQ(this,e,t,`directed`);if(!n)throw new KQ(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return f1(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new qQ(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new qQ(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=FQ(this,e,t,`undirected`);if(!n)throw new KQ(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return f1(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new GQ(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!IQ(e))throw new GQ(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!IQ(e))throw new GQ(`Graph.mergeAttributes: provided attributes are not a plain object.`);return PQ(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new GQ(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new GQ(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!BQ(t))throw new GQ(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new GQ(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!BQ(t))throw new GQ(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAdjacencyEntry: expecting a callback.`);i1(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);i1(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);i1(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);i1(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new GQ(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new GQ(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new GQ(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new GQ(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new GQ(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new GQ(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new GQ(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=a1(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=o1(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!IQ(t))throw new GQ(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!IQ(t.attributes))throw new GQ(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new GQ(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],s1(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new GQ(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],c1(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(PQ({},this._options,t));return n.replaceAttributes(PQ({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=PQ({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new qQ(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new qQ(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new qQ(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,d1(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,PQ({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!l1.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,RQ(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(p1.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=p1.prototype.inspect),Yle.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?d1:Qle;e.generateKey?p1.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:p1.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),p$(p1),w$(p1),G$(p1),r1(p1);var m1=class extends p1{constructor(e){let t=PQ({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new GQ(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new GQ(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},h1=class extends p1{constructor(e){let t=PQ({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new GQ(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new GQ(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},g1=class extends p1{constructor(e){let t=PQ({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new GQ(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},_1=class extends p1{constructor(e){let t=PQ({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new GQ(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new GQ(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},v1=class extends p1{constructor(e){let t=PQ({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new GQ(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new GQ(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function y1(e){e.from=function(t,n){let r=new e(PQ({},t.options,n));return r.import(t),r}}y1(p1),y1(m1),y1(h1),y1(g1),y1(_1),y1(v1),p1.Graph=p1,p1.DirectedGraph=m1,p1.UndirectedGraph=h1,p1.MultiGraph=g1,p1.MultiDirectedGraph=_1,p1.MultiUndirectedGraph=v1,p1.InvalidArgumentsGraphError=GQ,p1.NotFoundGraphError=KQ,p1.UsageGraphError=qQ;var b1={condition:`Condition`,wait:`Wait`,eventSplit:`Event Split`},$le=Ah([`newest-wins`,`first-wins`,`unlimited`]),x1=Ch({startEvents:Eh(Bh),cancelEvents:Eh(Bh),concurrency:$le,allowManualStart:mh(xh),correlationPaths:mh(wh(yh,Bh))}),S1={startEvents:[],cancelEvents:[],concurrency:`unlimited`,allowManualStart:!0},eue=Wh(x1);function C1(e){return eue(e?.lifecycleRules)}function w1(e){return(C1(e)?.cancelEvents.length??0)>0}function T1(e){return e.rules.correlationPaths?.[e.eventName]??e.declaredPath}function tue(e){return e.startEvents.length>0||e.allowManualStart===!0}function E1(e){return e===void 0||e.allowManualStart===!0}var nue={valid:!0},D1=e=>({valid:!1,error:e});function rue(e){return`No Event named "${e}" is defined. Choose an Event this app declares, or ask whoever defines them to add it.`}function O1(e){return e.concurrency!==`unlimited`||e.cancelEvents.length>0}function k1(e){let{rules:t,catalog:n,eventName:r,role:i}=e;if(!(i===`start`&&!O1(t)))return{eventName:r,role:i,declaredPath:Ny(n,r)?.correlationPath,suppliedPath:t.correlationPaths?.[r]}}function iue(e){let{rules:t,catalog:n}=e,r=t.startEvents.map(e=>k1({rules:t,catalog:n,eventName:e,role:`start`})),i=t.cancelEvents.map(e=>k1({rules:t,catalog:n,eventName:e,role:`cancel`}));return Ka([...r,...i])}function A1(e){if(!e.correlationPaths)return e;let t=new Set(e.cancelEvents);if(O1(e))for(let n of e.startEvents)t.add(n);let n=Object.fromEntries(Object.entries(e.correlationPaths).filter(([e])=>t.has(e)));return{...e,correlationPaths:Object.keys(n).length>0?n:void 0}}function aue(e){let{rules:t,catalog:n}=e,r=t.startEvents.find(e=>t.cancelEvents.includes(e));if(r)return D1(`Event "${r}" cannot both start and cancel runs of this workflow. Give it one role, or start on one Event and cancel on another.`);let i=[...t.startEvents,...t.cancelEvents];for(let e of i)if(!Ny(n,e))return D1(rue(e));let a=iue({rules:t,catalog:n}).find(e=>!T1({rules:t,eventName:e.eventName,declaredPath:e.declaredPath}));return a?D1(oue(a.eventName)):tue(t)?nue:D1(`Nothing can start this workflow. Add a Start Event, or allow manual starts.`)}function oue(e){return`Event "${e}" declares no Correlation Path. Enter the payload path holding the value that identifies the entity, or ask whoever defined the Event to declare it.`}var sue=Wh(zh);function cue(e){return sue(e)??null}function lue(e){let t=cue(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}var j1=wh(yh,zh),M1=Ch({byEvent:mh(wh(yh,j1)),manual:mh(j1)}),uue=Wh(M1);function due(e){return uue(e?.testPayloads)}function N1(e,t){return t?e?.byEvent?.[t]:e?.manual}var fue=Ch({lifecycleRules:mh(x1),testPayloads:mh(M1)}).annotate({message:`Lifecycle config must be an object`}),P1={label:yh,description:mh(yh),enabled:mh(xh)},pue=Th(Ch({...P1,type:hh(`lifecycle`),config:mh(fue)}),Hh),mue=kh([Ch({actionType:hh(b1.condition),condition:mh(kh([yh,xh])),conditionModel:mh(yh),integrationId:mh(yh)}).annotate({message:`Condition config must be an object`}),Th(Ch({actionType:hh(b1.wait),integrationId:mh(yh),waitDelayTimingMode:mh(yh),waitMode:mh(Ah([`delay`,`event`])),waitFor:mh(gh),waitTimeout:mh(yh),waitTimeoutBehavior:mh(yh),waitDuration:mh(yh),waitUntil:mh(yh),waitOffset:mh(yh),waitGateMode:mh(yh),waitAllowedHoursMode:mh(yh),waitAllowedStartTime:mh(yh),waitAllowedEndTime:mh(yh),waitTimezone:mh(yh)}),Hh).annotate({message:`Wait config must be an object`}),Ch({actionType:hh(b1.eventSplit),integrationId:mh(yh)}).annotate({message:`Event Split config must be an object`}),Th(Ch({actionType:mh(Bh.check(Nh(e=>e===b1.condition||e===b1.wait||e===b1.eventSplit?`Built-in action configs use their own schema arm`:!0))),integrationId:mh(yh)}),Hh)]).annotate({message:`Action config must be an object`}),hue=Th(Ch({...P1,type:hh(`action`),config:mh(mue)}),Hh),gue=Th(Ch({...P1,type:hh(`add`),config:mh(wh(yh,gh))}),Hh),_ue=Ch({entryNodeIds:mh(Uh(Bh)),exitNodeId:mh(Bh),outletHandle:mh(hh(`true`))}).annotate({message:`Group config must be an object`}),vue=kh([pue,hue,gue,Th(Ch({...P1,type:hh(`group`),config:mh(_ue)}),Hh)]).annotate({message:`Node data needs a type of "lifecycle", "action", "add", or "group"`}),F1=Th(Ch({id:Bh,type:mh(Ah([`lifecycle`,`action`,`add`,`group`])),parentId:mh(Bh),width:mh(Fh),height:mh(Fh),position:mh(Ch({x:Fh,y:Fh})),data:vue}),Hh),I1=Th(Ch({id:Bh,source:Bh,target:Bh,sourceHandle:mh(jh(Bh)),targetHandle:mh(jh(Bh)),data:mh(wh(yh,gh))}),Hh),yue=Ch({key:Bh,attributes:F1}),bue=Ch({key:Bh,source:Bh,target:Bh,attributes:I1,undirected:mh(hh(!1))}),L1=Ch({attributes:mh(wh(yh,gh)),options:mh(Ch({allowSelfLoops:mh(xh),multi:mh(xh),type:mh(Ah([`directed`,`undirected`,`mixed`]))})),nodes:Uh(yue),edges:Uh(bue)}),R1={allowSelfLoops:!1,multi:!1,type:`directed`},xue=sh(L1,Vh);oh(L1,{...Vh,errors:`all`});var Sue=sh(F1,Vh);oh(F1,Vh);var Cue=sh(I1,Vh);function z1(e){let t={label:e.label,type:e.type};return e.description!==void 0&&(t.description=e.description),typeof e.config==`object`&&e.config!==null&&!Array.isArray(e.config)&&(t.config={...e.config}),e.enabled!==void 0&&(t.enabled=e.enabled),t}function wue(e){let t=Sue(e),n={id:t.id,type:t.type,position:t.position??{x:0,y:0},data:z1(t.data)};return t.parentId!==void 0&&(n.parentId=t.parentId),t.width!==void 0&&(n.width=t.width),t.height!==void 0&&(n.height=t.height),n}function Tue(e){let t=Cue(e);return{id:t.id,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle,data:t.data}}function Eue(e){let t=wue(e.attributes);if(e.key!==t.id)throw Error(`Node key '${e.key}' must match node attribute id '${t.id}'`);return t}function Due(e){let t=Tue(e.attributes);if(e.key!==t.id)throw Error(`Edge key '${e.key}' must match edge attribute id '${t.id}'`);if(e.source!==t.source||e.target!==t.target)throw Error(`Edge '${e.key}' source/target must match edge attributes`);return t}function B1(e){let t=new m1({allowSelfLoops:R1.allowSelfLoops,multi:R1.multi});e.attributes&&t.replaceAttributes(e.attributes);for(let n of e.nodes)t.mergeNode(n.id,{...n,data:z1(n.data)});for(let n of e.edges){let e=[n.source,n.target].filter(e=>!t.hasNode(e));if(e.length>0)throw Error(`Edge '${n.id}' names ${e.join(` and `)}, which the graph has no node for`);t.mergeEdgeWithKey(n.id,n.source,n.target,n)}return V1(t.export())}function V1(e){return xue(e)}function H1(e){let t=V1(e);return{nodes:t.nodes.map(Eue),edges:t.edges.map(Due)}}var U1=`animated`;function W1(e){let{status:t,issues:n,...r}=e.data,i={id:e.id,position:e.position,data:r,type:e.type};return typeof e.width==`number`&&(i.width=e.width),typeof e.height==`number`&&(i.height=e.height),e.measured&&typeof e.measured.width==`number`&&typeof e.measured.height==`number`&&(i.measured={width:e.measured.width,height:e.measured.height}),typeof e.parentId==`string`&&e.parentId.length>0&&(i.parentId=e.parentId),i}function G1(e){return e.filter(e=>e.type!==`add`).map(W1)}function K1(e){let{displayLabel:t,inactive:n,...r}=e.data??{};return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,data:Object.keys(r).length>0?r:void 0}}function q1(e){let t={id:e.id,position:e.position,type:e.type,width:e.width,height:e.height,measured:e.measured,data:{...e.data}};return e.parentId&&(t.parentId=e.parentId,t.extent=`parent`,t.draggable=!1,t.connectable=!1),t}function J1(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle??void 0,targetHandle:e.targetHandle??void 0,data:e.data}}function Y1(e){return B1({nodes:G1(e.nodes),edges:e.edges.map(K1)})}var X1=class extends Error{constructor(e,t){super(t),this.status=e,this.name=`ApiError`}},Oue=`/api/rpc`,Z1=`http://localhost:3000`;function Q1(){let e=typeof globalThis.location?.origin==`string`?globalThis.location.origin.trim():``;if(!(!e||e===`null`))return e}function kue(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_RPC_URL;return typeof e==`string`?e:void 0}function Aue(e={}){let t=e.rpcUrl??kue();if(t){let n=t.trim();if(n.length>0)try{return new URL(n).toString()}catch{let t=e.origin?.trim()||Q1()||Z1;try{return new URL(n,t).toString()}catch{return new URL(n,Z1).toString()}}}let n=`${Sy()}${Oue}`,r=e.origin?.trim()||Q1()||Z1;try{return new URL(n,r).toString()}catch{return new URL(n,Z1).toString()}}function jue(e){let t=new URL(e);return{origin:t.origin,pathWithQuery:`/${t.pathname.slice(1)}${t.search}`}}var Mue=FZ,$1=jue(Aue()),e0=YZ(new EQ({origin:$1.origin,url:$1.pathWithQuery,fetch:(e,t)=>globalThis.fetch(e,t),interceptors:[async e=>{try{return await e.next()}catch(e){throw e instanceof X1?e:e instanceof LZ?new X1(Mue[e.code]??500,jQ(e.data??e.message)):e instanceof Error?new X1(500,e.message||`Request failed`):new X1(500,`Request failed`)}}]}));function t0(e){let t=H1(e.graph);return{...e,nodes:t.nodes.map(q1),edges:t.edges.map(J1)}}function n0(e){return e.graph?e.graph:Y1({nodes:e.nodes??[],edges:e.edges??[]})}var Nue={create:e=>e0.workflow.create({name:e.name,graph:n0(e),...OQ({description:e.description},DQ)}).then(t0),update:(e,t)=>{let n=t.graph!==void 0||t.nodes!==void 0&&t.edges!==void 0?n0({graph:t.graph,nodes:t.nodes,edges:t.edges}):void 0;return e0.workflow.update({workflowId:e,...OQ({name:t.name,description:t.description,graph:n,mode:t.mode},DQ)}).then(t0)}},r0=lQ(e0),i0=()=>r0.integration.getAll.queryOptions({input:{}}),Pue=()=>r0.workflow.getAll.queryOptions({input:{}});function Fue(e){return e.hasUnpublishedChanges}function Iue(e){return r0.workflow.getById.queryOptions({input:{workflowId:e},select:Fue,staleTime:1/0})}function a0(e){return e.invalidateQueries({queryKey:r0.workflow.getAll.key()})}function o0(e,t){e.setQueryData(r0.workflow.getById.queryKey({input:{workflowId:t.id}}),e=>e&&{...e,hasUnpublishedChanges:t.hasUnpublishedChanges,updatedAt:t.updatedAt??e.updatedAt,...t.publishedVersionId===void 0?{}:{publishedVersionId:t.publishedVersionId}})}function s0(e){return Promise.all([e.invalidateQueries({queryKey:r0.workflow.getExecutions.key()}),e.invalidateQueries({queryKey:r0.workflow.getExecutionsGlobal.key()})])}function c0(e){return e.invalidateQueries({queryKey:r0.integration.getAll.key()})}function l0(){let e=(0,Z.c)(3),t=Fe(),n=Gi(),r;return e[0]!==n||e[1]!==t?(r=r0.workflow.delete.mutationOptions({onSuccess:async()=>{Ty.success(`Workflow deleted successfully`),await Promise.all([a0(t),s0(t)]),await n({to:`/`,replace:!0})},meta:{errorMessage:`Failed to delete workflow. Please try again.`}}),e[0]=n,e[1]=t,e[2]=r):r=e[2],Ze(r)}var Lue=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,u0=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Lue[n[e]&63];return t};function d0(e,t){return!t||e?.[t.field]===t.equals}function f0(e,t){return t.filter(t=>d0(e,t.showWhen))}var Rue=/\{\{@([^:{}]+):([^{}]+)\}\}/g;function zue(e){let[t,n,r]=e,i=r.indexOf(`.`);return{raw:t,nodeId:n,nodeLabel:i===-1?r:r.slice(0,i),fieldPath:i===-1?``:r.slice(i+1),start:e.index,end:e.index+t.length}}function p0(e){let t=new RegExp(Rue.source,`g`),n=[],r=t.exec(e);for(;r!==null;)n.push(zue(r)),r=t.exec(e);return n}function m0(e){let t=[],n=0;for(let r of p0(e))r.start>n&&t.push({kind:`literal`,text:e.slice(n,r.start)}),t.push({kind:`token`,token:r}),n=r.end;return n<e.length&&t.push({kind:`literal`,text:e.slice(n)}),t}function h0(e){let t=e.fieldPath?`.${e.fieldPath}`:``;return`{{@${e.nodeId}:${e.nodeLabel}${t}}}`}function g0(e,t){if(typeof e==`string`)return Bue(e,t);if(Array.isArray(e)){let n=!1,r=e.map(e=>{let r=g0(e,t);return r!==e&&(n=!0),r});return n?r:e}if(typeof e==`object`&&e){let n=!1,r={};for(let[i,a]of Object.entries(e)){let e=g0(a,t);e!==a&&(n=!0),r[i]=e}return n?r:e}return e}function Bue(e,t){let n=!1,r=m0(e).map(e=>{if(e.kind===`literal`)return e.text;let r=t(e.token);return r===void 0||r===e.token.raw?e.token.raw:(n=!0,r)}).join(``);return n?r:e}var Vue=/\[(\d+)\]/g,Hue=/^([^[]*)((?:\[\d+\])*)$/;function Uue(e){let t=[];for(let n of e.split(`.`)){let e=n.trim();if(!e)return null;let r=Hue.exec(e);if(!r)return null;let i=r[1];if(i.includes(`]`))return null;i&&t.push({kind:`key`,key:i});for(let n of e.matchAll(Vue)){let e=Number(n[1]);if(!Number.isSafeInteger(e))return null;t.push({kind:`index`,index:e})}}return t.length>0?t:null}function _0(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function v0(e,t,n){return _0(e,t)??n}function y0(e,t){let n=_0(e,t)?.trim();return n&&n.length>0?n:void 0}function b0(e){if(!(!e||e.data.type!==`action`))return _0(e.data.config,`actionType`)}function Wue(e){return e===b1.wait}function x0(e){return!e||e.data.type!==`action`?!1:Wue(b0(e))}function S0(e){return!e||e.data.type!==`action`?!1:b0(e)===b1.condition}function C0(e){return!e||e.data.type!==`action`?!1:b0(e)===b1.eventSplit}function w0(e){return e===`true`||e===`false`?e:null}function Gue(e){let t=w0(e);return t===`true`?`True`:t===`false`?`False`:null}function T0(e){return e===b1.condition}function E0(e){return S0(e)}function D0(e){return e?.data.type===`group`}function O0(e){let t=e?.data.config?.entryNodeIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.length>0):[]}function k0(e){return _0(e?.data.config,`exitNodeId`)}function A0(e){return _0(e?.data.config,`outletHandle`)===`true`?`true`:void 0}function j0(e){return`${e.source}\0${e.sourceHandle??``}`}function M0(e,t){let n=e(t.source);return n!==void 0&&n===e(t.target)}function N0(e,t){return e.has(t.source)&&e.has(t.target)}function P0(e,t,n,r){let i=new Map(e.map(e=>[e.id,e])),a=[];for(let e of n){let t=i.get(e);if(!t)return{ok:!1,error:`Select at least two steps`};let n=$ue(t,r);if(n)return{ok:!1,error:n};a.push(t)}if(a.length<2)return{ok:!1,error:`Select at least two steps`};let o=new Set(a.map(e=>e.id)),s=t.filter(e=>N0(o,e)),c=new Map,l=new Map;for(let e of o)c.set(e,0),l.set(e,0);for(let e of s)c.set(e.target,(c.get(e.target)??0)+1),l.set(e.source,(l.get(e.source)??0)+1);let u=a.filter(e=>(c.get(e.id)??0)===0),d=a.filter(e=>(l.get(e.id)??0)===0);if(u.length===0)return{ok:!1,error:`Needs an entry step`};if(d.length!==1)return{ok:!1,error:`Needs exactly one exit step`};let f=d[0];if(!f)return{ok:!1,error:`Needs exactly one exit step`};let p=u.map(e=>e.id);if(U0(p,s,o).size!==o.size)return{ok:!1,error:`Needs a connected lookup group`};for(let e of p)if(!U0([e],s,o).has(f.id))return{ok:!1,error:`Needs a connected lookup group`};let m=new Set(p),h=new Set;for(let e of t){let t=o.has(e.source),n=o.has(e.target);if(t!==n){if(n&&!m.has(e.target))return{ok:!1,error:`Needs an entry step`};if(t&&e.source!==f.id)return{ok:!1,error:`Needs exactly one exit step`};if(t&&e.source===f.id){let t=w0(e.sourceHandle);if(S0(f)&&t===`false`)return{ok:!1,error:`Condition False cannot leave the group`}}n&&m.has(e.target)&&h.add(j0(e))}}return h.size>1?{ok:!1,error:`Parallel lookups must share the same incoming step`}:{ok:!0,entryIds:p,exitId:f.id,memberIds:W0(o,s,p)}}function Kue(e,t){let n=e.find(e=>e.id===t);return D0(n)?k0(n)??t:t}function F0(e){let t=Kue(e.nodes,e.sourceId),n=new Set(e.edges.filter(t=>t.id!==e.excludeEdgeId).map(e=>`${j0(e)}\0${e.target}`)),r=[];for(let i of que(e.nodes,e.targetId)){let a=`${j0({source:t,sourceHandle:e.sourceHandle})}\0${i}`;n.has(a)||r.push({source:t,target:i,sourceHandle:e.sourceHandle})}return r}function que(e,t){let n=e.find(e=>e.id===t);if(!D0(n))return[t];let r=O0(n);return r.length>0?r:[t]}function I0(e,t,n){let r=t.find(e=>e.id===n);if(!r)return[];let i=e.find(e=>e.id===r.target),a=i?.parentId?e.find(e=>e.id===i.parentId):void 0;if(!D0(a))return[n];let o=new Set(O0(a));return o.has(r.target)?t.filter(e=>e.source===r.source&&(e.sourceHandle??``)===(r.sourceHandle??``)&&o.has(e.target)).map(e=>e.id):[n]}function L0(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=new Map;for(let t of e){if(!D0(t))continue;for(let e of O0(t))r.set(e,t.id);let e=k0(t);e&&i.set(e,t.id)}let a=e=>n.get(e)?.parentId,o=!1,s=t.map(e=>{if(M0(a,e))return e;let t=e,n=a(e.source);n&&i.get(e.source)===n&&(t={...t,source:n});let s=a(e.target);return s&&r.get(e.target)===s&&(t={...t,target:s}),o||=t!==e,t});return ede(o?s:t)}function Jue(e,t){let n=new Map(e.map(e=>[e.id,e]));return L0(e,t).filter(e=>!n.get(e.source)?.parentId&&!n.get(e.target)?.parentId)}function R0(e,t){let n=new Set(t),r=new Map(e.map(e=>[e.id,e]));for(let i of t){let t=r.get(i);if(t){if(D0(t)){for(let t of e)t.parentId===i&&n.add(t.id);continue}if(t.parentId){n.add(t.parentId);for(let r of e)r.parentId===t.parentId&&n.add(r.id)}}}return n}function z0(e,t){return e.filter(e=>e.parentId===t).map(e=>e.id)}function B0(e){let t=new Map;for(let n of e){if(!n.parentId)continue;let e=(t.get(n.parentId)??!0)&&n.data.enabled===!1;t.set(n.parentId,e)}let n=new Set;for(let[e,r]of t)r&&n.add(e);return n}function V0(e){if(!e.some(e=>D0(e))||Yue(e))return e;let t=[],n=[],r=[];for(let i of e)D0(i)?t.push(i):i.parentId?n.push(i):r.push(i);return[...r,...t,...n]}function Yue(e){let t=`rest`;for(let n of e){let e=D0(n)?`groups`:n.parentId?`children`:`rest`;if(e!==t){if(t===`rest`&&e===`groups`){t=`groups`;continue}if(t===`groups`&&e===`children`){t=`children`;continue}return!1}}return!0}function Xue(e){let t=new Map;for(let n of e)n.parentId&&t.set(n.parentId,(t.get(n.parentId)??0)+1);return e.filter(e=>D0(e)&&(t.get(e.id)??0)<2).map(e=>e.id)}function Zue(e,t,n){let r=W0(new Set(e),t,n),i=new Map;for(let t of e)i.set(t,[]);for(let e of t)i.get(e.target)?.push(e.source);let a=new Map;for(let e of r){let t=(i.get(e)??[]).filter(e=>a.has(e)).map(e=>a.get(e)??0);a.set(e,t.length===0?0:Math.max(...t)+1)}let o=new Map;return r.map(e=>{let t=a.get(e)??0,n=o.get(t)??0;return o.set(t,n+1),{id:e,row:t,column:n}})}function Que(e){return e.length===0?{rows:1,columns:1}:{rows:Math.max(...e.map(e=>e.row+1)),columns:Math.max(...e.map(e=>e.column+1))}}function H0(e,t,n){let r=Zue(e,t,n);return{slots:r,bounds:Que(r)}}function $ue(e,t){if(e.data.type===`lifecycle`||e.data.type===`add`)return`Only lookup and Condition steps can be grouped`;if(D0(e)||e.parentId)return`Already in a group`;if(e.data.type!==`action`)return`Only lookup and Condition steps can be grouped`;let n=b0(e);return n?x0(e)?`Wait cannot be grouped`:C0(e)?`Event Split cannot be grouped`:Py(t,n)?.sideEffect?`A step that changes something outside the workflow stays outside the frame`:null:`Every step needs an action`}function U0(e,t,n){let r=new Map;for(let e of t){let t=r.get(e.source)??[];t.push(e.target),r.set(e.source,t)}let i=new Set,a=[...e];for(;a.length>0;){let e=a.pop();if(!(!e||i.has(e)||!n.has(e))){i.add(e);for(let t of r.get(e)??[])a.push(t)}}return i}function W0(e,t,n){let r=new Map,i=new Map;for(let t of e)r.set(t,0),i.set(t,[]);for(let n of t)!e.has(n.source)||!e.has(n.target)||(r.set(n.target,(r.get(n.target)??0)+1),i.get(n.source)?.push(n.target));let a=n.filter(t=>e.has(t)),o=[],s=new Set;for(;a.length>0;){let e=a.shift();if(!(!e||s.has(e))){s.add(e),o.push(e);for(let t of i.get(e)??[]){let e=(r.get(t)??1)-1;r.set(t,e),e===0&&a.push(t)}}}for(let t of e)s.has(t)||o.push(t);return o}function ede(e){let t=new Set,n=[];for(let r of e){let e=`${r.source}\0${r.sourceHandle??``}\0${r.target}\0${r.targetHandle??``}`;t.has(e)||(t.add(e),n.push(r))}return n.length===e.length?e:n}function G0(e){return e.data.type!==`lifecycle`&&e.type!==`add`}function tde(e,t){let n=e.find(e=>e.id===t);return!n||!G0(n)?new Set:n.selected?R0(e,new Set(e.filter(e=>e.selected&&G0(e)).map(e=>e.id))):R0(e,new Set([n.id]))}function nde(e){let t=e.nodes.filter(t=>G0(t)?e.nodeIds?e.nodeIds.has(t.id):!!t.selected:!1);if(t.length===0)return null;let n=R0(e.nodes,new Set(t.map(e=>e.id))),r=e.nodes.filter(e=>n.has(e.id)),i=e.edges.filter(e=>n.has(e.source)&&n.has(e.target));return{nodes:r.map(ide),edges:i.map(ade)}}function K0(e,t){let n=t.createId??u0,r=new Map;for(let t of e.nodes)r.set(t.id,n());let i=new Set(e.nodes.map(e=>e.id));return{nodes:e.nodes.map(e=>{let n=e.parentId,a=typeof n==`string`&&i.has(n),o=a?q0(r,n):void 0;return{...e,id:q0(r,e.id),parentId:o,position:a?e.position:{x:e.position.x+t.offset.x,y:e.position.y+t.offset.y},selected:!0,dragging:!1,data:{...e.data,config:ode(sde(e.data.config,r),r,e)}}}),edges:e.edges.map(e=>({...e,id:n(),source:q0(r,e.source),target:q0(r,e.target),selected:!0}))}}function rde(e,t){let n=new Set(e.map(e=>e.id)),r=e.filter(e=>!e.parentId||!n.has(e.parentId)),i=r.map(e=>e.position.x),a=r.map(e=>e.position.y);return{x:t.x-Math.min(...i),y:t.y-Math.min(...a)}}function q0(e,t){let n=e.get(t);if(n===void 0)throw Error(`cloneSelection expected extractCopyableSelection output`);return n}function ide(e){return{...q1(W1(e)),selected:!1,dragging:!1}}function ade(e){return{...J1(K1(e)),selected:!1}}function ode(e,t,n){if(!e||!D0(n))return e;let r={...e},i=Array.isArray(e.entryNodeIds)?e.entryNodeIds.map(e=>typeof e==`string`?t.get(e):void 0).filter(e=>typeof e==`string`):[],a=typeof e.exitNodeId==`string`?t.get(e.exitNodeId):void 0;return i.length>0&&(r.entryNodeIds=i),a&&(r.exitNodeId=a),r}function sde(e,t){return e&&g0(e,e=>{let n=t.get(e.nodeId);if(n)return h0({nodeId:n,nodeLabel:e.nodeLabel,fieldPath:e.fieldPath})})}function cde(e,t){return Py(e,t)?.integration}function J0(e,t,n){let r=_0(t.data.config,`actionType`);if(!r)return t;let i=cde(e,r);if(!i)return t;let a=_0(t.data.config,`integrationId`);if(a&&n.some(e=>e.id===a))return t;let o=n.filter(e=>e.type===i);return o.length===1?X0(t,o[0].id):o.length===0&&a?X0(t,void 0):t}function Y0(e,t,n){let r=!1,i=t.map(t=>{let i=J0(e,t,n);return i!==t&&(r=!0),i});return r?i:t}function X0(e,t){return{...e,data:{...e.data,config:{...e.data.config,integrationId:t}}}}var Z0=jy(`workflow`,`save`),Q0=lA(null),$0=lA(``),lde=lA(`private`),e2=lA(`live`),t2=lA(!0),n2=lA(null),r2=lA(!1),i2=lA(null),a2=lA(!1),o2=lA(!1),s2=lA(null),c2=lA(Nue);function l2(){My.invalidateQueries({queryKey:r0.workflow.getAll.key(),refetchType:`none`})}var ude=lA(1e3),dde=lA(()=>({timeoutId:null,pending:[],failedPatches:new Map,isFlushing:!1}));function u2(e){return e instanceof Error?e:Error(`Failed to save workflow`,{cause:e})}function fde(e){let{nodes:t,edges:n,...r}=e;return t&&n?{...r,nodes:t.filter(e=>e.type!==`add`),edges:n}:r}var d2=lA(null,async(e,t,n,r)=>{t(o2,!0),t(s2,null);let i=e(Q0);if(!i)return null;let a=e(dde),o=async()=>{if(!a.isFlushing){a.isFlushing=!0,t(a2,!0);try{for(;a.pending.length>0;){let n=a.pending.shift();if(!n)break;let r;try{let i=await e(c2).update(n.workflowId,fde(n.patch));r={ok:!0,workflow:i},t(s2,null),l2(),o0(My,i),!a.pending.some(e=>e.workflowId===n.workflowId)&&!a.failedPatches.has(n.workflowId)&&e(Q0)===n.workflowId&&t(o2,!1)}catch(e){let i=u2(e);r={ok:!1,error:i},t(s2,i);let o=a.pending.find(e=>e.workflowId===n.workflowId);o?o.patch={...n.patch,...o.patch}:a.failedPatches.set(n.workflowId,{...a.failedPatches.get(n.workflowId),...n.patch}),Z0.error(`Save failed`,{workflowId:n.workflowId,error:e})}for(let e of n.waiters)e(r)}}finally{a.isFlushing=!1,t(a2,!1)}}},s=new Promise(e=>{let t=a.failedPatches.get(i),r=t?{...t,...n}:n;a.failedPatches.delete(i);let o=a.pending.at(-1);if(o?.workflowId===i){o.patch={...o.patch,...r},o.waiters.push(e);return}a.pending.push({workflowId:i,patch:r,waiters:[e]})});return a.timeoutId&&=(clearTimeout(a.timeoutId),null),r?.immediate?(await o(),await s):(a.timeoutId=setTimeout(()=>{a.timeoutId=null,o().catch(e=>{Z0.error(`Save flush failed`,{error:e})})},e(ude)),await s)}),pde=lA(null,async(e,t,n)=>{t($0,n),t(n2,null);let r=await t(d2,{name:n});return r?.ok===!1?r.error:null}),mde=lA(null,async(e,t,n)=>await t(d2,{mode:n},{immediate:!0})),hde=lA(null,async(e,t,n)=>{try{let r=await e(c2).create({name:n.name,description:n.description??``,nodes:n.nodes.filter(e=>e.type!==`add`),edges:n.edges});return t(Q0,r.id),t($0,r.name),t(n2,null),t(o2,!1),t(s2,null),l2(),o0(My,r),{ok:!0,workflow:r}}catch(e){let n=u2(e);return t(s2,n),{ok:!1,error:n}}}),f2=`sidebar-width`,p2=`sidebar-collapsed`,gde=31536e3,_de=20,vde=50,yde=30;function m2(e){if(!(typeof document>`u`))return document.cookie.split(`; `).find(t=>t.startsWith(`${e}=`))?.split(`=`)[1]}function h2(e,t){document.cookie=`${e}=${t}; path=/; max-age=${gde}`}function bde(){let e=Number.parseFloat(m2(f2)??``);return e>=_de&&e<=vde?e:yde}var g2=lA(`properties`),_2=lA(!1),v2=lA(!1),y2=lA(m2(p2)===`true`),b2=lA(e=>e(y2),(e,t,n)=>{let r=typeof n==`function`?n(e(y2)):n;t(y2,r),h2(p2,String(r))}),x2=lA(bde()),S2=lA(e=>e(x2),(e,t,n)=>{t(x2,n),h2(f2,String(n))});function C2(e){return`min(max(${e}%, 320px), 460px)`}var xde=lA(e=>e(b2)?null:C2(e(S2))),w2=lA(!1),T2=lA(!1),E2=lA(e=>e(g2)===`runs`&&e(t2)?`runs`:`properties`),D2=lA(null),O2=lA(e=>e(E2)===`runs`?e(D2):null,(e,t,n)=>{t(D2,n)});function Sde(e){let t=new Map;for(let n of e.edges){let e=t.get(n.source);e?e.push(n.target):t.set(n.source,[n.target])}let n=[];for(let r of e.startIds)n.push(...t.get(r)??[]);let r=new Set;for(;n.length>0;){let e=n.pop();!e||r.has(e)||(r.add(e),n.push(...t.get(e)??[]))}return r}var k2=`started`,A2=`canceled`;function Cde(e){return e===`started`||e===`canceled`}var j2={nodeIds:new Set,outletEdgeIds:new Set};function wde(e){let t=Tde(e),n=e.nodes.filter(e=>e.data.enabled===!1).map(e=>e.id);if(t.length===0&&n.length===0)return j2;let r=new Set(t.map(e=>e.target)),i=[...r,...n];for(let t of Sde({startIds:i,edges:e.edges}))r.add(t);return Ede(e.nodes,r),r.size===0?j2:{nodeIds:r,outletEdgeIds:new Set(t.map(e=>e.id))}}function Tde(e){let t=e.nodes.filter(e=>e.data.type===`lifecycle`);if(t.length===0||t.some(e=>w1(e.data.config)))return[];let n=new Set(t.map(e=>e.id));return e.edges.filter(e=>n.has(e.source)&&e.sourceHandle===`canceled`)}function Ede(e,t){let n=new Map;for(let r of e){if(!r.parentId)continue;let e=t.has(r.id);n.set(r.parentId,(n.get(r.parentId)??!0)&&e)}for(let[e,r]of n)r&&t.add(e)}var M2=`payload`,Dde=`event`,Ode=`$event.name`;function kde(e){return e===`within_next`||e===`more_than_from_now`||e===`less_than_ago`||e===`more_than_ago`}function Ade(e){return e===`before`||e===`after`}function N2(e){return kde(e.operator)}function P2(e){return Ade(e.operator)}function jde(e){return e===`is_set`||e===`is_not_set`}function F2(e){return jde(e.operator)}function I2(e,t=`rule`){return e.type===`timestamp`?{id:t,field:e.path,fieldType:`timestamp`,operator:`within_next`,amount:1,unit:`days`}:e.type===`number`?{id:t,field:e.path,fieldType:`number`,operator:`equals`,value:0}:e.type===`boolean`?{id:t,field:e.path,fieldType:`boolean`,operator:`is_true`}:{id:t,field:e.path,fieldType:`string`,operator:`equals`,value:``}}function Mde(e,t){let n=!1,r=e.groups.map(e=>({...e,conditions:e.conditions.map(e=>{let r=t.get(e.field);return!r||r.type===e.fieldType?e:(n=!0,I2(r,e.id))})}));return n?{...e,groups:r}:e}function L2(e,t){return{version:2,groupLogic:`and`,groups:[{id:t?.groupId??`group`,logic:`and`,conditions:[I2(e,t?.conditionId??`rule`)]}]}}var Nde=[{value:`and`,label:`AND`},{value:`or`,label:`OR`}],Pde=[{value:`within_next`,label:`is within the next`},{value:`more_than_from_now`,label:`is more than from now`},{value:`less_than_ago`,label:`is less than ago`},{value:`more_than_ago`,label:`is more than ago`},{value:`before`,label:`is before`},{value:`after`,label:`is after`}],R2=[{value:`minutes`,label:`minutes`},{value:`hours`,label:`hours`},{value:`days`,label:`days`},{value:`weeks`,label:`weeks`}],Fde=[{value:`equals`,label:`equals`},{value:`not_equals`,label:`does not equal`},{value:`contains`,label:`contains`}],Ide=[{value:`equals`,label:`equals`},{value:`not_equals`,label:`does not equal`},{value:`greater_than`,label:`is greater than`},{value:`greater_or_equal`,label:`is greater than or equal`},{value:`less_than`,label:`is less than`},{value:`less_or_equal`,label:`is less than or equal`}],Lde=[{value:`is_true`,label:`is true`},{value:`is_false`,label:`is false`}],Rde=[{value:`is_set`,label:`is set`},{value:`is_not_set`,label:`is not set`}],zde=RegExp(`^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|(?:[+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$`),z2=yh.check(Tee(zde)).pipe(Mh(Mee,Vf)),Bde=ah(z2);ch(z2);var Vde=dh(z2);function B2(e){return Rc(Bde(e.trim()))}function Hde(e){return Vde(e)}function V2(e){return yh.annotate({message:e}).pipe(Mh(yh,Lf())).check(Lh(1).annotate({message:e})).annotateKey({messageMissingKey:e})}function H2(e,t){return e.annotate({message:t}).annotateKey({messageMissingKey:t})}function U2(e){return{id:V2(`Condition id is required`),field:V2(`Condition field is required`),fieldType:hh(e)}}function W2(e,t){return Ch({...U2(e),operator:H2(Ah([`is_set`,`is_not_set`]),t)})}var G2=`Timestamp operator is invalid`,K2=`Timestamp amount must be a positive integer`,q2=`Timestamp absolute operators require a valid date-time`,J2=`String operator is invalid`,Y2=`Number operator is invalid`,X2=`Number conditions require a finite numeric value`,Z2=`Boolean operator is invalid`;function Ude(e){return B2(e)!==null}var Wde=[Ch({...U2(`timestamp`),operator:H2(Ah([`within_next`,`more_than_from_now`,`less_than_ago`,`more_than_ago`]),G2),amount:H2(bh,K2).check(Ih().annotate({message:K2}),kee().annotate({message:K2}),Oee(0).annotate({message:K2})),unit:H2(Ah([`minutes`,`hours`,`days`,`weeks`]),`Timestamp unit is invalid`)}),Ch({...U2(`timestamp`),operator:H2(Ah([`before`,`after`]),G2),dateTime:yh.annotate({message:q2}).pipe(Mh(yh,Lf())).check(Nh(e=>Ude(e)?void 0:q2)).annotateKey({messageMissingKey:q2})}),W2(`timestamp`,G2),Ch({...U2(`string`),operator:H2(Ah([`equals`,`not_equals`,`contains`]),J2),value:H2(yh,`String conditions require a text value`)}),W2(`string`,J2),Ch({...U2(`number`),operator:H2(Ah([`equals`,`not_equals`,`greater_than`,`greater_or_equal`,`less_than`,`less_or_equal`]),Y2),value:H2(bh,X2).check(Ih().annotate({message:X2}))}),W2(`number`,Y2),Ch({...U2(`boolean`),operator:H2(Ah([`is_true`,`is_false`]),Z2)}),W2(`boolean`,Z2)],Gde=wh(yh,gh).annotate({message:`Condition must be an object`}).pipe(Mh(kh(Wde).annotate({message:`Condition field type is invalid`}))),Q2=`Each group must contain at least one condition`,Kde=Ch({id:V2(`Group id is required`),logic:H2(Ah([`and`,`or`]),`Group logic is invalid`),conditions:H2(Dh(Eh(Gde)),Q2).check(Lh(1).annotate({message:Q2}))}).annotate({message:`Group must be an object`}),$2=`Condition model must contain at least one group`,qde=oh(Ch({version:H2(hh(2),`Condition model version must be 2`),groupLogic:H2(Ah([`and`,`or`]),`Condition model group logic is invalid`),groups:H2(Dh(Eh(Kde)),$2).check(Lh(1).annotate({message:$2}))}).annotate({message:`Condition model must be an object`})),Jde=df();function Yde(e){let t=e.path?.at(-1);if(t!=null)return typeof t==`object`?t.key:t}function Xde(e){return(e.find(e=>Yde(e)!==`operator`)??e[0])?.message}function e4(e){let t=e;if(typeof e==`string`){let n=e.trim();if(!n)return{valid:!1,error:`Condition model is empty`};try{t=JSON.parse(n)}catch{return{valid:!1,error:`Condition model must be valid JSON`}}}let n=qde(t);if(Uc(n)){let{issues:e}=Jde(n.failure.issue);return{valid:!1,error:Xde(e)??`Condition model is invalid`}}return{valid:!0,model:n.success}}function t4(e){return JSON.stringify(e)}function n4(e){return JSON.stringify(e)}function r4(e){return e===`and`||e===`or`}function Zde(e){return typeof e==`number`&&Number.isFinite(e)&&Number.isInteger(e)&&e>0}function Qde(e){return e===`minutes`||e===`hours`||e===`days`||e===`weeks`}function $de(e){return B2(e)!==null}function efe(e){switch(e){case`equals`:return`==`;case`not_equals`:return`!=`;case`greater_than`:return`>`;case`greater_or_equal`:return`>=`;case`less_than`:return`<`;case`less_or_equal`:return`<=`;default:return`==`}}function tfe(e,t){if(N2(e)){let n=e.amount;if(!Zde(n))return{valid:!1,error:`Timestamp amount must be a positive integer`,incomplete:!0};if(!Qde(e.unit))return{valid:!1,error:`Timestamp unit is invalid`};let r=e.unit;return e.operator===`within_next`?{valid:!0,expression:`${t} > now && ${t} < now + ${r}(${n})`}:e.operator===`more_than_from_now`?{valid:!0,expression:`${t} > now + ${r}(${n})`}:e.operator===`less_than_ago`?{valid:!0,expression:`${t} > now - ${r}(${n})`}:{valid:!0,expression:`${t} < now - ${r}(${n})`}}if(!$de(e.dateTime))return{valid:!1,error:`Timestamp absolute operators require a valid date-time`,incomplete:!0};let n=n4(e.dateTime.trim());return e.operator===`before`?{valid:!0,expression:`${t} < date(${n})`}:{valid:!0,expression:`${t} > date(${n})`}}function nfe(e,t){if(!e.value.trim())return{valid:!1,error:`Text conditions require a value`,incomplete:!0};let n=n4(e.value);return e.operator===`equals`?{valid:!0,expression:`${t} == ${n}`}:e.operator===`not_equals`?{valid:!0,expression:`${t} != ${n}`}:{valid:!0,expression:`${t}.contains(${n})`}}function rfe(e,t){return Number.isFinite(e.value)?{valid:!0,expression:`${t} ${efe(e.operator)} ${e.value}`}:{valid:!1,error:`Number conditions require a finite numeric value`,incomplete:!0}}function ife(e,t){return e.operator===`is_true`?{valid:!0,expression:`${t} == true`}:{valid:!0,expression:`${t} == false`}}function afe(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)}function ofe(e){let t=Uue(e);if(!t)return null;if(t.every(e=>e.kind===`key`&&afe(e.key))){let e=t.map(e=>e.key);return{field:`${M2}.${e.join(`.`)}`,presence:e.map((t,n)=>`has(${M2}.${e.slice(0,n+1).join(`.`)})`).join(` && `)}}let n=M2,r=[];for(let e of t)if(e.kind===`key`){let t=n4(e.key);r.push(`${t} in ${n}`),n=`${n}[${t}]`}else r.push(`size(${n}) > ${e.index}`),n=`${n}[${e.index}]`;return{field:n,presence:r.join(` && `)}}function sfe(e,t){return e.operator===`is_set`?{valid:!0,expression:t}:{valid:!0,expression:`!(${t})`}}function i4(e,t){return e.fieldType===`timestamp`?tfe(e,t):e.fieldType===`string`?nfe(e,t):e.fieldType===`number`?rfe(e,t):ife(e,t)}function cfe(e){let t=`${Dde}.name`;return F2(e)?{valid:!0,expression:e.operator===`is_set`?`${t} != null`:`${t} == null`}:i4(e,t)}function lfe(e){let t=e.field.trim();if(!t)return{valid:!1,error:`Condition field is required`};if(t===`$event.name`)return cfe(e);let n=ofe(t);if(!n)return{valid:!1,error:`Condition field path is invalid`};let{field:r,presence:i}=n;if(F2(e))return sfe(e,i);let a=i4(e,r);return a.valid?{valid:!0,expression:`${i} && (${a.expression})`}:a}function ufe(e){if(e.conditions.length===0)return{valid:!1,error:`Each group must contain at least one condition`};let t=[];for(let n of e.conditions){let e=lfe(n);if(!e.valid)return e;t.push(`(${e.expression})`)}let n=e.logic===`and`?` && `:` || `;return{valid:!0,expression:t.join(n)}}function a4(e){if(!r4(e.groupLogic))return{valid:!1,error:`Condition model group logic is invalid`};if(e.groups.length===0)return{valid:!1,error:`Condition model must contain at least one group`};let t=[];for(let n of e.groups){if(!r4(n.logic))return{valid:!1,error:`Group logic is invalid`};let e=ufe(n);if(!e.valid)return e;t.push(`(${e.expression})`)}let n=e.groupLogic===`and`?` && `:` || `;return{valid:!0,expression:t.join(n)}}function dfe(e){let t=e4(e);return t.valid?a4(t.model):{valid:!1,error:t.error}}var o4=Ch({event:Bh,match:mh(yh)}),ffe=Dh(Eh(o4)).check(Lh(1)),pfe=Ch({waitMode:mh(Ah([`delay`,`event`])),waitFor:mh(ffe),waitTimeout:mh(yh),waitTimeoutBehavior:mh(Ah([`continue`,`skip`])),waitDuration:mh(yh),waitUntil:mh(yh),waitOffset:mh(yh),waitGateMode:mh(Ah([`off`,`require_actual_wait`])),waitAllowedHoursMode:mh(yh),waitAllowedStartTime:mh(yh),waitAllowedEndTime:mh(yh),waitTimezone:mh(yh)}),s4={waitDuration:{type:`duration`,required:!0,owner:{mode:`delay`,timing:`duration`}},waitUntil:{type:`timestamp`,required:!0,owner:{mode:`delay`,timing:`until`}},waitOffset:{type:`duration`,required:!1,owner:{mode:`delay`,timing:`until`}},waitTimeout:{type:`duration`,required:!0,owner:{mode:`event`}}},c4=[`waitDuration`,`waitUntil`,`waitOffset`,`waitTimeout`];function l4(e){let t=e.waitDelayTimingMode;return t===`until`||t===`duration`?t:typeof e.waitUntil==`string`&&e.waitUntil.trim()?`until`:`duration`}function mfe(e){let t=e.waitMode===`event`?`event`:`delay`,n=l4(e);return c4.filter(e=>{let{owner:r}=s4[e];return r.mode===`event`?t===`event`:t===`delay`&&r.timing===n})}function u4(e){let t=new Set(mfe(e));return c4.filter(e=>!t.has(e))}oh(pfe);var hfe=Wh(Dh(Eh(o4)));function d4(e){return hfe(e?.waitFor)??[]}var gfe=/^([01]\d|2[0-3]):([0-5]\d)$/;function f4(e){return typeof e==`string`&&e.trim()===`daily_window`?`daily_window`:`off`}function p4(e){if(typeof e!=`string`)return null;let t=e.trim(),n=gfe.exec(t);if(!n)return null;let[,r,i]=n;return r&&i?Number.parseInt(r,10)*60+Number.parseInt(i,10):null}function _fe(e){let t=[],n=typeof e.mode==`string`?e.mode.trim():f4(e.mode);if(n.length>0&&n!==`off`&&n!==`daily_window`)return t.push({field:`mode`,message:`Allowed-hours mode must be either "off" or "daily_window".`}),t;if(n!==`daily_window`)return t;let r=p4(e.startTime);r===null&&t.push({field:`start`,message:`Allowed-hours start must use HH:MM (24-hour) format.`});let i=p4(e.endTime);return i===null&&t.push({field:`end`,message:`Allowed-hours end must use HH:MM (24-hour) format.`}),r!==null&&i!==null&&r>=i&&t.push({field:`window`,message:`Allowed-hours start must be earlier than end (same-day window only).`}),t}function vfe(e){return e.type===`group`&&`fields`in e&&Array.isArray(e.fields)}function m4(e){return e==null||typeof e==`string`&&e.trim().length===0}function yfe(e){let t=[];for(let n of e){if(vfe(n)){t.push(...n.fields);continue}t.push(n)}return t}function bfe(e){let{config:t,configFields:n}=e;return yfe(n).filter(e=>e.required===!0&&d0(t,e.showWhen)&&m4(t[e.key])).map(e=>({fieldKey:e.key,fieldLabel:e.label}))}function xfe(e){return kQ(e.waitMode)===`event`?`event`:`delay`}function Sfe(e){if(xfe(e)===`event`){let t=[];d4(e).length===0&&t.push({fieldKey:`waitFor`,fieldLabel:`Wait for these events`});for(let n of d4(e)){let e=kQ(n.match);if(!e)continue;let r=dfe(e);!r.valid&&r.incomplete&&t.push({fieldKey:`waitFor`,fieldLabel:`Match value for "${n.event}"`})}return m4(e.waitTimeout)&&t.push({fieldKey:`waitTimeout`,fieldLabel:`Stop waiting after`}),t}let t=[];if(l4(e)===`until`?m4(e.waitUntil)&&t.push({fieldKey:`waitUntil`,fieldLabel:`Wait until this date/time`}):m4(e.waitDuration)&&t.push({fieldKey:`waitDuration`,fieldLabel:`Wait for (duration)`}),kQ(e.waitAllowedHoursMode)===`daily_window`){let n=kQ(e.waitAllowedStartTime);(!n||p4(n)===null)&&t.push({fieldKey:`waitAllowedStartTime`,fieldLabel:`Window start (HH:MM)`});let r=kQ(e.waitAllowedEndTime);(!r||p4(r)===null)&&t.push({fieldKey:`waitAllowedEndTime`,fieldLabel:`Window end (HH:MM)`}),m4(e.waitTimezone)&&t.push({fieldKey:`waitTimezone`,fieldLabel:`Timezone`})}return t}function Cfe(e){let{actionType:t,config:n}=e;switch(t){case b1.condition:return m4(n.condition)?[{fieldKey:`condition`,fieldLabel:`Condition`}]:[];case b1.wait:return Sfe(n);default:return[]}}function h4(e){let{node:t,actionType:n,actionLabel:r}=e;return kQ(t.data.label)||r||n||t.id}function wfe(e){let{node:t,resolveActionByType:n}=e;if(t.data.type!==`action`||t.data.enabled===!1)return null;let r=t.data.config??{},i=kQ(r.actionType);if(!i)return{nodeId:t.id,nodeLabel:h4({node:t}),missingFields:[{fieldKey:`actionType`,fieldLabel:`Action`}]};let a=n(i),o=Cfe({actionType:i,config:r}),s=a?bfe({config:r,configFields:a.configFields??[]}):[],c=[...o,...s];return c.length===0?null:{nodeId:t.id,nodeLabel:h4({node:t,actionType:i,actionLabel:a?.label}),missingFields:c}}function Tfe(e){let{nodes:t,resolveActionByType:n}=e;return t.map(e=>wfe({node:e,resolveActionByType:n})).filter(e=>e!==null)}function g4(e){return e.type===`group`}function Efe(e){let t=[];for(let n of e)g4(n)?t.push(...n.fields):t.push(n);return t}function Dfe(e){return t=>Py(e,t)}function _4(e){return kQ(e.node.data.label)||(e.actionLabel?e.actionLabel:e.actionType?e.actionType:e.node.id)}function Ofe(e){return Tfe({nodes:e.nodes,resolveActionByType:Dfe(e.catalog)}).flatMap(e=>e.missingFields.map(t=>({kind:`missing_required_field`,severity:`blocking`,nodeId:e.nodeId,nodeLabel:e.nodeLabel,fieldKey:t.fieldKey,fieldLabel:t.fieldLabel,message:`Node "${e.nodeLabel}" is missing required field "${t.fieldLabel}"`})))}function kfe(e){let t=new Set(e.integrations.map(e=>e.id)),n=[];for(let r of e.nodes){if(r.data.type!==`action`||r.data.enabled===!1)continue;let i=y0(r.data.config,`actionType`);if(!i)continue;let a=Py(e.catalog,i),o=a?.integration;if(!o)continue;let s=y0(r.data.config,`integrationId`);if(s&&t.has(s))continue;let c=Fy(e.catalog,o)?.label??o,l=_4({node:r,actionLabel:a?.label,actionType:i});n.push({kind:`missing_integration`,severity:`blocking`,nodeId:r.id,nodeLabel:l,integrationType:o,integrationLabel:c,message:`Node "${l}" needs a ${c} connection`})}return n}function Afe(e){return typeof e==`string`?p0(e).map(e=>({nodeId:e.nodeId,displayText:e.fieldPath?`${e.nodeLabel}.${e.fieldPath}`:e.nodeLabel})):[]}function v4(e,t=``){let n=[];for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;if(typeof i==`string`){for(let t of Afe(i))n.push({field:e,...t});continue}if(typeof i==`object`&&i&&!Array.isArray(i)){let t={...i};n.push(...v4(t,e))}}return n}function jfe(e){let t=new Set(e.nodes.map(e=>e.id)),n=[];for(let r of e.nodes){if(r.data.enabled===!1)continue;let i=r.data.config;if(!i||typeof i!=`object`)continue;let a=v4(i).filter(e=>!t.has(e.nodeId));if(a.length===0)continue;let o=y0(i,`actionType`),s=o?Py(e.catalog,o):void 0,c=s?Efe(s.configFields):[],l=_4({node:r,actionLabel:s?.label,actionType:o});for(let e of a){let t=c.find(t=>t.key===e.field)?.label??e.field;n.push({kind:`broken_reference`,severity:`warning`,nodeId:r.id,nodeLabel:l,fieldKey:e.field,fieldLabel:t,referencedNodeId:e.nodeId,displayText:e.displayText,message:`Node "${l}" references missing step in ${t}`})}}return n}function y4(e){return[...Ofe(e),...kfe(e),...jfe(e)]}function b4(e){return e.some(e=>e.severity===`blocking`)}function x4(e){let t=new Map,n=new Map,r=new Map;for(let i of e)switch(i.kind){case`missing_required_field`:{let e=t.get(i.nodeId);if(e){e.missingFields.push({fieldKey:i.fieldKey,fieldLabel:i.fieldLabel});break}t.set(i.nodeId,{nodeId:i.nodeId,nodeLabel:i.nodeLabel,missingFields:[{fieldKey:i.fieldKey,fieldLabel:i.fieldLabel}]});break}case`broken_reference`:{let e=n.get(i.nodeId);if(e){e.brokenReferences.push({fieldKey:i.fieldKey,fieldLabel:i.fieldLabel,referencedNodeId:i.referencedNodeId,displayText:i.displayText});break}n.set(i.nodeId,{nodeId:i.nodeId,nodeLabel:i.nodeLabel,brokenReferences:[{fieldKey:i.fieldKey,fieldLabel:i.fieldLabel,referencedNodeId:i.referencedNodeId,displayText:i.displayText}]});break}case`missing_integration`:{let e=r.get(i.integrationType);if(e){e.nodeNames.includes(i.nodeLabel)||e.nodeNames.push(i.nodeLabel);break}r.set(i.integrationType,{integrationType:i.integrationType,integrationLabel:i.integrationLabel,nodeNames:[i.nodeLabel]});break}default:throw Error(`Unhandled workflow issue`)}return{missingRequiredFields:Array.from(t.values()),missingIntegrations:Array.from(r.values()),brokenReferences:Array.from(n.values())}}var S4=[],C4=lA(S4),Mfe=lA(e=>{let t=qa(e(C4),e=>e.nodeId),n=new Map(Object.entries(t).map(([e,t])=>{let n=Ife(t),r=w4.get(e);return[e,r&&Nfe(r,n)?r:n]}));return w4=n,n}),w4=new Map;function Nfe(e,t){return e.severity===t.severity&&e.messages.length===t.messages.length&&e.messages.every((e,n)=>e===t.messages[n])}var Pfe=lA(e=>b4(e(C4))),Ffe=new Map;function Ife(e){return{severity:e.some(e=>e.severity===`blocking`)?`blocking`:`warning`,messages:e.map(e=>e.message)}}function Lfe(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.kind===r.kind&&e.nodeId===r.nodeId&&e.message===r.message})}function T4(e=192){return{width:e,height:112}}function E4(e,t){let n=Math.max(e,1),r=Math.max(t,1);return{width:12+n*188+(n-1)*24+12,height:48+r*56+(r-1)*40+12}}var Rfe=132;function D4(e){return e>1?e*Rfe:192}var O4=`size-5`,zfe=324/212,Bfe=200/96;function Vfe(e){let t=P0(e.nodes,e.edges,e.selectedIds,e.catalog);if(!t.ok)return null;let n=new Map(e.nodes.map(e=>[e.id,e])),r=t.memberIds.map(e=>{let t=n.get(e);if(!t)throw Error(`groupSelection expected analyzeGroupableSelection ids`);return t}),i={x:Math.min(...r.map(e=>e.position.x)),y:Math.min(...r.map(e=>e.position.y))},a=new Set(t.memberIds),o=e.edges.filter(e=>N0(a,e)),{slots:s,bounds:c}=H0(t.memberIds,o,t.entryIds),l=E4(c.columns,c.rows),u=(e.createId??u0)(),d=F4(s,c.columns),f=n.get(t.exitId),p={id:u,type:`group`,position:i,width:l.width,height:l.height,style:{width:l.width,height:l.height},selected:!0,data:{label:`Group`,type:`group`,config:{entryNodeIds:t.entryIds,exitNodeId:t.exitId,...S0(f)?{outletHandle:`true`}:{}}}},m=r.some(e=>e.data.enabled===!1),h=r.map(e=>L4(m?{...e,data:{...e.data,enabled:!1}}:e,u,I4(d,e.id)));return{nodes:V0([...e.nodes.filter(e=>!a.has(e.id)).map(e=>({...e,selected:!1})),p,...h]),edges:qfe({edges:e.edges,entryIds:t.entryIds,createEdgeId:e.createEdgeId??u0}),analysis:t}}function k4(e,t){let n=e.find(e=>e.id===t);return!n||!D0(n)?e:V0(e.flatMap(e=>e.id===t?[]:e.parentId===t?[Yfe(e,Jfe(n,e))]:[e]))}function Hfe(e,t){let n=new Map;for(let t of e){if(!t.parentId)continue;let e=n.get(t.parentId)??[];e.push(t),n.set(t.parentId,e)}if(n.size===0)return e;let r=new Map,i=new Map;for(let[a,o]of n){let n=e.find(e=>e.id===a),s=o.map(e=>e.id),c=new Set(s),{slots:l,bounds:u}=H0(s,t.filter(e=>N0(c,e)),O0(n));i.set(a,E4(u.columns,u.rows));let d=F4(l,u.columns);for(let e of o)r.set(e.id,L4(e,a,I4(d,e.id)))}return e.map(e=>{if(D0(e)){let t=i.get(e.id);return t?{...e,width:t.width,height:t.height,style:{...e.style,width:t.width,height:t.height}}:e}return r.get(e.id)??e})}var A4=new WeakMap;function Ufe(e,t){let n=new Map(e.map(e=>[e.id,e.parentId])),r=e=>n.get(e),i=!1,a=t.map(e=>{if(!M0(r,e))return e;i=!0;let t=A4.get(e);if(t)return t;let n={...e,selectable:!1,deletable:!1,focusable:!1};return A4.set(e,n),n});return i?a:t}function j4(e){let t=e;for(let e of Xue(t))t=k4(t,e);return t}function M4(e){let t=new Set(e.filter(e=>D0(e)).map(e=>e.id));return e.some(e=>e.parentId&&!t.has(e.parentId))?`Ungroup the frame before deleting a step inside it`:null}function N4(e){let t=M4(e);return t&&Ty.error(t),t}function P4(e){return!!(e&&(D0(e)||e.parentId))}function Wfe(e,t){let n=new Set([t]);if(D0(e.find(e=>e.id===t)))for(let r of z0(e,t))n.add(r);return n}function Gfe(e,t,n){let r=new Set;for(let i of n)if(i.type===`remove`)for(let n of I0(e,t,i.id))r.add(n);return r.size===0?n:[...n.filter(e=>e.type!==`remove`),...[...r].map(e=>({type:`remove`,id:e}))]}function Kfe(e,t){let n=new Set(e.map(e=>e.id)),r=t.filter(e=>n.has(e.source)&&n.has(e.target));return r.length===t.length?t:r}function qfe(e){let{edges:t,entryIds:n,createEdgeId:r}=e,i=new Set(n),a=t.filter(e=>i.has(e.target)),o=[],s=new Set;for(let e of a){let t=j0(e);s.has(t)||(s.add(t),o.push(e))}if(o.length!==1)return t;let c=o[0];if(!c)return t;let l=j0(c),u=new Set(t.filter(e=>j0(e)===l).map(e=>e.target)),d=[];for(let e of n)u.has(e)||d.push({id:r(),source:c.source,target:e,sourceHandle:c.sourceHandle,targetHandle:c.targetHandle});return d.length===0?t:[...t,...d]}function F4(e,t){let n=new Map;for(let t of e)n.set(t.row,(n.get(t.row)??0)+1);let r=new Map;for(let i of e){let e=(t-(n.get(i.row)??1))*212/2;r.set(i.id,{x:12+e+i.column*212,y:48+i.row*96})}return r}function I4(e,t){let n=e.get(t);if(!n)throw Error(`Group layout has no slot for member '${t}'`);return n}function L4(e,t,n){return{...e,parentId:t,extent:`parent`,draggable:!1,connectable:!1,selected:!1,width:188,height:56,position:n}}function Jfe(e,t){if(typeof e.width!=`number`)throw Error(`Group '${e.id}' has no width to ungroup around`);let n=e.position.x+e.width/2,r=e.position.x+t.position.x+94,i=t.position.y-36-12;return{x:n+(r-n)*zfe-96,y:e.position.y+i*Bfe}}function Yfe(e,t){let{extent:n,parentId:r,...i}=e;return{...i,draggable:!0,connectable:!0,width:192,height:112,position:t}}var R4=lA([]),z4=lA([]),B4=lA(null),V4=lA(e=>e(E2)===`runs`?e(B4):null,(e,t,n)=>{t(B4,n===null?null:{nodes:V0(n.nodes),edges:n.edges})}),H4=lA(null),U4=lA(null),W4=lA([]),G4=lA([]);function K4(e){return e(V4)===null}function q4(e,t){let n={nodes:e(R4),edges:e(z4)};t(W4,[...e(W4),n].slice(-50)),t(G4,[])}function J4(e,t,n){t(d2,{nodes:e(R4),edges:e(z4)},n)}var Y4=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(R4),i=n.selectedIds??new Set(r.filter(e=>e.selected).map(e=>e.id)),a=Vfe({nodes:r,edges:e(z4),selectedIds:i,catalog:n.catalog});return a?(q4(e,t),t(R4,a.nodes),t(z4,a.edges),t(H4,a.nodes.find(e=>D0(e)&&e.selected)?.id??null),t(U4,null),J4(e,t,{immediate:!0}),!0):!1}),X4=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(R4),i=r.find(e=>e.id===n),a=D0(i)?n:i?.parentId;if(!a)return!1;let o=k4(r,a);return o!==r&&(q4(e,t),t(R4,o),t(H4,null),t(U4,null),J4(e,t,{immediate:!0}),!0)}),Xfe=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(R4),i=new Set(z0(r,n.groupId));return i.size!==0&&(q4(e,t),t(R4,r.map(e=>i.has(e.id)?{...e,data:{...e.data,enabled:n.enabled}}:e)),J4(e,t),!0)}),Zfe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=A0(r.find(e=>e.id===n.source))??n.sourceHandle,a=e(z4),o=F0({nodes:r,edges:a,sourceId:n.source,targetId:n.target,sourceHandle:i}).map((e,t)=>({...n,id:t===0?n.id:u0(),source:e.source,target:e.target,sourceHandle:e.sourceHandle}));o.length!==0&&(q4(e,t),t(z4,[...a,...o]),J4(e,t,{immediate:!0}))}),Z4=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(z4),i=new Set(I0(e(R4),r,n));if(i.size===0)return;let a=r.filter(e=>!i.has(e.id));a.length!==r.length&&(q4(e,t),t(z4,a),e(U4)&&i.has(e(U4)??``)&&t(U4,null),J4(e,t,{immediate:!0}))}),Q4=lA(e=>e(R4)),$4=lA(e=>e(z4)),e3=lA(new Map),t3=lA(e=>e(V4)!==null),n3=lA(e=>e(T2)||e(t3)),r3=lA(e=>wde({nodes:e(V4)?.nodes??e(R4),edges:e(V4)?.edges??e(z4)})),Qfe={opacity:.5},i3=new WeakMap,$fe=lA(e=>{let t=e(V4),n=t?.nodes??e(R4),r=e(e3),{nodeIds:i}=e(r3),a=V0(n),o=B0(n),s=t?Ffe:e(Mfe);if(r.size===0&&i.size===0&&o.size===0&&s.size===0)return a;let c=r.size>0;return a.map(e=>{let t=o.has(e.id),n=i.has(e.id)&&!t&&e.data.enabled!==!1,a=s.get(e.id);if(!(c||t||n||a))return e;let l=c?r.get(e.id)??`idle`:void 0,u=i3.get(e);if(u&&u.status===l&&u.disabledFrame===t&&u.muted===n&&u.issues===a)return u.painted;let d={...e,data:{...e.data,...l?{status:l}:{},...t?{enabled:!1}:{},...a?{issues:a}:{}}},f=n?{...d,style:{...d.style,...Qfe}}:d;return i3.set(e,{status:l,disabledFrame:t,muted:n,issues:a,painted:f}),f})}),epe=lA(e=>{let t=e(V4)?.nodes??e(R4),n=Ufe(t,L0(t,e(V4)?.edges??e(z4))),{nodeIds:r,outletEdgeIds:i}=e(r3);return r.size===0?n:n.map(e=>r.has(e.target)?{...e,data:{...e.data,inactive:!0,...i.has(e.id)?{displayLabel:`No Cancel Event`}:{}}}:e)}),a3=lA(null),o3=lA(null),s3=lA(!1),tpe=lA(null,(e,t,n)=>{t(R4,V0(n.nodes)),t(z4,n.edges),t(W4,[]),t(G4,[]),t(H4,null),t(U4,null),t(a3,null),t(o2,!1),t(C4,S4)}),npe=lA(null,(e,t,n)=>{t(tpe,{nodes:n.nodes.map(e=>({...e,selected:!1})),edges:n.edges}),t(e3,new Map),t(V4,null),t(O2,null),t(Q0,n.id),t($0,n.name),t(lde,n.visibility??`private`),t(e2,n.mode??`live`),t(t2,n.isOwner!==!1),t(r2,!1),t(i2,null)}),rpe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=Y0(n.catalog,r,n.integrations);i!==r&&(t(R4,i),J4(e,t))}),ipe=lA(null,(e,t)=>{K4(e)&&q4(e,t)}),ape=lA(null,(e,t)=>{K4(e)&&(t(R4,e(R4).map(e=>({...e,selected:!1}))),t(z4,e(z4).map(e=>({...e,selected:!1}))),t(H4,null),t(U4,null))}),ope=lA(null,(e,t,n)=>{K4(e)&&(t(R4,e(R4).map(e=>({...e,selected:e.id===n}))),t(H4,n),t(U4,null))}),spe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=n.filter(e=>e.type!==`remove`||r.find(t=>t.id===e.id)?.data.type!==`lifecycle`),a=i.some(e=>e.type===`remove`),o=i.some(e=>e.type===`position`&&e.dragging===!0),s=i.some(e=>e.type===`position`&&e.dragging===!1);o&&!e(s3)&&(q4(e,t),t(s3,!0)),s&&t(s3,!1);let c=j4(bE(i,r));if(t(R4,c),a){let n=Kfe(c,e(z4));t(z4,n);let r=e(U4);r&&!n.some(e=>e.id===r)&&t(U4,null)}let l=c.find(e=>e.selected);if(l){t(H4,l.id),t(U4,null);let n=e(a3);n&&n!==l.id&&t(a3,null)}else if(e(H4)){let n=e(H4);c.find(e=>e.id===n)||t(H4,null),t(a3,null)}a?J4(e,t,{immediate:!0}):s&&J4(e,t)}),cpe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=n.some(e=>e.type===`remove`),i=e(z4),a=xE(Gfe(e(R4),i,n),i);t(z4,a);let o=a.find(e=>e.selected);if(o)t(U4,o.id),t(H4,null);else if(e(U4)){let n=e(U4);a.find(e=>e.id===n)||t(U4,null)}r&&J4(e,t,{immediate:!0})});function c3(e,t,n){let r=n.nodes.map(e=>({...e,selected:!0})),i=n.edges.map(e=>({...e,selected:!0}));q4(e,t),t(R4,V0([...e(R4).map(e=>({...e,selected:!1})),...r])),t(z4,[...e(z4).map(e=>({...e,selected:!1})),...i]),t(H4,r[0].id),t(U4,null);let a=r.length===1?r[0]:void 0;a?.data.type===`action`&&!a.data.config?.actionType?t(a3,a.id):t(a3,null),J4(e,t,{immediate:!0})}function l3(e,t){let n=e(R4);return nde({nodes:n,edges:e(z4),nodeIds:t?tde(n,t):void 0})}var u3=lA(null,(e,t,n)=>{K4(e)&&c3(e,t,{nodes:[n],edges:[]})}),lpe=lA(e=>e(o3)!==null),d3=lA(null,(e,t,n)=>{let r=l3(e,n);return r?(t(o3,{selection:r,pasteCount:0}),!0):!1}),f3=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(o3);if(!r)return!1;let i=r.pasteCount+1,a=n?rde(r.selection.nodes,n):{x:48*i,y:48*i};return t(o3,{...r,pasteCount:i}),c3(e,t,K0(r.selection,{offset:a})),!0}),p3=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=l3(e,n);return r?(c3(e,t,K0(r,{offset:{x:48,y:48}})),!0):!1}),upe=lA(null,(e,t,n)=>{K4(e)&&(q4(e,t),t(R4,n),J4(e,t,{immediate:!0}))}),m3=lA(null,(e,t,{id:n,data:r})=>{if(!K4(e))return;let i=e(R4);q4(e,t);let a=i.find(e=>e.id===n)?.data.label,o=r.label,s=o!==void 0&&a!==o;t(R4,i.map(e=>{if(e.id===n)return{...e,data:{...e.data,...r}};if(s&&a){let t=dpe(e.data.config||{},n,a,o);if(t!==e.data.config)return{...e,data:{...e.data,config:t}}}return e})),J4(e,t)});function dpe(e,t,n,r){return g0(e,e=>{if(e.nodeId===t&&e.nodeLabel===n)return h0({nodeId:t,nodeLabel:r,fieldPath:e.fieldPath})})}var h3=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=r.find(e=>e.id===n);if(i?.data.type===`lifecycle`||i&&N4([i]))return;q4(e,t);let a=Wfe(r,n);t(R4,j4(r.filter(e=>!a.has(e.id)))),t(z4,e(z4).filter(e=>!a.has(e.source)&&!a.has(e.target))),e(H4)&&a.has(e(H4)??``)&&t(H4,null),J4(e,t,{immediate:!0})}),fpe=lA(null,(e,t)=>{if(!K4(e))return;let n=e(R4),r=e(z4),i=n.filter(e=>e.selected);if(N4(i))return;let a=new Set(i.filter(e=>e.data.type!==`lifecycle`).map(e=>e.id));for(let e of n)e.parentId&&a.has(e.parentId)&&a.add(e.id);let o=j4(n.filter(e=>e.data.type===`lifecycle`||!a.has(e.id))),s=new Set(r.filter(e=>e.selected).flatMap(e=>I0(n,r,e.id))),c=r.filter(e=>!s.has(e.id)&&!a.has(e.source)&&!a.has(e.target));(o.length!==n.length||c.length!==r.length)&&(q4(e,t),t(R4,o),t(z4,c),t(H4,null),t(U4,null),J4(e,t,{immediate:!0}))}),g3=lA(null,(e,t)=>{if(!K4(e))return;let n=e(R4),r=n.filter(e=>e.data.type===`lifecycle`);(r.length!==n.length||e(z4).length!==0)&&(q4(e,t),t(R4,r),t(z4,[]),t(H4,null),t(U4,null),J4(e,t,{immediate:!0}))}),_3=lA(null,(e,t)=>{if(!K4(e))return;let n=e(W4),r=n.at(-1);r&&(t(G4,[...e(G4),{nodes:e(R4),edges:e(z4)}]),t(W4,n.slice(0,-1)),t(R4,r.nodes),t(z4,r.edges),J4(e,t,{immediate:!0}))}),v3=lA(null,(e,t)=>{if(!K4(e))return;let n=e(G4),r=n.at(-1);r&&(t(W4,[...e(W4),{nodes:e(R4),edges:e(z4)}]),t(G4,n.slice(0,-1)),t(R4,r.nodes),t(z4,r.edges),J4(e,t,{immediate:!0}))}),ppe=lA(e=>e(W4).length>0),mpe=lA(e=>e(G4).length>0),hpe=lA(null,(e,t)=>{t(V4,null),t(e3,new Map)}),gpe=lA(null,(e,t)=>{t(e3,new Map)}),y3=lA(null,(e,t,n)=>{if(n.length===0)return;let r=e(e3),i=new Map(r),a=!1;for(let{nodeId:e,status:t}of n)r.get(e)!==t&&(i.set(e,t),a=!0);a&&t(e3,i)}),_pe={database:dte};function b3(e){let t=(0,Z.c)(14),{integration:n,className:r}=e,i=r===void 0?`h-3 w-3`:r,a=xy(),o=_pe[n];if(o){let e;t[0]===i?e=t[1]:(e=Q(`text-foreground`,i),t[0]=i,t[1]=e);let n;return t[2]!==o||t[3]!==e?(n=(0,X.jsx)(o,{className:e}),t[2]=o,t[3]=e,t[4]=n):n=t[4],n}let s=a[n];if(s){let e=s.icon,n;t[5]===i?n=t[6]:(n=Q(`text-foreground`,i),t[5]=i,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,X.jsx)(e,{className:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}let c;t[10]===i?c=t[11]:(c=Q(`text-foreground`,i),t[10]=i,t[11]=c);let l;return t[12]===c?l=t[13]:(l=(0,X.jsx)(Zv,{className:c}),t[12]=c,t[13]=l),l}function x3(e){return Object.keys(OQ(e,e=>!e||e.length===0)).length>0}function S3(e){e.status===`success`?Ty.success(e.message||`Connection successful`):Ty.error(e.message||`Connection failed`)}function vpe(e){return e.integrations.toSorted((e,t)=>e.label.localeCompare(t.label))}var ype=(e,t)=>Fy(e,t)?.label??t;function bpe(e){let t=(0,Z.c)(36),{overlayId:n,onSuccess:r}=e,i=yy(),{push:a}=RY(),[o,s]=(0,Y.useState)(``),c=jY(),l,u,d,f,p,m,h,g;if(t[0]!==i||t[1]!==c||t[2]!==r||t[3]!==n||t[4]!==a||t[5]!==o){let e=o.trim().toLowerCase(),_=vpe(i).filter(t=>!e||t.label.toLowerCase().includes(e)),v;t[14]!==r||t[15]!==a?(v=e=>{a(C3,{type:e,onSuccess:r})},t[14]=r,t[15]=a,t[16]=v):v=t[16];let y=v;l=SX,m=n,h=`Add Connection`,t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Select a service to connect`}),t[17]=g):g=t[17],f=`space-y-3`;let b;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[18]=b):b=t[18];let x=!c,S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>s(e.target.value),t[19]=S):S=t[19],t[20]!==o||t[21]!==x?(p=(0,X.jsxs)(`div`,{className:`relative`,children:[b,(0,X.jsx)(wX,{autoFocus:x,className:`pl-9`,onChange:S,placeholder:`Search services...`,value:o})]}),t[20]=o,t[21]=x,t[22]=p):p=t[22],u=`max-h-[300px] space-y-1 overflow-y-auto`,d=_.length===0?(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`No services found`}):_.map(e=>(0,X.jsxs)(`button`,{className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted/50`,onClick:()=>y(e.type),type:`button`,children:[(0,X.jsx)(b3,{className:`size-5 shrink-0`,integration:e.type}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[` `,`- `,e.description]})]})]},e.type)),t[0]=i,t[1]=c,t[2]=r,t[3]=n,t[4]=a,t[5]=o,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[23]!==u||t[24]!==d?(_=(0,X.jsx)(`div`,{className:u,children:d}),t[23]=u,t[24]=d,t[25]=_):_=t[25];let v;t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,X.jsxs)(`div`,{className:f,children:[p,_]}),t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29];let y;return t[30]!==l||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==v?(y=(0,X.jsxs)(l,{overlayId:m,title:h,children:[g,v]}),t[30]=l,t[31]=m,t[32]=h,t[33]=g,t[34]=v,t[35]=y):y=t[35],y}function xpe(e){let t=(0,Z.c)(18),{fieldId:n,label:r,configKey:i,placeholder:a,helpText:o,helpLink:s,value:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,X.jsx)(TX,{htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==l?(d=e=>l(i,e.target.value),t[3]=i,t[4]=l,t[5]=d):d=t[5];let f;t[6]!==n||t[7]!==a||t[8]!==d||t[9]!==c?(f=(0,X.jsx)(wX,{className:`flex-1`,id:n,onChange:d,placeholder:a,type:`password`,value:c}),t[6]=n,t[7]=a,t[8]=d,t[9]=c,t[10]=f):f=t[10];let p;t[11]!==s||t[12]!==o?(p=(o||s)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[o,s&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:s.url,rel:`noopener noreferrer`,target:`_blank`,children:s.text})]}),t[11]=s,t[12]=o,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==f||t[16]!==p?(m=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[u,f,p]}),t[14]=u,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}function C3(e){let t=(0,Z.c)(62),{overlayId:n,type:r,onSuccess:i}=e,a=yy(),{push:o,closeAll:s}=RY(),c=Fe(),[l,u]=(0,Y.useState)(``),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Y.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=(e,t)=>{p(n=>({...n,[e]:t}))},t[1]=m):m=t[1];let h=m,g;t[2]!==s||t[3]!==i||t[4]!==c?(g=r0.integration.create.mutationOptions({onSuccess:async e=>{Ty.success(`Connection created`),await c0(c),i?.(e.id),s()},meta:{errorMessage:`Failed to save connection`}}),t[2]=s,t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=Ze(g),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=r0.integration.testCredentials.mutationOptions({meta:{errorShownByCaller:!0}}),t[6]=v):v=t[6];let y=Ze(v),b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=r0.integration.testCredentials.mutationOptions({onSuccess:S3}),t[7]=b):b=t[7];let x=Ze(b),S;t[8]!==a||t[9]!==r?(S=Fy(a,r),t[8]=a,t[9]=r,t[10]=S):S=t[10];let C=S,w=C?.credentialFields,T=C?.hasTest===!0,E=_.isPending||y.isPending,D;t[11]!==f||t[12]!==_||t[13]!==l||t[14]!==r?(D=()=>{_.mutate({name:l.trim(),type:r,config:f})},t[11]=f,t[12]=_,t[13]=l,t[14]=r,t[15]=D):D=t[15];let O=D,k;t[16]!==o||t[17]!==O?(k=e=>{o(CX,{title:`Connection Test Failed`,message:`${e}\n\nDo you want to save anyway?`,confirmLabel:`Save Anyway`,onConfirm:O})},t[16]=o,t[17]=O,t[18]=k):k=t[18];let A=k,j;t[19]!==f||t[20]!==T||t[21]!==A||t[22]!==O||t[23]!==y||t[24]!==r?(j=async()=>{if(!x3(f)){Ty.error(`Please enter credentials`);return}if(!T){O();return}try{let e=await y.mutateAsync({type:r,config:f});if(e.status===`error`){A(`The test failed: ${e.message}`);return}}catch(e){let t=e;A(t instanceof Error?t.message:`Failed to test connection`);return}O()},t[19]=f,t[20]=T,t[21]=A,t[22]=O,t[23]=y,t[24]=r,t[25]=j):j=t[25];let M=j,N;t[26]!==f||t[27]!==x||t[28]!==r?(N=()=>{if(!x3(f)){Ty.error(`Please enter credentials first`);return}x.mutate({type:r,config:f})},t[26]=f,t[27]=x,t[28]=r,t[29]=N):N=t[29];let P=N,F;t[30]!==f||t[31]!==w?(F=()=>w?Object.entries(w).map(e=>{let[t,n]=e;return n.type===`password`?(0,X.jsx)(xpe,{configKey:t,fieldId:t,helpLink:n.helpLink,helpText:n.helpText,label:n.label,onChange:h,placeholder:n.placeholder,value:f[t]||``},t):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:t,children:n.label}),(0,X.jsx)(wX,{id:t,onChange:e=>h(t,e.target.value),placeholder:n.placeholder,type:n.type,value:f[t]||``}),(n.helpText||n.helpLink)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[n.helpText,n.helpLink&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:n.helpLink.url,rel:`noopener noreferrer`,target:`_blank`,children:n.helpLink.text})]})]},t)}):null,t[30]=f,t[31]=w,t[32]=F):F=t[32];let I=F,L;t[33]!==P||t[34]!==T||t[35]!==E||t[36]!==x?(L=T?[{label:`Test`,variant:`outline`,onClick:P,loading:x.isPending,disabled:E}]:[],t[33]=P,t[34]=T,t[35]=E,t[36]=x,t[37]=L):L=t[37];let R;t[38]!==M||t[39]!==E?(R={label:`Create`,onClick:M,loading:E},t[38]=M,t[39]=E,t[40]=R):R=t[40];let z;t[41]!==L||t[42]!==R?(z=[...L,R],t[41]=L,t[42]=R,t[43]=z):z=t[43];let B;t[44]!==a||t[45]!==r?(B=ype(a,r),t[44]=a,t[45]=r,t[46]=B):B=t[46];let V=`Add ${B}`,H;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Enter your credentials`}),t[47]=H):H=t[47];let U;t[48]===I?U=t[49]:(U=I(),t[48]=I,t[49]=U);let W;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(TX,{htmlFor:`name`,children:`Label (Optional)`}),t[50]=W):W=t[50];let G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>u(e.target.value),t[51]=G):G=t[51];let K;t[52]===l?K=t[53]:(K=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[W,(0,X.jsx)(wX,{id:`name`,onChange:G,placeholder:`e.g. Production, Personal, Work`,value:l})]}),t[52]=l,t[53]=K);let q;t[54]!==U||t[55]!==K?(q=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[U,K]}),t[54]=U,t[55]=K,t[56]=q):q=t[56];let J;return t[57]!==n||t[58]!==z||t[59]!==V||t[60]!==q?(J=(0,X.jsxs)(SX,{actions:z,overlayId:n,title:V,children:[H,q]}),t[57]=n,t[58]=z,t[59]=V,t[60]=q,t[61]=J):J=t[61],J}var Spe=(e,t)=>e?.label??t;function Cpe(e){let t=(0,Z.c)(35),{fieldId:n,label:r,configKey:i,placeholder:a,helpText:o,helpLink:s,value:c,onChange:l}=e,[u,d]=(0,Y.useState)(!1),f=jY(),p=c.length>0;if(!(u||p)){let e;t[0]!==n||t[1]!==r?(e=(0,X.jsx)(TX,{htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsxs)(`div`,{className:`flex h-9 flex-1 items-center gap-2 rounded-md border bg-muted/30 px-3`,children:[(0,X.jsx)(qv,{className:`size-4 text-success`}),(0,X.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Configured`})]}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>d(!0),t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,(0,X.jsxs)(zv,{onClick:a,type:`button`,variant:`outline`,children:[(0,X.jsx)(oy,{className:`mr-1.5 size-3`}),`Change`]})]}),t[5]=o):o=t[5];let s;return t[6]===e?s=t[7]:(s=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[e,o]}),t[6]=e,t[7]=s),s}let m;t[8]!==n||t[9]!==r?(m=(0,X.jsx)(TX,{htmlFor:n,children:r}),t[8]=n,t[9]=r,t[10]=m):m=t[10];let h=u&&!f,g;t[11]!==i||t[12]!==l?(g=e=>l(i,e.target.value),t[11]=i,t[12]=l,t[13]=g):g=t[13];let _;t[14]!==n||t[15]!==a||t[16]!==h||t[17]!==g||t[18]!==c?(_=(0,X.jsx)(wX,{autoFocus:h,className:`flex-1`,id:n,onChange:g,placeholder:a,type:`password`,value:c}),t[14]=n,t[15]=a,t[16]=h,t[17]=g,t[18]=c,t[19]=_):_=t[19];let v;t[20]!==i||t[21]!==p||t[22]!==u||t[23]!==l?(v=(u||p)&&(0,X.jsx)(zv,{onClick:()=>{l(i,``),d(!1)},size:`icon`,type:`button`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})}),t[20]=i,t[21]=p,t[22]=u,t[23]=l,t[24]=v):v=t[24];let y;t[25]!==_||t[26]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,v]}),t[25]=_,t[26]=v,t[27]=y):y=t[27];let b;t[28]!==s||t[29]!==o?(b=(o||s)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[o,s&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:s.url,rel:`noopener noreferrer`,target:`_blank`,children:s.text})]}),t[28]=s,t[29]=o,t[30]=b):b=t[30];let x;return t[31]!==m||t[32]!==y||t[33]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[m,y,b]}),t[31]=m,t[32]=y,t[33]=b,t[34]=x):x=t[34],x}function w3(e){let t=(0,Z.c)(83),{overlayId:n,integration:r,onSuccess:i,onDelete:a}=e,{push:o,closeAll:s}=RY(),c=Fe(),[l,u]=(0,Y.useState)(r.name),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Y.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=(e,t)=>{p(n=>({...n,[e]:t}))},t[1]=m):m=t[1];let h=m,g;t[2]!==s||t[3]!==i||t[4]!==c?(g=r0.integration.update.mutationOptions({onSuccess:async()=>{Ty.success(`Connection updated`),await c0(c),i?.(),s()},meta:{errorMessage:`Failed to update connection`}}),t[2]=s,t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=Ze(g),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=r0.integration.testCredentials.mutationOptions({meta:{errorShownByCaller:!0}}),t[6]=v):v=t[6];let y=Ze(v),b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=r0.integration.testCredentials.mutationOptions({onSuccess:S3}),t[7]=b):b=t[7];let x=Ze(b),S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=r0.integration.testConnection.mutationOptions({onSuccess:S3}),t[8]=S):S=t[8];let C=Ze(S),w=yy(),T,E,D,O,k;if(t[9]!==w||t[10]!==s||t[11]!==f||t[12]!==r||t[13]!==l||t[14]!==a||t[15]!==n||t[16]!==o||t[17]!==y||t[18]!==x||t[19]!==C||t[20]!==_){let e=Fy(w,r.type),i=e?.credentialFields,c=e?.hasTest===!0,u=_.isPending||y.isPending,d=x.isPending||C.isPending,p;t[26]!==f||t[27]!==r.id||t[28]!==l||t[29]!==_?(p=()=>{_.mutate({integrationId:r.id,name:l.trim(),config:x3(f)?f:void 0})},t[26]=f,t[27]=r.id,t[28]=l,t[29]=_,t[30]=p):p=t[30];let m=p,g;t[31]!==o||t[32]!==m?(g=e=>{o(CX,{title:`Connection Test Failed`,message:`${e}\n\nDo you want to save anyway?`,confirmLabel:`Save Anyway`,onConfirm:m})},t[31]=o,t[32]=m,t[33]=g):g=t[33];let v=g,b;t[34]!==f||t[35]!==c||t[36]!==r.type||t[37]!==v||t[38]!==m||t[39]!==y?(b=async()=>{if(!(x3(f)&&c)){m();return}try{let e=await y.mutateAsync({type:r.type,config:f});if(e.status===`error`){v(`The test failed: ${e.message}`);return}}catch(e){let t=e;v(t instanceof Error?t.message:`Failed to test connection`);return}m()},t[34]=f,t[35]=c,t[36]=r.type,t[37]=v,t[38]=m,t[39]=y,t[40]=b):b=t[40];let S=b,A;t[41]!==f||t[42]!==r.id||t[43]!==r.type||t[44]!==x||t[45]!==C?(A=()=>{if(x3(f)){x.mutate({type:r.type,config:f});return}C.mutate({integrationId:r.id})},t[41]=f,t[42]=r.id,t[43]=r.type,t[44]=x,t[45]=C,t[46]=A):A=t[46];let j=A,M;t[47]!==s||t[48]!==r||t[49]!==a||t[50]!==o?(M=()=>{o(T3,{integration:r,onDismiss:s,onSuccess:a})},t[47]=s,t[48]=r,t[49]=a,t[50]=o,t[51]=M):M=t[51];let N=M;E=()=>i?Object.entries(i).map(e=>{let[t,n]=e;return n.type===`password`?(0,X.jsx)(Cpe,{configKey:t,fieldId:t,helpLink:n.helpLink,helpText:n.helpText,label:n.label,onChange:h,placeholder:n.placeholder,value:f[t]||``},t):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:t,children:n.label}),(0,X.jsx)(wX,{id:t,onChange:e=>h(t,e.target.value),placeholder:n.placeholder,type:n.type,value:f[t]||``}),(n.helpText||n.helpLink)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[n.helpText,n.helpLink&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:n.helpLink.url,rel:`noopener noreferrer`,target:`_blank`,children:n.helpLink.text})]})]},t)}):null,T=SX;let P=u||d,F;t[52]!==N||t[53]!==P?(F={label:`Delete`,variant:`ghost`,onClick:N,disabled:P},t[52]=N,t[53]=P,t[54]=F):F=t[54];let I;t[55]!==j||t[56]!==c||t[57]!==u||t[58]!==d?(I=c?[{label:`Test`,variant:`outline`,onClick:j,loading:d,disabled:u}]:[],t[55]=j,t[56]=c,t[57]=u,t[58]=d,t[59]=I):I=t[59];let L;t[60]!==S||t[61]!==u?(L={label:`Update`,onClick:S,loading:u},t[60]=S,t[61]=u,t[62]=L):L=t[62],t[63]!==F||t[64]!==I||t[65]!==L?(O=[F,...I,L],t[63]=F,t[64]=I,t[65]=L,t[66]=O):O=t[66],k=n,D=Spe(e,r.type),t[9]=w,t[10]=s,t[11]=f,t[12]=r,t[13]=l,t[14]=a,t[15]=n,t[16]=o,t[17]=y,t[18]=x,t[19]=C,t[20]=_,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A=`Edit ${D}`,j;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Update your connection credentials`}),t[67]=j):j=t[67];let M;t[68]===E?M=t[69]:(M=E(),t[68]=E,t[69]=M);let N;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(TX,{htmlFor:`name`,children:`Label (Optional)`}),t[70]=N):N=t[70];let P;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>u(e.target.value),t[71]=P):P=t[71];let F;t[72]===l?F=t[73]:(F=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[N,(0,X.jsx)(wX,{id:`name`,onChange:P,placeholder:`e.g. Production, Personal, Work`,value:l})]}),t[72]=l,t[73]=F);let I;t[74]!==M||t[75]!==F?(I=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[M,F]}),t[74]=M,t[75]=F,t[76]=I):I=t[76];let L;return t[77]!==T||t[78]!==A||t[79]!==I||t[80]!==O||t[81]!==k?(L=(0,X.jsxs)(T,{actions:O,overlayId:k,title:A,children:[j,I]}),t[77]=T,t[78]=A,t[79]=I,t[80]=O,t[81]=k,t[82]=L):L=t[82],L}function T3(e){let t=(0,Z.c)(19),{overlayId:n,integration:r,onDismiss:i,onSuccess:a}=e,{pop:o}=RY(),s=i??o,c=Fe(),l;t[0]!==s||t[1]!==a||t[2]!==c?(l=r0.integration.delete.mutationOptions({onSuccess:async()=>{Ty.success(`Connection deleted`),s(),await c0(c),a?.()},meta:{errorMessage:`Failed to delete connection`}}),t[0]=s,t[1]=a,t[2]=c,t[3]=l):l=t[3];let u=Ze(l),d;t[4]===o?d=t[5]:(d={label:`Cancel`,variant:`outline`,onClick:o},t[4]=o,t[5]=d);let f;t[6]!==u||t[7]!==r?(f=()=>u.mutate({integrationId:r.id}),t[6]=u,t[7]=r,t[8]=f):f=t[8];let p;t[9]!==u.isPending||t[10]!==f?(p={label:`Delete`,variant:`destructive`,onClick:f,loading:u.isPending},t[9]=u.isPending,t[10]=f,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==p?(m=[d,p],t[12]=d,t[13]=p,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Are you sure you want to delete this connection? Workflows using it will fail until a new one is configured.`}),t[15]=h):h=t[15];let g;return t[16]!==n||t[17]!==m?(g=(0,X.jsx)(SX,{actions:m,overlayId:n,title:`Delete Connection`,children:h}),t[16]=n,t[17]=m,t[18]=g):g=t[18],g}function E3(){let e=(0,Z.c)(4),t=Fe(),n=yy(),r=TA(rpe),i;return e[0]!==n||e[1]!==t||e[2]!==r?(i=async()=>{r({integrations:await t.fetchQuery(i0()),catalog:n})},e[0]=n,e[1]=t,e[2]=r,e[3]=i):i=e[3],i}function D3(e){let t=(0,Z.c)(23),{displayName:n,selected:r,className:i,disabled:a,onSelect:o,onEdit:s}=e,c=a&&`cursor-not-allowed opacity-50`,l;t[0]!==i||t[1]!==c?(l=Q(i,c),t[0]=i,t[1]=c,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=r?(0,X.jsx)(qv,{className:`size-4 shrink-0 text-success`}):(0,X.jsx)(Qv,{className:`size-4 shrink-0 text-muted-foreground`}),t[3]=r,t[4]=u);let d;t[5]===n?d=t[6]:(d=(0,X.jsx)(`span`,{className:`truncate`,children:n}),t[5]=n,t[6]=d);let f;t[7]!==a||t[8]!==o||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,X.jsxs)(`button`,{"aria-checked":r,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,disabled:a,onClick:o,role:`radio`,type:`button`,children:[u,d]}),t[7]=a,t[8]=o,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===s?p=t[14]:(p=e=>{e.stopPropagation(),s()},t[13]=s,t[14]=p);let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(oy,{className:`size-3`}),t[15]=m):m=t[15];let h;t[16]!==a||t[17]!==p?(h=(0,X.jsx)(zv,{className:`size-6 shrink-0`,disabled:a,onClick:p,size:`icon`,variant:`ghost`,children:m}),t[16]=a,t[17]=p,t[18]=h):h=t[18];let g;return t[19]!==l||t[20]!==f||t[21]!==h?(g=(0,X.jsxs)(`div`,{className:l,children:[f,h]}),t[19]=l,t[20]=f,t[21]=h,t[22]=g):g=t[22],g}function wpe(e){let t=(0,Z.c)(68),{integrationType:n,value:r,onChange:i,onOpenSettings:a,disabled:o,onAddConnection:s}=e,c=yy(),{push:l}=RY(),u=E3(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=i0(),t[0]=d):d=t[0];let{data:f,isPending:p}=Xe(d),m;t[1]===f?m=t[2]:(m=f===void 0?[]:f,t[1]=f,t[2]=m);let h=m,g;if(t[3]!==h||t[4]!==n){let e;t[6]===n?e=t[7]:(e=e=>e.type===n,t[6]=n,t[7]=e),g=h.filter(e),t[3]=h,t[4]=n,t[5]=g}else g=t[5];let _=g,v;t[8]!==i||t[9]!==u?(v=async e=>{await u(),i(e)},t[8]=i,t[9]=u,t[10]=v):v=t[10];let y=v,b;t[11]!==y||t[12]!==n||t[13]!==l?(b=()=>{l(C3,{type:n,onSuccess:y})},t[11]=y,t[12]=n,t[13]=l,t[14]=b):b=t[14];let x=b,S;t[15]!==l||t[16]!==u?(S=e=>{l(w3,{integration:e,onSuccess:u,onDelete:u})},t[15]=l,t[16]=u,t[17]=S):S=t[17];let C=S,w;t[18]!==s||t[19]!==x?(w=()=>{s?s():x()},t[18]=s,t[19]=x,t[20]=w):w=t[20];let T=w;if(p){let e;return t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex flex-col gap-1`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5`,children:[(0,X.jsx)(`div`,{className:`size-4 shrink-0 animate-pulse rounded-full bg-muted`}),(0,X.jsx)(`div`,{className:`h-4 flex-1 animate-pulse rounded bg-muted`}),(0,X.jsx)(`div`,{className:`size-6 shrink-0 animate-pulse rounded bg-muted`})]})}),t[21]=e):e=t[21],e}let E;t[22]!==c||t[23]!==n?(E=Fy(c,n),t[22]=c,t[23]=n,t[24]=E):E=t[24];let D=E?.label||n,O;t[25]===D?O=t[26]:(O=e=>e.name||`${D} API Key`,t[25]=D,t[26]=O);let k=O;if(_.length===0){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(py,{className:`size-4`}),t[27]=e):e=t[27];let n;t[28]===D?n=t[29]:(n=(0,X.jsxs)(`span`,{className:`flex-1 text-left`,children:[`Add `,D,` connection`]}),t[28]=D,t[29]=n);let r;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(cy,{className:`size-4`}),t[30]=r):r=t[30];let i;return t[31]!==o||t[32]!==T||t[33]!==n?(i=(0,X.jsxs)(zv,{className:`w-full justify-start gap-2 border-warning/50 bg-warning/10 text-warning hover:bg-warning/20`,disabled:o,onClick:T,variant:`outline`,children:[e,n,r]}),t[31]=o,t[32]=T,t[33]=n,t[34]=i):i=t[34],i}if(_.length===1){let e=_[0],n;t[35]!==e||t[36]!==k?(n=k(e),t[35]=e,t[36]=k,t[37]=n):n=t[37];let a;t[38]!==e||t[39]!==C?(a=()=>C(e),t[38]=e,t[39]=C,t[40]=a):a=t[40];let s;t[41]!==e.id||t[42]!==i?(s=()=>i(e.id),t[41]=e.id,t[42]=i,t[43]=s):s=t[43];let c=r===e.id,l;return t[44]!==o||t[45]!==e||t[46]!==n||t[47]!==a||t[48]!==s||t[49]!==c?(l=(0,X.jsx)(`div`,{role:`radiogroup`,children:(0,X.jsx)(D3,{className:`flex h-9 w-full items-center gap-2 rounded-md border px-3 text-sm`,disabled:o,displayName:n,integration:e,onEdit:a,onSelect:s,selected:c})}),t[44]=o,t[45]=e,t[46]=n,t[47]=a,t[48]=s,t[49]=c,t[50]=l):l=t[50],l}let A,j,M;if(t[51]!==o||t[52]!==_||t[53]!==k||t[54]!==i||t[55]!==C||t[56]!==r){let[e,n]=Ja(_,Tpe);A=`flex flex-col gap-1`,j=`radiogroup`,M=[...e,...n].map(e=>{let t=r===e.id;return(0,X.jsx)(D3,{className:Q(`flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors`,t?`bg-primary/10 text-primary`:`hover:bg-muted/50`),disabled:o,displayName:k(e),integration:e,onEdit:()=>C(e),onSelect:()=>i(e.id),selected:t},e.id)}),t[51]=o,t[52]=_,t[53]=k,t[54]=i,t[55]=C,t[56]=r,t[57]=A,t[58]=j,t[59]=M}else A=t[57],j=t[58],M=t[59];let N;t[60]!==o||t[61]!==a?(N=a&&(0,X.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-muted-foreground text-sm transition-colors hover:bg-muted/50 hover:text-foreground`,disabled:o,onClick:a,type:`button`,children:[(0,X.jsx)(dy,{className:`size-4 shrink-0`}),(0,X.jsx)(`span`,{children:`Manage all connections`})]}),t[60]=o,t[61]=a,t[62]=N):N=t[62];let P;return t[63]!==A||t[64]!==j||t[65]!==M||t[66]!==N?(P=(0,X.jsxs)(`div`,{className:A,role:j,children:[M,N]}),t[63]=A,t[64]=j,t[65]=M,t[66]=N,t[67]=P):P=t[67],P}function Tpe(e){return!!e.isManaged}function O3(e){let t=Y.useRef(!0);t.current&&(t.current=!1,e())}function Epe(e){let[t,n]=Y.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function k3(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function A3({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Y.useRef(e!==void 0),[a,o]=Y.useState(t);return[i?e:a,Y.useCallback(e=>{i||o(e)},[])]}var j3=Y.createContext(null);function M3(){let e=Y.useContext(j3);if(e===null)throw Error(Gg(60));return e}var N3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},P3={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Dpe={disabled:!1,...P3},F3={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},I3={invalid:void 0,name:void 0,validityData:{state:N3,errors:[],error:``,value:``,initialValue:null},setValidityData:r_,disabled:void 0,setTouched:r_,setDirty:r_,setFilled:r_,setFocused:r_,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Dpe,registerFieldControl:r_,validation:{getValidationProps:(e,t=a_)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:r_,getInputControl:()=>null,commit:async()=>{},change:r_}},L3=Y.createContext(I3);function R3(e=!0){let t=Y.useContext(L3);if(t.setValidityData===r_&&!e)throw Error(Gg(28));return t}function z3(e,t,n,r,i=!0,a){let{registerFieldControl:o}=R3(),s=Eg(()=>Symbol());Mg(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),Mg(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var Ope=Y.createContext({controlId:void 0,registerControlId:r_,labelId:void 0,setLabelId:r_,messageIds:[],setMessageIds:r_,getDescriptionProps:e=>e});function B3(){return Y.useContext(Ope)}function V3(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=B3(),o=PH(t),s=n?i:void 0,c=Eg(()=>Symbol()),l=Y.useRef(!1),u=Y.useRef(t!=null),d=kg(()=>{!l.current||a===r_||(l.current=!1,a(c.current,void 0))});return Mg(()=>{if(a===r_)return;let e;if(n){let n=r?.current;e=ig(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),Y.useEffect(()=>d,[d]),i??o}var H3=(e,t)=>Object.is(e,t);function U3(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function kpe(e,t,n){return!e||e.length===0?!1:e.some(e=>e!==void 0&&U3(t,e,n))}function W3(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&U3(e,t,n))}function G3(e,t,n,r){let i=W3(e,r&&Array.isArray(t)?t[t.length-1]:t,n);return i===-1?null:i}function K3(e,t,n){return e.filter(e=>!U3(t,e,n))}function q3(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function J3(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Y3(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(J3(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function X3(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return q3(e)}function Z3(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?q3(e.value):q3(e)}function Q3(e,t,n){function r(){return X3(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=J3(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Ape(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,X.jsx)(Y.Fragment,{children:Q3(r,t,n)},i)),e),[])}var $3={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Z3(t,r)!==``},hasNullItemLabel:(e,t)=>t?Y3(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>U3(t,e,n)):U3(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},jpe=Y.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:r_,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function e6(){return Y.useContext(jpe)}function t6(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function n6(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function r6(e,t){return Math.max(0,e-t)}function i6(e,t){if(t<=0)return 0;let n=n6(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Mpe(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=H3,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=e6(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=R3(),F=V3({id:t}),I=M||d,L=j??c,[R,z]=A3({controlled:n,default:y?r??i_:r,name:`Select`,state:`value`}),[B,V]=A3({controlled:a,default:o,name:`Select`,state:`open`}),H=Y.useRef([]),U=Y.useRef([]),W=Y.useRef(null),G=Y.useRef(null),K=Y.useRef(0),q=Y.useRef(null),J=Y.useRef([]),ee=Y.useRef(!1),te=Y.useRef(null),ne=Y.useRef(null),re=Y.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ie=Y.useRef(!1),{mounted:ae,setMounted:oe,transitionStatus:se}=gq(B),{openMethod:ce,triggerProps:le}=sY(B),ue=Eg(()=>new fq({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:B,mounted:ae,transitionStatus:se,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,de=$(ue,$3.activeIndex),fe=$(ue,$3.selectedIndex),pe=$(ue,$3.triggerElement),me=$(ue,$3.positionerElement),he=Epe(ce),ge=ce??he,_e=Y.useMemo(()=>y?``:Z3(R,x),[y,R,x]),ve=Y.useMemo(()=>y&&Array.isArray(R)?R.map(e=>Z3(e,x)):Z3(R,x),[y,R,x]);z3(FU(pe),F,R,kg(()=>ve),!I,c);let ye=Y.useRef(R),be=y?Array.isArray(R)&&R.length>0:R!=null&&_e!==``;Mg(()=>{A(be)},[be,A]),Mg(function(){let e=R,t=!1;if(y){let n=Array.isArray(R)?R:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:W3(J.current,e,S),r=n===-1?null:n;r===null&&(ne.current=null),!B&&ue.set(`selectedIndex`,r)},[y,B,R,S,ue]);function xe(e){let t=k.initialValue;return Array.isArray(e)&&Array.isArray(t)?!t6(e,t,(e,t)=>U3(e,t,S)):e!==t}aY(R,()=>{T(L),E(xe(R)),N.change(R)});let Se=kg((e,t)=>{s?.(e,t),!t.isCanceled&&(V(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),Ce=kg(()=>{oe(!1),ue.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});vq({enabled:!h,open:B,ref:W,onComplete(){B||Ce()}}),Y.useImperativeHandle(h,()=>({unmount:Ce}),[Ce]);let we=kg((e,t)=>{i?.(e,t),!t.isCanceled&&z(e)}),Te=kg(e=>{let t=r6(e.scrollHeight,e.clientHeight),n=i6(e.scrollTop,t),r=n>0,i=n<t;ue.set(`scrollUpArrowVisible`,r),ue.set(`scrollDownArrowVisible`,i)}),Ee=Uq({open:B,onOpenChange:Se,elements:{reference:pe,floating:me}}),De=UG(Ee,{enabled:!f&&!I,event:`mousedown`}),Oe=YG(Ee),ke=lJ(Ee,{enabled:!f&&!I,listRef:H,activeIndex:de,selectedIndex:fe,disabledIndices:i_,onNavigate(e){e===null&&!B||ue.set(`activeIndex`,e)},focusItemOnHover:C}),Ae=uJ(Ee,{enabled:!f&&!I&&(B||!y),listRef:U,activeIndex:de,selectedIndex:fe,disabledIndices:e=>k3(H.current[e]),onMatch(e){B?ue.set(`activeIndex`,e):we(J.current[e],DH(sH))},onTyping(e){ee.current=e}}),je=Y.useMemo(()=>Fg(Ae.reference,ke.reference,Oe.reference,De.reference,le),[De.reference,Ae.reference,ke.reference,Oe.reference,le]),Me=Y.useMemo(()=>Fg(yq,Ae.floating,ke.floating,Oe.floating),[Ae.floating,ke.floating,Oe.floating]),Ne=ke.item??a_;O3(()=>{ue.update({popupProps:Me,triggerProps:je})}),ue.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:B,mounted:ae,transitionStatus:se,popupProps:Me,triggerProps:je,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:ge});let Pe=Y.useMemo(()=>({store:ue,floatingContext:Ee,required:p,disabled:I,readOnly:f,multiple:y,highlightItemOnHover:C,setValue:we,setOpen:Se,listRef:H,popupRef:W,scrollHandlerRef:G,handleScrollArrowVisibility:Te,scrollArrowsMountedCountRef:K,itemProps:Ne,valueRef:q,valuesRef:J,labelsRef:U,typingRef:ee,selectionRef:re,firstItemTextRef:te,selectedItemTextRef:ne,validation:N,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:ie,initialValueRef:ye}),[ue,Ee,p,I,f,y,C,we,Se,Ne,N,_,Te]),Fe=Qg(g,N.inputRef),Ie=y?void 0:L,Le=Y.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=Z3(e,x);return(0,X.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,X.jsxs)(j3.Provider,{value:Pe,children:[w,(0,X.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){ue.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=DH(sH,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=J.current.findIndex(t=>Z3(t,x).toLowerCase()===e||X3(t,b).toLowerCase()===e);r===-1&&(r=J.current.findIndex((t,n)=>{let r=U.current[n];return r!=null&&r.toLowerCase()===e}));let i=J.current[r];i!=null&&we(i,n)}ue.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ie==null?`${F}-hidden-input`:void 0,form:l,name:Ie,autoComplete:u,value:_e,disabled:I,required:p&&!(y&&be),readOnly:f,ref:Fe,style:L?UU:HU,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Le]})}function a6(e,t){return e??t}var o6=5;function s6(e,t){let n=Npe(t);return e.clientX>=n.left-o6&&e.clientX<=n.right+o6&&e.clientY>=n.top-o6&&e.clientY<=n.bottom+o6}function Npe(e){let t=e.getBoundingClientRect(),n=tg(e);if(eU)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var Ppe=400,Fpe={...rH,...F3,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ipe=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=R3(),{labelId:m}=B3(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:b,alignItemWithTriggerActiveRef:x,disabled:S}=M3(),C=p||S||a,w=$(h,$3.open),T=$(h,$3.mounted),E=$(h,$3.value),D=$(h,$3.triggerProps),O=$(h,$3.positionerElement),k=$(h,$3.listElement),A=$(h,$3.popupSide),j=$(h,$3.id),M=$(h,$3.labelId),N=$(h,$3.hasSelectedValue),P=T&&O?A:null,F=i??j,I=a6(m,M);V3({id:F});let L=FU(O),R=Y.useRef(null),{getButtonProps:z,buttonRef:B}=Xg({disabled:C,native:o}),V=h.useStateSetter(`triggerElement`),H=zH(),U=zH(),W=zH();Y.useEffect(()=>{if(w)return W.start(Ppe,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{W.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[w,_,U,W]);let G=Fg(D,{id:F,role:`combobox`,"aria-expanded":w,"aria-haspopup":`listbox`,"aria-controls":w?k?.id??CU(O)?.id:void 0,"aria-labelledby":I,"aria-readonly":y||void 0,"aria-required":b||void 0,tabIndex:C?-1:0,onFocus(e){u(!0),w&&x.current&&g(!1,DH(sH,e.nativeEvent)),H.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){mU(O,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(E))},onMouseDown(e){if(w)return;let t=Jg(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;mU(R.current,t)||mU(L.current,t)||s6(e,R.current)||g(!1,DH(SH,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,z),K=v.getValidationProps(C,G);K.role=`combobox`;let q={...f,open:w,disabled:C,value:E,readOnly:y,popupSide:P,placeholder:!N};return o_(`button`,e,{ref:[t,R,B,V],state:q,stateAttributesMapping:Fpe,props:K})}),Lpe={value:()=>null},Rpe=Y.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=M3(),u=$(c,$3.value),d=$(c,$3.items),f=$(c,$3.itemToStringLabel),p=$(c,$3.hasSelectedValue),m=!p&&a!=null&&i==null,h=$(c,$3.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Ape(u,d,f):Q3(u,d,f)),o_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:Lpe})}),zpe=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=M3();return o_(`span`,e,{state:{open:$(o,$3.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:nH})}),Bpe=Y.forwardRef(function(e,t){let{store:n}=M3(),r=$(n,$3.mounted),i=$(n,$3.forceMount);return r||i?(0,X.jsx)(CG,{ref:t,...e}):null}),c6=Y.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Vpe(){return Y.useContext(c6)}function l6(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=kg(i),[,o]=Y.useState(!1),s=Eg(Upe).current,c=Eg(Hpe).current,l=Y.useRef(0),u=Y.useRef(!0),d=Y.useRef([]),f=Y.useRef(null),p=kg(()=>{u.current||(u.current=!0,o(e=>!e))}),m=kg((e,t)=>{c.set(e,t),p()}),h=kg(e=>{c.delete(e),p()}),g=kg(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Kpe(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&u6(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=Gpe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=kg(()=>{let[e,t]=Wpe(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});Mg(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Mg(()=>{u.current&&v()}),Mg(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=kg(e=>(s.add(e),()=>{s.delete(e)})),b=Y.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,X.jsx)(c6.Provider,{value:b,children:t})}function Hpe(){return new Map}function Upe(){return new Set}function Wpe(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>u6(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Gpe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Kpe(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function u6(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var qpe=Y.createContext(void 0);function d6(){return Y.useContext(qpe)?.direction??`ltr`}var Jpe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=QU(e,t)||{};if(l==null)return{};let f=gW(u),p={x:n,y:r},m=iW(i),h=nW(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=ZU(k,j,A),N=!c.arrow&&eW(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Ype=(e,t)=>({...Jpe(e),options:[e,t]}),Xpe={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Zpe={sideX:`left`,sideY:`top`},f6=`--available-width`,p6=`--available-height`;function m6(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function h6(e,t,n){let{rects:r,placement:i}=e;return{side:m6(t,$U(i),n),align:eW(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function g6(e){return Qpe(e,Wq)}function Qpe(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Y.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=kg(A),M=A?j:n,N=FU(n),P=FU(g),F=d6()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=Y.useRef(null),G=FU(a),K=FU(s),q=typeof a==`function`?0:a,J=typeof s==`function`?0:s,ee=[];p&&ee.push(p),ee.push(JK(e=>{let t=h6(e,i,F),n=typeof G.current==`function`?G.current(t):G.current,r=typeof K.current==`function`?K.current(t):K.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[q,J,F,i]));let te=E===`none`&&T!==`shift`,ne=!te&&(u||O||T===`shift`),re=T===`none`?null:ZK({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),ie=te?null:YK({...U,rootBoundary:k,mainAxis:E!==`none`,crossAxis:ne,limiter:u||O?void 0:XK(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=rW($U(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?ee.push(ie,re):ee.push(re,ie),ee.push(QK({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(f6,`${t}px`),i.setProperty(p6,`${n}px`);let a=tg(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Ype(e=>({element:W.current||Jg(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=$U(r),l=rW(c),u=W.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(h6(e,i,F)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ne&&l===`y`&&b?S:x),{}}},Xpe,b),Mg(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ae=Y.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:oe,elements:se,x:ce,y:le,middlewareData:ue,update:de,placement:fe,context:pe,isPositioned:me,floatingStyles:he}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:ee,strategy:r,whileElementsMounted:m?void 0:(...e)=>FK(...e,ae),nodeId:y,externalTree:S}),{sideX:ge,sideY:_e}=ue.adaptiveOrigin||Zpe,ve=me?r:`fixed`,ye=Y.useMemo(()=>{let e;return e=me?b?{position:ve,[ge]:ce,[_e]:le}:{...he,position:ve}:{position:ve,top:0,left:0},e[f6]=`100vw`,e[p6]=`100vh`,me||(e.opacity=0),e},[b,ve,ge,ce,_e,le,he,me]),be=Y.useRef(null);Mg(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(_6(t)?t.current:t)||null;n!==be.current&&(oe.setPositionReference(n),be.current=n)},[g,oe,M,N]),Y.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&_6(e)&&e.current!==be.current&&(oe.setPositionReference(e.current),be.current=e.current)},[g,oe,M,N]),Y.useEffect(()=>{if(m&&g&&se.reference&&se.floating)return FK(se.reference,se.floating,de,ae)},[m,g,se,de,ae]);let xe=$U(fe),Se=m6(i,xe,F),Ce=eW(fe)||`center`,we=!!ue.hide?.referenceHidden;Mg(()=>{x&&g&&me&&xe!==I&&w(xe)},[x,g,me,xe,I]);let Te=Y.useMemo(()=>({position:`absolute`,top:ue.arrow?.y,left:ue.arrow?.x}),[ue.arrow]),Ee=ue.arrow?.centerOffset!==0;return Y.useMemo(()=>({positionerStyles:ye,arrowStyles:Te,arrowRef:W,arrowUncentered:Ee,side:Se,align:Ce,physicalSide:xe,anchorHidden:we,refs:oe,context:pe,isPositioned:me,update:de}),[ye,Te,W,Ee,Se,Ce,xe,we,oe,pe,me,de])}function _6(e){return e!=null&&`current`in e}var v6=Y.createContext(void 0);function y6(){let e=Y.useContext(v6);if(!e)throw Error(Gg(59));return e}function b6(e,t){e&&Object.assign(e.style,t)}var x6={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function S6(e){return e===`starting`?hG:a_}function C6(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),o_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},S6(r),i],stateAttributesMapping:iH})}var $pe=20;function w6(e,t,n,r){let[i,a]=Y.useState(!1);Mg(()=>{if(!e||!t||n==null){a(!1);return}let r=Jg(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-$pe)},[e,t,n]),JJ(e&&(!t||i),r)}var eme={position:`fixed`},tme=Y.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=gG,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D,floatingContext:O}=M3(),k=$(y,$3.open),A=$(y,$3.mounted),j=$(y,$3.modal),M=$(y,$3.value),N=$(y,$3.openMethod),P=$(y,$3.positionerElement),F=$(y,$3.triggerElement),I=$(y,$3.isItemEqualToValue),L=$(y,$3.transitionStatus),R=Y.useRef(null),z=Y.useRef(null),[B,V]=Y.useState(h),H=A&&B&&N!==`touch`;!A&&B!==h&&V(h),Y.useImperativeHandle(S,()=>H),w6((H||j)&&k,N===`touch`,P,F);let U=g6({anchor:n,floatingRootContext:O,positionMethod:a,mounted:A,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),W=H?`none`:U.side,G=H?eme:U.positionerStyles,K={open:k,side:W,align:U.align,anchorHidden:U.anchorHidden};Mg(()=>{y.set(`popupSide`,U.side)},[y,U.side]);let q=C6(e,K,{styles:G,transitionStatus:L,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!A,inert:!k}),J=Y.useRef(0),ee=kg(e=>{if(w.current.length===0)return;let t=J.current;if(J.current=e.size,e.size===t)return;let n=DH(sH);if(t!==0&&!y.state.multiple&&M!==null&&W3(w.current,M,I)===-1){let e=T.current,t=e!=null&&W3(w.current,e,I)!==-1?e:null;D(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(M)){let e=M.filter(e=>W3(w.current,e,I)!==-1);e.length!==M.length&&(D(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(k&&H){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};b6(P,e),b6(E.current,e)}}),te=Y.useMemo(()=>({...U,side:W,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:R,scrollDownArrowRef:z}),[U,W,H,V]);return(0,X.jsx)(l6,{elementsRef:b,labelsRef:x,onMapChange:ee,children:(0,X.jsxs)(v6.Provider,{value:te,children:[A&&j&&(0,X.jsx)(IJ,{inert:FJ(!k),cutout:F}),q]})})}),T6=`base-ui-disable-scrollbar`,E6={className:T6,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:T6,precedence:`base-ui:low`,children:`.${T6}{scrollbar-width:none}.${T6}::-webkit-scrollbar{display:none}`})}},nme=Y.createContext(void 0);function D6(e){let t=Y.useContext(nme);if(t===void 0&&!e)throw Error(Gg(69));return t}var rme=Y.createContext(void 0),ime={disableStyleElements:!1};function ame(){return Y.useContext(rme)??ime}var ome={...iH,...XV},sme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v,floatingContext:y}=M3(),{side:b,align:x,alignItemWithTriggerActive:S,isPositioned:C,setControlledAlignItemWithTrigger:w}=y6(),T=D6(!0)!=null,E=d6(),{nonce:D,disableStyleElements:O}=ame(),k=$(s,$3.id),A=$(s,$3.open),j=$(s,$3.openMethod),M=$(s,$3.mounted),N=$(s,$3.popupProps),P=$(s,$3.transitionStatus),F=$(s,$3.triggerElement),I=$(s,$3.positionerElement),L=$(s,$3.listElement),R=Y.useRef(!1),z=Y.useRef(!1),B=Y.useRef({}),V=BU(),H=kg(e=>{if(!I||!c.current||!z.current)return;let t=I.style.top===`0px`,n=I.style.bottom===`0px`;if(R.current||!S||!t&&!n){h(e);return}let r=A6(I),i=j6(I.getBoundingClientRect().height,`y`,r),a=Jg(I),o=tg(I),s=o.getComputedStyle(I),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=O6(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=k6(e),g=null,_=e=>{I.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=n6(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(R.current=!0),h(e);return}f-y>1?g=t?1/0:0:n&&p<m&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=n6(g,0,k6(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(R.current=!0),h(e)});Y.useImperativeHandle(g,()=>H,[H]),vq({open:A,ref:c,onComplete(){A&&l?.(!0)}});let U={open:A,transitionStatus:P,side:b,align:x};Mg(()=>{!I||!c.current||Object.keys(B.current).length||(B.current={top:I.style.top||`0`,left:I.style.left||`0`,right:I.style.right,height:I.style.height,bottom:I.style.bottom,minHeight:I.style.minHeight,maxHeight:I.style.maxHeight,marginTop:I.style.marginTop,marginBottom:I.style.marginBottom})},[c,I]),Mg(()=>{A||S||(z.current=!1,R.current=!1,b6(I,B.current))},[A,S,I,c]),Mg(()=>{let e=c.current;if(!A||!F||!I||!e||S&&!C||s.state.transitionStatus===`ending`)return;if(z.current=!0,e.style.removeProperty(`--transform-origin`),!S){V.request(()=>h(L||e));return}let t=cme(e);try{let t=p.current;t?.isConnected||(t=!$3.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=tg(I),i=r.getComputedStyle(I),a=r.getComputedStyle(e),o=Jg(F),c=A6(F),l=M6(F.getBoundingClientRect(),c),u=M6(I.getBoundingClientRect(),c),m=l.height,g=L||e,y=g.scrollHeight,b=parseFloat(a.borderBottomWidth),x=parseFloat(i.marginTop)||10,S=parseFloat(i.marginBottom)||10,C=parseFloat(i.minHeight)||100,T=O6(a),D=o.documentElement.clientHeight-x-S,O=o.documentElement.clientWidth,k=D-l.bottom+m,A,j=E===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=M6(n.getBoundingClientRect(),c);A=M6(t.getBoundingClientRect(),c),j=u.left+(E===`rtl`?e.right-A.right:e.left-A.left);let r=e.top-l.top+e.height/2;M=A.top-u.top+A.height/2-r}let N=k+M+S+b,P=Math.min(D,N),z=D-x-S,V=N-P,H=O-5;I.style.left=`${n6(j,5,H-u.width)}px`,I.style.height=`${P}px`,I.style.maxHeight=`none`,I.style.marginTop=`${x}px`,I.style.marginBottom=`${S}px`,e.style.height=`100%`;let U=k6(g),W=V>=U-1;W&&(P=Math.min(D,u.height)-(V-U));let G=l.top<20||l.bottom>D-20||Math.ceil(P)+1<Math.min(y,C),K=(r.visualViewport?.scale??1)!==1&&ZH;if(G||K){b6(I,B.current),w(!1);return}let q=Math.max(C,P);if(W){let e=Math.max(0,D-N);I.style.top=u.height>=z?`0`:`${e}px`,I.style.height=`${P}px`,g.scrollTop=k6(g)}else I.style.bottom=`0`,g.scrollTop=V;if(A){let t=u.top,n=u.height,r=A.top+A.height/2,i=n6(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(q===D||P>=T)&&(R.current=!0),h(g),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,A,I,F,d,f,p,c,h,S,w,V,L,_,v,E,C]),Y.useEffect(()=>{if(!S||!I||!A)return;let e=tg(I);function t(e){u(!1,DH(EH,e))}return NU(e,`resize`,t)},[u,S,I,A]);let W={...L?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${k}-list`},onKeyDown(e){T&&TJ.has(e.key)&&e.stopPropagation()},onScroll(e){L||H(e.currentTarget)},...S&&{style:L?{height:`100%`}:x6},className:!L&&S?E6.className:void 0},G=o_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:ome,props:[N,W,S6(P),o]});return(0,X.jsxs)(Y.Fragment,{children:[!O&&E6.getElement(D),(0,X.jsx)(HG,{context:y,modal:!1,disabled:!M,openInteractionType:j,returnFocus:a,restoreFocus:!0,children:G})]})});function O6(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function k6(e){return r6(e.scrollHeight,e.clientHeight)}function A6(e){return MK.getScale(e)}function j6(e,t,n){return e/n[t]}function M6(e,t){return _W({x:j6(e.x,`x`,t),y:j6(e.y,`y`,t),width:j6(e.width,`x`,t),height:j6(e.height,`y`,t)})}var N6=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function cme(e){let{style:t}=e,n={};for(let[e,r]of N6)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of N6){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var lme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=M3(),{alignItemWithTriggerActive:l}=y6(),u=$(o,$3.hasScrollArrows),d=$(o,$3.openMethod),f={id:`${$(o,$3.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:x6},className:u&&d!==`touch`?E6.className:void 0};return o_(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})});function P6(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Vpe(),u=Y.useRef(-1),[d,f]=Y.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Y.useRef(null),h=Y.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Mg(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var F6=Y.createContext(void 0);function I6(){let e=Y.useContext(F6);if(!e)throw Error(Gg(57));return e}var ume=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Y.useRef(null),d=P6({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=M3(),C=x||s,w=$(f,$3.isActive,d.index),T=$(f,$3.open),E=$(f,$3.isSelected,a),D=$(f,$3.isSelectedByFocus,d.index),O=$(f,$3.isItemEqualToValue),k=d.index,A=Y.useRef(null);Mg(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),Mg(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&U3(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let j=Y.useRef(`mouse`),M=Y.useRef(!1),{getButtonProps:N,buttonRef:P}=Xg({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),F={disabled:C,selected:E,highlighted:w};function I(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?K3(n,a,O):[...n,a];h(r,DH(fH,e))}else h(a,DH(fH,e)),m(!1,DH(fH,e))}function L(){g.current.dragY=0}let R={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=j.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&rU(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!M.current;M.current=!1,!(C||i)&&I(e.nativeEvent)},onPointerEnter(e){j.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){j.current=e.pointerType,M.current=!0,L()},onMouseUp(){if(L(),C||j.current===`touch`||M.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(M.current=!0,A.current?.click(),M.current=!1)}},z=o_(`div`,e,{ref:[P,t,d.ref,A],state:F,props:[p,R,l,N]}),B=Y.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,X.jsx)(F6.Provider,{value:B,children:z})})),dme=Y.forwardRef(function(e,t){let{selected:n}=I6();return e.keepMounted||n?(0,X.jsx)(fme,{...e,ref:t}):null}),fme=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=I6(),c=Y.useRef(null),{transitionStatus:l,setMounted:u}=gq(s),d=o_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:XV});return vq({open:s,ref:c,onComplete(){s||u(!1)}}),d})),pme=Y.memo(Y.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=I6(),{firstItemTextRef:a,selectedItemTextRef:o}=M3(),{render:s,className:c,style:l,...u}=e;return o_(`div`,e,{ref:[Y.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]),t,r],props:u})})),L6=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=M3(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=y6(),_=$(l,c?$3.scrollUpArrowVisible:$3.scrollDownArrowVisible),v=$(l,$3.openMethod),y=_&&v!==`touch`,b=zH(),x=c?g:h,{mounted:S,transitionStatus:C,setMounted:w}=gq(y);Mg(()=>(p.current+=1,l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.set(`hasScrollArrows`,!1)}),[l,p]),vq({open:y,ref:x,onComplete(){y||w(!1)}});let T=o_(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:C},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f(e);let n=r6(e.scrollHeight,e.clientHeight),r=i6(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=mme(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s],stateAttributesMapping:XV});return S||o?T:null});function mme(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?i6(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?i6(l.offsetTop+l.offsetHeight-r+i,a):a}var hme=Y.forwardRef(function(e,t){return(0,X.jsx)(L6,{...e,ref:t,direction:`down`})}),gme=Y.forwardRef(function(e,t){return(0,X.jsx)(L6,{...e,ref:t,direction:`up`})}),R6=Y.createContext(void 0);function _me(){let e=Y.useContext(R6);if(e===void 0)throw Error(Gg(56));return e}var vme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Y.useState(),c=Y.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=o_(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,X.jsx)(R6.Provider,{value:c,children:l})}),yme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=_me(),c=PH(a);return Mg(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),o_(`div`,e,{ref:t,props:[{id:c},o]})}),bme=Y.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return o_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`presentation`},o]})}),z6=(0,Y.createContext)(new Map);function B6(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(B6).join(` `):(0,Y.isValidElement)(e)?B6(e.props.children):``}function xme(e){let t=[],n=e=>{Y.Children.forEach(e,e=>{if((0,Y.isValidElement)(e)){if(typeof e.props.value==`string`||e.props.value===null){let n=typeof e.props.label==`string`?e.props.label:B6(e.props.children).trim();n&&t.push({value:e.props.value,label:n})}e.props.children&&n(e.props.children)}})};return n(e),t}function V6(e){let t=(0,Z.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({onValueChange:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;if(t[4]!==n){a=new Map;for(let e of xme(n))a.set(e.value,e.label);t[4]=n,t[5]=a}else a=t[5];let o=a,s;t[6]===r?s=t[7]:(s=e=>r?.(e),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==i||t[10]!==s?(c=(0,X.jsx)(Mpe,{"data-slot":`select`,multiple:!1,onValueChange:s,...i,children:n}),t[8]=n,t[9]=i,t[10]=s,t[11]=c):c=t[11];let l;return t[12]!==o||t[13]!==c?(l=(0,X.jsx)(z6.Provider,{value:o,children:c}),t[12]=o,t[13]=c,t[14]=l):l=t[14],l}function H6(e){return t=>{t!==null&&e(t)}}function Sme(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(vme,{"data-slot":`select-group`,...n}),t[2]=n,t[3]=r),r}function U6(e){let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({placeholder:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,Y.useContext)(z6),a;t[3]!==i||t[4]!==n?(a=e=>i.get(e)??(e||n),t[3]=i,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==n||t[7]!==r||t[8]!==a?(o=(0,X.jsx)(Rpe,{"data-slot":`select-value`,placeholder:n,...r,children:a}),t[6]=n,t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function W6(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,size:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===r?s=t[6]:(s=Q(`flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[size=default]:h-9 data-[size=sm]:h-8 data-[disabled]:cursor-not-allowed data-[invalid]:border-destructive data-[placeholder]:text-muted-foreground data-[disabled]:opacity-50 data-[invalid]:ring-destructive/20 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:data-[invalid]:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(zpe,{children:(0,X.jsx)(Jv,{className:`size-4 opacity-50`})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,X.jsxs)(Ipe,{className:s,"data-size":o,"data-slot":`select-trigger`,...i,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function G6(e){let t=(0,Z.c)(27),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:r,children:n,side:a,sideOffset:o,align:s,alignOffset:c,alignItemWithTrigger:l,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?`bottom`:a,d=o===void 0?4:o,f=s===void 0?`center`:s,p=c===void 0?0:c,m=l!==void 0&&l,h;t[9]===r?h=t[10]:(h=Q(`data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 max-h-(--available-height) w-max min-w-(--anchor-width) origin-(--transform-origin) overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-closed:animate-out data-open:animate-in`,r),t[9]=r,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(Tme,{}),t[11]=g):g=t[11];let _;t[12]===n?_=t[13]:(_=(0,X.jsx)(lme,{className:`max-h-[inherit] w-max min-w-full overflow-y-auto p-1`,children:n}),t[12]=n,t[13]=_);let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Eme,{}),t[14]=v):v=t[14];let y;t[15]!==m||t[16]!==i||t[17]!==h||t[18]!==_?(y=(0,X.jsxs)(sme,{className:h,"data-align-trigger":m,"data-slot":`select-content`,...i,children:[g,_,v]}),t[15]=m,t[16]=i,t[17]=h,t[18]=_,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==m||t[22]!==p||t[23]!==u||t[24]!==d||t[25]!==y?(b=(0,X.jsx)(Bpe,{children:(0,X.jsx)(tme,{align:f,alignItemWithTrigger:m,alignOffset:p,className:`isolate z-50`,side:u,sideOffset:d,children:y})}),t[20]=f,t[21]=m,t[22]=p,t[23]=u,t[24]=d,t[25]=y,t[26]=b):b=t[26],b}function Cme(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-1.5 text-muted-foreground text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(yme,{className:i,"data-slot":`select-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function K6(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex w-full cursor-default select-none items-center gap-2 whitespace-nowrap rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(dme,{children:(0,X.jsx)(qv,{className:`size-4`})})}),t[6]=o):o=t[6];let s;t[7]===n?s=t[8]:(s=(0,X.jsx)(pme,{children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,X.jsxs)(ume,{className:a,"data-slot":`select-item`,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function wme(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`pointer-events-none -mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(bme,{className:i,"data-slot":`select-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tme(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex cursor-default items-center justify-center py-1 data-[visible=false]:hidden`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ote,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(gme,{className:i,"data-slot":`select-scroll-up-button`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Eme(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex cursor-default items-center justify-center py-1 data-[visible=false]:hidden`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Jv,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(hme,{className:i,"data-slot":`select-scroll-down-button`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function q6(e,t){let n=new Map;for(let e of t){let t=n.get(e.target);t?t.push(e.source):n.set(e.target,[e.source])}let r=new Set,i=new Set([e]),a=[e];for(;a.length>0;){let e=a.pop();if(e)for(let t of n.get(e)??[])r.add(t),i.has(t)||(i.add(t),a.push(t))}return r}var J6=`event:`;function Y6(e){return`${J6}${e}`}function X6(e){if(typeof e!=`string`||!e.startsWith(J6))return null;let t=e.slice(6).trim();return t.length>0?t:null}function Dme(e){return e===b1.eventSplit}function Z6(e){return C0(e)}function Q6(e){let{rule:t,event:n}=e,r=t.field.trim();return r===`$event.name`?F2(t)?!0:t.operator===`equals`?t.value===n.name:t.operator!==`not_equals`||t.value!==n.name:F2(t)||e.declaredElsewhere.has(r)?!0:n.payloadFields.some(e=>e.path===r)}function $6(e){let{rule:t,event:n}=e;return t.field.trim()!==`$event.name`||F2(t)?!0:t.operator===`equals`?t.value!==n.name:t.operator!==`not_equals`||t.value===n.name}function Ome(e){let t=(t,n)=>n?t.every(t=>Q6({...e,rule:t})):t.some(t=>Q6({...e,rule:t})),n=e.model.groups.map(e=>t(e.conditions,e.logic===`and`));return e.model.groupLogic===`and`?n.every(Boolean):n.some(Boolean)}function kme(e){let t=(t,n)=>n?t.some(t=>$6({...e,rule:t})):t.every(t=>$6({...e,rule:t})),n=e.model.groups.map(e=>t(e.conditions,e.logic===`and`));return e.model.groupLogic===`and`?n.some(Boolean):n.every(Boolean)}function Ame(e){let{events:t,branch:n}=e;if(!n)return[...t];let r=e4(e.node.data.config?.conditionModel);return r.valid?t.filter(t=>{let i={model:r.model,event:t,declaredElsewhere:e.declaredElsewhere};return n===`true`?Ome(i):kme(i)}):[...t]}function jme(e){let t=C1(e.entryNode.data.config);return t?Ka((e.handle===`started`?t.startEvents:e.handle===`canceled`?t.cancelEvents:[]).map(t=>Ny(e.catalog,t))):[]}function Mme(e,t){let n=e.data.config?.actionType;if(typeof n!=`string`)return[];let r=Py(t,n);return r?f0(e.data.config,r.outputFields).map(e=>e.path):[]}function Nme(e){let{catalog:t}=e,n=new Map(e.nodes.map(e=>[e.id,e])),r=new Map;for(let t of e.edges){let e=r.get(t.target);e?e.push(t):r.set(t.target,[t])}let i=r=>{let i=new Set,a=e=>{let r=n.get(e);if(r)for(let e of Mme(r,t))i.add(e)};a(r);for(let t of q6(r,e.edges))a(t);return i},a=new Map,o=(e,s)=>{let c=a.get(e);if(c)return c;if(s.has(e))return[];let l=r.get(e)??[];if(l.length===0)return a.set(e,[]),[];let u=new Set(s);u.add(e);let d=null;for(let e of l){let r=n.get(e.source);if(!r)continue;let a=r.data.type===`lifecycle`?jme({entryNode:r,handle:e.sourceHandle,catalog:t}):Pme({parent:r,handle:e.sourceHandle,events:o(r.id,u),declaredElsewhere:i(r.id)});d=d===null?a:Fme(d,a)}let f=d??[];return a.set(e,f),f};return o(e.targetNodeId,new Set)}function Pme(e){let{parent:t,handle:n,events:r}=e;if(Z6(t)){let e=X6(n);return r.filter(t=>t.name===e)}return r.length>0&&E0(t)?Ame({events:r,node:t,branch:w0(n),declaredElsewhere:e.declaredElsewhere}):r}function Fme(e,t){let n=new Set(t.map(e=>e.name));return e.filter(e=>n.has(e.name))}function Ime(e){let t=Ya(Ka(e.map(e=>e.field.type)));return t.length<2?t[0]?{type:t[0]}:{}:{typeClash:{types:t,events:e.filter(e=>e.field.type).map(e=>e.event.name)}}}function Lme(e){return e.find(e=>e.field.description)?.field.description}function Rme(e){return Ya(e.map(e=>(e.field.enumValues??[]).toSorted().join(` `))).length===1&&e[0]?.field.enumValues?[...e[0].field.enumValues]:void 0}function zme(e){let t=new Map;for(let n of e)for(let e of n.payloadFields){let r=t.get(e.path);r?r.push({event:n,field:e}):t.set(e.path,[{event:n,field:e}])}return Array.from(t.entries()).map(([t,n])=>{let{type:r,typeClash:i}=Ime(n),a=Lme(n),o=Rme(n);return{path:t,...a?{description:a}:{},...r?{type:r}:{},...o?{enumValues:o}:{},...i?{typeClash:i}:{},...n.length<e.length||n.some(e=>e.field.nullable)?{nullable:!0}:{},declaredBy:n.map(e=>e.event.name)}})}var e8=`Carried by every Event`,Bme=`Event name`;function Vme(e){return zme(e).map(({declaredBy:t,...n})=>{let[r,i]=Ja(e,e=>t.includes(e.name));return{...n,...i.length>0?{absentOn:i.map(e=>e.label)}:{},...e.length<2?{}:{sourceLabel:i.length===0?e8:r.map(e=>e.label).join(`, `)}}})}function t8(e){return Nme({targetNodeId:e.targetNodeId,nodes:e.nodes,edges:e.edges,catalog:e.catalog})}function Hme(e,t){let n=Py(e,t);return n?[...n.outputFields]:[]}function n8(e,t){if(t.data.label)return t.data.label;if(t.data.type===`action`){let n=_0(t.data.config,`actionType`);if(n){let t=Py(e,n);if(t?.label)return t.label}return n||`Action`}return t.data.type===`lifecycle`?`Lifecycle`:`Node`}function r8(e,t){let n=_0(e.data.config,`actionType`);if(n){let r=Hme(t.catalog,n);if(r.length>0)return[...f0(e.data.config,r)]}return e.data.type===`lifecycle`?Vme(t8(t)):[]}function i8(e){let{currentNodeId:t,nodes:n,edges:r}=e;if(!t)return[];let i=q6(t,r);return n.filter(e=>i.has(e.id))}function Ume(e){let{currentNodeId:t,nodes:n,edges:r,catalog:i}=e;return t?i8(e).flatMap(e=>{let a=n8(i,e);return r8(e,{targetNodeId:t,nodes:n,edges:r,catalog:i}).map(({sourceLabel:t,...n})=>({...n,sourceNodeId:e.id,sourceNodeName:t??a}))}):[]}function a8(e){return e.type===`timestamp`?`timestamp`:e.type===`string`||e.type===`number`||e.type===`boolean`?e.type:e.type===`duration`||e.type===void 0?`string`:null}function Wme(e,t){let n=Ny(e,t);return n?Ka(n.payloadFields.map(e=>{let r=e.path.trim(),i=a8({...e,sourceNodeId:t,sourceNodeName:n.label});return r&&i?{path:r,label:r,type:i,sourceNodeId:t,sourceNodeLabel:n.label,sourceNodeLabels:[n.label],...e.nullable?{nullable:!0}:{},...e.enumValues?{enumValues:e.enumValues}:{}}:null})).toSorted((e,t)=>e.path.localeCompare(t.path)):[]}function Gme(e){let{currentNodeId:t,nodes:n,edges:r,catalog:i}=e,a=i8(e).find(e=>e.data.type===`lifecycle`);if(!(a&&t))return[];let o=t8({targetNodeId:t,nodes:n,edges:r,catalog:i});return o.length<2?[]:[{path:Ode,label:Bme,type:`string`,sourceNodeId:a.id,sourceNodeLabel:e8,sourceNodeLabels:[e8],enumValues:o.map(e=>e.name)}]}function o8(e){let t=new Map(Gme(e).map(e=>[e.path,e]));for(let n of Ume(e)){let e=n.path.trim();if(!e||n.typeClash)continue;let r=a8(n);if(!r)continue;let i=t.get(e);if(i){i.sourceNodeLabels.includes(n.sourceNodeName)||(i.sourceNodeLabels.push(n.sourceNodeName),i.sourceNodeLabels.sort((e,t)=>e.localeCompare(t)));continue}t.set(e,{path:e,label:e,type:r,sourceNodeId:n.sourceNodeId,sourceNodeLabel:n.sourceNodeName,sourceNodeLabels:[n.sourceNodeName],...n.nullable?{nullable:!0}:{},...n.enumValues?{enumValues:n.enumValues}:{}})}return Array.from(t.values()).toSorted((e,t)=>e.path.localeCompare(t.path))}function Kme(e,t,n){return!(t&&e.type)||n.allowNumber&&e.type===`number`?!0:e.type===t}function s8(e,t){return Kme(e,t,{allowNumber:!1})}function qme(e,t,n){return n?2:t&&!e.type?1:0}function Jme(e,t){let n=e.typeClash;if(n&&!(t&&!n.types.some(e=>s8({type:e},t))))return`${n.events.join(` and `)} type this differently. Add an Event Split above this node to use it.`}function c8(e){let t=(0,Z.c)(45),{isOpen:n,position:r,onSelect:i,onClose:a,currentNodeId:o,filter:s,fieldType:c}=e,l=s===void 0?``:s,u=yy(),[d]=EA(Q4),[f]=EA($4),[p,m]=(0,Y.useState)(0),h=(0,Y.useRef)(null),g;t[0]!==o||t[1]!==f||t[2]!==d?(g=i8({currentNodeId:o,nodes:d,edges:f}),t[0]=o,t[1]=f,t[2]=d,t[3]=g):g=t[3];let _=g,v;bb0:{if(!o){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[4]=e):e=t[4],v=e;break bb0}let e;if(t[5]!==u||t[6]!==o||t[7]!==f||t[8]!==c||t[9]!==d||t[10]!==_){let n=[];for(let e of _){let t=n8(u,e),r=r8(e,{targetNodeId:o,nodes:d,edges:f,catalog:u});!c&&e.data.type!==`lifecycle`&&r.length&&n.push({type:`node`,rank:0,nodeId:e.id,nodeName:t,template:h0({nodeId:e.id,nodeLabel:t})});for(let i of r){let r=Jme(i,c);(r||s8(i,c))&&n.push({type:`field`,rank:qme(i,c,r),nodeId:e.id,nodeName:t,field:i.path,description:i.description,template:h0({nodeId:e.id,nodeLabel:t,fieldPath:i.path}),...r?{unusable:r}:{},...i.absentOn?.length?{absentOn:i.absentOn}:{}})}}e=n.toSorted(Xme),t[5]=u,t[6]=o,t[7]=f,t[8]=c,t[9]=d,t[10]=_,t[11]=e}else e=t[11];v=e}let y=v,b;if(t[12]!==l||t[13]!==y){bb1:{let e=l.trim().toLowerCase();if(!e){b=y;break bb1}b=y.filter(t=>t.nodeName.toLowerCase().includes(e)||t.field&&t.field.toLowerCase().includes(e))}t[12]=l,t[13]=y,t[14]=b}else b=t[14];let x=b,S=x.length===0?0:Math.min(p,x.length-1),C=c&&y.length===0?c===`duration`?`No field upstream is a duration. Type a value like 24h.`:`No field upstream is a date and time. Type one, like 2026-03-10T09:00:00Z.`:null,w=x.length>0||C!==null,T;t[15]!==x||t[16]!==a||t[17]!==i||t[18]!==S?(T=e=>{bb87:switch(e.key){case`ArrowDown`:e.preventDefault(),m(e=>e<x.length-1?e+1:e);break bb87;case`ArrowUp`:e.preventDefault(),m(Yme);break bb87;case`Enter`:{e.preventDefault();let t=x[S];t&&!t.unusable&&i(t.template);break bb87}case`Escape`:e.preventDefault(),a()}},t[15]=x,t[16]=a,t[17]=i,t[18]=S,t[19]=T):T=t[19];let E=T,D=n&&w,O;t[20]===D?O=t[21]:(O={enabled:D},t[20]=D,t[21]=O),_Y(window,`keydown`,E,O);let k;if(t[22]===S?k=t[23]:(k=()=>{let e=h.current?.children.item(S);e instanceof HTMLElement&&e.scrollIntoView({block:`nearest`})},t[22]=S,t[23]=k),vY(S,k),!(n&&w)||typeof document>`u`)return null;let A=Math.min(r.top,window.innerHeight-300),j=Math.min(r.left,window.innerWidth-320),M;t[24]!==j||t[25]!==A?(M={top:A,left:j},t[24]=j,t[25]=A,t[26]=M):M=t[26];let N=M,P=`${N.top}px`,F=`${N.left}px`,I;t[27]!==P||t[28]!==F?(I={top:P,left:F},t[27]=P,t[28]=F,t[29]=I):I=t[29];let L;t[30]===C?L=t[31]:(L=C&&(0,X.jsx)(`div`,{className:`px-2 py-1.5 text-muted-foreground text-sm`,children:C}),t[30]=C,t[31]=L);let R;if(t[32]!==x||t[33]!==i||t[34]!==S){let e;t[36]!==i||t[37]!==S?(e=(e,t)=>(0,X.jsxs)(`div`,{className:Q(`flex items-center justify-between rounded px-2 py-1.5 text-sm transition-colors`,e.unusable?`cursor-not-allowed opacity-60`:`cursor-pointer`,t===S?`bg-accent text-accent-foreground`:!e.unusable&&`hover:bg-accent/50`),onMouseDown:t=>{t.preventDefault(),e.unusable||i(e.template)},onMouseEnter:()=>m(t),children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:e.type===`node`?e.nodeName:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.nodeName,`.`]}),e.field]})}),e.description&&(0,X.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.description}),e.absentOn&&(0,X.jsxs)(`div`,{className:`text-warning text-xs dark:text-warning`,children:[`Absent on `,e.absentOn.join(`, `)]}),e.unusable&&(0,X.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.unusable})]}),t===S&&!e.unusable&&(0,X.jsx)(qv,{className:`size-4`})]},`${e.nodeId}-${e.field||`root`}`),t[36]=i,t[37]=S,t[38]=e):e=t[38],R=x.map(e),t[32]=x,t[33]=i,t[34]=S,t[35]=R}else R=t[35];let z;t[39]!==L||t[40]!==R?(z=(0,X.jsxs)(`div`,{className:`max-h-60 overflow-y-auto`,ref:h,children:[L,R]}),t[39]=L,t[40]=R,t[41]=z):z=t[41];let B;return t[42]!==I||t[43]!==z?(B=(0,Xi.createPortal)((0,X.jsx)(`div`,{className:`fixed z-50 w-80 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,style:I,children:z}),document.body),t[42]=I,t[43]=z,t[44]=B):B=t[44],B}function Yme(e){return e>0?e-1:e}function Xme(e,t){return e.rank-t.rank}var l8=`data-placeholder`,u8=`data-filler`,Zme=`inline-flex items-center gap-1 rounded bg-info/10 px-1.5 py-0.5 text-info font-mono text-xs border border-info/20 mx-0.5`,Qme=`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive font-mono text-xs border border-destructive/20 mx-0.5`;function $me(e,t,n){let r=e.fieldPath?`${e.nodeLabel}.${e.fieldPath}`:e.nodeLabel,i=t.find(t=>t.id===e.nodeId);if(!i)return r;let a=i.data.label;if(!a&&i.data.type===`action`){let e=_0(i.data.config,`actionType`);e&&(a=Py(n,e)?.label)}return a?e.fieldPath?`${a}.${e.fieldPath}`:a:r}function ehe(e){return e instanceof HTMLElement?e.getAttribute(`data-template`):null}function d8(e){return e.start+e.text.length}function f8(e,t){let n=[],r=0;function i(e){n.push(e),r+=e.text.length}function a(e){if(e instanceof Text){i({kind:`text`,node:e,start:r,text:e.data});return}if(!(e instanceof HTMLElement))return;let n=ehe(e);if(n!==null){i({kind:`badge`,node:e,start:r,text:n});return}if(!(e.hasAttribute(l8)||e.hasAttribute(u8))){if(e.tagName===`BR`){i({kind:`break`,node:e,start:r,text:t?`
|
|
100
|
-
`:``});return}for(let t of Array.from(e.childNodes))a(t)}}for(let t of Array.from(e.childNodes))a(t);return n}function
|
|
101
|
-
`);n.forEach((t,r)=>{t&&e.appendChild(document.createTextNode(t)),r<n.length-1&&(f(),e.appendChild(document.createElement(`br`)),f())})}function m(t,r){i=r;let a=r.focused?r.caretOffset??c()?.offset??null:null;if(e.innerHTML=``,!(t||r.focused)){let t=document.createElement(`span`);t.setAttribute(l8,``),t.className=`text-muted-foreground pointer-events-none`,t.textContent=r.placeholder??``,e.appendChild(t);return}for(let i of m0(t)){if(i.kind===`literal`){p(i.text);continue}let t=document.createElement(`span`);t.className=r.nodes.some(e=>e.id===i.token.nodeId)?Zme:Qme,t.contentEditable=`false`,t.setAttribute(`data-template`,i.token.raw),t.textContent=$me(i.token,r.nodes,n),f(),e.appendChild(t),f()}if(!t){let t=document.createElement(`br`);t.setAttribute(u8,``),f(),e.appendChild(t)}r.focused&&a!==null&&d(a)}return{render:m,rerender(t){m(p8(e,r),{...i,nodes:t,caretOffset:void 0})},readText:()=>p8(e,r),readCaret:c,setCaretOffset:d,insertText(e){let t=window.getSelection();if(!t||t.rangeCount===0)return!1;let n=t.getRangeAt(0);n.deleteContents();let r=document.createTextNode(e);return n.insertNode(r),n.setStartAfter(r),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!0},insertLineBreak(){let e=window.getSelection();if(!e||e.rangeCount===0)return!1;let t=e.getRangeAt(0);t.deleteContents();let n=document.createElement(`br`),r=document.createTextNode(``);return t.insertNode(n),n.parentNode?.insertBefore(r,n.nextSibling),n.parentNode?.insertBefore(document.createTextNode(``),n),t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!0}}}function m8(e){let t=(0,Z.c)(52),{value:n,onChange:r,placeholder:i,multiline:a}=e,o=yy(),s=wA(Q4),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(n),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={top:0,left:0},t[0]=h):h=t[0];let[g,_]=(0,Y.useState)(h),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),S;t[1]!==o||t[2]!==a?(S=e=>{if(c.current=e,!e){l.current=null;return}l.current=the(e,{multiline:a,catalog:o})},t[1]=o,t[2]=a,t[3]=S):S=t[3];let C=S,w;t[4]!==d||t[5]!==s||t[6]!==i||t[7]!==n?(w=()=>{d||l.current?.render(n,{focused:!1,nodes:s,placeholder:i})},t[4]=d,t[5]=s,t[6]=i,t[7]=n,t[8]=w):w=t[8],vY(d?h8:n,w);let T;t[9]!==d||t[10]!==s?(T=()=>{d||l.current?.rerender(s)},t[9]=d,t[10]=s,t[11]=T):T=t[11],vY(d?h8:s,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=e.slice(0,t),r=n.lastIndexOf(`@`),i=r===-1?null:n.slice(r+1),a=p0(e).some(e=>r>=e.start&&r<e.end);if(i===null||a||i.includes(` `)){m(!1);return}y(i),x(r);let o=c.current?.getBoundingClientRect();o&&_({top:o.bottom+window.scrollY+4,left:o.left+window.scrollX}),m(!0)},t[12]=E):E=t[12];let D=E,O;t[13]!==s||t[14]!==r||t[15]!==i?(O=()=>{let e=l.current;if(!e)return;let t=e.readText();if(t===u.current)return;let n=p0(u.current).length,a=p0(t).length;if(u.current=t,r?.(t),n===a){D(t,e.readCaret()?.offset??t.length);return}m(!1),e.render(t,{focused:!0,nodes:s,placeholder:i})},t[13]=s,t[14]=r,t[15]=i,t[16]=O):O=t[16];let k=O,A;t[17]!==b||t[18]!==v||t[19]!==s||t[20]!==r||t[21]!==i?(A=e=>{let t=l.current;if(!t||b===null)return;let n=t.readText(),a=n.slice(0,b),o=n.slice(b+1+v.length),c=a+e+o;u.current=c,r?.(c),m(!1),x(null),f(!0),t.render(c,{caretOffset:a.length+e.length,focused:!0,nodes:s,placeholder:i})},t[17]=b,t[18]=v,t[19]=s,t[20]=r,t[21]=i,t[22]=A):A=t[22];let j=A,M;t[23]!==s||t[24]!==i||t[25]!==n?(M=()=>{f(!0);let e=l.current?.readText()??n;u.current=e,e||l.current?.render(``,{focused:!0,nodes:s,placeholder:i})},t[23]=s,t[24]=i,t[25]=n,t[26]=M):M=t[26];let N=M,P;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{setTimeout(()=>{document.activeElement!==c.current&&(f(!1),m(!1))},nhe)},t[27]=P):P=t[27];let F=P,I;t[28]===k?I=t[29]:(I=e=>{e.preventDefault(),l.current?.insertText(e.clipboardData.getData(`text/plain`))&&k()},t[28]=k,t[29]=I);let L=I,R;t[30]===k?R=t[31]:(R=()=>{l.current?.insertLineBreak()&&k()},t[30]=k,t[31]=R);let z=R,B;t[32]!==s||t[33]!==r||t[34]!==i?(B=e=>{let t=l.current;if(!t)return;let n=t.readText(),a=n.slice(0,e.start)+n.slice(e.end);u.current=a,r?.(a),m(!1),t.render(a,{caretOffset:e.start,focused:!0,nodes:s,placeholder:i})},t[32]=s,t[33]=r,t[34]=i,t[35]=B):B=t[35];let V=B,H;t[36]!==z||t[37]!==a||t[38]!==V?(H=e=>{let t=l.current;if(!t)return;if(a&&e.key===`Enter`){e.preventDefault(),z();return}if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.key===`Backspace`||e.key===`ArrowLeft`,r=e.key===`Delete`||e.key===`ArrowRight`;if(!(n||r))return;let i=t.readCaret();if(!i?.collapsed)return;let o=n?i.badgeBefore:i.badgeAfter;o&&(e.preventDefault(),e.key===`ArrowLeft`?t.setCaretOffset(o.start):e.key===`ArrowRight`?t.setCaretOffset(o.end):V(o))},t[36]=z,t[37]=a,t[38]=V,t[39]=H):H=t[39];let U=H,W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>m(!1),t[40]=W):W=t[40];let G;return t[41]!==C||t[42]!==v||t[43]!==g||t[44]!==j||t[45]!==N||t[46]!==k||t[47]!==U||t[48]!==L||t[49]!==s||t[50]!==p?(G={attachEditor:C,autocompleteFilter:v,autocompletePosition:g,handleBlur:F,handleFocus:N,handleInput:k,handleAutocompleteSelect:j,handleKeyDown:U,handlePaste:L,closeAutocomplete:W,nodes:s,showAutocomplete:p},t[41]=C,t[42]=v,t[43]=g,t[44]=j,t[45]=N,t[46]=k,t[47]=U,t[48]=L,t[49]=s,t[50]=p,t[51]=G):G=t[51],G}var h8=Symbol(`focused`),nhe=200;function g8(e){let t=(0,Z.c)(38),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,fieldType:c,currentNodeId:l,labelledBy:u,ariaLabel:d,required:f,invalid:p}=e,m=n===void 0?``:n,h;t[0]!==r||t[1]!==i||t[2]!==m?(h={value:m,onChange:r,placeholder:i},t[0]=r,t[1]=i,t[2]=m,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=m8(h),O;t[4]===E?O=t[5]:(O=E.find(rhe)?.id,t[4]=E,t[5]=O);let k=O,A=p&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex min-h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=p||void 0,P=p||void 0,F=f||void 0,I=!a,L;t[10]!==d||t[11]!==g||t[12]!==x||t[13]!==S||t[14]!==C||t[15]!==w||t[16]!==T||t[17]!==s||t[18]!==u||t[19]!==I||t[20]!==P||t[21]!==F?(L=(0,X.jsx)(`div`,{"aria-invalid":P,"aria-label":d,"aria-labelledby":u,"aria-required":F,className:`w-full outline-none`,contentEditable:I,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[10]=d,t[11]=g,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=s,t[18]=u,t[19]=I,t[20]=P,t[21]=F,t[22]=L):L=t[22];let R;t[23]!==L||t[24]!==M||t[25]!==N?(R=(0,X.jsx)(`div`,{className:M,"data-invalid":N,children:L}),t[23]=L,t[24]=M,t[25]=N,t[26]=R):R=t[26];let z=l??k??void 0,B;t[27]!==_||t[28]!==v||t[29]!==y||t[30]!==c||t[31]!==b||t[32]!==D||t[33]!==z?(B=(0,X.jsx)(c8,{currentNodeId:z,fieldType:c,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[27]=_,t[28]=v,t[29]=y,t[30]=c,t[31]=b,t[32]=D,t[33]=z,t[34]=B):B=t[34];let V;return t[35]!==R||t[36]!==B?(V=(0,X.jsxs)(X.Fragment,{children:[R,B]}),t[35]=R,t[36]=B,t[37]=V):V=t[37],V}function rhe(e){return e.selected}var ihe=[{label:`North America`,zones:[{value:`America/New_York`,label:`Eastern Time (ET)`},{value:`America/Chicago`,label:`Central Time (CT)`},{value:`America/Denver`,label:`Mountain Time (MT)`},{value:`America/Phoenix`,label:`Arizona Time (MST)`},{value:`America/Los_Angeles`,label:`Pacific Time (PT)`},{value:`America/Anchorage`,label:`Alaska Time (AKT)`},{value:`Pacific/Honolulu`,label:`Hawaii Time (HST)`},{value:`America/Toronto`,label:`Toronto`},{value:`America/Vancouver`,label:`Vancouver`}]},{label:`Europe`,zones:[{value:`Europe/London`,label:`London (GMT/BST)`},{value:`Europe/Paris`,label:`Paris (CET/CEST)`},{value:`Europe/Berlin`,label:`Berlin (CET/CEST)`},{value:`Europe/Rome`,label:`Rome (CET/CEST)`},{value:`Europe/Madrid`,label:`Madrid (CET/CEST)`},{value:`Europe/Amsterdam`,label:`Amsterdam (CET/CEST)`},{value:`Europe/Brussels`,label:`Brussels (CET/CEST)`},{value:`Europe/Stockholm`,label:`Stockholm (CET/CEST)`},{value:`Europe/Warsaw`,label:`Warsaw (CET/CEST)`},{value:`Europe/Athens`,label:`Athens (EET/EEST)`},{value:`Europe/Moscow`,label:`Moscow (MSK)`}]},{label:`Asia`,zones:[{value:`Asia/Dubai`,label:`Dubai (GST)`},{value:`Asia/Kolkata`,label:`India (IST)`},{value:`Asia/Shanghai`,label:`China (CST)`},{value:`Asia/Hong_Kong`,label:`Hong Kong (HKT)`},{value:`Asia/Tokyo`,label:`Tokyo (JST)`},{value:`Asia/Seoul`,label:`Seoul (KST)`},{value:`Asia/Singapore`,label:`Singapore (SGT)`},{value:`Asia/Bangkok`,label:`Bangkok (ICT)`},{value:`Asia/Jakarta`,label:`Jakarta (WIB)`}]},{label:`Australia & Pacific`,zones:[{value:`Australia/Sydney`,label:`Sydney (AEDT/AEST)`},{value:`Australia/Melbourne`,label:`Melbourne (AEDT/AEST)`},{value:`Australia/Brisbane`,label:`Brisbane (AEST)`},{value:`Australia/Perth`,label:`Perth (AWST)`},{value:`Pacific/Auckland`,label:`Auckland (NZDT/NZST)`}]},{label:`South America`,zones:[{value:`America/Sao_Paulo`,label:`São Paulo (BRT)`},{value:`America/Argentina/Buenos_Aires`,label:`Buenos Aires (ART)`},{value:`America/Santiago`,label:`Santiago (CLT)`},{value:`America/Bogota`,label:`Bogotá (COT)`},{value:`America/Lima`,label:`Lima (PET)`}]},{label:`Africa & Middle East`,zones:[{value:`Africa/Cairo`,label:`Cairo (EET)`},{value:`Africa/Johannesburg`,label:`Johannesburg (SAST)`},{value:`Africa/Lagos`,label:`Lagos (WAT)`},{value:`Africa/Nairobi`,label:`Nairobi (EAT)`},{value:`Asia/Jerusalem`,label:`Jerusalem (IST)`}]},{label:`Other`,zones:[{value:`UTC`,label:`UTC (Coordinated Universal Time)`}]}];function ahe(e){let t=(0,Z.c)(11),{value:n,onValueChange:r,disabled:i,id:a}=e,o;t[0]===r?o=t[1]:(o=H6(r),t[0]=r,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(U6,{placeholder:`Select timezone`}),t[2]=s):s=t[2];let c;t[3]===a?c=t[4]:(c=(0,X.jsx)(W6,{className:`w-full`,id:a,children:s}),t[3]=a,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(G6,{children:ihe.map(ohe)}),t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==n?(u=(0,X.jsxs)(V6,{disabled:i,onValueChange:o,value:n,children:[c,l]}),t[6]=i,t[7]=o,t[8]=c,t[9]=n,t[10]=u):u=t[10],u}function ohe(e){return(0,X.jsxs)(Sme,{children:[(0,X.jsx)(Cme,{children:e.label}),e.zones.map(she)]},e.label)}function she(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}var _8=Y.createContext(void 0);function v8(e){let t=Y.useContext(_8);if(t===void 0&&!e)throw Error(Gg(72));return t}var che={...Vq,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},lhe=class extends fq{constructor(e,t,n){let r=new Mq;super(uhe(e,r,t,n),dhe(r),che)}setOpen=(e,t)=>{Eq(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,DH(cH,e))}};function uhe(e,t,n,r=!1){let i={...Pq(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=Fq(t,n,r),i}function dhe(e){return{popupRef:Y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var fhe=rq(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=xq((e,t)=>new lhe({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Oq(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=kq(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Y.useRef(null);Mg(()=>{m&&t&&p.setOpen(!1,DH(wH))},[m,t,p]),Mg(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Mg(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Y.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,DH(TH))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,X.jsxs)(_8.Provider,{value:p,children:[l&&(0,X.jsx)(Sq,{handle:l,store:p}),T&&(0,X.jsx)(phe,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function phe({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=YG(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=KG(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Y.useMemo(()=>Fg(a.reference,i.reference),[a.reference,i.reference]);return Aq(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??a_}),null}var y8=Y.createContext(void 0);function mhe(){return Y.useContext(y8)}var b8=`data-base-ui-tooltip-trigger`;function x8(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(ig(n))return n}}let t=e.target;return ig(t)?t:null}function hhe(e){let t=e;for(;t;){let e=t.closest(`[${b8}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&ig(n.host)?n.host:null}return null}var ghe=iq(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=v8(!0),m=Hq(a)??p;if(!m)throw Error(Gg(82));let h=PH(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Y.useRef(null),b=c??600,x=u??0,{registerTrigger:S,isMountedByThisTrigger:C}=Dq(h,y,m,{payload:o,closeOnClick:l,closeDelay:x}),w=mhe(),{delayRef:T,isInstantPhase:E,hasProvider:D}=MU(v,{open:_}),O=Qq(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=FU(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Y.useRef(!1),F=zH(),I=Y.useRef(void 0);function L(){return D?TU(T.current,`open`)===0?0:c??w??600:b}function R(e){let t=y.current;if(!t||!e)return!1;let n=hhe(e);return n!==null&&n!==t&&mU(t,n)}function z(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let B=tJ(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?vJ():null,restMs:L,delay(){return u==null&&D?{close:TU(T.current,`close`)}:{close:x}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),V=qq(v,{enabled:!A}).reference,H=e=>{let t=P.current,n=x8(e),r=z(n),i=y.current,a=i&&n&&mU(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,DH(lH,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&aU(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,DH(lH,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},U=m.useState(`triggerProps`,C);return o_(`button`,e,{state:{open:_},ref:[t,S,y],props:[B,V,C||M!==`none`?U:void 0,{onMouseOver(e){H(e.nativeEvent)},onFocus(e){R(x8(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,"data-trigger-disabled":A?``:void 0,[b8]:A?void 0:``},f],stateAttributesMapping:nH})}),S8=Y.createContext(void 0);function _he(){let e=Y.useContext(S8);if(e===void 0)throw Error(Gg(70));return e}var vhe=Y.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=SG({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,X.jsxs)(Y.Fragment,{children:[l,c&&Xi.createPortal(n,c)]})}),yhe=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return v8().useState(`mounted`)||n?(0,X.jsx)(S8.Provider,{value:n,children:(0,X.jsx)(vhe,{ref:t,...r})}):null}),C8=Y.createContext(void 0);function w8(){let e=Y.useContext(C8);if(e===void 0)throw Error(Gg(71));return e}var bhe=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=_G,style:g,..._}=e,v=v8(),y=_he(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=g6({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=C6(e,Y.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,X.jsx)(C8.Provider,{value:D,children:O})}),xhe=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=v8(),{side:s,align:c}=w8(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);vq({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),$q(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return o_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[yq,f,S6(d),a],stateAttributesMapping:aH})}),She=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=v8(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=w8();return o_(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:iH})}),Che=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Y.useMemo(()=>({open:t,close:n}),[t,n]);return(0,X.jsx)(y8.Provider,{value:t,children:(0,X.jsx)(jU,{delay:i,timeoutMs:r,children:e.children})})};function T8(e){let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,X.jsx)(Che,{closeDelay:0,"data-slot":`tooltip-provider`,delay:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function E8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(T8,{children:(0,X.jsx)(fhe,{"data-slot":`tooltip`,...n})}),t[2]=n,t[3]=r),r}function D8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(ghe,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function O8(e){let t=(0,Z.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--transform-origin) text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(She,{className:`z-50 size-2.5 rotate-45 rounded-[2px] bg-foreground`}),t[7]=c):c=t[7];let l;t[8]!==n||t[9]!==s?(l=(0,X.jsxs)(xhe,{className:s,"data-slot":`tooltip-content`,children:[n,c]}),t[8]=n,t[9]=s,t[10]=l):l=t[10];let u;return t[11]!==i||t[12]!==o||t[13]!==l?(u=(0,X.jsx)(yhe,{children:(0,X.jsx)(bhe,{sideOffset:o,...i,children:l})}),t[11]=i,t[12]=o,t[13]=l,t[14]=u):u=t[14],u}var whe=[];function k8(e){let t=(0,Z.c)(5),n=yy(),r=wA(Q4),i=wA($4),a;return t[0]!==n||t[1]!==i||t[2]!==e||t[3]!==r?(a=e?t8({targetNodeId:e,nodes:r,edges:i,catalog:n}):whe,t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=a):a=t[4],a}function The(e){let t=(0,Z.c)(40),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,rows:c,fieldType:l,labelledBy:u,required:d,invalid:f}=e,p=n===void 0?``:n,m=c===void 0?3:c,h;t[0]!==r||t[1]!==i||t[2]!==p?(h={value:p,onChange:r,placeholder:i,multiline:!0},t[0]=r,t[1]=i,t[2]=p,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=m8(h),O;t[4]===E?O=t[5]:(O=E.find(Ehe)?.id,t[4]=E,t[5]=O);let k=O,A=f&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=f||void 0,P=`${m*1.5}rem`,F;t[10]===P?F=t[11]:(F={minHeight:P},t[10]=P,t[11]=F);let I=f||void 0,L=d||void 0,R=!a,z;t[12]!==g||t[13]!==x||t[14]!==S||t[15]!==C||t[16]!==w||t[17]!==T||t[18]!==s||t[19]!==u||t[20]!==I||t[21]!==L||t[22]!==R?(z=(0,X.jsx)(`div`,{"aria-invalid":I,"aria-labelledby":u,"aria-required":L,className:`w-full whitespace-pre-wrap break-words outline-none`,contentEditable:R,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[12]=g,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=s,t[19]=u,t[20]=I,t[21]=L,t[22]=R,t[23]=z):z=t[23];let B;t[24]!==F||t[25]!==z||t[26]!==M||t[27]!==N?(B=(0,X.jsx)(`div`,{className:M,"data-invalid":N,style:F,children:z}),t[24]=F,t[25]=z,t[26]=M,t[27]=N,t[28]=B):B=t[28];let V=k||void 0,H;t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==l||t[33]!==b||t[34]!==D||t[35]!==V?(H=(0,X.jsx)(c8,{currentNodeId:V,fieldType:l,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[29]=_,t[30]=v,t[31]=y,t[32]=l,t[33]=b,t[34]=D,t[35]=V,t[36]=H):H=t[36];let U;return t[37]!==B||t[38]!==H?(U=(0,X.jsxs)(X.Fragment,{children:[B,H]}),t[37]=B,t[38]=H,t[39]=U):U=t[39],U}function Ehe(e){return e.selected}function Dhe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=typeof r==`string`?r:``,c;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(g8,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,value:s}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ohe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=n.rows||4,c=typeof r==`string`?r:``,l;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,X.jsx)(The,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,rows:s,value:c}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function khe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.value),t[0]=i,t[1]=o);let s=typeof r==`string`?r:``,c;return t[2]!==a||t[3]!==n.key||t[4]!==n.placeholder||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(wX,{disabled:a,id:n.key,onChange:o,placeholder:n.placeholder,value:s}),t[2]=a,t[3]=n.key,t[4]=n.placeholder,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ahe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=typeof r==`number`||typeof r==`string`?`${r}`:``,s;t[0]===i?s=t[1]:(s=e=>{let t=e.target.value.trim();if(!t){i(void 0);return}let n=Number.parseFloat(t);Number.isFinite(n)&&i(n)},t[0]=i,t[1]=s);let c;return t[2]!==a||t[3]!==o||t[4]!==n.key||t[5]!==n.min||t[6]!==n.placeholder||t[7]!==s?(c=(0,X.jsx)(wX,{disabled:a,id:n.key,min:n.min,onChange:s,placeholder:n.placeholder,type:`number`,value:o}),t[2]=a,t[3]=o,t[4]=n.key,t[5]=n.min,t[6]=n.placeholder,t[7]=s,t[8]=c):c=t[8],c}function jhe(e){let t=(0,Z.c)(15),{field:n,value:r,onChange:i,disabled:a}=e;if(!n.options)return null;let o=typeof r==`string`?r:``,s;t[0]===n.placeholder?s=t[1]:(s=(0,X.jsx)(U6,{placeholder:n.placeholder}),t[0]=n.placeholder,t[1]=s);let c;t[2]!==n.key||t[3]!==s?(c=(0,X.jsx)(W6,{className:`w-full`,id:n.key,children:s}),t[2]=n.key,t[3]=s,t[4]=c):c=t[4];let l;t[5]===n.options?l=t[6]:(l=n.options.map(Mhe),t[5]=n.options,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,X.jsx)(G6,{children:l}),t[7]=l,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==o||t[12]!==c||t[13]!==u?(d=(0,X.jsxs)(V6,{disabled:a,onValueChange:i,value:o,children:[c,u]}),t[9]=a,t[10]=i,t[11]=o,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Mhe(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}var Nhe=0;function A8(){return`kv-${++Nhe}`}function Phe(e){return typeof e!=`object`||!e||!(`name`in e&&`value`in e)?!1:typeof e.name==`string`&&typeof e.value==`string`}function Fhe(e){if(typeof e!=`string`||!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(Phe)}catch{}return[]}function Ihe(e){let t=(0,Z.c)(29),{value:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=()=>Fhe(n).map(Rhe),t[0]=n,t[1]=a);let[o,s]=(0,Y.useState)(a),c;t[2]===r?c=t[3]:(c=function(e){s(e),r(JSON.stringify(e.map(Lhe)))},t[2]=r,t[3]=c);let l=c,u;t[4]!==o||t[5]!==l?(u=function(){l([...o,{name:``,value:``,_id:A8()}])},t[4]=o,t[5]=l,t[6]=u):u=t[6];let d=u,f;t[7]!==o||t[8]!==l?(f=function(e){l(o.filter(t=>t._id!==e))},t[7]=o,t[8]=l,t[9]=f):f=t[9];let p=f,m;t[10]!==o||t[11]!==l?(m=function(e,t,n){l(o.map(r=>r._id===e?{...r,[t]:n}:r))},t[10]=o,t[11]=l,t[12]=m):m=t[12];let h=m,g;if(t[13]!==i||t[14]!==p||t[15]!==o||t[16]!==h){let e;t[18]!==i||t[19]!==p||t[20]!==h?(e=e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(wX,{className:`flex-1`,disabled:i,onChange:t=>h(e._id,`name`,t.target.value),placeholder:`Name`,value:e.name}),(0,X.jsx)(g8,{ariaLabel:`Value`,className:`flex-1`,disabled:i,onChange:t=>h(e._id,`value`,t??``),placeholder:`Value`,value:e.value}),(0,X.jsx)(zv,{className:`size-8 shrink-0`,disabled:i,onClick:()=>p(e._id),size:`icon`,type:`button`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})})]},e._id),t[18]=i,t[19]=p,t[20]=h,t[21]=e):e=t[21],g=o.map(e),t[13]=i,t[14]=p,t[15]=o,t[16]=h,t[17]=g}else g=t[17];let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(cy,{className:`mr-1 size-3.5`}),t[22]=_):_=t[22];let v;t[23]!==d||t[24]!==i?(v=(0,X.jsxs)(zv,{className:`h-8`,disabled:i,onClick:d,size:`sm`,type:`button`,variant:`outline`,children:[_,`Add`]}),t[23]=d,t[24]=i,t[25]=v):v=t[25];let y;return t[26]!==g||t[27]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[g,v]}),t[26]=g,t[27]=v,t[28]=y):y=t[28],y}function Lhe(e){let{name:t,value:n}=e;return{name:t,value:n}}function Rhe(e){return{...e,_id:A8()}}var zhe={"template-input":Dhe,"template-textarea":Ohe,text:khe,number:Ahe,select:jhe,"key-value":Ihe};function j8(e,t,n,r){if(!d0(t,e.showWhen))return null;let i=t[e.key]??e.defaultValue??``,a=zhe[e.type];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.label&&(0,X.jsxs)(TX,{className:`ml-1`,htmlFor:e.key,id:`${e.key}-label`,children:[e.label,e.required&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:`*`})]}),(0,X.jsx)(a,{disabled:r,field:e,onChange:t=>n({[e.key]:t}),value:i})]},e.key)}function Bhe(e){let t=(0,Z.c)(19),{label:n,fields:r,config:i,onUpdateConfig:a,disabled:o,defaultExpanded:s}=e,[c,l]=(0,Y.useState)(s!==void 0&&s),u;t[0]===c?u=t[1]:(u=()=>l(!c),t[0]=c,t[1]=u);let d;t[2]===n?d=t[3]:(d=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:n}),t[2]=n,t[3]=d);let f=`size-3.5 text-muted-foreground transition-transform duration-200 ${c?``:`-rotate-90`}`,p;t[4]===f?p=t[5]:(p=(0,X.jsx)(Jv,{className:f}),t[4]=f,t[5]=p);let m;t[6]!==u||t[7]!==d||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`ml-1 flex items-center gap-1 text-left`,onClick:u,type:`button`,children:[d,p]}),t[6]=u,t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==i||t[11]!==o||t[12]!==r||t[13]!==c||t[14]!==a?(h=c&&(0,X.jsx)(`div`,{className:`ml-1 space-y-4 border-primary/50 border-l-2 py-2 pl-3`,children:r.map(e=>j8(e,i,a,o))}),t[10]=i,t[11]=o,t[12]=r,t[13]=c,t[14]=a,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Vhe(e){let t=(0,Z.c)(11),{fields:n,config:r,onUpdateConfig:i,disabled:a}=e,o;if(t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==i){let e;t[5]!==r||t[6]!==a||t[7]!==i?(e=e=>g4(e)?(0,X.jsx)(Bhe,{config:r,defaultExpanded:e.defaultExpanded,disabled:a,fields:e.fields,label:e.label,onUpdateConfig:i},`group-${e.label}`):j8(e,r,i,a),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],o=n.map(e),t[0]=r,t[1]=a,t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,X.jsx)(X.Fragment,{children:o}),t[9]=o,t[10]=s),s}function Hhe(e,t,n,r,i,a,o,s,c,l=2){let u=CW(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return yW(n.current,u)?void 0:u}var M8=Y.createContext(void 0),N8=Y.createContext(void 0),P8=Y.createContext(void 0),F8=Y.createContext(!1),I8=Y.createContext(``);function L8(){let e=Y.useContext(M8);if(!e)throw Error(Gg(22));return e}function R8(){let e=Y.useContext(N8);if(!e)throw Error(Gg(23));return e}function z8(){let e=Y.useContext(P8);if(!e)throw Error(Gg(24));return e}function B8(){return Y.useContext(I8)}function Uhe(){return Y.useContext(F8)}var V8={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Y3(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>U3(t,e,n)):U3(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function H8(e){return e==null?void 0:`${e}-popup`}function Whe(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function U8(e){return Array.isArray(e)?e.map(e=>U8(e)).join(`,`):e==null?``:String(e)}var W8=new Map;function Ghe(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${U8(e.locale)}|${JSON.stringify(t)}`,r=W8.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=X3(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=X3(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=X3(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return W8.set(n,a),a}var Khe=Ghe;function qhe(e,t=!1){let{overflowY:n}=vg(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var G8=Symbol(`none`),K8={value:G8,index:-1};function Jhe(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u,onItemHighlighted:d,name:f,form:p,disabled:m=!1,readOnly:h=!1,required:g=!1,inputRef:_,grid:v=!1,items:y,filteredItems:b,filter:x,openOnInputClick:S=!0,autoHighlight:C=!1,keepHighlight:w=!1,highlightItemOnHover:T=!0,loopFocus:E=!0,itemToStringLabel:D,itemToStringValue:O,isItemEqualToValue:k=H3,virtualized:A=!1,inline:j=!1,fillInputOnItemPress:M=!0,modal:N=!1,limit:P=-1,autoComplete:F=`list`,formAutoComplete:I,locale:L,submitOnItemClick:R=!1}=e,{clearErrors:z}=e6(),{setDirty:B,validityData:V,setFilled:H,name:U,disabled:W,setTouched:G,setFocused:K,validationMode:q,validation:J}=R3(),ee=d6(),te=V3({id:t}),ne=Khe({locale:L}),[re,ie]=Y.useState(!1),[ae,oe]=Y.useState(null),se=Y.useRef([]),ce=Y.useRef([]),le=Y.useRef(null),ue=Y.useRef(null),de=Y.useRef(null),fe=Y.useRef(null),pe=Y.useRef(null),me=Y.useRef(!0),he=Y.useRef(!1),ge=Y.useRef(null),_e=Y.useRef(null),ve=Y.useRef(null),ye=Y.useRef(K8),be=Y.useRef(null),xe=Y.useRef([]),Se=Y.useRef(null),Ce=W||m,we=U??f,Te=u===`multiple`,Ee=u===`single`,De=s!==void 0||o!==void 0,Oe=y!==void 0,ke=b!==void 0,Ae;Ae=C===`always`?`always`:C?`input-change`:!1;let[je,Me]=A3({controlled:i,default:Te?r??i_:r,name:`Combobox`,state:`selectedValue`}),Ne=Y.useMemo(()=>x===null?()=>!0:x===void 0?Whe(ne,D):x,[x,ne,D]),Pe=Eg(()=>De?o??``:Ee?X3(je,D):``).current,[Fe,Ie]=A3({controlled:s,default:Pe,name:`Combobox`,state:`inputValue`}),[Le,Re]=A3({controlled:c,default:l,name:`Combobox`,state:`open`}),ze=J3(y),Be=ae??String(Fe).trim(),Ve=Ee?X3(je,D):``,He=Ee&&!re&&Be!==``&&Ve.length===Be.length&&ne.contains(Ve,Be),Ue=He?``:Be,We=Oe&&ke&&He,Ge=Y.useMemo(()=>y?ze?y.flatMap(e=>e.items):y:i_,[y,ze]),Ke=Y.useMemo(()=>{if(b&&!We)return b;if(!y)return i_;if(ze){let e=y,t=[],n=0;for(let r of e){if(P>-1&&n>=P)break;let e=P>-1?P-n:1/0,i=Ue===``?r.items.slice(0,e):[];if(Ue!==``)for(let t of r.items){if(i.length>=e)break;Ne(t,Ue,D)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(Ue===``)return P>-1?Ge.slice(0,P):Ge;let e=[];for(let t of Ge){if(P>-1&&e.length>=P)break;Ne(t,Ue,D)&&e.push(t)}return e},[b,We,y,ze,Ue,P,Ne,D,Ge]),qe=Y.useMemo(()=>ze?Ke.flatMap(e=>e.items):Ke,[Ke,ze]),Je=Eg(()=>{let e=null;return j&&Le&&Oe&&u!==`none`&&(e=G3(qe,je,k,Te)),new dq({id:te,labelId:void 0,selectedValue:je,open:Le,items:y,selectionMode:u,listRef:se,labelsRef:ce,popupRef:le,emptyRef:pe,inputRef:ue,startDismissRef:de,endDismissRef:fe,keyboardActiveRef:me,chipsContainerRef:ge,clearRef:_e,valuesRef:xe,pointerDownItemRef:Se,selectionEventRef:ve,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,isItemEqualToValue:k,modal:N,autoHighlight:Ae,submitOnItemClick:R,hasInputValue:De,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:j,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:a_,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`,onOpenChangeComplete:r_,setOpen:r_,setInputValue:r_,setSelectedValue:r_,setIndices:r_,handleSelection:r_,forceMount:r_,requestSubmit:r_})}).current,Ye=u===`none`?Fe:je,Xe=Y.useMemo(()=>u===`none`?Ye:Array.isArray(je)?je.map(e=>Z3(e,O)):Z3(je,O),[Ye,O,u,je]),Ze=kg(d),Qe=kg(n),$e=$(Je,V8.activeIndex),et=$(Je,V8.selectedIndex),tt=$(Je,V8.positionerElement),nt=$(Je,V8.listElement),rt=$(Je,V8.triggerElement),it=$(Je,V8.inputElement),at=$(Je,V8.inputGroupElement),ot=$(Je,V8.inline),st=$(Je,V8.inputInsidePopup),ct=$(Je,V8.inputOwnsFormValue),lt=FU(rt),{mounted:ut,setMounted:dt,transitionStatus:ft}=gq(Le),{openMethod:pt,triggerProps:mt}=sY(Le),ht=kg(()=>Xe);z3(st?lt:ue,te,Ye,ht,!Ce,f);let gt=kg(()=>{y?ce.current=qe.map(e=>X3(e,D)):Je.set(`forceMounted`,!0)}),_t=kg((e,t,n)=>{if(t===-1){if(ye.current===K8)return;ye.current=K8}else ye.current={value:e,index:t};Ze(e,OH(n,void 0,{index:t}))}),vt=kg(e=>{Je.update(e);let t=e.activeIndex;if(t===void 0)return;let n=e.type||`none`;t===null?_t(void 0,-1,n):_t(xe.current[t],t,n)}),yt=kg((t,n)=>{if(he.current=n.reason===hH,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){Le&&ae!==null&&oe(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&ie(!0),be.current={hasQuery:e};let n=Je.state.listElement;if(!Je.state.virtualized&&n){let e=le.current;for(let t of Sg(n.firstElementChild??n)){if(!ag(t)||(e?!mU(e,t):t.getAttribute(`role`)===`dialog`))break;if(qhe(t)){t.scrollTop=0;break}}}e&&Ae&&Je.state.activeIndex==null&&(Le||ot)&&Je.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Je.state.inputInsidePopup&&(be.current={hasQuery:!1,selection:!0});Ie(t)}}),bt=kg((t,n)=>{if(Le!==t&&(n.reason===`escape-key`&&Oe&&qe.length===0&&!pe.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&st&&!ot&&ae!==null&&(ie(!1),oe(null),Fe!==``&&n.reason!==`input-change`&&yt(``,DH(hH,n.event))),!t&&re&&(Ee?(ot||oe(Be),Be===``&&ie(!1)):Te&&(ot||oe(Be),st&&vt({activeIndex:null}),(!st||ot)&&yt(``,DH(hH,n.event)))),Re(t),!t&&st&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(G(!0),K(!1),q===`onBlur`)))){let e=u===`none`?Fe:je;J.commit(e)}}),xt=kg((e,t)=>{a?.(e,t),!t.isCanceled&&(Me(e),(u===`none`&&le.current&&M||Ee&&!Je.state.inputInsidePopup)&&yt(X3(e,D),DH(t.reason,t.event)))}),St=kg((e,t)=>{let n=hU(e),r=ve.current??e;ve.current=null;let i=DH(fH,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&bt(!1,i);return}if(Te){let e=Array.isArray(je)?je:[],n=kpe(e,t,k)?K3(e,t,k):[...e,t];if(xt(n,i),i.isCanceled||!(ue.current&&ue.current.value.trim()!==``))return;Je.state.inputInsidePopup?yt(``,DH(hH,i.event)):bt(!1,i)}else{if(xt(t,i),i.isCanceled)return;bt(!1,i)}}),Ct=kg(()=>{let e=J.inputRef.current?.form??Je.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),wt=kg(()=>{if(dt(!1),Qe?.(!1),ie(!1),oe(null),vt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Te&&ue.current&&ue.current.value!==``&&!he.current&&yt(``,DH(hH)),Ee){if(Je.state.inputInsidePopup)ue.current&&ue.current.value!==``&&yt(``,DH(hH));else{let e=X3(je,D);ue.current&&ue.current.value!==e&&yt(e,DH(e===``?hH:sH))}}}),Tt=Y.useMemo(()=>ot&&tt?{current:tt.closest(`[role="dialog"]`)}:le,[ot,tt]);vq({enabled:!e.actionsRef,open:Le,ref:Tt,onComplete(){Le||wt()}}),Y.useImperativeHandle(e.actionsRef,()=>({unmount:wt}),[wt]),Mg(function(){if(Le||(Se.current=null,u===`none`))return;let e=Oe?Ge:xe.current;vt({selectedIndex:G3(e,je,k,Te)})},[Le,je,u,Te,Oe,Ge,k,vt]),Mg(()=>{y&&(xe.current=qe,se.current.length=qe.length)},[y,qe]),Mg(()=>{let e=be.current;if(e){let t=Le||ot||Je.state.positionerElement?.hidden===!1;if(e.hasQuery)Ae&&t&&Je.set(`activeIndex`,0),be.current=null;else if(String(Fe).trim()===``&&(be.current=null,t)){let t=e.selection;Ae===`always`&&!t&&Je.state.selectionMode===`none`&&Je.set(`activeIndex`,0),queueMicrotask(()=>{if(!Je.state.open&&!Je.state.inline||ue.current&&ue.current.value.trim()!==``)return;let e=Je.state.selectedValue,n=Je.state.selectionMode===`multiple`,r=n&&Array.isArray(e)?e[e.length-1]:e,i=Je.state.selectionMode!==`none`&&r!=null;if(i||t){let t=Oe||ke?qe:xe.current;Je.set(`activeIndex`,i?G3(t,e,Je.state.isItemEqualToValue,n):null)}else Ae===`always`&&Je.set(`activeIndex`,0)})}}if(!Le&&!ot)return;let t=Oe||ke?qe:xe.current,n=Je.state.activeIndex;if(n==null){if(Ae===`always`&&t.length>0){Je.set(`activeIndex`,0);return}_t(void 0,-1,sH);return}if(n>=t.length){_t(void 0,-1,sH),Je.set(`activeIndex`,null);return}let r=t[n],i=ye.current.value,a=i!==G8&&U3(r,i,Je.state.isItemEqualToValue);(ye.current.index!==n||!a)&&_t(r,n,sH)},[$e,Ae,_t,ke,Oe,qe,ot,Le,Je,Fe]),Mg(()=>{if(u===`none`){H(String(Fe)!==``);return}H(Te?Array.isArray(je)&&je.length>0:je!=null)},[H,u,Fe,je,Te]),Y.useEffect(()=>{Oe&&Ae&&qe.length===0&&vt({activeIndex:null})},[Oe,Ae,qe.length,vt]);function Et(e){let t=V.initialValue;return Array.isArray(e)&&Array.isArray(t)?!t6(e,t,(e,t)=>U3(e,t,k)):e!==t}aY(Be,()=>{!Le||Be===``||Be===String(Pe)||ie(!0)});function Dt(){let e=X3(je,D);Fe!==e&&yt(e,DH(sH))}aY(je,()=>{u!==`none`&&(z(we),B(Et(je)),J.change(je),Ee&&!De&&!st&&Dt())}),aY(Fe,()=>{u===`none`&&(z(we),B(Fe!==V.initialValue),J.change(Fe))}),aY(y,()=>{!Ee||De||st||re||Dt()});let Ot=Uq({open:ot?!0:Le,onOpenChange:bt,elements:{reference:st?rt:it,floating:tt}}),kt=v?`grid`:`listbox`,At=Le||ot,jt=At?`true`:`false`,Mt=Y.useMemo(()=>{let e=it?.tagName===`INPUT`,t=it==null||e,n=t||At,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=jt,r[`aria-haspopup`]=kt,r[`aria-controls`]=At?nt?.id:void 0,r[`aria-autocomplete`]=F),{reference:r,floating:{role:`presentation`}}},[it,At,jt,kt,nt?.id,F]),Nt=UG(Ot,{enabled:!h&&!Ce&&S,event:`mousedown-only`,toggle:!1,touchOpenDelay:st?0:100,reason:gH}),Pt=YG(Ot,{enabled:!h&&!Ce&&!ot,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:ot?!0:void 0,outsidePress(e){let t=hU(e);return!mU(rt,t)&&!mU(_e.current,t)&&!mU(ge.current,t)&&!mU(at,t)}}),Ft=lJ(Ot,{enabled:!h&&!Ce,id:te,listRef:se,activeIndex:$e,selectedIndex:et,virtual:!0,loopFocus:E,allowEscape:E&&!Ae,focusItemOnOpen:re||u===`none`&&!Ae?!1:`auto`,focusItemOnHover:T,resetOnPointerLeave:!w,orientation:v?`horizontal`:void 0,rtl:ee===`rtl`,disabledIndices:i_,grid:v?Hhe:void 0,onNavigate(e,t){!t&&!Le||ft===`ending`||vt(t?{activeIndex:e,type:me.current?bH:xH}:{activeIndex:e})}}),It=Y.useMemo(()=>Fg(Ft.reference,{onKeyDown(e){v&&Je.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Pt.reference,Nt.reference,Mt.reference),[Ft.reference,Pt.reference,Nt.reference,Mt.reference,v,Je]),Lt=Y.useMemo(()=>Fg(yq,Pt.floating),[Pt.floating]),Rt=Y.useMemo(()=>Fg(Ft.floating,Mt.floating),[Ft.floating,Mt.floating]),zt=Y.useMemo(()=>{let e=Ft.item;return e?{...e,onFocus:void 0}:a_},[Ft.item]);O3(()=>{Je.update({inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,itemProps:zt,setOpen:bt,setInputValue:yt,setSelectedValue:xt,setIndices:vt,handleSelection:St,forceMount:gt,requestSubmit:Ct,onOpenChangeComplete:Qe})}),Mg(()=>{Je.update({id:te,selectedValue:je,open:Le,mounted:ut,transitionStatus:ft,items:y,inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,openMethod:pt,itemProps:zt,selectionMode:u,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,modal:N,autoHighlight:Ae,isItemEqualToValue:k,submitOnItemClick:R,hasInputValue:De,inputOwnsFormValue:u===`none`&&(j||!Je.state.inputInsidePopup)})},[Je,te,je,Le,ut,ft,y,Lt,Rt,It,zt,pt,mt,u,we,Ce,h,g,v,A,S,D,N,k,R,De,j,Ae,p]);let Bt=Qg(_,J.inputRef),Vt=Y.useMemo(()=>({query:Be,hasItems:Oe,filteredItems:Ke,flatFilteredItems:qe}),[Be,Oe,Ke,qe]),Ht=Y.useMemo(()=>Array.isArray(Ye)?``:Z3(Ye,O),[Ye,O]),Ut=Te&&Array.isArray(je)&&je.length>0,Wt=Te||u===`none`&&ct?void 0:we,Gt=Y.useMemo(()=>!Te||!Array.isArray(je)||!we?null:je.map(e=>{let t=Z3(e,O);return(0,X.jsx)(`input`,{type:`hidden`,form:p,name:we,value:t,disabled:Ce},t)}),[Te,je,p,we,O,Ce]),Kt=(0,X.jsxs)(Y.Fragment,{children:[e.children,(0,X.jsx)(`input`,{...J.getValidationProps(Ce,{onFocus(){if(st){rt?.focus();return}(ue.current||rt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ce||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=DH(sH,e.nativeEvent),i=()=>xe.current.findIndex(e=>Z3(e,O).toLowerCase()===n||X3(e,D).toLowerCase()===n);function a(){if(Te)return;if(u===`none`){yt(t,r);return}let e=i();e===-1&&(e=xe.current.findIndex((e,t)=>{let r=ce.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:xe.current[e];a!=null&&xt?.(a,r)}Ee&&(gt(),y&&i()===-1&&Je.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:te&&Wt==null?`${te}-hidden-input`:void 0,form:p,name:Wt,autoComplete:I,disabled:Ce,required:g&&!Ut,readOnly:h,value:Ht,ref:Bt,style:Wt?UU:HU,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Gt]});return(0,X.jsx)(M8.Provider,{value:Je,children:(0,X.jsx)(N8.Provider,{value:Ot,children:(0,X.jsx)(F8.Provider,{value:Oe,children:(0,X.jsx)(P8.Provider,{value:Vt,children:(0,X.jsx)(I8.Provider,{value:Fe,children:Kt})})})})})}function Yhe(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,X.jsx)(Jhe,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var q8={...rH,...F3,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},Xhe=Y.createContext(void 0);function Zhe(){return Y.useContext(Xhe)}var J8=Y.createContext(void 0);function Y8(e){let t=Y.useContext(J8);if(t===void 0&&!e)throw Error(Gg(21));return t}var X8=Y.forwardRef(function(e,t){let n=L8(),{buttonRef:r,getButtonProps:i}=Xg({native:!1}),a=Qg(t,r);function o(e){n.state.setOpen(!1,DH(pH,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,X.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:UU})});function Z8(e){let t=$(e,V8.mounted),n=$(e,V8.popupSide),r=$(e,V8.positionerElement);return t&&r?n:null}function Q8(){return z8().filteredItems.length===0}function Qhe(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function $he(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function $8(e,t,n){let r=e.state.listRef.current[t];r&&(e.state.selectionEventRef.current=n,r.click(),e.state.selectionEventRef.current=null)}var ege=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:f,validation:p}=R3(),{labelId:m}=B3(),h=Zhe(),g=!!Y8(!0),_=L8(),v=B8(),y=d6(),b=$(_,V8.required),x=$(_,V8.disabled),S=$(_,V8.readOnly),C=$(_,V8.name),w=$(_,V8.form),T=$(_,V8.selectionMode),E=$(_,V8.autoHighlight),D=$(_,V8.inputProps),O=$(_,V8.triggerProps),k=$(_,V8.open),A=$(_,V8.mounted),j=$(_,V8.selectedValue),M=$(_,V8.id),N=$(_,V8.inline),P=$(_,V8.modal),F=!!E,I=Z8(_),L=l||x||i,R=Q8(),z=g||N,B=!z||P,V=PH(a??(z?void 0:M)),H=g?P3:c,[U,W]=Y.useState(null),G=Y.useRef(!1),K=Y.useRef(null),q=Y.useRef(!1),J=T===`none`&&!g,ee=kg(e=>{let t=g||_.state.inline;t&&!_.state.hasInputValue&&_.state.setInputValue(``,DH(sH)),_.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:J})}),te=g?s:p.getValidationProps(L,s);function ne(){_.state.setIndices({activeIndex:null,selectedIndex:null,type:_.state.keyboardActiveRef.current?bH:xH})}function re(){_.state.keyboardActiveRef.current=!1}let ie={...H,open:k,disabled:L,readOnly:S,popupSide:I,listEmpty:R};function ae(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,[i,a]=Qhe(y);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&j.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=$he(n,j.length),ne()),t)}let oe=o_(`input`,e,{state:ie,ref:[t,_.state.inputRef,ee],props:[D,O,{value:U??v,"aria-readonly":S||void 0,"aria-required":b||void 0,"aria-labelledby":m,disabled:L,readOnly:S,required:T===`none`?b:void 0,form:w,...J&&C&&{name:C},id:V,onFocus(){if(d(!0),!N||!q.current)return;q.current=!1;let e=K.current;e==null||!Object.hasOwn(_.state.valuesRef.current,e)||_.state.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=_.state.activeIndex;if(N&&e!==null&&E!==`always`&&(K.current=e,q.current=!0,_.state.setIndices({activeIndex:null})),f===`onBlur`){let e=T===`none`?v:j;p.commit(e)}},onCompositionStart(e){JH||(G.current=!0,W(e.currentTarget.value))},onCompositionEnd(e){G.current=!1;let t=e.currentTarget.value;W(null),_.state.setInputValue(t,DH(mH,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=G.current||!r;function a(e){S||L||!e||!i||(_.state.setOpen(!0,DH(mH,t)),F||ne())}if(G.current){let n=e.currentTarget.value;W(n),n===``&&!_.state.openOnInputClick&&!_.state.inputInsidePopup&&_.state.setOpen(!1,DH(hH,t));let r=n.trim(),i=F&&r!==``;a(r),k&&_.state.activeIndex!==null&&!i&&ne();return}let o=DH(mH,t);if(_.state.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=DH(hH,t);s&&!_.state.inputInsidePopup&&(T===`single`&&_.state.setSelectedValue(null,c),_.state.openOnInputClick||_.state.setOpen(!1,c)),a(e.currentTarget.value.trim()),k&&_.state.activeIndex!==null&&!F&&ne()},onKeyDown(e){if(L||S||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;_.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){tU(e);let n=QH&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){tU(e);let i=QH&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!A&&e.key===`Escape`){let t=T===`multiple`&&Array.isArray(j)?j.length===0:j===null,n=DH(vH,e.nativeEvent),r=T===`multiple`?[]:null;_.state.setInputValue(``,n),_.state.setSelectedValue(r,n),!t&&!_.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(j)&&j.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:j.length-1,r=j.filter((e,t)=>t!==n);ne(),_.state.setSelectedValue(r,DH(sH,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=ae(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&_.state.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&k){let t=_.state.activeIndex,n=e.nativeEvent;if(t===null){if(N)return;_.state.setOpen(!1,DH(sH,n));return}tU(e),$8(_,t,n)}},onPointerMove:re,onPointerDown:re},te],stateAttributesMapping:q8}),se=g?(0,X.jsx)(L3.Provider,{value:I3,children:oe}):oe;return(0,X.jsxs)(Y.Fragment,{children:[k&&B&&(0,X.jsx)(X8,{ref:_.state.startDismissRef}),se]})});function tge(e,t,n,r,i){if(e.baseUIHandlerPrevented||r)return;let a=hU(e.nativeEvent),o=ig(a)?a:null;o!==e.currentTarget&&(i?.(o)||bU(o))||(e.preventDefault(),!n&&(t.state.inputRef.current?.focus(),t.state.openOnInputClick&&t.state.setOpen(!0,DH(gH,e.nativeEvent))))}var nge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=R3(),s=L8(),c=$(s,V8.open),l=$(s,V8.disabled),u=$(s,V8.readOnly),d=$(s,V8.hasSelectedValue),f=$(s,V8.selectionMode),p=Z8(s),m=l,h=Q8(),g=f!==`none`&&!d,_={...o,open:c,disabled:m,readOnly:u,popupSide:p,listEmpty:h,placeholder:g};return o_(`div`,e,{ref:[t,kg(e=>{s.set(`inputGroupElement`,e)})],props:[{role:`group`,onMouseDown(e){tge(e,s,m,u,e=>mU(s.state.chipsContainerRef.current,e))}},a],state:_,stateAttributesMapping:q8})}),rge=Y.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=R3(),{labelId:h}=B3(),g=L8(),_=$(g,V8.selectionMode),v=$(g,V8.disabled),y=$(g,V8.readOnly),b=$(g,V8.required),x=$(g,V8.positionerElement),S=$(g,V8.listElement),C=$(g,V8.popupId),w=$(g,V8.triggerProps),T=$(g,V8.inputInsidePopup),E=$(g,V8.id),D=$(g,V8.labelId),O=$(g,V8.open),k=$(g,V8.selectedValue),A=$(g,V8.activeIndex),j=$(g,V8.selectedIndex),M=$(g,V8.hasSelectedValue),N=R8(),P=B8(),F=zH(),I=u||v||a,L=Q8(),R=Z8(g);V3({id:T?o:void 0});let z=T?o??E:o,B=a6(h,D),V;O&&T?V=C??H8(E):O&&(V=S?.id);let H=Y.useRef(``);function U(e){H.current=e.pointerType}let{reference:W}=uJ(N,{enabled:!O&&!y&&!v&&_===`single`,listRef:g.state.labelsRef,activeIndex:A,selectedIndex:j,onMatch(e){let t=g.state.valuesRef.current[e];t!==void 0&&g.state.setSelectedValue(t,DH(sH))}}),{reference:G}=UG(N,{enabled:!y&&!v,event:`mousedown`}),{buttonRef:K,getButtonProps:q}=Xg({native:i,disabled:I}),J={...l,open:O,disabled:I,popupSide:R,listEmpty:L,placeholder:_!==`none`&&!M};return o_(`button`,e,{ref:[t,K,kg(e=>{g.set(`triggerElement`,e)})],state:J,props:[w,G,W,{id:z,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":O,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":V,"aria-required":T&&b||void 0,"aria-labelledby":B,onPointerDown:U,onPointerEnter:U,onFocus(){f(!0),!(I||y)&&F.start(0,g.state.forceMount)},onBlur(e){if(!mU(x,e.relatedTarget)&&(d(!0),f(!1),p===`onBlur`)){let e=_===`none`?P:k;m.commit(e)}},onMouseDown(e){if(I||y||(T||N.set(`domReferenceElement`,e.currentTarget),g.state.forceMount(),H.current!==`touch`&&(g.state.inputRef.current?.focus(),T||e.preventDefault()),O))return;let t=Jg(e.currentTarget);function n(e){let t=g.state.triggerElement;if(!t)return;let n=hU(e),r=g.state.positionerElement,i=g.state.listElement;mU(t,n)||mU(r,n)||mU(i,n)||s6(e,t)||g.state.setOpen(!1,DH(SH,e))}T&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){y||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(tU(e),g.state.setOpen(!0,DH(yH,e.nativeEvent)),g.state.inputRef.current?.focus())}},m.getValidationProps(I,c),q],stateAttributesMapping:q8})}),e5=Y.createContext(null);function ige(){return Y.useContext(e5)}function age(e){let{children:t,items:n}=e,r=Y.useMemo(()=>({items:n}),[n]);return(0,X.jsx)(e5.Provider,{value:r,children:t})}function t5(e){let{children:t}=e,{filteredItems:n}=z8(),r=ige(),i=r?r.items:n;return(0,X.jsx)(Y.Fragment,{children:i.map(t)})}var oge=Y.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=L8(),l=R8(),u=!!Y8(!0),{filteredItems:d,hasItems:f}=z8(),p=$(c,V8.selectionMode),m=$(c,V8.grid),h=$(c,V8.listProps),g=$(c,V8.virtualized),_=$(c,V8.forceMounted),v=p===`multiple`,y=d.length===0,b=kg(e=>{c.set(`positionerElement`,e)}),x=kg(e=>{c.set(`listElement`,e)}),S=Y.useMemo(()=>typeof o==`function`?n||=(0,X.jsx)(t5,{children:o}):o,[o]),C={empty:y},w=l.useState(`floatingId`),T=o_(`div`,e,{state:C,ref:[t,x,u?null:b],props:[h,{children:S,tabIndex:-1,id:w,role:m?`grid`:`listbox`,"aria-multiselectable":v?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;tU(e),$8(c,t,e.nativeEvent)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});if(g)return T;let E=f&&!_?void 0:c.state.labelsRef;return(0,X.jsx)(l6,{elementsRef:c.state.listRef,labelsRef:E,children:T})}),sge=``;function cge(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function lge(){let e=zH(),t=Y.useRef(null);return Y.useEffect(()=>{if(KH)return;let n=t.current;if(n==null)return;let r=cge(n);if(r==null)return;let i=r.data,a=`${i}${sge}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var n5=Y.createContext(void 0);function uge(){let e=Y.useContext(n5);if(e===void 0)throw Error(Gg(20));return e}var dge=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=L8(),a=$(i,V8.mounted),o=$(i,V8.forceMounted);return a||n||o?(0,X.jsx)(n5.Provider,{value:n,children:(0,X.jsx)(CG,{ref:t,...r})}):null}),fge=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=gG,style:g,..._}=e,v=L8(),y=R8(),b=uge(),x=$(v,V8.modal),S=$(v,V8.open),C=$(v,V8.mounted),w=$(v,V8.openMethod),T=$(v,V8.positionerElement),E=$(v,V8.triggerElement),D=$(v,V8.inputElement),O=$(v,V8.inputGroupElement),k=$(v,V8.inputInsidePopup),A=$(v,V8.transitionStatus),j=Q8(),M=g6({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});w6(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};Mg(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=kg(e=>{v.set(`positionerElement`,e)}),F=C6(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return(0,X.jsxs)(J8.Provider,{value:M,children:[C&&x&&(0,X.jsx)(IJ,{inert:FJ(!S),cutout:O??D??E}),F]})}),pge={...iH,...XV},mge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=L8(),l=Y8(),u=R8(),d=$(c,V8.mounted),f=$(c,V8.open),p=$(c,V8.openMethod),m=$(c,V8.popupProps),h=$(c,V8.transitionStatus),g=$(c,V8.inputInsidePopup),_=$(c,V8.inputElement),v=$(c,V8.modal),y=$(c,V8.id),b=Q8(),x=s.id??(g?H8(y):void 0);Mg(()=>(c.set(`popupId`,c.state.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),vq({open:f,ref:c.state.popupRef,onComplete(){f&&c.state.onOpenChangeComplete(!0)}});let S=o_(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.state.popupRef],props:[m,{id:x,role:g?`dialog`:`presentation`,onFocus(e){let t=hU(e.nativeEvent);p!==`touch`&&(mU(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},S6(h),s],stateAttributesMapping:pge}),C=a===void 0?g?e=>e===`touch`?c.state.popupRef.current:_:!1:a,w;w=o??(g?void 0:!1);let T=!g||v;return(0,X.jsx)(HG,{context:u,disabled:!d,modal:T,openInteractionType:p,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,X.jsxs)(Y.Fragment,{children:[S,T&&(0,X.jsx)(X8,{ref:c.state.endDismissRef})]})})}),r5=Y.createContext(void 0);function hge(){let e=Y.useContext(r5);if(e===void 0)throw Error(Gg(18));return e}var gge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,[s,c]=Y.useState(),l=Y.useMemo(()=>({labelId:s,setLabelId:c,items:a}),[s,c,a]),u=o_(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":s},o]}),d=(0,X.jsx)(r5.Provider,{value:l,children:u});return a?(0,X.jsx)(age,{items:a,children:d}):d}),_ge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=hge(),c=PH(a);return Mg(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),o_(`div`,e,{ref:t,props:[{id:c},o]})}),i5=Y.createContext(void 0);function a5(){let e=Y.useContext(i5);if(!e)throw Error(Gg(19));return e}var vge=Y.createContext(!1);function yge(){return Y.useContext(vge)}function o5(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=Y.useRef(null),m=P6({guess:!0,index:l,textRef:p}),h=L8(),g=yge(),_=Uhe(),v=$(h,V8.selectionMode),y=$(h,V8.disabled),b=$(h,V8.readOnly),x=$(h,V8.isItemEqualToValue),S=y||u,C=v!==`none`,w=l??i??m.index,T=w!==-1,E=$(h,V8.id),D=$(h,V8.isActive,w),O=$(h,V8.isSelected,c),k=$(h,V8.itemProps),A=Y.useRef(null),j=E!=null&&T?`${E}-${w}`:void 0,M=O&&C;Mg(()=>{if(!(T&&(r||l!=null)))return;let e=h.state.listRef.current;return e[w]=A.current,()=>{delete e[w]}},[T,r,w,l,h]),Mg(()=>{if(!T||_)return;let e=h.state.valuesRef.current;return e[w]=c,()=>{delete e[w]}},[T,_,w,c,h]),Mg(()=>{if(!T||_)return;let e=h.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;U3(c,t,x)&&h.set(`selectedIndex`,w)},[T,_,h,w,c,x]);let{getButtonProps:N,buttonRef:P}=Xg({disabled:S,focusableWhenDisabled:!0,native:d,composite:!0}),F={disabled:S,selected:M,highlighted:D};function I(e){function t(){h.state.handleSelection(e,c)}h.state.submitOnItemClick?(Xi.flushSync(t),h.state.requestSubmit()):t()}let L={id:j,role:g?`gridcell`:`option`,"aria-selected":C?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.state.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){S||b||I(e.nativeEvent)},onMouseUp(e){let t=h.state.pointerDownItemRef.current===e.currentTarget;h.state.pointerDownItemRef.current=null,!(S||b||e.button!==0||t||!D)&&I(e.nativeEvent)}},R=o_(`div`,t,{ref:[P,n,m.ref,A],state:F,props:[k,L,f,N]}),z=Y.useMemo(()=>({selected:M,textRef:p}),[M,p]);return(0,X.jsx)(i5.Provider,{value:z,children:R})}function bge(e){let{componentProps:t,forwardedRef:n}=e,r=$(L8(),V8.isItemEqualToValue),{flatFilteredItems:i}=z8(),a=W3(i,t.value??null,r);return(0,X.jsx)(o5,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var xge=Y.memo(Y.forwardRef(function(e,t){let n=$(L8(),V8.virtualized);return n&&e.index==null?(0,X.jsx)(bge,{componentProps:e,forwardedRef:t}):(0,X.jsx)(o5,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),Sge=Y.forwardRef(function(e,t){let{selected:n}=a5();return e.keepMounted||n?(0,X.jsx)(Cge,{...e,ref:t}):null}),Cge=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=a5(),c=Y.useRef(null),{transitionStatus:l,setMounted:u}=gq(s),d=o_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:XV});return vq({open:s,ref:c,onComplete(){s||u(!1)}}),d})),wge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=z8(),c=L8(),l=lge(),u=s.length===0?a:null;return o_(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function s5(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Yhe,{...e}),t[0]=e,t[1]=n),n}function c5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`relative flex w-full items-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nge,{className:i,"data-slot":`combobox-input-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function l5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent py-1 pr-16 pl-3 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ege,{className:i,"data-slot":`combobox-input`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Tge=`flex size-7 items-center justify-center rounded-sm text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`;function u5(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Tge,`absolute right-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Jv,{className:`size-4 opacity-50`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(rge,{className:i,"data-slot":`combobox-trigger`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function d5(e){let t=(0,Z.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,side:a,sideOffset:o,align:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`bottom`:a,l=o===void 0?4:o,u=s===void 0?`start`:s,d;t[7]===r?d=t[8]:(d=Q(`data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in`,r),t[7]=r,t[8]=d);let f;t[9]!==n||t[10]!==i||t[11]!==d?(f=(0,X.jsx)(mge,{className:d,"data-slot":`combobox-content`,...i,children:n}),t[9]=n,t[10]=i,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==c||t[15]!==l||t[16]!==f?(p=(0,X.jsx)(dge,{children:(0,X.jsx)(fge,{align:u,className:`isolate z-50 outline-none`,side:c,sideOffset:l,children:f})}),t[13]=u,t[14]=c,t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function f5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`max-h-64 overflow-y-auto overscroll-contain`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(oge,{className:i,"data-slot":`combobox-list`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function p5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-3 text-muted-foreground text-xs empty:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(wge,{className:i,"data-slot":`combobox-empty`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function m5(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[6]=n,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(Sge,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(qv,{className:`size-4`})}),t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(xge,{className:a,"data-slot":`combobox-item`,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Ege(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(gge,{"data-slot":`combobox-group`,...n}),t[2]=n,t[3]=r),r}function Dge(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-1.5 text-muted-foreground text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(_ge,{className:i,"data-slot":`combobox-group-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Oge=t5;function kge(e){return{path:e,label:`${e} (Unavailable)`,type:`string`,sourceNodeId:``,sourceNodeLabel:`Unavailable`,sourceNodeLabels:[`Unavailable`]}}function Age(e){let t=new Map;for(let n of e){let e=t.get(n.sourceNodeLabel);e?e.push(n):t.set(n.sourceNodeLabel,[n])}return Array.from(t.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({value:e,items:t.toSorted((e,t)=>e.path.localeCompare(t.path))}))}function jge(e,t){let n=e.find(e=>e.path===t),r=Age(e);if(n)return{selected:n,groups:r};let i=kge(t);return{selected:i,groups:[{value:i.sourceNodeLabel,items:[i]},...r]}}function Mge(e,t){let n=t.trim().toLowerCase();return!n||[e.path,e.label,...e.sourceNodeLabels,...e.nullable?[`nullable`]:[]].some(e=>e.toLowerCase().includes(n))}function Nge(e,t){return e.path===t.path}function Pge(e){return e.label}function Fge(e){let t=(0,Z.c)(12),{fields:n,valuePath:r,onValueChange:i,disabled:a}=e,o;t[0]!==n||t[1]!==r?(o=jge(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let{selected:s,groups:c}=o,l;t[3]===i?l=t[4]:(l=e=>{e&&i(e)},t[3]=i,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsxs)(c5,{className:`min-w-[280px]`,children:[(0,X.jsx)(l5,{"aria-label":`Select field`,placeholder:`Select field`}),(0,X.jsx)(u5,{"aria-label":`Show the fields`})]}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(d5,{className:`w-max min-w-(--anchor-width)`,children:[(0,X.jsx)(p5,{children:`No field matches that.`}),(0,X.jsx)(f5,{children:Ige})]}),t[6]=d):d=t[6];let f;return t[7]!==a||t[8]!==c||t[9]!==s||t[10]!==l?(f=(0,X.jsxs)(s5,{disabled:a,filter:Mge,isItemEqualToValue:Nge,items:c,itemToStringLabel:Pge,onValueChange:l,value:s,children:[u,d]}),t[7]=a,t[8]=c,t[9]=s,t[10]=l,t[11]=f):f=t[11],f}function Ige(e){return(0,X.jsxs)(Ege,{items:e.items,children:[(0,X.jsx)(Dge,{children:e.value}),(0,X.jsx)(Oge,{children:t=>(0,X.jsx)(m5,{className:`items-start`,value:t,children:(0,X.jsxs)(`span`,{className:`flex w-full flex-col items-start`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t.label,t.nullable&&(0,X.jsx)(`span`,{className:`rounded bg-muted px-1 py-0.5 font-normal text-xs text-muted-foreground leading-none`,children:`nullable`})]}),t.sourceNodeLabels.length>1&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Also from`,` `,t.sourceNodeLabels.filter(t=>t!==e.value).join(`, `)]})]})},t.path)})]},e.value)}function Lge(e){return e===`within_next`||e===`more_than_from_now`||e===`less_than_ago`||e===`more_than_ago`}function Rge(e){return e===`before`||e===`after`}function zge(e){return e===`equals`||e===`not_equals`||e===`contains`}function Bge(e){return e===`equals`||e===`not_equals`||e===`greater_than`||e===`greater_or_equal`||e===`less_than`||e===`less_or_equal`}function Vge(e){return e===`is_true`||e===`is_false`}function Hge(e){return R2.some(t=>t.value===e)}function Uge(e,t){let n=t?Rde:[];return e===`timestamp`?[...Pde,...n]:e===`string`?[...Fde,...n]:e===`number`?[...Ide,...n]:[...Lde,...n]}function Wge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function Gge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toISOString()}function Kge(e){return L2(e,{groupId:u0(),conditionId:u0()})}function h5(e){return I2(e,u0())}function qge(e){let{condition:t,operatorValue:n}=e;return Lge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,amount:N2(t)?t.amount:1,unit:N2(t)?t.unit:`days`}:Rge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,dateTime:P2(t)?t.dateTime:new Date().toISOString()}:null}function Jge(e){return e===`is_set`||e===`is_not_set`}function Yge(e,t){let n={id:e.id,field:e.field};if(Jge(t))return{...n,fieldType:e.fieldType,operator:t};if(e.fieldType===`timestamp`)return qge({condition:F2(e)?{...n,fieldType:`timestamp`,operator:`within_next`,amount:1,unit:`days`}:e,operatorValue:t});if(e.fieldType===`string`){if(!zge(t))return null;let r=!F2(e)&&`value`in e?e.value:``;return{...n,fieldType:`string`,operator:t,value:r}}if(e.fieldType===`number`){if(!Bge(t))return null;let r=!F2(e)&&`value`in e?e.value:0;return{...n,fieldType:`number`,operator:t,value:r}}return Vge(t)?{...n,fieldType:`boolean`,operator:t}:null}function g5(e){let t=(0,Z.c)(6),{value:n,onChange:r,disabled:i}=e,a;t[0]!==i||t[1]!==r||t[2]!==n?(a=Nde.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{className:`rounded-full px-3 py-1 font-medium text-xs transition-colors ${t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,disabled:i,onClick:()=>r(e.value),type:`button`,children:e.label},e.value)}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`div`,{className:`inline-flex items-center rounded-full border bg-card p-0.5`,children:a}),t[4]=a,t[5]=o),o}function Xge(e){let t=(0,Z.c)(56),{condition:n,disabled:r,currentNodeId:i,enumValues:a,onConditionChange:o}=e;if(F2(n))return null;if(n.fieldType===`timestamp`){if(N2(n)){let e;t[0]!==n||t[1]!==o?(e=e=>{let t=Number.parseInt(e.target.value,10);o({...n,amount:Number.isNaN(t)?1:Math.max(t,1)})},t[0]=n,t[1]=o,t[2]=e):e=t[2];let i;t[3]!==n.amount||t[4]!==r||t[5]!==e?(i=(0,X.jsx)(wX,{className:`w-24`,disabled:r,min:1,onChange:e,type:`number`,value:n.amount}),t[3]=n.amount,t[4]=r,t[5]=e,t[6]=i):i=t[6];let a;t[7]!==n||t[8]!==o?(a=H6(e=>{Hge(e)&&o({...n,unit:e})}),t[7]=n,t[8]=o,t[9]=a):a=t[9];let s;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(W6,{className:`w-36`,children:(0,X.jsx)(U6,{})}),t[10]=s):s=t[10];let c;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(G6,{children:R2.map(Qge)}),t[11]=c):c=t[11];let l;t[12]!==n.unit||t[13]!==r||t[14]!==a?(l=(0,X.jsxs)(V6,{disabled:r,onValueChange:a,value:n.unit,children:[s,c]}),t[12]=n.unit,t[13]=r,t[14]=a,t[15]=l):l=t[15];let u;return t[16]!==i||t[17]!==l?(u=(0,X.jsxs)(X.Fragment,{children:[i,l]}),t[16]=i,t[17]=l,t[18]=u):u=t[18],u}let e;t[19]!==n||t[20]!==o?(e=e=>{P2(n)&&o({...n,dateTime:Gge(e.target.value)})},t[19]=n,t[20]=o,t[21]=e):e=t[21];let i;t[22]===n?i=t[23]:(i=P2(n)?Wge(n.dateTime):``,t[22]=n,t[23]=i);let a;return t[24]!==r||t[25]!==e||t[26]!==i?(a=(0,X.jsx)(wX,{disabled:r,onChange:e,type:`datetime-local`,value:i}),t[24]=r,t[25]=e,t[26]=i,t[27]=a):a=t[27],a}if(n.fieldType===`string`){if(a&&a.length>0&&(n.operator===`equals`||n.operator===`not_equals`)){let e;t[28]!==n||t[29]!==o?(e=H6(e=>{o({...n,value:e})}),t[28]=n,t[29]=o,t[30]=e):e=t[30];let i=a.includes(n.value)?n.value:null,s;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(W6,{className:`min-w-[240px]`,children:(0,X.jsx)(U6,{placeholder:`Select value`})}),t[31]=s):s=t[31];let c;t[32]===a?c=t[33]:(c=a.map(Zge),t[32]=a,t[33]=c);let l;t[34]===c?l=t[35]:(l=(0,X.jsx)(G6,{children:c}),t[34]=c,t[35]=l);let u;return t[36]!==r||t[37]!==e||t[38]!==i||t[39]!==l?(u=(0,X.jsxs)(V6,{disabled:r,onValueChange:e,value:i,children:[s,l]}),t[36]=r,t[37]=e,t[38]=i,t[39]=l,t[40]=u):u=t[40],u}let e;t[41]!==n||t[42]!==o?(e=e=>{o({...n,value:e})},t[41]=n,t[42]=o,t[43]=e):e=t[43];let s;return t[44]!==n.value||t[45]!==i||t[46]!==r||t[47]!==e?(s=(0,X.jsx)(g8,{className:`min-w-[240px]`,currentNodeId:i,disabled:r,onChange:e,placeholder:`value`,value:n.value}),t[44]=n.value,t[45]=i,t[46]=r,t[47]=e,t[48]=s):s=t[48],s}if(n.fieldType===`number`){let e;t[49]!==n||t[50]!==o?(e=e=>{let t=Number.parseFloat(e.target.value);o({...n,value:Number.isNaN(t)?0:t})},t[49]=n,t[50]=o,t[51]=e):e=t[51];let i=String(n.value),a;return t[52]!==r||t[53]!==e||t[54]!==i?(a=(0,X.jsx)(wX,{disabled:r,onChange:e,placeholder:`0`,type:`number`,value:i}),t[52]=r,t[53]=e,t[54]=i,t[55]=a):a=t[55],a}return null}function Zge(e){return(0,X.jsx)(K6,{value:e,children:e},e)}function Qge(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}function _5(e){let t=(0,Z.c)(58),{label:n,description:r,fields:i,emptyFieldsMessage:a,value:o,onChange:s,currentNodeId:c,disabled:l}=e,u=i[0]??null,d;t[0]===i?d=t[1]:(d=new Map(i.map(e_e)),t[0]=i,t[1]=d);let f=d,p,m,h,g,_,v,y;if(t[2]!==i||t[3]!==c||t[4]!==r||t[5]!==l||t[6]!==a||t[7]!==f||t[8]!==n||t[9]!==s||t[10]!==u||t[11]!==o){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=o.trim(),d=e4(e),b=d.valid?d.model:null,x;t[19]===s?x=t[20]:(x=e=>{let t=a4(e);s({model:t4(e),expression:t.valid?t.expression:``})},t[19]=s,t[20]=x);let S=x,C;t[21]!==S||t[22]!==u?(C=()=>{u&&S(Kge(u))},t[21]=S,t[22]=u,t[23]=C):C=t[23];let w=C,T=b?Mde(b,f):null;m=T?a4(T):null;let E=(e,t)=>{T&&S({...T,groups:T.groups.map(n=>n.id===e?t(n):n)})},D=(e,t,n)=>{E(e,e=>({...e,conditions:e.conditions.map(e=>e.id===t?n(e):e)}))},O=e=>{T&&u&&E(e,e=>({...e,conditions:[...e.conditions,h5(u)]}))},k=(e,t)=>{T&&E(e,e=>e.conditions.length<=1?e:{...e,conditions:e.conditions.filter(e=>e.id!==t)})};p=()=>{T&&u&&S({...T,groups:[...T.groups,{id:u0(),logic:`and`,conditions:[h5(u)]}]})};let A=e=>{!T||T.groups.length<=1||S({...T,groups:T.groups.filter(t=>t.id!==e)})};if(!T){let o;t[24]===n?o=t[25]:(o=(0,X.jsx)(TX,{className:`text-sm`,children:n}),t[24]=n,t[25]=o);let s;t[26]===r?s=t[27]:(s=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[26]=r,t[27]=s);let c;t[28]!==w||t[29]!==i.length||t[30]!==l||t[31]!==a?(c=i.length>0?(0,X.jsx)(zv,{disabled:l,onClick:w,size:`sm`,type:`button`,variant:`outline`,children:`Configure condition`}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[28]=w,t[29]=i.length,t[30]=l,t[31]=a,t[32]=c):c=t[32],y=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border bg-muted/30 p-3`,children:[o,s,c,e&&!d.valid&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:d.error})]});break bb0}_=`space-y-3 rounded-md border bg-muted/30 p-3`;let j;t[33]===n?j=t[34]:(j=(0,X.jsx)(TX,{className:`text-sm`,children:n}),t[33]=n,t[34]=j);let M;t[35]===r?M=t[36]:(M=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[35]=r,t[36]=M),t[37]!==M||t[38]!==j?(v=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[j,M]}),t[37]=M,t[38]=j,t[39]=v):v=t[39],h=`space-y-3`,g=T.groups.map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`rounded-lg border bg-card`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-muted px-2 py-1 font-medium text-xs`,children:t+1}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Filter group`}),(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[e.conditions.length,` `,e.conditions.length===1?`condition`:`conditions`]})]}),(0,X.jsx)(zv,{disabled:l||T.groups.length<=1,onClick:()=>A(e.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),(0,X.jsxs)(`div`,{className:`space-y-3 p-3`,children:[e.conditions.map((t,n)=>{let r=f.get(t.field),a=Uge(t.fieldType,r?.nullable),o=e.conditions.length>1;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Fge,{disabled:l||i.length===0,fields:i,onValueChange:n=>{n.path!==t.field&&D(e.id,t.id,e=>I2(n,e.id))},valuePath:t.field}),(0,X.jsxs)(V6,{disabled:l,onValueChange:H6(n=>{let r=Yge(t,n);r&&D(e.id,t.id,()=>r)}),value:t.operator,children:[(0,X.jsx)(W6,{className:`min-w-[190px]`,children:(0,X.jsx)(U6,{placeholder:`Select operator`})}),(0,X.jsx)(G6,{children:a.map($ge)})]}),(0,X.jsx)(Xge,{condition:t,currentNodeId:c,disabled:l,enumValues:r?.enumValues,onConditionChange:n=>{D(e.id,t.id,()=>n)}}),(0,X.jsx)(zv,{disabled:l||!o,onClick:()=>k(e.id,t.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),n<e.conditions.length-1&&(0,X.jsx)(`div`,{className:`py-2 pl-2`,children:(0,X.jsx)(g5,{disabled:l,onChange:t=>{E(e.id,e=>({...e,logic:t}))},value:e.logic})})]},t.id)}),(0,X.jsxs)(zv,{disabled:l||!u,onClick:()=>O(e.id),size:`sm`,type:`button`,variant:`ghost`,children:[(0,X.jsx)(cy,{className:`size-4`}),`Add condition`]})]})]}),t<T.groups.length-1&&(0,X.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,X.jsx)(g5,{disabled:l,onChange:e=>{S({...T,groupLogic:e})},value:T.groupLogic})})]},e.id))}t[2]=i,t[3]=c,t[4]=r,t[5]=l,t[6]=a,t[7]=f,t[8]=n,t[9]=s,t[10]=u,t[11]=o,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y}else p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;t[40]!==h||t[41]!==g?(b=(0,X.jsx)(`div`,{className:h,children:g}),t[40]=h,t[41]=g,t[42]=b):b=t[42];let x=l||!u,S;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(cy,{className:`size-4`}),t[43]=S):S=t[43];let C;t[44]!==p||t[45]!==x?(C=(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsxs)(zv,{disabled:x,onClick:p,size:`sm`,type:`button`,variant:`outline`,children:[S,`Add group`]})}),t[44]=p,t[45]=x,t[46]=C):C=t[46];let w;t[47]===m?w=t[48]:(w=m?.valid===!1&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:m.error}),t[47]=m,t[48]=w);let T;t[49]===m?T=t[50]:(T=m?.valid&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Compiled CEL: `,m.expression]}),t[49]=m,t[50]=T);let E;return t[51]!==C||t[52]!==w||t[53]!==T||t[54]!==_||t[55]!==v||t[56]!==b?(E=(0,X.jsxs)(`div`,{className:_,children:[v,b,C,w,T]}),t[51]=C,t[52]=w,t[53]=T,t[54]=_,t[55]=v,t[56]=b,t[57]=E):E=t[57],E}function $ge(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}function e_e(e){return[e.path,e]}function v5(e){let t=(0,Z.c)(18),{children:n,className:r,title:i,variant:a}=e;if((a===void 0?`box`:a)===`text`){let e;t[0]===r?e=t[1]:(e=Q(`text-warning text-xs`,r),t[0]=r,t[1]=e);let i;return t[2]!==n||t[3]!==e?(i=(0,X.jsx)(`p`,{className:e,children:n}),t[2]=n,t[3]=e,t[4]=i):i=t[4],i}let o;t[5]===r?o=t[6]:(o=Q(`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/10 p-2`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(py,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),t[7]=s):s=t[7];let c;t[8]===i?c=t[9]:(c=i?(0,X.jsx)(`p`,{className:`font-medium text-warning text-xs`,children:i}):null,t[8]=i,t[9]=c);let l;t[10]===n?l=t[11]:(l=(0,X.jsx)(`p`,{className:`text-warning text-xs`,children:n}),t[10]=n,t[11]=l);let u;t[12]!==c||t[13]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;return t[15]!==o||t[16]!==u?(d=(0,X.jsxs)(`div`,{className:o,children:[s,u]}),t[15]=o,t[16]=u,t[17]=d):d=t[17],d}function t_e(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function n_e(e,t){return e.name===t.name}function r_e(e){let t=(0,Z.c)(9),{inputId:n,placeholder:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,X.jsx)(l5,{id:n,placeholder:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(u5,{"aria-label":`Show the Events`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,X.jsxs)(c5,{children:[i,a]}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsxs)(d5,{children:[(0,X.jsx)(p5,{children:`No Event matches that.`}),(0,X.jsx)(f5,{children:i_e})]}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,X.jsxs)(X.Fragment,{children:[o,s]}),t[7]=o,t[8]=c),c}function i_e(e){return(0,X.jsxs)(m5,{value:e,children:[(0,X.jsx)(`span`,{className:`block truncate`,children:e.label}),e.label===e.name?null:(0,X.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.name})]},e.name)}function y5(e){let t=(0,Z.c)(16),{choices:n,value:r,onValueChange:i,disabled:a,inputId:o,placeholder:s}=e,c=s===void 0?`Search Events`:s,l;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>n.find(t=>t.name===e)??[],t[3]=n,t[4]=e),l=r.flatMap(e),t[0]=n,t[1]=r,t[2]=l}else l=t[2];let u=l,d;t[5]===i?d=t[6]:(d=e=>i(e.map(a_e)),t[5]=i,t[6]=d);let f;t[7]!==o||t[8]!==c?(f=(0,X.jsx)(r_e,{inputId:o,placeholder:c}),t[7]=o,t[8]=c,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,X.jsx)(s5,{disabled:a,filter:t_e,isItemEqualToValue:n_e,items:n,itemToStringLabel:o_e,multiple:!0,onValueChange:d,value:u,children:f}),t[10]=n,t[11]=a,t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function a_e(e){return e.name}function o_e(e){return e.label}function s_e(e){let t=(0,Z.c)(30),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=d4(n),s=yy(),c=o.map(c_e),l;t[0]===r?l=t[1]:(l=e=>{r({waitFor:e})},t[0]=r,t[1]=l);let u=l,d;t[2]!==o||t[3]!==u?(d=e=>{u(e.map(e=>o.find(t=>t.event===e)??{event:e}))},t[2]=o,t[3]=u,t[4]=d):d=t[4];let f=d,p;t[5]!==o||t[6]!==u?(p=e=>{u(o.filter(t=>t.event!==e))},t[5]=o,t[6]=u,t[7]=p):p=t[7];let m=p,h;t[8]!==o||t[9]!==u?(h=(e,t)=>{u(o.map(n=>n.event===e?{event:n.event,...t?{match:t}:{}}:n))},t[8]=o,t[9]=u,t[10]=h):h=t[10];let g=h,_;t[11]===a?_=t[12]:(_=(0,X.jsx)(TX,{htmlFor:a,children:`Resume when the event is`}),t[11]=a,t[12]=_);let v;t[13]!==s.events||t[14]!==i||t[15]!==a||t[16]!==c||t[17]!==f?(v=s.events.length>0?(0,X.jsx)(y5,{choices:s.events,disabled:i,inputId:a,onValueChange:f,value:c}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This server declares no Events, so there is nothing for a wait to park on. Ask whoever runs it to declare the Event.`}),t[13]=s.events,t[14]=i,t[15]=a,t[16]=c,t[17]=f,t[18]=v):v=t[18];let y;t[19]!==_||t[20]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==m||t[24]!==o||t[25]!==g?(b=o.length===0?(0,X.jsx)(v5,{children:`Name at least one event. A wait with none cannot be resumed by anything, and the workflow will not save.`}):o.map(e=>(0,X.jsx)(l_e,{disabled:i,onMatchChange:g,onRemove:m,subscription:e},e.event)),t[22]=i,t[23]=m,t[24]=o,t[25]=g,t[26]=b):b=t[26];let x;return t[27]!==y||t[28]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[y,b]}),t[27]=y,t[28]=b,t[29]=x):x=t[29],x}function c_e(e){return e.event}function l_e(e){let t=(0,Z.c)(59),{subscription:n,onMatchChange:r,onRemove:i,disabled:a}=e,o=wA(H4),s=wA(Q4),c=yy(),l;t[0]!==c||t[1]!==n.event?(l=Ny(c,n.event),t[0]=c,t[1]=n.event,t[2]=l):l=t[2];let u=l,d;t[3]===s?d=t[4]:(d=s.filter(f_e).map(d_e).find(u_e),t[3]=s,t[4]=d);let f=d,p;t[5]!==c||t[6]!==n.event?(p=Wme(c,n.event),t[5]=c,t[6]=n.event,t[7]=p):p=t[7];let m=p,h;t[8]!==r||t[9]!==n.event?(h=e=>{r(n.event,e.model)},t[8]=r,t[9]=n.event,t[10]=h):h=t[10];let g=h,_;t[11]!==r||t[12]!==n.event?(_=()=>{r(n.event,``)},t[11]=r,t[12]=n.event,t[13]=_):_=t[13];let v=_,y;t[14]!==f||t[15]!==u?.correlationPath||t[16]!==n.event?(y=()=>f?T1({rules:f,eventName:n.event,declaredPath:u?.correlationPath}):u?.correlationPath,t[14]=f,t[15]=u?.correlationPath,t[16]=n.event,t[17]=y):y=t[17],u?.correlationPath;let b;t[18]===y?b=t[19]:(b=y(),t[18]=y,t[19]=b);let x=b,S;t[20]!==m||t[21]!==r||t[22]!==x||t[23]!==n.event?(S=()=>{let e=m.find(e=>e.path===x)??m[0];e&&r(n.event,t4(L2(e,{groupId:`${n.event}-group`,conditionId:`${n.event}-rule`})))},t[20]=m,t[21]=r,t[22]=x,t[23]=n.event,t[24]=S):S=t[24];let C=S,w;t[25]===u?w=t[26]:(w=u?(0,X.jsx)(`p`,{className:`truncate text-xs`,children:u.label}):null,t[25]=u,t[26]=w);let T;t[27]===n.event?T=t[28]:(T=(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:n.event}),t[27]=n.event,t[28]=T);let E;t[29]===u?E=t[30]:(E=u?null:(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:`This app no longer declares this Event; the workflow will not save until it is removed or declared again.`}),t[29]=u,t[30]=E);let D;t[31]!==n.event||t[32]!==T||t[33]!==E||t[34]!==w?(D=(0,X.jsxs)(`div`,{className:`min-w-0`,title:n.event,children:[w,T,E]}),t[31]=n.event,t[32]=T,t[33]=E,t[34]=w,t[35]=D):D=t[35];let O=`Remove ${n.event}`,k;t[36]!==i||t[37]!==n.event?(k=()=>i(n.event),t[36]=i,t[37]=n.event,t[38]=k):k=t[38];let A;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(hy,{className:`size-3.5`}),t[39]=A):A=t[39];let j;t[40]!==a||t[41]!==O||t[42]!==k?(j=(0,X.jsx)(zv,{"aria-label":O,className:`size-7 shrink-0`,disabled:a,onClick:k,size:`icon`,type:`button`,variant:`ghost`,children:A}),t[40]=a,t[41]=O,t[42]=k,t[43]=j):j=t[43];let M;t[44]!==D||t[45]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[D,j]}),t[44]=D,t[45]=j,t[46]=M):M=t[46];let N;t[47]!==a||t[48]!==m||t[49]!==g||t[50]!==v||t[51]!==C||t[52]!==o||t[53]!==n.event||t[54]!==n.match?(N=n.match?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_5,{currentNodeId:o??void 0,description:`Only an arrival satisfying this resumes the run. Compare a payload field against a literal, or against a value from this run.`,disabled:a,emptyFieldsMessage:`This Event declares no fields, so there is nothing to match on.`,fields:m,label:`Match`,onChange:g,value:n.match}),(0,X.jsxs)(zv,{disabled:a,onClick:v,size:`sm`,type:`button`,variant:`ghost`,children:[`Resume on any `,n.event]})]}):(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Any `,n.event,` resumes this run, whatever it carries.`]}),(0,X.jsx)(zv,{disabled:a||m.length===0,onClick:C,size:`sm`,type:`button`,variant:`outline`,children:`Add a match`})]}),t[47]=a,t[48]=m,t[49]=g,t[50]=v,t[51]=C,t[52]=o,t[53]=n.event,t[54]=n.match,t[55]=N):N=t[55];let P;return t[56]!==M||t[57]!==N?(P=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[M,N]}),t[56]=M,t[57]=N,t[58]=P):P=t[58],P}function u_e(e){return e!==void 0}function d_e(e){return C1(e.data.config)}function f_e(e){return e.data.type===`lifecycle`}function b5(e){let t=(0,Z.c)(5),{logoUrl:n,label:r,fallback:i}=e,a;t[0]===n?a=t[1]:(a=n?.trim(),t[0]=n,t[1]=a);let o=a;if(!o)return i;let s=`${r} logo`,c;return t[2]!==o||t[3]!==s?(c=(0,X.jsx)(`img`,{alt:s,className:`size-4 rounded-sm object-contain`,height:16,loading:`lazy`,src:o,width:16}),t[2]=o,t[3]=s,t[4]=c):c=t[4],c}function p_e(e){let t=(0,Z.c)(15),{config:n,onUpdateConfig:r,disabled:i}=e,a=wA(H4),o=wA(Q4),s=wA($4),c=yy(),l=a??void 0,u;t[0]!==c||t[1]!==s||t[2]!==o||t[3]!==l?(u=o8({currentNodeId:l,nodes:o,edges:s,catalog:c}),t[0]=c,t[1]=s,t[2]=o,t[3]=l,t[4]=u):u=t[4];let d=u,f;t[5]===r?f=t[6]:(f=e=>{r({conditionModel:e.model,condition:e.expression})},t[5]=r,t[6]=f);let p=f,m=a??void 0,h;t[7]===n?h=t[8]:(h=_0(n,`conditionModel`)??``,t[7]=n,t[8]=h);let g;return t[9]!==i||t[10]!==d||t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,X.jsx)(_5,{currentNodeId:m,description:`Build a condition from the Lifecycle Node and upstream action output fields. Timestamp fields support relative and absolute time filters.`,disabled:i,emptyFieldsMessage:`No upstream fields available. Connect this node to the Lifecycle Node or an action with typed outputs first.`,fields:d,label:`Condition`,onChange:p,value:h}),t[9]=i,t[10]=d,t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function m_e(){let e=(0,Z.c)(3),t=k8(wA(H4)),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Splits On Event`}),e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[n,t.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No Event reaches this node yet. Connect it below the Lifecycle Node, and it draws one outlet per Start Event.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ul`,{className:`space-y-1`,children:t.map(h_e)}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A run leaves by the outlet naming the Event it arrived on. An outlet with nothing connected ends the run there.`})]})]}),e[1]=t,e[2]=r),r}function h_e(e){return(0,X.jsxs)(`li`,{className:`text-sm`,children:[e.label,(0,X.jsx)(`span`,{className:`ml-2 text-muted-foreground text-xs`,children:e.name})]},e.name)}function g_e(e){let t=(0,Z.c)(87),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=v0(n,`waitGateMode`,`off`),t[0]=n,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=_0(n,`waitUntil`),t[2]=n,t[3]=s);let c=s,l;t[4]===n?l=t[5]:(l=_0(n,`waitDuration`),t[4]=n,t[5]=l);let u=l,d;t[6]===n?d=t[7]:(d=l4(n),t[6]=n,t[7]=d);let f=d,p;t[8]===n?p=t[9]:(p=_0(n,`waitAllowedHoursMode`),t[8]=n,t[9]=p);let m=p===`daily_window`,h;t[10]!==n||t[11]!==r?(h=e=>{let t={...n,waitDelayTimingMode:e},i=Object.fromEntries(u4(t).map(__e));r({...i,waitDelayTimingMode:e})},t[10]=n,t[11]=r,t[12]=h):h=t[12];let g=h,_;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Time-Based Wait`}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(TX,{htmlFor:`waitDelayTimingMode`,children:`Time input mode`}),t[14]=v):v=t[14];let y;t[15]===g?y=t[16]:(y=H6(g),t[15]=g,t[16]=y);let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(W6,{className:`w-full`,id:`waitDelayTimingMode`,children:(0,X.jsx)(U6,{placeholder:`Select time input mode`})}),t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`duration`,children:`Wait for duration`}),(0,X.jsx)(K6,{value:`until`,children:`Wait until date/time`})]}),t[18]=x):x=t[18];let S;t[19]!==f||t[20]!==i||t[21]!==y?(S=(0,X.jsxs)(V6,{disabled:i,onValueChange:y,value:f,children:[b,x]}),t[19]=f,t[20]=i,t[21]=y,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Pick one mode. Switching modes clears fields that do not apply.`}),t[23]=C):C=t[23];let w;t[24]===S?w=t[25]:(w=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[v,S,C]}),t[24]=S,t[25]=w);let T;t[26]!==n||t[27]!==u||t[28]!==c||t[29]!==f||t[30]!==i||t[31]!==r?(T=f===`duration`?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitDuration`,children:`Wait for (duration)`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitDuration.type,id:`waitDuration`,onChange:e=>r({waitDuration:e}),placeholder:`24h, 90m, 3600000, or P1D`,value:u}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: use `,(0,X.jsx)(`code`,{children:`24h`}),` to continue one day later.`]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitUntil`,children:`Wait until this date/time`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitUntil.type,id:`waitUntil`,onChange:e=>r({waitUntil:e}),placeholder:`2026-03-10T09:00:00-05:00 or {{@lifecycle_1:Lifecycle.appointment.startsAt}}`,value:c}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Use this when timing comes from payload data, like an appointment start time.`})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitOffset`,children:`Send before/after that time (optional)`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitOffset.type,id:`waitOffset`,onChange:e=>r({waitOffset:e}),placeholder:`-1d, 6h, 30m`,value:_0(n,`waitOffset`)}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: `,(0,X.jsx)(`code`,{children:`-1d`}),` sends one day before the target time.`]})]})]}),t[26]=n,t[27]=u,t[28]=c,t[29]=f,t[30]=i,t[31]=r,t[32]=T):T=t[32];let E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(TX,{htmlFor:`waitGateMode`,children:`Continue only if time actually elapsed`}),t[33]=E):E=t[33];let D;t[34]===r?D=t[35]:(D=e=>r({waitGateMode:e}),t[34]=r,t[35]=D);let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(W6,{className:`w-full`,id:`waitGateMode`,children:(0,X.jsx)(U6,{placeholder:`Select behavior`})}),t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`off`,children:`Off (continue immediately)`}),(0,X.jsx)(K6,{value:`require_actual_wait`,children:`Skip branch when already due`})]}),t[37]=k):k=t[37];let A;t[38]!==i||t[39]!==D||t[40]!==o?(A=(0,X.jsxs)(V6,{disabled:i,onValueChange:D,value:o,children:[O,k]}),t[38]=i,t[39]=D,t[40]=o,t[41]=A):A=t[41];let j;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Prevents immediate sends when the computed time is now or in the past after an update/reschedule.`}),t[42]=j):j=t[42];let M;t[43]===A?M=t[44]:(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[E,A,j]}),t[43]=A,t[44]=M);let N;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(TX,{htmlFor:`waitAllowedHoursMode`,children:`Allowed send window`}),t[45]=N):N=t[45];let P;t[46]===r?P=t[47]:(P=e=>r({waitAllowedHoursMode:e}),t[46]=r,t[47]=P);let F;t[48]===n?F=t[49]:(F=v0(n,`waitAllowedHoursMode`,`off`),t[48]=n,t[49]=F);let I;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(W6,{className:`w-full`,id:`waitAllowedHoursMode`,children:(0,X.jsx)(U6,{placeholder:`Select window mode`})}),t[50]=I):I=t[50];let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`off`,children:`Off (allow any time)`}),(0,X.jsx)(K6,{value:`daily_window`,children:`Daily window`})]}),t[51]=L):L=t[51];let R;t[52]!==i||t[53]!==P||t[54]!==F?(R=(0,X.jsxs)(V6,{disabled:i,onValueChange:P,value:F,children:[I,L]}),t[52]=i,t[53]=P,t[54]=F,t[55]=R):R=t[55];let z;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`When enabled, times outside the window shift to the next allowed start.`}),t[56]=z):z=t[56];let B;t[57]===R?B=t[58]:(B=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[N,R,z]}),t[57]=R,t[58]=B);let V;t[59]!==n||t[60]!==i||t[61]!==m||t[62]!==r?(V=m&&(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitAllowedStartTime`,children:`Window start`}),(0,X.jsx)(wX,{disabled:i,id:`waitAllowedStartTime`,onChange:e=>r({waitAllowedStartTime:e.target.value}),placeholder:`09:00`,value:_0(n,`waitAllowedStartTime`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitAllowedEndTime`,children:`Window end`}),(0,X.jsx)(wX,{disabled:i,id:`waitAllowedEndTime`,onChange:e=>r({waitAllowedEndTime:e.target.value}),placeholder:`17:00`,value:_0(n,`waitAllowedEndTime`)})]}),(0,X.jsx)(`p`,{className:`col-span-2 text-muted-foreground text-xs`,children:`Use 24-hour format (HH:MM). Start must be before end. Requires timezone below.`})]}),t[59]=n,t[60]=i,t[61]=m,t[62]=r,t[63]=V):V=t[63];let H=m?` (required for send window)`:` (optional)`,U;t[64]===H?U=t[65]:(U=(0,X.jsxs)(TX,{htmlFor:`waitTimezone`,children:[`Timezone`,H]}),t[64]=H,t[65]=U);let W;t[66]===r?W=t[67]:(W=e=>r({waitTimezone:e}),t[66]=r,t[67]=W);let G;t[68]===n?G=t[69]:(G=v0(n,`waitTimezone`,`UTC`),t[68]=n,t[69]=G);let K;t[70]!==i||t[71]!==W||t[72]!==G?(K=(0,X.jsx)(ahe,{disabled:i,id:`waitTimezone`,onValueChange:W,value:G}),t[70]=i,t[71]=W,t[72]=G,t[73]=K):K=t[73];let q=m&&` Also determines when the daily send window applies.`,J;t[74]===q?J=t[75]:(J=(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Used when the target date/time does not include an offset.`,q]}),t[74]=q,t[75]=J);let ee;t[76]!==U||t[77]!==K||t[78]!==J?(ee=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[U,K,J]}),t[76]=U,t[77]=K,t[78]=J,t[79]=ee):ee=t[79];let te;return t[80]!==w||t[81]!==T||t[82]!==M||t[83]!==B||t[84]!==V||t[85]!==ee?(te=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[_,w,T,M,B,V,ee]}),t[80]=w,t[81]=T,t[82]=M,t[83]=B,t[84]=V,t[85]=ee,t[86]=te):te=t[86],te}function __e(e){return[e,``]}function v_e(e){let t=(0,Z.c)(35),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Wait for Event`}),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=(0,X.jsx)(s_e,{config:n,disabled:i,onUpdateConfig:r}),t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(TX,{htmlFor:`waitTimeout`,children:`Stop waiting after`}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=e=>r({waitTimeout:e}),t[6]=r,t[7]=c);let l;t[8]===n?l=t[9]:(l=_0(n,`waitTimeout`),t[8]=n,t[9]=l);let u;t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitTimeout.type,id:`waitTimeout`,onChange:c,placeholder:`7d`,value:l}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Required. A wait with no end holds a run, and a place in the run list, until somebody notices.`}),t[14]=d):d=t[14];let f;t[15]===u?f=t[16]:(f=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,u,d]}),t[15]=u,t[16]=f);let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(TX,{htmlFor:`waitTimeoutBehavior`,children:`On timeout`}),t[17]=p):p=t[17];let m;t[18]===r?m=t[19]:(m=e=>r({waitTimeoutBehavior:e}),t[18]=r,t[19]=m);let h;t[20]===n?h=t[21]:(h=v0(n,`waitTimeoutBehavior`,`continue`),t[20]=n,t[21]=h);let g;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(W6,{className:`w-full`,id:`waitTimeoutBehavior`,children:(0,X.jsx)(U6,{placeholder:`Select timeout behavior`})}),t[22]=g):g=t[22];let _;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`continue`,children:`Continue workflow`}),(0,X.jsx)(K6,{value:`skip`,children:`Skip remaining branch`})]}),t[23]=_):_=t[23];let v;t[24]!==i||t[25]!==m||t[26]!==h?(v=(0,X.jsxs)(V6,{disabled:i,onValueChange:m,value:h,children:[g,_]}),t[24]=i,t[25]=m,t[26]=h,t[27]=v):v=t[27];let y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Choose whether to continue downstream nodes or halt the branch when the timeout expires.`}),t[28]=y):y=t[28];let b;t[29]===v?b=t[30]:(b=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,v,y]}),t[29]=v,t[30]=b);let x;return t[31]!==b||t[32]!==o||t[33]!==f?(x=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[a,o,f,b]}),t[31]=b,t[32]=o,t[33]=f,t[34]=x):x=t[34],x}function y_e(e){let t=(0,Z.c)(31),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=v0(n,`waitMode`,`delay`),t[0]=n,t[1]=a);let o=a,s;t[2]!==n||t[3]!==r?(s=e=>{let t={...n,waitMode:e},i=Object.fromEntries(u4(t).map(b_e));r({...i,waitMode:e,...e===`event`&&!(_0(n,`waitTimeout`)??``).trim()?{waitTimeout:`7d`}:{}})},t[2]=n,t[3]=r,t[4]=s):s=t[4];let c=s,l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(TX,{htmlFor:`waitMode`,children:`How should this step wait?`}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=H6(c),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(W6,{className:`w-full`,id:`waitMode`,children:(0,X.jsx)(U6,{placeholder:`Select wait mode`})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`delay`,children:`Wait for time`}),(0,X.jsx)(K6,{value:`event`,children:`Wait for an event`})]}),t[9]=f):f=t[9];let p;t[10]!==i||t[11]!==u||t[12]!==o?(p=(0,X.jsxs)(V6,{disabled:i,onValueChange:u,value:o,children:[d,f]}),t[10]=i,t[11]=u,t[12]=o,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Resume on a clock, or when an event arrives that this step's match accepts.`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[l,p,m]}),t[15]=p,t[16]=h);let g;t[17]!==n||t[18]!==i||t[19]!==r||t[20]!==o?(g=o===`delay`&&(0,X.jsx)(g_e,{config:n,disabled:i,onUpdateConfig:r}),t[17]=n,t[18]=i,t[19]=r,t[20]=o,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==i||t[24]!==r||t[25]!==o?(_=o===`event`&&(0,X.jsx)(v_e,{config:n,disabled:i,onUpdateConfig:r}),t[22]=n,t[23]=i,t[24]=r,t[25]=o,t[26]=_):_=t[26];let v;return t[27]!==g||t[28]!==_||t[29]!==h?(v=(0,X.jsxs)(X.Fragment,{children:[h,g,_]}),t[27]=g,t[28]=_,t[29]=h,t[30]=v):v=t[30],v}function b_e(e){return[e,``]}function x_e(e){let t=(0,Z.c)(9),{actionType:n,config:r,onUpdateConfig:i,disabled:a}=e;switch(n){case b1.condition:{let e;return t[0]!==r||t[1]!==a||t[2]!==i?(e=(0,X.jsx)(p_e,{config:r,disabled:a,onUpdateConfig:i}),t[0]=r,t[1]=a,t[2]=i,t[3]=e):e=t[3],e}case b1.eventSplit:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(m_e,{}),t[4]=e):e=t[4],e}case b1.wait:{let e;return t[5]!==r||t[6]!==a||t[7]!==i?(e=(0,X.jsx)(y_e,{config:r,disabled:a,onUpdateConfig:i}),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],e}default:return null}}function S_e(){let e=(0,Z.c)(2),t=yy(),n;if(e[0]!==t){let r=yne(t);n=Object.fromEntries(Object.entries(r).map(C_e)),e[0]=t,e[1]=n}else n=e[1];return n}function C_e(e){let[t,n]=e;return[t,n.map(w_e)]}function w_e(e){return{id:e.id,label:e.label,logoUrl:e.logoUrl,integration:e.integration}}function T_e(e,t){return Py(e,t)?.category??null}function E_e(e){let t=(0,Z.c)(81),{config:n,onUpdateConfig:r,disabled:i,isOwner:a}=e,o=a===void 0||a,s=yy(),c=_0(n,`actionType`),l=S_e(),u;t[0]===l?u=t[1]:(u=Object.keys(l).filter(k_e).toSorted(),t[0]=l,t[1]=u);let d=u,f=c&&T_e(s,c)||``,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=i0(),t[2]=p):p=t[2];let{data:m}=Xe(p),h;t[3]===m?h=t[4]:(h=m===void 0?[]:m,t[3]=m,t[4]=h);let g=h,{push:_}=RY(),v;t[5]!==l||t[6]!==r?(v=e=>{let t=l[e]?.[0];t&&r({actionType:t.id})},t[5]=l,t[6]=r,t[7]=v):v=t[7];let y=v,b;t[8]===r?b=t[9]:(b=e=>{r({actionType:e})},t[8]=r,t[9]=b);let x=b,S=c?Py(s,c):void 0,C=S?.integration,w;if(t[10]!==g||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>e.type===C,t[13]=C,t[14]=e),w=g.some(e),t[10]=g,t[11]=C,t[12]=w}else w=t[12];let T=w,E;t[15]!==C||t[16]!==r||t[17]!==_?(E=()=>{C&&_(C3,{type:C,onSuccess:e=>{r({integrationId:e})}})},t[15]=C,t[16]=r,t[17]=_,t[18]=E):E=t[18];let D=E,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(TX,{className:`ml-1`,htmlFor:`actionCategory`,children:`Service`}),t[19]=O):O=t[19];let k;t[20]===y?k=t[21]:(k=H6(y),t[20]=y,t[21]=k);let A=f||void 0,j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(W6,{className:`w-full`,id:`actionCategory`,children:(0,X.jsx)(U6,{placeholder:`Select category`})}),t[22]=j):j=t[22];let M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(K6,{value:`System`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(dy,{className:`size-4`}),(0,X.jsx)(`span`,{children:`System`})]})}),t[23]=M):M=t[23];let N;t[24]===d.length?N=t[25]:(N=d.length>0&&(0,X.jsx)(wme,{}),t[24]=d.length,t[25]=N);let P;if(t[26]!==l||t[27]!==d){let e;t[29]===l?e=t[30]:(e=e=>{let t=l[e],n=t?.[0]?.integration,r=t?.map(O_e).find(D_e);return(0,X.jsx)(K6,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b5,{fallback:n?(0,X.jsx)(b3,{className:`size-4`,integration:n}):(0,X.jsx)(gy,{className:`size-4`}),label:e,logoUrl:r}),(0,X.jsx)(`span`,{children:e})]})},e)},t[29]=l,t[30]=e),P=d.map(e),t[26]=l,t[27]=d,t[28]=P}else P=t[28];let F;t[31]!==N||t[32]!==P?(F=(0,X.jsxs)(G6,{children:[M,N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let I;t[34]!==i||t[35]!==k||t[36]!==A||t[37]!==F?(I=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[O,(0,X.jsxs)(V6,{disabled:i,onValueChange:k,value:A,children:[j,F]})]}),t[34]=i,t[35]=k,t[36]=A,t[37]=F,t[38]=I):I=t[38];let L;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(TX,{className:`ml-1`,htmlFor:`actionType`,children:`Action`}),t[39]=L):L=t[39];let R=i||!f,z;t[40]===x?z=t[41]:(z=H6(x),t[40]=x,t[41]=z);let B=c||void 0,V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsx)(W6,{className:`w-full`,id:`actionType`,children:(0,X.jsx)(U6,{placeholder:`Select action`})}),t[42]=V):V=t[42];let H;t[43]!==l||t[44]!==f?(H=f&&l[f]?.map(e=>{let t;return t=f===`System`?(0,X.jsx)(dy,{className:`size-4`}):e.integration?(0,X.jsx)(b3,{className:`size-4`,integration:e.integration}):(0,X.jsx)(gy,{className:`size-4`}),(0,X.jsx)(K6,{value:e.id,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b5,{fallback:t,label:e.label,logoUrl:e.logoUrl}),(0,X.jsx)(`span`,{children:e.label})]})},e.id)}),t[43]=l,t[44]=f,t[45]=H):H=t[45];let U;t[46]===H?U=t[47]:(U=(0,X.jsx)(G6,{children:H}),t[46]=H,t[47]=U);let W;t[48]!==R||t[49]!==z||t[50]!==B||t[51]!==U?(W=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[L,(0,X.jsxs)(V6,{disabled:R,onValueChange:z,value:B,children:[V,U]})]}),t[48]=R,t[49]=z,t[50]=B,t[51]=U,t[52]=W):W=t[52];let G;t[53]!==I||t[54]!==W?(G=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[I,W]}),t[53]=I,t[54]=W,t[55]=G):G=t[55];let K;t[56]!==n||t[57]!==i||t[58]!==T||t[59]!==C||t[60]!==o||t[61]!==r||t[62]!==D?(K=C&&o&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`ml-1 flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(TX,{children:`Connection`}),(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[(0,X.jsx)(D8,{render:(0,X.jsx)(`span`,{className:`inline-flex`,children:(0,X.jsx)(Zv,{className:`size-3.5 text-muted-foreground`})}),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Connection help`})}),(0,X.jsx)(O8,{children:(0,X.jsx)(`p`,{children:`API key or OAuth credentials for this service`})})]})})]}),T&&(0,X.jsx)(zv,{"aria-label":`Add connection`,className:`size-6`,disabled:i,onClick:D,size:`icon`,variant:`ghost`,children:(0,X.jsx)(cy,{className:`size-4`})})]}),(0,X.jsx)(wpe,{disabled:i,integrationType:C,onChange:e=>r({integrationId:e}),value:_0(n,`integrationId`)})]}),t[56]=n,t[57]=i,t[58]=T,t[59]=C,t[60]=o,t[61]=r,t[62]=D,t[63]=K):K=t[63];let q;t[64]===n?q=t[65]:(q=_0(n,`actionType`)??``,t[64]=n,t[65]=q);let J;t[66]!==n||t[67]!==i||t[68]!==r||t[69]!==q?(J=(0,X.jsx)(x_e,{actionType:q,config:n,disabled:i,onUpdateConfig:r}),t[66]=n,t[67]=i,t[68]=r,t[69]=q,t[70]=J):J=t[70];let ee;t[71]!==S||t[72]!==n||t[73]!==i||t[74]!==r?(ee=S&&S.configFields.length>0&&(0,X.jsx)(Vhe,{config:n,disabled:i,fields:S.configFields,onUpdateConfig:r}),t[71]=S,t[72]=n,t[73]=i,t[74]=r,t[75]=ee):ee=t[75];let te;return t[76]!==G||t[77]!==K||t[78]!==J||t[79]!==ee?(te=(0,X.jsxs)(X.Fragment,{children:[G,K,J,ee]}),t[76]=G,t[77]=K,t[78]=J,t[79]=ee,t[80]=te):te=t[80],te}function D_e(e){return typeof e==`string`&&e.trim().length>0}function O_e(e){return e.logoUrl}function k_e(e){return e!==`System`}var x5=Y.createContext(void 0);function S5(e){let t=Y.useContext(x5);if(t===void 0&&!e)throw Error(Gg(33));return t}var C5=Y.createContext(void 0);function w5(e){let t=Y.useContext(C5);if(t===void 0&&!e)throw Error(Gg(36));return t}var A_e=Y.createContext(void 0);function T5(e=!0){let t=Y.useContext(A_e);if(t===void 0&&!e)throw Error(Gg(25));return t}function j_e(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=T5(!0),f=d!==void 0;return Y.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:fH})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!YH&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&Yg(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var E5={type:`regular-item`};function D5(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Y.useRef(null),{getButtonProps:d,buttonRef:f}=Xg({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=j_e({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Y.useCallback(e=>Fg(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Qg(u,f);return Y.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var O5=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),k5={checked(e){return e?{[O5.checked]:``}:{[O5.unchecked]:``}},...XV},M_e=Y.createContext(void 0),N_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=P6({guess:!0,label:a}),f=S5(!0),p=PH(i),{store:m}=w5(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=D5({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:E5});return o_(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),A5=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=w5(),{side:c,align:l}=S5(),u=D6(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;vq({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Y.useEffect(()=>{function e(e){s.setOpen(!1,DH(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),$q(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=o_(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:aH,props:[p,{onKeyDown(e){u&&TJ.has(e.key)&&e.stopPropagation()}},S6(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,X.jsx)(HG,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),j5=Y.createContext(void 0);function P_e(){let e=Y.useContext(j5);if(e===void 0)throw Error(Gg(32));return e}var M5=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=w5();return i.useState(`mounted`)||n?(0,X.jsx)(j5.Provider,{value:n,children:(0,X.jsx)(CG,{ref:t,...r})}):null}),N5=Y.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=gG,style:g,..._}=e,{store:v}=w5(),y=P_e(),b=T5(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Y.useRef(null),R=_q(A),z=n,B=c,V=l,H=s,U=h;x.type===`context-menu`&&(z=n??x.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let W=o,G=H;x.type===`menu`?(W??=`inline-end`,G??=`start`,U=e.collisionAvoidance??_G):x.type===`menubar`&&(W??=x.context.orientation===`vertical`?`inline-end`:`bottom`,G??=`start`);let K=x.type===`context-menu`,q=g6({anchor:z,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:W,sideOffset:B,align:G,alignOffset:V,arrowPadding:K?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:U,shift:K?{crossAxis:!(`side`in U&&U.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Y.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,DH(CH)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Y.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,DH(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let J=zH();Y.useEffect(()=>{T||J.clear()},[T,J]),Y.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?J.isStarted()||J.start(e,()=>{v.setOpen(!1,DH(CH))}):v.setOpen(!1,DH(CH))}else J.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,J]),Y.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Mg(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let ee={open:T,side:q.side,align:q.align,anchorHidden:q.anchorHidden,nested:x.type===`menu`,instant:j},te=x.type===`menubar`&&x.context.modal;w6(T&&(te||E&&N!==`trigger-hover`),D===`touch`,A,O);let ne=C6(e,ee,{styles:q.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),re=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),ie=null;return x.type===`menubar`?ie=x.context.contentElement:x.type===void 0&&(ie=O),(0,X.jsxs)(x5.Provider,{value:q,children:[re&&(0,X.jsx)(IJ,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:FJ(!T),cutout:ie}),(0,X.jsx)(jG,{id:P,children:(0,X.jsx)(l6,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:ne})})]})}),P5=Y.createContext(void 0);function F_e(){let e=Y.useContext(P5);if(e===void 0)throw Error(Gg(34));return e}var I_e=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Y.useState(void 0),[p,m]=A3({controlled:i,default:a,name:`MenuRadioGroup`}),h=kg((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=o_(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Y.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,X.jsx)(M_e.Provider,{value:f,children:(0,X.jsx)(P5.Provider,{value:_,children:g})})})),F5=Y.createContext(void 0);function L_e(){let e=Y.useContext(F5);if(e===void 0)throw Error(Gg(35));return e}var R_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=P6({guess:!0,label:a}),p=S5(!0),m=PH(i),{store:h}=w5(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=F_e(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=D5({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:E5}),E=Y.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=DH(fH,e.nativeEvent,void 0,{preventUnmountOnClose:r_});y(l,t)}let O=o_(`div`,e,{state:E,stateAttributesMapping:k5,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,X.jsx)(F5.Provider,{value:E,children:O})}),z_e=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=L_e(),c=Y.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=gq(s.checked);return vq({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),o_(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:k5,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),B_e=Y.createContext(null);function I5(e){let t=Y.useContext(B_e);if(t===null&&!e)throw Error(Gg(5));return t}var V_e={...Vq,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},H_e=class extends fq{constructor(e){super({...W_e(),...e},U_e(),V_e),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function U_e(){return{positionerRef:Y.createRef(),popupRef:Y.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Y.createRef(),beforeContentFocusGuardRef:Y.createRef(),onOpenChangeComplete:void 0,triggerElements:new Mq}}function W_e(){return{...Pq(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new TG,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:a_,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var L5=Y.createContext(void 0);function R5(){return Y.useContext(L5)}var z5=rq(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=T5(!0),_=w5(!0),v=I5(!0),y=R5(),b=Y.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=G_e({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});x.useControlledProp(`openProp`,n),x.useControlledProp(`triggerIdProp`,p),x.useContextCallback(`onOpenChangeComplete`,i);let S=NH(),C=NH(),w=x.useState(`floatingTreeRoot`),T=AG(w),E=OG(),D=x.useState(`open`),O=x.useState(`activeTriggerElement`),k=x.useState(`positionerElement`),A=x.useState(`hoverEnabled`),j=x.useState(`disabled`),M=x.useState(`lastOpenChangeReason`),N=x.useState(`parent`),P=x.useState(`activeIndex`),F=x.useState(`payload`),I=x.useState(`floatingParentNodeId`),L=Y.useRef(null),R=Y.useRef(N.type!==`context-menu`),z=zH(),B=Y.useRef(!0),V=zH(),H=I!=null,{openMethod:U,triggerProps:W}=sY(D);x.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:N.type===void 0?s:void 0,openMethod:U,rootId:S}),Oq(x);let{forceUnmount:G}=kq(D,x,()=>{x.set(`allowMouseEnter`,!1)});Mg(()=>{g&&!_?x.update({parent:{type:`context-menu`,context:g},floatingNodeId:T,floatingParentNodeId:E}):_&&x.update({floatingNodeId:T,floatingParentNodeId:E})},[g,_,T,E,x]),Y.useEffect(()=>{if(D||(L.current=null),N.type===`context-menu`){if(!D){z.clear(),R.current=!1;return}z.start(500,()=>{R.current=!0})}},[z,D,N.type]),Mg(()=>{!D&&!A&&x.set(`hoverEnabled`,!0)},[D,A,x]);let K=kg((e,t)=>{let n=t.reason;if(!e&&!x.select(`open`)||D===e&&t.trigger===O&&M===n)return;let i=Tq(t);if(!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled)return;x.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!B.current)return;e&&n===`trigger-focus`?(B.current=!1,V.start(300,()=>{B.current=!0})):(B.current=!0,V.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};L.current=t.event,wq(c,e,t.trigger,i()),x.update(c),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?x.set(`instantType`,`group`):o||s?x.set(`instantType`,o?`click`:`dismiss`):x.set(`instantType`,void 0)}),q=hq({popupStore:x,floatingId:C,nested:E!=null,onOpenChange:K}),J=q.context.events;Mg(()=>{let e=({open:e,eventDetails:t})=>K(e,t);return J.on(`setOpen`,e),()=>{J?.off(`setOpen`,e)}},[J,K]);let ee=Y.useCallback(()=>{x.setOpen(!1,DH(TH))},[x]);Y.useImperativeHandle(u,()=>({unmount:G,close:ee}),[G,ee]);let te;N.type===`context-menu`&&(te=N.context),Y.useImperativeHandle(te?.positionerRef,()=>k,[k]),Y.useImperativeHandle(te?.actionsRef,()=>({setOpen:K}),[K]);let ne=YG(q,{enabled:!j,bubbles:{escapeKey:d&&N.type===`menu`},outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`||R.current},externalTree:H?w:void 0}),re=d6(),ie=Y.useCallback(e=>{x.select(`activeIndex`)!==e&&x.set(`activeIndex`,e)},[x]),ae=lJ(q,{enabled:!j,listRef:x.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:c,orientation:l,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:re===`rtl`,disabledIndices:i_,onNavigate:ie,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:H?w:void 0,focusItemOnHover:h}),oe=Y.useCallback(e=>{x.context.typingRef.current=e},[x]),se=uJ(q,{enabled:!j,listRef:x.context.itemLabels,elementsRef:x.context.itemDomElements,activeIndex:P,resetMs:500,onMatch:e=>{D&&e!==P&&x.set(`activeIndex`,e)},onTyping:oe});Aq(x,{floatingRootContext:q,activeTriggerProps:Y.useMemo(()=>{let e=Fg(se.reference,ae.reference,ne.reference,{onMouseMove(){x.set(`allowMouseEnter`,!0)}},W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=D,e},[x,se.reference,ae.reference,ne.reference,W,D]),inactiveTriggerProps:Y.useMemo(()=>{let e=Fg(ae.trigger,ne.trigger,W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ae.trigger,ne.trigger,W]),popupProps:Y.useMemo(()=>Fg(yq,{id:C,role:`menu`,"aria-labelledby":O?.id,onMouseMove(){x.set(`allowMouseEnter`,!0),N.type===`menu`&&x.set(`hoverEnabled`,!1)},onClick(){x.select(`hoverEnabled`)&&x.set(`hoverEnabled`,!1)},onKeyDown(e){let t=x.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},se.floating,ae.floating,ne.floating),[O,C,N.type,x,se.floating,ae.floating,ne.floating]),itemProps:ae.item??a_});let ce=Y.useMemo(()=>({store:x,parent:b}),[x,b]),le=(0,X.jsxs)(C5.Provider,{value:ce,children:[f&&(0,X.jsx)(Sq,{handle:f,store:x}),typeof t==`function`?t({payload:F}):t]});return N.type===void 0||N.type===`context-menu`?(0,X.jsx)(MG,{externalTree:w,children:le}):le});function G_e(e){return Eg(()=>new H_e(e)).current}function K_e(e){let t=w5().store,n=Y.useMemo(()=>({parentMenu:t}),[t]);return(0,X.jsx)(L5.Provider,{value:n,children:(0,X.jsx)(z5,{...e})})}function q_e(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=qg(),{ref:i,index:a}=P6(e),o=n===a,s=Y.useRef(null),c=Qg(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function B5(e){let{render:t,className:n,style:r,state:i=a_,props:a=i_,refs:o=i_,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=q_e({metadata:s});return o_(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function V5(e){if(ag(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!_g(e))return V5(bg(e))}function J_e(e,t){let n=Y.useRef(null);function r(t){Xi.flushSync(()=>{e.setOpen(!1,DH(_H,t.nativeEvent,t.currentTarget))}),JW(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&YW(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Xi.flushSync(()=>{e.setOpen(!1,DH(_H,n.nativeEvent,n.currentTarget))});let i=qW(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&mU(r,i);){let e=i;if(i=WW(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Y_e(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Y.useRef(!1);return Y.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Jg(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:a_,[t,n,r])}var X_e=iq(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=w5(!0),h=Hq(d)??m?.store;if(!h)throw Error(Gg(85));let g=PH(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Y.useRef(null),S=Q_e(),C=qg(!0),w=kG(),T=Y.useMemo(()=>w??new TG,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Dq(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:AG(T),floatingParentNodeId:OG(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Xg({disabled:A,native:o});Y.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Y.useRef(null),P=zH(),F=kg(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;mU(N.current,t)||mU(h.select(`positionerElement`),t)||t===N.current||(t==null||V5(t)!==h.select(`rootId`))&&(s6(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:SH}))});Y.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&Jg(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=tJ(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:vJ({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=Z_e(y,h.select(`lastOpenChangeReason`)),z=UG(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=qq(v,{enabled:!A&&I}),V=Y_e({open:y,enabled:O,mouseDownAction:`open`}),H=Y.useMemo(()=>Fg(B.reference,z.reference),[B.reference,z.reference]),U=h.useState(`triggerProps`,D),{preFocusGuardRef:W,handlePreFocusGuardFocus:G,handleFocusTargetFocus:K}=J_e(h,x),q={disabled:A,open:y},J=[N,t,M,E,x],ee=[H,L??a_,U,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Jg(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},V,p,j],te=o_(`button`,e,{enabled:!O,stateAttributesMapping:rH,state:q,ref:J,props:ee});return O?(0,X.jsx)(B5,{tag:`button`,render:n,className:r,style:i,state:q,refs:J,props:ee,stateAttributesMapping:rH}):y?(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(WU,{ref:W,onFocus:G},`${g}-pre-focus-guard`),(0,X.jsx)(Y.Fragment,{children:te},g),(0,X.jsx)(WU,{ref:h.context.triggerFocusTargetRef,onFocus:K},`${g}-post-focus-guard`)]}):(0,X.jsx)(Y.Fragment,{children:te},g)});function Z_e(e,t){let n=zH(),[r,i]=Y.useState(!1);return Mg(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Q_e(){let e=I5(!0);return Y.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var $_e=Y.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return o_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),eve={"aria-expanded":void 0},tve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=R5();if(!p?.parentMenu)throw Error(Gg(37));let m=P6({guess:!0,label:a}),h=S5(),{store:g}=w5(),_=PH(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=Cq(_,g),C=Y.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=Y.useRef(null),T=Y.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),j=E.useState(`isActive`,m.index),M=Y.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:N,itemRef:P}=D5({closeOnClick:!1,disabled:k,highlighted:j,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:M,nodeId:h?.context.nodeId}),F=tJ(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:vJ({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),I=UG(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??a_,L=g.useState(`triggerProps`,!0);delete L.id;let R={disabled:k,highlighted:j,open:v},z=g.useState(`openMethod`),B=g.useState(`lastOpenChangeReason`)===`list-navigation`||z===`keyboard`;return o_(`div`,e,{state:R,stateAttributesMapping:nH,props:[I,F,L,A,v&&B&&$H?eve:void 0,{"aria-controls":x,tabIndex:v||j?0:-1,onBlur(){j&&E.set(`activeIndex`,null)}},f,N],ref:[t,m.ref,P,C,T]})});function H5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(z5,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function U5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(X_e,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function W5(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(A5,{className:s,"data-slot":`dropdown-menu-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(M5,{children:(0,X.jsx)(N5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function G5(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Q(`data-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive data-[disabled]:opacity-50 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,X.jsx)(N_e,{className:s,"data-inset":r,"data-slot":`dropdown-menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function nve(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(I_e,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function K5(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(z_e,{children:(0,X.jsx)(Qv,{className:`size-2 fill-current`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,X.jsxs)(R_e,{className:a,"data-slot":`dropdown-menu-radio-item`,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function q5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)($_e,{className:i,"data-slot":`dropdown-menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rve(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(K_e,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function ive(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Q(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[highlighted]:bg-accent data-[popup-open]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[popup-open]:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(Xv,{className:`ml-auto size-4`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(tve,{className:o,"data-inset":i,"data-slot":`dropdown-menu-sub-trigger`,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function ave(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(A5,{className:s,"data-slot":`dropdown-menu-sub-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(M5,{children:(0,X.jsx)(N5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function ove(){return`ontouchstart`in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function sve(){return yy().actions}function cve(e){let t=(0,Z.c)(4),{group:n}=e,r=n.actions[0];if(r?.integration){let e;return t[0]===r.integration?e=t[1]:(e=(0,X.jsx)(b3,{className:`size-4`,integration:r.integration}),t[0]=r.integration,t[1]=e),e}if(n.category===`System`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(dy,{className:`size-4`}),t[2]=e):e=t[2],e}let i;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(gy,{className:`size-4`}),t[3]=i):i=t[3],i}function lve(e){let t=(0,Z.c)(11),{action:n,className:r}=e;if(n.integration){let e;return t[0]!==n.integration||t[1]!==r?(e=(0,X.jsx)(b3,{className:r,integration:n.integration}),t[0]=n.integration,t[1]=r,t[2]=e):e=t[2],e}if(n.category===`System`){let e;t[3]===r?e=t[4]:(e=Q(r,`text-muted-foreground`),t[3]=r,t[4]=e);let n;return t[5]===e?n=t[6]:(n=(0,X.jsx)(dy,{className:e}),t[5]=e,t[6]=n),n}let i;t[7]===r?i=t[8]:(i=Q(r,`text-muted-foreground`),t[7]=r,t[8]=i);let a;return t[9]===i?a=t[10]:(a=(0,X.jsx)(gy,{className:i}),t[9]=i,t[10]=a),a}var J5=`workflow-action-grid-hidden-groups`,Y5=`workflow-action-grid-view-mode`;function uve(){if(typeof window>`u`)return new Set;try{let e=localStorage.getItem(J5);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function dve(){if(typeof window>`u`)return`list`;try{return localStorage.getItem(Y5)===`grid`?`grid`:`list`}catch{return`list`}}function fve(e){let t=(0,Z.c)(72),{onSelectAction:n,disabled:r,isNewlyCreated:i}=e,[a,o]=(0,Y.useState)(``),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Set,t[0]=s):s=t[0];let[c,l]=(0,Y.useState)(s),[u,d]=(0,Y.useState)(uve),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(dve),g=sve(),_;t[1]===m?_=t[2]:(_=()=>{let e=m===`list`?`grid`:`list`;h(e),localStorage.setItem(Y5,e)},t[1]=m,t[2]=_);let v=_,y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[3]=y):y=t[3];let b=y,x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),localStorage.setItem(J5,JSON.stringify([...n])),n})},t[4]=x):x=t[4];let S=x,C;if(t[5]!==g||t[6]!==a){let e;t[8]===a?e=t[9]:(e=e=>{let t=a.toLowerCase();return e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.category.toLowerCase().includes(t)},t[8]=a,t[9]=e),C=g.filter(e),t[5]=g,t[6]=a,t[7]=C}else C=t[7];let w=C,T;if(t[10]!==w){let e={};for(let t of w){let n=t.category;e[n]||(e[n]=[]),e[n].push(t)}T=Object.keys(e).toSorted(pve).map(t=>({category:t,actions:e[t]})),t[10]=w,t[11]=T}else T=t[11];let E=T,D;bb0:{if(f){D=E;break bb0}let e;if(t[12]!==E||t[13]!==u){let n;t[15]===u?n=t[16]:(n=e=>!u.has(e.category),t[15]=u,t[16]=n),e=E.filter(n),t[12]=E,t[13]=u,t[14]=e}else e=t[14];D=e}let O=D,k=u.size,A;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[17]=A):A=t[17];let j;t[18]===i?j=t[19]:(j=i===!0&&!ove(),t[18]=i,t[19]=j);let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>o(e.target.value),t[20]=M):M=t[20];let N;t[21]!==r||t[22]!==a||t[23]!==j?(N=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[A,(0,X.jsx)(wX,{autoFocus:j,className:`pl-9`,"data-testid":`action-search-input`,disabled:r,id:`action-filter`,onChange:M,placeholder:`Search actions...`,value:a})]}),t[21]=r,t[22]=a,t[23]=j,t[24]=N):N=t[24];let P;t[25]===v?P=t[26]:(P=(0,X.jsx)(zv,{className:`shrink-0`,onClick:v,size:`icon`,variant:`ghost`}),t[25]=v,t[26]=P);let F;t[27]===m?F=t[28]:(F=m===`list`?(0,X.jsx)(pte,{className:`size-4`}):(0,X.jsx)(vte,{className:`size-4`}),t[27]=m,t[28]=F);let I;t[29]!==P||t[30]!==F?(I=(0,X.jsx)(D8,{render:P,children:F}),t[29]=P,t[30]=F,t[31]=I):I=t[31];let L=m===`list`?`Grid view`:`List view`,R;t[32]===L?R=t[33]:(R=(0,X.jsx)(O8,{children:L}),t[32]=L,t[33]=R);let z;t[34]!==I||t[35]!==R?(z=(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[I,R]})}),t[34]=I,t[35]=R,t[36]=z):z=t[36];let B;t[37]!==k||t[38]!==f?(B=k>0&&(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[(0,X.jsx)(D8,{render:(0,X.jsx)(zv,{className:Q(`shrink-0`,f&&`bg-muted`),onClick:()=>p(!f),size:`icon`,variant:`ghost`}),children:f?(0,X.jsx)(ry,{className:`size-4`}):(0,X.jsx)(ny,{className:`size-4`})}),(0,X.jsx)(O8,{children:f?`Hide hidden groups`:`Show ${k} hidden group${k>1?`s`:``}`})]})}),t[37]=k,t[38]=f,t[39]=B):B=t[39];let V;t[40]!==N||t[41]!==z||t[42]!==B?(V=(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[N,z,B]}),t[40]=N,t[41]=z,t[42]=B,t[43]=V):V=t[43];let H;t[44]===w.length?H=t[45]:(H=w.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`No actions found`}),t[44]=w.length,t[45]=H);let U;t[46]!==w.length||t[47]!==O?(U=w.length>0&&O.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`All groups are hidden`}),t[46]=w.length,t[47]=O,t[48]=U):U=t[48];let W;t[49]!==r||t[50]!==w||t[51]!==u||t[52]!==n||t[53]!==f||t[54]!==m||t[55]!==O?(W=m===`grid`&&O.length>0&&(0,X.jsx)(`div`,{className:`grid gap-2 p-1`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(72px, 1fr))`},children:w.filter(e=>f||!u.has(e.category)).map(e=>(0,X.jsxs)(`button`,{className:Q(`flex aspect-square flex-col items-center justify-center gap-1.5 rounded-lg border border-transparent p-2 text-center transition-colors hover:border-border hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:[(0,X.jsx)(lve,{action:e,className:`size-6`}),(0,X.jsx)(`span`,{className:`line-clamp-2 font-medium text-xs leading-tight`,children:e.label})]},e.id))}),t[49]=r,t[50]=w,t[51]=u,t[52]=n,t[53]=f,t[54]=m,t[55]=O,t[56]=W):W=t[56];let G;t[57]!==c||t[58]!==r||t[59]!==u||t[60]!==n||t[61]!==m||t[62]!==O?(G=m===`list`&&O.length>0&&O.map((e,t)=>{let i=c.has(e.category),a=u.has(e.category);return(0,X.jsxs)(`div`,{children:[t>0&&(0,X.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,X.jsxs)(`div`,{className:Q(`sticky top-0 z-10 mb-1 flex items-center gap-2 bg-background px-3 py-2 font-medium text-muted-foreground text-xs uppercase tracking-wider`,a&&`opacity-50`),children:[(0,X.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 text-left hover:text-foreground`,onClick:()=>b(e.category),type:`button`,children:[(0,X.jsx)(Xv,{className:Q(`size-3.5 transition-transform`,!i&&`rotate-90`)}),(0,X.jsx)(cve,{group:e}),e.category]}),(0,X.jsxs)(H5,{children:[(0,X.jsx)(U5,{render:(0,X.jsx)(`button`,{className:`rounded p-0.5 hover:bg-muted hover:text-foreground`,type:`button`}),children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsx)(W5,{align:`end`,children:(0,X.jsx)(G5,{onClick:()=>S(e.category),children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Show group`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Hide group`]})})})]})]}),!i&&e.actions.map(e=>(0,X.jsx)(`button`,{className:Q(`flex w-full items-center rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[` `,`- `,e.description]})]})},e.id))]},e.category)}),t[57]=c,t[58]=r,t[59]=u,t[60]=n,t[61]=m,t[62]=O,t[63]=G):G=t[63];let K;t[64]!==H||t[65]!==U||t[66]!==W||t[67]!==G?(K=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-4`,"data-testid":`action-grid`,children:[H,U,W,G]}),t[64]=H,t[65]=U,t[66]=W,t[67]=G,t[68]=K):K=t[68];let q;return t[69]!==V||t[70]!==K?(q=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[V,K]}),t[69]=V,t[70]=K,t[71]=q):q=t[71],q}function pve(e,t){return e===`System`?-1:t===`System`?1:e.localeCompare(t)}function mve(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function X5(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...F3}}var hve=Y.createContext({disabled:!1});function Z5(){return Y.useContext(hve)}function Q5(e,t,n,r=!0,i){let[a,o]=Y.useState(),s=PH(i?`${i}-label`:void 0),c=e??t??a;return Mg(()=>{let i=e||t||!r?void 0:gve(n.current,s);a!==i&&o(i)}),c}function gve(e,t){let n=_ve(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function _ve(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var vve=Y.createContext(void 0);function yve(){return Y.useContext(vve)}var $5=Y.createContext(void 0);function bve(){let e=Y.useContext($5);if(e===void 0)throw Error(Gg(14));return e}var xve=`data-parent`,Sve=Y.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=e6(),{disabled:C,name:w,setDirty:T,setFilled:E,setFocused:D,setTouched:O,state:k,validationMode:A,validityData:j,validation:M}=R3(),N=Z5(),{labelId:P,controlId:F,registerControlId:I,getDescriptionProps:L}=B3(),R=yve(),z=R?.allValues===void 0?void 0:R.parent,B=z!==void 0,V=C||N.disabled||R?.disabled||o,H=w??d,U=v??H,W=PH(),G=PH(),K=c||F;B&&(p?K=G:U===void 0?K||=G:K=`${z.id}-${U}`);let q={};B&&(p?q=z.getParentProps():U!==void 0&&(q=z.getChildProps(U)));let{checked:J=n,indeterminate:ee=l,onCheckedChange:te,...ne}=q,re=R?.value,ie=Y.useRef(null),ae=Eg(()=>Symbol()),oe=Y.useRef(!1),{getButtonProps:se,buttonRef:ce}=Xg({disabled:V,native:y}),le=R?.validation??M,[ue,de]=A3({controlled:U!==void 0&&re!==void 0&&!p?re.includes(U):J,default:i,name:`Checkbox`,state:`checked`}),fe=B?!!J:ue,pe=B&&ee||l;Mg(()=>{I!==r_&&(oe.current=!0,I(ae.current,K))},[K,I,ae]),Y.useEffect(()=>{let e=ae.current;return()=>{!oe.current||I===r_||(oe.current=!1,I(e,void 0))}},[I,ae]),z3(ie,W,ue,void 0,!R&&!V,d);let me=Y.useRef(null),he=le.registerInput,ge=R?U:void 0,_e=Y.useCallback(e=>he(e,{controlRef:ie,value:ge}),[he,ge]),ve=Qg(u,me,p?void 0:_e),ye=Q5(a,P,me,!y,K??void 0);Mg(()=>{me.current&&(me.current.indeterminate=pe,ue&&E(!0))},[ue,pe,E]),aY(ue,()=>{R||(S(H),E(ue),T(ue!==j.initialValue),le.change(ue))});let be=Fg({checked:ue,disabled:V,form:s,name:p?void 0:H,id:y?void 0:K??void 0,required:g,ref:ve,style:H?UU:HU,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=DH(sH,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(te?.(t,n),!n.isCanceled&&(de(t),U!==void 0&&R!==void 0&&!p&&!B))){let e=t?[...R.value,U]:R.value.filter(e=>e!==U);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){ie.current?.focus()}},v===void 0?a_:{value:(R?ue&&v:v)||``},L,e=>le.getValidationProps(V,e));Y.useEffect(()=>{if(!z||U===void 0)return;let e=z.disabledStatesRef.current;return e.set(U,V),()=>{e.delete(U)}},[z,V,U]);let xe=Y.useMemo(()=>({...k,checked:fe,disabled:V,readOnly:m,required:g,indeterminate:pe}),[k,fe,V,m,g,pe]),Se=X5(xe),Ce=o_(`span`,e,{state:xe,ref:[ce,ie,t],props:[{id:y?K??void 0:W,role:`checkbox`,"aria-checked":pe?`mixed`:fe,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":ye,[xve]:p?``:void 0,onFocus(){V||D(!0)},onBlur(){let e=me.current;e&&(O(!0),D(!1),A===`onBlur`&&le.commit(R?re:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=me.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),tg(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||mve(t)?.click()})},onClick(e){if(m||V)return;e.preventDefault();let t=me.current;t&&Yg(t,e)}},x,ne,se,L,e=>le.getValidationProps(V,e)],stateAttributesMapping:Se});return(0,X.jsxs)($5.Provider,{value:xe,children:[Ce,!ue&&!R&&H&&!p&&_!==void 0&&(0,X.jsx)(`input`,{type:`hidden`,form:s,name:H,value:_,disabled:V}),(0,X.jsx)(`input`,{...be,suppressHydrationWarning:!0})]})}),Cve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=bve(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=gq(c),f=Y.useRef(null),p={...s,transitionStatus:u};vq({open:c,ref:f,onComplete(){c||d(!1)}});let m={...X5(s),...XV},h=a||l,g=o_(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function e7(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`peer inline-grid size-4 shrink-0 place-content-center rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[disabled]:cursor-not-allowed data-[checked]:border-primary data-[invalid]:border-destructive data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:opacity-50 data-[invalid]:ring-destructive/20 dark:bg-input/30 dark:data-[checked]:bg-primary dark:data-[invalid]:ring-destructive/40`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Cve,{className:`grid place-content-center text-current transition-none`,"data-slot":`checkbox-indicator`,children:(0,X.jsx)(qv,{className:`size-3.5`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Sve,{className:i,"data-slot":`checkbox`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var t7={checked(e){return e?{"data-checked":``}:{"data-unchecked":``}},...XV,...F3},wve=`data-composite-item-active`,n7=Y.createContext(void 0);function Tve(){return Y.useContext(n7)}var r7=Y.createContext(void 0);function Eve(){let e=Y.useContext(r7);if(e===void 0)throw Error(Gg(52));return e}var Dve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...p}=e,m=Tve(),{disabled:h,readOnly:g,required:_,form:v,checkedValue:y,touched:b=!1,validation:x,name:S,setCheckedValue:C=r_,setTouched:w=r_,registerInputRef:T=r_}=m??{},{setTouched:E,setFilled:D,state:O,disabled:k}=R3(),A=Z5(),{labelId:j,getDescriptionProps:M}=B3(),N=k||A.disabled||h||i,P=g||a,F=_||o,I=v,L=m?y===c:c===``,R=Y.useRef(null),z=Y.useRef(null),B=x?.registerInput,V=Qg(l,z,T,Y.useCallback(e=>B?.(e,{controlRef:R,value:void 0}),[B]));Mg(()=>{z.current?.checked&&D(!0)},[D]),Mg(()=>{if(z.current){if(N&&L){T(null);return}T(z.current)}},[L,N,T]);let H=PH(),U=V3({id:d,implicit:!1,controlRef:R}),W=u?void 0:U,G={role:`radio`,"aria-checked":L,"aria-labelledby":Q5(s,j,z,!u,W),[wve]:L?``:void 0,id:u?U:H,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||N||P)return;e.preventDefault();let t=z.current;t&&Yg(t,e)},onFocus(e){e.defaultPrevented||N||P||!b||(z.current?.click(),w(!1))}},{getButtonProps:K,buttonRef:q}=Xg({disabled:N,native:u,composite:!1}),J={type:`radio`,ref:V,form:I,id:W,name:S,tabIndex:-1,style:S?UU:HU,"aria-hidden":!0,...c===void 0?a_:{value:q3(c)},disabled:N,checked:L,required:F,readOnly:P,onChange(e){if(e.nativeEvent.defaultPrevented||N||P||c===void 0)return;let t=DH(sH,e.nativeEvent);C(c,t),!t.isCanceled&&E(!0)},onClick(e){e.stopPropagation()},onFocus(){R.current?.focus()}},ee=Y.useMemo(()=>({...O,required:F,disabled:N,readOnly:P,checked:L}),[O,N,P,L,F]),te=ee,ne=m!==void 0,re=[t,R,q],ie=[G,p,K,M,x?e=>x.getValidationProps(N,e):a_],ae=o_(`span`,e,{enabled:!ne,state:ee,ref:re,props:ie,stateAttributesMapping:t7});return(0,X.jsxs)(r7.Provider,{value:te,children:[ne?(0,X.jsx)(B5,{tag:`span`,render:n,className:r,style:f,state:ee,refs:re,props:ie,stateAttributesMapping:t7}):ae,(0,X.jsx)(`input`,{...J,suppressHydrationWarning:!0})]})}),Ove=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Eve(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=gq(c),f={...s,transitionStatus:u},p=Y.useRef(null),m=a||l,h=o_(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:t7});return vq({open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null}),kve=[];function Ave(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=kve}=e,[p,m]=Y.useState(0),h=r!=null,g=Y.useRef(null),_=Qg(g,c),v=Y.useRef([]),y=Y.useRef(!1),b=o??p,x=kg((e,t=!1)=>{if((s??m)(e),t){let t=v.current[e];AJ(g.current,t,a,n)}}),S=kg(e=>{if(e.size===0||y.current)return;y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)x(i);else if(wW(t,b,d)){let e=SW(t,{disabledIndices:d});yW(t,e)||x(e)}AJ(g.current,r,a,n)});Mg(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(wW(e,b,d)){let t=SW(e,{disabledIndices:d});yW(e,t)||x(t)}},[d,o,b,v,x]);let C=kg((e,t,n)=>i?i(e,t,n,v):n),w=kg(e=>{let o=e.key===`Home`||e.key===`End`;if(!TJ.has(e.key)||!l&&o||jve(e,f)||!g.current)return;let s=a===`rtl`,c=s?CJ:wJ,p=s?wJ:CJ,m=n===`vertical`?SJ:c,_=n===`vertical`?xJ:p,y=hU(e.nativeEvent);if(y!=null&&kJ(y)&&!k3(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let S=b,w=bW(v,d),T=xW(v,d);r!=null&&(S=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:b,loopFocus:t,maxIndex:T,minIndex:w,onLoop:C,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?S=w:e.key===`End`&&(S=T)),S===b&&(E||D)&&(t&&S===T&&E?(S=w,i&&(S=i(e,b,S,v))):t&&S===w&&D?(S=T,i&&(S=i(e,b,S,v))):S=SW(v.current,{startingIndex:S,decrement:D,disabledIndices:d})),S!==b&&!yW(v.current,S)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),x(S,!0),queueMicrotask(()=>{v.current[S]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=hU(e.nativeEvent);!t||n==null||!kJ(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:w},highlightedIndex:b,onHighlightedIndexChange:x,elementsRef:v,onMapChange:S,relayKeyboardEvent:w}}function jve(e,t){for(let n of DJ)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Mve(e){let{render:t,className:n,style:r,refs:i=i_,props:a=i_,state:o=a_,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Ave({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:d6(),disabledIndices:v,modifierKeys:y}),k=o_(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Y.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,X.jsx)(Kg.Provider,{value:A,children:(0,X.jsx)(l6,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}Object.keys(N3);function Nve(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var Pve=Y.createContext(void 0);function Fve(e=!1){let t=Y.useContext(Pve);if(!t&&!e)throw Error(Gg(86));return t}var Ive=[EJ],Lve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:g,setFocused:_,validationMode:v,name:y,disabled:b,state:x,validation:S,setDirty:C,setFilled:w,validityData:T}=R3(),{labelId:E}=B3(),{clearErrors:D,elementRef:O}=e6(),k=Fve(!0),A=b||i,j=y??d,M=PH(p),[N,P]=A3({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[F,I]=Y.useState(!1),L=kg((e,t)=>{s?.(e,t),!t.isCanceled&&P(e)}),R=S.getInputControl,z=Y.useMemo(()=>({get current(){return R()}}),[R]),B=Y.useRef(null),V=Y.useRef(null);function H(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),B.current=e,t}let U=kg(e=>{if(!e||e.disabled)return;V.current||=e;let t=B.current,n=e.checked||t==null||t.disabled?H(e):void 0;return()=>{V.current===e&&(V.current=null),B.current===e?n?(n(),B.current=null):H(null):n?.()}}),W=kg(()=>{let e=O.current;if(!e)return N??null;for(let t of S.registeredInputs.keys())if(t.checked&&Nve(t,e))return N??null;return null});z3(z,M,N??null,W,!A,d),aY(N,()=>{D(j),C(N!==T.initialValue),w(N!=null),S.change(N);let e=V.current;N==null&&e&&!e.disabled&&H(e)});let G=E??k?.legendId,K={...x,disabled:A??!1,required:o??!1,readOnly:a??!1},q=Y.useMemo(()=>({checkedValue:N,disabled:A,form:u,validation:S,name:j,readOnly:a,registerInputRef:U,required:o,setCheckedValue:L,setTouched:I,touched:F}),[N,A,u,S,j,a,U,o,L,I,F]),J={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":A||void 0,"aria-readonly":a||void 0,"aria-labelledby":G,onFocus(){_(!0)},onBlur(e){mU(e.currentTarget,e.relatedTarget)||(g(!0),_(!1),v===`onBlur`&&S.commit(N))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(I(!0),_(!0))}};return(0,X.jsx)(n7.Provider,{value:q,children:(0,X.jsx)(Mve,{render:n,className:r,style:m,state:K,props:[J,h,e=>S.getValidationProps(A??!1,e)],refs:[t],stateAttributesMapping:F3,enableHomeAndEndKeys:!1,modifierKeys:Ive})})});function Rve(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`space-y-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Lve,{className:i,"data-slot":`radio-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zve(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex size-4 shrink-0 items-center justify-center rounded-full border border-input bg-background outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[checked]:border-primary data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Ove,{className:`flex items-center justify-center before:size-1.5 before:rounded-full before:bg-current data-[unchecked]:hidden`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Dve,{className:i,"data-slot":`radio`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Bve(e){let t=(0,Z.c)(95),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=(0,Y.useId)(),s=(0,Y.useId)(),c=(0,Y.useId)(),l=yy(),u,d;t[0]!==l||t[1]!==n?(u=C1(n)??S1,d=aue({rules:u,catalog:l}),t[0]=l,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]);let f=d,p;t[4]===r?p=t[5]:(p=e=>{r({lifecycleRules:e})},t[4]=r,t[5]=p);let m=p,h;t[6]!==u||t[7]!==m?(h=e=>{m(A1({...u,startEvents:e}))},t[6]=u,t[7]=m,t[8]=h):h=t[8];let g=h,_;t[9]!==u||t[10]!==m?(_=e=>{m(A1({...u,cancelEvents:e}))},t[9]=u,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==u||t[13]!==m?(y=e=>{m(A1({...u,concurrency:e}))},t[12]=u,t[13]=m,t[14]=y):y=t[14];let b=y,x;t[15]!==u||t[16]!==m?(x=(e,t)=>{let n=t.trim(),r={...u.correlationPaths};n?r[e]=n:delete r[e],m({...u,correlationPaths:Object.keys(r).length>0?r:void 0})},t[15]=u,t[16]=m,t[17]=x):x=t[17];let S=x,C=l.events.length>0,w;t[18]!==l.events||t[19]!==i||t[20]!==u.startEvents||t[21]!==g||t[22]!==a?(w=(0,X.jsx)(y5,{choices:l.events,disabled:i,inputId:a,onValueChange:g,value:u.startEvents}),t[18]=l.events,t[19]=i,t[20]=u.startEvents,t[21]=g,t[22]=a,t[23]=w):w=t[23];let T;t[24]!==l||t[25]!==i||t[26]!==u||t[27]!==S||t[28]!==g?(T=u.startEvents.map(e=>(0,X.jsx)(a7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>g(u.startEvents.filter(t=>t!==e)),request:k1({rules:u,catalog:l,eventName:e,role:`start`})},e)),t[24]=l,t[25]=i,t[26]=u,t[27]=S,t[28]=g,t[29]=T):T=t[29];let E;t[30]!==a||t[31]!==C||t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(i7,{help:`A run starts when one of these Events arrives. Naming several is how one workflow answers an appointment being booked and being moved: Concurrency decides what happens to the run already going.`,hasEvents:C,inputId:a,label:`Start Events`,children:[w,T]}),t[30]=a,t[31]=C,t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]===s?D=t[36]:(D=(0,X.jsx)(TX,{id:s,children:`Concurrency`}),t[35]=s,t[36]=D);let O=u.concurrency,k;t[37]!==i||t[38]!==u.concurrency?(k=Gve.map(e=>(0,X.jsxs)(`label`,{className:Q(`flex w-full cursor-pointer items-start gap-2 rounded-md border p-2 transition-colors`,u.concurrency===e.value?`border-primary bg-muted/50`:`border-input hover:bg-muted/30`,i&&`pointer-events-none opacity-50`),children:[(0,X.jsx)(zve,{className:`mt-0.5`,value:e.value}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]})]},e.value)),t[37]=i,t[38]=u.concurrency,t[39]=k):k=t[39];let A;t[40]!==s||t[41]!==i||t[42]!==u.concurrency||t[43]!==b||t[44]!==k?(A=(0,X.jsx)(Rve,{"aria-labelledby":s,disabled:i,onValueChange:b,value:O,children:k}),t[40]=s,t[41]=i,t[42]=u.concurrency,t[43]=b,t[44]=k,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The entity is the value at the Correlation Path. A start carrying no payload uses the workflow itself, so every manual run is about the same entity.`}),t[46]=j):j=t[46];let M;t[47]!==D||t[48]!==A?(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[D,A,j]}),t[47]=D,t[48]=A,t[49]=M):M=t[49];let N=u.allowManualStart===!0,P;t[50]!==u||t[51]!==m?(P=e=>m({...u,allowManualStart:e}),t[50]=u,t[51]=m,t[52]=P):P=t[52];let F;t[53]!==i||t[54]!==c||t[55]!==N||t[56]!==P?(F=(0,X.jsx)(e7,{checked:N,disabled:i,id:c,onCheckedChange:P}),t[53]=i,t[54]=c,t[55]=N,t[56]=P,t[57]=F):F=t[57];let I;t[58]===c?I=t[59]:(I=(0,X.jsx)(TX,{htmlFor:c,children:`Allow manual runs`}),t[58]=c,t[59]=I);let L;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The Run button and the execute route. With this off, only a Start Event starts a run.`}),t[60]=L):L=t[60];let R;t[61]===u.startEvents.length?R=t[62]:(R=u.startEvents.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A manual run's payload is described by nothing, so downstream nodes are offered no fields to reference. Add a Start Event to give them its payload.`}):null,t[61]=u.startEvents.length,t[62]=R);let z;t[63]!==I||t[64]!==R?(z=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[I,L,R]}),t[63]=I,t[64]=R,t[65]=z):z=t[65];let B;t[66]!==F||t[67]!==z?(B=(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,z]}),t[66]=F,t[67]=z,t[68]=B):B=t[68];let V=l.events.length>0,H;t[69]!==o||t[70]!==l.events||t[71]!==i||t[72]!==u.cancelEvents||t[73]!==v?(H=(0,X.jsx)(y5,{choices:l.events,disabled:i,inputId:o,onValueChange:v,value:u.cancelEvents}),t[69]=o,t[70]=l.events,t[71]=i,t[72]=u.cancelEvents,t[73]=v,t[74]=H):H=t[74];let U;t[75]!==l||t[76]!==i||t[77]!==u||t[78]!==v||t[79]!==S?(U=u.cancelEvents.map(e=>(0,X.jsx)(a7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>v(u.cancelEvents.filter(t=>t!==e)),request:k1({rules:u,catalog:l,eventName:e,role:`cancel`})},e)),t[75]=l,t[76]=i,t[77]=u,t[78]=v,t[79]=S,t[80]=U):U=t[80];let W;t[81]!==o||t[82]!==V||t[83]!==H||t[84]!==U?(W=(0,X.jsxs)(i7,{hasEvents:V,help:`When one of these arrives, Workflow Graph reads its Entity Value at the Correlation Path you set for it and cancels the runs already going for that entity. A canceled run leaves through the Canceled outlet.`,inputId:o,label:`Cancel Events`,children:[H,U]}),t[81]=o,t[82]=V,t[83]=H,t[84]=U,t[85]=W):W=t[85];let G;t[86]!==f.error||t[87]!==f.valid?(G=f.valid?null:(0,X.jsx)(v5,{title:`This will not save`,children:f.error}),t[86]=f.error,t[87]=f.valid,t[88]=G):G=t[88];let K;return t[89]!==E||t[90]!==M||t[91]!==B||t[92]!==W||t[93]!==G?(K=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[E,M,B,W,G]}),t[89]=E,t[90]=M,t[91]=B,t[92]=W,t[93]=G,t[94]=K):K=t[94],K}function i7(e){let t=(0,Z.c)(12),{label:n,inputId:r,hasEvents:i,help:a,children:o}=e,s;t[0]!==r||t[1]!==n?(s=(0,X.jsx)(TX,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c;t[3]!==o||t[4]!==i?(c=i?o:(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`This server declares no Events. Whoever runs it passes them to`,(0,X.jsx)(`code`,{className:`mx-1 font-mono text-xs`,children:`createWfGraphApp`}),`, and they appear here.`]}),t[3]=o,t[4]=i,t[5]=c):c=t[5];let l;t[6]===a?l=t[7]:(l=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[6]=a,t[7]=l);let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function a7(e){let t=(0,Z.c)(19),{eventName:n,label:r,request:i,catalog:a,onCommitPath:o,onRemove:s,disabled:c}=e,l=r??n,u;t[0]!==n||t[1]!==l?(u=(0,X.jsx)(`p`,{className:`min-w-0 truncate text-xs`,title:n,children:l}),t[0]=n,t[1]=l,t[2]=u):u=t[2];let d=`Remove ${n}`,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(hy,{className:`size-3.5`}),t[3]=f):f=t[3];let p;t[4]!==c||t[5]!==s||t[6]!==d?(p=(0,X.jsx)(zv,{"aria-label":d,className:`size-7 shrink-0`,disabled:c,onClick:s,size:`icon`,type:`button`,variant:`ghost`,children:f}),t[4]=c,t[5]=s,t[6]=d,t[7]=p):p=t[7];let m;t[8]!==u||t[9]!==p?(m=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[u,p]}),t[8]=u,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==a||t[12]!==c||t[13]!==o||t[14]!==i?(h=i?(0,X.jsx)(Vve,{catalog:a,disabled:c,onCommit:o,request:i}):null,t[11]=a,t[12]=c,t[13]=o,t[14]=i,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Vve(e){let t=(0,Z.c)(47),{request:n,catalog:r,disabled:i,onCommit:a}=e,o=(0,Y.useId)(),{eventName:s,declaredPath:c,suppliedPath:l}=n,u,d,f,p,m,h,g,_,v,y;if(t[0]!==r||t[1]!==c||t[2]!==i||t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==l){let e=Wve(r,s,c,l);v=`space-y-1`,t[17]!==s||t[18]!==o?(y=(0,X.jsx)(TX,{className:`sr-only`,htmlFor:o,children:s}),t[17]=s,t[18]=o,t[19]=y):y=t[19],d=V6,m=i,t[20]!==c||t[21]!==s||t[22]!==a?(h=e=>a(s,e===c||e===null?``:e),t[20]=c,t[21]=s,t[22]=a,t[23]=h):h=t[23],g=l??c??null;let n;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(U6,{}),t[24]=n):n=t[24],t[25]===o?_=t[26]:(_=(0,X.jsx)(W6,{className:`w-full`,id:o,children:n}),t[25]=o,t[26]=_),u=G6,t[27]===c?f=t[28]:(f=c?null:(0,X.jsx)(K6,{value:null,children:`Choose a path`}),t[27]=c,t[28]=f),p=e.map(Hve),t[0]=r,t[1]=c,t[2]=i,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[29]!==u||t[30]!==f||t[31]!==p?(b=(0,X.jsxs)(u,{children:[f,p]}),t[29]=u,t[30]=f,t[31]=p,t[32]=b):b=t[32];let x;t[33]!==d||t[34]!==m||t[35]!==h||t[36]!==g||t[37]!==_||t[38]!==b?(x=(0,X.jsxs)(d,{disabled:m,onValueChange:h,value:g,children:[_,b]}),t[33]=d,t[34]=m,t[35]=h,t[36]=g,t[37]=_,t[38]=b,t[39]=x):x=t[39];let S=c?`Runs are matched on this payload path. The Event declares ${c}; a path here is read instead.`:`Runs are matched on this payload path. This Event declares none, so choose the one holding the value that identifies the entity.`,C;t[40]===S?C=t[41]:(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:S}),t[40]=S,t[41]=C);let w;return t[42]!==x||t[43]!==C||t[44]!==v||t[45]!==y?(w=(0,X.jsxs)(`div`,{className:v,children:[y,x,C]}),t[42]=x,t[43]=C,t[44]=v,t[45]=y,t[46]=w):w=t[46],w}function Hve(e){return(0,X.jsx)(K6,{value:e,children:e},e)}var Uve=new Set([`string`,`number`]);function Wve(e,t,n,r){return Ya(Ka([...(Ny(e,t)?.payloadFields??[]).filter(e=>Uve.has(e.type??``)).map(e=>e.path),n,r]))}var Gve=[{value:`unlimited`,label:`Unlimited`,description:`Every Event starts its own run.`},{value:`newest-wins`,label:`Newest wins`,description:`A new run for the same entity supersedes the ones already going, which end with that status.`},{value:`first-wins`,label:`First wins`,description:`A run already going for the same entity keeps it. The arriving Event is recorded as a Refused Start.`}];function Kve(e){let[t]=o8({currentNodeId:e.nodeId,nodes:e.nodes,edges:e.edges,catalog:e.catalog});if(!t)return;let n=L2(t),r=a4(n);return{conditionModel:t4(n),condition:r.valid?r.expression:``}}function qve(){let e=(0,Z.c)(17),t=yy(),n=_A(),r=Fe(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={from:`/workflows/$workflowId`},e[0]=i):i=e[0];let a=Gi(i),o=wA(H4),s=TA(m3),c=TA(hpe),l;e[1]!==t||e[2]!==r||e[3]!==o||e[4]!==n||e[5]!==s?(l=e=>{let i=n.get(Q4),a=i.find(e=>e.id===o);if(!a)return;let c=typeof e.actionType==`string`&&!!a.data.config?.integrationId,l={...a.data.config,...e,...c?{integrationId:void 0}:{}};e.actionType===b1.condition&&!l.conditionModel&&Object.assign(l,Kve({nodeId:a.id,nodes:i,edges:n.get($4),catalog:t}));let u=r.getQueryData(i0().queryKey),d=u?J0(t,{...a,data:{...a.data,config:l}},u).data.config:l;s({id:a.id,data:{config:d}})},e[1]=t,e[2]=r,e[3]=o,e[4]=n,e[5]=s,e[6]=l):l=e[6];let u=l,d;e[7]===r?d=e[8]:(d=()=>s0(r),e[7]=r,e[8]=d);let f=d,p;e[9]!==c||e[10]!==a||e[11]!==r?(p=r0.workflow.deleteExecutions.mutationOptions({onSuccess:async()=>{c(),a({search:{},replace:!0}),await s0(r),Ty.success(`All runs deleted`)},meta:{errorMessage:`Failed to delete runs`}}),e[9]=c,e[10]=a,e[11]=r,e[12]=p):p=e[12];let m=Ze(p),h;return e[13]!==m||e[14]!==f||e[15]!==u?(h={updateConfig:u,refreshRuns:f,deleteRuns:m},e[13]=m,e[14]=f,e[15]=u,e[16]=h):h=e[16],h}var Jve=[`pending`,`running`,`waiting`,`completed`,`canceled`,`superseded`,`failed`],Yve=[`pending`,`running`,`waiting`];function o7(e){return Yve.some(t=>t===e)}function Xve(e){return{supersededCount:e.supersededCount,refusedStarts:e.refusedStarts.map(e=>({...e,createdAt:new Date(e.createdAt)})),executions:e.items.map(e=>({...e,startedAt:new Date(e.startedAt),waitingAt:e.waitingAt?new Date(e.waitingAt):null,cancelledAt:e.cancelledAt?new Date(e.cancelledAt):null,completedAt:e.completedAt?new Date(e.completedAt):null}))}}function Zve(e){return{logs:s7(e),waits:e.waits.map(e=>({...e,waitUntil:e.waitUntil?new Date(e.waitUntil):null})),execution:{...Qve(e.execution),workflowVersionId:e.execution.workflowVersionId}}}function Qve(e){return{id:e.id,workflowId:e.workflowId,status:$ve(e.status),startSource:e.startSource,runMode:e.runMode,startEventName:e.startEventName,entityValue:e.entityValue,workflowRunId:null,startedAt:new Date(e.startedAt),waitingAt:null,cancelledAt:null,completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,error:e.error}}function $ve(e){for(let t of Jve)if(t===e)return t;return`failed`}function eye(e){return iye(s7(e))}function tye(e){return{workflowId:e.execution.workflowId,workflowVersionId:e.execution.workflowVersionId}}function nye(e){return e.events.map(e=>({...e,createdAt:new Date(e.createdAt)}))}function s7(e){return aye(e.logs.map(e=>({id:e.id,nodeId:e.nodeId,nodeName:e.nodeName,nodeType:e.nodeType,status:e.status,startedAt:new Date(e.startedAt),completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,input:e.input,output:e.output,error:e.error})),e.execution.status)}function rye(e){return new Date(e.startedAt).getTime()}function iye(e){let t={};for(let n of e){let e=t[n.nodeId];e?.startedAt!==void 0&&rye(n)<new Date(e.startedAt).getTime()||(t[n.nodeId]={nodeId:n.nodeId,nodeName:n.nodeName,nodeType:n.nodeType,status:n.status,input:n.input,output:n.output,startedAt:n.startedAt,completedAt:n.completedAt})}return t}function aye(e,t){return t!==`canceled`&&t!==`superseded`?e:e.map(e=>e.status===`pending`||e.status===`running`?{...e,status:`cancelled`,error:e.error||`Run cancelled before step completion`}:e)}function c7(){let e=(0,Z.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={from:`/workflows/$workflowId`},e[0]=t):t=e[0];let n=Gi(t),r;return e[1]===n?r=e[2]:(r=()=>{n({search:{},replace:!0})},e[1]=n,e[2]=r),r}function l7(){let e=(0,Z.c)(3),t=c7(),n=TA(g2),r;return e[0]!==t||e[1]!==n?(r=()=>{n(`properties`),t()},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function u7(e,t){return`${e} ${t}${e===1?``:`s`} ago`}function d7(e){let t=new Date,n=new Date(e),r=Math.floor((t.getTime()-n.getTime())/1e3);if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return u7(i,`min`);let a=Math.floor(i/60);if(a<24)return u7(a,`hour`);let o=Math.floor(a/24);if(o<7)return u7(o,`day`);let s=Math.floor(o/7);if(s<4)return u7(s,`week`);let c=Math.floor(o/30);return c<12?u7(c,`month`):u7(Math.floor(o/365),`year`)}function f7(e){let t=(0,Z.c)(5),{refusedStarts:n}=e;if(n.length===0)return null;let r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Kv,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Refused Starts`})]}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=n.map(oye),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[r,(0,X.jsx)(`div`,{className:`divide-y`,children:i})]}),t[3]=i,t[4]=a),a}function oye(e){return(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-2`,children:[(0,X.jsx)(`p`,{className:`text-foreground text-xs`,children:e.message}),(0,X.jsx)(`p`,{className:`shrink-0 text-muted-foreground text-xs tabular-nums`,title:e.createdAt.toLocaleString(),children:d7(e.createdAt)})]},e.id)}var sye=jy(`workflow`,`run`),cye={pending:`muted`,running:`info`,waiting:`pending`,completed:`good`,canceled:`quiet`,superseded:`quiet`,failed:`bad`},lye={pending:`muted`,running:`info`,success:`good`,error:`bad`,cancelled:`quiet`};function p7(e){return cye[e]??lye[e]??`muted`}var uye={good:`bg-success`,bad:`bg-destructive`,info:`bg-info`,pending:`bg-warning`,quiet:`bg-cancelled`,muted:`bg-muted-foreground`},dye={pending:`Pending`,running:`Running`,waiting:`Waiting`,completed:`Completed`,canceled:`Canceled`,superseded:`Superseded`,failed:`Failed`},fye={pending:`Pending`,running:`Running`,success:`Success`,error:`Error`,cancelled:`Cancelled`},pye={good:`border-success/30 bg-success/10 text-success`,bad:`border-destructive/30 bg-destructive/10 text-destructive`,info:`border-info/30 bg-info/10 text-info`,pending:`border-warning/30 bg-warning/10 text-warning`,quiet:`border-cancelled/30 bg-cancelled/10 text-cancelled`,muted:`border-muted bg-muted/40 text-muted-foreground`};function m7(e){return uye[p7(e)]}function h7(e){return dye[e]??fye[e]??`Unknown`}function g7(e){return pye[p7(e)]}function _7(e){let t=Number.parseInt(e,10);return t<1e3?`${e}ms`:`${(t/1e3).toFixed(2)}s`}var mye=Wh(Ch({base64:yh.check(Lh(101))}));function v7(e){return mye(e)?.base64??null}function hye(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function y7(e){let t=(0,Z.c)(4),{data:n}=e,r;t[0]===n?r=t[1]:(r=JSON.stringify(n,null,2).split(/("https?:\/\/[^"]+"|"[^"]*")/g).map(gye),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(X.Fragment,{children:r}),t[2]=r,t[3]=i),i}function gye(e){if(e.startsWith(`"`)&&e.endsWith(`"`)){let t=e.slice(1,-1);if(hye(t))return(0,X.jsx)(`a`,{className:`text-info underline underline-offset-2 hover:text-info/80`,href:t,rel:`noopener noreferrer`,target:`_blank`,children:e},t)}return e}function _ye({data:e,isError:t=!1}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(zv,{className:`h-7 px-2`,onClick:async n=>{n.stopPropagation();try{let n=t?String(e):JSON.stringify(e,null,2);await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){sye.error(`Failed to copy the run payload`,{error:e})}},size:`sm`,type:`button`,variant:`ghost`,children:n?(0,X.jsx)(qv,{className:`size-3 text-success`}):(0,X.jsx)($v,{className:`size-3`})})}function b7(e){let t=(0,Z.c)(21),{title:n,children:r,defaultExpanded:i,copyData:a,isError:o}=e,s=i!==void 0&&i,c=o!==void 0&&o,[l,u]=(0,Y.useState)(s),d;t[0]===l?d=t[1]:(d=()=>u(!l),t[0]=l,t[1]=d);let f;t[2]===l?f=t[3]:(f=l?(0,X.jsx)(Jv,{className:`size-3 text-muted-foreground`}):(0,X.jsx)(Xv,{className:`size-3 text-muted-foreground`}),t[2]=l,t[3]=f);let p;t[4]===n?p=t[5]:(p=(0,X.jsx)(`span`,{className:`font-medium text-muted-foreground text-sm`,children:n}),t[4]=n,t[5]=p);let m;t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`flex items-center gap-1.5`,onClick:d,type:`button`,children:[f,p]}),t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==c?(h=a===void 0?null:(0,X.jsx)(_ye,{data:a,isError:c}),t[10]=a,t[11]=c,t[12]=h):h=t[12];let g;t[13]===h?g=t[14]:(g=(0,X.jsx)(`div`,{className:`flex items-center gap-1`,children:h}),t[13]=h,t[14]=g);let _;t[15]!==m||t[16]!==g?(_=(0,X.jsxs)(`div`,{className:`mb-2 flex w-full items-center justify-between`,children:[m,g]}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v=l?r:null,y;return t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20],y}function vye(e,t){let n=t?.integration;if(!n)return;let r=`${n}/`;if(t.id.startsWith(r))return e[n]?.outputComponents?.[t.id.slice(r.length)]}function yye(e){let t=(0,Z.c)(22),{output:n,input:r,actionType:i}=e,a=yy(),o=xy(),s;t[0]!==i||t[1]!==a||t[2]!==o?(s=i?vye(o,Py(a,i)):void 0,t[0]=i,t[1]=a,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]!==c||t[5]!==n?(l=c?null:v7(n),t[4]=c,t[5]=n,t[6]=l):l=t[6];let u=l,d;t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==n?(d=c?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(c,{input:r,output:n})}):u?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(`img`,{alt:`Step output`,className:`max-h-96 w-auto rounded`,height:384,src:`data:image/png;base64,${u}`,width:384})}):null,t[7]=c,t[8]=u,t[9]=r,t[10]=n,t[11]=d):d=t[11];let f=d,p;t[12]===n?p=t[13]:(p=(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(y7,{data:n})}),t[12]=n,t[13]=p);let m;t[14]!==n||t[15]!==p?(m=(0,X.jsx)(b7,{copyData:n,title:`Output`,children:p}),t[14]=n,t[15]=p,t[16]=m):m=t[16];let h;t[17]===f?h=t[18]:(h=f?(0,X.jsx)(b7,{defaultExpanded:!0,title:`Result`,children:f}):null,t[17]=f,t[18]=h);let g;return t[19]!==m||t[20]!==h?(g=(0,X.jsxs)(X.Fragment,{children:[m,h]}),t[19]=m,t[20]=h,t[21]=g):g=t[21],g}var x7=`grid w-full grid-cols-[1.5rem_minmax(0,1fr)_5rem] items-start gap-3 px-1 py-3 text-left`;function bye(e){return e.type===`back`?(0,X.jsx)(`button`,{"aria-label":`Back to runs list`,className:`mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-muted`,onClick:e.onBack,type:`button`,children:(0,X.jsx)(ate,{className:`size-4 text-muted-foreground`})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`size-6 shrink-0`})}function xye(e,t){return t.type===`cancel`?(0,X.jsx)(`div`,{className:`flex w-20 justify-end`,children:(0,X.jsxs)(zv,{className:`w-full`,disabled:t.isCanceling,onClick:()=>t.onCancel(e.id),size:`sm`,variant:`outline`,children:[t.isCanceling?(0,X.jsx)(ay,{className:`mr-1 size-3 animate-spin`}):(0,X.jsx)(Kv,{className:`mr-1 size-3`}),`Cancel`]})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`w-20 shrink-0`})}function Sye(e){let t=(0,Z.c)(41),{execution:n,runNumber:r,showStartEventName:i}=e,a;t[0]===n.status?a=t[1]:(a=Q(`mt-1 size-2.5 shrink-0 rounded-full`,m7(n.status)),t[0]=n.status,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,X.jsx)(`div`,{className:a}),t[2]=a,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,X.jsxs)(`span`,{className:`font-medium text-sm`,children:[`Run #`,r]}),t[4]=r,t[5]=s);let c;t[6]===n.status?c=t[7]:(c=Q(`rounded border px-1.5 py-0.5 font-medium text-xs uppercase`,g7(n.status)),t[6]=n.status,t[7]=c);let l;t[8]===n.status?l=t[9]:(l=h7(n.status),t[8]=n.status,t[9]=l);let u;t[10]!==c||t[11]!==l?(u=(0,X.jsx)(`span`,{className:c,children:l}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;t[13]===n.runMode?d=t[14]:(d=n.runMode===`test`?(0,X.jsx)(`span`,{className:`rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 font-medium text-xs text-warning uppercase`,children:`Test Mode`}):null,t[13]=n.runMode,t[14]=d);let f;t[15]!==s||t[16]!==u||t[17]!==d?(f=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,u,d]}),t[15]=s,t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;t[19]===n.startedAt?p=t[20]:(p=d7(n.startedAt),t[19]=n.startedAt,t[20]=p);let m;t[21]===p?m=t[22]:(m=(0,X.jsx)(`span`,{children:p}),t[21]=p,t[22]=m);let h;t[23]===n.startSource?h=t[24]:(h=n.startSource?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`capitalize`,children:n.startSource})]}):null,t[23]=n.startSource,t[24]=h);let g;t[25]!==n.startEventName||t[26]!==i?(g=i&&n.startEventName?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{children:n.startEventName})]}):null,t[25]=n.startEventName,t[26]=i,t[27]=g):g=t[27];let _;t[28]===n.duration?_=t[29]:(_=n.duration?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`font-mono tabular-nums`,children:_7(n.duration)})]}):null,t[28]=n.duration,t[29]=_);let v;t[30]!==m||t[31]!==h||t[32]!==g||t[33]!==_?(v=(0,X.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-muted-foreground text-xs`,children:[m,h,g,_]}),t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v):v=t[34];let y;t[35]!==v||t[36]!==f?(y=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,v]}),t[35]=v,t[36]=f,t[37]=y):y=t[37];let b;return t[38]!==y||t[39]!==o?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[o,y]}),t[38]=y,t[39]=o,t[40]=b):b=t[40],b}function S7(e){let t=(0,Z.c)(21),{execution:n,runNumber:r,leading:i,trailing:a,onClick:o,selected:s,showStartEventName:c}=e,l=s!==void 0&&s,u=c!==void 0&&c,d;t[0]===i?d=t[1]:(d=bye(i),t[0]=i,t[1]=d);let f;t[2]!==n||t[3]!==r||t[4]!==u?(f=(0,X.jsx)(Sye,{execution:n,runNumber:r,showStartEventName:u}),t[2]=n,t[3]=r,t[4]=u,t[5]=f):f=t[5];let p;t[6]!==n||t[7]!==a?(p=xye(n,a),t[6]=n,t[7]=a,t[8]=p):p=t[8];let m;t[9]!==d||t[10]!==f||t[11]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[d,f,p]}),t[9]=d,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h=m;if(o){let e=l&&`bg-muted/50`,n;t[13]===e?n=t[14]:(n=Q(x7,`transition-colors hover:bg-muted/50`,e),t[13]=e,t[14]=n);let r;return t[15]!==h||t[16]!==o||t[17]!==n?(r=(0,X.jsx)(`button`,{className:n,"data-testid":`workflow-run-summary-row`,onClick:o,type:`button`,children:h}),t[15]=h,t[16]=o,t[17]=n,t[18]=r):r=t[18],r}let g;return t[19]===h?g=t[20]:(g=(0,X.jsx)(`div`,{className:x7,"data-testid":`workflow-run-summary-row`,children:h}),t[19]=h,t[20]=g),g}function Cye(e){let t=(0,Z.c)(36),{log:n,isLast:r}=e,[i,a]=(0,Y.useState)(!1),o;t[0]===r?o=t[1]:(o=r?null:(0,X.jsx)(`div`,{className:`absolute top-5 bottom-0 left-2 w-px bg-border`}),t[0]=r,t[1]=o);let s;t[2]===n.status?s=t[3]:(s=Q(`size-4 rounded-full ring-2 ring-background`,m7(n.status)),t[2]=n.status,t[3]=s);let c;t[4]===s?c=t[5]:(c=(0,X.jsx)(`div`,{className:`relative z-10 mt-1.5 flex shrink-0 items-center justify-center`,children:(0,X.jsx)(`div`,{className:s})}),t[4]=s,t[5]=c);let l;t[6]===i?l=t[7]:(l=()=>a(!i),t[6]=i,t[7]=l);let u=n.nodeName||n.nodeType,d;t[8]===u?d=t[9]:(d=(0,X.jsx)(`span`,{className:`truncate font-medium text-sm transition-colors group-hover:text-foreground`,children:u}),t[8]=u,t[9]=d);let f;t[10]===n.status?f=t[11]:(f=h7(n.status),t[10]=n.status,t[11]=f);let p;t[12]===f?p=t[13]:(p=(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:f}),t[12]=f,t[13]=p);let m;t[14]===n.duration?m=t[15]:(m=n.duration?(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground text-xs tabular-nums`,children:_7(n.duration)}):null,t[14]=n.duration,t[15]=m);let h;t[16]!==d||t[17]!==p||t[18]!==m?(h=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d,p,m]}),t[16]=d,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==h||t[21]!==l?(g=(0,X.jsx)(`button`,{className:`group w-full text-left`,onClick:l,type:`button`,children:h}),t[20]=h,t[21]=l,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==n.error||t[25]!==n.input||t[26]!==n.nodeType||t[27]!==n.output?(_=i?(0,X.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[n.input!==null&&n.input!==void 0?(0,X.jsx)(b7,{copyData:n.input,title:`Input`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(y7,{data:n.input})})}):null,n.output!==null&&n.output!==void 0?(0,X.jsx)(yye,{actionType:n.nodeType,input:n.input,output:n.output}):null,n.error?(0,X.jsx)(b7,{copyData:n.error,defaultExpanded:!0,isError:!0,title:`Error`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border border-destructive/20 bg-destructive/5 p-3 font-mono text-destructive text-xs leading-relaxed`,children:n.error})}):null,n.input||n.output||n.error?null:(0,X.jsx)(`div`,{className:`rounded-lg border bg-muted/30 py-4 text-center text-muted-foreground text-xs`,children:`No data recorded`})]}):null,t[23]=i,t[24]=n.error,t[25]=n.input,t[26]=n.nodeType,t[27]=n.output,t[28]=_):_=t[28];let v;t[29]!==g||t[30]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 pb-4`,children:[g,_]}),t[29]=g,t[30]=_,t[31]=v):v=t[31];let y;return t[32]!==o||t[33]!==v||t[34]!==c?(y=(0,X.jsxs)(`div`,{className:`relative flex gap-3`,children:[o,c,v]}),t[32]=o,t[33]=v,t[34]=c,t[35]=y):y=t[35],y}function wye(e){let t=(0,Z.c)(7),{logs:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`py-8 text-center text-muted-foreground text-xs`,children:`No steps recorded`}),t[0]=e):e=t[0],e}let r;if(t[1]!==n){let e;t[3]===n.length?e=t[4]:(e=(e,t)=>(0,X.jsx)(Cye,{isLast:t===n.length-1,log:e},e.id),t[3]=n.length,t[4]=e),r=n.map(e),t[1]=n,t[2]=r}else r=t[2];let i;return t[5]===r?i=t[6]:(i=(0,X.jsx)(`div`,{className:`pl-1`,children:r}),t[5]=r,t[6]=i),i}function Tye(e){let t=(0,Z.c)(32),{execution:n,runNumber:r,notice:i,logs:a,events:o,waits:s,isCanceling:c,isResuming:l,onBack:u,onCancel:d,onResume:f}=e,p;t[0]===a?p=t[1]:(p=a.toSorted(Dye),t[0]=a,t[1]=p);let m=p,h;t[2]===u?h=t[3]:(h={onBack:u,type:`back`},t[2]=u,t[3]=h);let g;t[4]!==n.status||t[5]!==c||t[6]!==d?(g=o7(n.status)?{isCanceling:c,onCancel:d,type:`cancel`}:{type:`spacer`},t[4]=n.status,t[5]=c,t[6]=d,t[7]=g):g=t[7];let _;t[8]!==n||t[9]!==r||t[10]!==h||t[11]!==g?(_=(0,X.jsx)(S7,{execution:n,leading:h,runNumber:r,showStartEventName:!0,trailing:g}),t[8]=n,t[9]=r,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v;t[13]===i?v=t[14]:(v=i?(0,X.jsx)(`p`,{className:`rounded-md border bg-muted/30 p-2 text-muted-foreground text-xs`,children:i}):null,t[13]=i,t[14]=v);let y;if(t[15]!==l||t[16]!==f||t[17]!==s){let e;t[19]!==l||t[20]!==f?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-1.5 rounded-md border bg-muted/30 p-2`,children:[(0,X.jsxs)(`p`,{className:`font-medium text-xs`,children:[`Parked at `,e.nodeName]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.subscribedEvents.length>0?`Waiting for ${e.subscribedEvents.join(`, `)}`:`Waiting on a timer`}),e.resumeToken?(0,X.jsx)(zv,{disabled:l,onClick:()=>f(e.resumeToken??``),size:`sm`,type:`button`,variant:`outline`,children:`Resume now`}):null]},e.id),t[19]=l,t[20]=f,t[21]=e):e=t[21],y=s.map(e),t[15]=l,t[16]=f,t[17]=s,t[18]=y}else y=t[18];let b;t[22]===m?b=t[23]:(b=(0,X.jsx)(wye,{logs:m}),t[22]=m,t[23]=b);let x;t[24]===o?x=t[25]:(x=o.length>0?(0,X.jsx)(b7,{title:`Audit Events`,children:(0,X.jsx)(`div`,{className:`space-y-2`,children:o.map(Eye)})}):null,t[24]=o,t[25]=x);let S;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==b||t[30]!==x?(S=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v,y,b,x]}),t[26]=_,t[27]=v,t[28]=y,t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Eye(e){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate font-medium text-xs`,children:e.message}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.eventType})]}),(0,X.jsx)(`div`,{className:`ml-3 shrink-0 text-xs text-muted-foreground`,children:d7(e.createdAt)})]},e.id)}function Dye(e,t){return new Date(e.startedAt).getTime()-new Date(t.startedAt).getTime()}function Oye(e){let t=(0,Z.c)(10),{executions:n,selectedId:r,onSelect:i}=e,a;if(t[0]!==n||t[1]!==i||t[2]!==r){let e;t[4]!==n.length||t[5]!==i||t[6]!==r?(e=(e,t)=>{let a=r===e.id,o=n.length-t;return(0,X.jsx)(S7,{execution:e,leading:{type:`spacer`},onClick:()=>i(e.id),runNumber:o,selected:a,trailing:{type:`spacer`}},e.id)},t[4]=n.length,t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[0]=n,t[1]=i,t[2]=r,t[3]=a}else a=t[3];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`divide-y`,children:a}),t[8]=a,t[9]=o),o}var C7=2e3,w7=50,kye=`This run has left the runs list, so what it shows stops here. A newer start supersedes the runs going for the same entity, and the list holds the newest 50.`,Aye=ma(`/workflows/$workflowId`);function jye(){let e=(0,Z.c)(80),t=wA(Q0),n=wA(O2),r=Fe(),{executionId:i}=Aye.useSearch(),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={from:`/workflows/$workflowId`},e[0]=a):a=e[0];let o=Gi(a),s=c7(),[c,l]=(0,Y.useState)(!1),u=c||i!==void 0,d;e[1]!==t||e[2]!==u?(d=r0.workflow.getExecutions.queryOptions({input:{workflowId:t??``,includeSuperseded:u},select:Xve}),e[1]=t,e[2]=u,e[3]=d):d=e[3];let f=t!==null,p;e[4]!==d||e[5]!==f?(p={...d,enabled:f,staleTime:0,refetchInterval:C7,placeholderData:L},e[4]=d,e[5]=f,e[6]=p):p=e[6];let m=Xe(p),h;e[7]===m.data?.executions?h=e[8]:(h=m.data?.executions??[],e[7]=m.data?.executions,e[8]=h);let g=h,_=m.data?.supersededCount??0,v;e[9]===m.data?.refusedStarts?v=e[10]:(v=m.data?.refusedStarts??[],e[9]=m.data?.refusedStarts,e[10]=v);let y=v,b;e[11]!==i||e[12]!==g?(b=i===void 0?-1:g.findIndex(e=>e.id===i),e[11]=i,e[12]=g,e[13]=b):b=e[13];let x=b,S=x>=0?g[x]:void 0,C=o7(S?.status)?C7:!1,w;e[14]===i?w=e[15]:(w=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:i??``},select:Zve}),e[14]=i,e[15]=w);let T=i!==void 0,E;e[16]!==C||e[17]!==w||e[18]!==T?(E={...w,enabled:T,staleTime:0,refetchInterval:C},e[16]=C,e[17]=w,e[18]=T,e[19]=E):E=e[19];let D=Xe(E),O;e[20]===i?O=e[21]:(O=r0.workflow.getExecutionEvents.queryOptions({input:{executionId:i??``},select:nye}),e[20]=i,e[21]=O);let k=i!==void 0,A;e[22]!==C||e[23]!==O||e[24]!==k?(A={...O,enabled:k,staleTime:0,refetchInterval:C},e[22]=C,e[23]=O,e[24]=k,e[25]=A):A=e[25];let j=Xe(A),M;e[26]===r?M=e[27]:(M=r0.workflow.cancelExecution.mutationOptions({onSuccess:()=>s0(r),meta:{errorMessage:`Failed to cancel run`}}),e[26]=r,e[27]=M);let N=Ze(M),P;e[28]===r?P=e[29]:(P=r0.workflow.resumeWait.mutationOptions({onSuccess:()=>s0(r),meta:{errorMessage:`Failed to resume the run`}}),e[28]=r,e[29]=P);let F=Ze(P),I;e[30]===o?I=e[31]:(I=e=>{o({search:{executionId:e}})},e[30]=o,e[31]=I);let R=I;if(m.isPending&&i===void 0){let t;return e[32]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[32]=t):t=e[32],t}let z;e[33]!==c||e[34]!==_?(z=_>0?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-1 pb-2`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[_===1?`1 run was superseded by a newer start`:`${_} runs were superseded by newer starts`,_>w7?`, of which the newest ${w7} can be shown`:``]}),(0,X.jsx)(zv,{onClick:()=>l(Mye),size:`sm`,type:`button`,variant:`ghost`,children:c?`Hide`:`Show`})]}):null,e[33]=c,e[34]=_,e[35]=z):z=e[35];let B=z;if(i!==void 0){let t=S??D.data?.execution;if(!t){if(!D.isError&&(D.isPending||m.isPending)){let t;return e[36]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[36]=t):t=e[36],t}let t;e[37]===s?t=e[38]:(t=(0,X.jsx)(zv,{"aria-label":`Back to runs list`,onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:`Back`}),e[37]=s,e[38]=t);let n;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This run could not be loaded.`}),e[39]=n):n=e[39];let r;return e[40]===t?r=e[41]:(r=(0,X.jsxs)(`div`,{className:`space-y-2 px-1 py-2`,children:[t,n]}),e[40]=t,e[41]=r),r}let n=x>=0?g.length-x:0,r;e[42]===j.data?r=e[43]:(r=j.data??[],e[42]=j.data,e[43]=r);let i=N.isPending&&N.variables?.executionId===t.id,a;e[44]===D.data?.logs?a=e[45]:(a=D.data?.logs??[],e[44]=D.data?.logs,e[45]=a);let o=S?void 0:kye,c;e[46]===N?c=e[47]:(c=e=>N.mutate({executionId:e}),e[46]=N,e[47]=c);let l;e[48]===F?l=e[49]:(l=e=>F.mutate({token:e}),e[48]=F,e[49]=l);let u;e[50]===D.data?.waits?u=e[51]:(u=D.data?.waits??[],e[50]=D.data?.waits,e[51]=u);let d;return e[52]!==t||e[53]!==s||e[54]!==F.isPending||e[55]!==n||e[56]!==r||e[57]!==i||e[58]!==a||e[59]!==o||e[60]!==c||e[61]!==l||e[62]!==u?(d=(0,X.jsx)(Tye,{events:r,execution:t,isCanceling:i,isResuming:F.isPending,logs:a,notice:o,onBack:s,onCancel:c,onResume:l,runNumber:n,waits:u}),e[52]=t,e[53]=s,e[54]=F.isPending,e[55]=n,e[56]=r,e[57]=i,e[58]=a,e[59]=o,e[60]=c,e[61]=l,e[62]=u,e[63]=d):d=e[63],d}if(g.length===0){let t;e[64]===y?t=e[65]:(t=(0,X.jsx)(f7,{refusedStarts:y}),e[64]=y,e[65]=t);let n;e[66]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,X.jsx)(`div`,{className:`mb-3 rounded-lg border border-dashed p-4`,children:(0,X.jsx)(sy,{className:`size-6 text-muted-foreground`})}),(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:`No runs yet`}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground text-xs`,children:`Execute your workflow to see runs here`})]}),e[66]=n):n=e[66];let r;return e[67]!==B||e[68]!==t?(r=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,t,n]}),e[67]=B,e[68]=t,e[69]=r):r=e[69],r}let V;e[70]===y?V=e[71]:(V=(0,X.jsx)(f7,{refusedStarts:y}),e[70]=y,e[71]=V);let H;e[72]!==g||e[73]!==R||e[74]!==n?(H=(0,X.jsx)(Oye,{executions:g,onSelect:R,selectedId:n}),e[72]=g,e[73]=R,e[74]=n,e[75]=H):H=e[75];let U;return e[76]!==B||e[77]!==V||e[78]!==H?(U=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,V,H]}),e[76]=B,e[77]=V,e[78]=H,e[79]=U):U=e[79],U}function Mye(e){return!e}function T7(){let e=(0,Z.c)(3),t=wA(E2),n=TA(g2),r;return e[0]!==n||e[1]!==t?(r={validActiveTab:t,setActiveTab:n},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function Nye(){let{validActiveTab:e}=T7(),t=wA(H4),n=wA(U4);return e===`runs`?`Runs`:t?`Properties`:n?`Connection`:`Workflow`}function Pye(e){let t=(0,Z.c)(27),{placement:n,activeTab:r,onSelect:i,propertiesLabel:a,showRuns:o}=e;if(n===`bottom`){let e=`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`properties`?`text-foreground`:`text-muted-foreground`}`,n;t[0]===i?n=t[1]:(n=()=>i(`properties`),t[0]=i,t[1]=n);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(uy,{className:`size-5`}),t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==e||t[5]!==n?(c=(0,X.jsxs)(`button`,{className:e,onClick:n,type:`button`,children:[s,a]}),t[3]=a,t[4]=e,t[5]=n,t[6]=c):c=t[6];let l;t[7]!==r||t[8]!==i||t[9]!==o?(l=o?(0,X.jsxs)(`button`,{className:`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`runs`?`text-foreground`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:[(0,X.jsx)(sy,{className:`size-5`}),`Runs`]}):null,t[7]=r,t[8]=i,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==c||t[12]!==l?(u=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-around border-t bg-background pb-safe`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}let s=`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`properties`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,c;t[14]===i?c=t[15]:(c=()=>i(`properties`),t[14]=i,t[15]=c);let l;t[16]!==a||t[17]!==s||t[18]!==c?(l=(0,X.jsx)(`button`,{className:s,onClick:c,type:`button`,children:a}),t[16]=a,t[17]=s,t[18]=c,t[19]=l):l=t[19];let u;t[20]!==r||t[21]!==i||t[22]!==o?(u=o?(0,X.jsx)(`button`,{className:`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`runs`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:`Runs`}):null,t[20]=r,t[21]=i,t[22]=o,t[23]=u):u=t[23];let d;return t[24]!==l||t[25]!==u?(d=(0,X.jsx)(`div`,{className:`shrink-0 border-b px-4 py-2.5`,children:(0,X.jsxs)(`div`,{className:`inline-flex h-9 w-full items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground`,children:[l,u]})}),t[24]=l,t[25]=u,t[26]=d):d=t[26],d}function E7(e){let t=(0,Z.c)(82),{frame:n}=e,{updateConfig:r,refreshRuns:i,deleteRuns:a}=qve(),{validActiveTab:o,setActiveTab:s}=T7(),c=wA(H4),l=wA(U4),u=wA(Q4),d=wA($4),f=wA(T2),p=wA(Q0),m=wA($0),h=TA(pde),[g,_]=EA(n2),v=wA(t2),y=TA(m3),b=TA(h3),x=TA(X4),S=TA(Xfe),C=TA(Z4),w=TA(fpe),T=TA(g3),E=l0(),[D,O]=EA(a3),k,A,j,M,N;if(t[0]!==T||t[1]!==p||t[2]!==m||t[3]!==C||t[4]!==b||t[5]!==a||t[6]!==w||t[7]!==E||t[8]!==d||t[9]!==n||t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==v||t[14]!==D||t[15]!==u||t[16]!==h||t[17]!==l||t[18]!==c||t[19]!==s||t[20]!==S||t[21]!==O||t[22]!==_||t[23]!==x||t[24]!==y||t[25]!==o||t[26]!==g){let e;t[32]===c?e=t[33]:(e=e=>e.id===c,t[32]=c,t[33]=e);let P=u.find(e),F;if(t[34]!==d||t[35]!==l){let e;t[37]===l?e=t[38]:(e=e=>e.id===l,t[37]=l,t[38]=e),F=d.find(e),t[34]=d,t[35]=l,t[36]=F}else F=t[36];let I=F,L;t[39]===u?L=t[40]:(L=u.filter(Iye),t[39]=u,t[40]=L);let R=L,z;t[41]===d?z=t[42]:(z=d.filter(Fye),t[41]=d,t[42]=z);let B=z,V=R.length+B.length>1,H;t[43]!==B.length||t[44]!==R.length?(H=[],R.length>0&&H.push(`${R.length} ${R.length===1?`step`:`steps`}`),B.length>0&&H.push(`${B.length} ${B.length===1?`connection`:`connections`}`),t[43]=B.length,t[44]=R.length,t[45]=H):H=t[45];let U=H.join(` and `),W=e=>{P&&y({id:P.id,data:{label:e}})},G=e=>{P&&y({id:P.id,data:{description:e}})},K=P&&D0(P)?B0(u).has(P.id):!1,q=!!(P&&!P.parentId&&(P.data.type===`action`||D0(P))),J=P?D0(P)?K:P.data.enabled===!1:!1,ee=()=>{if(P){if(D0(P)){S({groupId:P.id,enabled:K});return}y({id:P.id,data:{enabled:P.data.enabled===!1}})}},te;t[46]!==h||t[47]!==_?(te=async e=>{let t=await h(e);t&&_(t.message||`Failed to update workflow name`)},t[46]=h,t[47]=_,t[48]=te):te=t[48];let ne=te,re=()=>{if(!P)return;let e=P.id;n.confirm({title:`Delete Step`,message:`Are you sure you want to delete this step? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{b(e),n.dismiss?.()}})},ie;t[49]!==C||t[50]!==n||t[51]!==l?(ie=()=>{l&&n.confirm({title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{C(l),n.dismiss?.()}})},t[49]=C,t[50]=n,t[51]=l,t[52]=ie):ie=t[52];let ae=ie,oe;t[53]!==w||t[54]!==n||t[55]!==U?(oe=()=>{n.confirm({title:`Delete Selected Items`,message:`Are you sure you want to delete ${U}? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{w(),n.dismiss?.()}})},t[53]=w,t[54]=n,t[55]=U,t[56]=oe):oe=t[56];let se=oe,ce;t[57]!==p||t[58]!==a||t[59]!==n?(ce=()=>{n.confirm({title:`Delete All Runs`,message:`Are you sure you want to delete all workflow runs? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{p&&a.mutate({workflowId:p})}})},t[57]=p,t[58]=a,t[59]=n,t[60]=ce):ce=t[60];let le=ce,ue;t[61]!==T||t[62]!==n?(ue=()=>{n.confirm({title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,onConfirm:()=>T()})},t[61]=T,t[62]=n,t[63]=ue):ue=t[63];let de=ue,fe;t[64]!==p||t[65]!==m||t[66]!==E||t[67]!==n?(fe=()=>{n.confirm({title:`Delete Workflow`,message:`Are you sure you want to delete "${m}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,onConfirm:()=>{p&&E.mutate({workflowId:p},{onSuccess:()=>n.dismiss?.()})}})},t[64]=p,t[65]=m,t[66]=E,t[67]=n,t[68]=fe):fe=t[68];let pe=fe,me=P?.data.type===`action`&&!P.data.config?.actionType&&v,he;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`You are viewing a public workflow. Duplicate it to make changes.`})}),t[69]=he):he=t[69];let ge=he,_e=()=>V?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{children:`Selection`}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[U,` selected`]})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:se,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):I&&!P?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-id`,children:`Connection ID`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-id`,value:I.id})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-source`,children:`Source`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-source`,value:I.source})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-target`,children:`Target`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-target`,value:I.target})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:ae,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):P?me?(0,X.jsx)(`div`,{className:`px-4 pt-4`,children:(0,X.jsx)(fve,{disabled:f,isNewlyCreated:P.id===D,onSelectAction:e=>{r({actionType:e}),P.id===D&&O(null)}},P.id)}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[P.data.type===`group`?(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Lookups and a Condition in a single-entry, single-exit frame. Lookups may run side by side and join at the Condition. True continues; False with no outgoing edge ends that path.`}):null,P.data.type===`lifecycle`?(0,X.jsx)(Bve,{config:P.data.config||{},disabled:f||!v,onUpdateConfig:r}):null,P.data.type===`action`&&!P.data.config?.actionType?(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No action configured for this step.`})}):null,P.data.type===`action`&&P.data.config?.actionType?(0,X.jsx)(E_e,{config:P.data.config||{},disabled:f||!v,isOwner:v,onUpdateConfig:r},P.id):null,P.data.type!==`action`||P.data.config?.actionType?(0,X.jsxs)(`div`,{className:P.data.type===`lifecycle`?`space-y-3 rounded-md border border-muted/70 bg-muted/20 p-3`:`space-y-4`,children:[P.data.type===`lifecycle`?(0,X.jsx)(`p`,{className:`font-medium text-muted-foreground text-sm`,children:`Node Metadata`}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`label`,children:`Label`}),(0,X.jsx)(wX,{disabled:f||!v,id:`label`,onChange:e=>W(e.target.value),value:P.data.label})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`description`,children:`Description`}),(0,X.jsx)(wX,{disabled:f||!v,id:`description`,onChange:e=>G(e.target.value),placeholder:`Optional description`,value:P.data.description||``})]})]}):null,v?null:ge,v&&P.parentId?(0,X.jsx)(`p`,{className:`pt-4 text-muted-foreground text-xs`,children:`This step runs with its Group. Select the frame to switch it off.`}):null,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[q?(0,X.jsx)(zv,{onClick:ee,size:`sm`,variant:`outline`,children:J?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Disabled`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Enabled`]})}):null,P4(P)?(0,X.jsxs)(zv,{onClick:()=>x(P.id),size:`sm`,variant:`outline`,children:[(0,X.jsx)(my,{className:`mr-2 size-4`}),`Ungroup`]}):null,M4([P])?null:(0,X.jsxs)(zv,{onClick:re,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`workflow-name`,children:`Workflow Name`}),(0,X.jsx)(wX,{className:g?`border-destructive`:void 0,disabled:!v,id:`workflow-name`,onChange:e=>ne(e.target.value),value:m}),g?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:g}):null]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`workflow-id`,children:`Workflow ID`}),(0,X.jsx)(wX,{disabled:!0,id:`workflow-id`,value:p||`Not saved`})]}),v?null:ge,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:de,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear`]}),(0,X.jsxs)(zv,{onClick:pe,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}),ve=P||I||V?`Properties`:`Workflow`,ye;t[70]!==n.tabs||t[71]!==v||t[72]!==s||t[73]!==ve||t[74]!==o?(ye=(0,X.jsx)(Pye,{activeTab:o,onSelect:s,placement:n.tabs,propertiesLabel:ve,showRuns:v}),t[70]=n.tabs,t[71]=v,t[72]=s,t[73]=ve,t[74]=o,t[75]=ye):ye=t[75],N=ye,k=`flex min-h-0 flex-1 flex-col`,A=`properties-panel`,j=n.tabs===`top`?N:null,M=o===`properties`?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-gutter:stable_both-edges]`,children:_e()}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:[(0,X.jsxs)(zv,{onClick:i,size:`sm`,variant:`outline`,children:[(0,X.jsx)(Dte,{className:`mr-2 size-4`}),`Refresh`]}),(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:le,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear All`]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable_both-edges]`,children:(0,X.jsx)(jye,{})})]}),t[0]=T,t[1]=p,t[2]=m,t[3]=C,t[4]=b,t[5]=a,t[6]=w,t[7]=E,t[8]=d,t[9]=n,t[10]=i,t[11]=r,t[12]=f,t[13]=v,t[14]=D,t[15]=u,t[16]=h,t[17]=l,t[18]=c,t[19]=s,t[20]=S,t[21]=O,t[22]=_,t[23]=x,t[24]=y,t[25]=o,t[26]=g,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31];let P=n.tabs===`bottom`?N:null,F;return t[76]!==k||t[77]!==A||t[78]!==j||t[79]!==M||t[80]!==P?(F=(0,X.jsxs)(`div`,{className:k,"data-testid":A,children:[j,M,P]}),t[76]=k,t[77]=A,t[78]=j,t[79]=M,t[80]=P,t[81]=F):F=t[81],F}function Fye(e){return e.selected}function Iye(e){return e.selected}function D7(e){let t=(0,Z.c)(16),{overlayId:n}=e,{push:r,closeAll:i}=RY(),a=Nye(),o=jY(),s;t[0]!==i||t[1]!==o?(s=()=>{o||i()},t[0]=i,t[1]=o,t[2]=s):s=t[2],vY(o,s);let c;t[3]===r?c=t[4]:(c=e=>{let{title:t,message:n,confirmLabel:i,onConfirm:a}=e;return r(CX,{title:t,message:n,confirmLabel:i,confirmVariant:`destructive`,destructive:!0,onConfirm:a})},t[3]=r,t[4]=c);let l;t[5]!==i||t[6]!==c?(l={confirm:c,dismiss:i,tabs:`bottom`},t[5]=i,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]!==n||t[9]!==a?(d=(0,X.jsx)(xX,{overlayId:n,title:a}),t[8]=n,t[9]=a,t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,X.jsx)(E7,{frame:u}),t[11]=u,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-full max-h-[80vh] flex-col`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function O7(){let e=(0,Z.c)(11),{open:t,push:n}=RY(),r=l7(),i;e[0]===r?i=e[1]:(i=()=>{AY()&&r()},e[0]=r,e[1]=i);let a=i,o;e[2]!==a||e[3]!==t?(o=()=>{t(D7,{},{onClose:a})},e[2]=a,e[3]=t,e[4]=o):o=e[4];let s=o,c;e[5]!==a||e[6]!==n?(c=()=>{n(D7,{},{onClose:a})},e[5]=a,e[6]=n,e[7]=c):c=e[7];let l=c,u;return e[8]!==s||e[9]!==l?(u={openSheet:s,pushSheet:l},e[8]=s,e[9]=l,e[10]=u):u=e[10],u}function Lye(){let e=(0,Z.c)(2),t=rE(Rye),n;return e[0]===t?n=e[1]:(n=()=>{document.documentElement.style.setProperty(`--rf-zoom`,String(t))},e[0]=t,e[1]=n),vY(t,n),null}function Rye(e){return e.transform[2]}var zye=e=>{let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`Backspace`,`Delete`],t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=[`Meta`,`Control`,`Shift`],t[4]=a):a=t[4];let o,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(Lye,{}),s=(0,X.jsx)(tk,{bgColor:`var(--sidebar)`,color:`var(--border)`,gap:24,size:2}),t[5]=o,t[6]=s):(o=t[5],s=t[6]);let c;return t[7]!==n||t[8]!==r?(c=(0,X.jsxs)(WO,{deleteKeyCode:i,fitView:!0,multiSelectionKeyCode:a,panActivationKeyCode:null,selectionOnDrag:!1,zoomOnDoubleClick:!1,zoomOnPinch:!0,...r,children:[o,s,n]}),t[7]=n,t[8]=r,t[9]=c):c=t[9],c},Bye=16,Vye=16;function k7(e){return mT({...e,borderRadius:Bye,offset:Vye})}var Hye=e=>{let t=(0,Z.c)(15),{fromX:n,fromY:r,fromPosition:i,toX:a,toY:o,toPosition:s}=e,c;t[0]!==i||t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==o?(c=k7({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:o,targetPosition:s}),t[0]=i,t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=o,t[6]=c):c=t[6];let[l]=c,u;t[7]===l?u=t[8]:(u=(0,X.jsx)(`path`,{className:`animated`,d:l,fill:`none`,stroke:`var(--color-ring)`,strokeDasharray:`5, 5`,strokeWidth:1}),t[7]=l,t[8]=u);let d;t[9]!==a||t[10]!==o?(d=(0,X.jsx)(`circle`,{cx:a,cy:o,fill:`#fff`,r:3,stroke:`var(--color-ring)`,strokeWidth:1}),t[9]=a,t[10]=o,t[11]=d):d=t[11];let f;return t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`g`,{children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14],f},Uye=d_(`flex w-fit shrink-0 items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function A7(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=Q(Uye({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,X.jsx)(`div`,{className:a,"data-orientation":r,"data-slot":`button-group`,role:`group`,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var Wye=e=>{let t=(0,Z.c)(33),{onReflow:n,canReflow:r}=e,i=r===void 0||r,{zoomIn:a,zoomOut:o,fitView:s}=RE(),[c,l]=EA(_2),u;t[0]===a?u=t[1]:(u=()=>{a()},t[0]=a,t[1]=u);let d=u,f;t[2]===o?f=t[3]:(f=()=>{o()},t[2]=o,t[3]=f);let p=f,m;t[4]===s?m=t[5]:(m=()=>{s({padding:.2,duration:300})},t[4]=s,t[5]=m);let h=m,g;t[6]!==l||t[7]!==c?(g=()=>{l(!c)},t[6]=l,t[7]=c,t[8]=g):g=t[8];let _=g,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Pte,{className:`size-4`}),t[9]=v):v=t[9];let y;t[10]===d?y=t[11]:(y=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:d,size:`icon`,title:`Zoom in`,variant:`secondary`,children:v}),t[10]=d,t[11]=y);let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(Fte,{className:`size-4`}),t[12]=b):b=t[12];let x;t[13]===p?x=t[14]:(x=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:p,size:`icon`,title:`Zoom out`,variant:`secondary`,children:b}),t[13]=p,t[14]=x);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(xte,{className:`size-4`}),t[15]=S):S=t[15];let C;t[16]===h?C=t[17]:(C=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:h,size:`icon`,title:`Fit view`,variant:`secondary`,children:S}),t[16]=h,t[17]=C);let w=c?`Hide minimap`:`Show minimap`,T;t[18]===c?T=t[19]:(T=c?(0,X.jsx)(bte,{className:`size-4`}):(0,X.jsx)(yte,{className:`size-4`}),t[18]=c,t[19]=T);let E;t[20]!==_||t[21]!==w||t[22]!==T?(E=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:_,size:`icon`,title:w,variant:`secondary`,children:T}),t[20]=_,t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==i||t[25]!==n?(D=n?(0,X.jsx)(zv,{"aria-label":`Reflow nodes`,className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:!i,onClick:n,size:`icon`,title:`Reflow nodes`,variant:`secondary`,children:(0,X.jsx)(Ete,{className:`size-4`})}):null,t[24]=i,t[25]=n,t[26]=D):D=t[26];let O;return t[27]!==C||t[28]!==E||t[29]!==D||t[30]!==y||t[31]!==x?(O=(0,X.jsxs)(A7,{orientation:`vertical`,children:[y,x,C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=y,t[31]=x,t[32]=O):O=t[32],O};function j7(e){return new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function Gye(e){navigator.clipboard.writeText(e),Ty.success(`Copied to clipboard`)}function Kye(e){let t=(0,Z.c)(19),{overlayId:n,onCreated:r}=e,{pop:i}=RY(),a=Fe(),[o,s]=(0,Y.useState)(``),c;t[0]!==r||t[1]!==i||t[2]!==a?(c=r0.apiKey.create.mutationOptions({onSuccess:async e=>{r(e.key),Ty.success(`API key created successfully`),await a.invalidateQueries({queryKey:r0.apiKey.key()}),i()},meta:{errorMessage:`Failed to create API key`}}),t[0]=r,t[1]=i,t[2]=a,t[3]=c):c=t[3];let l=Ze(c),u;t[4]!==l||t[5]!==o?(u=()=>l.mutate({name:o||null}),t[4]=l,t[5]=o,t[6]=u):u=t[6];let d;t[7]!==l.isPending||t[8]!==u?(d=[{label:`Create`,onClick:u,loading:l.isPending}],t[7]=l.isPending,t[8]=u,t[9]=d):d=t[9];let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(`p`,{className:`mb-4 text-muted-foreground text-sm`,children:`Create a new API key for webhook authentication`}),t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(TX,{htmlFor:`key-name`,children:`Label (optional)`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>s(e.target.value),t[12]=m):m=t[12];let h;t[13]===o?h=t[14]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,(0,X.jsx)(wX,{id:`key-name`,onChange:m,placeholder:`e.g., Production, Testing`,value:o})]}),t[13]=o,t[14]=h);let g;return t[15]!==n||t[16]!==d||t[17]!==h?(g=(0,X.jsxs)(SX,{actions:d,overlayId:n,title:`Create API Key`,children:[f,h]}),t[15]=n,t[16]=d,t[17]=h,t[18]=g):g=t[18],g}function qye(e){let t=(0,Z.c)(26),{overlayId:n}=e,{push:r,closeAll:i}=RY(),a=Fe(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...r0.apiKey.getAll.queryOptions({input:{}}),meta:{errorMessage:`Failed to load API keys`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,[d,f]=(0,Y.useState)(null),p;t[3]===a?p=t[4]:(p=r0.apiKey.delete.mutationOptions({onSuccess:async()=>{Ty.success(`API key deleted`),await a.invalidateQueries({queryKey:r0.apiKey.key()})},meta:{errorMessage:`Failed to delete API key`}}),t[3]=a,t[4]=p);let m=Ze(p),h=m.isPending?m.variables?.keyId:void 0,g;t[5]!==m||t[6]!==r?(g=e=>{r(CX,{title:`Delete API Key`,message:`Are you sure you want to delete this API key? Any webhooks using this key will stop working immediately.`,confirmLabel:`Delete`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>m.mutate({keyId:e})})},t[5]=m,t[6]=r,t[7]=g):g=t[7];let _=g,v;t[8]===r?v=t[9]:(v={label:`New API Key`,variant:`outline`,onClick:()=>r(Kye,{onCreated:f})},t[8]=r,t[9]=v);let y;t[10]===i?y=t[11]:(y={label:`Done`,onClick:i},t[10]=i,t[11]=y);let b;t[12]!==v||t[13]!==y?(b=[v,y],t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys for webhook authentication`}),t[15]=x):x=t[15];let S;t[16]!==u||t[17]!==h||t[18]!==c||t[19]!==d||t[20]!==_?(S=c?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[d&&(0,X.jsxs)(`div`,{className:`rounded-md border border-warning/50 bg-warning/10 p-3`,children:[(0,X.jsx)(`p`,{className:`mb-2 font-medium text-sm text-warning`,children:`Copy your API key now. You won't be able to see it again!`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 font-mono text-xs`,children:d}),(0,X.jsx)(zv,{onClick:()=>Gye(d),size:`sm`,variant:`outline`,children:(0,X.jsx)($v,{className:`size-4`})})]}),(0,X.jsx)(zv,{className:`mt-2`,onClick:()=>f(null),size:`sm`,variant:`ghost`,children:`Dismiss`})]}),u.length===0?(0,X.jsxs)(`div`,{className:`py-8 text-center text-muted-foreground text-sm`,children:[(0,X.jsx)(iy,{className:`mx-auto mb-2 size-8 opacity-50`}),(0,X.jsx)(`p`,{children:`No API keys yet`}),(0,X.jsx)(`p`,{className:`text-xs`,children:`Create an API key to authenticate webhook requests`})]}):(0,X.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:[e.keyPrefix,`...`]}),e.name&&(0,X.jsx)(`span`,{className:`truncate text-sm`,children:e.name})]}),(0,X.jsxs)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:[`Created `,j7(e.createdAt),e.lastUsedAt&&` · Last used ${j7(e.lastUsedAt)}`]})]}),(0,X.jsx)(zv,{disabled:h===e.id,onClick:()=>_(e.id),size:`sm`,variant:`ghost`,children:h===e.id?(0,X.jsx)(_y,{className:`size-4`}):(0,X.jsx)(fy,{className:`size-4 text-destructive`})})]},e.id))})]}),t[16]=u,t[17]=h,t[18]=c,t[19]=d,t[20]=_,t[21]=S):S=t[21];let C;return t[22]!==n||t[23]!==S||t[24]!==b?(C=(0,X.jsxs)(SX,{actions:b,overlayId:n,title:`API Keys`,children:[x,S]}),t[22]=n,t[23]=S,t[24]=b,t[25]=C):C=t[25],C}function Jye(e){let t=(0,Z.c)(24),{filter:n}=e,r=n===void 0?``:n,i=yy(),{push:a}=RY(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...i0(),meta:{errorMessage:`Failed to load integrations`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=r0.integration.testConnection.mutationOptions({onSuccess:S3,meta:{errorMessage:`Connection test failed`}}),t[3]=d):d=t[3];let f=Ze(d),p;if(t[4]!==i||t[5]!==r||t[6]!==u){let e=r.toLowerCase(),n;t[8]===i?n=t[9]:(n=e=>{let t=Fy(i,e.type);return{...e,label:t?.label??e.type,hasTest:t?.hasTest===!0,known:t!==void 0}},t[8]=i,t[9]=n),p=u.map(n).filter(t=>!r||t.label.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)).toSorted(Yye),t[4]=i,t[5]=r,t[6]=u,t[7]=p}else p=t[7];let m=p,h;t[10]===a?h=t[11]:(h=e=>{a(w3,{integration:e})},t[10]=a,t[11]=h);let g=h,_;t[12]===a?_=t[13]:(_=e=>{a(T3,{integration:e})},t[12]=a,t[13]=_);let v=_,y=f.isPending?f.variables?.integrationId:void 0;if(c){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}),t[14]=e):e=t[14],e}let b;t[15]!==v||t[16]!==g||t[17]!==u.length||t[18]!==m||t[19]!==f||t[20]!==y?(b=()=>u.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections configured yet`})}):m.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections match your filter`})}):(0,X.jsx)(`div`,{className:`space-y-1`,children:m.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b3,{className:`size-4`,integration:e.type}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:e.name}),e.known?null:(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Not available in this build`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.hasTest&&(0,X.jsx)(zv,{className:`h-7 px-2`,disabled:y===e.id,onClick:()=>f.mutate({integrationId:e.id}),size:`sm`,variant:`outline`,children:y===e.id?(0,X.jsx)(_y,{className:`size-3`}):(0,X.jsx)(`span`,{className:`text-xs`,children:`Test`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>g(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(oy,{className:`size-3`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>v(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(fy,{className:`size-3`})})]})]},e.id))}),t[15]=v,t[16]=g,t[17]=u.length,t[18]=m,t[19]=f,t[20]=y,t[21]=b):b=t[21];let x=b,S;return t[22]===x?S=t[23]:(S=(0,X.jsx)(`div`,{className:`space-y-1`,children:x()}),t[22]=x,t[23]=S),S}function Yye(e,t){let n=e.label.localeCompare(t.label);return n===0?e.name.localeCompare(t.name):n}function Xye(e){let t=(0,Z.c)(25),{overlayId:n}=e,{push:r,closeAll:i}=RY(),[a,o]=(0,Y.useState)(``),s;t[0]===r?s=t[1]:(s=()=>{r(bpe,{})},t[0]=r,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=()=>i(),t[2]=i,t[3]=l);let u=l,d;t[4]===c?d=t[5]:(d={label:`Add Connection`,variant:`outline`,onClick:c},t[4]=c,t[5]=d);let f;t[6]===u?f=t[7]:(f={label:`Done`,onClick:u},t[6]=u,t[7]=f);let p;t[8]!==d||t[9]!==f?(p=[d,f],t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys and credentials used by your workflows`}),t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>o(e.target.value),t[13]=g):g=t[13];let _;t[14]===a?_=t[15]:(_=(0,X.jsxs)(`div`,{className:`relative`,children:[h,(0,X.jsx)(wX,{className:`pl-9`,onChange:g,placeholder:`Filter connections...`,value:a})]}),t[14]=a,t[15]=_);let v;t[16]===a?v=t[17]:(v=(0,X.jsx)(`div`,{className:`max-h-[300px] overflow-y-auto`,children:(0,X.jsx)(Jye,{filter:a})}),t[16]=a,t[17]=v);let y;t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20];let b;return t[21]!==n||t[22]!==y||t[23]!==p?(b=(0,X.jsxs)(SX,{actions:p,overlayId:n,title:`Connections`,children:[m,y]}),t[21]=n,t[22]=y,t[23]=p,t[24]=b):b=t[24],b}var Zye=()=>{let e=(0,Z.c)(25),{theme:t,setTheme:n}=eX(),{open:r}=RY(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(U5,{render:(0,X.jsx)(zv,{className:`h-9`,size:`sm`,variant:`outline`}),children:`Settings`}),e[0]=i):i=e[0];let a;e[1]===r?a=e[2]:(a=()=>r(Xye),e[1]=r,e[2]=a);let o,s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(wte,{className:`size-4`}),s=(0,X.jsx)(`span`,{children:`Connections`}),e[3]=o,e[4]=s):(o=e[3],s=e[4]);let c;e[5]===a?c=e[6]:(c=(0,X.jsxs)(G5,{onClick:a,children:[o,s]}),e[5]=a,e[6]=c);let l;e[7]===r?l=e[8]:(l=()=>r(qye),e[7]=r,e[8]=l);let u,d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(iy,{className:`size-4`}),d=(0,X.jsx)(`span`,{children:`API Keys`}),e[9]=u,e[10]=d):(u=e[9],d=e[10]);let f;e[11]===l?f=e[12]:(f=(0,X.jsxs)(G5,{onClick:l,children:[u,d]}),e[11]=l,e[12]=f);let p;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(q5,{}),e[13]=p):p=e[13];let m;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsxs)(ive,{children:[(0,X.jsx)(jte,{className:`size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,X.jsx)(Ste,{className:`absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,X.jsx)(`span`,{children:`Theme`})]}),e[14]=m):m=e[14];let h,g,_;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(K5,{value:`light`,children:`Light`}),g=(0,X.jsx)(K5,{value:`dark`,children:`Dark`}),_=(0,X.jsx)(K5,{value:`system`,children:`System`}),e[15]=h,e[16]=g,e[17]=_):(h=e[15],g=e[16],_=e[17]);let v;e[18]!==n||e[19]!==t?(v=(0,X.jsxs)(rve,{children:[m,(0,X.jsx)(ave,{children:(0,X.jsxs)(nve,{onValueChange:n,value:t,children:[h,g,_]})})]}),e[18]=n,e[19]=t,e[20]=v):v=e[20];let y;return e[21]!==v||e[22]!==c||e[23]!==f?(y=(0,X.jsxs)(H5,{children:[i,(0,X.jsxs)(W5,{align:`end`,className:`w-56`,children:[c,f,p,v]})]}),e[21]=v,e[22]=c,e[23]=f,e[24]=y):y=e[24],y};function Qye(e){let t=(0,Z.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M125.776 0C120.929 1.64945e-05 117 3.9291 117 8.77539V61.4248C117 66.2711 120.929 70.2002 125.776 70.2002H160.875L161.253 70.2051C169.032 70.4023 175.301 76.6734 175.495 84.4531L175.5 84.8252V143.325C175.5 148.171 179.429 152.101 184.276 152.101H219.375L219.753 152.105C227.53 152.303 233.798 158.571 233.995 166.348L234 166.726V225.225C234 230.071 237.929 234 242.776 234H295.425C300.271 234 304.2 230.071 304.2 225.225V172.575C304.2 167.729 300.271 163.8 295.425 163.8H260.25C252.334 163.76 245.905 157.43 245.705 149.553L245.7 149.176V90.6758C245.7 85.8295 241.771 81.9004 236.925 81.9004H201.825C193.874 81.9004 187.405 75.5551 187.205 67.6523L187.2 67.2754V8.77539C187.2 3.9291 183.271 1.64951e-05 178.425 0H125.776Z`}),i=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M67.2755 81.9004C62.4293 81.9004 58.5002 85.8295 58.5002 90.6758V143.325C58.5004 148.171 62.4294 152.101 67.2755 152.101H102.375L102.753 152.105C110.53 152.303 116.798 158.571 116.995 166.348L117 166.726V225.225C117 230.071 120.929 234 125.776 234H178.425C183.271 234 187.2 230.071 187.2 225.225V172.575C187.2 167.729 183.271 163.8 178.425 163.8H143.25C135.334 163.76 128.905 157.43 128.705 149.553L128.7 149.176V90.6758C128.7 85.8295 124.771 81.9004 119.925 81.9004H67.2755Z`}),a=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M8.77454 163.8C3.92844 163.8 0.00012207 167.729 0.00012207 172.575V225.225C0.00012207 230.071 3.92844 234 8.77454 234H61.4249C66.2712 234 70.2003 230.071 70.2003 225.225V172.575C70.2003 167.729 66.2712 163.8 61.4249 163.8H8.77454Z`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,X.jsxs)(`svg`,{className:n,fill:`none`,height:`16`,viewBox:`0 0 305 234`,width:`16`,xmlns:`http://www.w3.org/2000/svg`,children:[r,i,a]}),t[3]=n,t[4]=o),o}function $ye(e){let t=new Set(e.map(e=>e.toLowerCase())),n=`New Workflow`;if(!t.has(`new workflow`))return n;let r=2;for(;t.has(`${n} (${r})`.toLowerCase());)r+=1;return`${n} (${r})`}function M7(e){let t=(0,Z.c)(50),{open:n,onOpenChange:r,existingWorkflowNames:i,onCreated:a}=e,o;t[0]===i?o=t[1]:(o=()=>$ye(i),t[0]=i,t[1]=o);let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(null),d=Fe(),f;if(t[2]!==a||t[3]!==r||t[4]!==d){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{u(e instanceof X1?e.message:`Failed to create workflow`)},t[6]=e):e=t[6],f=r0.workflow.create.mutationOptions({onSuccess:async e=>{await a0(d),await a(e.id),r(!1),Ty.success(`Workflow created`)},onError:e,meta:{errorShownByCaller:!0}}),t[2]=a,t[3]=r,t[4]=d,t[5]=f}else f=t[5];let p=Ze(f),m=p.isPending,h;t[7]!==p||t[8]!==s?(h=()=>{let e=s.trim();if(!e){u(`Workflow name is required.`);return}u(null),p.mutate({name:e,graph:B1({nodes:[],edges:[]})})},t[7]=p,t[8]=s,t[9]=h):h=t[9];let g=h,_;t[10]!==m||t[11]!==r?(_=e=>{e||m||r(!1)},t[10]=m,t[11]=r,t[12]=_):_=t[12];let v=_,y=!m,b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(fY,{children:[(0,X.jsx)(mY,{children:`Create Workflow`}),(0,X.jsx)(hY,{children:`Choose a name for the new workflow.`})]}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(TX,{htmlFor:`create-workflow-name`,children:`Name`}),t[14]=x):x=t[14];let S=l?!0:void 0,C;t[15]===l?C=t[16]:(C=e=>{c(e.target.value),l&&u(null)},t[15]=l,t[16]=C);let w;t[17]===g?w=t[18]:(w=e=>{e.key===`Enter`&&(e.preventDefault(),g())},t[17]=g,t[18]=w);let T;t[19]!==m||t[20]!==w||t[21]!==S||t[22]!==C||t[23]!==s?(T=(0,X.jsx)(wX,{"aria-invalid":S,autoFocus:!0,disabled:m,id:`create-workflow-name`,onChange:C,onKeyDown:w,placeholder:`Workflow name`,value:s}),t[19]=m,t[20]=w,t[21]=S,t[22]=C,t[23]=s,t[24]=T):T=t[24];let E;t[25]===l?E=t[26]:(E=l?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:l}):null,t[25]=l,t[26]=E);let D;t[27]!==T||t[28]!==E?(D=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[x,T,E]}),t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===r?O=t[31]:(O=()=>{r(!1)},t[30]=r,t[31]=O);let k;t[32]!==m||t[33]!==O?(k=(0,X.jsx)(zv,{disabled:m,onClick:O,type:`button`,variant:`outline`,children:`Cancel`}),t[32]=m,t[33]=O,t[34]=k):k=t[34];let A=m?`Creating...`:`Create Workflow`,j;t[35]!==g||t[36]!==m||t[37]!==A?(j=(0,X.jsx)(zv,{disabled:m,onClick:g,type:`button`,children:A}),t[35]=g,t[36]=m,t[37]=A,t[38]=j):j=t[38];let M;t[39]!==k||t[40]!==j?(M=(0,X.jsxs)(pY,{children:[k,j]}),t[39]=k,t[40]=j,t[41]=M):M=t[41];let N;t[42]!==D||t[43]!==M||t[44]!==y?(N=(0,X.jsxs)(dY,{showCloseButton:y,children:[b,D,M]}),t[42]=D,t[43]=M,t[44]=y,t[45]=N):N=t[45];let P;return t[46]!==v||t[47]!==n||t[48]!==N?(P=(0,X.jsx)(cY,{onOpenChange:v,open:n,children:N}),t[46]=v,t[47]=n,t[48]=N,t[49]=P):P=t[49],P}function ebe(e){let t=(0,Z.c)(10),{isPublishing:n,disabled:r,handlePublish:i}=e,a=r||n,o=n?`Publishing...`:`Publish workflow`,s;t[0]===n?s=t[1]:(s=n?(0,X.jsx)(ay,{className:`size-4 animate-spin`,"data-icon":`inline-start`}):(0,X.jsx)(Nte,{className:`size-4`,"data-icon":`inline-start`}),t[0]=n,t[1]=s);let c=n?`Publishing`:`Publish`,l;t[2]===c?l=t[3]:(l=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:c}),t[2]=c,t[3]=l);let u;return t[4]!==i||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==l?(u=(0,X.jsxs)(zv,{className:`relative gap-1.5`,disabled:a,onClick:i,size:`default`,title:o,variant:`default`,children:[s,l]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s,t[8]=l,t[9]=u):u=t[9],u}function tbe(e){let t=(0,Z.c)(9),{state:n,handleSave:r}=e,i;t[0]===n.nodes?i=t[1]:(i=n.nodes.some(nbe),t[0]=n.nodes,t[1]=i);let a=!i||n.isGenerating||n.isSaving,o=n.isSaving?`Saving...`:`Save workflow`,s;t[2]===n.isSaving?s=t[3]:(s=n.isSaving?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(Ote,{className:`size-4`}),t[2]=n.isSaving,t[3]=s);let c;return t[4]!==r||t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,X.jsx)(zv,{className:`relative border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:a,onClick:r,size:`icon`,title:o,variant:`secondary`,children:s}),t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function nbe(e){return e.type!==`add`}function rbe(e){let t=(0,Z.c)(8),{state:n,actions:r}=e,i=n.isExecuting||n.nodes.length===0||n.isGenerating||!n.currentWorkflowId,a;t[0]===r?a=t[1]:(a=()=>r.handleExecute(),t[0]=r,t[1]=a);let o;t[2]===n.isExecuting?o=t[3]:(o=n.isExecuting?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(sy,{className:`size-4`}),t[2]=n.isExecuting,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,X.jsx)(A7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:i,onClick:a,size:`icon`,title:`Run Workflow`,variant:`secondary`,children:o})}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function ibe(e){let t=(0,Z.c)(6),{isDuplicating:n,onDuplicate:r}=e,i;t[0]===n?i=t[1]:(i=n?(0,X.jsx)(ay,{className:`mr-2 size-4 animate-spin`}):(0,X.jsx)($v,{className:`mr-2 size-4`}),t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==r||t[4]!==i?(a=(0,X.jsxs)(zv,{className:`h-9 border hover:bg-secondary dark:hover:bg-secondary`,disabled:n,onClick:r,size:`sm`,title:`Duplicate to your workflows`,variant:`secondary`,children:[i,`Duplicate`]}),t[2]=n,t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function abe(e){let t=(0,Z.c)(79),{workflowId:n,state:r,actions:i}=e,{push:a}=RY(),{openSheet:o}=O7(),[s]=EA(H4),[c]=EA(U4),l=wA(Q4),u=wA($4),d=TA(h3),f=TA(Z4),{screenToFlowPosition:p}=RE(),m=jY(),h=wA(n3),g;if(t[0]!==l||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>e.id===s,t[3]=s,t[4]=e),g=l.find(e),t[0]=l,t[1]=s,t[2]=g}else g=t[2];let _=g,v;if(t[5]!==u||t[6]!==c){let e;t[8]===c?e=t[9]:(e=e=>e.id===c,t[8]=c,t[9]=e),v=u.find(e),t[5]=u,t[6]=c,t[7]=v}else v=t[7];let y=_||v,b;t[10]!==h||t[11]!==r?(b=h||r.isSaving||!r.nodes.some(obe),t[10]=h,t[11]=r,t[12]=b):b=t[12];let x=b;if(n&&!r.isOwner)return null;let S;t[13]!==f||t[14]!==d||t[15]!==a||t[16]!==c||t[17]!==s?(S=()=>{let e=s?`Node`:`Connection`;a(CX,{title:`Delete ${e}`,message:`Are you sure you want to delete this ${e.toLowerCase()}? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s?d(s):c&&f(c)}})},t[13]=f,t[14]=d,t[15]=a,t[16]=c,t[17]=s,t[18]=S):S=t[18];let C=S,w;t[19]!==p||t[20]!==r?(w=()=>{let e=document.querySelector(`.react-flow`);if(!e)return;let t=e.getBoundingClientRect(),n=t.left+t.width/2,i=t.top+t.height/2,a=p({x:n,y:i});a.x-=96,a.y-=56;let o={...a},s=!0,c=0;for(;s&&c<20;)s=r.nodes.some(e=>Math.abs(e.position.x-o.x)<192&&Math.abs(e.position.y-o.y)<112),s&&(o.x+=20,o.y+=20,c+=1);let l={id:u0(),type:`action`,position:o,data:{label:``,description:``,type:`action`,config:{},status:`idle`}};r.addNode(l),r.setSelectedNodeId(l.id),r.setActiveTab(`properties`)},t[19]=p,t[20]=r,t[21]=w):w=t[21];let T=w,E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(cy,{className:`size-4`}),t[22]=E):E=t[22];let D;t[23]!==T||t[24]!==r.isGenerating?(D=(0,X.jsx)(A7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:r.isGenerating,onClick:T,size:`icon`,title:`Add Step`,variant:`secondary`,children:E})}),t[23]=T,t[24]=r.isGenerating,t[25]=D):D=t[25];let O=m?``:`hidden`,k;t[26]===O?k=t[27]:(k=Q(`flex`,O),t[26]=O,t[27]=k);let A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(uy,{className:`size-4`}),t[28]=A):A=t[28];let j;t[29]===o?j=t[30]:(j=(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:o,size:`icon`,title:`Configuration`,variant:`secondary`,children:A}),t[29]=o,t[30]=j);let M;t[31]!==C||t[32]!==y?(M=y&&(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:C,size:`icon`,title:`Delete`,variant:`secondary`,children:(0,X.jsx)(fy,{className:`size-4`})}),t[31]=C,t[32]=y,t[33]=M):M=t[33];let N;t[34]!==j||t[35]!==M||t[36]!==k?(N=(0,X.jsxs)(A7,{className:k,orientation:`horizontal`,children:[j,M]}),t[34]=j,t[35]=M,t[36]=k,t[37]=N):N=t[37];let P=!r.canUndo||r.isGenerating,F;t[38]===r?F=t[39]:(F=()=>r.undo(),t[38]=r,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(Mte,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==P||t[42]!==F?(L=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:P,onClick:F,size:`icon`,title:`Undo`,variant:`secondary`,children:I}),t[41]=P,t[42]=F,t[43]=L):L=t[43];let R=!r.canRedo||r.isGenerating,z;t[44]===r?z=t[45]:(z=()=>r.redo(),t[44]=r,t[45]=z);let B;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(Tte,{className:`size-4`}),t[46]=B):B=t[46];let V;t[47]!==R||t[48]!==z?(V=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:R,onClick:z,size:`icon`,title:`Redo`,variant:`secondary`,children:B}),t[47]=R,t[48]=z,t[49]=V):V=t[49];let H;t[50]!==L||t[51]!==V?(H=(0,X.jsxs)(A7,{className:`flex`,orientation:`horizontal`,children:[L,V]}),t[50]=L,t[51]=V,t[52]=H):H=t[52];let U;t[53]!==i.handleSave||t[54]!==r?(U=(0,X.jsx)(tbe,{handleSave:i.handleSave,state:r}),t[53]=i.handleSave,t[54]=r,t[55]=U):U=t[55];let W;t[56]!==i.handlePublish||t[57]!==i.isPublishing||t[58]!==x?(W=(0,X.jsx)(ebe,{disabled:x,handlePublish:i.handlePublish,isPublishing:i.isPublishing}),t[56]=i.handlePublish,t[57]=i.isPublishing,t[58]=x,t[59]=W):W=t[59];let G;t[60]!==U||t[61]!==W?(G=(0,X.jsxs)(A7,{className:`flex`,orientation:`horizontal`,children:[U,W]}),t[60]=U,t[61]=W,t[62]=G):G=t[62];let K;t[63]!==i||t[64]!==r?(K=(0,X.jsx)(rbe,{actions:i,state:r}),t[63]=i,t[64]=r,t[65]=K):K=t[65];let q;t[66]!==i||t[67]!==r.isGenerating||t[68]!==r.isSaving||t[69]!==r.workflowMode||t[70]!==n?(q=n&&(0,X.jsx)(A7,{"aria-label":`Workflow mode`,className:`flex`,orientation:`horizontal`,role:`radiogroup`,children:[`live`,`test`].map(e=>{let t=r.workflowMode===e;return(0,X.jsx)(zv,{"aria-checked":t,className:`border`,disabled:r.isSaving||r.isGenerating,onClick:()=>i.handleSetWorkflowMode(e),role:`radio`,size:`default`,variant:t?`default`:`outline`,children:e===`live`?`Live`:`Test`},e)})}),t[66]=i,t[67]=r.isGenerating,t[68]=r.isSaving,t[69]=r.workflowMode,t[70]=n,t[71]=q):q=t[71];let J;return t[72]!==N||t[73]!==H||t[74]!==G||t[75]!==K||t[76]!==q||t[77]!==D?(J=(0,X.jsxs)(X.Fragment,{children:[D,N,H,G,K,q]}),t[72]=N,t[73]=H,t[74]=G,t[75]=K,t[76]=q,t[77]=D,t[78]=J):J=t[78],J}function obe(e){return e.type!==`add`}function sbe(e){let t=(0,Z.c)(52),{workflowId:n,state:r,actions:i}=e,a=Gi(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(0),u;t[0]===a?u=t[1]:(u=()=>a({to:`/`}),t[0]=a,t[1]=u);let d,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(Qye,{className:`size-4 shrink-0`}),f=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:`Dashboard`}),t[2]=d,t[3]=f):(d=t[2],f=t[3]);let p;t[4]===u?p=t[5]:(p=(0,X.jsxs)(`button`,{className:`flex h-full shrink-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,onClick:u,type:`button`,children:[d,f]}),t[4]=u,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/60`,children:`/`}),t[6]=m):m=t[6];let h;t[7]===i?h=t[8]:(h=e=>e&&i.loadWorkflows(),t[7]=i,t[8]=h);let g=r.workflowName||`Untitled workflow`,_;t[9]===g?_=t[10]:(_=(0,X.jsx)(`p`,{className:`truncate font-medium text-sm`,children:g}),t[9]=g,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Jv,{className:`size-3 shrink-0 opacity-50`}),t[11]=v):v=t[11];let y;t[12]===_?y=t[13]:(y=(0,X.jsxs)(U5,{className:`flex h-full min-w-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,children:[_,v]}),t[12]=_,t[13]=y);let b,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(G5,{className:`flex items-center gap-2`,onClick:()=>{l(ube),s(!0)},children:[(0,X.jsx)(cy,{className:`size-4`}),`New Workflow...`]}),x=(0,X.jsx)(q5,{}),t[14]=b,t[15]=x):(b=t[14],x=t[15]);let S;t[16]!==a||t[17]!==r.allWorkflows||t[18]!==r.currentWorkflowId?(S=r.allWorkflows.length===0?(0,X.jsx)(G5,{disabled:!0,children:`No workflows found`}):r.allWorkflows.filter(lbe).map(e=>(0,X.jsxs)(G5,{className:`flex items-center justify-between`,onClick:()=>a({to:`/workflows/$workflowId`,params:{workflowId:e.id}}),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),e.id===r.currentWorkflowId&&(0,X.jsx)(qv,{className:`size-4 shrink-0`})]},e.id)),t[16]=a,t[17]=r.allWorkflows,t[18]=r.currentWorkflowId,t[19]=S):S=t[19];let C;t[20]!==i||t[21]!==r.isOwner||t[22]!==n?(C=n&&r.isOwner&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q5,{}),(0,X.jsxs)(G5,{className:`flex items-center gap-2`,disabled:i.isDuplicating,onClick:i.handleDuplicate,children:[i.isDuplicating?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)($v,{className:`size-4`}),`Duplicate`]}),(0,X.jsxs)(G5,{className:`flex items-center gap-2 text-destructive focus:text-destructive`,onClick:i.handleDeleteWorkflow,children:[(0,X.jsx)(fy,{className:`size-4`}),`Delete Workflow`]})]}),t[20]=i,t[21]=r.isOwner,t[22]=n,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C?(w=(0,X.jsxs)(W5,{align:`start`,className:`w-64`,children:[b,x,S,C]}),t[24]=S,t[25]=C,t[26]=w):w=t[26];let T;t[27]!==y||t[28]!==w||t[29]!==h?(T=(0,X.jsxs)(H5,{onOpenChange:h,children:[y,w]}),t[27]=y,t[28]=w,t[29]=h,t[30]=T):T=t[30];let E;t[31]!==T||t[32]!==p?(E=(0,X.jsxs)(`div`,{className:`flex h-9 max-w-[260px] items-center overflow-hidden rounded-md border bg-secondary text-secondary-foreground sm:max-w-none`,children:[p,m,T]}),t[31]=T,t[32]=p,t[33]=E):E=t[33];let D;t[34]!==r.isOwner||t[35]!==n?(D=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs @xl:hidden`,children:`Read-only`}),t[34]=r.isOwner,t[35]=n,t[36]=D):D=t[36];let O;t[37]!==E||t[38]!==D?(O=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[E,D]}),t[37]=E,t[38]=D,t[39]=O):O=t[39];let k;t[40]===r.allWorkflows?k=t[41]:(k=r.allWorkflows.map(cbe),t[40]=r.allWorkflows,t[41]=k);let A;t[42]===a?A=t[43]:(A=e=>a({to:`/workflows/$workflowId`,params:{workflowId:e}}),t[42]=a,t[43]=A);let j;t[44]!==c||t[45]!==o||t[46]!==k||t[47]!==A?(j=(0,X.jsx)(M7,{existingWorkflowNames:k,onCreated:A,onOpenChange:s,open:o},c),t[44]=c,t[45]=o,t[46]=k,t[47]=A,t[48]=j):j=t[48];let M;return t[49]!==O||t[50]!==j?(M=(0,X.jsxs)(X.Fragment,{children:[O,j]}),t[49]=O,t[50]=j,t[51]=M):M=t[51],M}function cbe(e){return e.name}function lbe(e){return e.name!==`__current__`}function ube(e){return e+1}function dbe(e,t){if(!t)return;let n=t.trim();if(!n)return;let r=Ka(n.split(`.`)),i=e;for(let e of r){if(i==null)return;if(Array.isArray(i)){if(!/^\d+$/.test(e))return;let t=Number(e);if(!Number.isSafeInteger(t))return;i=i[t];continue}if(typeof i==`object`){i=i[e];continue}return}return i}function fbe(e,t,n){let r=Ka(t.trim().split(`.`)),i=r.pop();if(!i)return e;let a=e;for(let e of r){let t=a[e],n=typeof t==`object`&&t&&!Array.isArray(t)?t:{};a[e]=n,a=n}return a[i]=n,e}function pbe(e){return!e.path.includes(`[`)&&e.type!==`array`&&e.type!==`object`}function mbe(e){return e.enumValues&&e.enumValues.length>0?`select`:e.type===`boolean`?`checkbox`:e.type===`number`?`number`:e.type===`timestamp`?`datetime`:`text`}function N7(e){return e?e.payloadFields.filter(pbe).map(e=>({path:e.path,...e.description?{description:e.description}:{},control:mbe(e),...e.enumValues?{options:[...e.enumValues]}:{},optional:e.nullable===!0})):[]}function hbe(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function P7(e,t){let n={};for(let r of e){let e=dbe(t,r.path);if(e==null){n[r.path]=``;continue}let i=typeof e==`string`?e:JSON.stringify(e);n[r.path]=r.control===`datetime`?hbe(i):i}return n}function gbe(e,t){let n=t.trim();if(n){if(e.control===`checkbox`)return n===`true`;if(e.control===`number`){let e=Number(n);return Number.isFinite(e)?e:n}if(e.control===`datetime`){let e=new Date(n);return Number.isNaN(e.getTime())?n:Hde(e)}return n}}function _be(e,t,n={}){let r=structuredClone(n);for(let n of e){let e=gbe(n,t[n.path]??``);e!==void 0&&fbe(r,n.path,e)}return r}function F7(e){let t=e.trim();if(!t)return{ok:!0,payload:{}};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:`This is not valid JSON.`}}let r=lue(n);return r?{ok:!0,payload:r}:{ok:!1,error:`A payload has to be a JSON object.`}}function I7(e){return e.find(e=>e.data.type===`lifecycle`)}function vbe(e){return C1(I7(e)?.data.config)}function L7(e){return due(I7(e)?.data.config)??{}}function ybe(e,t){return t.eventName?{...e,byEvent:{...e.byEvent,[t.eventName]:t.input}}:{...e,manual:t.input}}var R7=``;function bbe(e,t){return Ny(e,t)?.label??t}function xbe(e){let t=(0,Z.c)(29),{field:n,value:r,onChange:i}=e;if(n.control===`checkbox`){let e=r===`true`,a;t[0]===i?a=t[1]:(a=e=>i(e?`true`:`false`),t[0]=i,t[1]=a);let o;return t[2]!==n.path||t[3]!==e||t[4]!==a?(o=(0,X.jsx)(e7,{checked:e,id:n.path,onCheckedChange:a}),t[2]=n.path,t[3]=e,t[4]=a,t[5]=o):o=t[5],o}if(n.control===`select`){let e;t[6]===i?e=t[7]:(e=H6(i),t[6]=i,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(U6,{placeholder:`Choose a value`}),t[8]=a):a=t[8];let o;t[9]===n.path?o=t[10]:(o=(0,X.jsx)(W6,{className:`w-full`,id:n.path,children:a}),t[9]=n.path,t[10]=o);let s;t[11]===n.options?s=t[12]:(s=n.options??[],t[11]=n.options,t[12]=s);let c;t[13]===s?c=t[14]:(c=s.map(z7),t[13]=s,t[14]=c);let l;t[15]===c?l=t[16]:(l=(0,X.jsx)(G6,{children:c}),t[15]=c,t[16]=l);let u;return t[17]!==e||t[18]!==o||t[19]!==l||t[20]!==r?(u=(0,X.jsxs)(V6,{onValueChange:e,value:r,children:[o,l]}),t[17]=e,t[18]=o,t[19]=l,t[20]=r,t[21]=u):u=t[21],u}let a;t[22]===i?a=t[23]:(a=e=>i(e.target.value),t[22]=i,t[23]=a);let o=n.control===`number`?`number`:n.control===`datetime`?`datetime-local`:`text`,s;return t[24]!==n.path||t[25]!==a||t[26]!==o||t[27]!==r?(s=(0,X.jsx)(wX,{id:n.path,onChange:a,type:o,value:r}),t[24]=n.path,t[25]=a,t[26]=o,t[27]=r,t[28]=s):s=t[28],s}function z7(e){return(0,X.jsx)(K6,{value:e,children:e},e)}function Sbe(e){let t=(0,Z.c)(10),{fields:n,values:r,onChange:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This Event declares no payload field the form can draw. Use the JSON tab to write the payload.`}),t[0]=e):e=t[0],e}let a;if(t[1]!==n||t[2]!==i||t[3]!==r){let e;t[5]!==i||t[6]!==r?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(TX,{className:`font-mono text-xs`,htmlFor:e.path,children:[e.path,e.optional&&(0,X.jsx)(`span`,{className:`ml-2 font-sans text-muted-foreground`,children:`optional`})]}),(0,X.jsx)(xbe,{field:e,onChange:t=>i(e.path,t),value:r[e.path]??``}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]},e.path),t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[1]=n,t[2]=i,t[3]=r,t[4]=a}else a=t[4];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`space-y-4`,children:a}),t[8]=a,t[9]=o),o}function Cbe(e){let t=(0,Z.c)(92),{overlayId:n,startEvents:r,allowManualStart:i,hasEventSplit:a,savedPayloads:o,onRun:s}=e,c=yy(),{closeAll:l}=RY(),[u,d]=(0,Y.useState)(r[0]??R7),[f,p]=(0,Y.useState)(`form`),m=u===R7?void 0:u,h;t[0]!==m||t[1]!==o?(h=N1(o,m),t[0]=m,t[1]=o,t[2]=h):h=t[2];let g=h,_;t[3]!==c||t[4]!==m?(_=N7(m?Ny(c,m):void 0),t[3]=c,t[4]=m,t[5]=_):_=t[5];let v=_,y;t[6]!==v||t[7]!==g?(y=()=>P7(v,g),t[6]=v,t[7]=g,t[8]=y):y=t[8];let[b,x]=(0,Y.useState)(y),S;t[9]===g?S=t[10]:(S=()=>JSON.stringify(g??{},null,2),t[9]=g,t[10]=S);let[C,w]=(0,Y.useState)(S),[T,E]=(0,Y.useState)(null),D;t[11]===g?D=t[12]:(D=()=>g??{},t[11]=g,t[12]=D);let[O,k]=(0,Y.useState)(D),A;t[13]!==c||t[14]!==o?(A=e=>{d(e);let t=e===R7?void 0:e,n=N1(o,t)??{},r=N7(t?Ny(c,t):void 0);x(P7(r,n)),w(JSON.stringify(n,null,2)),k(n),E(null)},t[13]=c,t[14]=o,t[15]=A):A=t[15];let j=A,M;t[16]!==O||t[17]!==v||t[18]!==b?(M=()=>_be(v,b,O),t[16]=O,t[17]=v,t[18]=b,t[19]=M):M=t[19];let N=M,P;t[20]===N?P=t[21]:(P=()=>{w(JSON.stringify(N(),null,2)),E(null),p(`json`)},t[20]=N,t[21]=P);let F=P,I;t[22]!==v||t[23]!==C?(I=()=>{let e=F7(C);if(!e.ok){E(e.error);return}x(P7(v,e.payload)),k(e.payload),E(null),p(`form`)},t[22]=v,t[23]=C,t[24]=I):I=t[24];let L=I,R=!a||m!==void 0,z;t[25]!==l||t[26]!==N||t[27]!==m||t[28]!==C||t[29]!==s||t[30]!==f?(z=()=>{if(f===`json`){let e=F7(C);if(!e.ok){E(e.error);return}s({...m?{eventName:m}:{},input:e.payload}),l();return}s({...m?{eventName:m}:{},input:N()}),l()},t[25]=l,t[26]=N,t[27]=m,t[28]=C,t[29]=s,t[30]=f,t[31]=z):z=t[31];let B=z,V;t[32]===l?V=t[33]:(V={label:`Cancel`,variant:`outline`,onClick:l},t[32]=l,t[33]=V);let H=!R,U;t[34]!==B||t[35]!==H?(U={label:`Run`,onClick:B,disabled:H},t[34]=B,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==V||t[38]!==U?(W=[V,U],t[37]=V,t[38]=U,t[39]=W):W=t[39];let G;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,X.jsx)(TX,{htmlFor:`testRunEvent`,children:`Which Event does this run stand in for?`}),t[40]=G):G=t[40];let K;t[41]===j?K=t[42]:(K=H6(j),t[41]=j,t[42]=K);let q;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(W6,{className:`w-full`,id:`testRunEvent`,children:(0,X.jsx)(U6,{placeholder:`Choose an Event`})}),t[43]=q):q=t[43];let J;if(t[44]!==c||t[45]!==r){let e;t[47]===c?e=t[48]:(e=e=>(0,X.jsx)(K6,{value:e,children:bbe(c,e)},e),t[47]=c,t[48]=e),J=r.map(e),t[44]=c,t[45]=r,t[46]=J}else J=t[46];let ee;t[49]!==i||t[50]!==a?(ee=i&&(0,X.jsx)(K6,{disabled:a,value:R7,children:`No Event (manual start)`}),t[49]=i,t[50]=a,t[51]=ee):ee=t[51];let te;t[52]!==J||t[53]!==ee?(te=(0,X.jsxs)(G6,{children:[J,ee]}),t[52]=J,t[53]=ee,t[54]=te):te=t[54];let ne;t[55]!==u||t[56]!==K||t[57]!==te?(ne=(0,X.jsxs)(V6,{onValueChange:K,value:u,children:[q,te]}),t[55]=u,t[56]=K,t[57]=te,t[58]=ne):ne=t[58];let re;t[59]===a?re=t[60]:(re=a&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This workflow splits on the Event a run is on, so a run has to name one.`}),t[59]=a,t[60]=re);let ie;t[61]!==ne||t[62]!==re?(ie=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[G,ne,re]}),t[61]=ne,t[62]=re,t[63]=ie):ie=t[63];let ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Payload`}),t[64]=ae):ae=t[64];let oe=f===`form`?`secondary`:`ghost`,se;t[65]!==L||t[66]!==oe?(se=(0,X.jsx)(zv,{onClick:L,size:`sm`,variant:oe,children:`Form`}),t[65]=L,t[66]=oe,t[67]=se):se=t[67];let ce=f===`json`?`secondary`:`ghost`,le;t[68]!==F||t[69]!==ce?(le=(0,X.jsx)(zv,{onClick:F,size:`sm`,variant:ce,children:`JSON`}),t[68]=F,t[69]=ce,t[70]=le):le=t[70];let ue;t[71]!==se||t[72]!==le?(ue=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[ae,(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[se,le]})]}),t[71]=se,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==v||t[75]!==C||t[76]!==f||t[77]!==b?(de=f===`form`?(0,X.jsx)(Sbe,{fields:v,onChange:(e,t)=>x(n=>({...n,[e]:t})),values:b}):(0,X.jsx)(`textarea`,{"aria-label":`Payload JSON`,className:`min-h-64 w-full rounded-md border border-input bg-transparent p-3 font-mono text-xs shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,onChange:e=>{w(e.target.value),E(null)},spellCheck:!1,value:C}),t[74]=v,t[75]=C,t[76]=f,t[77]=b,t[78]=de):de=t[78];let fe;t[79]===T?fe=t[80]:(fe=T&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:T}),t[79]=T,t[80]=fe);let pe;t[81]!==ue||t[82]!==de||t[83]!==fe?(pe=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[ue,de,fe]}),t[81]=ue,t[82]=de,t[83]=fe,t[84]=pe):pe=t[84];let me;t[85]!==ie||t[86]!==pe?(me=(0,X.jsxs)(`div`,{className:`space-y-6`,children:[ie,pe]}),t[85]=ie,t[86]=pe,t[87]=me):me=t[87];let he;return t[88]!==n||t[89]!==W||t[90]!==me?(he=(0,X.jsx)(SX,{actions:W,description:`A test run carries the payload an Event would have sent, so every template downstream resolves the way it will in production.`,overlayId:n,title:`Test run`,children:me}),t[88]=n,t[89]=W,t[90]=me,t[91]=he):he=t[91],he}function B7(e){let t=(0,Z.c)(38),{overlayId:n,issues:r,onGoToStep:i,onRunAnyway:a,allowRunAnyway:o}=e,s=o!==void 0&&o,{push:c,closeAll:l}=RY(),{pushSheet:u}=O7(),d=jY(),f=E3(),{brokenReferences:p,missingRequiredFields:m,missingIntegrations:h}=r,g=p.length+m.length+h.length,_;t[0]!==l||t[1]!==d||t[2]!==i||t[3]!==u?(_=(e,t)=>{i(e,t),d?u():l()},t[0]=l,t[1]=d,t[2]=i,t[3]=u,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==f?(y=e=>{c(C3,{type:e,onSuccess:()=>void f()})},t[5]=c,t[6]=f,t[7]=y):y=t[7];let b=y,x;t[8]!==l||t[9]!==a?(x=()=>{a&&(l(),a())},t[8]=l,t[9]=a,t[10]=x):x=t[10];let S=x,C=m.length+h.length,w;t[11]!==s||t[12]!==l||t[13]!==S||t[14]!==a?(w=s&&a?[{label:`Run Anyway`,variant:`outline`,onClick:S},{label:`Cancel`,onClick:l}]:[{label:`Close`,onClick:l}],t[11]=s,t[12]=l,t[13]=S,t[14]=a,t[15]=w):w=t[15];let T=`Workflow Issues (${g})`,E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-warning`,children:[(0,X.jsx)(py,{className:`size-5`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This workflow has issues that may cause it to fail.`})]}),t[16]=E):E=t[16];let D;t[17]===C?D=t[18]:(D=C>0&&(0,X.jsx)(`p`,{className:`mt-2 text-destructive text-sm`,children:`Resolve blocking issues before running this workflow.`}),t[17]=C,t[18]=D);let O;t[19]!==b||t[20]!==h?(O=h.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Connections`}),h.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,X.jsx)(b3,{className:`size-4 shrink-0`,integration:e.integrationType}),(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.integrationLabel}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — `,e.nodeNames.length>3?`${e.nodeNames.slice(0,3).join(`, `)} +${e.nodeNames.length-3} more`:e.nodeNames.join(`, `)]})]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>b(e.integrationType),size:`sm`,variant:`outline`,children:`Add`})]},e.integrationType))]}),t[19]=b,t[20]=h,t[21]=O):O=t[21];let k;t[22]!==p||t[23]!==v?(k=p.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Broken References`}),p.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.brokenReferences.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:t.displayText}),` in `,t.fieldLabel]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}-${t.displayText}-${t.fieldLabel}`))})]},e.nodeId))]}),t[22]=p,t[23]=v,t[24]=k):k=t[24];let A;t[25]!==v||t[26]!==m?(A=m.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Required Fields`}),m.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.missingFields.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:t.fieldLabel}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}`))})]},e.nodeId))]}),t[25]=v,t[26]=m,t[27]=A):A=t[27];let j;t[28]!==k||t[29]!==A||t[30]!==O?(j=(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[O,k,A]}),t[28]=k,t[29]=A,t[30]=O,t[31]=j):j=t[31];let M;return t[32]!==n||t[33]!==j||t[34]!==w||t[35]!==T||t[36]!==D?(M=(0,X.jsxs)(SX,{actions:w,overlayId:n,title:T,children:[E,D,j]}),t[32]=n,t[33]=j,t[34]=w,t[35]=T,t[36]=D,t[37]=M):M=t[37],M}function V7(e){return e instanceof HTMLElement&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable)}var wbe=jy(`workflow`,`run`),Tbe={workflow_paused:`Workflow is paused and cannot start new runs.`,concurrency_first_wins:`A run for this entity is already going, and this workflow keeps the first one.`,entity_value_missing:`This payload carries nothing at the workflow's Correlation Path, and its Concurrency needs an entity to compare.`,manual_start_not_allowed:`This workflow does not list manual runs as a start source.`,start_event_required:`This workflow splits on the Event a run is on, so a run has to name one.`};function H7(e,t,n){t(e.map(e=>({nodeId:e.id,status:n})))}function Ebe(e){let t=I7(e.nodes);t&&e.updateNodeData({id:t.id,data:{config:{...t.data.config,testPayloads:ybe(L7(e.nodes),e.request)}}})}async function Dbe({runWorkflow:e,nodes:t,setNodeStatuses:n,setIsExecuting:r,navigateToExecution:i}){H7(t,n,`idle`),n(t.filter(e=>e.data.type===`lifecycle`).map(e=>({nodeId:e.id,status:`running`})));try{let a=await e();if(a.status!==`running`||!a.executionId){Ty.message(a.status===`ignored`?Tbe[a.reason]:`Execution completed without starting a new run.`),r(!1),H7(t,n,`idle`);return}if(typeof a.supersededExecutions==`number`&&a.supersededExecutions>0){let e=Array.isArray(a.failedToSupersede)?a.failedToSupersede.length:0,t=`Superseded ${a.supersededExecutions} run${a.supersededExecutions===1?``:`s`} for this entity and started a new one.`;e>0?Ty.error(`${t} ${e} could not be signalled and may still be running. Cancel them from the Runs panel.`):Ty.success(t)}await i(a.executionId)}catch(e){wbe.error(`Failed to execute the workflow`,{error:e}),H7(t,n,`error`),r(!1)}}function Obe(e){let t=(0,Z.c)(53),{currentWorkflowId:n,workflowName:r,nodes:i,edges:a,updateNodeData:o,isExecuting:s,setIsExecuting:c,setCurrentWorkflowName:l,setWorkflowNameError:u,setIsTransitioningFromHomepage:d,setActiveTab:f,setSelectedNodeId:p,userIntegrations:m}=e,h=yy(),[g,_]=(0,Y.useState)(null),{open:v}=RY(),y=Gi(),b=Fe(),x=TA(ape),S=TA(V4),C=TA(y3),w=TA(d2),T=TA(hde),E;t[0]===b?E=t[1]:(E=r0.workflow.execute.mutationOptions({onSuccess:()=>s0(b)}),t[0]=b,t[1]=E);let D=Ze(E),O;t[2]!==T||t[3]!==n||t[4]!==a||t[5]!==y||t[6]!==i||t[7]!==w||t[8]!==l||t[9]!==d||t[10]!==u||t[11]!==r?(O=async()=>{if(!i.some(kbe)){u(`Add at least one step before saving.`);return}let e=r.trim();if(!e){u(`Workflow name is required.`);return}if(n){let t=await w({name:e,nodes:i,edges:a},{immediate:!0});if(t&&!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}l(e),u(null);return}let t=await T({name:e,nodes:i,edges:a});if(!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}d(!0),await y({to:`/workflows/$workflowId`,params:{workflowId:t.workflow.id},replace:!0})},t[2]=T,t[3]=n,t[4]=a,t[5]=y,t[6]=i,t[7]=w,t[8]=l,t[9]=d,t[10]=u,t[11]=r,t[12]=O):O=t[12];let k=O,A;t[13]!==x||t[14]!==n||t[15]!==y||t[16]!==i||t[17]!==D||t[18]!==f||t[19]!==S||t[20]!==c||t[21]!==C||t[22]!==p||t[23]!==o?(A=async e=>{if(!n){Ty.error(`Please save the workflow before executing`);return}Ebe({nodes:i,updateNodeData:o,request:e}),f(`runs`),S(null),x(),p(null),c(!0),await Dbe({runWorkflow:()=>D.mutateAsync({workflowId:n,input:e.input,...e.eventName?{eventName:e.eventName}:{}}),nodes:i,setNodeStatuses:C,setIsExecuting:c,navigateToExecution:e=>y({to:`/workflows/$workflowId`,params:{workflowId:n},search:{executionId:e}})})},t[13]=x,t[14]=n,t[15]=y,t[16]=i,t[17]=D,t[18]=f,t[19]=S,t[20]=c,t[21]=C,t[22]=p,t[23]=o,t[24]=A):A=t[24];let j=A,M;t[25]!==j||t[26]!==i||t[27]!==v?(M=()=>{let e=vbe(i)??S1;v(Cbe,{startEvents:e.startEvents,allowManualStart:E1(e),hasEventSplit:i.some(Z6),savedPayloads:L7(i),onRun:e=>{j(e)}})},t[25]=j,t[26]=i,t[27]=v,t[28]=M):M=t[28];let N=M,P;t[29]!==f||t[30]!==p?(P=(e,t)=>{p(e),f(`properties`),_(t??null)},t[29]=f,t[30]=p,t[31]=P):P=t[31];let F=P,I;t[32]===g?I=t[33]:(I=()=>{if(!g)return;_(null);let e=document.getElementById(g);e&&(e.focus(),e.scrollIntoView({behavior:`smooth`,block:`center`}))},t[32]=g,t[33]=I),yY(g,I);let L;t[34]!==h||t[35]!==F||t[36]!==s||t[37]!==i||t[38]!==v||t[39]!==N||t[40]!==m?(L=async()=>{if(s)return;let e=y4({nodes:G1(i),catalog:h,integrations:m});if(e.length>0){let t=b4(e);v(B7,{issues:x4(e),onGoToStep:F,onRunAnyway:t?void 0:N,allowRunAnyway:!t});return}N()},t[34]=h,t[35]=F,t[36]=s,t[37]=i,t[38]=v,t[39]=N,t[40]=m,t[41]=L):L=t[41];let R=L,z;t[42]!==h||t[43]!==F||t[44]!==i||t[45]!==v||t[46]!==m?(z=()=>{let e=y4({nodes:G1(i),catalog:h,integrations:m});v(B7,{issues:x4(e),onGoToStep:F,allowRunAnyway:!1})},t[42]=h,t[43]=F,t[44]=i,t[45]=v,t[46]=m,t[47]=z):z=t[47];let B=z,V;return t[48]!==R||t[49]!==F||t[50]!==k||t[51]!==B?(V={handleSave:k,handleExecute:R,handleShowIssues:B,handleGoToStep:F},t[48]=R,t[49]=F,t[50]=k,t[51]=B,t[52]=V):V=t[52],V}function kbe(e){return e.type!==`add`}function Abe(){let e=(0,Z.c)(33),t=wA(Q4),n=wA($4),[r,i]=EA(w2),[a]=EA(T2),o=TA(g3),s=TA(m3),[c]=EA(Q0),[l,u]=EA($0),[d,f]=EA(e2),p=TA(n2),m=TA(v2),h=wA(t2),g=wA(a2),_=wA(o2),v=TA(_3),y=TA(v3),b=TA(u3),[x]=EA(ppe),[S]=EA(mpe),C=TA(g2),w=TA(H4),T;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=i0(),e[0]=T):T=e[0];let{data:E}=Xe(T),D;e[1]===E?D=e[2]:(D=E===void 0?[]:E,e[1]=E,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=Pue(),e[3]=k):k=e[3];let{data:A}=Xe(k),j;e[4]===A?j=e[5]:(j=A===void 0?[]:A,e[4]=A,e[5]=j);let M=j,N;return e[6]!==b||e[7]!==M||e[8]!==S||e[9]!==x||e[10]!==o||e[11]!==c||e[12]!==n||e[13]!==_||e[14]!==r||e[15]!==a||e[16]!==h||e[17]!==g||e[18]!==t||e[19]!==y||e[20]!==C||e[21]!==f||e[22]!==u||e[23]!==i||e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==v||e[28]!==s||e[29]!==O||e[30]!==d||e[31]!==l?(N={nodes:t,edges:n,isExecuting:r,setIsExecuting:i,isGenerating:a,clearWorkflow:o,updateNodeData:s,currentWorkflowId:c,workflowName:l,workflowMode:d,setCurrentWorkflowName:u,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,isOwner:h,isSaving:g,hasUnsavedChanges:_,undo:v,redo:y,addNode:b,canUndo:x,canRedo:S,allWorkflows:M,setActiveTab:C,setSelectedNodeId:w,userIntegrations:O},e[6]=b,e[7]=M,e[8]=S,e[9]=x,e[10]=o,e[11]=c,e[12]=n,e[13]=_,e[14]=r,e[15]=a,e[16]=h,e[17]=g,e[18]=t,e[19]=y,e[20]=C,e[21]=f,e[22]=u,e[23]=i,e[24]=m,e[25]=w,e[26]=p,e[27]=v,e[28]=s,e[29]=O,e[30]=d,e[31]=l,e[32]=N):N=e[32],N}function jbe(e){let t=(0,Z.c)(62),n=yy(),{open:r}=RY(),i=Gi(),a=Fe(),o=l0(),s=TA(mde),{currentWorkflowId:c,workflowName:l,workflowMode:u,setCurrentWorkflowName:d,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,clearWorkflow:b,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C}=e,w;t[0]!==c||t[1]!==g||t[2]!==v||t[3]!==h||t[4]!==x||t[5]!==d||t[6]!==y||t[7]!==m||t[8]!==S||t[9]!==p||t[10]!==_||t[11]!==C||t[12]!==l?(w={currentWorkflowId:c,workflowName:l,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,setCurrentWorkflowName:d,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C},t[0]=c,t[1]=g,t[2]=v,t[3]=h,t[4]=x,t[5]=d,t[6]=y,t[7]=m,t[8]=S,t[9]=p,t[10]=_,t[11]=C,t[12]=l,t[13]=w):w=t[13];let{handleSave:T,handleExecute:E,handleShowIssues:D,handleGoToStep:O}=Obe(w),k;t[14]===E?k=t[15]:(k=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(V7(e.target)||(e.preventDefault(),e.stopPropagation(),E()))},t[14]=E,t[15]=k);let A=k,j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j={capture:!0},t[16]=j):j=t[16],_Y(document,`keydown`,A,j);let M;t[17]!==b||t[18]!==r?(M=()=>{r(CX,{title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{b()}})},t[17]=b,t[18]=r,t[19]=M):M=t[19];let N=M,P;t[20]!==c||t[21]!==o||t[22]!==r||t[23]!==l?(P=()=>{r(CX,{title:`Delete Workflow`,message:`Are you sure you want to delete "${l}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{c&&o.mutate({workflowId:c})}})},t[20]=c,t[21]=o,t[22]=r,t[23]=l,t[24]=P):P=t[24];let F=P,I;t[25]===a?I=t[26]:(I=()=>a0(a),t[25]=a,t[26]=I);let L=I,R;t[27]!==L||t[28]!==i?(R=r0.workflow.duplicate.mutationOptions({onSuccess:async e=>{Ty.success(`Workflow duplicated successfully`),await L(),await i({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},meta:{errorMessage:`Failed to duplicate workflow. Please try again.`}}),t[27]=L,t[28]=i,t[29]=R):R=t[29];let z=Ze(R),B;t[30]!==L||t[31]!==a?(B=r0.workflow.publish.mutationOptions({onSuccess:e=>{Ty.success(`Published version ${e.publishedVersion}`),o0(a,e),L()}}),t[30]=L,t[31]=a,t[32]=B):B=t[32];let V=Ze(B),H;t[33]!==c||t[34]!==z?(H=()=>{c&&z.mutate({workflowId:c})},t[33]=c,t[34]=z,t[35]=H):H=t[35];let U=H,W;t[36]!==n||t[37]!==c||t[38]!==g||t[39]!==O||t[40]!==h||t[41]!==r||t[42]!==V||t[43]!==C?(W=()=>{if(!c)return;let e=y4({nodes:G1(h),catalog:n,integrations:C});if(b4(e)){r(B7,{issues:x4(e),onGoToStep:O,allowRunAnyway:!1});return}V.mutate({workflowId:c,graph:Y1({nodes:h,edges:g})})},t[36]=n,t[37]=c,t[38]=g,t[39]=O,t[40]=h,t[41]=r,t[42]=V,t[43]=C,t[44]=W):W=t[44];let G=W,K;t[45]!==c||t[46]!==f||t[47]!==s||t[48]!==u?(K=async e=>{if(!c||u===e)return;let t=await s(e);if(!t?.ok){Ty.error(`Failed to update workflow mode`);return}f(t.workflow.mode),Ty.success(e===`test`?`Workflow set to Test mode`:`Workflow set to Live mode`)},t[45]=c,t[46]=f,t[47]=s,t[48]=u,t[49]=K):K=t[49];let q=K,J;return t[50]!==z.isPending||t[51]!==N||t[52]!==F||t[53]!==U||t[54]!==E||t[55]!==G||t[56]!==T||t[57]!==q||t[58]!==D||t[59]!==L||t[60]!==V.isPending?(J={handleSave:T,handleExecute:E,handleShowIssues:D,handleClearWorkflow:N,handleDeleteWorkflow:F,loadWorkflows:L,handleDuplicate:U,isDuplicating:z.isPending,handlePublish:G,isPublishing:V.isPending,handleSetWorkflowMode:q},t[50]=z.isPending,t[51]=N,t[52]=F,t[53]=U,t[54]=E,t[55]=G,t[56]=T,t[57]=q,t[58]=D,t[59]=L,t[60]=V.isPending,t[61]=J):J=t[61],J}function Mbe(e){let t=(0,Z.c)(7),{onOpen:n}=e,r=wA(C4),i=wA(Pfe),a=wA(t2),o=`${r.length} ${r.length===1?`issue`:`issues`}`;if(!a)return null;let s;t[0]!==i||t[1]!==r.length||t[2]!==o||t[3]!==n?(s=r.length>0&&(0,X.jsxs)(`button`,{className:Q(`flex items-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 font-medium text-xs transition-colors`,i?`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20`:`bg-card text-muted-foreground hover:bg-accent`),onClick:n,title:`Show what is wrong with this workflow`,type:`button`,children:[(0,X.jsx)(py,{className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:o})]}),t[0]=i,t[1]=r.length,t[2]=o,t[3]=n,t[4]=s):s=t[4];let c;return t[5]===s?c=t[6]:(c=(0,X.jsx)(`output`,{"aria-live":`polite`,className:`shrink-0`,children:s}),t[5]=s,t[6]=c),c}function Nbe(e){let t=(0,Z.c)(3),{isPublished:n,hasUnpublishedChanges:r}=e;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:`Never published`}),t[0]=e):e=t[0],e}let i=r?`Unpublished changes`:`Published`,a;return t[1]===i?a=t[2]:(a=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:i}),t[1]=i,t[2]=a),a}function Pbe(e){return e.isSaving?`saving`:e.lastSaveError?`failed`:e.hasUnsavedChanges?`unsaved`:`saved`}var Fbe={saving:`Saving`,unsaved:`Unsaved changes`,failed:`Save failed`,saved:`Saved`},Ibe={saving:`text-muted-foreground`,unsaved:`text-warning`,failed:`text-destructive`,saved:`text-muted-foreground`};function Lbe(){let e=(0,Z.c)(14),t=wA(a2),n=wA(o2),r=wA(s2),i=wA(t2),a;e[0]!==n||e[1]!==t||e[2]!==r?(a=Pbe({isSaving:t,hasUnsavedChanges:n,lastSaveError:r}),e[0]=n,e[1]=t,e[2]=r,e[3]=a):a=e[3];let o=a,s=i&&(n||t),c;if(e[4]===s?c=e[5]:(c={enabled:s},e[4]=s,e[5]=c),_Y(window,`beforeunload`,Rbe,c),!i)return null;let l=Ibe[o],u;e[6]===l?u=e[7]:(u=Q(`flex shrink-0 items-center gap-1.5 whitespace-nowrap px-1 font-medium text-xs`,l),e[6]=l,e[7]=u);let d;e[8]===o?d=e[9]:(d=o===`saving`&&(0,X.jsx)(ay,{className:`size-3 animate-spin`}),e[8]=o,e[9]=d);let f=Fbe[o],p;return e[10]!==u||e[11]!==d||e[12]!==f?(p=(0,X.jsxs)(`output`,{"aria-live":`polite`,className:u,children:[d,f]}),e[10]=u,e[11]=d,e[12]=f,e[13]=p):p=e[13],p}function Rbe(e){e.preventDefault()}var zbe=e=>{let t=(0,Z.c)(57),{workflowId:n}=e,r=Abe(),i=jbe(r),a;if(t[0]!==r.allWorkflows||t[1]!==r.currentWorkflowId){let e;t[3]===r.currentWorkflowId?e=t[4]:(e=e=>e.id===r.currentWorkflowId,t[3]=r.currentWorkflowId,t[4]=e),a=r.allWorkflows.find(e),t[0]=r.allWorkflows,t[1]=r.currentWorkflowId,t[2]=a}else a=t[2];let o=!!a?.publishedVersionId,s=n??``,c;t[5]===s?c=t[6]:(c=Iue(s),t[5]=s,t[6]=c);let l=!!n,u;t[7]!==c||t[8]!==l?(u={...c,enabled:l},t[7]=c,t[8]=l,t[9]=u):u=t[9];let{data:d}=Xe(u),f=d!==void 0&&d,p;t[10]!==i||t[11]!==r||t[12]!==n?(p=(0,X.jsx)(sbe,{actions:i,state:r,workflowId:n}),t[10]=i,t[11]=r,t[12]=n,t[13]=p):p=t[13];let m;t[14]!==r.workflowMode||t[15]!==n?(m=n&&r.workflowMode===`test`&&(0,X.jsx)(`span`,{className:`rounded-md border border-warning/40 bg-warning/10 px-2 py-1 font-medium text-warning text-xs`,children:`Test mode`}),t[14]=r.workflowMode,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==f||t[18]!==o||t[19]!==n?(h=n&&(0,X.jsx)(Nbe,{hasUnpublishedChanges:f,isPublished:o}),t[17]=f,t[18]=o,t[19]=n,t[20]=h):h=t[20];let g;t[21]!==r.isOwner||t[22]!==n?(g=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Read-only`}),t[21]=r.isOwner,t[22]=n,t[23]=g):g=t[23];let _;t[24]===i.handleShowIssues?_=t[25]:(_=(0,X.jsx)(Mbe,{onOpen:i.handleShowIssues}),t[24]=i.handleShowIssues,t[25]=_);let v;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Lbe,{}),t[26]=v):v=t[26];let y;t[27]!==g||t[28]!==_||t[29]!==p||t[30]!==m||t[31]!==h?(y=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 flex-wrap items-center gap-2`,children:[p,m,h,g,_,v]}),t[27]=g,t[28]=_,t[29]=p,t[30]=m,t[31]=h,t[32]=y):y=t[32];let b;t[33]!==i||t[34]!==r||t[35]!==n?(b=(0,X.jsx)(abe,{actions:i,state:r,workflowId:n}),t[33]=i,t[34]=r,t[35]=n,t[36]=b):b=t[36];let x;t[37]!==i.handleDuplicate||t[38]!==i.isDuplicating||t[39]!==r.isOwner||t[40]!==n?(x=n&&!r.isOwner&&(0,X.jsx)(ibe,{isDuplicating:i.isDuplicating,onDuplicate:i.handleDuplicate}),t[37]=i.handleDuplicate,t[38]=i.isDuplicating,t[39]=r.isOwner,t[40]=n,t[41]=x):x=t[41];let S;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(Zye,{}),t[42]=S):S=t[42];let C;t[43]===x?C=t[44]:(C=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x,S]}),t[43]=x,t[44]=C);let w;t[45]!==b||t[46]!==C?(w=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2 overflow-x-auto @xl:justify-end`,children:[b,C]}),t[45]=b,t[46]=C,t[47]=w):w=t[47];let T;t[48]!==y||t[49]!==w?(T=(0,X.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-4 top-4 z-10 flex flex-col items-stretch gap-2 @container @xl:flex-row @xl:items-start @xl:justify-between`,children:[y,w]}),t[48]=y,t[49]=w,t[50]=T):T=t[50];let E;t[51]!==r.workflowMode||t[52]!==n?(E=n&&r.workflowMode===`test`&&(0,X.jsxs)(`div`,{className:`-translate-x-1/2 pointer-events-none absolute bottom-4 left-1/2 z-10 max-w-xl rounded-md border border-warning/30 bg-warning/10 px-4 py-2 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-warning`,children:`Test mode active`}),(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:`No real email or SMS is sent unless a node is configured to route to a test recipient.`})]}),t[51]=r.workflowMode,t[52]=n,t[53]=E):E=t[53];let D;return t[54]!==T||t[55]!==E?(D=(0,X.jsxs)(X.Fragment,{children:[T,E]}),t[54]=T,t[55]=E,t[56]=D):D=t[56],D};function U7(e,t){return e?.data.label?.trim()||t}function Bbe(e){return e.data.type===`lifecycle`||E0(e)||Z6(e)}function Vbe(e){return w0(e.sourceHandle)||(typeof e.sourceHandle==`string`&&e.sourceHandle.length>0?e.sourceHandle:``)}function Hbe(e){let{joinNodeId:t,predecessorIds:n,edges:r}=e;if(n.length===0)return new Set;let i=null;for(let e of n){let t=q6(e,r);if(!i){i=t;continue}for(let e of i)t.has(e)||i.delete(e)}let a=q6(t,r);for(let e of i??[])a.delete(e);return a}function Ube(e){if(e.nodeById.get(e.nodeId)?.data.type===`lifecycle`)return!0;for(let t of q6(e.nodeId,e.edges))if(e.nodeById.get(t)?.data.type===`lifecycle`)return!0;return!1}function Wbe(e){let{joinNodeId:t,nodes:n,edges:r}=e,i=new Map(n.map(e=>[e.id,e])),a=U7(i.get(t),t),o=r.filter(e=>e.target===t).map(e=>e.source),s=q6(t,r);for(let e of o)if(!Ube({nodeId:e,nodeById:i,edges:r}))return`Node "${a}" cannot join an unreachable branch (found "${U7(i.get(e),e)}")`;let c=new Map;for(let e of r){if(e.target!==t&&!s.has(e.target))continue;let n=i.get(e.source);if(!n||!Bbe(n))continue;let r=c.get(n.id)??new Set;r.add(Vbe(e)),c.set(n.id,r)}for(let[e,t]of c){if(t.size<=1)continue;let n=i.get(e);return n?.data.type===`lifecycle`?`Node "${a}" cannot join the Started and Canceled branches`:`Node "${a}" cannot join mutually exclusive branches from "${U7(n,e)}"`}for(let e of Hbe({joinNodeId:t,predecessorIds:o,edges:r})){let t=i.get(e);if(t&&x0(t))return`Node "${a}" cannot join branches that include a Wait (found "${U7(t,e)}")`}return null}function Gbe(e){let t=new Map;for(let n of e.edges)t.set(n.target,(t.get(n.target)??0)+1);for(let[n,r]of t){if(r<=1)continue;let t=Wbe({joinNodeId:n,nodes:e.nodes,edges:e.edges});if(t)return t}return null}function Kbe(e,t){return Gue(e)??t?.displayLabel??null}var W7=(e,t,n,r)=>{let i=e.internals.handleBounds?.[t];if(!(i&&i.length>0))return[0,0];let a=(r?i.find(e=>(e.id??null)===r):void 0)??i.find(e=>e.position===n)??i[0];if(!a)return[0,0];let o=a.width/2,s=a.height/2;switch(n){case _w.Left:o=0;break;case _w.Right:o=a.width;break;case _w.Top:s=0;break;case _w.Bottom:s=a.height;break;default:throw Error(`Invalid handle position`)}return[e.internals.positionAbsolute.x+a.x+o,e.internals.positionAbsolute.y+a.y+s]},qbe=(e,t,n,r)=>{let i=_w.Bottom,[a,o]=W7(e,`source`,i,n),s=_w.Top,[c,l]=W7(t,`target`,s,r);return{sx:a,sy:o,tx:c,ty:l,sourcePos:i,targetPos:s}},Jbe={Animated:(0,Y.memo)(function(e){let t=(0,Z.c)(27),{id:n,source:r,sourceHandleId:i,target:a,targetHandleId:o,style:s,selected:c,data:l}=e,u=JO(r),d=JO(a);if(!(u&&d))return null;let f;if(t[0]!==i||t[1]!==u||t[2]!==o||t[3]!==d){let{sx:e,sy:n,tx:r,ty:a,sourcePos:s,targetPos:c}=qbe(u,d,i,o);f=k7({sourceX:e,sourceY:n,sourcePosition:s,targetX:r,targetY:a,targetPosition:c}),t[0]=i,t[1]=u,t[2]=o,t[3]=d,t[4]=f}else f=t[4];let[p,m,h]=f,g;t[5]!==l||t[6]!==i?(g=Kbe(i,l),t[5]=l,t[6]=i,t[7]=g):g=t[7];let _=g,v=l?.inactive===!0,y=c?`var(--primary)`:v?`var(--canvas-line-muted)`:`var(--canvas-line)`,b=v?`4, 8`:`5`,x;t[8]===v?x=t[9]:(x=v?{}:{animation:`dashdraw 0.5s linear infinite`},t[8]=v,t[9]=x);let S;t[10]!==s||t[11]!==y||t[12]!==b||t[13]!==x?(S={...s,stroke:y,strokeWidth:2,strokeDasharray:b,...x},t[10]=s,t[11]=y,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]!==p||t[16]!==n||t[17]!==S?(C=(0,X.jsx)(GD,{id:n,path:p,style:S}),t[15]=p,t[16]=n,t[17]=S,t[18]=C):C=t[18];let w;t[19]!==_||t[20]!==v||t[21]!==m||t[22]!==h?(w=_&&(0,X.jsx)(KO,{children:(0,X.jsx)(`div`,{className:`pointer-events-none absolute rounded-sm border bg-background px-1.5 py-0.5 font-medium text-xs text-muted-foreground leading-none`,style:{transform:`translate(-50%, -50%) translate(${m}px,${h}px)`,...v?{opacity:.7}:{}},children:_})}),t[19]=_,t[20]=v,t[21]=m,t[22]=h,t[23]=w):w=t[23];let T;return t[24]!==C||t[25]!==w?(T=(0,X.jsxs)(X.Fragment,{children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26],T})},Ybe=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`m-4 rounded-md border bg-card p-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(cE,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function Xbe(e,t){let n=t.filter(t=>t.source===e);return n.some(e=>w0(e.sourceHandle)===`true`)?n.some(e=>w0(e.sourceHandle)===`false`)?`true`:`false`:`true`}function Zbe(e){let{nodes:t,edges:n,sourceNodeId:r,catalog:i}=e,a=t8({targetNodeId:r,nodes:t,edges:n,catalog:i}),o=new Set(n.filter(e=>e.source===r).map(e=>e.sourceHandle)),s=a.find(e=>!o.has(Y6(e.name)))??a[0];return s?Y6(s.name):null}function G7(e){let{nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:a}=e,o=w0(i);if(o)return o;let s=t.find(e=>e.id===r);if(D0(s))return A0(s)??i??null;if(s?.data.type===`lifecycle`)return Cde(i)?i:k2;if(Z6(s)){let e=X6(i);return e?Y6(e):Zbe({nodes:t,edges:n,sourceNodeId:r,catalog:a})}return E0(s)?Xbe(r,n):i??null}var Qbe=e=>{let t=(0,Z.c)(12),{className:n}=e,r;t[0]===n?r=t[1]:(r=Q(`pointer-events-none absolute inset-0 animate-border-mask rounded-[inherit]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(`svg`,{className:`size-full overflow-visible`,xmlns:`http://www.w3.org/2000/svg`,children:(0,X.jsx)(`rect`,{fill:`none`,height:`calc(100% - 2px)`,rx:`6`,stroke:`var(--info)`,strokeWidth:`2`,width:`calc(100% - 2px)`,x:`1`,y:`1`})}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,X.jsx)(`div`,{className:r,children:i}),t[3]=r,t[4]=a);let o;t[5]===n?o=t[6]:(o=Q(`pointer-events-none absolute inset-0 rounded-[inherit] border-2 border-info/20`,n),t[5]=n,t[6]=o);let s;t[7]===o?s=t[8]:(s=(0,X.jsx)(`div`,{className:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,X.jsxs)(X.Fragment,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c},$be=d_(`flex flex-col rounded-xl border text-card-foreground shadow-sm`,{variants:{size:{default:`gap-6 py-6`,sm:`gap-4 py-4`}},defaultVariants:{size:`default`}});function exe(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Q($be({size:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,X.jsx)(`div`,{className:o,"data-size":a,"data-slot":`card`,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function txe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nxe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var rxe={running:{label:`Running`,Icon:ay,className:`bg-primary/5 text-foreground`,iconClassName:`animate-spin motion-reduce:animate-none`},success:{label:`Succeeded`,Icon:qv,className:`bg-success/10 text-success`,iconClassName:``},error:{label:`Failed`,Icon:cte,className:`bg-destructive/10 text-destructive`,iconClassName:``},cancelled:{label:`Cancelled`,Icon:Kv,className:`bg-cancelled/10 text-cancelled`,iconClassName:``}},ixe=e=>{let t=(0,Z.c)(11),{status:n}=e;if(!n||n===`idle`)return null;let r=rxe[n],i;t[0]===r.className?i=t[1]:(i=Q(`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-sm py-0.5 pr-2 pl-1.5 font-medium text-xs leading-none`,r.className),t[0]=r.className,t[1]=i);let a=r.Icon,o;t[2]===r.iconClassName?o=t[3]:(o=Q(`size-3`,r.iconClassName),t[2]=r.iconClassName,t[3]=o);let s;t[4]!==r.Icon||t[5]!==o?(s=(0,X.jsx)(a,{className:o,strokeWidth:2.5}),t[4]=r.Icon,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==r.label||t[8]!==i||t[9]!==s?(c=(0,X.jsxs)(`div`,{className:i,role:`status`,children:[s,r.label]}),t[7]=r.label,t[8]=i,t[9]=s,t[10]=c):c=t[10],c};function K7(e,t){return t===!1?null:t===!0?(0,X.jsx)(dD,{position:e===`source`?_w.Bottom:_w.Top,type:e}):t.map(t=>{let n=[e,t.position,t.style?.top,t.style?.right,t.style?.bottom,t.style?.left].join(`:`);return(0,X.jsx)(dD,{className:t.className,id:t.id,position:t.position,style:t.style,type:e},t.id??n)})}var q7=e=>{let t=(0,Z.c)(25),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({handles:r,className:n,status:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===`success`&&`border-2 border-success`,s=a===`error`&&`border-2 border-destructive`,c=a===`cancelled`&&`border-2 border-cancelled`,l;t[5]!==n||t[6]!==o||t[7]!==s||t[8]!==c?(l=Q(`node-container relative flex flex-col items-center justify-center gap-0 overflow-visible rounded-md border-[1.5px] border-canvas-line bg-card p-0 shadow-none transition-all duration-150 ease-out`,o,s,c,n),t[5]=n,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=a===`running`&&(0,X.jsx)(Qbe,{}),t[10]=a,t[11]=u);let d;t[12]===a?d=t[13]:(d=(0,X.jsx)(ixe,{status:a}),t[12]=a,t[13]=d);let f;t[14]===r.target?f=t[15]:(f=K7(`target`,r.target),t[14]=r.target,t[15]=f);let p;t[16]===r.source?p=t[17]:(p=K7(`source`,r.source),t[16]=r.source,t[17]=p);let m;return t[18]!==i||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p?(m=(0,X.jsxs)(exe,{className:l,...i,children:[u,d,f,p,i.children]}),t[18]=i,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m):m=t[24],m},J7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-base`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(txe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},Y7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nxe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},X7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex w-full flex-col items-center justify-center gap-1 px-3 py-2 text-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function axe(e){if(!e)return``;let t=e.messages.length,n=t===1?`issue`:`issues`;return e.severity===`blocking`?`${t} blocking ${n}`:`${t} ${n}`}function Z7(e){let t=(0,Z.c)(13),{issues:n,placement:r}=e,i=r===void 0?`corner`:r;if(!n)return null;let a,o;t[0]===n.messages?(a=t[1],o=t[2]):([a,...o]=n.messages,t[0]=n.messages,t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=axe(n),t[3]=n,t[4]=s);let c=i===`corner`?`absolute top-2 left-2 z-10`:`shrink-0`,l=n.severity===`blocking`?`bg-warning/50`:`bg-muted-foreground/40`,u;t[5]!==c||t[6]!==l?(u=Q(`rounded-full p-1`,c,l),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=o.length>0?`${a} and ${o.length} more`:a,f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(py,{className:`size-3.5 text-background`}),t[8]=f):f=t[8];let p;return t[9]!==s||t[10]!==u||t[11]!==d?(p=(0,X.jsx)(`div`,{"aria-label":s,className:u,role:`img`,title:d,children:f}),t[9]=s,t[10]=u,t[11]=d,t[12]=p):p=t[12],p}var oxe=/(-?\d+(?:\.\d+)?)\s*(ms|s|m|h|d|w)/gi,sxe=/(Z|[+-]\d{2}:\d{2})$/i,cxe=/^(-)?P(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/i,lxe=/^-?\d+(?:\.\d+)?$/,uxe=/^\d+$/,dxe=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Q7(e){switch(e){case`ms`:return 1;case`s`:return 1e3;case`m`:return 6e4;case`h`:return 36e5;case`d`:return 864e5;case`w`:return 6048e5;default:return NaN}}function fxe(e){let t=cxe.exec(e.trim());if(!t)return null;let n=t[1]?-1:1,r=Number.parseFloat(t[2]??`0`),i=Number.parseFloat(t[3]??`0`),a=Number.parseFloat(t[4]??`0`),o=Number.parseFloat(t[5]??`0`),s=Number.parseFloat(t[6]??`0`);return n*(r*Q7(`w`)+i*Q7(`d`)+a*Q7(`h`)+o*Q7(`m`)+s*Q7(`s`))}function $7(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;if(lxe.test(t))return Number.parseFloat(t);let n=fxe(t);if(n!==null)return n;let r=0,i=!1;for(let e of t.matchAll(oxe)){let t=Number.parseFloat(e[1]),n=Q7(e[2].toLowerCase());if(!Number.isFinite(t)||Number.isNaN(n))return null;i=!0,r+=t*n}return i?r:null}function pxe(e){let t=dxe.exec(e);return t?{year:Number.parseInt(t[1],10),month:Number.parseInt(t[2],10),day:Number.parseInt(t[3],10),hour:Number.parseInt(t[4]??`0`,10),minute:Number.parseInt(t[5]??`0`,10),second:Number.parseInt(t[6]??`0`,10)}:null}function e9(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).formatToParts(e),r=Object.fromEntries(n.map(e=>[e.type,e.value]));return Date.UTC(Number.parseInt(r.year,10),Number.parseInt(r.month,10)-1,Number.parseInt(r.day,10),Number.parseInt(r.hour,10),Number.parseInt(r.minute,10),Number.parseInt(r.second,10))-e.getTime()}function mxe(e,t){let n=pxe(e);if(!n)return null;let r=new Date(Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)),i=e9(r,t),a=new Date(r.getTime()-i),o=e9(a,t);return o===i?a:new Date(r.getTime()-o)}function t9(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==`number`)return n9(e);if(typeof e!=`string`)return null;let n=e.trim();return n?hxe(n)??gxe(n)??_xe(n,t):null}function n9(e){if(typeof e==`number`&&!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function hxe(e){if(!uxe.test(e))return null;let t=Number.parseInt(e,10);return n9(e.length<=10?t*1e3:t)}function gxe(e){return sxe.test(e)?n9(e):null}function _xe(e,t){if(t){let n=mxe(e,t);if(n)return n}return n9(e)}function vxe(e,t,n,r){let i=e9(e,r),a=e.getTime()+i,o=new Date(a),s=o.getUTCHours()*60+o.getUTCMinutes();if(s>=t&&s<n)return e;let c=Math.floor(t/60),l=t%60,u=s<t?0:1,d=new Date(a);d.setUTCDate(d.getUTCDate()+u),d.setUTCHours(c,l,0,0);let f=new Date(d.getTime()-i),p=e9(f,r);return p===i?f:new Date(d.getTime()-p)}function yxe(e){let t=f4(e.waitAllowedHoursMode);if(t===`off`)return{date:e.candidate};let n=_fe({mode:t,startTime:e.waitAllowedStartTime,endTime:e.waitAllowedEndTime});if(n.length>0)return{date:e.candidate,error:n.map(e=>e.message).join(` `)};if(!e.timeZone)return{date:e.candidate,error:`Timezone is required when allowed-hours window is enabled.`};let r=p4(e.waitAllowedStartTime),i=p4(e.waitAllowedEndTime);return r===null||i===null?{date:e.candidate,error:`Invalid allowed-hours time format after validation.`}:{date:vxe(e.candidate,r,i,e.timeZone)}}function r9(e){let t=e.now??new Date,n=typeof e.waitTimezone==`string`&&e.waitTimezone.trim()?e.waitTimezone.trim():void 0,r;if(e.waitUntil!==void 0&&e.waitUntil!==``){let t=t9(e.waitUntil,n);if(!t)return{error:`Invalid waitUntil value. Use an ISO timestamp or unix epoch.`};let i=$7(e.waitOffset);if(e.waitOffset!==void 0&&e.waitOffset!==``&&i===null)return{error:`Invalid waitOffset value. Use duration like -1d, 6h, 30m, or ISO duration.`};r=new Date(t.getTime()+(i??0))}else{let n=$7(e.waitDuration);if(n===null)return{error:`Invalid waitDuration value. Use milliseconds, duration tokens (e.g. 24h), or ISO duration.`};r=new Date(t.getTime()+n)}let i=yxe({candidate:r,waitAllowedHoursMode:e.waitAllowedHoursMode,waitAllowedStartTime:e.waitAllowedStartTime,waitAllowedEndTime:e.waitAllowedEndTime,timeZone:n});return i.error?{error:i.error}:{waitUntil:i.date}}var bxe={};function xxe(){let e=(0,Z.c)(5),t=wA(O2),n;e[0]===t?n=e[1]:(n=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:t??``},select:eye}),e[0]=t,e[1]=n);let r=t!==null,i;e[2]!==n||e[3]!==r?(i={...n,enabled:r},e[2]=n,e[3]=r,e[4]=i):i=e[4];let{data:a}=Xe(i);return a??bxe}var Sxe=Wh(Ch({waitMode:ph(Rh),waitTimezone:ph(Rh),waitDuration:ph(gh),waitUntil:ph(gh),waitOffset:ph(gh),waitTimeout:ph(gh)}));function i9(e){return typeof e==`string`&&e.includes(`{{`)&&e.includes(`}}`)}function a9(e){let t=Math.max(Math.floor(e/1e3),0),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return`${n} ${n===1?`day`:`days`} ${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function o9(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0,timeZoneName:`short`}),r=Object.fromEntries(n.formatToParts(e).map(e=>[e.type,e.value])),i=r.dayPeriod?` ${r.dayPeriod.toUpperCase()}`:``,a=r.timeZoneName?` ${r.timeZoneName}`:``;return`${r.month} ${r.day}, ${r.year} ${r.hour}:${r.minute}${i}${a}`}function Cxe(e,t){let n=(0,Z.c)(15),r=v0(t,`waitMode`,`delay`),i=e===b1.wait&&(r===`delay`||r===`event`),a=t?.waitDuration,o=t?.waitUntil,s=t?.waitOffset,c;n[0]===t?c=n[1]:(c=typeof t?.waitTimezone==`string`&&t.waitTimezone.trim()?t.waitTimezone.trim():void 0,n[0]=t,n[1]=c);let l=c,u=i9(a)||i9(o)||i9(s),d;bb0:{if(!i||u||r===`event`){d=null;break bb0}let e;n[2]!==a||n[3]!==s||n[4]!==l||n[5]!==o?(e=r9({waitDuration:a,waitUntil:o,waitOffset:s,waitTimezone:l}),n[2]=a,n[3]=s,n[4]=l,n[5]=o,n[6]=e):e=n[6],d=e}let f=d;if(!i)return null;if(r===`event`){let e;return n[7]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Waiting for event`,triggerTime:`Resumes when a matching event arrives`},n[7]=e):e=n[7],e}if(u){let e;return n[8]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Runtime-calculated`,triggerTime:`Trigger time comes from workflow data`},n[8]=e):e=n[8],e}if(!f?.waitUntil){let e;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Set wait duration`,triggerTime:`Add a valid wait time`},n[9]=e):e=n[9],e}let p;n[10]!==f.waitUntil||n[11]!==l?(p=o9(f.waitUntil,l),n[10]=f.waitUntil,n[11]=l,n[12]=p):p=n[12];let m;return n[13]===p?m=n[14]:(m={countdown:`Delay configured`,triggerTime:p},n[13]=p,n[14]=m),m}function wxe(e,t,n){let r=(0,Z.c)(16),i=e===b1.wait&&t!==null&&n!==void 0&&(n.status===`running`||n.status===`pending`),a;r[0]===i?a=r[1]:(a={intervalMs:1e3,enabled:i},r[0]=i,r[1]=a);let o=SY(a);n?.input;let s;bb0:{if(!i){s=null;break bb0}let e;r[2]===n?.input?e=r[3]:(e=Sxe(n?.input)??null,r[2]=n?.input,r[3]=e),s=e}let c=s,l,u,d;if(r[4]!==n||r[5]!==o||r[6]!==c||r[7]!==i){d=Symbol.for(`react.early_return_sentinel`);bb1:{let e=i&&n?.startedAt!==void 0?t9(n.startedAt):null;if(!(i&&c&&e)){d=null;break bb1}let t=c.waitMode||`delay`,a=c.waitTimezone||void 0;if(t===`event`){let t=r9({now:e,waitDuration:c.waitTimeout});if(!t.waitUntil){d={countdown:`Waiting for event`,triggerTime:`Resumes when matching event arrives`};break bb1}d={countdown:a9(t.waitUntil.getTime()-o),triggerTime:o9(t.waitUntil,a)};break bb1}let s=r9({now:e,waitDuration:c.waitDuration,waitUntil:c.waitUntil,waitOffset:c.waitOffset,waitTimezone:a});if(!s.waitUntil){d={countdown:`Runtime-calculated`,triggerTime:`Waiting timestamp unavailable`};break bb1}let f=s.waitUntil.getTime()-o;r[11]===f?l=r[12]:(l=a9(f),r[11]=f,r[12]=l),u=o9(s.waitUntil,a)}r[4]=n,r[5]=o,r[6]=c,r[7]=i,r[8]=l,r[9]=u,r[10]=d}else l=r[8],u=r[9],d=r[10];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;return r[13]!==l||r[14]!==u?(f={countdown:l,triggerTime:u},r[13]=l,r[14]=u,r[15]=f):f=r[15],f}var Txe=e=>({"gpt-5":`GPT-5`,"openai/gpt-5.1-instant":`GPT-5.1 Instant`,"openai/gpt-5.1-codex":`GPT-5.1 Codex`,"openai/gpt-5.1-codex-mini":`GPT-5.1 Codex Mini`,"openai/gpt-5.1-thinking":`GPT-5.1 Thinking`,"gpt-4":`GPT-4`,"gpt-4o":`GPT-4o`,"gpt-4o-mini":`GPT-4o Mini`,"claude-3-5-sonnet":`Claude 3.5`,"claude-3-opus":`Claude 3 Opus`,"anthropic/claude-opus-4.5":`Claude Opus 4.5`,"anthropic/claude-sonnet-4.5":`Claude Sonnet 4.5`,"anthropic/claude-haiku-4.5":`Claude Haiku 4.5`,"google/gemini-3-pro-preview":`Gemini 3 Pro Preview`,"google/gemini-2.5-flash-lite":`Gemini 2.5 Flash Lite`,"google/gemini-2.5-flash":`Gemini 2.5 Flash`,"google/gemini-2.5-pro":`Gemini 2.5 Pro`,"meta/llama-4-scout":`Llama 4 Scout`,"meta/llama-3.3-70b":`Llama 3.3 70B`,"meta/llama-3.1-8b":`Llama 3.1 8B`,"moonshotai/kimi-k2-0905":`Kimi K2`,"openai/gpt-oss-120b":`GPT OSS 120B`,"openai/gpt-oss-safeguard-20b":`GPT OSS Safeguard 20B`,"openai/gpt-oss-20b":`GPT OSS 20B`,"o1-preview":`o1 Preview`,"o1-mini":`o1 Mini`,"bfl/flux-2-pro":`FLUX.2 Pro`,"bfl/flux-1-pro":`FLUX.1 Pro`,"openai/dall-e-3":`DALL-E 3`,"google/imagen-4.0-generate":`Imagen 4.0`})[e]||e,Exe=(e,t)=>{let n=Py(e,t)?.integration;return n&&Fy(e,n)?.label||`System`},s9=e=>{let t=(0,Z.c)(19),{actionType:n,catalog:r,className:i}=e,a=i===void 0?O4:i,o=xy();switch(n){case b1.condition:{let e;t[0]===a?e=t[1]:(e=Q(a,`text-node-condition`),t[0]=a,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(fte,{className:e,strokeWidth:1.5}),t[2]=e,t[3]=n),n}case b1.eventSplit:{let e;t[4]===a?e=t[5]:(e=Q(a,`text-node-split`),t[4]=a,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,X.jsx)(Ate,{className:e,strokeWidth:1.5}),t[6]=e,t[7]=n),n}case b1.wait:{let e;t[8]===a?e=t[9]:(e=Q(a,`text-node-wait`),t[8]=a,t[9]=e);let n;return t[10]===e?n=t[11]:(n=(0,X.jsx)(hte,{className:e,strokeWidth:1.5}),t[10]=e,t[11]=n),n}}let s=Py(r,n)?.integration;if(s){let e=o[s];if(e){let n=e.icon,r;return t[12]!==n||t[13]!==a?(r=(0,X.jsx)(n,{className:a}),t[12]=n,t[13]=a,t[14]=r):r=t[14],r}}let c;t[15]===a?c=t[16]:(c=Q(a,`text-node-wait`),t[15]=a,t[16]=c);let l;return t[17]===c?l=t[18]:(l=(0,X.jsx)(gy,{className:c,strokeWidth:1.5}),t[17]=c,t[18]=l),l};function Dxe(e){let t=(0,Z.c)(14),{base64:n}=e,[r,i]=(0,Y.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Q(O4,`relative cursor-zoom-in overflow-hidden rounded-lg transition-transform hover:scale-105`),o=e=>{e.stopPropagation(),i(!0)},t[0]=a,t[1]=o):(a=t[0],o=t[1]);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=Q(O4,`object-cover`),t[2]=s):s=t[2];let c=`data:image/png;base64,${n}`,l;t[3]===c?l=t[4]:(l=(0,X.jsx)(`button`,{className:a,onClick:o,type:`button`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:s,height:20,src:c,width:20})}),t[3]=c,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(mY,{className:`sr-only`,children:`Generated Image`}),t[5]=u):u=t[5];let d=`data:image/png;base64,${n}`,f;t[6]===d?f=t[7]:(f=(0,X.jsxs)(dY,{className:`max-w-3xl p-2`,showCloseButton:!1,children:[u,(0,X.jsx)(`div`,{className:`relative aspect-square w-full overflow-hidden rounded-lg`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:`h-auto w-full object-contain`,height:768,src:d,width:768})})]}),t[6]=d,t[7]=f);let p;t[8]!==r||t[9]!==f?(p=(0,X.jsx)(cY,{onOpenChange:i,open:r,children:f}),t[8]=r,t[9]=f,t[10]=p):p=t[10];let m;return t[11]!==l||t[12]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[l,p]}),t[11]=l,t[12]=p,t[13]=m):m=t[13],m}var c9=`38%`,l9=`62%`;function u9(e,t){return`${(e+.5)/t*100}%`}var d9=`group-child-handle`,Oxe=[{position:_w.Top,className:d9}],kxe=[{position:_w.Bottom,className:d9}],Axe=[{id:`true`,position:_w.Bottom,className:d9,style:{left:c9}},{id:`false`,position:_w.Bottom,className:d9,style:{left:l9}}];function jxe(e){let t=(0,Z.c)(26),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=_0(n?.config,`actionType`),c=T0(s),l;if(t[0]!==i||t[1]!==o?(l=()=>{o(i)},t[0]=i,t[1]=o,t[2]=l):l=t[2],yY(c,l),!n)return null;let u=n.label||(s?Py(a,s)?.label:void 0)||s||`Action`,d=r&&`border-primary`,f=n.enabled===!1&&`opacity-50`,p;t[3]!==d||t[4]!==f?(p=Q(`nodrag flex h-14 w-[188px] flex-row items-center shadow-none transition-all duration-150 ease-out`,d,f),t[3]=d,t[4]=f,t[5]=p):p=t[5];let m=`action-node-${i}`,h=c?Axe:kxe,g;t[6]===h?g=t[7]:(g={target:Oxe,source:h},t[6]=h,t[7]=g);let _;t[8]!==s||t[9]!==a?(_=s?(0,X.jsx)(s9,{actionType:s,catalog:a,className:Q(O4,`shrink-0`)}):(0,X.jsx)(gy,{className:Q(O4,`shrink-0 text-muted-foreground`),strokeWidth:1.5}),t[8]=s,t[9]=a,t[10]=_):_=t[10];let v;t[11]===u?v=t[12]:(v=(0,X.jsx)(J7,{className:`truncate text-sm`,children:u}),t[11]=u,t[12]=v);let y;t[13]!==n.enabled||t[14]!==n.issues?(y=n.enabled!==!1&&(0,X.jsx)(Z7,{issues:n.issues,placement:`inline`}),t[13]=n.enabled,t[14]=n.issues,t[15]=y):y=t[15];let b;t[16]!==y||t[17]!==_||t[18]!==v?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 px-3`,children:[_,v,y]}),t[16]=y,t[17]=_,t[18]=v,t[19]=b):b=t[19];let x;return t[20]!==n.status||t[21]!==b||t[22]!==p||t[23]!==m||t[24]!==g?(x=(0,X.jsx)(q7,{className:p,"data-testid":m,handles:g,status:n.status,children:b}),t[20]=n.status,t[21]=b,t[22]=p,t[23]=m,t[24]=g,t[25]=x):x=t[25],x}var f9=(0,Y.memo)(e=>{let t=(0,Z.c)(99),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=wA(O2),c=xxe()[i],l,u,d;t[0]===n?.config?(l=t[1],u=t[2],d=t[3]):(l=_0(n?.config,`actionType`),u=T0(l),d=Dme(l),t[0]=n?.config,t[1]=l,t[2]=u,t[3]=d);let f=d,p=k8(f?i:null),m=wxe(l??``,s,c),h=Cxe(l??``,n?.config),g=m??h,_;t[4]!==f||t[5]!==p?(_=f?p.map(Mxe).join(`|`):null,t[4]=f,t[5]=p,t[6]=_):_=t[6];let v=_,y;if(t[7]!==i||t[8]!==u||t[9]!==f||t[10]!==o?(y=()=>{(u||f)&&o(i)},t[7]=i,t[8]=u,t[9]=f,t[10]=o,t[11]=y):y=t[11],yY(u?i:v,y),!n)return null;let b=n.status,x;t[12]!==l||t[13]!==c?.output||t[14]!==s?(x=s&&l===`Generate Image`?v7(c?.output):null,t[12]=l,t[13]=c?.output,t[14]=s,t[15]=x):x=t[15];let S=x;if(!l){let e=n.enabled===!1,a=r&&`border-primary`,o=e&&`opacity-50`,s;t[16]!==a||t[17]!==o?(s=Q(a,o),t[16]=a,t[17]=o,t[18]=s):s=t[18];let c=`action-node-${i}`,l;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(l={target:!0,source:!0},t[19]=l):l=t[19];let u;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(u=T4(),t[20]=u):u=t[20];let d;t[21]===e?d=t[22]:(d=e&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[21]=e,t[22]=d);let f;t[23]!==n.issues||t[24]!==e?(f=!e&&(0,X.jsx)(Z7,{issues:n.issues}),t[23]=n.issues,t[24]=e,t[25]=f):f=t[25];let p;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(gy,{className:Q(O4,`text-muted-foreground`),strokeWidth:1.5}),t[26]=p):p=t[26];let m=n.label||`Action`,h;t[27]===m?h=t[28]:(h=(0,X.jsx)(J7,{children:m}),t[27]=m,t[28]=h);let g;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(Y7,{children:`Select an action`}),t[29]=g):g=t[29];let _;t[30]===h?_=t[31]:(_=(0,X.jsxs)(X7,{children:[p,h,g]}),t[30]=h,t[31]=_);let v;return t[32]!==b||t[33]!==d||t[34]!==f||t[35]!==_||t[36]!==s||t[37]!==c?(v=(0,X.jsxs)(q7,{className:s,"data-testid":c,handles:l,status:b,style:u,children:[d,f,_]}),t[32]=b,t[33]=d,t[34]=f,t[35]=_,t[36]=s,t[37]=c,t[38]=v):v=t[38],v}let C;t[39]!==l||t[40]!==a?(C=Py(a,l),t[39]=l,t[40]=a,t[41]=C):C=t[41];let w=C,T=n.label||w?.label||l,E;t[42]!==l||t[43]!==n.config?(E=()=>l===`Generate Text`?v0(n.config,`aiModel`,`meta/llama-4-scout`):l===`Generate Image`?v0(n.config,`imageModel`,`google/imagen-4.0-generate`):null,t[42]=l,t[43]=n.config,t[44]=E):E=t[44];let D=E,O,k;if(t[45]!==l||t[46]!==a||t[47]!==n.description||t[48]!==n.enabled||t[49]!==D||t[50]!==g){let e=D();O=n.enabled===!1,k=g?g.countdown:e?Txe(e):n.description||Exe(a,l),t[45]=l,t[46]=a,t[47]=n.description,t[48]=n.enabled,t[49]=D,t[50]=g,t[51]=O,t[52]=k}else O=t[51],k=t[52];let A=k,j=r&&`border-primary`,M=O&&`opacity-50`,N;t[53]!==j||t[54]!==M?(N=Q(j,M),t[53]=j,t[54]=M,t[55]=N):N=t[55];let P=`action-node-${i}`,F;t[56]!==u||t[57]!==f||t[58]!==p?(F=u?[{id:`true`,position:_w.Bottom,style:{left:c9,width:12,height:12}},{id:`false`,position:_w.Bottom,style:{left:l9,width:12,height:12}}]:!f||p.map((e,t)=>({id:Y6(e.name),position:_w.Bottom,style:{left:u9(t,p.length),width:12,height:12}})),t[56]=u,t[57]=f,t[58]=p,t[59]=F):F=t[59];let I;t[60]===F?I=t[61]:(I={target:!0,source:F},t[60]=F,t[61]=I);let L;t[62]!==f||t[63]!==p?(L=T4(f?D4(p.length):192),t[62]=f,t[63]=p,t[64]=L):L=t[64];let R;t[65]===O?R=t[66]:(R=O&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[65]=O,t[66]=R);let z;t[67]!==n.issues||t[68]!==O?(z=!O&&(0,X.jsx)(Z7,{issues:n.issues}),t[67]=n.issues,t[68]=O,t[69]=z):z=t[69];let B;t[70]===u?B=t[71]:(B=u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[38%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`True`}),(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[62%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`False`})]}),t[70]=u,t[71]=B);let V;t[72]!==f||t[73]!==p?(V=f&&p.map((e,t)=>(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 max-w-28 -translate-x-1/2 truncate rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:u9(t,p.length)},title:e.name,children:e.label},e.name)),t[72]=f,t[73]=p,t[74]=V):V=t[74];let H;t[75]!==l||t[76]!==a||t[77]!==S?(H=S?(0,X.jsx)(Dxe,{base64:S}):(0,X.jsx)(s9,{actionType:l,catalog:a}),t[75]=l,t[76]=a,t[77]=S,t[78]=H):H=t[78];let U;t[79]===T?U=t[80]:(U=(0,X.jsx)(J7,{children:T}),t[79]=T,t[80]=U);let W;t[81]!==A||t[82]!==g?(W=A&&(0,X.jsx)(Y7,{className:g?`font-medium tabular-nums`:void 0,children:A}),t[81]=A,t[82]=g,t[83]=W):W=t[83];let G;t[84]!==H||t[85]!==U||t[86]!==W?(G=(0,X.jsxs)(X7,{children:[H,U,W]}),t[84]=H,t[85]=U,t[86]=W,t[87]=G):G=t[87];let K;return t[88]!==b||t[89]!==N||t[90]!==P||t[91]!==I||t[92]!==L||t[93]!==R||t[94]!==z||t[95]!==B||t[96]!==V||t[97]!==G?(K=(0,X.jsxs)(q7,{className:N,"data-testid":P,handles:I,status:b,style:L,children:[R,z,B,V,G]}),t[88]=b,t[89]=N,t[90]=P,t[91]=I,t[92]=L,t[93]=R,t[94]=z,t[95]=B,t[96]=V,t[97]=G,t[98]=K):K=t[98],K});f9.displayName=`StandaloneActionNode`;var p9=(0,Y.memo)(e=>{let t=(0,Z.c)(4);if(e.parentId){let n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(jxe,{...e}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(f9,{...e}),t[2]=e,t[3]=n),n});p9.displayName=`ActionNode`;function Mxe(e){return e.name}function Nxe(e){let t=(0,Z.c)(3),{data:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(cy,{className:`size-4`}),t[0]=r):r=t[0];let i;return t[1]===n.onClick?i=t[2]:(i=(0,X.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-border border-dashed bg-background/50 p-8 backdrop-blur-sm`,children:(0,X.jsxs)(zv,{className:`gap-2 shadow-lg`,onClick:n.onClick,size:`default`,children:[r,`Add a Step`]})}),t[1]=n.onClick,t[2]=i),i}var m9=(0,Y.memo)(e=>{let t=(0,Z.c)(19),{data:n,selected:r,id:i}=e;if(!n||!D0({data:n}))return null;let a=n.enabled===!1,o=r&&`border-primary`,s=a&&`opacity-50`,c;t[0]!==o||t[1]!==s?(c=Q(`flex h-full w-full flex-col rounded-md border-[1.5px] border-canvas-line bg-muted shadow-none`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=`group-node-${i}`,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(dD,{position:_w.Top,type:`target`}),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a&&(0,X.jsx)(`span`,{className:`rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[4]=a,t[5]=d);let f=n.label||`Group`,p;t[6]!==d||t[7]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-canvas-line/60 border-b px-3 font-medium text-sm`,children:[d,f]}),t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==n||t[10]!==i?(m=A0({data:n,id:i}),t[9]=n,t[10]=i,t[11]=m):m=t[11];let h;t[12]===m?h=t[13]:(h=(0,X.jsx)(dD,{id:m,position:_w.Bottom,type:`source`}),t[12]=m,t[13]=h);let g;return t[14]!==h||t[15]!==c||t[16]!==l||t[17]!==p?(g=(0,X.jsxs)(`div`,{className:c,"data-testid":l,children:[u,p,h]}),t[14]=h,t[15]=c,t[16]=l,t[17]=p,t[18]=g):g=t[18],g});m9.displayName=`GroupNode`;var h9=`25%`,g9=`75%`;function Pxe(e){let t=C1(e);return t?.startEvents.length?`On ${t.startEvents.join(`, `)}`:E1(t)?`Manual runs only`:`Nothing starts this yet`}var _9=(0,Y.memo)(e=>{let t=(0,Z.c)(33),{data:n,selected:r}=e;if(!n)return null;let i=n.label||`Lifecycle`,a;t[0]===n.config?a=t[1]:(a=Pxe(n.config),t[0]=n.config,t[1]=a);let o=a,s=n.description||o,c=n.status,l;t[2]===n.config?l=t[3]:(l=w1(n.config),t[2]=n.config,t[3]=l);let u=!l,d=r&&`border-primary`,f;t[4]===d?f=t[5]:(f=Q(d),t[4]=d,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p={id:k2,position:_w.Bottom,style:{left:h9,width:12,height:12}},t[6]=p):p=t[6];let m;t[7]===u?m=t[8]:(m={target:!1,source:[p,{id:A2,position:_w.Bottom,style:{left:g9,width:12,height:12,...u?{opacity:.45}:{}}}]},t[7]=u,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=T4(),t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:h9},children:`Started`}),t[10]=g):g=t[10];let _=u&&`opacity-50`,v;t[11]===_?v=t[12]:(v=Q(`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,_),t[11]=_,t[12]=v);let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y={left:g9},t[13]=y):y=t[13];let b;t[14]===v?b=t[15]:(b=(0,X.jsx)(`div`,{className:v,style:y,children:`Canceled`}),t[14]=v,t[15]=b);let x;t[16]===n.issues?x=t[17]:(x=(0,X.jsx)(Z7,{issues:n.issues}),t[16]=n.issues,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(sy,{className:Q(O4,`text-node-lifecycle`),strokeWidth:1.5}),t[18]=S):S=t[18];let C;t[19]===i?C=t[20]:(C=(0,X.jsx)(J7,{children:i}),t[19]=i,t[20]=C);let w;t[21]===s?w=t[22]:(w=s&&(0,X.jsx)(Y7,{children:s}),t[21]=s,t[22]=w);let T;t[23]!==C||t[24]!==w?(T=(0,X.jsxs)(X7,{children:[S,C,w]}),t[23]=C,t[24]=w,t[25]=T):T=t[25];let E;return t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==T||t[30]!==f||t[31]!==m?(E=(0,X.jsxs)(q7,{className:f,handles:m,status:c,style:h,children:[g,b,x,T]}),t[26]=c,t[27]=b,t[28]=x,t[29]=T,t[30]=f,t[31]=m,t[32]=E):E=t[32],E});_9.displayName=`LifecycleNode`;function Fxe(e){let t=(0,Z.c)(8),n=TA(d3),r=TA(f3),i=TA(p3),a=TA(Y4),o=yy(),s;t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==a||t[4]!==r?(s=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||V7(e.target))return;let t=e.key.toLowerCase();if(t===`c`){n()&&e.preventDefault();return}if(t===`v`){r()&&e.preventDefault();return}if(t===`d`){i()&&e.preventDefault();return}t===`g`&&a({catalog:o})&&e.preventDefault()},t[0]=o,t[1]=n,t[2]=i,t[3]=a,t[4]=r,t[5]=s):s=t[5];let c=s,l;t[6]===e?l=t[7]:(l={enabled:e},t[6]=e,t[7]=l),_Y(window,`keydown`,c,l)}var Ixe=300;function Lxe(){let e=(0,Z.c)(8),t=wA(Q4),n=yy(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=i0(),e[0]=r):r=e[0];let{data:i}=Xe(r),a=TA(C4),o=bY(t,Ixe),s;bb0:{if(!i){s=S4;break bb0}let t;e[1]!==n||e[2]!==i||e[3]!==o?(t=y4({nodes:G1(o),catalog:n,integrations:i}),e[1]=n,e[2]=i,e[3]=o,e[4]=t):t=e[4],s=t}let c=s,l;e[5]!==c||e[6]!==a?(l=()=>{a(e=>Lfe(e,c)?e:c)},e[5]=c,e[6]=a,e[7]=l):l=e[7],vY(c,l)}var Rxe=8,zxe=280;function Bxe(e){let t=(0,Z.c)(106),{menuState:n,onClose:r}=e,i=wA(Q4),a=wA($4),o=TA(h3),s=TA(Z4),c=TA(u3),l=TA(d3),u=TA(f3),d=TA(p3),f=TA(Y4),p=TA(X4),m=wA(lpe),h=TA(H4),g=TA(g2),_=yy(),{open:v}=RY(),{openSheet:y}=O7(),b=jY(),x=(0,Y.useRef)(null),S;t[0]!==o||t[1]!==n||t[2]!==r||t[3]!==v?(S=()=>{if(n?.nodeId){let e=n.nodeId;r(),v(CX,{title:`Delete Step`,message:`Are you sure you want to delete this node? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{o(e)}})}},t[0]=o,t[1]=n,t[2]=r,t[3]=v,t[4]=S):S=t[4];let C=S,w;t[5]!==b||t[6]!==n||t[7]!==r||t[8]!==y||t[9]!==g||t[10]!==h?(w=()=>{if(n?.nodeId){let e=n.nodeId;r(),h(e),g(`properties`),b&&y()}},t[5]=b,t[6]=n,t[7]=r,t[8]=y,t[9]=g,t[10]=h,t[11]=w):w=t[11];let T=w,E;t[12]!==s||t[13]!==n||t[14]!==r||t[15]!==v?(E=()=>{if(n?.edgeId){let e=n.edgeId;r(),v(CX,{title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s(e)}})}},t[12]=s,t[13]=n,t[14]=r,t[15]=v,t[16]=E):E=t[16];let D=E,O;t[17]!==c||t[18]!==n||t[19]!==r||t[20]!==g||t[21]!==h?(O=()=>{if(n?.flowPosition){let e={id:u0(),type:`action`,position:{x:n.flowPosition.x,y:n.flowPosition.y-56},data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};c(e),h(e.id),g(`properties`)}r()},t[17]=c,t[18]=n,t[19]=r,t[20]=g,t[21]=h,t[22]=O):O=t[22];let k=O,A;t[23]!==l||t[24]!==n||t[25]!==r?(A=()=>{n?.nodeId&&l(n.nodeId),r()},t[23]=l,t[24]=n,t[25]=r,t[26]=A):A=t[26];let j=A,M;t[27]!==d||t[28]!==n||t[29]!==r?(M=()=>{n?.nodeId&&d(n.nodeId),r()},t[27]=d,t[28]=n,t[29]=r,t[30]=M):M=t[30];let N=M,P;t[31]!==_||t[32]!==f||t[33]!==n||t[34]!==r?(P=()=>{if(n?.type!==`node`){r();return}f({catalog:_,selectedIds:n.selectedIds??new Set}),r()},t[31]=_,t[32]=f,t[33]=n,t[34]=r,t[35]=P):P=t[35];let F=P,I;t[36]!==n||t[37]!==r||t[38]!==p?(I=()=>{n?.nodeId&&p(n.nodeId),r()},t[36]=n,t[37]=r,t[38]=p,t[39]=I):I=t[39];let L=I,R;t[40]!==n?.flowPosition||t[41]!==r||t[42]!==u?(R=()=>{u(n?.flowPosition),r()},t[40]=n?.flowPosition,t[41]=r,t[42]=u,t[43]=R):R=t[43];let z=R,B;t[44]===r?B=t[45]:(B=e=>{let t=e.target;x.current&&!(t instanceof globalThis.Node&&x.current.contains(t))&&r()},t[44]=r,t[45]=B);let V=B,H;t[46]===r?H=t[47]:(H=e=>{e.key===`Escape`&&r()},t[46]=r,t[47]=H);let U=H,W=n!==null,G;t[48]===W?G=t[49]:(G={deferAttach:!0,enabled:W},t[48]=W,t[49]=G),_Y(document,`mousedown`,V,G);let K;t[50]===W?K=t[51]:(K={enabled:W},t[50]=W,t[51]=K),_Y(document,`keydown`,U,K);let q;if(t[52]===W?q=t[53]:(q={enabled:W},t[52]=W,t[53]=q),_Y(window,`resize`,r,q),!n)return null;let J,ee,te,ne,re,ie;if(t[54]!==_||t[55]!==a||t[56]!==n.nodeId||t[57]!==n.selectedIds||t[58]!==i){ee=n.nodeId?i.find(e=>e.id===n.nodeId):void 0,ne=ee?.data.type===`lifecycle`;let e;t[65]===n.selectedIds?e=t[66]:(e=n.selectedIds??new Set,t[65]=n.selectedIds,t[66]=e);let r=e,o;t[67]!==_||t[68]!==a||t[69]!==r||t[70]!==i?(o=P0(i,a,r,_),t[67]=_,t[68]=a,t[69]=r,t[70]=i,t[71]=o):o=t[71],te=o,J=te.ok,re=P4(ee),ie=ee?M4([ee]):null,t[54]=_,t[55]=a,t[56]=n.nodeId,t[57]=n.selectedIds,t[58]=i,t[59]=J,t[60]=ee,t[61]=te,t[62]=ne,t[63]=re,t[64]=ie}else J=t[59],ee=t[60],te=t[61],ne=t[62],re=t[63],ie=t[64];let ae=ie,oe=n.position.y+zxe+Rxe>window.innerHeight,se=ee?.data.label||`Step`,ce=`min(${n.position.x}px, calc(100vw - 296px))`,le;t[72]!==n.position.y||t[73]!==oe?(le=oe?{bottom:`calc(100vh - ${n.position.y}px)`}:{top:n.position.y},t[72]=n.position.y,t[73]=oe,t[74]=le):le=t[74];let ue;t[75]!==ce||t[76]!==le?(ue={left:ce,...le},t[75]=ce,t[76]=le,t[77]=ue):ue=t[77];let de;t[78]!==J||t[79]!==ae||t[80]!==te.error||t[81]!==te.ok||t[82]!==j||t[83]!==C||t[84]!==N||t[85]!==T||t[86]!==F||t[87]!==L||t[88]!==ne||t[89]!==n.type||t[90]!==se||t[91]!==re?(de=n.type===`node`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y9,{icon:(0,X.jsx)(kte,{className:`size-4`}),label:`Edit ${se}`,onClick:T}),(0,X.jsx)(y9,{disabled:ne,icon:(0,X.jsx)($v,{className:`size-4`}),label:`Copy`,onClick:j,shortcut:v9(`C`)}),(0,X.jsx)(y9,{disabled:ne,icon:(0,X.jsx)(ute,{className:`size-4`}),label:`Duplicate`,onClick:N,shortcut:v9(`D`)}),(0,X.jsx)(y9,{disabled:!J,hint:!J&&!te.ok?te.error:void 0,icon:(0,X.jsx)(mte,{className:`size-4`}),label:`Group`,onClick:F,shortcut:v9(`G`)}),(0,X.jsx)(y9,{disabled:!re,icon:(0,X.jsx)(my,{className:`size-4`}),label:`Ungroup`,onClick:L}),(0,X.jsx)(y9,{disabled:ne||!!ae,hint:ae??void 0,icon:(0,X.jsx)(fy,{className:`size-4`}),label:`Delete ${se}`,onClick:C,variant:`destructive`})]}),t[78]=J,t[79]=ae,t[80]=te.error,t[81]=te.ok,t[82]=j,t[83]=C,t[84]=N,t[85]=T,t[86]=F,t[87]=L,t[88]=ne,t[89]=n.type,t[90]=se,t[91]=re,t[92]=de):de=t[92];let fe;t[93]!==D||t[94]!==n.type?(fe=n.type===`edge`&&(0,X.jsx)(y9,{icon:(0,X.jsx)(_te,{className:`size-4`}),label:`Delete Connection`,onClick:D,variant:`destructive`}),t[93]=D,t[94]=n.type,t[95]=fe):fe=t[95];let pe;t[96]!==k||t[97]!==z||t[98]!==m||t[99]!==n.type?(pe=n.type===`pane`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y9,{icon:(0,X.jsx)(cy,{className:`size-4`}),label:`Add Step`,onClick:k}),(0,X.jsx)(y9,{disabled:!m,icon:(0,X.jsx)(lte,{className:`size-4`}),label:`Paste`,onClick:z,shortcut:v9(`V`)})]}),t[96]=k,t[97]=z,t[98]=m,t[99]=n.type,t[100]=pe):pe=t[100];let me;return t[101]!==ue||t[102]!==de||t[103]!==fe||t[104]!==pe?(me=(0,Xi.createPortal)((0,X.jsxs)(`div`,{className:`fade-in-0 zoom-in-95 fixed z-50 max-h-[calc(100vh-1rem)] w-fit min-w-[8rem] max-w-72 animate-in overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md`,ref:x,style:ue,children:[de,fe,pe]}),document.body),t[101]=ue,t[102]=de,t[103]=fe,t[104]=pe,t[105]=me):me=t[105],me}function v9(e){return typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?`⌘${e}`:`Ctrl+${e}`}function y9(e){let t=(0,Z.c)(23),{icon:n,label:r,onClick:i,variant:a,disabled:o,hint:s,shortcut:c}=e,l=(a===void 0?`default`:a)===`destructive`&&`text-destructive hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive`,u=o&&`pointer-events-none opacity-50`,d;t[0]!==l||t[1]!==u?(d=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none`,`hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground`,l,u),t[0]=l,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,X.jsx)(`span`,{className:`shrink-0`,children:n}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,X.jsx)(`span`,{className:`w-full truncate`,children:r}),t[5]=r,t[6]=p);let m;t[7]===s?m=t[8]:(m=s?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs leading-tight`,children:s}):null,t[7]=s,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col items-start text-left`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==o||t[13]!==c?(g=c&&!o?(0,X.jsx)(`span`,{className:`ml-auto shrink-0 pl-4 text-muted-foreground text-xs tracking-widest`,children:c}):null,t[12]=o,t[13]=c,t[14]=g):g=t[14];let _;return t[15]!==o||t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==f||t[20]!==h||t[21]!==g?(_=(0,X.jsxs)(`button`,{className:d,disabled:o,onClick:i,title:s,type:`button`,children:[f,h,g]}),t[15]=o,t[16]=s,t[17]=i,t[18]=d,t[19]=f,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}function Vxe(e,t,n){let r=(0,Z.c)(12),i;r[0]!==n||r[1]!==t?(i=(e,r)=>{e.preventDefault(),t({type:`node`,position:{x:e.clientX,y:e.clientY},nodeId:r.id,selectedIds:n()})},r[0]=n,r[1]=t,r[2]=i):i=r[2];let a=i,o;r[3]===t?o=r[4]:(o=(e,n)=>{e.preventDefault(),t({type:`edge`,position:{x:e.clientX,y:e.clientY},edgeId:n.id})},r[3]=t,r[4]=o);let s=o,c;r[5]!==e||r[6]!==t?(c=n=>{n.preventDefault();let r=e({x:n.clientX,y:n.clientY});t({type:`pane`,position:{x:n.clientX,y:n.clientY},flowPosition:r})},r[5]=e,r[6]=t,r[7]=c):c=r[7];let l=c,u;return r[8]!==s||r[9]!==a||r[10]!==l?(u={onNodeContextMenu:a,onEdgeContextMenu:s,onPaneContextMenu:l},r[8]=s,r[9]=a,r[10]=l,r[11]=u):u=r[11],u}var b9=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),x9=b9((e,t)=>{var n=Object.defineProperty,r=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t,n)=>r(e,typeof t==`symbol`?t:t+``,n),o=i((e,t)=>{var n=class{constructor(e){a(this,`_isDirected`,!0),a(this,`_isMultigraph`,!1),a(this,`_isCompound`,!1),a(this,`_label`),a(this,`_defaultNodeLabelFn`,()=>{}),a(this,`_defaultEdgeLabelFn`,()=>{}),a(this,`_nodes`,{}),a(this,`_in`,{}),a(this,`_preds`,{}),a(this,`_out`,{}),a(this,`_sucs`,{}),a(this,`_edgeObjs`,{}),a(this,`_edgeLabels`,{}),a(this,`_nodeCount`,0),a(this,`_edgeCount`,0),a(this,`_parent`),a(this,`_children`),e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){var t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,a=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(e,t,n);var u=s(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n),a=this._edgeObjs[r];return a&&(e=a.v,t=a.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}filterEdges(e,t,n){if(e){var r=Object.values(e);return n?r.filter(function(e){return e.v===t&&e.w===n||e.v===n&&e.w===t}):r}}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function s(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function c(e,t){return o(e,t.v,t.w,t.name)}t.exports=n}),s=i((e,t)=>{t.exports=`3.0.2`}),c=i((e,t)=>{t.exports={Graph:o(),version:s()}}),l=i((e,t)=>{var n=o();t.exports={write:r,read:s};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function s(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}),u=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r,a){return i(e,String(t),r||n,a||function(t){return e.outEdges(t)})}function i(e,t,n,r){var i={},a=!0,o=0,s=e.nodes(),c=function(e){var t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){var n=t.v===e?t.v:t.w;c({v:n,w:n===t.v?t.w:t.v})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0}});for(var u=s.length,d=1;d<u&&(a=!1,o++,l(),a);d++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}}),d=i((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}}),f=i((e,t)=>{t.exports=class{constructor(){a(this,`_arr`,[]),a(this,`_keyIndices`,{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}}),p=i((e,t)=>{var n=f();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}}),m=i((e,t)=>{var n=p();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}}),h=i((e,t)=>{t.exports=n;function n(e,t,n){if(e[t].predecessor!==void 0)throw Error(`Invalid source vertex`);if(e[n].predecessor===void 0&&n!==t)throw Error(`Invalid destination vertex`);return{weight:e[n].distance,path:r(e,t,n)}}function r(e,t,n){for(var r=[],i=n;i!==t;)r.push(i),i=e[i].predecessor;return r.push(t),r.reverse()}}),g=i((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}}),_=i((e,t)=>{var n=g();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}}),v=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}}),y=i((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r}),b=i((e,t)=>{var n=y();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}}),x=i((e,t)=>{t.exports=n;function n(e,t,n,i,a){Array.isArray(t)||(t=[t]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);a=r(e,t,n===`post`,s,o,i,a)}),a}function r(e,t,n,i,a,o,s){return Object.hasOwn(i,t)||(i[t]=!0,n||(s=o(s,t)),a(t).forEach(function(t){s=r(e,t,n,i,a,o,s)}),n&&(s=o(s,t))),s}}),S=i((e,t)=>{var n=x();t.exports=r;function r(e,t,r){return n(e,t,r,function(e,t){return e.push(t),e},[])}}),C=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`post`)}}),w=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`pre`)}}),T=i((e,t)=>{var n=o(),r=f();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}e.nodeEdges(s).forEach(c)}return i}}),E=i((e,t)=>{var n=p(),r=u();t.exports=i;function i(e,t,n,r){return a(e,t,n,r||function(t){return e.outEdges(t)})}function a(e,t,i,a){if(i===void 0)return n(e,t,i,a);for(var o=!1,s=e.nodes(),c=0;c<s.length;c++){for(var l=a(s[c]),u=0;u<l.length;u++){var d=l[u],f=d.v===s[c]?d.v:d.w;i({v:f,w:f===d.v?d.w:d.v})<0&&(o=!0)}if(o)return r(e,t,i,a)}return n(e,t,i,a)}}),D=i((e,t)=>{t.exports={bellmanFord:u(),components:d(),dijkstra:p(),dijkstraAll:m(),extractPath:h(),findCycles:_(),floydWarshall:v(),isAcyclic:b(),postorder:C(),preorder:w(),prim:T(),shortestPaths:E(),reduce:x(),tarjan:g(),topsort:y()}}),O=c();t.exports={Graph:O.Graph,json:l(),alg:D(),version:O.version}}),Hxe=b9((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n}),Uxe=b9((e,t)=>{var n=x9().Graph,r=Hxe();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}}),S9=b9((e,t)=>{var n=x9().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}}),Wxe=b9((e,t)=>{var n=Uxe(),r=S9().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}}),Gxe=b9((e,t)=>{var n=S9();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}}),C9=b9((e,t)=>{var{applyWithChunking:n}=S9();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}),w9=b9((e,t)=>{var n=x9().Graph,r=C9().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}}),Kxe=b9((e,t)=>{var n=w9(),r=C9().slack,i=C9().longestPath,a=x9().alg.preorder,o=x9().alg.postorder,s=S9().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}}),qxe=b9((e,t)=>{var n=C9().longestPath,r=w9(),i=Kxe();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}}),Jxe=b9((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}}),Yxe=b9((e,t)=>{var n=S9();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}),Xxe=b9((e,t)=>{var n=S9();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}}),Zxe=b9((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}}),Qxe=b9((e,t)=>{var n=S9();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}}),$xe=b9((e,t)=>{var n=S9().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}}),eSe=b9((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}}),tSe=b9((e,t)=>{var n=S9();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}}),nSe=b9((e,t)=>{var n=S9();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}),rSe=b9((e,t)=>{var n=eSe(),r=tSe(),i=nSe();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}}),iSe=b9((e,t)=>{var n=x9().Graph,r=S9();t.exports=i;function i(e,t,r,i){i||=e.nodes();let o=a(e),s=new n({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(n=>{let i=e.node(n),a=e.parent(n);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(s.setNode(n),s.setParent(n,a||o),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=s.edge(r,n),a=i===void 0?0:i.weight;s.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&s.setNode(n,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),s}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}}),aSe=b9((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}}),oSe=b9((e,t)=>{var n=Qxe(),r=$xe(),i=rSe(),a=iSe(),o=aSe(),s=x9().Graph,c=S9();t.exports=l;function l(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t.disableOptimalOrderHeuristic)return;let p=1/0,m,h=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2,h),s=c.buildLayerMatrix(e);let i=r(e,s);i<p?(n=0,m=Object.assign({},s),p=i):i===p&&(m=structuredClone(s))}f(e,m)}function u(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return a(e,t,n,r.get(t)||[])})}function d(e,t,n){let r=new s;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let a=e.graph().root,s=i(e,a,r,t);s.vs.forEach((t,n)=>e.node(t).order=n),o(e,r,s.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}}),sSe=b9((e,t)=>{var n=x9().Graph,r=S9();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}}),cSe=b9((e,t)=>{var n=S9(),r=sSe().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=e.graph().rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}}),lSe=b9((e,t)=>{var n=Wxe(),r=Gxe(),i=qxe(),a=S9().normalizeRanks,o=Jxe(),s=S9().removeEmptyRanks,c=Yxe(),l=Xxe(),u=Zxe(),d=oSe(),f=cSe(),p=S9(),m=x9().Graph;t.exports=h;function h(e,t={}){let n=t.debugTiming?p.time:p.notime;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));return n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r)),r})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>I(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>L(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>R(e)),t(` removeBorderNodes`,()=>F(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`,rankalign:`center`},b=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=B(e.graph());return t.setGraph(Object.assign({},y,z(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=z(B(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=B(e.edge(n));t.setEdge(n,Object.assign({},w,z(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function F(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function I(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function L(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function R(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function z(e,t){return p.mapValues(p.pick(e,t),Number)}function B(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}}),uSe=b9((e,t)=>{var n=S9(),r=x9().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}}),dSe=b9((e,t)=>{t.exports=`2.0.4`}),T9=b9((e,t)=>{t.exports={graphlib:x9(),layout:lSe(),debug:uSe(),util:{time:S9().time,notime:S9().notime},version:dSe()}})();function fSe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function pSe(){return this.eachAfter(fSe)}function mSe(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function hSe(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function gSe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function _Se(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function vSe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function ySe(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function bSe(e){for(var t=this,n=xSe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function xSe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function SSe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function CSe(){return Array.from(this)}function wSe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function TSe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*ESe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function E9(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=kSe)):t===void 0&&(t=OSe);for(var n=new D9(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new D9(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(jSe)}function DSe(){return E9(this).eachBefore(ASe)}function OSe(e){return e.children}function kSe(e){return Array.isArray(e)?e[1]:null}function ASe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function jSe(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function D9(e){this.data=e,this.depth=this.height=0,this.parent=null}D9.prototype=E9.prototype={constructor:D9,count:pSe,each:mSe,eachAfter:gSe,eachBefore:hSe,find:_Se,sum:vSe,sort:ySe,path:bSe,ancestors:SSe,descendants:CSe,leaves:wSe,links:TSe,copy:DSe,[Symbol.iterator]:ESe};function MSe(e,t){return e.parent===t.parent?1:2}function O9(e){var t=e.children;return t?t[0]:e.t}function k9(e){var t=e.children;return t?t[t.length-1]:e.t}function NSe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function PSe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function FSe(e,t,n){return e.a.parent===t.parent?e.a:n}function A9(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}A9.prototype=Object.create(D9.prototype);function ISe(e){for(var t=new A9(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new A9(a[o],o)),i.parent=n;return(t.parent=new A9(null,0)).children=[t],t}function LSe(){var e=MSe,t=1,n=1,r=null;function i(i){var s=ISe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.x<l.x&&(l=e),e.x>u.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){PSe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=k9(o),i=O9(i),o&&i;)s=O9(s),a=k9(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(NSe(FSe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!k9(a)&&(a.t=o,a.m+=u-l),i&&!O9(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var RSe=`TB`,j9=40,M9=`__workflow-root__`;function N9(e,t){return e.x!==t.x||e.y!==t.y}function zSe(e){return e.sourceHandle===`true`?4:e.sourceHandle===`false`?3:X6(e.sourceHandle)?4:6}function BSe(e){return typeof e==`number`&&Number.isFinite(e)&&e<1024?{nodeSpacing:96,rankSpacing:72}:{nodeSpacing:132,rankSpacing:88}}function VSe(e,t){let n=e.node(t);return n?.x===void 0||n.y===void 0?null:{x:n.x,y:n.y}}var P9=new Map([[`true`,0],[`false`,1],[k2,0],[A2,1]]),HSe=2**53-1;function USe(e){if(D0(e.node)){let t=e.nodes.filter(t=>t.parentId===e.node.id).map(e=>e.id),n=new Set(t),{bounds:r}=H0(t,e.edges.filter(e=>n.has(e.source)&&n.has(e.target)),O0(e.node)),i=E4(r.columns,r.rows);return{width:i.width,height:i.height,handleRanks:P9}}if(!Z6(e.node))return{width:192,height:112,handleRanks:P9};let t=t8({targetNodeId:e.node.id,nodes:e.nodes,edges:e.edges,catalog:e.catalog});return{width:D4(t.length),height:112,handleRanks:new Map(t.map((e,t)=>[Y6(e.name),t]))}}function WSe(e){let t=t=>e.ranks.get(t.sourceHandle??``)??HSe,n=t=>e.positionXById.get(t)??0;return e.edges.toSorted((e,r)=>{let i=t(e)-t(r);return i===0?n(e.target)-n(r.target):i})}function GSe(e){let t=new Map(e.nodes.map(e=>[e.id,e.position.x])),n=new Map(e.nodes.map(e=>[e.id,[]]));for(let t of e.edges)n.get(t.source)?.push(t);let r=new Map,i=new Map;for(let a of e.nodes){let o=USe({node:a,nodes:e.allNodes,edges:e.allEdges,catalog:e.catalog});r.set(a.id,o.width),i.set(a.id,o.height),n.set(a.id,WSe({edges:n.get(a.id)??[],ranks:o.handleRanks,positionXById:t}))}return{nodes:e.nodes.toSorted((e,t)=>e.position.x-t.position.x),widthById:r,heightById:i,outEdgesBySource:n}}function KSe(e){let t=new T9.graphlib.Graph({directed:!0,multigraph:!1,compound:!1});t.setGraph({rankdir:RSe,nodesep:e.spacing.nodeSpacing,ranksep:e.spacing.rankSpacing,marginx:j9,marginy:j9}),t.setDefaultEdgeLabel(()=>({}));let n=t=>e.model.widthById.get(t)??192,r=t=>e.model.heightById.get(t)??112;for(let i of e.model.nodes)t.setNode(i.id,{width:n(i.id),height:r(i.id)});for(let n of e.model.nodes)for(let r of e.model.outEdgesBySource.get(n.id)??[])t.setEdge(r.source,r.target,{weight:zSe(r)});T9.layout(t);let i=!1;return{nodes:e.nodes.map(e=>{let a=VSe(t,e.id);if(!a)return e;let o={x:Math.round(a.x-n(e.id)/2),y:Math.round(a.y-r(e.id)/2)};return N9(e.position,o)?(i=!0,{...e,position:o}):e}),changed:i}}function qSe(e){let t=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.model.outEdgesBySource.values())for(let e of n)if(e.source===e.target||(t.set(e.target,(t.get(e.target)??0)+1),(t.get(e.target)??0)>1))return null;let n=e.model.nodes.filter(e=>(t.get(e.id)??0)===0);if(n.length===0)return null;let r=new Set,i=new Set;function a(t){if(i.has(t))return null;i.add(t),r.add(t);let n=e.model.outEdgesBySource.get(t)??[],o=[];for(let e of n){let t=a(e.target);if(!t)return null;o.push(t)}return i.delete(t),o.length===0?{id:t}:{id:t,children:o}}let o=[];for(let e of n){let t=a(e.id);if(!t)return null;o.push(t)}return r.size===e.nodes.length?{id:M9,children:o}:null}function JSe(e){if(e.nodes.some(e=>D0(e)))return null;let t=qSe({nodes:e.nodes,model:e.model});if(!t)return null;let n=t=>e.model.widthById.get(t)??192,r=E9(t,e=>e.children??[]),i=192+e.spacing.nodeSpacing;LSe().nodeSize([i,112+e.spacing.rankSpacing]).separation((t,r)=>{let a=t.parent===r.parent?e.spacing.nodeSpacing:e.spacing.nodeSpacing*2;return(n(t.data.id)/2+n(r.data.id)/2+a)/i})(r);let a=r.descendants().filter(e=>e.data.id!==M9);if(a.length===0)return{nodes:e.nodes,changed:!1};let o=new Map;for(let e of a){let t=e.x??0,r=e.y??0;o.set(e.data.id,{x:t-n(e.data.id)/2,y:r-56})}let s=Array.from(o.values()),c=Math.min(...s.map(e=>e.x)),l=Math.min(...s.map(e=>e.y)),u=!1;return{nodes:e.nodes.map(e=>{let t=o.get(e.id);if(!t)return e;let n={x:Math.round(t.x-c+j9),y:Math.round(t.y-l+j9)};return N9(e.position,n)?(u=!0,{...e,position:n}):e}),changed:u}}function YSe(e){return e.type!==`add`&&!e.parentId}function XSe(e){let t=e.nodes.filter(YSe);if(t.length===0)return{nodes:e.nodes,changed:!1};let n=new Set(t.map(e=>e.id)),r=Jue(e.nodes,e.edges).filter(e=>n.has(e.source)&&n.has(e.target)),i=BSe(e.availableWidth),a=GSe({nodes:t,allNodes:e.nodes,edges:r,allEdges:e.edges,catalog:e.catalog}),o=JSe({nodes:t,model:a,spacing:i})??KSe({nodes:t,model:a,spacing:i}),s=new Map(o.nodes.map(e=>[e.id,e])),c=Hfe(e.nodes.map(e=>{let t=s.get(e.id);return t?{...e,position:t.position}:e}),e.edges),l=new Map(e.nodes.map(e=>[e.id,e]));return{nodes:c,changed:c.some(e=>{let t=l.get(e.id);return!t||N9(t.position,e.position)||t.width!==e.width||t.height!==e.height})}}var ZSe={[U1]:Jbe.Animated},QSe={type:U1},$Se={lifecycle:_9,action:p9,add:Nxe,group:m9};function eCe(){let e=yy(),t=wA($fe),n=wA(epe),r=wA($4),i=wA(n3),a=wA(Q0),[o]=EA(_2),s=jY(),{openSheet:c}=O7(),l=wA(xde),u=s?null:l,[d,f]=EA(v2),p=TA(spe),m=TA(cpe),h=TA(H4),g=TA(U4),_=TA(u3),v=TA(upe),y=TA(Zfe),b=TA(ope),x=TA(ipe),S=TA(_3),C=TA(v3),w=TA(g2),{screenToFlowPosition:T,fitView:E,getViewport:D,setViewport:O}=RE(),k=(0,Y.useRef)(null),A=(0,Y.useRef)(null),j=(0,Y.useRef)(null),M=(0,Y.useRef)(!1),N=(0,Y.useRef)(!1),P=(0,Y.useRef)(null),F=(0,Y.useRef)(0),I=(0,Y.useRef)(!1),[L,R]=(0,Y.useState)(!1),[z,B]=(0,Y.useState)(!1),[V,H]=(0,Y.useState)(null),U=(0,Y.useRef)(new Set);_Y(window,`pointerdown`,e=>{e.button===2&&(U.current=new Set(t.filter(e=>e.selected).map(e=>e.id)))},{capture:!0,enabled:!i});let{onNodeContextMenu:W,onEdgeContextMenu:G,onPaneContextMenu:K}=Vxe(T,H,(0,Y.useCallback)(()=>U.current,[])),q=(0,Y.useCallback)(()=>{H(null)},[]),J=t.some(e=>e.type!==`add`),ee=(0,Y.useMemo)(()=>t.filter(e=>e.type!==`add`).length,[t]),te=(0,Y.useRef)(!1);vY(d,()=>{if(!d||te.current||(te.current=!0,document.cookie.split(`; `).find(e=>e.startsWith(`sidebar-collapsed=`))?.split(`=`)[1]===`true`))return;let e=D(),t=window.innerWidth*.3/2;O({...e,x:e.x-t},{duration:0})}),yY(a,()=>{if(d&&N.current){R(!0),f(!1);return}E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0),f(!1)}),yY(!a&&J,()=>{a||!J||(E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0))});let ne=(0,Y.useCallback)(e=>{!(e.metaKey||e.ctrlKey)||e.key.toLowerCase()!==`z`||V7(e.target)||i||(e.preventDefault(),e.shiftKey?C():S())},[S,C,i]);_Y(window,`keydown`,ne),Fxe(!i),Lxe();let re=(0,Y.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`/`&&(e.preventDefault(),E({padding:.2,duration:300}))},[E]);_Y(window,`keydown`,re);let ie=(0,Y.useCallback)(()=>{if(i||ee<2||I.current)return;I.current=!0,B(!0);let r=F.current+1;F.current=r;try{let i=P.current?.getBoundingClientRect().width??(typeof window<`u`?window.innerWidth:void 0),{nodes:a,changed:o}=XSe({nodes:t,edges:n,availableWidth:i,catalog:e});if(r!==F.current)return;o&&v(a),window.requestAnimationFrame(()=>{Promise.resolve(E({maxZoom:1,minZoom:.5,padding:.2,duration:300})).catch(()=>void 0)})}finally{r===F.current&&(I.current=!1,B(!1))}},[v,n,E,i,t,ee,e]),ae=(0,Y.useCallback)((e,n)=>{let r=t.find(t=>t.id===e);return!r||r.type===`add`||r.parentId?!1:n!==`target`||r.type!==`lifecycle`},[t]),oe=(0,Y.useCallback)(i=>{let a=i.source,o=i.target;if(!(a&&o)||a===o)return!1;let s=t.find(e=>e.id===a),c=t.find(e=>e.id===o);if(s?.parentId||c?.parentId)return!1;let l=`id`in i&&typeof i.id==`string`?i.id:null,u=G7({nodes:t,edges:n,sourceNodeId:a,sourceHandle:`sourceHandle`in i?i.sourceHandle:void 0,catalog:e}),d=F0({nodes:t,edges:r,sourceId:a,targetId:o,sourceHandle:u,excludeEdgeId:l});if(d.length===0)return!1;let f=[...r.filter(e=>e.id!==l),...d];return!Gbe({nodes:t,edges:f})},[e,n,t,r]),se=(0,Y.useCallback)((r,i)=>G7({nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:e}),[t,n,e]),ce=(0,Y.useCallback)(e=>{if(!(e.source&&e.target)||!oe(e))return;let t=se(e.source,e.sourceHandle),n={id:u0(),...e,sourceHandle:t};y(n)},[se,oe,y]),le=(0,Y.useCallback)(({nodes:e,edges:t})=>!(e.some(e=>e.data.type!==`lifecycle`)||t.length>0)||N4(e)?Promise.resolve(!1):(x(),Promise.resolve(!0)),[x]),ue=(0,Y.useCallback)((e,t)=>{h(t.id),w(`properties`),s&&c()},[h,w,s,c]),de=(0,Y.useCallback)((e,t)=>{k.current=t.nodeId,A.current=t.handleType,j.current=t.handleId??null},[]),fe=(0,Y.useCallback)(e=>({clientX:`changedTouches`in e?e.changedTouches[0].clientX:e.clientX,clientY:`changedTouches`in e?e.changedTouches[0].clientY:e.clientY}),[]),pe=(0,Y.useCallback)((e,t,n)=>{let r=(e.target instanceof Element?e.target:void 0)?.closest(`.react-flow`)?.getBoundingClientRect();return{adjustedX:r?t-r.left:t,adjustedY:r?n-r.top:n}},[]),me=(0,Y.useCallback)(e=>{let t=e.getAttribute(`data-id`),n=A.current===`source`,r=n?`target`:`source`,i=k.current;if(t&&i&&t!==i&&ae(t,r)){let e=n?i:t,r=n?t:i,a=se(e,n?j.current:null),o=n?null:j.current;ce({source:e,target:r,sourceHandle:a,targetHandle:o})}},[ae,se,ce]),he=(0,Y.useCallback)((e,t,n)=>{let r=k.current;if(!r)return;let i=A.current===`source`;if(!(i||oe({source:`__new_node__`,target:r,sourceHandle:null,targetHandle:null})))return;let{adjustedX:a,adjustedY:o}=pe(e,t,n),s=T({x:a,y:o});s.y-=56;let c={id:u0(),type:`action`,position:s,data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};_(c),h(c.id),w(`properties`),setTimeout(()=>{b(c.id)},50);let l=i?r:c.id,u=i?c.id:r,d=se(l,i?j.current:null),f=i?null:j.current;ce({source:l,target:u,sourceHandle:d,targetHandle:f}),M.current=!0,setTimeout(()=>{M.current=!1},100)},[pe,T,_,b,h,w,se,ce,oe]),ge=(0,Y.useCallback)(e=>{if(!k.current)return;let{clientX:t,clientY:n}=fe(e),r;if(r=`changedTouches`in e?document.elementFromPoint(t,n):e.target instanceof Element?e.target:null,!r){k.current=null,A.current=null,j.current=null;return}let i=r.closest(`.react-flow__node`),a=r.closest(`.react-flow__handle`);if(i&&!a&&A.current){me(i),k.current=null,A.current=null,j.current=null;return}i||a||he(e,t,n),k.current=null,A.current=null,j.current=null},[fe,me,he]),_e=(0,Y.useCallback)(()=>{M.current||(h(null),g(null),q())},[h,g,q]),ve=(0,Y.useCallback)(({nodes:e})=>{M.current&&e.length===0||(e.length===0?h(null):e.length===1&&h(e[0].id))},[h]);return(0,X.jsxs)(`div`,{className:`relative h-full bg-background`,"data-testid":`workflow-canvas`,ref:P,style:{opacity:+!!L,width:u?`calc(100% - ${u})`:`100%`,transition:`opacity 300ms`},children:[(0,X.jsx)(`div`,{className:`pointer-events-auto`,children:(0,X.jsx)(zbe,{workflowId:a??void 0})}),(0,X.jsxs)(zye,{className:`bg-background`,connectionLineComponent:Hye,connectionMode:dw.Strict,defaultEdgeOptions:QSe,edges:n,edgeTypes:ZSe,elementsSelectable:!i,isValidConnection:oe,nodes:t,nodesConnectable:!i,nodesDraggable:!i,nodeTypes:$Se,onBeforeDelete:le,onConnect:i?void 0:ce,onConnectEnd:i?void 0:ge,onConnectStart:i?void 0:de,onEdgeContextMenu:i?void 0:G,onEdgesChange:i?void 0:m,onNodeClick:i?void 0:ue,onNodeContextMenu:i?void 0:W,onNodesChange:i?void 0:p,onPaneClick:_e,onPaneContextMenu:i?void 0:K,onSelectionChange:i?void 0:ve,children:[(0,X.jsx)(Ybe,{className:`workflow-controls-panel border-none bg-transparent p-0`,position:`bottom-left`,children:(0,X.jsx)(Wye,{canReflow:!i&&ee>1&&!z,onReflow:i?void 0:ie})}),o&&(0,X.jsx)(Ek,{bgColor:`var(--sidebar)`,className:`rounded-lg border shadow-sm`,maskColor:`color-mix(in oklch, var(--muted) 60%, transparent)`,nodeColor:`var(--muted-foreground)`,nodeStrokeColor:`var(--border)`})]}),(0,X.jsx)(Bxe,{menuState:V,onClose:q})]})}var tCe=/^\/workflows\/[^/]+$/;function nCe(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={select:rCe},e[0]=t):t=e[0];let n=za(t);if(!tCe.test(n))return null;let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`div`,{className:`fixed inset-0 z-0`,children:(0,X.jsx)(eCe,{})}),e[1]=r):r=e[1],r}function rCe(e){return e.location.pathname}var F9=pA(),I9=`The workflow could not be loaded. Try again.`;function iCe(e){return e instanceof X1&&e.status===404?{notFound:!0,message:null}:{notFound:!1,message:I9}}function aCe(e){return e?`runs`:null}var oCe=ma(`/workflows/$workflowId`);function sCe(){let e=(0,Z.c)(19),t=wA(Q0),[n,r]=EA(O2),i=TA(V4),a=TA(gpe),{executionId:o}=oCe.useSearch(),s;e[0]===o?s=e[1]:(s=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:o??``},select:tye}),e[0]=o,e[1]=s);let c=o!==void 0,l;e[2]!==s||e[3]!==c?(l={...s,enabled:c,staleTime:0},e[2]=s,e[3]=c,e[4]=l):l=e[4];let u=Xe(l),d=u.data?.workflowVersionId,f;e[5]===d?f=e[6]:(f=r0.workflow.getVersionGraph.queryOptions({input:{versionId:d??``},select:lCe}),e[5]=d,e[6]=f);let p=d!==void 0,m;e[7]!==f||e[8]!==p?(m={...f,enabled:p,staleTime:1/0},e[7]=f,e[8]=p,e[9]=m):m=e[9];let h=Xe(m),g=u.data,_=h.data,v=g!==void 0&&_!==void 0&&g.workflowId===t,y;e[10]!==t||e[11]!==g||e[12]!==o||e[13]!==_||e[14]!==a||e[15]!==n||e[16]!==i||e[17]!==r?(y=()=>{if(o===void 0){r(null),i(null);return}if(n!==o&&a(),r(o),g===void 0||_===void 0||g.workflowId!==t){i(null);return}let e=H1(_);i({nodes:e.nodes.map(cCe),edges:e.edges.map(J1)})},e[10]=t,e[11]=g,e[12]=o,e[13]=_,e[14]=a,e[15]=n,e[16]=i,e[17]=r,e[18]=y):y=e[18],vY(o===void 0?`closed`:v?`ready:${o}:${t}`:`open:${o}:${t??``}`,y)}function cCe(e){return{...q1(e),selected:!1}}function lCe(e){return e.graph}function uCe(){return sCe(),null}function dCe(e){return eY(`alert-dialog`,e)}function L9(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(dCe,{"data-slot":`alert-dialog`,...n}),t[2]=n,t[3]=r),r}function fCe(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(LJ,{"data-slot":`alert-dialog-portal`,...n}),t[2]=n,t[3]=r),r}function pCe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`data-[starting-style]:fade-in-0 data-[ending-style]:fade-out-0 fixed inset-0 z-50 bg-foreground/50 data-[closed]:animate-out data-[open]:animate-in`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(oH,{className:i,"data-slot":`alert-dialog-overlay`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function R9(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(pCe,{}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 grid w-full max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[closed]:animate-out data-[open]:animate-in`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,X.jsxs)(fCe,{children:[i,(0,X.jsx)(nY,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:(0,X.jsx)(PJ,{className:a,"data-slot":`alert-dialog-content`,...r})})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function z9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function V9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold text-lg`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(rY,{className:i,"data-slot":`alert-dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function H9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(FH,{className:i,"data-slot":`alert-dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U9(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=Q(Rv({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,X.jsx)(kH,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function W9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Rv({variant:`outline`}),n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(kH,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mCe(e){let t=(0,Z.c)(18),{open:n,onOpenChange:r,onConfirm:i,title:a,description:o,confirmLabel:s}=e,c=a===void 0?`Delete`:a,l=o===void 0?`Are you sure? This action cannot be undone.`:o,u=s===void 0?`Delete`:s,d;t[0]===c?d=t[1]:(d=(0,X.jsx)(V9,{children:c}),t[0]=c,t[1]=d);let f;t[2]===l?f=t[3]:(f=(0,X.jsx)(H9,{children:l}),t[2]=l,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,X.jsxs)(z9,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(W9,{children:`Cancel`}),t[7]=m):m=t[7];let h;t[8]!==u||t[9]!==i?(h=(0,X.jsxs)(B9,{children:[m,(0,X.jsx)(U9,{onClick:i,variant:`destructive`,children:u})]}),t[8]=u,t[9]=i,t[10]=h):h=t[10];let g;t[11]!==p||t[12]!==h?(g=(0,X.jsxs)(R9,{children:[p,h]}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;return t[14]!==r||t[15]!==n||t[16]!==g?(_=(0,X.jsx)(L9,{onOpenChange:r,open:n,children:g}),t[14]=r,t[15]=n,t[16]=g,t[17]=_):_=t[17],_}var hCe=4;function gCe(){let e=(0,Z.c)(11),[t,n]=(0,Y.useState)(null),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={confirm:n,tabs:`top`},e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(E7,{frame:i}),e[1]=a):a=e[1];let o=t?.confirmLabel,s=t?.message,c;e[2]===t?c=e[3]:(c=()=>t?.onConfirm(),e[2]=t,e[3]=c);let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{e||n(null)},e[4]=l):l=e[4];let u=t!==null,d=t?.title,f;return e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==u||e[9]!==d?(f=(0,X.jsxs)(`aside`,{className:`flex size-full flex-col overflow-hidden bg-card`,children:[a,(0,X.jsx)(mCe,{confirmLabel:o,description:s,onConfirm:c,onOpenChange:l,open:u,title:d})]}),e[5]=o,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f):f=e[10],f}function _Ce(){let e=(0,Z.c)(29),t=jY(),[n,r]=EA(b2),[i,a]=EA(S2),o=wA(H4),{hasOverlays:s}=RY(),{openSheet:c}=O7(),l=l7(),u;e[0]!==s||e[1]!==t||e[2]!==c||e[3]!==o?(u=()=>{t&&o&&!s&&c()},e[0]=s,e[1]=t,e[2]=c,e[3]=o,e[4]=u):u=e[4],vY(t,u);let d;e[5]!==l||e[6]!==r?(d=e=>{e&&l(),r(e)},e[5]=l,e[6]=r,e[7]=d):d=e[7];let f=d,[p,m]=(0,Y.useState)(!1),h=(0,Y.useRef)(!1),g;e[8]!==n||e[9]!==f?(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`b`&&(e.preventDefault(),f(!n))},e[8]=n,e[9]=f,e[10]=g):g=e[10],_Y(window,`keydown`,g);let _;e[11]!==n||e[12]!==f||e[13]!==a?(_=e=>{e.preventDefault(),h.current=!0,m(!0);let t=e.clientX,r=!1,i=e=>{if(!h.current||(Math.abs(e.clientX-t)>hCe&&(r=!0),!r))return;let n=(window.innerWidth-e.clientX)/window.innerWidth*100;a(Math.min(50,Math.max(20,n)))},o=()=>{h.current=!1,m(!1),document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,o),document.removeEventListener(`pointercancel`,o),document.body.style.cursor=``,document.body.style.userSelect=``,r||f(!n)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,o),document.addEventListener(`pointercancel`,o),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},e[11]=n,e[12]=f,e[13]=a,e[14]=_):_=e[14];let v=_,y;e[15]!==t||e[16]!==n||e[17]!==f?(y=!t&&n&&(0,X.jsx)(`button`,{className:`pointer-events-auto absolute top-1/2 right-0 z-20 flex size-6 -translate-y-1/2 items-center justify-center rounded-l-full border border-r-0 bg-background shadow-sm transition-colors hover:bg-muted`,onClick:()=>{f(!1)},type:`button`,children:(0,X.jsx)(Yv,{className:`size-4`})}),e[15]=t,e[16]=n,e[17]=f,e[18]=y):y=e[18];let b;e[19]!==v||e[20]!==p||e[21]!==t||e[22]!==n||e[23]!==i||e[24]!==f?(b=!t&&(0,X.jsxs)(`div`,{className:`workflow-sidebar-panel pointer-events-auto absolute inset-y-0 right-0 z-20 border-l bg-sidebar transition-transform duration-200 ease-out`,style:{width:C2(i),transform:n?`translateX(100%)`:`translateX(0)`},children:[(0,X.jsxs)(`div`,{"aria-label":`Resize properties panel. Click to collapse.`,"aria-orientation":`vertical`,"aria-valuenow":i,className:`group absolute inset-y-0 left-0 z-10 w-3 cursor-col-resize`,onPointerDown:v,role:`separator`,tabIndex:0,children:[(0,X.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1 bg-transparent transition-colors group-hover:bg-ring group-active:bg-primary`}),!(p||n)&&(0,X.jsx)(`button`,{"aria-label":`Collapse panel`,className:`absolute top-1/2 left-0 flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border bg-background shadow-sm transition-opacity hover:bg-muted focus-visible:opacity-100 lg:opacity-0 lg:group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),f(!0)},onPointerDown:vCe,type:`button`,children:(0,X.jsx)(Xv,{className:`size-4`})})]}),(0,X.jsx)(gCe,{})]}),e[19]=v,e[20]=p,e[21]=t,e[22]=n,e[23]=i,e[24]=f,e[25]=b):b=e[25];let x;return e[26]!==y||e[27]!==b?(x=(0,X.jsxs)(X.Fragment,{children:[y,b]}),e[26]=y,e[27]=b,e[28]=x):x=e[28],x}function vCe(e){return e.stopPropagation()}var yCe=500,bCe=()=>{let e=(0,Z.c)(33),t=wA(T2),n=wA(s2),r=wA(Q4),i=wA($4),[a]=EA(Q0),[o]=EA(O2),s=wA(t3),c=TA(w2),l=TA(d2),u=TA(y3),d=wA(r2),f=wA(i2),p;e[0]===n?p=e[1]:(p=()=>{n&&Ty.error(n.message||`Failed to save workflow`)},e[0]=n,e[1]=p),vY(n,p);let m;e[2]!==a||e[3]!==i||e[4]!==t||e[5]!==r||e[6]!==l?(m=async()=>{if(!a||t)return;let e=await l({nodes:r,edges:i},{immediate:!0});e&&!e.ok&&Ty.error(e.error.message||`Failed to save workflow`)},e[2]=a,e[3]=i,e[4]=t,e[5]=r,e[6]=l,e[7]=m):m=e[7];let h=m,g;e[8]===h?g=e[9]:(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),e.stopPropagation(),h())},e[8]=h,e[9]=g);let _=g,v;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={capture:!0},e[10]=v):v=e[10],_Y(document,`keydown`,_,v);let y;e[11]===o?y=e[12]:(y=r0.workflow.getExecutionStatus.queryOptions({input:{executionId:o??``}}),e[11]=o,e[12]=y);let b=o!==null,x;e[13]!==y||e[14]!==b?(x={...y,enabled:b,staleTime:0,refetchIntervalInBackground:!1,refetchInterval:xCe},e[13]=y,e[14]=b,e[15]=x):x=e[15];let S=Xe(x).data,C;e[16]===S?.nodeStatuses?C=e[17]:(C=S?.nodeStatuses.map(SCe).join(`,`)??``,e[16]=S?.nodeStatuses,e[17]=C);let w=C,T;e[18]!==S||e[19]!==r||e[20]!==o||e[21]!==c||e[22]!==u?(T=()=>{if(!o){u(r.map(CCe)),c(!1);return}S&&(u(S.nodeStatuses.map(wCe)),c(o7(S.status)))},e[18]=S,e[19]=r,e[20]=o,e[21]=c,e[22]=u,e[23]=T):T=e[23],vY(o===null?`idle`:`${o}:${s}:${S===void 0?`loading`:`${S.status}:${w}`}`,T);let E;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(uCe,{}),e[24]=E):E=e[24];let D;e[25]===d?D=e[26]:(D=d&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Workflow Not Found`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:`The workflow you're looking for doesn't exist or has been deleted.`}),(0,X.jsx)(zv,{render:(0,X.jsx)(fa,{to:`/`}),children:`Go to Dashboard`})]})}),e[25]=d,e[26]=D);let O;e[27]===f?O=e[28]:(O=f&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Couldn't Load Workflow`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:f}),(0,X.jsx)(zv,{onClick:TCe,children:`Try Again`})]})}),e[27]=f,e[28]=O);let k;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(_Ce,{}),e[29]=k):k=e[29];let A;return e[30]!==D||e[31]!==O?(A=(0,X.jsxs)(`div`,{className:`flex h-dvh w-full flex-col overflow-hidden`,children:[E,D,O,k]}),e[30]=D,e[31]=O,e[32]=A):A=e[32],A};function xCe(e){return o7(e.state.data?.status)?yCe:!1}function SCe(e){return`${e.nodeId}=${e.status}`}function CCe(e){return{nodeId:e.id,status:`idle`}}function wCe(e){return{nodeId:e.nodeId,status:e.status===`pending`?`idle`:e.status}}function TCe(){return window.location.reload()}var ECe=jy(`workflows`),G9=3,K9=[`running`,`waiting`,`failed`,`completed`,`canceled`,`pending`],DCe=[...K9,`superseded`];function OCe(e){if(!e)return`-`;let t=Number.parseInt(e,10);return Number.isNaN(t)?e:t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}var kCe=100;function ACe(e){return e.toSorted(jCe)}function jCe(e,t){return new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()}function MCe(e){return e===`pause`?`Paused`:e===`resume`?`Resumed`:`Deleted`}function q9(e,t,n){return e===1?t:n}function NCe(){let e=(0,Z.c)(165),t=Gi(),n=Fe(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,e[0]=r):r=e[0];let[i,a]=(0,Y.useState)(r),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Set,e[1]=o):o=e[1];let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(0),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(null),y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=r0.workflow.getAll.queryOptions({input:{},select:ACe,meta:{errorMessage:`Failed to load workflows`}}),e[2]=y):y=e[2];let{data:b,isPending:x}=Xe(y),S;e[3]===b?S=e[4]:(S=b===void 0?[]:b,e[3]=b,e[4]=S);let C=S,w;e[5]===C?w=e[6]:(w=C.filter(WCe),e[5]=C,e[6]=w);let T=w,E;e[7]===i?E=e[8]:(E=Array.from(i),e[7]=i,e[8]=E);let D=E,O;e[9]!==D||e[10]!==T?(O=D.filter(e=>T.some(t=>t.id===e&&t.isOwner!==!1)),e[9]=D,e[10]=T,e[11]=O):O=e[11];let k=O,A;e[12]!==i||e[13]!==T?(A=T.length>0&&T.every(e=>i.has(e.id)),e[12]=i,e[13]=T,e[14]=A):A=e[14];let j=A,M=l&&k.length>0,N;e[15]!==M||e[16]!==k||e[17]!==s?(N=OQ({workflowIds:M?k.toSorted():void 0,statuses:s.size>0?Array.from(s).toSorted():K9.toSorted(),limit:kCe},DQ),e[15]=M,e[16]=k,e[17]=s,e[18]=N):N=e[18];let P=N,F;e[19]===P?F=e[20]:(F=r0.workflow.getExecutionsGlobal.infiniteOptions({input:e=>({...P,cursor:e}),initialPageParam:void 0,getNextPageParam:UCe,meta:{errorMessage:`Failed to load workflow runs`}}),e[19]=P,e[20]=F);let I=Qe(F),L;e[21]===I.data?.pages?L=e[22]:(L=I.data?.pages.flatMap(HCe)??[],e[21]=I.data?.pages,e[22]=L);let R=L,z=I.isPending,B=I.isFetchingNextPage,V;e[23]===n?V=e[24]:(V=()=>a0(n),e[23]=n,e[24]=V);let H=V,U;e[25]===n?U=e[26]:(U=()=>s0(n),e[25]=n,e[26]=U);let W=U,G;e[27]===H?G=e[28]:(G=r0.workflow.update.mutationOptions({onSuccess:async(e,t)=>{let{mode:n}=t;await H(),Ty.success(n===`test`?`Switched workflow to Test mode`:`Switched workflow to Live mode`)},meta:{errorMessage:`Failed to switch workflow mode`}}),e[27]=H,e[28]=G);let K=Ze(G),q;e[29]===T?q=e[30]:(q=e=>{if(!e){a(new Set);return}a(new Set(T.map(VCe)))},e[29]=T,e[30]=q);let J=q,ee;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(e,t)=>{a(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},e[31]=ee):ee=e[31];let te=ee,ne;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},e[32]=ne):ne=e[32];let re=ne,ie;e[33]===n?ie=e[34]:(ie=r0.workflow.bulkLifecycle.mutationOptions({onSuccess:async(e,t)=>{let{action:r}=t;if(e.summary.failed===0?Ty.success(`${MCe(r)} ${e.summary.succeeded} workflow${q9(e.summary.succeeded,``,`s`)}`):Ty.error(`${r} finished with ${e.summary.failed} failure${q9(e.summary.failed,``,`s`)}`),await a0(n),r!==`delete`)return;let i=new Set(e.results.filter(BCe).map(zCe));a(e=>{let t=new Set;for(let n of e)i.has(n)||t.add(n);return t}),await s0(n)},onError:RCe,meta:{errorShownByCaller:!0}}),e[33]=n,e[34]=ie);let ae=Ze(ie),oe=ae.isPending?ae.variables.action:null,se=ae.mutate,ce;e[35]===se?ce=e[36]:(ce=(e,t)=>{t.length!==0&&se({workflowIds:t,action:e})},e[35]=se,e[36]=ce);let le=ce,ue;e[37]===C?ue=e[38]:(ue=e=>{if(e.length===0)return;let t=new Map(C.map(LCe)),n=e.map(e=>t.get(e)??`Untitled workflow`),r=e.length===1?`Delete Workflow`:`Delete Workflows`,i=e.length===1?`This will permanently delete "${n[0]}" and all of its runs and events. This cannot be undone.`:`This will permanently delete ${e.length} workflows and all of their runs and events. This cannot be undone.`;v({workflowIds:e,workflowNames:n,title:r,description:i})},e[37]=C,e[38]=ue);let de=ue,fe;e[39]!==j||e[40]!==x||e[41]!==oe||e[42]!==t||e[43]!==de||e[44]!==le||e[45]!==i||e[46]!==K||e[47]!==J||e[48]!==T?(fe=()=>x&&T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading workflows...`}):T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No workflows found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`w-10 px-4 py-2`,children:(0,X.jsx)(e7,{"aria-label":`Select all workflows`,checked:j,onCheckedChange:e=>{J(e)}})}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Name`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`State`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Mode`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Updated`}),(0,X.jsx)(`th`,{className:`w-10`})]})}),(0,X.jsx)(`tbody`,{children:T.map(e=>{let n=i.has(e.id),r=e.isOwner!==!1,a=e.isPaused?`border-amber-500/30 bg-amber-500/10 text-amber-700`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-700`,o=e.isPaused?`Paused`:`Active`,s=e.mode===`test`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-zinc-500/30 bg-zinc-500/10 text-zinc-700`,c=e.mode===`test`?`Test`:`Live`,l=e.isPaused?`resume`:`pause`,u=e.isPaused?`Resume`:`Pause`;return(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsx)(`td`,{className:`px-4 py-3`,children:(0,X.jsx)(e7,{"aria-label":`Select ${e.name}`,checked:n,onCheckedChange:t=>{te(e.id,t)}})}),(0,X.jsxs)(`td`,{className:`px-2 py-3`,children:[(0,X.jsx)(`button`,{className:`text-left font-medium text-foreground hover:underline`,onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},type:`button`,children:e.name}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.id})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs transition-colors duration-200 ${a}`,children:o})}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase transition-colors duration-200 ${s}`,children:c})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:d7(e.updatedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsxs)(H5,{children:[(0,X.jsx)(U5,{className:`inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50`,disabled:!r||oe!==null,children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsxs)(W5,{align:`end`,children:[(0,X.jsx)(G5,{onClick:()=>{K.mutate({workflowId:e.id,mode:e.mode===`test`?`live`:`test`})},children:e.mode===`test`?`Switch to Live`:`Switch to Test`}),(0,X.jsx)(G5,{onClick:()=>{le(l,[e.id])},children:u}),(0,X.jsx)(q5,{}),(0,X.jsx)(G5,{onClick:()=>{de([e.id])},variant:`destructive`,children:`Delete`})]})]})})]},e.id)})})]}),e[39]=j,e[40]=x,e[41]=oe,e[42]=t,e[43]=de,e[44]=le,e[45]=i,e[46]=K,e[47]=J,e[48]=T,e[49]=fe):fe=e[49];let pe=fe,me;e[50]!==z||e[51]!==t||e[52]!==R?(me=()=>z&&R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading runs...`}):R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No runs found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`px-4 py-2`,children:`Workflow`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Status`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Started`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Duration`}),(0,X.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Open`})]})}),(0,X.jsx)(`tbody`,{children:R.map(e=>(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:e.workflowName}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.workflowId})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase ${g7(e.status)}`,children:e.status})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:d7(e.startedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:OCe(e.duration)}),(0,X.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,X.jsx)(zv,{onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.workflowId},search:{executionId:e.id}})},size:`sm`,type:`button`,variant:`outline`,children:`Open`})})]},e.id))})]}),e[50]=z,e[51]=t,e[52]=R,e[53]=me):me=e[53];let he=me,ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(`h1`,{className:`font-semibold text-2xl text-foreground`,children:`Workflow Dashboard`}),e[54]=ge):ge=e[54];let _e;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[ge,(0,X.jsx)(zv,{onClick:()=>{m(ICe),f(!0)},type:`button`,children:`New Workflow`})]}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Manage workflows in bulk and review runs across every workflow. Paused workflows block new starts. Test mode makes runs execute with test-mode action behavior.`})]}),e[55]=_e):_e=e[55];let ve;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`Workflows`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Select one or more workflows to run bulk actions.`})]}),e[56]=ve):ve=e[56];let ye=x||oe!==null,be;e[57]!==H||e[58]!==ye?(be=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[ve,(0,X.jsx)(zv,{disabled:ye,onClick:H,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[57]=H,e[58]=ye,e[59]=be):be=e[59];let xe=k.length===0||oe!==null,Se;e[60]!==le||e[61]!==k?(Se=()=>{le(`pause`,k)},e[60]=le,e[61]=k,e[62]=Se):Se=e[62];let Ce;e[63]!==xe||e[64]!==Se?(Ce=(0,X.jsx)(zv,{disabled:xe,onClick:Se,size:`sm`,type:`button`,variant:`outline`,children:`Pause Selected`}),e[63]=xe,e[64]=Se,e[65]=Ce):Ce=e[65];let we=k.length===0||oe!==null,Te;e[66]!==le||e[67]!==k?(Te=()=>{le(`resume`,k)},e[66]=le,e[67]=k,e[68]=Te):Te=e[68];let Ee;e[69]!==we||e[70]!==Te?(Ee=(0,X.jsx)(zv,{disabled:we,onClick:Te,size:`sm`,type:`button`,variant:`outline`,children:`Resume Selected`}),e[69]=we,e[70]=Te,e[71]=Ee):Ee=e[71];let De=k.length===0||oe!==null,Oe;e[72]!==de||e[73]!==k?(Oe=()=>{de(k)},e[72]=de,e[73]=k,e[74]=Oe):Oe=e[74];let ke;e[75]!==De||e[76]!==Oe?(ke=(0,X.jsx)(zv,{disabled:De,onClick:Oe,size:`sm`,type:`button`,variant:`destructive`,children:`Delete Selected`}),e[75]=De,e[76]=Oe,e[77]=ke):ke=e[77];let Ae;e[78]!==Ce||e[79]!==Ee||e[80]!==ke?(Ae=(0,X.jsx)(`div`,{className:`border-b px-4 py-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ce,Ee,ke]})}),e[78]=Ce,e[79]=Ee,e[80]=ke,e[81]=Ae):Ae=e[81];let je;e[82]===pe?je=e[83]:(je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:pe()}),e[82]=pe,e[83]=je);let Me;e[84]!==be||e[85]!==Ae||e[86]!==je?(Me=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[be,Ae,je]}),e[84]=be,e[85]=Ae,e[86]=je,e[87]=Me):Me=e[87];let Ne;e[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`All Runs`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Combined run history across workflows.`})]}),e[88]=Ne):Ne=e[88];let Pe=z||B,Ie;e[89]===W?Ie=e[90]:(Ie=()=>{W()},e[89]=W,e[90]=Ie);let Le;e[91]!==Pe||e[92]!==Ie?(Le=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[Ne,(0,X.jsx)(zv,{disabled:Pe,onClick:Ie,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[91]=Pe,e[92]=Ie,e[93]=Le):Le=e[93];let Re;e[94]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>{c(new Set)},e[94]=Re):Re=e[94];let ze=s.size===0?`secondary`:`outline`,Be;e[95]===ze?Be=e[96]:(Be=(0,X.jsx)(zv,{onClick:Re,size:`sm`,type:`button`,variant:ze,children:`All statuses`}),e[95]=ze,e[96]=Be);let Ve;e[97]===s?Ve=e[98]:(Ve=DCe.map(e=>(0,X.jsx)(zv,{onClick:()=>{re(e)},size:`sm`,type:`button`,variant:s.has(e)?`secondary`:`outline`,children:e},e)),e[97]=s,e[98]=Ve);let He=k.length===0,Ue;e[99]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=()=>{u(FCe)},e[99]=Ue):Ue=e[99];let We=l?`secondary`:`outline`,Ge=l?`Showing selected workflows`:`Show selected workflows only`,Ke;e[100]!==He||e[101]!==We||e[102]!==Ge?(Ke=(0,X.jsx)(zv,{disabled:He,onClick:Ue,size:`sm`,type:`button`,variant:We,children:Ge}),e[100]=He,e[101]=We,e[102]=Ge,e[103]=Ke):Ke=e[103];let qe;e[104]!==Be||e[105]!==Ve||e[106]!==Ke?(qe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b px-4 py-2`,children:[Be,Ve,Ke]}),e[104]=Be,e[105]=Ve,e[106]=Ke,e[107]=qe):qe=e[107];let Je;e[108]===he?Je=e[109]:(Je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:he()}),e[108]=he,e[109]=Je);let Ye;e[110]!==B||e[111]!==I?(Ye=I.hasNextPage?(0,X.jsx)(`div`,{className:`border-t px-4 py-3`,children:(0,X.jsx)(zv,{disabled:B,onClick:()=>{I.fetchNextPage()},size:`sm`,type:`button`,variant:`outline`,children:B?`Loading...`:`Load more`})}):null,e[110]=B,e[111]=I,e[112]=Ye):Ye=e[112];let $e;e[113]!==Le||e[114]!==qe||e[115]!==Je||e[116]!==Ye?($e=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[Le,qe,Je,Ye]}),e[113]=Le,e[114]=qe,e[115]=Je,e[116]=Ye,e[117]=$e):$e=e[117];let et;e[118]!==Me||e[119]!==$e?(et=(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1600px] flex-col gap-6 p-6`,children:[_e,(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 xl:grid-cols-[1fr_1.5fr]`,children:[Me,$e]})]}),e[118]=Me,e[119]=$e,e[120]=et):et=e[120];let tt;e[121]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>{e||(v(null),g(``))},e[121]=tt):tt=e[121];let nt=_!==null,rt=_?.title,it;e[122]===rt?it=e[123]:(it=(0,X.jsx)(V9,{children:rt}),e[122]=rt,e[123]=it);let at=_?.description,ot;e[124]===at?ot=e[125]:(ot=(0,X.jsx)(H9,{children:at}),e[124]=at,e[125]=ot);let st;e[126]!==it||e[127]!==ot?(st=(0,X.jsxs)(z9,{children:[it,ot]}),e[126]=it,e[127]=ot,e[128]=st):st=e[128];let ct;e[129]===_?ct=e[130]:(ct=_&&_.workflowNames.length>1?(0,X.jsxs)(`ul`,{className:`list-disc pl-5 text-muted-foreground text-sm`,children:[_.workflowIds.slice(0,3).map((e,t)=>(0,X.jsx)(`li`,{children:_.workflowNames[t]},e)),_.workflowNames.length>3?(0,X.jsxs)(`li`,{children:[`and `,_.workflowNames.length-3,` more`]}):null]}):null,e[129]=_,e[130]=ct);let lt;e[131]!==_||e[132]!==h?(lt=_&&_.workflowIds.length>G9?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(TX,{htmlFor:`delete-challenge`,children:[`Type `,_.workflowIds.length,` to confirm`]}),(0,X.jsx)(wX,{autoComplete:`off`,id:`delete-challenge`,inputMode:`numeric`,onChange:e=>{g(e.target.value)},value:h})]}):null,e[131]=_,e[132]=h,e[133]=lt):lt=e[133];let ut;e[134]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,X.jsx)(W9,{children:`Cancel`}),e[134]=ut):ut=e[134];let dt;e[135]!==_||e[136]!==h?(dt=_!==null&&_.workflowIds.length>G9&&h.trim()!==String(_.workflowIds.length),e[135]=_,e[136]=h,e[137]=dt):dt=e[137];let ft;e[138]!==_||e[139]!==le?(ft=()=>{_&&(le(`delete`,_.workflowIds),v(null),g(``))},e[138]=_,e[139]=le,e[140]=ft):ft=e[140];let pt;e[141]!==dt||e[142]!==ft?(pt=(0,X.jsxs)(B9,{children:[ut,(0,X.jsx)(U9,{disabled:dt,onClick:ft,variant:`destructive`,children:`Delete`})]}),e[141]=dt,e[142]=ft,e[143]=pt):pt=e[143];let mt;e[144]!==st||e[145]!==ct||e[146]!==lt||e[147]!==pt?(mt=(0,X.jsxs)(R9,{children:[st,ct,lt,pt]}),e[144]=st,e[145]=ct,e[146]=lt,e[147]=pt,e[148]=mt):mt=e[148];let ht;e[149]!==nt||e[150]!==mt?(ht=(0,X.jsx)(L9,{onOpenChange:tt,open:nt,children:mt}),e[149]=nt,e[150]=mt,e[151]=ht):ht=e[151];let gt;e[152]===C?gt=e[153]:(gt=C.map(PCe),e[152]=C,e[153]=gt);let _t;e[154]===t?_t=e[155]:(_t=e=>t({to:`/workflows/$workflowId`,params:{workflowId:e}}),e[154]=t,e[155]=_t);let vt;e[156]!==p||e[157]!==d||e[158]!==gt||e[159]!==_t?(vt=(0,X.jsx)(M7,{existingWorkflowNames:gt,onCreated:_t,onOpenChange:f,open:d},p),e[156]=p,e[157]=d,e[158]=gt,e[159]=_t,e[160]=vt):vt=e[160];let yt;return e[161]!==et||e[162]!==ht||e[163]!==vt?(yt=(0,X.jsxs)(`div`,{className:`pointer-events-auto h-dvh overflow-auto bg-background`,children:[et,ht,vt]}),e[161]=et,e[162]=ht,e[163]=vt,e[164]=yt):yt=e[164],yt}function PCe(e){return e.name}function FCe(e){return!e}function ICe(e){return e+1}function LCe(e){return[e.id,e.name]}function RCe(e,t){let{action:n}=t;ECe.error(`Failed to ${n} workflows`,{action:n,error:e}),Ty.error(`Failed to ${n} workflows`)}function zCe(e){return e.workflowId}function BCe(e){return e.ok&&e.deleted===!0}function VCe(e){return e.id}function HCe(e){return e.items}function UCe(e){return e.nextCursor??void 0}function WCe(e){return e.name!==`__current__`}function GCe(e){return{executionId:typeof e.executionId==`string`&&e.executionId.length>0?e.executionId:void 0}}function KCe(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(nCe,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(BO,{children:[t,(0,X.jsx)(`div`,{className:`pointer-events-none relative z-10`,children:(0,X.jsx)(ka,{})})]}),e[1]=n):n=e[1],n}function qCe(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(cX,{attribute:`class`,defaultTheme:`system`,disableTransitionOnChange:!0,enableSystem:!0,children:(0,X.jsx)(vA,{store:F9,children:(0,X.jsxs)(FY,{children:[(0,X.jsx)(KCe,{}),(0,X.jsx)(dX,{}),(0,X.jsx)(qY,{})]})})}),e[0]=t):t=e[0],t}function J9(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(bCe,{}),e[0]=t):t=e[0],t}var Y9=ya({component:qCe}),JCe=_a({getParentRoute:()=>Y9,path:`/`,component:NCe}),YCe=_a({getParentRoute:()=>Y9,path:`/workflows`,component:()=>(0,X.jsx)(Ki,{replace:!0,to:`/`})}),XCe=_a({getParentRoute:()=>Y9,path:`/workflows/$workflowId`,validateSearch:GCe,beforeLoad:({search:e})=>{let t=aCe(e.executionId);t!==null&&F9.set(g2,t)},loader:async({params:e})=>{F9.set(r2,!1),F9.set(i2,null);let[t,n]=await Promise.allSettled([My.fetchQuery(r0.workflow.getById.queryOptions({input:{workflowId:e.workflowId},staleTime:0})),My.fetchQuery(i0())]);if(t.status===`rejected`){let e=iCe(t.reason);throw F9.set(r2,e.notFound),F9.set(i2,e.message),t.reason}if(n.status===`rejected`)throw F9.set(i2,I9),n.reason;let r=t0(t.value);F9.set(npe,{...r,nodes:Y0(By(),r.nodes,n.value)})},errorComponent:J9,component:J9}),ZCe=Fa({routeTree:Y9.addChildren([JCe,YCe,XCe]),defaultPreload:`intent`,basepath:Sy()}),X9=e=>typeof e==`string`&&e.includes(`ResizeObserver loop`);function QCe(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)return e.message}(()=>{if(window.__resizeObserverPatched||!window.ResizeObserver)return;let e=window.ResizeObserver;window.ResizeObserver=class extends e{constructor(e){super((t,n)=>{window.requestAnimationFrame(()=>e(t,n))})}},window.__resizeObserverPatched=!0})(),window.addEventListener(`error`,e=>{X9(e.message)&&(e.preventDefault(),e.stopImmediatePropagation())}),window.addEventListener(`unhandledrejection`,e=>{X9(QCe(e.reason))&&e.preventDefault()});var Z9=document.getElementById(`root`);if(!Z9)throw Error(`Root element not found`);var Q9=(0,Pee.createRoot)(Z9);Q9.render((0,X.jsx)(Ite,{}));var $9=await One();Q9.render($9.ok?(0,X.jsx)(Bte,{value:By(),children:(0,X.jsx)(Vte,{value:Qh,children:(0,X.jsx)(Ie,{client:My,children:(0,X.jsx)(Ra,{router:ZCe})})})}):(0,X.jsx)(Rte,{endpoint:`${Sy()}/api/extensions`,reason:$9.reason}));
|
|
91
|
+
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function HB(){let e=navigator.userAgent;return typeof window<`u`&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function UB(){return JB(/^Mac/)}function WB(){return JB(/^iPhone/)}function GB(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function KB(){return JB(/^iPad/)||UB()&&navigator.maxTouchPoints>1}function qB(){return WB()||KB()}function JB(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.platform):void 0}var YB=24,XB=typeof window<`u`?Y.useLayoutEffect:Y.useEffect;function ZB(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var QB=typeof document<`u`&&window.visualViewport;function $B(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function eV(e){for($B(e)&&(e=e.parentElement);e&&!$B(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}var tV=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]),nV=0,rV;function iV(e={}){let{isDisabled:t}=e;XB(()=>{if(!t)return nV++,nV===1&&qB()&&(rV=aV()),()=>{nV--,nV===0&&rV?.()}},[t])}function aV(){let e,t=0,n=n=>{e=eV(n.target),(e!==document.documentElement||e!==document.body)&&(t=n.changedTouches[0].pageY)},r=n=>{if(!e||e===document.documentElement||e===document.body){n.preventDefault();return}let r=n.changedTouches[0].pageY,i=e.scrollTop,a=e.scrollHeight-e.clientHeight;a!==0&&((i<=0&&r>t||i>=a&&r<t)&&n.preventDefault(),t=r)},i=e=>{let t=e.target;lV(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform=`translateY(-2000px)`,t.focus(),requestAnimationFrame(()=>{t.style.transform=``}))},a=e=>{let t=e.target;lV(t)&&(t.style.transform=`translateY(-2000px)`,requestAnimationFrame(()=>{t.style.transform=``,QB&&(QB.height<window.innerHeight?requestAnimationFrame(()=>{cV(t)}):QB.addEventListener(`resize`,()=>cV(t),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},s=window.pageXOffset,c=window.pageYOffset,l=ZB(oV(document.documentElement,`paddingRight`,`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=ZB(sV(document,`touchstart`,n,{passive:!1,capture:!0}),sV(document,`touchmove`,r,{passive:!1,capture:!0}),sV(document,`touchend`,i,{passive:!1,capture:!0}),sV(document,`focus`,a,!0),sV(window,`scroll`,o));return()=>{l(),u(),window.scrollTo(s,c)}}function oV(e,t,n){let r=e.style[t];return e.style[t]=n,()=>{e.style[t]=r}}function sV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function cV(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=eV(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+YB&&(t.scrollTop+=r-n)}e=t.parentElement}}function lV(e){return e instanceof HTMLInputElement&&!tV.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function uV(e,t){typeof e==`function`?e(t):e!=null&&(e.current=t)}function dV(...e){return t=>e.forEach(e=>uV(e,t))}function fV(...e){return Y.useCallback(dV(...e),e)}var pV=new WeakMap;function mV(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{if(t.startsWith(`--`)){e.style.setProperty(t,n);return}r[t]=e.style[t],e.style[t]=n}),!n&&pV.set(e,r)}function hV(e,t){if(!e||!(e instanceof HTMLElement))return;let n=pV.get(e);n&&(e.style[t]=n[t])}var gV=e=>{switch(e){case`top`:case`bottom`:return!0;case`left`:case`right`:return!1;default:return e}};function _V(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,i=r.match(/^matrix3d\((.+)\)$/);return i?parseFloat(i[1].split(`, `)[gV(t)?13:12]):(i=r.match(/^matrix\((.+)\)$/),i?parseFloat(i[1].split(`, `)[gV(t)?5:4]):null)}function vV(e){return 8*(Math.log(e+1)-2)}function yV(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}var bV={DURATION:.5,EASE:[.32,.72,0,1]},xV=.4,SV=.25,CV=100,wV=8,TV=16,EV=26,DV=`vaul-dragging`;function OV(e){let t=Y.useRef(e);return Y.useEffect(()=>{t.current=e}),Y.useMemo(()=>(...e)=>t.current==null?void 0:t.current.call(t,...e),[])}function kV({defaultProp:e,onChange:t}){let n=Y.useState(e),[r]=n,i=Y.useRef(r),a=OV(t);return Y.useEffect(()=>{i.current!==r&&(a(r),i.current=r)},[r,i,a]),n}function AV({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,i]=kV({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,s=OV(n);return[o,Y.useCallback(t=>{if(a){let n=typeof t==`function`?t(e):t;n!==e&&s(n)}else i(t)},[a,e,i,s])]}function jV({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:i,fadeFromIndex:a,onSnapPointChange:o,direction:s=`bottom`,container:c,snapToSequentialPoint:l}){let[u,d]=AV({prop:e,defaultProp:n?.[0],onChange:t}),[f,p]=Y.useState(typeof window<`u`?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);Y.useEffect(()=>{function e(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=Y.useMemo(()=>u===n?.[n.length-1]||null,[n,u]),h=Y.useMemo(()=>n?.findIndex(e=>e===u)??null,[n,u]),g=n&&n.length>0&&(a||a===0)&&!Number.isNaN(a)&&n[a]===u||!n,_=Y.useMemo(()=>{let e=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return n?.map(t=>{let n=typeof t==`string`,r=0;if(n&&(r=parseInt(t,10)),gV(s)){let i=n?r:f?t*e.height:0;return f?s===`bottom`?e.height-i:-e.height+i:i}let i=n?r:f?t*e.width:0;return f?s===`right`?e.width-i:-e.width+i:i})??[]},[n,f,c]),v=Y.useMemo(()=>h===null?null:_?.[h],[_,h]),y=Y.useCallback(e=>{let t=_?.findIndex(t=>t===e)??null;o(t),mV(r.current,{transition:`transform ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`,transform:gV(s)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),_&&t!==_.length-1&&a!==void 0&&t!==a&&t<a?mV(i.current,{transition:`opacity ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`,opacity:`0`}):mV(i.current,{transition:`opacity ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`,opacity:`1`}),d(n?.[Math.max(t,0)])},[r.current,n,_,a,i,d]);Y.useEffect(()=>{if(u||e){let t=n?.findIndex(t=>t===e||t===u)??-1;_&&t!==-1&&typeof _[t]==`number`&&y(_[t])}},[u,e,n,_,y]);function b({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(a===void 0)return;let c=s===`bottom`||s===`right`?(v??0)-e:(v??0)+e,u=h===a-1,d=h===0,f=e>0;if(u&&mV(i.current,{transition:`opacity ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`}),!l&&r>2&&!f){o?t():y(_[0]);return}if(!l&&r>2&&f&&_&&n){y(_[n.length-1]);return}let p=_?.reduce((e,t)=>typeof e!=`number`||typeof t!=`number`?e:Math.abs(t-c)<Math.abs(e-c)?t:e),g=gV(s)?window.innerHeight:window.innerWidth;if(r>xV&&Math.abs(e)<g*.4){let e=f?1:-1;if(e>0&&m&&n){y(_[n.length-1]);return}if(d&&e<0&&o&&t(),h===null)return;y(_[h+e]);return}y(p)}function x({draggedDistance:e}){if(v===null)return;let t=s===`bottom`||s===`right`?v-e:v+e;(s===`bottom`||s===`right`)&&t<_[_.length-1]||(s===`top`||s===`left`)&&t>_[_.length-1]||mV(r.current,{transform:gV(s)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})}function S(e,t){if(!n||typeof h!=`number`||!_||a===void 0)return null;let r=h===a-1;if(h>=a&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let i=r?h+1:h-1,o=r?_[i]-_[i-1]:_[i+1]-_[i],s=e/Math.abs(o);return r?1-s:s}return{isLastSnapPoint:m,activeSnapPoint:u,shouldFade:g,getPercentageDragged:S,setActiveSnapPoint:d,activeSnapPointIndex:h,onRelease:b,onDrag:x,snapPointsOffset:_}}function MV(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:i}=VB(),a=Y.useRef(null),o=(0,Y.useMemo)(()=>document.body.style.backgroundColor,[]);function s(){return(window.innerWidth-EV)/window.innerWidth}Y.useEffect(()=>{if(t&&n){a.current&&clearTimeout(a.current);let t=document.querySelector(`[data-vaul-drawer-wrapper]`)||document.querySelector(`[vaul-drawer-wrapper]`);if(!t)return;r&&!i&&yV(document.body,{background:`black`}),yV(t,{transformOrigin:gV(e)?`top`:`left`,transitionProperty:`transform, border-radius`,transitionDuration:`${bV.DURATION}s`,transitionTimingFunction:`cubic-bezier(${bV.EASE.join(`,`)})`});let n=yV(t,{borderRadius:`${wV}px`,overflow:`hidden`,...gV(e)?{transform:`scale(${s()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${s()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),a.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty(`background`)},bV.DURATION*1e3)}}},[t,n,o])}var NV=null;function PV({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:i,noBodyStyles:a}){let[o,s]=Y.useState(()=>typeof window<`u`?window.location.href:``),c=Y.useRef(0),l=Y.useCallback(()=>{if(GB()&&NV===null&&e&&!a){NV={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:`unset`};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty(`position`,`fixed`,`important`),Object.assign(document.body.style,{top:`${-c.current}px`,left:`${-e}px`,right:`0px`,height:`auto`}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&c.current>=t&&(document.body.style.top=`${-(c.current+e)}px`)}),300)}},[e]),u=Y.useCallback(()=>{if(GB()&&NV!==null&&!a){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,NV),window.requestAnimationFrame(()=>{if(i&&o!==window.location.href){s(window.location.href);return}window.scrollTo(t,e)}),NV=null}},[o]);return Y.useEffect(()=>{function e(){c.current=window.scrollY}return e(),window.addEventListener(`scroll`,e),()=>{window.removeEventListener(`scroll`,e)}},[]),Y.useEffect(()=>{if(t)return()=>{typeof document>`u`||document.querySelector(`[data-vaul-drawer]`)||u()}},[t,u]),Y.useEffect(()=>{n||!r||(e?(!window.matchMedia(`(display-mode: standalone)`).matches&&l(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,l,u]),{restorePositionSetting:u}}function FV({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:i,snapPoints:a,shouldScaleBackground:o=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=SV,scrollLockTimeout:l=CV,dismissible:u=!0,handleOnly:d=!1,fadeFromIndex:f=a&&a.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:h,modal:g=!0,onClose:_,nested:v,noBodyStyles:y=!1,direction:b=`bottom`,defaultOpen:x=!1,disablePreventScroll:S=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:w=!1,repositionInputs:T=!0,onAnimationEnd:E,container:D,autoFocus:O=!1}){let[k=!1,A]=AV({defaultProp:x,prop:e,onChange:e=>{t?.(e),!e&&!v&&de(),setTimeout(()=>{E?.(e)},bV.DURATION*1e3),e&&!g&&typeof window<`u`&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`}),e||(document.body.style.pointerEvents=`auto`)}}),[j,M]=Y.useState(!1),[N,P]=Y.useState(!1),[F,I]=Y.useState(!1),L=Y.useRef(null),R=Y.useRef(null),z=Y.useRef(null),B=Y.useRef(null),V=Y.useRef(null),H=Y.useRef(!1),U=Y.useRef(null),W=Y.useRef(0),G=Y.useRef(!1),K=Y.useRef(!x),q=Y.useRef(0),J=Y.useRef(null),ee=Y.useRef(J.current?.getBoundingClientRect().height||0),te=Y.useRef(J.current?.getBoundingClientRect().width||0),ne=Y.useRef(0),{activeSnapPoint:re,activeSnapPointIndex:ie,setActiveSnapPoint:ae,onRelease:oe,snapPointsOffset:se,onDrag:ce,shouldFade:le,getPercentageDragged:ue}=jV({snapPoints:a,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:J,fadeFromIndex:f,overlayRef:L,onSnapPointChange:Y.useCallback(e=>{a&&e===se.length-1&&(R.current=new Date)},[]),direction:b,container:D,snapToSequentialPoint:C});iV({isDisabled:!k||N||!g||F||!j||!T||!S});let{restorePositionSetting:de}=PV({isOpen:k,modal:g,nested:v??!1,hasBeenOpened:j,preventScrollRestoration:w,noBodyStyles:y});function fe(){return(window.innerWidth-EV)/window.innerWidth}function pe(e){!u&&!a||J.current&&!J.current.contains(e.target)||(ee.current=J.current?.getBoundingClientRect().height||0,te.current=J.current?.getBoundingClientRect().width||0,P(!0),z.current=new Date,qB()&&window.addEventListener(`touchend`,()=>H.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),W.current=gV(b)?e.pageY:e.pageX)}function me(e,t){let n=e,r=window.getSelection()?.toString(),i=J.current?_V(J.current,b):null,a=new Date;if(n.tagName===`SELECT`||n.hasAttribute(`data-vaul-no-drag`)||n.closest(`[data-vaul-no-drag]`))return!1;if(b===`right`||b===`left`)return!0;if(R.current&&a.getTime()-R.current.getTime()<500)return!1;if(i!==null&&(b===`bottom`?i>0:i<0))return!0;if(r&&r.length>0)return!1;if(V.current&&a.getTime()-V.current.getTime()<l&&i===0||t)return V.current=a,!1;for(;n;){if(n.scrollHeight>n.clientHeight){if(n.scrollTop!==0)return V.current=new Date,!1;if(n.getAttribute(`role`)===`dialog`)return!0}n=n.parentNode}return!0}function he(e){if(J.current&&N){let t=b===`bottom`||b===`right`?1:-1,n=(W.current-(gV(b)?e.pageY:e.pageX))*t,i=n>0,s=a&&!u&&!i;if(s&&ie===0)return;let c=Math.abs(n),l=document.querySelector(`[data-vaul-drawer-wrapper]`),d=c/(b===`bottom`||b===`top`?ee.current:te.current),p=ue(c,i);if(p!==null&&(d=p),s&&d>=1||!H.current&&!me(e.target,i))return;if(J.current.classList.add(DV),H.current=!0,mV(J.current,{transition:`none`}),mV(L.current,{transition:`none`}),a&&ce({draggedDistance:n}),i&&!a){let e=vV(n),r=Math.min(e*-1,0)*t;mV(J.current,{transform:gV(b)?`translate3d(0, ${r}px, 0)`:`translate3d(${r}px, 0, 0)`});return}let m=1-d;if((le||f&&ie===f-1)&&(r?.(e,d),mV(L.current,{opacity:`${m}`,transition:`none`},!0)),l&&L.current&&o){let e=Math.min(fe()+d*(1-fe()),1),t=8-d*8,n=Math.max(0,14-d*14);mV(l,{borderRadius:`${t}px`,transform:gV(b)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:`none`},!0)}if(!a){let e=c*t;mV(J.current,{transform:gV(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}}Y.useEffect(()=>{window.requestAnimationFrame(()=>{K.current=!0})},[]),Y.useEffect(()=>{var e;function t(){if(!J.current||!T)return;let e=document.activeElement;if(lV(e)||G.current){let e=window.visualViewport?.height||0,t=window.innerHeight,n=t-e,r=J.current.getBoundingClientRect().height||0,i=r>t*.8;ne.current||=r;let o=J.current.getBoundingClientRect().top;if(Math.abs(q.current-n)>60&&(G.current=!G.current),a&&a.length>0&&se&&ie){let e=se[ie]||0;n+=e}if(q.current=n,r>e||G.current){let t=J.current.getBoundingClientRect().height,r=t;t>e&&(r=e-(i?o:EV)),h?J.current.style.height=`${t-Math.max(n,0)}px`:J.current.style.height=`${Math.max(r,e-o)}px`}else HB()||(J.current.style.height=`${ne.current}px`);a&&a.length>0&&!G.current?J.current.style.bottom=`0px`:J.current.style.bottom=`${Math.max(n,0)}px`}}return(e=window.visualViewport)==null||e.addEventListener(`resize`,t),()=>window.visualViewport?.removeEventListener(`resize`,t)},[ie,a,se]);function ge(e){ve(),_?.(),e||A(!1),setTimeout(()=>{a&&ae(a[0])},bV.DURATION*1e3)}function _e(){if(!J.current)return;let e=document.querySelector(`[data-vaul-drawer-wrapper]`),t=_V(J.current,b);mV(J.current,{transform:`translate3d(0, 0, 0)`,transition:`transform ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`}),mV(L.current,{transition:`opacity ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`,opacity:`1`}),o&&t&&t>0&&k&&mV(e,{borderRadius:`${wV}px`,overflow:`hidden`,...gV(b)?{transform:`scale(${fe()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:`top`}:{transform:`scale(${fe()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:`left`},transitionProperty:`transform, border-radius`,transitionDuration:`${bV.DURATION}s`,transitionTimingFunction:`cubic-bezier(${bV.EASE.join(`,`)})`},!0)}function ve(){!N||!J.current||(J.current.classList.remove(DV),H.current=!1,P(!1),B.current=new Date)}function ye(e){if(!N||!J.current)return;J.current.classList.remove(DV),H.current=!1,P(!1),B.current=new Date;let t=_V(J.current,b);if(!e||!me(e.target,!1)||!t||Number.isNaN(t)||z.current===null)return;let n=B.current.getTime()-z.current.getTime(),r=W.current-(gV(b)?e.pageY:e.pageX),o=Math.abs(r)/n;if(o>.05&&(I(!0),setTimeout(()=>{I(!1)},200)),a){oe({draggedDistance:r*(b===`bottom`||b===`right`?1:-1),closeDrawer:ge,velocity:o,dismissible:u}),i?.(e,!0);return}if(b===`bottom`||b===`right`?r>0:r<0){_e(),i?.(e,!0);return}if(o>xV){ge(),i?.(e,!1);return}let s=Math.min(J.current.getBoundingClientRect().height??0,window.innerHeight),l=Math.min(J.current.getBoundingClientRect().width??0,window.innerWidth);if(Math.abs(t)>=(b===`left`||b===`right`?l:s)*c){ge(),i?.(e,!1);return}i?.(e,!0),_e()}Y.useEffect(()=>(k&&(mV(document.documentElement,{scrollBehavior:`auto`}),R.current=new Date),()=>{hV(document.documentElement,`scrollBehavior`)}),[k]);function be(e){let t=e?(window.innerWidth-TV)/window.innerWidth:1,n=e?-16:0;U.current&&window.clearTimeout(U.current),mV(J.current,{transition:`transform ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`,transform:gV(b)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&J.current&&(U.current=setTimeout(()=>{let e=_V(J.current,b);mV(J.current,{transition:`none`,transform:gV(b)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))}function xe(e,t){if(t<0)return;let n=(window.innerWidth-TV)/window.innerWidth,r=n+t*(1-n),i=-16+t*TV;mV(J.current,{transform:gV(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`,transition:`none`})}function Se(e,t){let n=gV(b)?window.innerHeight:window.innerWidth,r=t?(n-TV)/n:1,i=t?-16:0;t&&mV(J.current,{transition:`transform ${bV.DURATION}s cubic-bezier(${bV.EASE.join(`,`)})`,transform:gV(b)?`scale(${r}) translate3d(0, ${i}px, 0)`:`scale(${r}) translate3d(${i}px, 0, 0)`})}return Y.useEffect(()=>{g||window.requestAnimationFrame(()=>{document.body.style.pointerEvents=`auto`})},[g]),Y.createElement(gB,{defaultOpen:x,onOpenChange:e=>{!u&&!e||(e?M(!0):ge(!0),A(e))},open:k},Y.createElement(BB.Provider,{value:{activeSnapPoint:re,snapPoints:a,setActiveSnapPoint:ae,drawerRef:J,overlayRef:L,onOpenChange:t,onPress:pe,onRelease:ye,onDrag:he,dismissible:u,shouldAnimate:K,handleOnly:d,isOpen:k,isDragging:N,shouldFade:le,closeDrawer:ge,onNestedDrag:xe,onNestedOpenChange:be,onNestedRelease:Se,keyboardIsOpen:G,modal:g,snapPointsOffset:se,activeSnapPointIndex:ie,direction:b,shouldScaleBackground:o,setBackgroundColorOnScale:s,noBodyStyles:y,container:D,autoFocus:O}},n))}var IV=Y.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:i,shouldFade:a,isOpen:o,modal:s,shouldAnimate:c}=VB(),l=fV(t,n),u=r&&r.length>0;if(!s)return null;let d=Y.useCallback(e=>i(e),[i]);return Y.createElement(wB,{onMouseUp:d,ref:l,"data-vaul-overlay":``,"data-vaul-snap-points":o&&u?`true`:`false`,"data-vaul-snap-points-overlay":o&&a?`true`:`false`,"data-vaul-animate":c?.current?`true`:`false`,...e})});IV.displayName=`Drawer.Overlay`;var LV=Y.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},i){let{drawerRef:a,onPress:o,onRelease:s,onDrag:c,keyboardIsOpen:l,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:p,direction:m,snapPoints:h,container:g,handleOnly:_,shouldAnimate:v,autoFocus:y}=VB(),[b,x]=Y.useState(!1),S=fV(i,a),C=Y.useRef(null),w=Y.useRef(null),T=Y.useRef(!1),E=h&&h.length>0;MV();let D=(e,t,n=0)=>{if(T.current)return!0;let r=Math.abs(e.y),i=Math.abs(e.x),a=i>r,o=[`bottom`,`right`].includes(t)?1:-1;if(t===`left`||t===`right`){if(!(e.x*o<0)&&i>=0&&i<=n)return a}else if(!(e.y*o<0)&&r>=0&&r<=n)return!a;return T.current=!0,!0};Y.useEffect(()=>{E&&window.requestAnimationFrame(()=>{x(!0)})},[]);function O(e){C.current=null,T.current=!1,s(e)}return Y.createElement(OB,{"data-vaul-drawer-direction":m,"data-vaul-drawer":``,"data-vaul-delayed-snap-points":b?`true`:`false`,"data-vaul-snap-points":p&&E?`true`:`false`,"data-vaul-custom-container":g?`true`:`false`,"data-vaul-animate":v?.current?`true`:`false`,...r,ref:S,style:u&&u.length>0?{"--snap-point-height":`${u[d??0]}px`,...t}:t,onPointerDown:e=>{_||(r.onPointerDown==null||r.onPointerDown.call(r,e),C.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{n?.(e),y||e.preventDefault()},onPointerDownOutside:t=>{if(e?.(t),!f||t.defaultPrevented){t.preventDefault();return}l.current&&=!1},onFocusOutside:e=>{if(!f){e.preventDefault();return}},onPointerMove:e=>{if(w.current=e,_||(r.onPointerMove==null||r.onPointerMove.call(r,e),!C.current))return;let t=e.pageY-C.current.y,n=e.pageX-C.current.x,i=e.pointerType===`touch`?10:2;D({x:n,y:t},m,i)?c(e):(Math.abs(n)>i||Math.abs(t)>i)&&(C.current=null)},onPointerUp:e=>{r.onPointerUp==null||r.onPointerUp.call(r,e),C.current=null,T.current=!1,s(e)},onPointerOut:e=>{r.onPointerOut==null||r.onPointerOut.call(r,e),O(w.current)},onContextMenu:e=>{r.onContextMenu==null||r.onContextMenu.call(r,e),w.current&&O(w.current)}})});LV.displayName=`Drawer.Content`;var RV=250,zV=120,BV=Y.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:i,isDragging:a,snapPoints:o,activeSnapPoint:s,setActiveSnapPoint:c,dismissible:l,handleOnly:u,isOpen:d,onPress:f,onDrag:p}=VB(),m=Y.useRef(null),h=Y.useRef(!1);function g(){if(h.current){y();return}window.setTimeout(()=>{_()},zV)}function _(){if(a||e||h.current){y();return}if(y(),!o||o.length===0){l||i();return}if(s===o[o.length-1]&&l){i();return}let t=o.findIndex(e=>e===s);if(t===-1)return;let n=o[t+1];c(n)}function v(){m.current=window.setTimeout(()=>{h.current=!0},RV)}function y(){m.current&&window.clearTimeout(m.current),h.current=!1}return Y.createElement(`div`,{onClick:g,onPointerCancel:y,onPointerDown:e=>{u&&f(e),v()},onPointerMove:e=>{u&&p(e)},ref:r,"data-vaul-drawer-visible":d?`true`:`false`,"data-vaul-handle":``,"aria-hidden":`true`,...n},Y.createElement(`span`,{"data-vaul-handle-hitarea":``,"aria-hidden":`true`},t))});BV.displayName=`Drawer.Handle`;function VV({onDrag:e,onOpenChange:t,open:n,...r}){let{onNestedDrag:i,onNestedOpenChange:a,onNestedRelease:o}=VB();if(!i)throw Error(`Drawer.NestedRoot must be placed in another drawer`);return Y.createElement(FV,{nested:!0,open:n,onClose:()=>{a(!1)},onDrag:(t,n)=>{i(t,n),e?.(t,n)},onOpenChange:e=>{e&&a(e),t?.(e)},onRelease:o,...r})}function HV(e){let t=VB(),{container:n=t.container,...r}=e;return Y.createElement(SB,{container:n,...r})}var UV={Root:FV,NestedRoot:VV,Content:LV,Overlay:IV,Trigger:vB,Portal:HV,Handle:BV,Close:LB,Title:NB,Description:FB},WV=Y.createContext(void 0);function GV(e){let t=Y.useContext(WV);if(!e&&t===void 0)throw Error(Gg(27));return t}var KV=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),qV={"data-starting-style":``},JV={"data-ending-style":``},YV={transitionStatus(e){return e===`starting`?qV:e===`ending`?JV:null}};(function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=KV.startingStyle]=`startingStyle`,e[e.endingStyle=KV.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e})({});var XV={"data-popup-open":``},ZV={"data-popup-open":``,"data-pressed":``},QV={"data-open":``},$V={"data-closed":``},eH={"data-anchor-hidden":``},tH={open(e){return e?XV:null}},nH={open(e){return e?ZV:null}},rH={open(e){return e?QV:$V},anchorHidden(e){return e?eH:null}},iH={...rH,...YV},aH=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,s=GV(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return o_(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:iH,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),oH=`none`,sH=`trigger-press`,cH=`trigger-hover`,lH=`trigger-focus`,uH=`outside-press`,dH=`item-press`,fH=`close-press`,pH=`input-change`,mH=`input-clear`,hH=`input-press`,gH=`focus-out`,_H=`escape-key`,vH=`list-navigation`,yH=`keyboard`,bH=`pointer`,xH=`cancel-open`,SH=`sibling-open`,CH=`disabled`,wH=`imperative-action`,TH=`window-resize`;function EH(e,t,n,r){let i=!1,a=!1,o=r??a_;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function DH(e,t,n){let r=n??a_;return{reason:e,event:t??new Event(`base-ui`),...r}}var OH=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,...s}=e,c=GV(),l=c.useState(`open`),{getButtonProps:u,buttonRef:d}=Xg({disabled:a,native:o}),f={disabled:a};function p(e){l&&c.setOpen(!1,EH(fH,e.nativeEvent))}return o_(`button`,e,{state:f,ref:[t,d],props:[{onClick:p},s,u]})}),kH=0;function AH(e,t=`mui`){let[n,r]=Y.useState(e),i=e||n;return Y.useEffect(()=>{n??(kH+=1,r(`${t}-${kH}`))},[n,t]),i}var jH=wg.useId;function MH(e,t){if(jH!==void 0){let n=jH();return e??(t?`${t}-${n}`:n)}return AH(e,t)}function NH(e){return MH(e,`base-ui`)}var PH=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=GV(),c=NH(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),o_(`p`,e,{ref:t,props:[{id:c},o]})});function FH(e){Y.useEffect(e,i_)}var IH=0,LH=class e{static create(){return new e}currentId=IH;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=IH,t()},e)}isStarted(){return this.currentId!==IH}clear=()=>{this.currentId!==IH&&(clearTimeout(this.currentId),this.currentId=IH)};disposeEffect=()=>this.clear};function RH(){let e=Eg(LH.create).current;return FH(e.disposeEffect),e}function zH(){return typeof navigator>`u`?{userAgent:``,platform:``,maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??0}}var{userAgent:BH,platform:VH,maxTouchPoints:HH}=zH(),UH=BH.toLowerCase(),WH=VH.toLowerCase(),GH=/^i(os$|p)/.test(WH)||WH===`macintel`&&HH>1,KH=`android`,qH=WH===KH||UH.includes(KH),JH=!GH&&WH.startsWith(`mac`);WH.startsWith(`win`),!qH&&/^(linux|chrome os)/.test(WH);var YH=JH||GH,XH=typeof CSS<`u`&&!!CSS.supports?.(`-webkit-backdrop-filter:none`),ZH=!XH&&UH.includes(`firefox`);!XH&&UH.includes(`chrom`);var QH=YH,$H=/jsdom|happydom/.test(UH);function eU(e){e.preventDefault(),e.stopPropagation()}function tU(e){return`nativeEvent`in e}function nU(e){return e.pointerType===``&&e.isTrusted?!0:qH&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function rU(e){return $H?!1:!qH&&e.width===0&&e.height===0||qH&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function iU(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function aU(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var oU=`data-base-ui-focusable`,sU=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,cU=`ArrowLeft`,lU=`ArrowRight`,uU=`ArrowUp`,dU=`ArrowDown`;function fU(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function pU(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&og(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function mU(e){return`composedPath`in e?e.composedPath()[0]:e.target}function hU(e,t){if(!ig(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(pU(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function gU(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function _U(e){return e.matches(`html,body`)}function vU(e){return ag(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function yU(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${sU}`)!=null}function bU(e){return e?e.getAttribute(`role`)===`combobox`&&vU(e):!1}function xU(e){if(!e||$H)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function SU(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function CU(e,t){return t!=null&&!iU(t)?0:typeof e==`function`?e():e}function wU(e,t,n){let r=CU(e,n);return typeof r==`number`?r:r?.[t]}function TU(e){return typeof e==`function`?e():e}function EU(e,t){return t||e===`click`||e===`mousedown`}function DU(e){return e?.includes(`mouse`)&&e!==`mousedown`}var OU=Y.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new LH,currentIdRef:{current:null},currentContextRef:{current:null}});function kU(e,t){e.current=t.current}function AU(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=Y.useRef(n),a=Y.useRef(n),o=Y.useRef(null),s=Y.useRef(null),c=RH();return Mg(()=>{if(a.current=n,!o.current){i.current=n;return}i.current={open:wU(i.current,`open`),close:wU(n,`close`)}},[n,o,i,a]),(0,X.jsx)(OU.Provider,{value:Y.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function jU(e,t={open:!1}){let{open:n}=t,r=`rootStore`in e?e.rootStore:e,i=r.useState(`floatingId`),{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=Y.useContext(OU),[f,p]=Y.useState(!1),m=Y.useRef(n);return Mg(()=>{m.current=n},[n]),Mg(()=>{function e(){l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current,d.clear()}if(a.current&&!n&&a.current===i){if(p(!1),s){let t=i;return d.start(s,()=>{r.select(`open`)||a.current&&a.current!==t||e()}),()=>{(m.current||a.current!==t)&&d.clear()}}e()}},[n,i,a,o,s,c,l,d,r]),Mg(()=>{if(!n)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:r.setOpen,setIsInstantPhase:p},a.current=i,o.current={open:0,close:wU(c.current,`close`)},t!==null&&t!==i?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,EH(oH))):(p(!1),e?.setIsInstantPhase(!1))},[n,i,r,a,o,c,l,d]),Mg(()=>()=>{if(a.current===i){if(l.current=null,!m.current)return;a.current=null,kU(o,c),d.clear()}},[l,a,o,i,c,d]),Y.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function MU(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function NU(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function PU(e){let t=Eg(FU,e).current;return t.next=e,Mg(t.effect),t}function FU(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var IU=null;globalThis.requestAnimationFrame;var LU=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},RU=class e{static create(){return new e}static request(e){return LU.request(e)}static cancel(e){return LU.cancel(e)}currentId=IU;request(e){this.cancel(),this.currentId=LU.request(()=>{this.currentId=IU,e()})}cancel=()=>{this.currentId!==IU&&(LU.cancel(this.currentId),this.currentId=IU)};disposeEffect=()=>this.cancel};function zU(){let e=Eg(RU.create).current;return FH(e.disposeEffect),e}var BU={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},VU={...BU,position:`fixed`,top:0,left:0},HU={...BU,position:`absolute`},UU=Y.forwardRef(function(e,t){let[n,r]=Y.useState();Mg(()=>{QH&&XH&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,X.jsx)(`span`,{...e,ref:t,style:VU,"aria-hidden":!n||void 0,...i,"data-base-ui-focus-guard":``})}),WU=Math.min,GU=Math.max,KU=Math.round,qU=Math.floor,JU=e=>({x:e,y:e}),YU={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function XU(e,t,n){return GU(e,WU(t,n))}function ZU(e,t){return typeof e==`function`?e(t):e}function QU(e){return e.split(`-`)[0]}function $U(e){return e.split(`-`)[1]}function eW(e){return e===`x`?`y`:`x`}function tW(e){return e===`y`?`height`:`width`}function nW(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function rW(e){return eW(nW(e))}function iW(e,t,n){n===void 0&&(n=!1);let r=$U(e),i=rW(e),a=tW(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pW(o)),[o,pW(o)]}function aW(e){let t=pW(e);return[oW(e),t,oW(t)]}function oW(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var sW=[`left`,`right`],cW=[`right`,`left`],lW=[`top`,`bottom`],uW=[`bottom`,`top`];function dW(e,t,n){switch(e){case`top`:case`bottom`:return n?t?cW:sW:t?sW:cW;case`left`:case`right`:return t?lW:uW;default:return[]}}function fW(e,t,n,r){let i=$U(e),a=dW(QU(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(oW)))),a}function pW(e){let t=QU(e);return YU[t]+e.slice(t.length)}function mW(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function hW(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:mW(e)}function gW(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _W(e,t,n){return Math.floor(e/t)!==n}function vW(e,t){return t<0||t>=e.length}function yW(e,t){return xW(e.current,{disabledIndices:t})}function bW(e,t){return xW(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function xW(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&CW(e,a,r));return a}function SW(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1),r=i(t,u,n[o][e]??n[o][0]);o=a[r]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!CW(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=qU(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!CW(e,r,s))return r}};d&&eU(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=xW(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=xW(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}vW(e,f)&&(f=u)}if(n===`both`){let n=qU(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&eU(t),u%o===o-1?r&&(f=xW(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=xW(e,{startingIndex:u,disabledIndices:s}),r&&_W(f,o,n)&&(f=xW(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),_W(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&eU(t),u%o===0?r&&(f=xW(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=xW(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&_W(f,o,n)&&(f=xW(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),_W(f,o,n)&&(f=u));let c=qU(l/o)===n;vW(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:xW(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function CW(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?!TW(r)||r.matches(`:disabled`)?!0:!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!1}function wW(e){return e.visibility===`hidden`||e.visibility===`collapse`}function TW(e,t=e?vg(e):null){return!e||!e.isConnected||!t||wW(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var EW=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function DW(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return og(n)?n.host:null}function OW(e){for(let t of Array.from(e.children))if(eg(t)===`summary`)return t;return null}function kW(e,t){let n=OW(t);return!!n&&(e===n||pU(n,e))}function AW(e){let t=e?eg(e):``;return e!=null&&e.matches(EW)&&(t!==`summary`||e.parentElement!=null&&eg(e.parentElement)===`details`&&OW(e.parentElement)===e)&&(t!==`details`||OW(e)==null)&&(t!==`input`||e.type!==`hidden`)}function jW(e){if(!AW(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=DW(t)){let n=t!==e,r=eg(t)===`slot`;if(t.hasAttribute(`inert`)||n&&eg(t)===`details`&&!t.open&&!kW(e,t)||t.hasAttribute(`hidden`)||!r&&!MW(t,n))return!1}return!0}function MW(e,t){let n=vg(e);return t?n.display!==`none`:TW(e,n)}function NW(e){let t=e.tabIndex;if(t<0){let t=eg(e);if(t===`details`||t===`audio`||t===`video`||ag(e)&&e.isContentEditable)return 0}return t}function PW(e){if(eg(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function FW(e,t){let n=PW(e);if(!n)return!0;let r=t.find(e=>{let t=PW(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=PW(e);return t?.name===n.name&&t.form===n.form})===n}function IW(e){if(ag(e)&&eg(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return ag(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function LW(e,t){IW(e).forEach(e=>{AW(e)&&t.push(e),LW(e,t)})}function RW(e,t,n){IW(e).forEach(e=>{ag(e)&&e.matches(t)&&n.push(e),RW(e,t,n)})}function zW(e){return jW(e)&&NW(e)>=0}function BW(e){let t=[];return LW(e,t),t.filter(jW)}function VW(e){let t=BW(e);return t.filter(e=>NW(e)>=0&&FW(e,t))}function HW(e,t){let n=VW(e),r=n.length;if(r===0)return;let i=fU(Jg(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function UW(e){return HW(Jg(e).body,1)||e}function WW(e){return HW(Jg(e).body,-1)||e}function GW(e,t){if(!e)return null;let n=VW(Jg(e).body),r=n.length;if(r===0)return null;let i=n.indexOf(e);return i===-1?null:n[(i+t+r)%r]}function KW(e){return GW(e,1)}function qW(e){return GW(e,-1)}function JW(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!pU(n,r)}function YW(e){VW(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function XW(e){let t=[];RW(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function ZW(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...ZW(e,t.id,n)])}function QW(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function $W(e){return`data-base-ui-${e}`}var eG=0;function tG(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(eG);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),r_;let o=requestAnimationFrame(a);return eG=o,()=>{eG===o&&(cancelAnimationFrame(o),eG=0)}}var nG={inert:new WeakMap,"aria-hidden":new WeakMap},rG=`data-base-ui-inert`,iG={inert:new WeakSet,"aria-hidden":new WeakSet},aG=new WeakMap,oG=0;function sG(e){return iG[e]}function cG(e){return e?og(e)?e.host:cG(e.parentNode):null}var lG=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=cG(t);return e.contains(n)?n:null}).filter(e=>e!=null),uG=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},dG=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{eg(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function fG(e,t,n,r,{mark:i=!0}){let a=null;r?a=`inert`:n&&(a=`aria-hidden`);let o=null,s=null,c=lG(t,e),l=i?dG(t,uG(c),new Set(c)):[],u=[],d=[];if(a){let e=nG[a],n=sG(a);s=n,o=e;let r=lG(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=c.concat(r);dG(t,uG(i),new Set(i)).forEach(t=>{let r=t.getAttribute(a),i=r!==null&&r!==`false`,o=(e.get(t)||0)+1;e.set(t,o),u.push(t),o===1&&i&&n.add(t),i||t.setAttribute(a,a===`inert`?``:`true`)})}return i&&l.forEach(e=>{let t=(aG.get(e)||0)+1;aG.set(e,t),d.push(e),t===1&&e.setAttribute(rG,``)}),oG+=1,()=>{o&&u.forEach(e=>{let t=(o.get(e)||0)-1;o.set(e,t),t||(!s?.has(e)&&a&&e.removeAttribute(a),s?.delete(e))}),i&&d.forEach(e=>{let t=(aG.get(e)||0)-1;aG.set(e,t),t||e.removeAttribute(rG)}),--oG,oG||(nG.inert=new WeakMap,nG[`aria-hidden`]=new WeakMap,iG.inert=new WeakSet,iG[`aria-hidden`]=new WeakSet,aG=new WeakMap)}}function pG(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0}=t,a=Jg(e[0]).body;return fG(e,a,n,r,{mark:i})}var mG={style:{transition:`none`}},hG={fallbackAxisSide:`none`},gG={fallbackAxisSide:`end`},_G={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},vG=Y.createContext(null),yG=()=>Y.useContext(vG),bG=$W(`portal`);function xG(e={}){let{ref:t,container:n,componentProps:r=a_,elementProps:i}=e,a=MH(),o=yG()?.portalNode,[s,c]=Y.useState(null),[l,u]=Y.useState(null),d=kg(e=>{e!==null&&u(e)}),f=Y.useRef(null);Mg(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}let e=(n&&(rg(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o]);let p=o_(`div`,r,{ref:[t,d],props:[{id:a,[bG]:``},i]}),m=s&&p?Xi.createPortal(p,s):null;return{node:l,nodeId:Y.isValidElement(p)?p.props.id:void 0,subtree:m}}var SG=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,...s}=e,{node:c,nodeId:l,subtree:u}=xG({container:o,ref:t,componentProps:e,elementProps:s}),d=Y.useRef(null),f=Y.useRef(null),p=Y.useRef(null),m=Y.useRef(null),[h,g]=Y.useState(null),_=Y.useRef(!1),v=h?.modal,y=h?.open,b=!!h&&!h.modal&&h.open&&!!c;Y.useEffect(()=>{if(!c||v)return;function e(e){c&&e.relatedTarget&&JW(e)&&(e.type===`focusin`?_.current&&=(XW(c),!1):(YW(c),_.current=!0))}return NU(MU(c,`focusin`,e,!0),MU(c,`focusout`,e,!0))},[c,v]),Mg(()=>{!c||y!==!0||!_.current||(XW(c),_.current=!1)},[y,c]);let x=Y.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:g}),[c]);return(0,X.jsxs)(Y.Fragment,{children:[u,(0,X.jsxs)(vG.Provider,{value:x,children:[b&&c&&(0,X.jsx)(UU,{"data-type":`outside`,ref:d,onFocus:e=>{JW(e,c)?p.current?.focus():WW(h?h.domReference:null)?.focus()}}),b&&c&&(0,X.jsx)(`span`,{"aria-owns":l,style:_G}),c&&Xi.createPortal(a,c),b&&c&&(0,X.jsx)(UU,{"data-type":`outside`,ref:f,onFocus:e=>{JW(e,c)?m.current?.focus():(UW(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,EH(`focus-out`,e.nativeEvent)))}})]})]})});function CG(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var wG=class{nodesRef={current:[]};events=CG();addNode(e){this.nodesRef.current.push(e)}removeNode(e){let t=this.nodesRef.current.findIndex(t=>t===e);t!==-1&&this.nodesRef.current.splice(t,1)}},TG=Y.createContext(null),EG=Y.createContext(null),DG=()=>Y.useContext(TG)?.id||null,OG=e=>{let t=Y.useContext(EG);return e??t};function kG(e){let t=MH(),n=OG(e),r=DG();return Mg(()=>{if(!t)return;let e={id:t,parentId:r};return n?.addNode(e),()=>{n?.removeNode(e)}},[n,t,r]),t}function AG(e){let{children:t,id:n}=e,r=DG();return(0,X.jsx)(TG.Provider,{value:Y.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function jG(e){let{children:t,externalTree:n}=e,r=Eg(()=>n??new wG).current;return(0,X.jsx)(EG.Provider,{value:r,children:t})}function MG(e){return e==null?e:`current`in e?e.current:e}function NG(e,t){let n=tg(mU(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var PG=20,FG=[];function IG(){FG=FG.filter(e=>e.deref()?.isConnected)}function LG(e){IG(),e&&eg(e)!==`body`&&(FG.push(new WeakRef(e)),FG.length>PG&&(FG=FG.slice(-20)))}function RG(){return IG(),FG[FG.length-1]?.deref()}function zG(e){return e?zW(e)?e:VW(e)[0]||e:null}function BG(e){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!e.getAttribute(`role`)?.includes(`dialog`))return;let t=BW(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return zW(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),n=e.getAttribute(`tabindex`);t.length===0?n!==`0`&&(e.setAttribute(`tabindex`,`0`),e.setAttribute(`data-tabindex`,`0`)):(n!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function VG(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:y,dataRef:b}=h.context,x=kg(()=>b.current.floatingContext?.nodeId),S=i===!1,C=bU(_)&&S,w=PU(i),T=PU(a),E=PU(l),D=PU(g),O=OG(p),k=yG(),A=Y.useRef(!1),j=Y.useRef(!1),M=Y.useRef(!1),N=Y.useRef(null),P=Y.useRef(``),F=Y.useRef(``),I=Y.useRef(null),L=Y.useRef(null),R=Qg(I,f,k?.beforeInsideRef),z=Qg(L,k?.afterInsideRef),B=RH(),V=RH(),H=zU(),U=k!=null,W=SU(v),G=kg((e=W)=>e?VW(e):[]),K=kg(()=>m?.().filter(e=>e!=null)??[]);Y.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&pU(W,fU(Jg(W)))&&G().length===0&&!C&&eU(e)}return MU(Jg(W),`keydown`,e)},[r,W,s,C,G]),Y.useEffect(()=>{if(r||!g)return;let e=Jg(W);function t(){M.current=!1}function n(e){let t=mU(e),n=K(),r=pU(v,t)||pU(_,t)||pU(k?.portalNode,t)||n.some(e=>e===t||pU(e,t));M.current=!r,F.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(j.current=!0,V.start(0,()=>{j.current=!1}))}function i(){F.current=`keyboard`}return NU(MU(e,`pointerdown`,n,!0),MU(e,`pointerup`,t,!0),MU(e,`pointercancel`,t,!0),MU(e,`keydown`,i,!0),t)},[r,v,_,W,g,k,V,K]),Y.useEffect(()=>{if(r||!c)return;let e=Jg(W);function t(){j.current=!0,V.start(0,()=>{j.current=!1})}function n(e){let t=mU(e);zW(t)&&(N.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=mU(t);s&&n==null&&i!=null&&pU(v,i)&&LG(i),queueMicrotask(()=>{let a=x(),c=h.context.triggerElements,l=K(),f=n?.hasAttribute($W(`focus-guard`))&&[I.current,L.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,MG(d),MG(u)].includes(n),p=!(pU(_,n)||pU(v,n)||pU(n,v)||pU(k?.portalNode,n)||l.some(e=>e===n||pU(e,n))||c.hasMatchingElement(e=>pU(e,n))||f||O&&(ZW(O.nodesRef.current,a).find(e=>pU(e.context?.elements.floating,n)||pU(e.context?.elements.domReference,n))||QW(O.nodesRef.current,a).find(e=>[e.context?.elements.floating,SU(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&W&&BG(W),o&&r!==_&&!TW(i)&&fU(e)===e.body){if(ag(W)&&(W.focus(),o===`popup`)){H.request(()=>{W.focus()});return}let e=G(),t=N.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||W;ag(n)&&n.focus()}if(b.current.insideReactTree){b.current.insideReactTree=!1;return}(C||!s)&&n&&p&&!j.current&&(C||n!==RG())&&(A.current=!0,h.setOpen(!1,EH(gH,t)))})}function a(){M.current||(b.current.insideReactTree=!0,B.start(0,()=>{b.current.insideReactTree=!1}))}let l=ag(_)?_:null;if(!(!v&&!l))return NU(l&&MU(l,`focusout`,i),l&&MU(l,`pointerdown`,t),v&&MU(v,`focusin`,n),v&&MU(v,`focusout`,i),v&&k&&MU(v,`focusout`,a,!0))},[r,_,v,W,s,O,k,h,c,o,G,C,x,b,B,V,H,u,d,K]),Y.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(k?.portalNode?.querySelectorAll(`[${$W(`portal`)}]`)||[]),t=(O?QW(O.nodesRef.current,x()):[]).find(e=>bU(e.context?.elements.domReference||null))?.context?.elements.domReference,n=pG([v,...e,I.current,L.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,...K(),t,MG(d),MG(u),C?_:null].filter(e=>e!=null),{ariaHidden:s||C,mark:!1}),i=pG([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,k,C,O,x,u,d,K]),Mg(()=>{if(!g||r||!ag(W))return;P.current=``,F.current=``;let e=Jg(W),t=fU(e);queueMicrotask(()=>{let n=w.current,r=typeof n==`function`?n(E.current||``):n;if(r===void 0||r===!1||pU(W,t))return;let i=null,a=()=>(i??=G(W),i[0]||W),o;o=r===!0||r===null?a():MG(r),o||=a();let s=pU(W,fU(e));tG(o,{preventScroll:o===W,shouldFocus(){if(!D.current)return!1;if(s)return!0;let t=fU(e);return!(t!==o&&pU(W,t))}})})},[r,g,W,G,w,E,D]),Mg(()=>{if(r||!W)return;let e=Jg(W),t=fU(e),n=E.current==null;LG(t);function i(e){if(e.open||(P.current=NG(e.nativeEvent,F.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(A.current=!0),e.reason===`outside-press`){if(e.nested)A.current=!1;else if(nU(e.nativeEvent)||rU(e.nativeEvent))A.current=!1;else{let e=!1;Jg(W).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?A.current=!1:A.current=!0}}}y.on(`openchange`,i);function a(e){let r=T.current,i=typeof r==`function`?r(e):r;if(i===void 0||i===!1)return null;i===null&&(i=!0);let a=_?.isConnected?_:null,o=t?.isConnected&&eg(t)!==`body`?t:null,s=n?o||a:a||o;return s||=RG()||null,typeof i==`boolean`?s:MG(i)||s||null}return()=>{y.off(`openchange`,i);let t=fU(e),n=K(),r=pU(v,t)||n.some(e=>e===t||pU(e,t))||O&&ZW(O.nodesRef.current,x(),!1).some(e=>pU(e.context?.elements.floating,t)),o=T.current,s=P.current,c=a(s);queueMicrotask(()=>{let n=zG(c),i=typeof o!=`boolean`;if(o&&!A.current&&ag(n)&&(!(!i&&n!==t&&t!==e.body)||r)){let e={preventScroll:!0};s===`keyboard`&&(e.focusVisible=!0),n.focus(e)}A.current=!1})}},[r,v,W,T,E,y,O,_,x,K]),Mg(()=>{if(!XH||g||!v)return;let e=fU(Jg(v));!ag(e)||!vU(e)||pU(v,e)&&e.blur()},[g,v]),Mg(()=>{if(!(r||!k))return k.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{k.setFocusManagerState(null)}},[r,k,s,g,h,c,_]),Mg(()=>{if(!(r||!W))return BG(W),()=>{queueMicrotask(IG)}},[r,W]);let q=!r&&(!s||!C)&&(U||s);return(0,X.jsxs)(Y.Fragment,{children:[q&&(0,X.jsx)(UU,{"data-type":`inside`,ref:R,onFocus:e=>{if(s){let e=G();tG(e[e.length-1])}else k?.portalNode&&(A.current=!1,JW(e,k.portalNode)?UW(_)?.focus():MG(d??k.beforeOutsideRef)?.focus())}}),n,q&&(0,X.jsx)(UU,{"data-type":`inside`,ref:z,onFocus:e=>{s?tG(G()[0]):k?.portalNode&&(c&&(A.current=!0),JW(e,k.portalNode)?WW(_)?.focus():MG(u??k.afterOutsideRef)?.focus())}})]})}function HG(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=sH}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Y.useRef(void 0),f=zU(),p=RH(),m=Y.useMemo(()=>{function e(e,t,n,r){let i=EH(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=iU(e.pointerType,!0)&&rU(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||iU(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=mU(o);if(vU(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}iU(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Y.useMemo(()=>n?{reference:m}:a_,[n,m])}function UG(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function WG(e){return e!=null&&e.clientX!=null}function GG(e,t={}){let{enabled:n=!0,axis:r=`both`}=t,i=`rootStore`in e?e.rootStore:e,a=i.useState(`open`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.context.dataRef,l=Y.useRef(!1),u=Y.useRef(null),[d,f]=Y.useState(),[p,m]=Y.useState([]),h=kg(e=>{i.set(`positionReference`,e)}),g=kg((e,t,n)=>{l.current||c.current.openEvent&&!WG(c.current.openEvent)||i.set(`positionReference`,UG(n??s,{x:e,y:t,axis:r,dataRef:c,pointerType:d}))}),_=kg(e=>{a?u.current||(g(e.clientX,e.clientY,e.currentTarget),m([])):g(e.clientX,e.clientY,e.currentTarget)}),v=iU(d)?o:a;Y.useEffect(()=>{if(!n){h(s);return}if(!v)return;function e(){u.current?.(),u.current=null}let t=tg(o);function r(t){let n=mU(t);pU(o,n)?e():g(t.clientX,t.clientY)}return!c.current.openEvent||WG(c.current.openEvent)?u.current=MU(t,`mousemove`,r):h(s),e},[v,n,o,c,s,i,g,h,p]),Y.useEffect(()=>()=>{i.set(`positionReference`,null)},[i]),Y.useEffect(()=>{n&&!o&&(l.current=!1)},[n,o]),Y.useEffect(()=>{!n&&a&&(l.current=!0)},[n,a]);let y=Y.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:_,onMouseEnter:_}},[_]);return Y.useMemo(()=>n?{reference:y,trigger:y}:{},[n,y])}function KG(){return!1}function qG(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function JG(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=KG,bubbles:s,externalTree:c}=t,l=`rootStore`in e?e.rootStore:e,u=l.useState(`open`),d=l.useState(`floatingElement`),{dataRef:f}=l.context,p=OG(c),m=kg(typeof i==`function`?i:()=>!1),h=typeof i==`function`?m:i,g=h!==!1,_=kg(()=>a),{escapeKey:v,outsidePress:y}=qG(s),b=Y.useRef(!1),x=Y.useRef(!1),S=Y.useRef(!1),C=Y.useRef(!1),w=Y.useRef(``),T=Y.useRef(null),E=RH(),D=RH(),O=kg(()=>{D.clear(),f.current.insideReactTree=!1}),k=kg(e=>{let t=f.current.floatingContext?.nodeId;return(p?ZW(p.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),A=kg(e=>gU(e,l.select(`floatingElement`))||gU(e,l.select(`domReferenceElement`))),j=kg(e=>{o()&&l.setOpen(!1,EH(sH,e.nativeEvent))}),M=kg(e=>{if(!u||!n||!r||e.key!==`Escape`||C.current||!v&&k(`__escapeKeyBubbles`))return;let t=EH(_H,tU(e)?e.nativeEvent:e);l.setOpen(!1,t),t.isCanceled||e.preventDefault(),!v&&!t.isPropagationAllowed&&e.stopPropagation()}),N=kg(()=>{f.current.insideReactTree=!0,D.start(0,O)}),P=kg(e=>{if(!u||!n||e.button!==0)return;let t=mU(e.nativeEvent);pU(l.select(`floatingElement`),t)&&(b.current||(b.current=!0,x.current=!1))}),F=kg(e=>{!u||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&b.current&&(x.current=!0)});Y.useEffect(()=>{if(!u||!n)return O;f.current.__escapeKeyBubbles=v,f.current.__outsidePressBubbles=y;let e=new LH,t=new LH;function i(){e.clear(),C.current=!0}function a(){e.start(XH?5:0,()=>{C.current=!1})}function o(){S.current=!0,t.start(0,()=>{S.current=!1})}function s(){b.current=!1,x.current=!1}function c(){let e=w.current,t=e===`pen`||!e?`mouse`:e,n=_(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function m(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function D(e){let t=f.current.floatingContext?.nodeId,n=p&&ZW(p.nodesRef.current,t).some(t=>gU(e,t.context?.elements.floating));return A(e)||n}function j(e){if(m(e)){e.type!==`click`&&!A(e)&&(t.clear(),S.current=!1),O();return}if(f.current.insideReactTree){O();return}let n=mU(e),r=`[${$W(`inert`)}]`,i=ig(n)?n.getRootNode():null,a=Array.from((og(i)?i:Jg(l.select(`floatingElement`))).querySelectorAll(r)),o=l.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>pU(e,n))))return;let s=ig(n)?n:null;for(;s&&!_g(s);){let e=bg(s);if(_g(e)||!ig(e))break;s=e}if(!(a.length&&ig(n)&&!_U(n)&&!pU(n,l.select(`floatingElement`))&&a.every(e=>!pU(s,e)))){if(ag(n)&&!(`touches`in e)){let t=_g(n),r=vg(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!D(e)){if(c()===`intentional`&&S.current){t.clear(),S.current=!1;return}typeof h==`function`&&!h(e)||k(`__outsidePressBubbles`)||(l.setOpen(!1,EH(uH,e)),O())}}}function N(e){c()!==`sloppy`||e.pointerType===`touch`||!l.select(`open`)||!n||A(e)||j(e)}function P(e){if(c()!==`sloppy`||!l.select(`open`)||!n||A(e))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=mU(e);if(!n)return;let r=MU(n,e.type,()=>{t(e),r()})}function I(e){w.current=`touch`,F(e,P)}function L(e){E.clear(),e.type===`pointerdown`&&(w.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?N(e):j(e)})}function R(e){if(!b.current)return;let n=x.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!D(e)){if(n){o();return}typeof h==`function`&&!h(e)||(t.clear(),S.current=!0,O())}}}function z(e){if(c()!==`sloppy`||!T.current||A(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-T.current.startX),r=Math.abs(t.clientY-T.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(T.current.dismissOnTouchEnd=!0),i>10&&(j(e),E.clear(),T.current=null)}function B(e){F(e,z)}function V(e){c()!==`sloppy`||!T.current||A(e)||(T.current.dismissOnTouchEnd&&j(e),E.clear(),T.current=null)}function H(e){F(e,V)}let U=Jg(d),W=NU(r&&NU(MU(U,`keydown`,M),MU(U,`compositionstart`,i),MU(U,`compositionend`,a)),g&&NU(MU(U,`click`,L,!0),MU(U,`pointerdown`,L,!0),MU(U,`pointerup`,R,!0),MU(U,`pointercancel`,R,!0),MU(U,`mousedown`,L,!0),MU(U,`mouseup`,R,!0),MU(U,`touchstart`,I,!0),MU(U,`touchmove`,B,!0),MU(U,`touchend`,H,!0)));return()=>{W(),e.clear(),t.clear(),s(),S.current=!1,O()}},[f,d,r,g,h,u,n,v,y,M,O,_,k,A,p,l,E]);let I=Y.useMemo(()=>({onKeyDown:M,onPointerDown:j,onClick:j}),[M,j]),L=Y.useMemo(()=>({onKeyDown:M,onPointerDown:F,onMouseDown:F,onClickCapture:N,onMouseDownCapture(e){N(),P(e)},onPointerDownCapture(e){N(),P(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,P,F]);return Y.useMemo(()=>n?{reference:I,floating:L,trigger:I}:{},[n,I,L])}function YG(e,t,n){let{reference:r,floating:i}=e,a=nW(t),o=rW(t),s=tW(o),c=QU(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=$U(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function XG(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ZU(t,e),p=hW(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=gW(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=gW(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ZG=50,QG=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:XG},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=YG(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ZG&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=YG(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},$G=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ZU(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=QU(r),_=nW(o),v=QU(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[pW(o)]:aW(o)),x=p!==`none`;!d&&x&&b.push(...fW(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=iW(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(u!==`alignment`||_===nW(t)||T.every(e=>nW(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=nW(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o}if(r!==n)return{reset:{placement:n}}}return{}}}},eK=new Set([`left`,`top`]);async function tK(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=QU(n),s=$U(n),c=nW(n)===`y`,l=eK.has(o)?-1:1,u=a&&c?-1:1,d=ZU(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var nK=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await tK(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},rK=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ZU(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=nW(i),p=eW(f),m=u[p],h=u[f],g=(e,t)=>XU(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},iK=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=ZU(e,t),u={x:n,y:r},d=nW(i),f=eW(d),p=u[f],m=u[d],h=ZU(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=eK.has(QU(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},aK=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=ZU(e,t),c=await i.detectOverflow(t,s),l=QU(n),u=$U(n),d=nW(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=WU(p-c[m],g),y=WU(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*GU(c.left,c.right):S=p-2*GU(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function oK(e){let t=vg(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ag(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=KU(n)!==a||KU(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function sK(e){return ig(e)?e:e.contextElement}function cK(e){let t=sK(e);if(!ag(t))return JU(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=oK(t),o=(a?KU(n.width):n.width)/r,s=(a?KU(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var lK=JU(0);function uK(e){let t=tg(e);return!gg()||!t.visualViewport?lK:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dK(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===tg(e)}function fK(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=sK(e),o=JU(1);t&&(r?ig(r)&&(o=cK(r)):o=cK(e));let s=dK(a,n,r)?uK(a):JU(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=tg(a),t=ig(r)?tg(r):r,n=e,i=Cg(n);for(;i&&t!==n;){let e=cK(i),t=i.getBoundingClientRect(),r=vg(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=tg(i),i=Cg(n)}}return gW({width:u,height:d,x:c,y:l})}function pK(e,t){let n=yg(e).scrollLeft;return t?t.left+n:fK(ng(e)).left+n}function mK(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-pK(e,n),y:n.top+t.scrollTop}}function hK(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=ng(r),s=t?lg(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=JU(1),u=JU(0),d=ag(r);if((d||!a)&&((eg(r)!==`body`||sg(o))&&(c=yg(r)),d)){let e=fK(r);l=cK(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?mK(o,c):JU(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function gK(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function _K(e){let t=yg(e),n=e.ownerDocument.body,r=GU(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=GU(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+pK(e),o=-t.scrollTop;return vg(n).direction===`rtl`&&(a+=GU(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var vK=25;function yK(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=tg(e),a=ng(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!gg()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(pK(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=vK&&(s-=o)}return{width:s,height:c,x:l,y:u}}function bK(e,t){let n=fK(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=cK(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function xK(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=yK(e,n,t);else if(t===`document`)r=_K(ng(e));else if(ig(t))r=bK(t,n);else{let n=uK(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return gW(r)}function SK(e,t){let n=t.get(e);if(n)return n;let r=Sg(e,[],!1).filter(e=>ig(e)&&eg(e)!==`body`),i=null,a=vg(e).position===`fixed`,o=a?bg(e):e;for(;ig(o)&&!_g(o);){let e=vg(o),t=mg(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=bg(o)}return t.set(e,r),r}function CK(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?lg(t)?[]:SK(t,this._c):[].concat(n),r],o=xK(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=xK(t,a[e],i);s=GU(n.top,s),c=WU(n.right,c),l=WU(n.bottom,l),u=GU(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function wK(e){let{width:t,height:n}=oK(e);return{width:t,height:n}}function TK(e,t,n){let r=ag(t),i=ng(t),a=n===`fixed`,o=fK(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=JU(0);if((r||!a)&&((eg(t)!==`body`||sg(i))&&(s=yg(t)),r)){let e=fK(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=pK(i));let l=i&&!r&&!a?mK(i,s):JU(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function EK(e){return vg(e).position===`static`}function DK(e,t){if(!ag(e)||vg(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return ng(e)===n&&(n=n.ownerDocument.body),n}function OK(e,t){let n=tg(e);if(lg(e))return n;if(!ag(e)){let t=bg(e);for(;t&&!_g(t);){if(ig(t)&&!EK(t))return t;t=bg(t)}return n}let r=DK(e,t);for(;r&&cg(r)&&EK(r);)r=DK(r,t);return r&&_g(r)&&EK(r)&&!mg(r)?n:r||hg(e)||n}var kK=async function(e){let t=this.getOffsetParent||OK,n=this.getDimensions,r=await n(e.floating);return{reference:TK(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function AK(e){return vg(e).direction===`rtl`}var jK={convertOffsetParentRelativeRectToViewportRelativeRect:hK,getDocumentElement:ng,getClippingRect:CK,getOffsetParent:OK,getElementRects:kK,getClientRects:gK,getDimensions:wK,getScale:cK,isElement:ig,isRTL:AK};function MK(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function NK(e,t,n){let r=null,i,a=ng(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=qU(d),h=qU(a.clientWidth-(u+f)),g=qU(a.clientHeight-(d+p)),_=qU(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:GU(0,WU(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!MK(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=tg(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function PK(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=sK(e),u=i||a?[...l?Sg(l):[],...t?Sg(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?NK(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?fK(e):null;c&&g();function g(){let t=fK(e);h&&!MK(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var FK=nK,IK=rK,LK=$G,RK=aK,zK=iK,BK=(e,t,n)=>{let r=new Map,i=n??{},a={...jK,...i.platform,_c:r};return QG(e,t,{...i,platform:a})},VK=typeof document<`u`?Y.useLayoutEffect:function(){};function HK(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!HK(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!HK(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function UK(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function WK(e,t){let n=UK(e);return Math.round(t*n)/n}function GK(e){let t=Y.useRef(e);return VK(()=>{t.current=e}),t}function KK(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=Y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=Y.useState(r);HK(f,r)||p(r);let[m,h]=Y.useState(null),[g,_]=Y.useState(null),v=Y.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=Y.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=Y.useRef(null),C=Y.useRef(null),w=Y.useRef(u),T=c!=null,E=GK(c),D=GK(i),O=GK(l),k=Y.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),BK(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!HK(w.current,t)&&(w.current=t,Xi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);VK(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=Y.useRef(!1);VK(()=>(A.current=!0,()=>{A.current=!1}),[]),VK(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=Y.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=Y.useMemo(()=>({reference:b,floating:x}),[b,x]),N=Y.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=WK(M.floating,u.x),r=WK(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...UK(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return Y.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var qK=(e,t)=>{let n=FK(e);return{name:n.name,fn:n.fn,options:[e,t]}},JK=(e,t)=>{let n=IK(e);return{name:n.name,fn:n.fn,options:[e,t]}},YK=(e,t)=>({fn:zK(e).fn,options:[e,t]}),XK=(e,t)=>{let n=LK(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZK=(e,t)=>{let n=RK(e);return{name:n.name,fn:n.fn,options:[e,t]}},QK=[],$K=void 0;function eq(){return $K}function tq(e){QK.push(e)}function nq(e){let t=(t,n)=>{let r=Eg(iq).current,i;try{$K=r;for(let e of QK)e.before(r);i=e(t,n);for(let e of QK)e.after(r);r.didInitialize=!0}finally{$K=void 0}return i};return t.displayName=e.displayName||e.name,t}function rq(e){return Y.forwardRef(nq(e))}function iq(){return{didInitialize:!1}}var aq=Ni(),oq=t_(19)?cq:lq;function $(e,t,n,r,i){return oq(e,t,n,r,i)}function sq(e,t,n,r,i){let a=Y.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,aq.useSyncExternalStore)(e.subscribe,a,a)}tq({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);Object.is(r.value,i)||(t=!0,r.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,aq.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function cq(e,t,n,r,i){let a=eq();if(!a)return sq(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.value=t(e.getSnapshot(),n,r,i))):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i)},a.syncHooks.push(s)),s.value}function lq(e,t,n,r,i){return(0,Fi.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var uq=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return $(this,e,t,n,r)}},dq=class extends uq{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){Y.useDebugValue(e);let n=this;Mg(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Mg(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Mg(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){Y.useDebugValue(e);let n=this,r=t!==void 0;Mg(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return Y.useDebugValue(e),$(this,this.selectors[e],t,n,r)}useContextCallback(e,t){Y.useDebugValue(e);let n=kg(t??r_);this.context[e]=n}useStateSetter(e){let t=Y.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},fq={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId},pq=class extends dq{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:CG(),nested:n,triggerElements:i},fq),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&aU(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function mq(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,floatingRootContext:r,floatingId:i,nested:a,onOpenChange:o}=e,s=t.useState(`open`),c=t.useState(`activeTriggerElement`),l=t.useState(n?`popupElement`:`positionerElement`),u=t.context.triggerElements,d=o,f=Y.useRef(null);r===void 0&&f.current===null&&(f.current=new pq({open:s,transitionStatus:void 0,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:d,floatingId:i,syncOnly:!0,nested:a}));let p=r??f.current;return t.useSyncedValue(`floatingId`,i),Mg(()=>{let e={open:s,floatingId:i,referenceElement:c,floatingElement:l};ig(c)&&(e.domReferenceElement=c),p.state.positionReference===p.state.referenceElement&&(e.positionReference=c),p.update(e)},[s,i,c,l,p]),p.context.onOpenChange=d,p.context.nested=a,p}function hq(e,t=!1,n=!1){let[r,i]=Y.useState(e&&t?`idle`:void 0),[a,o]=Y.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Mg(()=>{if(!e&&a&&r!==`ending`&&n){let e=RU.request(()=>{i(`ending`)});return()=>{RU.cancel(e)}}},[e,a,r,n]),Mg(()=>{if(!e||t)return;let n=RU.request(()=>{i(void 0)});return()=>{RU.cancel(n)}},[t,e]),Mg(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=RU.request(()=>{i(`idle`)});return()=>{RU.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function gq(e,t=!1){let n=zU();return kg((r,i=null)=>{n.cancel();let a=MG(e);if(a==null)return;let o=a,s=()=>{Xi.flushSync(r)};if(typeof o.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){r();return}function c(){Promise.all(o.getAnimations().map(e=>e.finished)).then(()=>{i?.aborted||s()},()=>{if(!i?.aborted){if(o.getAnimations().some(e=>e.pending||e.playState!==`finished`)){c();return}s()}})}if(t){let e=`data-starting-style`;if(!o.hasAttribute(e)){n.request(c);return}let t=new MutationObserver(()=>{o.hasAttribute(e)||(t.disconnect(),c())});t.observe(o,{attributes:!0,attributeFilter:[e]}),i?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}n.request(c)})}function _q(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=kg(i),o=gq(r,n);Y.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var vq={tabIndex:-1,[oU]:``};function yq(e){return t=>t!==`touch`||e.current}function bq(e,t=!1){let n=MH(),r=DG()!=null,i=Eg(()=>e(n,r)).current;return mq({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:n,nested:r,onOpenChange:i.setOpen}),i}function xq({handle:e,store:t}){return Mg(()=>e.attachStore(t),[e,t]),null}function Sq(e,t){let n=Y.useRef(null),r=Y.useRef(null);return Y.useCallback(i=>{if(e===void 0)return;let a=!1;if(n.current!==null){let e=n.current,i=r.current,o=t.context.triggerElements.getById(e);i&&o===i&&(t.context.triggerElements.delete(e),a=!0),n.current=null,r.current=null}if(i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i),a=!0),a){let e=t.context.triggerElements.size;t.select(`open`)&&t.state.triggerCount!==e&&t.set(`triggerCount`,e)}},[t,e])}function Cq(e,t,n,r=!1){t?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);let i=n?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=n??null)}function wq(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function Tq(e,t,n,r={}){let i=n.reason,a=i===cH,o=t&&i===`trigger-focus`,s=!t&&(i===`trigger-press`||i===`escape-key`),c=wq(n);if(e.context.onOpenChange?.(t,n),n.isCanceled)return;r.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,n);let l=()=>{let i={...r.extraState,open:t};o?i.instantType=`focus`:s?i.instantType=`dismiss`:a&&(i.instantType=void 0),Cq(i,t,n.trigger,c()),e.update(i)};a?Xi.flushSync(l):l()}function Eq(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=Sq(e,n),o=kg(t=>{let i=n.select(`open`),a=n.select(`activeTriggerId`);if(a===e){n.update({activeTriggerElement:t,...i?r:null});return}a==null&&i&&n.update({activeTriggerId:e,activeTriggerElement:t,...r})}),s=Y.useCallback(e=>{a(e),e&&o(e)},[a,o]);return Mg(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function Dq(e,t={}){let{closeOnActiveTriggerUnmount:n=!1}=t,r=Y.useRef(null),i=e.useState(`open`);Mg(()=>{if(!i){r.current=null,e.state.triggerCount!==0&&e.set(`triggerCount`,0);return}let t=e.context.triggerElements.size,a={};e.state.triggerCount!==t&&(a.triggerCount=t);let o=e.select(`activeTriggerId`),s=null;if(o){let t=e.context.triggerElements.getById(o);if(t)r.current=o,t!==e.state.activeTriggerElement&&(a.activeTriggerElement=t);else{for(let[t,n]of e.context.triggerElements.entries())if(n===e.state.activeTriggerElement){a.activeTriggerId=t,a.activeTriggerElement=n,r.current=t;break}a.activeTriggerId===void 0&&(r.current===o?s=o:r.current=null)}}else r.current=null;if(!s&&!o&&t===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[e,n]=t.value;a.activeTriggerId=e,a.activeTriggerElement=n,r.current=e}}(a.triggerCount!==void 0||a.activeTriggerId!==void 0||a.activeTriggerElement!==void 0)&&e.update(a),s&&n&&queueMicrotask(()=>{if(e.select(`open`)&&e.select(`activeTriggerId`)===s&&!e.context.triggerElements.getById(s)){let t=EH(oH);e.setOpen(!1,t),t.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,e.useState(`triggerCount`),e.useState(`activeTriggerId`),e.useState(`activeTriggerElement`),n])}function Oq(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=hq(e),o=t.useState(`preventUnmountingOnClose`),s=!e&&o;t.useSyncedValues({mounted:r,transitionStatus:a,preventUnmountingOnClose:s});let c=kg(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return _q({enabled:r&&!e&&!s,open:e,ref:t.context.popupRef,onComplete(){e||c()}}),{forceUnmount:c,transitionStatus:a}}function kq(e,t){e.useSyncedValues(t),Mg(()=>()=>{e.update({activeTriggerProps:a_,inactiveTriggerProps:a_,popupProps:a_})},[e])}function Aq(e,t){Mg(()=>{!t&&e.state.openMethod!==null&&e.set(`openMethod`,null)},[t,e]),Mg(()=>()=>{e.state.openMethod!==null&&e.set(`openMethod`,null)},[e])}var jq=class{constructor(){this.idMap=new Map}add(e,t){this.idMap.set(e,t)}delete(e){this.idMap.delete(e)}hasElement(e){for(let t of this.idMap.values())if(t===e)return!0;return!1}hasMatchingElement(e){for(let t of this.idMap.values())if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}};function Mq(){return new pq({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new jq,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Nq(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Mq(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:a_,inactiveTriggerProps:a_,popupProps:a_}}function Pq(e,t,n=!1){return new pq({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:n,onOpenChange:void 0})}var Fq=e=>e.triggerIdProp??e.activeTriggerId,Iq=e=>e.openProp??e.open,Lq=e=>(e.popupElement?.id??e.floatingId)||void 0;function Rq(e,t){return t!==void 0&&Iq(e)&&Fq(e)===t}function zq(e,t){return Rq(e,t)?!0:t!==void 0&&Iq(e)&&Fq(e)==null&&e.triggerCount===1}var Bq={open:Iq,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Fq,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:Lq,isTriggerActive:(e,t)=>t!==void 0&&Fq(e)===t,isOpenedByTrigger:(e,t)=>Rq(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Fq(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>zq(e,t)?Lq(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function Vq(e){let t=Y.useCallback(t=>e===void 0?r_:e.subscribeStore(t),[e]),n=Y.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,aq.useSyncExternalStore)(t,n,()=>e?.serverStore)}function Hq(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=MH(),a=DG()!=null,o=Eg(()=>new pq({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new jq,floatingId:i,syncOnly:!1,nested:a})).current;return Mg(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=ig(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Uq(e){return Wq(e,e.rootContext)}function Wq(e,t){let{nodeId:n,externalTree:r}=e,i=t.useState(`referenceElement`),a=t.useState(`floatingElement`),o=t.useState(`domReferenceElement`),s=t.useState(`open`),c=t.useState(`floatingId`),[l,u]=Y.useState(null),[d,f]=Y.useState(void 0),[p,m]=Y.useState(void 0),h=Y.useRef(null),g=OG(r),_=Y.useMemo(()=>({reference:i,floating:a,domReference:o}),[i,a,o]),v=KK({...e,elements:{..._,...l&&{reference:l}}}),y=ig(d)?d:null,b=p===void 0?t.state.floatingElement:p;t.useSyncedValue(`referenceElement`,d??null),t.useSyncedValue(`domReferenceElement`,d===void 0?o:y),t.useSyncedValue(`floatingElement`,b);let x=Y.useCallback(e=>{let t=ig(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;u(t),v.refs.setReference(t)},[v.refs]),S=Y.useCallback(e=>{(ig(e)||e===null)&&(h.current=e,f(e)),(ig(v.refs.reference.current)||v.refs.reference.current===null||e!==null&&!ig(e))&&v.refs.setReference(e)},[v.refs,f]),C=Y.useCallback(e=>{m(e),v.refs.setFloating(e)},[v.refs]),w=Y.useMemo(()=>({...v.refs,setReference:S,setFloating:C,setPositionReference:x,domReference:h}),[v.refs,S,C,x]),T=Y.useMemo(()=>({...v.elements,domReference:o}),[v.elements,o]),E=Y.useMemo(()=>({...v,dataRef:t.context.dataRef,open:s,onOpenChange:t.setOpen,events:t.context.events,floatingId:c,refs:w,elements:T,nodeId:n,rootStore:t}),[v,w,T,n,t,s,c]);return Mg(()=>{o&&(h.current=o)},[o]),Mg(()=>{t.context.dataRef.current.floatingContext=E;let e=g?.nodesRef.current.find(e=>e.id===n);e&&(e.context=E)}),Y.useMemo(()=>({...v,context:E,refs:w,elements:T,rootStore:t}),[v,w,T,E,t])}var Gq=JH&&XH;function Kq(e,t={}){let{enabled:n=!0,delay:r}=t,i=`rootStore`in e?e.rootStore:e,{events:a,dataRef:o}=i.context,s=Y.useRef(!1),c=Y.useRef(null),l=Y.useRef(!0),u=RH();Y.useEffect(()=>{let e=i.select(`domReferenceElement`);if(!n)return;let t=tg(e);function r(){let e=i.select(`domReferenceElement`);!i.select(`open`)&&ag(e)&&e===fU(Jg(e))&&(s.current=!0)}function a(){l.current=!0}function o(){l.current=!1}return NU(MU(t,`blur`,r),Gq&&MU(t,`keydown`,a,!0),Gq&&MU(t,`pointerdown`,o,!0))},[i,n]),Y.useEffect(()=>{if(!n)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=i.select(`domReferenceElement`);ig(e)&&(c.current=e,s.current=!0)}}return a.on(`openchange`,e),()=>{a.off(`openchange`,e)}},[a,n,i]);let d=Y.useMemo(()=>{function e(){s.current=!1,c.current=null}return{onMouseLeave(){e()},onFocus(t){let n=t.currentTarget;if(s.current){if(c.current===n)return;e()}let a=mU(t.nativeEvent);if(ig(a)){if(Gq&&!t.relatedTarget){if(!l.current&&!vU(a))return}else if(!xU(a))return}let o=hU(t.relatedTarget,i.context.triggerElements),{nativeEvent:d,currentTarget:f}=t,p=typeof r==`function`?r():r;if(i.select(`open`)&&o||p===0||p===void 0){i.setOpen(!0,EH(lH,d,f));return}u.start(p,()=>{s.current||i.setOpen(!0,EH(lH,d,f))})},onBlur(t){e();let n=t.relatedTarget,r=t.nativeEvent,a=ig(n)&&n.hasAttribute($W(`focus-guard`))&&n.getAttribute(`data-type`)===`outside`;u.start(0,()=>{let e=i.select(`domReferenceElement`),t=fU(Jg(e));!n&&t===e||pU(o.current.floatingContext?.refs.floating.current,t)||pU(e,t)||a||hU(n??t,i.context.triggerElements)||i.setOpen(!1,EH(lH,r))})}}},[o,r,i,u]);return Y.useMemo(()=>n?{reference:d,trigger:d}:{},[n,d])}var qq=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new LH,this.restTimeout=new LH,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},Jq=new WeakMap;function Yq(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&Jq.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),Jq.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Xq(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=Jq.get(n);a&&a!==e&&Yq(a),Yq(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Jq.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function Zq(e){let t=e.context.dataRef.current,n=Eg(()=>t.hoverInteractionState??qq.create()).current;return t.hoverInteractionState||=n,FH(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function Qq(e,t={}){let{enabled:n=!0,closeDelay:r=0,nodeId:i}=t,a=`rootStore`in e?e.rootStore:e,o=a.useState(`open`),s=a.useState(`floatingElement`),c=a.useState(`domReferenceElement`),{dataRef:l}=a.context,u=OG(),d=DG(),f=Zq(a),p=RH(),m=kg(()=>EU(l.current.openEvent?.type,f.interactedInside)),h=kg(()=>DU(l.current.openEvent?.type)),g=kg(()=>{Yq(f)});Mg(()=>{o||(f.pointerType=void 0,f.restTimeoutPending=!1,f.interactedInside=!1,g())},[o,f,g]),Y.useEffect(()=>g,[g]),Mg(()=>{if(n&&o&&f.handleCloseOptions?.blockPointerEvents&&h()&&ig(c)&&s){let e=c,t=s,n=Jg(s),r=u?.nodesRef.current.find(e=>e.id===d)?.context?.elements.floating;r&&(r.style.pointerEvents=``);let i=f.pointerEventsScopeElement===t?null:f.pointerEventsScopeElement,a=r===t?null:r,o=f.handleCloseOptions?.getScope?.()??i??a??e.closest(`[data-rootownerid]`)??n.body;return Xq(f,{scopeElement:o,referenceElement:e,floatingElement:t}),()=>{g()}}},[n,o,c,s,f,h,u,d,g]),Y.useEffect(()=>{if(!n)return;function e(){return!!(u&&d&&ZW(u.nodesRef.current,d).length>0)}function t(e){let t=wU(r,`close`,f.pointerType),n=()=>{a.setOpen(!1,EH(cH,e)),u?.events.emit(`floating.closed`,e)};t?f.openChangeTimeout.start(t,n):(f.openChangeTimeout.clear(),n())}function o(e){let t=mU(e);if(!yU(t)){f.interactedInside=!1;return}f.interactedInside=t?.closest(`[aria-haspopup]`)!=null}function c(){f.openChangeTimeout.clear(),p.clear(),u?.events.off(`floating.closed`,v),g()}function _(n){if(e()&&u){u.events.on(`floating.closed`,v);return}if(hU(n.relatedTarget,a.context.triggerElements))return;let r=l.current.floatingContext?.nodeId??i,o=n.relatedTarget;if(!(u&&r&&ig(o)&&ZW(u.nodesRef.current,r,!1).some(e=>pU(e.context?.elements.floating,o)))){if(f.handler){f.handler(n);return}g(),h()&&!m()&&t(n)}}function v(t){!u||!d||e()||p.start(0,()=>{u.events.off(`floating.closed`,v),a.setOpen(!1,EH(cH,t)),u.events.emit(`floating.closed`,t)})}let y=s;return NU(y&&MU(y,`mouseenter`,c),y&&MU(y,`mouseleave`,_),y&&MU(y,`pointerdown`,o,!0),()=>{u?.events.off(`floating.closed`,v)})},[n,s,a,l,r,i,h,m,g,f,u,d,p])}var $q={current:null};function eJ(e,t={}){let{enabled:n=!0,delay:r=0,handleClose:i=null,mouseOnly:a=!1,restMs:o=0,move:s=!0,triggerElementRef:c=$q,externalTree:l,isActiveTrigger:u=!0,getHandleCloseContext:d,isClosing:f,shouldOpen:p,guardStaleOpen:m=!1}=t,h=`rootStore`in e?e.rootStore:e,{dataRef:g,events:_}=h.context,v=OG(l),y=Zq(h),b=Y.useRef(!1),x=PU(i),S=PU(r),C=PU(o),w=PU(n),T=PU(p),E=PU(f),D=kg(()=>EU(g.current.openEvent?.type,y.interactedInside)),O=kg(()=>T.current?.()!==!1),k=kg((e,t,n)=>{let r=h.context.triggerElements;if(r.hasElement(t))return!e||!pU(e,t);if(!ig(n))return!1;let i=n;return r.hasMatchingElement(e=>pU(e,i))&&(!e||!pU(e,i))}),A=kg(()=>{y.handler&&=(Jg(h.select(`domReferenceElement`)).removeEventListener(`mousemove`,y.handler),void 0)}),j=kg(()=>{Yq(y)});return u&&(y.handleCloseOptions=x.current?.__options),Y.useEffect(()=>A,[A]),Y.useEffect(()=>{if(!n)return;function e(e){e.open?b.current=!1:(b.current=e.reason===cH,A(),y.openChangeTimeout.clear(),y.restTimeout.clear(),y.blockMouseMove=!0,y.restTimeoutPending=!1)}return _.on(`openchange`,e),()=>{_.off(`openchange`,e)}},[n,_,y,A]),Y.useEffect(()=>{if(!n)return;function e(e,t=!0){let n=wU(S.current,`close`,y.pointerType);n?y.openChangeTimeout.start(n,()=>{h.setOpen(!1,EH(cH,e)),v?.events.emit(`floating.closed`,e)}):t&&(y.openChangeTimeout.clear(),h.setOpen(!1,EH(cH,e)),v?.events.emit(`floating.closed`,e))}let t=c.current??(u?h.select(`domReferenceElement`):null);if(!ig(t))return;function r(e){if(y.openChangeTimeout.clear(),y.blockMouseMove=!1,a&&!iU(y.pointerType))return;let t=TU(C.current),n=wU(S.current,`open`,y.pointerType),r=mU(e),i=e.currentTarget??null,o=h.select(`domReferenceElement`),s=i;if(ig(r)&&!h.context.triggerElements.hasElement(r)){for(let e of h.context.triggerElements.elements())if(pU(e,r)){s=e;break}}ig(i)&&ig(o)&&!h.context.triggerElements.hasElement(i)&&pU(i,o)&&(s=o);let c=s!=null&&k(o,s,r),l=h.select(`open`),u=E.current?.()??h.select(`transitionStatus`)===`ending`,d=!l&&u&&b.current,f=!c&&ig(s)&&ig(o)&&pU(o,s)&&d,p=t>0&&!n,m=c&&(l||d)||f,g=!l||c;if(m){O()&&h.setOpen(!0,EH(cH,e,s));return}p||(n?y.openChangeTimeout.start(n,()=>{g&&O()&&h.setOpen(!0,EH(cH,e,s))}):g&&O()&&h.setOpen(!0,EH(cH,e,s)))}function i(t){if(D()){j();return}A();let n=Jg(h.select(`domReferenceElement`));y.restTimeout.clear(),y.restTimeoutPending=!1;let r=g.current.floatingContext??d?.();if(!hU(t.relatedTarget,h.context.triggerElements)){if(x.current&&r){h.select(`open`)||y.openChangeTimeout.clear();let i=c.current;y.handler=x.current({...r,tree:v,x:t.clientX,y:t.clientY,onClose(){j(),A(),w.current&&!D()&&i===h.select(`domReferenceElement`)&&e(t,!0)}}),n.addEventListener(`mousemove`,y.handler),y.handler(t);return}(y.pointerType!==`touch`||!pU(h.select(`floatingElement`),t.relatedTarget))&&e(t)}}function o(e){pU(t,e.relatedTarget)||(y.openChangeTimeout.clear(),y.restTimeout.clear(),y.restTimeoutPending=!1)}let l=m?MU(t,`mouseout`,o):void 0;return s?NU(MU(t,`mousemove`,r,{once:!0}),MU(t,`mouseenter`,r),MU(t,`mouseleave`,i),l):NU(MU(t,`mouseenter`,r),MU(t,`mouseleave`,i),l)},[A,j,g,S,h,n,x,y,u,k,D,a,s,C,c,v,w,d,E,O,m]),Y.useMemo(()=>{if(!n)return;function e(e){y.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,n=e.currentTarget,r=h.select(`domReferenceElement`),i=h.select(`open`),o=k(r,n,e.target);if(a&&!iU(y.pointerType))return;if(i&&o&&y.handleCloseOptions?.blockPointerEvents){let e=h.select(`floatingElement`);if(e){let t=y.handleCloseOptions?.getScope?.()??n.ownerDocument.body;Xq(y,{scopeElement:t,referenceElement:n,floatingElement:e})}}let s=TU(C.current);if(i&&!o||s===0||!o&&y.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;y.restTimeout.clear();function c(){if(y.restTimeoutPending=!1,D())return;let e=h.select(`open`);!y.blockMouseMove&&(!e||o)&&O()&&h.setOpen(!0,EH(cH,t,n))}y.pointerType===`touch`?Xi.flushSync(()=>{c()}):o&&i?c():(y.restTimeoutPending=!0,y.restTimeout.start(s,c))}}},[n,y,D,k,a,h,C,O])}var tJ=`Escape`;function nJ(e){return XH&&e.movementX===0&&e.movementY===0}function rJ(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function iJ(e,t){return rJ(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function aJ(e,t,n){return rJ(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function oJ(e,t,n){return rJ(t,n?e===cU:e===lU,e===dU)}function sJ(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===tJ:rJ(t,n?e===lU:e===cU,e===uU)}function cJ(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,id:v,resetOnPointerLeave:y=!0,externalTree:b,grid:x}=t,S=x!=null,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=SU(T),k=bU(E),A=PU(O),j=DG(),M=OG(b),N=Y.useRef(f),P=Y.useRef(o??-1),F=Y.useRef(null),I=Y.useRef(!0),L=kg(e=>{i(P.current===-1?null:P.current,e)}),R=Y.useRef(!!T),z=Y.useRef(w),B=Y.useRef(!1),V=Y.useRef(!1),H=Y.useRef(null),U=PU(h),W=PU(w),G=PU(o),K=PU(y),q=zU(),J=zU(),ee=kg(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):H.current=tG(e,{sync:B.current,preventScroll:!0})}let t=n.current[P.current],r=V.current;t&&e(t),(B.current?e=>e():e=>q.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),oe&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Mg(()=>{D.current.orientation=g},[D,g]),Mg(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(V.current=!0,L())):R.current&&(P.current=-1,L()))},[a,w,T,o,L]),Mg(()=>{if(a){if(!w){B.current=!1;return}if(T){if(r==null){if(B.current=!1,G.current!=null)return;if(R.current&&(P.current=-1,ee()),(!z.current||!R.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>J.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||aJ(F.current,g,u)||l?yW(n):bW(n),F.current=null,L())};t()}}else vW(n.current,r)||(P.current=r,ee(),V.current=!1)}}},[a,w,T,r,G,l,n,g,u,L,ee,J]),Mg(()=>{if(!a||T||!M||d||!R.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=fU(Jg(E??t??null)),r=e.some(e=>e.context&&pU(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,E,M,j,d]),Mg(()=>{z.current=w,R.current=!!T}),Mg(()=>{w||(F.current=null,N.current=f)},[w,f]);let te=r!=null,ne=kg(e=>{if(!W.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),re=kg(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ie=kg(()=>yW(n,U.current)),ae=kg(e=>{if(I.current=!1,B.current=!0,e.which===229||!W.current&&e.currentTarget===A.current)return;if(l&&sJ(e.key,g,u,S)){iJ(e.key,re())||eU(e),C.setOpen(!1,EH(vH,e.nativeEvent)),ag(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=yW(n,h),i=bW(n,h);if(k||(e.key===`Home`&&(eU(e),P.current=r,L(e)),e.key===`End`&&(eU(e),P.current=i,L(e))),x!=null){let t=x(e,P.current,n,g,c,u,h,r,i);if(t!=null&&(P.current=t,L(e)),g===`both`)return}if(iJ(e.key,g)){if(eU(e),w&&!d&&fU(e.currentTarget.ownerDocument)===e.currentTarget){P.current=aJ(e.key,g,u)?r:i,L(e);return}aJ(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(B.current=!1,P.current=r):P.current=xW(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,xW(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(B.current=!1,P.current=i):P.current=xW(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,xW(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),vW(n.current,P.current)&&(P.current=-1),L(e)}}),oe=Y.useMemo(()=>({onFocus(e){B.current=!0,ne(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){nJ(e)||(B.current=!0,V.current=!1,p&&ne(e))},onPointerLeave(e){if(!W.current||!I.current||e.pointerType===`touch`)return;B.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&K.current&&(H.current?.(),H.current=null,P.current=-1,L(e),!d)){let e=A.current,t=fU(Jg(e));e&&pU(e,t)&&e.focus({preventScroll:!0})}}}),[ne,W,A,p,n,L,K,d]),se=Y.useMemo(()=>d&&w&&te&&{"aria-activedescendant":`${v}-${r}`},[d,w,te,v,r]),ce=Y.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...k?{}:se,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=mU(e.nativeEvent);if(t&&!pU(A.current,t))return;eU(e),C.setOpen(!1,EH(gH,e.nativeEvent)),ag(E)&&E.focus();return}ae(e)},onPointerMove(e){nJ(e)||(I.current=!0)}}),[se,ae,A,g,k,C,w,d,E]),le=Y.useMemo(()=>{function e(e){C.setOpen(!0,EH(vH,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&nU(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&rU(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=oJ(t.key,re(),u),a=iJ(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return ae(t);if(!(!n&&!m&&r)){if(o){let e=iJ(t.key,re());F.current=l&&e?null:t.key}if(l){i&&(eU(t),n?(P.current=ie(),L(t)):e(t));return}a&&(G.current!=null&&(P.current=G.current),eU(t),!n&&m?e(t):ae(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[ae,f,ie,l,L,C,m,g,re,u,G,d]),ue=Y.useMemo(()=>({...se,...le}),[se,le]);return Y.useMemo(()=>a?{reference:ue,floating:ce,item:oe,trigger:le}:{},[a,ue,ce,le,oe])}function lJ(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=RH(),m=Y.useRef(``),h=Y.useRef(u??i??-1),g=Y.useRef(null),_=kg(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!TW(n)||n?.matches(`:disabled`)?!1:o==null||!CW(i_,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(!(!e[n]?.toLowerCase().startsWith(i)||!c(n)))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(eU(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(eU(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=kg(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);pU(n,t)||pU(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});Mg(()=>{!f&&u!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Y.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Y.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var uJ=.1,dJ=uJ*uJ,fJ=.5;function pJ(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function mJ(e,t,n,r,i,a,o,s,c,l){let u=!1;return pJ(e,t,n,r,i,a)&&(u=!u),pJ(e,t,i,a,o,s)&&(u=!u),pJ(e,t,o,s,c,l)&&(u=!u),pJ(e,t,c,l,n,r)&&(u=!u),u}function hJ(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function gJ(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function _J(e={}){let{blockPointerEvents:t=!1}=e,n=new LH,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*dJ;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=mU(r),g=r.type===`mouseleave`,_=pU(u,h),v=pU(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&ig(r.relatedTarget)&&pU(u,r.relatedTarget))return;function y(){return!!(s&&ZW(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=gJ(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=gJ(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=gJ(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=gJ(d,f,x.right-1,A,S.left+1,k)}if(j)return;if(l&&!hJ(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?fJ/2:fJ*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+fJ+1,o=C||T?S.bottom-fJ:S.top,s=C?T?S.bottom-fJ:S.top:S.bottom-fJ;M=mJ(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?fJ/2:fJ*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-fJ,o=C||T?S.top+fJ:S.bottom,s=C?T?S.top+fJ:S.bottom:S.top+fJ;M=mJ(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?fJ/2:fJ*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+fJ+1,o=w||E?S.right-fJ:S.left,s=w?E?S.right-fJ:S.left:S.right-fJ;M=mJ(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?fJ/2:fJ*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-fJ,o=w||E?S.left+fJ:S.right,s=w?E?S.left+fJ:S.right:S.left+fJ;M=mJ(d,f,a,r,a,i,o,S.top,s,S.bottom);break}}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}var vJ=Y.createContext(void 0);function yJ(){let e=Y.useContext(vJ);if(e===void 0)throw Error(Gg(26));return e}var bJ=`ArrowUp`,xJ=`ArrowDown`,SJ=`ArrowLeft`,CJ=`ArrowRight`,wJ=new Set([bJ,xJ,SJ,CJ,`Home`,`End`]),TJ=`Shift`,EJ=[TJ,`Control`,`Alt`,`Meta`];function DJ(e){return ag(e)&&e.tagName===`INPUT`}function OJ(e){return!!(DJ(e)&&e.selectionStart!=null||ag(e)&&e.tagName===`TEXTAREA`)}function kJ(e,t,n,r){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,a=e.scrollTop,o=e.clientWidth<e.scrollWidth,s=e.clientHeight<e.scrollHeight;if(o&&r!==`vertical`){let r=AJ(e,t,`left`),a=jJ(e),o=jJ(t);n===`ltr`&&(r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(i=r-o.scrollMarginLeft-a.scrollPaddingLeft)),n===`rtl`&&(r-o.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft?i=r-o.scrollMarginLeft-a.scrollPaddingLeft:r+t.offsetWidth+o.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(i=r+t.offsetWidth+o.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(s&&r!==`horizontal`){let n=AJ(e,t,`top`),r=jJ(e),i=jJ(t);n-i.scrollMarginTop<e.scrollTop+r.scrollPaddingTop?a=n-i.scrollMarginTop-r.scrollPaddingTop:n+t.offsetHeight+i.scrollMarginBottom>e.scrollTop+e.clientHeight-r.scrollPaddingBottom&&(a=n+t.offsetHeight+i.scrollMarginBottom-e.clientHeight+r.scrollPaddingBottom)}e.scrollTo({left:i,top:a,behavior:`auto`})}function AJ(e,t,n){let r=n===`left`?`offsetLeft`:`offsetTop`,i=0;for(;t.offsetParent&&(i+=t[r],t.offsetParent!==e);)t=t.offsetParent;return i}function jJ(e){let t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}var MJ={...rH,...YV,nestedDialogOpen(e){return e?{"data-nested-dialog-open":``}:null}},NJ=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=GV(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),y=c.useState(`titleElementId`),b=c.useState(`transitionStatus`),x=c.useState(`role`),S=d.useState(`floatingId`);yJ(),_q({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});let C=o===void 0?yq(c.context.popupRef):o,w=g>0,T=c.useStateSetter(`popupElement`),E=o_(`div`,e,{state:{open:_,nested:h,transitionStatus:b,nestedDialogOpen:w},props:[f,{id:S,"aria-labelledby":y,"aria-describedby":l,role:x,...vq,hidden:!m,onKeyDown(e){wJ.has(e.key)&&e.stopPropagation()},style:{"--nested-dialogs":g}},s],ref:[t,c.context.popupRef,T],stateAttributesMapping:MJ});return(0,X.jsx)(VG,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:C,returnFocus:a,modal:p!==!1,restoreFocus:`popup`,children:E})});function PJ(e){return t_(19)?e:e?`true`:void 0}var FJ=Y.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,X.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),IJ=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=GV(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,X.jsx)(vJ.Provider,{value:n,children:(0,X.jsxs)(SG,{ref:t,...r,children:[a&&o===!0&&(0,X.jsx)(FJ,{ref:i.context.internalBackdropRef,inert:PJ(!s)}),e.children]})}):null}),LJ={},RJ={},zJ=``;function BJ(e,t){return sg(e)?e:t}function VJ(e,t,n){return/hidden|clip/.test(e.getComputedStyle(BJ(t,n)).overflowY)}function HJ(e){if(typeof document>`u`)return!1;let t=Jg(e);return tg(t).innerWidth-t.documentElement.clientWidth>0}function UJ(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Jg(e),n=t.documentElement,r=t.body,i=BJ(n,r),a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function WJ(e){let t=Jg(e),n=t.documentElement,r=t.body,i=BJ(n,r),a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function GJ(e){let t=Jg(e),n=t.documentElement,r=t.body,i=tg(n),a=0,o=0,s=!1,c=RU.create();if(XH&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,LJ={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},zJ=n.style.scrollBehavior,RJ={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=BJ(n,r);if(s=UJ(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflowY:`hidden`,overflowX:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,LJ),Object.assign(r.style,RJ),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=zJ)}function d(){u(),c.request(l)}l();let f=MU(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var KJ=new class{lockCount=0;restore=null;timeoutLock=LH.create();timeoutUnlock=LH.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Jg(e),n=t.documentElement,r=t.body,i=tg(n);if(VJ(i,n,r)){let t=new i.MutationObserver(()=>{VJ(i,n,r)||(t.disconnect(),this.restore=null,this.lock(e))}),a={attributes:!0};t.observe(n,a),t.observe(r,a),this.restore=()=>t.disconnect();return}let a=GH||!HJ(e);this.restore=a?WJ(e):GJ(e)}};function qJ(e=!0,t=null){Mg(()=>{if(e)return KJ.acquire(t)},[e,t])}function JJ({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),o=e.useState(`popupElement`),s=e.useState(`floatingRootContext`),[c,l]=Y.useState(0),[u,d]=Y.useState(0),f=c===0,p=JG(s,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=mU(t);if(f&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||pU(n,o)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:f});return qJ(r&&a===!0,o),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{l(e),d(t)}),Mg(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(c+1,u+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,c,u,t]),kq(e,{activeTriggerProps:p.reference,inactiveTriggerProps:p.trigger,popupProps:p.floating,nestedOpenDialogCount:c,nestedOpenDrawerCount:u}),null}var YJ={...Bq,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},XJ=class extends dq{constructor(e,t,n){let r=new jq,i=ZJ(e,r,t,n);super(i,QJ(r),YJ)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e};Cq(n,e,t.trigger),this.update(n)}};function ZJ(e,t,n,r=!1){let i={...Nq(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e};return i.floatingRootContext=Pq(t,n,r),i}function QJ(e){return{popupRef:Y.createRef(),backdropRef:Y.createRef(),internalBackdropRef:Y.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function $J(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,m=e===`alert-dialog`,h=m?!0:c,g=m||s,_=m?`alertdialog`:`dialog`,v=GV(!0),y={modal:h,disablePointerDismissal:g,nested:v!=null,role:_},b=bq((e,t)=>new XJ({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...y},e,t),!0);b.useControlledProp(`openProp`,r),b.useControlledProp(`triggerIdProp`,d),b.useSyncedValues(y),b.useContextCallback(`onOpenChange`,a),b.useContextCallback(`onOpenChangeComplete`,o);let x=b.useState(`open`),S=b.useState(`mounted`),C=b.useState(`payload`);Aq(b,x),Dq(b);let{forceUnmount:w}=Oq(x,b);Y.useImperativeHandle(l,()=>({unmount:w,close:()=>b.setOpen(!1,EH(wH))}),[w,b]);let T=x||S;return(0,X.jsxs)(WV.Provider,{value:b,children:[u&&(0,X.jsx)(xq,{handle:u,store:b}),T&&(0,X.jsx)(JJ,{store:b,parentContext:v?.context,isDrawer:p}),typeof n==`function`?n({payload:C}):n]})}function eY(e){return $J(`dialog`,e)}var tY=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=yJ(),c=GV(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`transitionStatus`),f=c.useState(`nestedOpenDialogCount`),p=c.useState(`mounted`),m=c.useStateSetter(`viewportElement`);return o_(`div`,e,{enabled:s||p,state:{open:l,nested:u,transitionStatus:d,nestedDialogOpen:f>0},ref:[t,m],stateAttributesMapping:MJ,props:[{role:`presentation`,hidden:!p,style:{pointerEvents:l?void 0:`none`},children:a},o]})}),nY=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=GV(),c=NH(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),o_(`h2`,e,{ref:t,props:[{id:c},o]})});function rY(e){let t=Y.useRef(``),n=Y.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Y.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function iY(e,t){let n=Y.useRef(e),r=kg(t);Mg(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function aY(e,t){let{onClick:n,onPointerDown:r}=rY(kg((n,r)=>{(typeof e==`function`?e():e)||t(r||(GH?`touch`:``))}));return Y.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function oY(e){let[t,n]=Y.useState(null),r=aY(e,n);return iY(e,t=>{t&&!e&&n(null)}),Y.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function sY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(eY,{"data-slot":`dialog`,...n}),t[2]=n,t[3]=r),r}function cY(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(IJ,{"data-slot":`dialog-portal`,...n}),t[2]=n,t[3]=r),r}function lY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`data-[starting-style]:fade-in-0 data-[ending-style]:fade-out-0 fixed inset-0 z-50 bg-foreground/50 data-[closed]:animate-out data-[open]:animate-in`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(aH,{className:i,"data-slot":`dialog-overlay`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uY(e){let t=(0,Z.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,showCloseButton:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0||a,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(lY,{}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 grid w-full max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[closed]:animate-out data-[open]:animate-in`,r),t[6]=r,t[7]=c);let l;t[8]===o?l=t[9]:(l=o&&(0,X.jsxs)(OH,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,"data-slot":`dialog-close`,children:[(0,X.jsx)(hy,{}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[8]=o,t[9]=l);let u;return t[10]!==n||t[11]!==i||t[12]!==c||t[13]!==l?(u=(0,X.jsxs)(cY,{"data-slot":`dialog-portal`,children:[s,(0,X.jsx)(tY,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:(0,X.jsxs)(NJ,{className:c,"data-slot":`dialog-content`,...i,children:[n,l]})})]}),t[10]=n,t[11]=i,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function dY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`dialog-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function pY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold text-lg leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nY,{className:i,"data-slot":`dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mY(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(PH,{className:i,"data-slot":`dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function hY(e){let t=(0,Z.c)(3),n=(0,Y.useRef)(e),r;t[0]===e?r=t[1]:(r=()=>{n.current=e},t[0]=e,t[1]=r),(0,Y.useInsertionEffect)(r);let i;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(...e)=>{let t=e;return n.current(...t)},t[2]=i):i=t[2],i}function gY(e,t,n,r){let i=(0,Z.c)(10),a=r?.enabled??!0,o=r?.capture??!1,s=r?.deferAttach??!1,c;i[0]===n?c=i[1]:(c=e=>n(e),i[0]=n,i[1]=c);let l=hY(c),u,d;i[2]!==o||i[3]!==s||i[4]!==a||i[5]!==l||i[6]!==e||i[7]!==t?(u=()=>{if(!a)return;let n=e=>l(e);if(!s)return e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o);let r=setTimeout(()=>{e.addEventListener(t,n,o)},0);return()=>{clearTimeout(r),e.removeEventListener(t,n,o)}},d=[e,t,a,o,s,l],i[2]=o,i[3]=s,i[4]=a,i[5]=l,i[6]=e,i[7]=t,i[8]=u,i[9]=d):(u=i[8],d=i[9]),(0,Y.useEffect)(u,d)}function _Y(e,t){let n=(0,Z.c)(7),r;n[0]===t?r=n[1]:(r=()=>t(),n[0]=t,n[1]=r);let i=hY(r),a;n[2]===i?a=n[3]:(a=()=>{i()},n[2]=i,n[3]=a);let o;n[4]!==e||n[5]!==i?(o=[e,i],n[4]=e,n[5]=i,n[6]=o):o=n[6],(0,Y.useEffect)(a,o)}function vY(e,t){let n=(0,Z.c)(7),r;n[0]===t?r=n[1]:(r=()=>t(),n[0]=t,n[1]=r);let i=hY(r),a;n[2]===i?a=n[3]:(a=()=>{let e=setTimeout(()=>i(),0);return()=>clearTimeout(e)},n[2]=i,n[3]=a);let o;n[4]!==e||n[5]!==i?(o=[e,i],n[4]=e,n[5]=i,n[6]=o):o=n[6],(0,Y.useEffect)(a,o)}function yY(e,t){let n=(0,Z.c)(4),[r,i]=(0,Y.useState)(e),a,o;return n[0]!==t||n[1]!==e?(a=()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Y.useEffect)(a,o),r}function bY(e,t){let n=(0,Z.c)(6),r;n[0]===e?r=n[1]:(r=()=>e(),n[0]=e,n[1]=r);let i=hY(r),a,o;n[2]!==t||n[3]!==i?(a=()=>{if(t===null)return;let e=setInterval(()=>i(),t);return()=>clearInterval(e)},o=[t,i],n[2]=t,n[3]=i,n[4]=a,n[5]=o):(a=n[4],o=n[5]),(0,Y.useEffect)(a,o)}function xY(e){let t=(0,Z.c)(1),{intervalMs:n,enabled:r}=e,[i,a]=(0,Y.useState)(SY),o;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>a(Date.now()),t[0]=o):o=t[0],bY(o,r?n:null),i}function SY(){return Date.now()}function CY(e,t){let n=(0,Z.c)(4),[r,i]=(0,Y.useState)(0),a,o;return n[0]!==t||n[1]!==e?(a=()=>{if(!t){i(0);return}let n=e.current?.offsetHeight??0;n>0&&i(n)},o=[e,t],n[0]=t,n[1]=e,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,Y.useLayoutEffect)(a,o),r}var wY=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"]),[contenteditable="true"]`;function TY(e){return Array.from(e.querySelectorAll(wY)).filter(e=>e.offsetWidth>0||e.offsetHeight>0||e===document.activeElement)}function EY(e,t){let n=(0,Z.c)(8),r=(0,Y.useRef)(null),i,a;n[0]!==t||n[1]!==e?(i=()=>{let n=t?e.current:null;return n&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null,n.contains(document.activeElement)||(TY(n)[0]??n).focus()),()=>{r.current?.focus(),r.current=null}},a=[e,t],n[0]=t,n[1]=e,n[2]=i,n[3]=a):(i=n[2],a=n[3]),(0,Y.useEffect)(i,a);let o;n[4]===e?o=n[5]:(o=t=>{let n=e.current;if(t.key!==`Tab`||!n)return;let r=TY(n);if(r.length===0){t.preventDefault();return}let i=r[0],a=r.at(-1),o=document.activeElement;n.contains(o)?t.shiftKey&&o===i?(t.preventDefault(),a?.focus()):!t.shiftKey&&o===a&&(t.preventDefault(),i.focus()):(t.preventDefault(),(t.shiftKey?a:i)?.focus())},n[4]=e,n[5]=o);let s=hY(o),c;n[6]===t?c=n[7]:(c={enabled:t},n[6]=t,n[7]=c),gY(document,`keydown`,s,c)}var DY=768;function OY(e){let t=window.matchMedia(`(max-width: 767px)`);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function kY(){return window.innerWidth<DY}function AY(){return(0,Y.useSyncExternalStore)(OY,kY)}var jY=(0,Y.createContext)(null);function MY(){return`overlay-${Date.now()}-${Math.random().toString(36).slice(2,9)}`}function NY(e,t,n){return{id:MY(),component:e,props:t??{},options:n??{}}}function PY(e){let t=(0,Z.c)(13),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let[i,a]=(0,Y.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(e,t,n)=>{let r=NY(e,t,n);return a(e=>{for(let t of e)t.options.onClose?.();return[r]}),r.id},t[1]=o):o=t[1];let s=o,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(e,t,n)=>{let r=NY(e,t,n);return a(e=>[...e,r]),r.id},t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>{a(IY)},t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(e,t,n)=>{let r=NY(e,t,n);return a(e=>e.length===0?[r]:(e.at(-1)?.options.onClose?.(),[...e.slice(0,-1),r])),r.id},t[4]=f):f=t[4];let p=f,m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{a(FY)},t[5]=m):m=t[5];let h=m,g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{a(t=>{let n=t.findIndex(t=>t.id===e);if(n===-1)return t;for(let e=n;e<t.length;e++)t[e].options.onClose?.();return t.slice(0,n)})},t[6]=g):g=t[6];let _=g,v=i.length>0,y;t[7]!==i||t[8]!==v?(y={stack:i,open:s,push:l,pop:d,replace:p,closeAll:h,close:_,hasOverlays:v,depth:i.length},t[7]=i,t[8]=v,t[9]=y):y=t[9];let b=y,x;return t[10]!==n||t[11]!==b?(x=(0,X.jsx)(jY.Provider,{value:b,children:n}),t[10]=n,t[11]=b,t[12]=x):x=t[12],x}function FY(e){for(let t of e)t.options.onClose?.();return[]}function IY(e){return e.length<=1?(e[0]?.options.onClose?.(),[]):(e.at(-1)?.options.onClose?.(),e.slice(0,-1))}function LY(){let e=(0,Y.useContext)(jY);if(!e)throw Error(`useOverlay must be used within an OverlayProvider`);return e}function RY(e){let t=(0,Z.c)(8),{stack:n}=LY(),r;t[0]===e?r=t[1]:(r=t=>t.id===e,t[0]=e,t[1]=r);let i=n.findIndex(r),a=i===0,o=i===n.length-1,s=i>0,c;return t[2]!==i||t[3]!==n.length||t[4]!==a||t[5]!==o||t[6]!==s?(c={index:i,isFirst:a,isLast:o,depth:n.length,showBackButton:s},t[2]=i,t[3]=n.length,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}var zY={type:`spring`,stiffness:400,damping:35,mass:.8},BY={type:`spring`,stiffness:350,damping:30,mass:.8},VY={hidden:{opacity:0,scale:.95},visible:{opacity:1,scale:1,transition:{type:`spring`,stiffness:400,damping:30}},exit:{opacity:0,scale:.95,transition:{duration:.15,ease:[.4,0,1,1]}}};function HY(e,t){return e?`0%`:t?`-35%`:`100%`}function UY(){let e=(0,Z.c)(22),{stack:t,closeAll:n,pop:r}=LY(),i=XL(),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null),s=t.length>0,c=t,l=c.length-1,u=CY(a,s),d;e[0]===t?d=e[1]:(d=t.at(-1),e[0]=t,e[1]=d);let f=d,p;e[2]===i?p=e[3]:(p=i?{duration:.01}:zY,e[2]=i,e[3]=p);let m=p,h;e[4]!==n||e[5]!==f?.options.closeOnBackdropClick?(h=()=>{f?.options.closeOnBackdropClick!==!1&&n()},e[4]=n,e[5]=f?.options.closeOnBackdropClick,e[6]=h):h=e[6],f?.options.closeOnBackdropClick;let g=h,_;e[7]!==f?.options.closeOnEscape||e[8]!==r?(_=e=>{e.key===`Escape`&&f?.options.closeOnEscape!==!1&&r()},e[7]=f?.options.closeOnEscape,e[8]=r,e[9]=_):_=e[9],f?.options.closeOnEscape;let v=_,y;if(e[10]===s?y=e[11]:(y={enabled:s},e[10]=s,e[11]=y),gY(document,`keydown`,v,y),EY(o,s),!s)return null;let b;e[12]!==l||e[13]!==f||e[14]!==g||e[15]!==s||e[16]!==u||e[17]!==c||e[18]!==m?(b=s&&(0,X.jsx)(sY,{modal:!1,open:!0,children:(0,X.jsxs)(cY,{keepMounted:!0,children:[(0,X.jsx)(ZL.div,{animate:{opacity:1},className:`fixed inset-0 z-50 bg-foreground/60`,exit:{opacity:0},initial:{opacity:0},onClick:g,transition:{duration:.2}}),(0,X.jsx)(ZL.div,{animate:`visible`,"aria-labelledby":f?`overlay-title-${f.id}`:void 0,"aria-modal":`true`,className:`fixed top-1/2 left-1/2 z-50 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 px-4`,exit:`exit`,initial:`hidden`,ref:o,role:`dialog`,variants:VY,children:(0,X.jsx)(sL,{children:(0,X.jsx)(ZL.div,{className:`relative flex max-h-[calc(100dvh-2rem)] flex-col overflow-hidden rounded-xl border bg-card shadow-lg ring-1 ring-border`,layout:`position`,style:{minHeight:u>0?u:`auto`},transition:zY,children:(0,X.jsx)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,ref:a,children:c.map((e,t)=>{let n=t===l,r=t<l,i=n&&c.length>1?{x:`100%`,scale:1,opacity:1}:!1;return(0,X.jsx)(ZL.div,{animate:{x:HY(n,r),scale:n?1:.94,opacity:+!!n},"aria-hidden":!n,className:Q(`w-full`,n?`relative flex min-h-0 flex-col`:`pointer-events-none absolute inset-0`),initial:i,transition:m,children:(0,X.jsx)(e.component,{overlayId:e.id,...e.props})},e.id)})})})})})]})}),e[12]=l,e[13]=f,e[14]=g,e[15]=s,e[16]=u,e[17]=c,e[18]=m,e[19]=b):b=e[19];let x;return e[20]===b?x=e[21]:(x=(0,X.jsx)(Ose,{children:b}),e[20]=b,e[21]=x),x}function WY(){let e=(0,Z.c)(40),{stack:t,closeAll:n,pop:r}=LY(),i=XL(),a=(0,Y.useRef)(null),o=t.length>0,s=t,c=s.length-1,l=CY(a,o),u;e[0]===t?u=e[1]:(u=t.at(-1),e[0]=t,e[1]=u);let d=u,f;e[2]===i?f=e[3]:(f=i?{duration:.01}:zY,e[2]=i,e[3]=f);let p=f,m;e[4]!==d?.options.closeOnEscape||e[5]!==r?(m=e=>{e.key===`Escape`&&d?.options.closeOnEscape!==!1&&r()},e[4]=d?.options.closeOnEscape,e[5]=r,e[6]=m):m=e[6],d?.options.closeOnEscape;let h=m,g;e[7]===o?g=e[8]:(g={enabled:o},e[7]=o,e[8]=g),gY(document,`keydown`,h,g);let _;e[9]===n?_=e[10]:(_=e=>{e||n()},e[9]=n,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(UV.Overlay,{className:`fixed inset-0 z-50 bg-black/60`}),e[11]=v):v=e[11];let y=d?`overlay-title-${d.id}`:void 0,b;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=Q(`fixed inset-x-0 bottom-0 z-50 flex max-h-[90vh] flex-col`,`rounded-t-xl border-t bg-card shadow-lg`),e[12]=b):b=e[12];let x=d?.options.title||`Overlay`,S;e[13]===x?S=e[14]:(S=(0,X.jsx)(UV.Title,{className:`sr-only`,children:x}),e[13]=x,e[14]=S);let C;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(`div`,{className:`mx-auto mt-3 h-1.5 w-12 shrink-0 rounded-full bg-muted-foreground/20`}),e[15]=C):C=e[15];let w=l>0?l:`auto`,T;e[16]===w?T=e[17]:(T={minHeight:w},e[16]=w,e[17]=T);let E;if(e[18]!==c||e[19]!==s||e[20]!==p){let t;e[22]!==c||e[23]!==s.length||e[24]!==p?(t=(e,t)=>{let n=t===c,r=t<c,i=n&&s.length>1?{x:`100%`,scale:1,opacity:1}:!1;return(0,X.jsx)(ZL.div,{animate:{x:HY(n,r),scale:n?1:.94,opacity:+!!n},"aria-hidden":!n,className:Q(`w-full`,n?`relative`:`pointer-events-none absolute inset-0`),initial:i,transition:p,children:(0,X.jsx)(e.component,{overlayId:e.id,...e.props})},e.id)},e[22]=c,e[23]=s.length,e[24]=p,e[25]=t):t=e[25],E=s.map(t),e[18]=c,e[19]=s,e[20]=p,e[21]=E}else E=e[21];let D;e[26]===E?D=e[27]:(D=(0,X.jsx)(`div`,{className:`relative`,ref:a,children:E}),e[26]=E,e[27]=D);let O;e[28]!==T||e[29]!==D?(O=(0,X.jsx)(sL,{children:(0,X.jsx)(ZL.div,{className:`relative flex-1 overflow-hidden`,layout:`position`,style:T,transition:BY,children:D})}),e[28]=T,e[29]=D,e[30]=O):O=e[30];let k;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(`div`,{className:`h-safe-area-inset-bottom`}),e[31]=k):k=e[31];let A;e[32]!==O||e[33]!==y||e[34]!==S?(A=(0,X.jsxs)(UV.Portal,{children:[v,(0,X.jsxs)(UV.Content,{"aria-labelledby":y,className:b,children:[S,C,O,k]})]}),e[32]=O,e[33]=y,e[34]=S,e[35]=A):A=e[35];let j;return e[36]!==o||e[37]!==A||e[38]!==_?(j=(0,X.jsx)(UV.Root,{onOpenChange:_,open:o,children:A}),e[36]=o,e[37]=A,e[38]=_,e[39]=j):j=e[39],j}function GY(){let e=(0,Z.c)(2);if(AY()){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(WY,{}),e[0]=t):t=e[0],t}let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(UY,{}),e[1]=t):t=e[1],t}function KY(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(GY,{}),e[0]=t):t=e[0],t}var qY=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},JY=[`light`,`dark`],YY=`(prefers-color-scheme: dark)`,XY=typeof window>`u`,ZY=Y.createContext(void 0),QY={setTheme:e=>{},themes:[]},$Y=()=>Y.useContext(ZY)??QY,eX=e=>Y.useContext(ZY)?Y.createElement(Y.Fragment,null,e.children):Y.createElement(nX,{...e}),tX=[`light`,`dark`],nX=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:i=`theme`,themes:a=tX,defaultTheme:o=n?`system`:`light`,attribute:s=`data-theme`,value:c,children:l,nonce:u,scriptProps:d})=>{let[f,p]=Y.useState(()=>iX(i,o)),[m,h]=Y.useState(()=>f===`system`?oX():f),g=c?Object.values(c):a,_=Y.useCallback(e=>{let i=e;if(!i)return;e===`system`&&n&&(i=oX());let a=c?c[i]:i,l=t?aX(u):null,d=document.documentElement,f=e=>{e===`class`?(d.classList.remove(...g),a&&d.classList.add(a)):e.startsWith(`data-`)&&(a?d.setAttribute(e,a):d.removeAttribute(e))};if(Array.isArray(s)?s.forEach(f):f(s),r){let e=JY.includes(o)?o:null,t=JY.includes(i)?i:e;d.style.colorScheme=t}l?.()},[u]),v=Y.useCallback(e=>{let t=typeof e==`function`?e(f):e;p(t);try{localStorage.setItem(i,t)}catch{}},[f]),y=Y.useCallback(t=>{let r=oX(t);h(r),f===`system`&&n&&!e&&_(`system`)},[f,e]);Y.useEffect(()=>{let e=window.matchMedia(YY);return e.addListener(y),y(e),()=>e.removeListener(y)},[y]),Y.useEffect(()=>{let e=e=>{e.key===i&&(e.newValue?p(e.newValue):v(o))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[v]),Y.useEffect(()=>{_(e??f)},[e,f]);let b=Y.useMemo(()=>({theme:f,setTheme:v,forcedTheme:e,resolvedTheme:f===`system`?m:f,themes:n?[...a,`system`]:a,systemTheme:n?m:void 0}),[f,v,e,m,n,a]);return Y.createElement(ZY.Provider,{value:b},Y.createElement(rX,{forcedTheme:e,storageKey:i,attribute:s,enableSystem:n,enableColorScheme:r,defaultTheme:o,value:c,themes:a,nonce:u,scriptProps:d}),l)},rX=Y.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,themes:s,nonce:c,scriptProps:l})=>{let u=JSON.stringify([n,t,a,e,s,o,r,i]).slice(1,-1);return Y.createElement(`script`,{...l,suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(${qY.toString()})(${u})`}})}),iX=(e,t)=>{if(XY)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},aX=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},oX=e=>(e||=window.matchMedia(YY),e.matches?`dark`:`light`);function sX(e){let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,X.jsx)(eX,{...r,children:n}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}var cX={"--normal-bg":`var(--popover)`,"--normal-text":`var(--popover-foreground)`,"--normal-border":`var(--border)`,"--border-radius":`var(--radius)`},lX=e=>e===`light`||e===`dark`||e===`system`?e:`system`,uX=e=>{let t=(0,Z.c)(8),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let{theme:r}=$Y(),i=r===void 0?`system`:r,a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={success:(0,X.jsx)(ste,{className:`size-4`}),info:(0,X.jsx)(gte,{className:`size-4`}),warning:(0,X.jsx)(py,{className:`size-4`}),error:(0,X.jsx)(Cte,{className:`size-4`}),loading:(0,X.jsx)(ay,{className:`size-4 animate-spin`})},t[2]=a):a=t[2];let o;t[3]===i?o=t[4]:(o=lX(i),t[3]=i,t[4]=o);let s;return t[5]!==n||t[6]!==o?(s=(0,X.jsx)(pne,{className:`toaster group`,icons:a,style:cX,theme:o,...n}),t[5]=n,t[6]=o,t[7]=s):s=t[7],s};function dX(e){let t=(0,Z.c)(8),{action:n}=e,r=n.disabled||n.loading,i=n.variant??`default`,a;t[0]===n.loading?a=t[1]:(a=n.loading&&(0,X.jsx)(ay,{className:`mr-2 size-4 animate-spin`}),t[0]=n.loading,t[1]=a);let o;return t[2]!==n.label||t[3]!==n.onClick||t[4]!==r||t[5]!==i||t[6]!==a?(o=(0,X.jsxs)(zv,{disabled:r,onClick:n.onClick,variant:i,children:[a,n.label]}),t[2]=n.label,t[3]=n.onClick,t[4]=r,t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function fX(e){let t=(0,Z.c)(17),{actions:n,className:r,children:i}=e;if(i){let e;t[0]===r?e=t[1]:(e=Q(`flex flex-col-reverse gap-2 p-6 pt-4 sm:flex-row sm:justify-end`,r),t[0]=r,t[1]=e);let n;return t[2]!==i||t[3]!==e?(n=(0,X.jsx)(`div`,{className:e,children:i}),t[2]=i,t[3]=e,t[4]=n):n=t[4],n}if(!n||n.length===0)return null;let a,o,s;if(t[5]!==n||t[6]!==r){let e=n.filter(vX),i=n.filter(_X),c=n.filter(gX),l=e.length>0,u=i.length>0||c.length>0,d=l&&u?`sm:justify-between`:`sm:justify-end`;t[10]!==r||t[11]!==d?(a=Q(`flex flex-col-reverse gap-2 p-6 pt-4 sm:flex-row`,d,r),t[10]=r,t[11]=d,t[12]=a):a=t[12],o=l&&(0,X.jsx)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row`,children:e.map(hX)}),s=u&&(0,X.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row`,children:[i.map(mX),c.map(pX)]}),t[5]=n,t[6]=r,t[7]=a,t[8]=o,t[9]=s}else a=t[7],o=t[8],s=t[9];let c;return t[13]!==a||t[14]!==o||t[15]!==s?(c=(0,X.jsxs)(`div`,{className:a,children:[o,s]}),t[13]=a,t[14]=o,t[15]=s,t[16]=c):c=t[16],c}function pX(e){return(0,X.jsx)(dX,{action:e},e.label)}function mX(e){return(0,X.jsx)(dX,{action:e},e.label)}function hX(e){return(0,X.jsx)(dX,{action:e},e.label)}function gX(e){return!e.variant||e.variant==="default"||e.variant===`destructive`}function _X(e){return e.variant===`outline`||e.variant===`secondary`}function vX(e){return e.variant===`ghost`}function yX(e){let t=(0,Z.c)(27),{title:n,description:r,showBackButton:i,showCloseButton:a,onBack:o,onClose:s,className:c,overlayId:l}=e,u=a===void 0||a,{pop:d,closeAll:f}=LY(),p=i??!1,m;t[0]!==o||t[1]!==d?(m=()=>{o?o():d()},t[0]=o,t[1]=d,t[2]=m):m=t[2];let h=m,g;t[3]!==f||t[4]!==s?(g=()=>{s?s():f()},t[3]=f,t[4]=s,t[5]=g):g=t[5];let _=g,v;t[6]===c?v=t[7]:(v=Q(`relative flex flex-col gap-1.5 p-6 pb-0`,c),t[6]=c,t[7]=v);let y;t[8]!==h||t[9]!==p?(y=p&&(0,X.jsx)(zv,{"aria-label":`Go back`,className:`ml-[-8px] size-8 shrink-0`,onClick:h,size:`icon`,variant:`ghost`,children:(0,X.jsx)(Yv,{className:`size-5`})}),t[8]=h,t[9]=p,t[10]=y):y=t[10];let b;t[11]!==l||t[12]!==n?(b=n&&(0,X.jsx)(`h2`,{className:`flex-1 font-semibold text-base leading-none`,id:l?`overlay-title-${l}`:void 0,children:n}),t[11]=l,t[12]=n,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==u?(x=u&&(0,X.jsx)(zv,{"aria-label":`Close`,className:`absolute top-4 right-4 size-8 shrink-0 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,onClick:_,size:`icon`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})}),t[14]=_,t[15]=u,t[16]=x):x=t[16];let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,X.jsxs)(`div`,{className:`flex min-h-8 items-center gap-2`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:r}),t[21]=r,t[22]=C);let w;return t[23]!==v||t[24]!==S||t[25]!==C?(w=(0,X.jsxs)(`div`,{className:v,children:[S,C]}),t[23]=v,t[24]=S,t[25]=C,t[26]=w):w=t[26],w}function bX(e){let t=(0,Z.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({overlayId:n,showBackButton:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{showBackButton:a}=RY(n),o=i??a,s;return t[4]!==n||t[5]!==r||t[6]!==o?(s=(0,X.jsx)(yX,{...r,overlayId:n,showBackButton:o}),t[4]=n,t[5]=r,t[6]=o,t[7]=s):s=t[7],s}function xX(e){let t=(0,Z.c)(15),{overlayId:n,title:r,description:i,actions:a,children:o,className:s}=e,c;t[0]===s?c=t[1]:(c=Q(`flex min-h-0 flex-col`,s),t[0]=s,t[1]=c);let l;t[2]!==i||t[3]!==n||t[4]!==r?(l=(r||i)&&(0,X.jsx)(bX,{description:i,overlayId:n,title:r}),t[2]=i,t[3]=n,t[4]=r,t[5]=l):l=t[5];let u;t[6]===o?u=t[7]:(u=o&&(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:o}),t[6]=o,t[7]=u);let d;t[8]===a?d=t[9]:(d=(0,X.jsx)(fX,{actions:a}),t[8]=a,t[9]=d);let f;return t[10]!==c||t[11]!==l||t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`div`,{className:c,children:[l,u,d]}),t[10]=c,t[11]=l,t[12]=u,t[13]=d,t[14]=f):f=t[14],f}function SX(e){let t=(0,Z.c)(31),{overlayId:n,title:r,message:i,confirmLabel:a,cancelLabel:o,confirmVariant:s,destructive:c,onConfirm:l,onCancel:u}=e,d=r===void 0?`Confirm`:r,f=a===void 0?`Confirm`:a,p=o===void 0?`Cancel`:o,m=s===void 0?`default`:s,h=c!==void 0&&c,{pop:g}=LY(),_;t[0]!==u||t[1]!==g?(_=()=>{u?.(),g()},t[0]=u,t[1]=g,t[2]=_):_=t[2];let v=_,y;t[3]!==l||t[4]!==g?(y=async()=>{await l(),g()},t[3]=l,t[4]=g,t[5]=y):y=t[5];let b=y,x;t[6]!==p||t[7]!==v?(x={label:p,variant:`outline`,onClick:v},t[6]=p,t[7]=v,t[8]=x):x=t[8];let S=h?`destructive`:m,C;t[9]!==f||t[10]!==b||t[11]!==S?(C={label:f,variant:S,onClick:b},t[9]=f,t[10]=b,t[11]=S,t[12]=C):C=t[12];let w;t[13]!==C||t[14]!==x?(w=[x,C],t[13]=C,t[14]=x,t[15]=w):w=t[15];let T=w,E;t[16]===h?E=t[17]:(E=h&&(0,X.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-destructive/10`,children:(0,X.jsx)(py,{className:`size-5 text-destructive`})}),t[16]=h,t[17]=E);let D=h&&`pt-2`,O;t[18]===D?O=t[19]:(O=Q(`text-muted-foreground text-sm`,D),t[18]=D,t[19]=O);let k;t[20]!==i||t[21]!==O?(k=(0,X.jsx)(`p`,{className:O,children:i}),t[20]=i,t[21]=O,t[22]=k):k=t[22];let A;t[23]!==E||t[24]!==k?(A=(0,X.jsxs)(`div`,{className:`flex gap-4`,children:[E,k]}),t[23]=E,t[24]=k,t[25]=A):A=t[25];let j;return t[26]!==T||t[27]!==n||t[28]!==A||t[29]!==d?(j=(0,X.jsx)(xX,{actions:T,overlayId:n,title:d,children:A}),t[26]=T,t[27]=n,t[28]=A,t[29]=d,t[30]=j):j=t[30],j}function CX(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 lg:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a||t[8]!==i?(o=(0,X.jsx)(`input`,{className:a,"data-slot":`input`,type:i,...r}),t[6]=r,t[7]=a,t[8]=i,t[9]=o):o=t[9],o}function wX(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`label`,{className:i,"data-slot":`label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function TX(e){return Array.isArray(e)?e:e==null?[]:[e]}var EX=class extends Error{constructor(...e){super(...e),this.name=`AbortError`}};function DX(e){let t=Promise.resolve();return(...n)=>t=t.catch(()=>{}).then(()=>e(...n))}function OX(e){return!e||typeof e!=`object`?!1:`next`in e&&typeof e.next==`function`&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]==`function`}var kX=Symbol.asyncDispose??Symbol.for(`asyncDispose`),AX=class{isDone=!1;isExecuteComplete=!1;cleanup;next;constructor(e,t){this.cleanup=t,this.next=DX(async()=>{if(this.isDone)return{done:!0,value:void 0};let t;try{let t=await e();return t.done&&(this.isDone=!0),t}catch(e){throw t={value:e},this.isDone=!0,e}finally{this.isDone&&!this.isExecuteComplete&&(this.isExecuteComplete=!0,await this.cleanup(t?{kind:`error`,error:t.value}:{kind:`success`}))}})}async return(e){return this.isDone=!0,this.isExecuteComplete||(this.isExecuteComplete=!0,await this.cleanup({kind:`cancelled`})),{done:!0,value:e}}async throw(e){throw this.isDone=!0,this.isExecuteComplete||(this.isExecuteComplete=!0,await this.cleanup({kind:`cancelled`,error:e})),e}async[kX](){this.isDone=!0,this.isExecuteComplete||(this.isExecuteComplete=!0,await this.cleanup({kind:`cancelled`}))}[Symbol.asyncIterator](){return this}};function jX(e){if(e)return JSON.parse(e)}function MX(e){return JSON.stringify(e)}function NX(e){if(!e)return!1;let t=typeof e;return t===`object`||t===`function`}var PX=new WeakMap;function FX(e,t,{bind:n=!0}={}){let r=Reflect.get(e,t);if(!n||typeof r!=`function`)return r;let i=PX.get(r);i||PX.set(r,i=new WeakMap);let a=i.get(e);return a||i.set(e,a=r.bind(e)),a}function IX(e){try{return decodeURIComponent(e)}catch{return e}}function LX(e){return e[0]??{}}var RX=`orpc`;function zX(e){return e instanceof Error&&e.name.includes(`Abort`)}function BX(e){let t;return()=>{if(t)return t.result;let n=e();return t={result:n},n}}function VX(e){return`/${e.map(encodeURIComponent).join(`/`)}`}var HX=2,UX=Symbol.for(`ORPC_OPENTELEMETRY_CONFIG`);function WX(){return globalThis[UX]}function GX(e){let t=WX()?.tracer;if(!t)return;let{name:n,context:r,...i}=typeof e==`string`?{name:e}:e;return t.startSpan(n,i,r)}function KX(e,t){if(!e)return;let n=qX(t);e.recordException(n),zX(t)||e.setStatus({code:HX,message:n.message})}function qX(e){if(e instanceof Error){let t={message:e.message,name:e.name,stack:e.stack};return`code`in e&&(typeof e.code==`string`||typeof e.code==`number`)&&(t.code=e.code),t}return{message:String(e)}}async function JX(e,t){let n=WX()?.tracer;if(!n)return t();typeof e==`string`&&(e={name:e});let r=async e=>{try{return await t(e)}catch(t){throw KX(e,t),t}finally{e.end()}};return e.context?n.startActiveSpan(e.name,e,e.context,r):n.startActiveSpan(e.name,e,r)}async function YX(e,t){let n=WX();if(!e||!n)return t();let r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function XX(e,{runWith:t,mapResult:n,mapError:r,onError:i,onFinish:a}){t??=e=>e();let o;return new AX(async()=>{try{let r;try{r=await t(()=>e.next()),o=r.done}catch(e){throw o=!0,e}return n?await n(r):r}catch(e){throw await i?.(e),r?await r(e):e}},async n=>{try{if(!o)try{await t(async()=>e.return?.())}catch(e){throw await i?.(e),e}}finally{await a?.()}})}function ZX(e,t){let n=BX(()=>GX(e));return XX(t,{runWith:e=>YX(n(),e),mapResult(e){return n()?.addEvent(e.done?`completed`:`yielded`),e},onError(e){KX(n(),e)},onFinish(){n()?.end()}})}function QX(e,...t){return typeof e==`function`?e(...t):e}function $X(e,t){return new Proxy(typeof e==`function`?t:e,{get(n,r){return FX(r in t?t:QX(e),r)},has(n,r){return Reflect.has(t,r)||Reflect.has(QX(e),r)}})}function eZ(e){return NX(e)?Object.getPrototypeOf(e)?.constructor:null}function tZ(e){if(!e||typeof e!=`object`)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function nZ(e,t){let n=e;for(let e of t){if(!NX(n)||!Object.hasOwn(n,e))return;n=n[e]}return n}var rZ=(()=>{let e=function(){};return e.prototype=Object.create(null),Object.freeze(e.prototype),e})();function iZ(e){let t=new rZ,n=e;for(;n&&n!==Object.prototype;){for(let r of Object.getOwnPropertyNames(n)){if(r===`constructor`||r in t)continue;let n=e[r];typeof n==`function`&&(t[r]=n.bind(e))}for(let r of Object.getOwnPropertySymbols(n)){if(r in t)continue;let n=e[r];typeof n==`function`&&(t[r]=n.bind(e))}n=Object.getPrototypeOf(n)}return t}function aZ(e,t,n){if(!e?.length)return n(t);let r=(t,i)=>{let a=e[i];return a?a({...t,next:(e=t)=>r(e,i+1)}):n(t)};return r(t,0)}function oZ(e){let t=e.length,n=new Map;for(let r=0;r<t;r++){let t=e[r],i=n.get(t.name);i===void 0?n.set(t.name,[r]):i.push(r)}let r=Array.from({length:t},()=>new Set);for(let i=0;i<t;i++){let t=e[i],a=t.before;if(a!==void 0)for(let e of a){let t=n.get(e);if(t!==void 0)for(let e of t){let t=r[e];t!==void 0&&t.add(i)}}let o=t.after;if(o!==void 0){let e=r[i];if(e!==void 0)for(let t of o){let r=n.get(t);if(r!==void 0)for(let t of r)e.add(t)}}}let i=[],a=new Set,o=new Set;function s(t){if(o.has(t))return;if(a.has(t)){let n=e[t],r=n===void 0?`unknown`:n.name;throw Error(`Circular dependency detected involving plugin "${r}"`)}a.add(t);let n=r[t];if(n!==void 0)for(let e of n)s(e);a.delete(t),o.add(t);let c=e[t];c!==void 0&&i.push(c)}for(let e=0;e<t;e++)s(e);return i}var sZ=class extends TypeError{},cZ=class extends TypeError{},lZ=class extends Error{constructor(e,t={}){super(t?.message??`Error Event`,t),this.data=e}},uZ=/\r\n|[\n\r]/,dZ=/(?:\r\n|\r(?!\n)|\n)(?:\r\n|\r(?!\n)|\n)/,fZ=/^\s/;function pZ(e){let t=e.split(uZ),n={};for(let e of t){let t=e.indexOf(`:`),r=t===-1?e:e.slice(0,t),i=t===-1?``:e.slice(t+1).replace(fZ,``);if(t===0)n.comments??=[],n.comments.push(i);else if(r===`data`)n.data===void 0?n.data=i:n.data+=`
|
|
92
|
+
${i}`;else if(r===`event`)n.event=i;else if(r===`id`)n.id=i;else if(r===`retry`){let e=Number.parseInt(i);Number.isInteger(e)&&e>=0&&e.toString()===i&&(n.retry=e)}}return n}var mZ=class{constructor(e){this.onEvent=e}incomplete=``;trailingCR=!1;feed(e){this.trailingCR&&e.startsWith(`
|
|
93
|
+
`)&&(e=e.slice(1)),this.trailingCR=e.endsWith(`\r`),this.incomplete+=e;let t=this.incomplete.split(dZ);this.incomplete=t.pop();for(let e of t){let t=pZ(e);this.onEvent(t)}}end(){if(this.incomplete)throw new cZ(`Event Stream ended before complete`)}},hZ=class extends TransformStream{constructor(){let e;super({start(t){e=new mZ(e=>{t.enqueue(e)})},transform(t){e.feed(t)},flush(){e.end()}})}},gZ=/\r\n|[\n\r]/;function _Z(e){return gZ.test(e)}function vZ(e){if(_Z(e))throw new sZ(`Event's id must not contain a carriage return or newline character`)}function yZ(e){if(_Z(e))throw new sZ(`Event's event must not contain a carriage return or newline character`)}function bZ(e){if(!Number.isInteger(e)||e<0)throw new sZ(`Event's retry must be a integer and >= 0`)}function xZ(e){if(_Z(e))throw new sZ(`Event's comment must not contain a carriage return or newline character`)}function SZ(e){let t=``;if(e!==void 0){let n=e.split(gZ);for(let e of n)t+=`data: ${e}
|
|
94
|
+
`}return t}function CZ(e){let t=``;for(let n of e??[])xZ(n),t+=`: ${n}
|
|
95
|
+
`;return t}function wZ(e){let t=``;return t+=CZ(e.comments),e.event!==void 0&&(yZ(e.event),t+=`event: ${e.event}
|
|
96
|
+
`),e.retry!==void 0&&(bZ(e.retry),t+=`retry: ${e.retry}
|
|
97
|
+
`),e.id!==void 0&&(vZ(e.id),t+=`id: ${e.id}
|
|
98
|
+
`),t+=SZ(e.data),t+=`
|
|
99
|
+
`,t}var TZ=Symbol.for(`STANDARDSERVER_EVENT_META`),EZ=Symbol.for(`STANDARDSERVER_EVENT_SOURCE`);function DZ(e,t){let n;if(t.id!==void 0&&(vZ(t.id),n??={},n.id=t.id),t.retry!==void 0&&(bZ(t.retry),n??={},n.retry=t.retry),t.comments!==void 0){for(let e of t.comments)xZ(e);n??={},n.comments=t.comments}return n?new Proxy(e,{get(e,t,r){return t===EZ?e:t===TZ?n:FX(e,t)}}):e}function OZ(e){if(!NX(e))return[e,void 0];let t=e[TZ];return[e[EZ]??e,t]}function kZ(e){if(NX(e))return e[TZ]}function AZ(e){return`inline; filename="${e.replace(/[^\x20-\x7E]/g,`_`).replace(/"/g,`\\"`)}"; filename*=utf-8''${encodeURIComponent(e).replace(/['()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)))}`}function jZ(e){let t=e.match(/filename\*=(UTF-8'')?([^;]*)/i);if(t&&typeof t[2]==`string`)return IX(t[2]);let n=e.match(/filename="((?:\\"|[^"])*)"/i);if(n&&typeof n[1]==`string`)return n[1].replace(/\\"/g,`"`)}function MZ(e,t){let n={...e};for(let e in t)Array.isArray(t[e])?n[e]=[...TX(n[e]),...t[e]]:t[e]!==void 0&&(n[e]=Array.isArray(n[e])?[...n[e],t[e]]:n[e]===void 0?t[e]:[n[e],t[e]]);return n}function NZ(e){let t=e.indexOf(`#`),n=e.indexOf(`?`),r=n!==-1&&(t===-1||n<t),i=r?n:t===-1?e.length:t,a=t===-1?e.length:t;return[e.slice(0,i),r?e.slice(n,a):void 0,t===-1?void 0:e.slice(t)]}var PZ={BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_SUPPORTED:405,NOT_ACCEPTABLE:406,TIMEOUT:408,CONFLICT:409,GONE:410,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,UNSUPPORTED_MEDIA_TYPE:415,UNPROCESSABLE_CONTENT:422,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504},FZ,IZ=class e extends Error{static{let t=Symbol.for(`ORPC_ERROR_CONSTRUCTORS`);globalThis[t]??=new WeakSet,FZ=globalThis[t],FZ.add(e)}name=`ORPCError`;defined=!1;inferable=!1;code;data;constructor(e,...t){let n=LX(t),r=n.message??e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `);super(r,n),this.code=e,this.data=n.data}toJSON(){return{defined:this.defined,inferable:this.inferable,code:this.code,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(!FZ.has(this))return super[Symbol.hasInstance](e);let t=eZ(e);return t&&FZ.has(t)?!0:super[Symbol.hasInstance](e)}};function LZ(e){return e instanceof IZ?e:new IZ(`INTERNAL_SERVER_ERROR`,{cause:e})}function RZ(e){if(!tZ(e))return!1;let t=[`defined`,`inferable`,`code`,`message`,`data`];return!Object.keys(e).some(e=>!t.includes(e))&&`defined`in e&&typeof e.defined==`boolean`&&`inferable`in e&&typeof e.inferable==`boolean`&&`code`in e&&typeof e.code==`string`&&`message`in e&&typeof e.message==`string`}function zZ(e,t={}){let n=new IZ(e.code,{...e,...t});return n.defined=e.defined,n.inferable=e.inferable,n}function BZ(e,{mapResult:t,mapError:n,...r}){return XX(e,{...r,mapResult:t&&(async e=>{let n=await t(e);if(n.value!==e.value){let t=kZ(e.value);if(t&&NX(n.value))return{done:n.done,value:DZ(n.value,t)}}return n}),mapError:n&&(async e=>{let t=await n(e);if(t!==e){let n=kZ(e);if(n&&NX(t))return DZ(t,n)}return t})})}var VZ=/^\/(.*)\/([a-z]*)$/,HZ={undefined:{condition(e){return e===void 0},serialize(){return null},deserialize(){},isTerminal:!0},bigint:{condition(e){return typeof e==`bigint`},serialize(e){return e.toString()},deserialize(e){return BigInt(e)},isTerminal:!0},date:{condition(e){return e instanceof Date},serialize(e){return Number.isNaN(e.getTime())?null:e.toISOString()},deserialize(e){return new Date(e??`Invalid Date`)},isTerminal:!0},nan:{condition(e){return typeof e==`number`&&Number.isNaN(e)},serialize(){return null},deserialize(){return NaN},isTerminal:!0},url:{condition(e){return e instanceof URL},serialize(e){return e.toString()},deserialize(e){return new URL(e)},isTerminal:!0},regexp:{condition(e){return e instanceof RegExp},serialize(e){return e.toString()},deserialize(e){let[,t,n]=e.match(VZ);return new RegExp(t,n)},isTerminal:!0},set:{condition(e){return e instanceof Set},serialize(e){return Array.from(e)},deserialize(e){return new Set(e)}},map:{condition(e){return e instanceof Map},serialize(e){return Array.from(e.entries())},deserialize(e){return new Map(e)}}},UZ=class{handlers;omitUndefinedProperties;constructor(e={}){this.handlers={...HZ,...e.handlers},this.omitUndefinedProperties=e.omitUndefinedProperties!==!1}serialize(e){let[t,n,r,i]=this.serializeValue(e,[],[],[],[]),a=n.length===0?void 0:n;return r.length===0?{json:t,meta:a}:{json:t,meta:a,maps:r,blobs:i}}serializeValue(e,t,n,r,i){for(let a in this.handlers){let o=this.handlers[a];if(o&&o.condition(e)){let s=o.serialize(e);if(o.isTerminal)return n.push([a,...t]),[s,n,r,i];let c=this.serializeValue(s,t,n,r,i);return n.push([a,...t]),c}}if(e instanceof Blob)return r.push(t),i.push(e),[e,n,r,i];if(Array.isArray(e))return[e.map((e,a)=>this.serializeValue(e,[...t,a],n,r,i)[0]),n,r,i];if(tZ(e)){let a={};for(let o in e){let s=e[o];(o!==`toJSON`||typeof s!=`function`)&&(s===void 0&&this.omitUndefinedProperties||(a[o]=this.serializeValue(s,[...t,o],n,r,i)[0]))}return[a,n,r,i]}return[e,n,r,i]}deserialize(e){let t={data:e.json};return e.blobs?.length&&e.maps.forEach((n,r)=>{let i=t,a=`data`;n.forEach(e=>{if(i=i[a],a=e,!Object.hasOwn(i,a))throw Error(`Security error: Invalid serialized data. Segment "${a}" does not exist.`)}),i[a]=e.blobs[r]}),e.meta?.forEach(e=>{let n=e[0],r=t,i=`data`;for(let t=1;t<e.length;t++)if(r=r[i],i=e[t],!Object.hasOwn(r,i))throw Error(`Security error: Invalid serialized data. Segment "${i}" does not exist.`);r[i]=this.handlers[n].deserialize(r[i])}),t.data}},WZ=class{jsonSerializer;defaultSerializeOptions;constructor(e={}){this.jsonSerializer=new UZ(e),this.defaultSerializeOptions=e.serialize}serialize(e,t={}){return e===void 0||e instanceof ReadableStream||e instanceof Blob?e:OX(e)?BZ(e,{mapResult:e=>e.value===void 0?e:{done:e.done,value:this.serializeValue(e.value,t)},mapError:e=>new lZ(this.serializeValue(LZ(e).toJSON(),{...t,useFormDataForBlobFields:!1}),{cause:e})}):this.serializeValue(e,t)}serializeValue(e,t){let n=t.useFormDataForBlobFields??this.defaultSerializeOptions?.useFormDataForBlobFields??!0,{json:r,meta:i,maps:a,blobs:o}=this.jsonSerializer.serialize(e);if(!n||!o?.length)return{json:r,meta:i};let s=new FormData;return s.set(`data`,MX({json:r,meta:i,maps:a})),o.forEach((e,t)=>{s.set(t.toString(),e)}),s}deserialize(e){return e===void 0||e instanceof ReadableStream||e instanceof Blob?e:OX(e)?BZ(e,{mapResult:e=>e.value===void 0?e:{done:e.done,value:this.deserializeValue(e.value)},mapError:e=>{if(!(e instanceof lZ))return e;let t=this.deserializeValue(e.data);return RZ(t)?zZ(t,{cause:e}):new lZ(t,{cause:e})}}):this.deserializeValue(e)}deserializeValue(e){if(!(e instanceof FormData))return this.jsonSerializer.deserialize(e);let t=JSON.parse(e.get(`data`)),n=[];for(let[t,r]of e)r instanceof Blob&&(n[Number(t)]=r);return this.jsonSerializer.deserialize({...t,blobs:n})}},GZ=new Set([`then`,`bind`,`valueOf`,`toString`,`toJSON`]);function KZ(e){return{...e,context:e.context??{}}}function qZ(e){return[e[0],KZ(e[1]??{})]}function JZ(e,{path:t=[],...n}={}){return new Proxy((...r)=>{let[i,a]=qZ(r);return aZ([...TX(n.interceptors),...TX(n.scoped?.interceptors)],{...a,input:i,path:t},({path:t,input:n,...r})=>e.call(t,n,r))},{get(r,i){if(typeof i!=`string`||GZ.has(i))return FX(r,i);let a=n.scoped===void 0?void 0:n.scoped[i];return JZ(e,{...n,path:[...t,i],scoped:a})}})}var YZ=class{constructor(e=[]){this.plugins=e,this.plugins=oZ(e)}name=`~composite`;init(e){for(let t of this.plugins)t.init&&(e=t.init(e));return e}initProcedureOptions(e,t){for(let n of this.plugins)n.initProcedureOptions&&(t=n.initProcedureOptions(e,t));return t}};function XZ(e,t={}){return[...t.prefix===void 0?[]:[t.prefix],e,{...t.input===void 0?{}:{input:t.input},...t.type===void 0?{}:{type:t.type},...t.fnOptions===void 0?{}:{fnOptions:t.fnOptions}}]}function ZZ(e){return async t=>{let n=await e(t),r;for await(let e of n)t.signal?.throwIfAborted(),r={chunk:e},t.client.setQueryData(t.queryKey,e);if(!r)throw TypeError(`Live query for ${MX(t.queryKey)} did not yield any data. Ensure the query function returns an AsyncIterable with at least one chunk.`);return r.chunk}}var QZ=class{constructor(e,t){this.path=e,this.options=t}key(e={}){return XZ(this.path,{...e,prefix:this.options.prefix})}};function $Z(e,{refetchMode:t=`reset`,maxChunks:n=1/0}={}){return async r=>{let i=r.client.getQueryCache().find({queryKey:r.queryKey,exact:!0}),a=!!i&&i.state.data!==void 0;a&&(t===`reset`?i.setState({status:`pending`,data:void 0,error:null,fetchStatus:`fetching`}):r.client.setQueryData(r.queryKey,(e=[])=>eQ(e,n)));let o=[],s=await e(r),c=!a||t!==`replace`;r.client.setQueryData(r.queryKey,(e=[])=>eQ(e,n));for await(let e of s){if(r.signal.aborted)throw r.signal.reason;o.push(e),o=eQ(o,n),c&&r.client.setQueryData(r.queryKey,(t=[])=>eQ([...t,e],n))}c||r.client.setQueryData(r.queryKey,o);let l=r.client.getQueryData(r.queryKey);return l?eQ(l,n):o}}function eQ(e,t){return e.length<=t?e:e.slice(e.length-t)}var tQ=Symbol.for(`ORPC_TANSTACK_QUERY_OPERATION_CONTEXT`),nQ=[`queryInterceptors`,`streamedInterceptors`,`liveInterceptors`,`infiniteInterceptors`,`mutationInterceptors`],rQ=[`queryKey`,`queryOptions`,`streamedKey`,`streamedOptions`,`liveKey`,`liveOptions`,`infiniteKey`,`infiniteOptions`,`mutationKey`,`mutationOptions`];function iQ(e){if(!NX(e))return!1;for(let t in e)if(e[t]!==void 0){if(t===`prefix`){if(typeof e[t]!=`string`)return!1}else if(nQ.includes(t)){if(!Array.isArray(e[t])||e[t].some(e=>typeof e!=`function`))return!1}else if(rQ.includes(t)&&!NX(e[t]))return!1}return!0}function aQ(e,t){if(typeof e!=`function`&&typeof t!=`function`)return{...e,...t};let n=typeof e==`function`?e:t=>({...e,...t}),r=typeof t==`function`?t:e=>({...t,...e});return e=>r(n(e))}function oQ(e,t){let n={...e,...t};for(let r of nQ){let i=e[r],a=t[r];i&&a&&(n[r]=[...i,...a])}for(let r of rQ){let i=e[r],a=t[r];i&&a&&(n[r]=aQ(i,a))}return n}var sQ=class extends QZ{call;constructor(e,t,n={}){super(e,n),this.call=t}queryKey(...e){let t=LX(e);return typeof this.options.queryKey==`function`?t=this.options.queryKey(t):this.options.queryKey&&(t={...this.options.queryKey,...t}),t.queryKey??XZ(this.path,{prefix:this.options.prefix,type:`query`,input:t.input})}queryOptions(...e){let t=LX(e);typeof this.options.queryOptions==`function`?t=this.options.queryOptions(t):this.options.queryOptions&&(t={...this.options.queryOptions,...t});let n=this.queryKey(t);return{...t,queryKey:n,queryFn:e=>aZ(this.options.queryInterceptors,{path:this.path,context:{[tQ]:{key:n,type:`query`},...t.context},input:t.input,fnContext:e},({context:e,input:n,fnContext:r})=>{if(n===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(r):this.call(n,{signal:r.signal,context:e})}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}streamedKey(...e){let t=LX(e);return typeof this.options.streamedKey==`function`?t=this.options.streamedKey(t):this.options.streamedKey&&(t={...this.options.streamedKey,...t}),t.queryKey??XZ(this.path,{prefix:this.options.prefix,type:`streamed`,input:t.input,fnOptions:t.queryFnOptions})}streamedOptions(...e){let t=LX(e);typeof this.options.streamedOptions==`function`?t=this.options.streamedOptions(t):this.options.streamedOptions&&(t={...this.options.streamedOptions,...t});let n=this.streamedKey(t);return{...t,queryKey:n,queryFn:e=>aZ(TX(this.options.streamedInterceptors),{path:this.path,context:{[tQ]:{key:n,type:`streamed`},...t.context},input:t.input,fnContext:e},({context:e,fnContext:n,input:r})=>{if(r===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(n):$Z(async t=>{let n=await this.call(r,{signal:t.signal,context:e});if(!OX(n))throw Error(`streamedQuery requires an AsyncIteratorObject output`);return n},t.queryFnOptions)(n)}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}liveKey(...e){let t=LX(e);return typeof this.options.liveKey==`function`?t=this.options.liveKey(t):this.options.liveKey&&(t={...this.options.liveKey,...t}),t.queryKey??XZ(this.path,{prefix:this.options.prefix,type:`live`,input:t.input})}liveOptions(...e){let t=LX(e);typeof this.options.liveOptions==`function`?t=this.options.liveOptions(t):this.options.liveOptions&&(t={...this.options.liveOptions,...t});let n=this.liveKey(t);return{...t,queryKey:n,queryFn:e=>aZ(TX(this.options.liveInterceptors),{path:this.path,context:{[tQ]:{key:n,type:`live`},...t.context},input:t.input,fnContext:e},({fnContext:e,input:n,context:r})=>{if(n===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(e):ZZ(async e=>{let t=await this.call(n,{signal:e.signal,context:r});if(!OX(t))throw Error(`liveQuery requires an AsyncIteratorObject output`);return t})(e)}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}infiniteKey(e){return typeof this.options.infiniteKey==`function`?e=this.options.infiniteKey(e):this.options.infiniteKey&&(e={...this.options.infiniteKey,...e}),e.queryKey??XZ(this.path,{prefix:this.options.prefix,type:`infinite`,input:e.input===B?B:e.input(e.initialPageParam)})}infiniteOptions(e){typeof this.options.infiniteOptions==`function`?e=this.options.infiniteOptions(e):this.options.infiniteOptions&&(e={...this.options.infiniteOptions,...e});let t=this.infiniteKey(e);return{...e,queryKey:t,queryFn:n=>aZ(TX(this.options.infiniteInterceptors),{path:this.path,context:{[tQ]:{key:t,type:`infinite`},...e.context},input:e.input===B?B:e.input(n.pageParam),fnContext:n},({context:t,input:n,fnContext:r})=>{if(n===B||e.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return e.queryFn?e.queryFn(r):this.call(n,{signal:r.signal,context:t})}),...e.input===B||e.queryFn===B?{enabled:!1}:{}}}mutationKey(e={}){return typeof this.options.mutationKey==`function`?e=this.options.mutationKey(e):this.options.mutationKey&&(e={...this.options.mutationKey,...e}),e.mutationKey??XZ(this.path,{prefix:this.options.prefix,type:`mutation`})}mutationOptions(...e){let t=LX(e);typeof this.options.mutationOptions==`function`?t=this.options.mutationOptions(t):this.options.mutationOptions&&(t={...this.options.mutationOptions,...t});let n=this.mutationKey(t);return{...t,mutationKey:n,mutationFn:(e,r)=>aZ(TX(this.options.mutationInterceptors),{path:this.path,context:{[tQ]:{key:n,type:`mutation`},...t.context},fnContext:r,input:e},({input:e,fnContext:n,context:r})=>t.mutationFn?t.mutationFn(e,n):this.call(e,{context:r}))}}};function cQ(e,t={}){let n=new YZ(t.plugins);return t=n.init(t),lQ(e,t,n)}function lQ(e,t,n){let r=TX(t.path),i=typeof e==`function`&&(t.scoped===void 0||iQ(t.scoped))?iZ(new sQ(r,e,n.initProcedureOptions(r,oQ({prefix:t.prefix,queryInterceptors:t.queryInterceptors,streamedInterceptors:t.streamedInterceptors,liveInterceptors:t.liveInterceptors,infiniteInterceptors:t.infiniteInterceptors,mutationInterceptors:t.mutationInterceptors},t.scoped??{})))):iZ(new QZ(r,t));return new Proxy(i,{get(i,a){let o=FX(i,a),s=e[a];if(typeof a!=`string`||GZ.has(a)||!NX(s))return o;let c=lQ(s,{...t,path:[...r,a],scoped:nZ(t.scoped,[a])},n);return typeof o==`function`?new Proxy(o,{get(e,t){return typeof t!=`string`||GZ.has(t)?FX(e,t):FX(c,t)}}):c}})}function uQ(e){let t=(e?.pipeThrough(new TextDecoderStream).pipeThrough(new hZ))?.getReader(),n=!1;return new AX(async()=>{for(;;){if(t===void 0)return{done:!0,value:void 0};let{done:e,value:r}=await t.read();if(e){if(n)throw new EX(`Stream was cancelled`);return{done:!0,value:void 0}}switch(r.event){case`message`:{let e=jX(r.data);return NX(e)&&(e=DZ(e,r)),{done:!1,value:e}}case`error`:{let e=new lZ(jX(r.data));throw e=DZ(e,r),e}case`close`:{let e=jX(r.data);return NX(e)&&(e=DZ(e,r)),{done:!0,value:e}}}}},async e=>{e.kind===`cancelled`&&(n=!0),await t?.cancel()})}function dQ(e,t={}){let n=t.keepAlive?.enabled??!0,r=t.keepAlive?.interval??15e3,i=t.keepAlive?.comment??``,a=t.initialComment?.enabled??!0,o=t.initialComment?.comment??``,s=t.emptyCloseEventEnabled??!0,c=!1,l;return new ReadableStream({start(e){a&&e.enqueue(wZ({comments:[o]}))},async pull(t){try{n&&(l=setInterval(()=>{t.enqueue(wZ({comments:[i]}))},r));let a=await e.next();if(clearInterval(l),c)return;let[o,u]=OZ(a.value);if(!a.done||o!==void 0||u!==void 0||s){let e=a.done?`close`:`message`;t.enqueue(wZ({...u,event:e,data:MX(o)}))}a.done&&t.close()}catch(e){if(clearInterval(l),c)return;e instanceof lZ?(t.enqueue(wZ({...kZ(e),event:`error`,data:MX(e.data)})),t.close()):t.error(e)}},async cancel(){c=!0,clearInterval(l),await e.return?.()}}).pipeThrough(new TextEncoderStream)}async function fQ(e,t){let n=t?.hint??e.headers.get(`standard-server`),r=e.headers.get(`content-type`)?.split(`;`)[0]?.trim(),i=e.headers.get(`content-length`);if(n!==`none`&&(n!==null||r!==void 0||i!==`0`&&i!==null)&&(n!==null||e.body!==null)){if(e.bodyUsed)throw TypeError(`Failed to read body: body stream already read`);if(n===`json`||n===null&&r===`application/json`)return jX(await e.text());if(n===`form-data`||n===null&&r===`multipart/form-data`)return await e.formData();if(n===`url-search-params`||n===null&&r===`application/x-www-form-urlencoded`){let t=await e.text();return new URLSearchParams(t)}if(n===`event-stream`||n===null&&r===`text/event-stream`)return uQ(e.body);if(n===`file`||n===null&&i!==null){let t=e.headers.get(`content-disposition`),n=t===null?void 0:jZ(t),r=await e.blob();return new File([r],n??`blob`,{type:r.type})}return e.body??new ReadableStream({start(e){e.close()}})}}function pQ(e,t,n={}){return t={...t},e instanceof ReadableStream?(t[`standard-server`]??=`octet-stream`,t[`content-type`]??=`application/octet-stream`,[e,t]):e instanceof Blob?(t[`standard-server`]??=`file`,t[`content-type`]=e.type,t[`content-disposition`]??=AZ(e instanceof File?e.name:`blob`),Number.isFinite(e.size)?(t[`content-length`]=e.size.toString(),[e,t]):[e.stream(),t]):(t[`standard-server`]=void 0,t[`content-length`]=void 0,e===void 0?(t[`content-type`]=void 0,[void 0,t]):e instanceof FormData||e instanceof URLSearchParams?(t[`content-type`]=void 0,[e,t]):OX(e)?(t[`content-type`]=`text/event-stream`,[dQ(e,n.eventStream),t]):(t[`content-type`]=`application/json`,[MX(e),t]))}function mQ(e){let t={};return e.forEach((e,n)=>{Array.isArray(t[n])?t[n].push(e):t[n]===void 0?t[n]=e:t[n]=[t[n],e]}),t}function hQ(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.append(n,r);return t}function gQ(e){return{resolveBody:t=>fQ(e,{hint:t}),status:e.status,get headers(){let t=mQ(e.headers);return Object.defineProperty(this,"headers",{value:t,writable:!0}),t},set headers(e){Object.defineProperty(this,"headers",{value:e,writable:!0})}}}var _Q=class{name=`~composite`;plugins;constructor(e=[]){this.plugins=oZ(e)}init(e){for(let t of this.plugins)t.init&&(e=t.init(e));return e}},vQ=class{constructor(e,t,n={}){this.codec=e,this.transport=t,n=new _Q(n.plugins).init(n),this.interceptors=n.interceptors,this.transportInterceptors=n.transportInterceptors}interceptors;transportInterceptors;call(e,t,n){return JX(`${RX}.${e.join(`/`)}`,r=>(r?.setAttribute(`rpc.system`,RX),r?.setAttribute(`rpc.method`,e.join(`.`)),OX(t)&&(t=$X(t,ZX(`consume_async_iterator_object_input`,t))),aZ(this.interceptors,{...n,path:e,input:t},async({path:e,input:t,...n})=>{let i=WX(),a,o=i?.trace.getActiveSpan()??r;o&&i&&(a=i.trace.setSpan(i.context.active(),o));let s=await JX({name:`encode_input`,context:a},()=>this.codec.encodeInput(t,e,n));if(a&&i?.propagation){let e={...s.headers};i.propagation.inject(a,e),s={...s,headers:e}}let c=await aZ(this.transportInterceptors,{...n,path:e,request:s},({path:e,request:t,...n})=>{let r,a=i?.trace.getActiveSpan()??o;return a&&i&&(r=i.trace.setSpan(i.context.active(),a)),JX({name:`send_request`,context:r},()=>this.transport.send(t,e,n))}),l=await JX({name:`decode_response`,context:a},()=>this.codec.decodeResponse(c,e,n));if(l.kind===`error`)throw l.error;let u=l.output;return OX(u)?$X(u,ZX(`consume_async_iterator_object_output`,u)):u})))}},yQ=/\/$/,bQ=class{baseUrl;maxUrlLength;fallbackMethod;expectedMethod;headers;serializer;constructor(e){this.baseUrl=e.url??`/`,this.maxUrlLength=e.maxUrlLength??2083,this.fallbackMethod=e.fallbackMethod??`POST`,this.expectedMethod=e.method??this.fallbackMethod,this.headers=e.headers??{},this.serializer=e.serializer??new WZ}async encodeInput(e,t,n){let r=xQ(await QX(this.headers,n,t,e));n.lastEventId!==void 0&&(r=MZ(r,{"last-event-id":n.lastEventId}));let i=await QX(this.expectedMethod,n,t,e),[a,o,s]=NZ(await QX(this.baseUrl,n,t,e)),c=`${a.replace(yQ,``)}${VX(t)}`,l=this.serializer.serialize(e);if(i===`GET`&&!(l instanceof Blob)&&!(l instanceof ReadableStream)&&!(l instanceof FormData)&&!OX(l)){let a=await QX(this.maxUrlLength,n,t,e),u=new URLSearchParams(o);u.append(`data`,MX(l)??``);let d=`${c}?${u}${s??``}`;if(d.length<=a)return{body:void 0,method:i,headers:r,url:d,signal:n.signal}}return{url:`${c}${o??``}${s??``}`,method:i===`GET`?this.fallbackMethod:i,headers:r,body:l,signal:n.signal}}async decodeResponse(e){let t=e.status<400,n=await e.resolveBody(),r=await(async()=>{try{return this.serializer.deserialize(n)}catch(e){throw Error(`Invalid RPC response format.`,{cause:e})}})();return t?{kind:`output`,output:r}:RZ(r)?{kind:`error`,error:zZ(r)}:{kind:`error`,error:new IZ(`MALFORMED_ORPC_ERROR_RESPONSE`,{data:{headers:e.headers,status:e.status,body:r}})}}};function xQ(e){return typeof e.forEach==`function`?mQ(e):e}var SQ=class{constructor(e=[]){this.plugins=e,this.plugins=oZ(e)}name=`~composite/fetch-link-transport`;initFetchLinkTransportOptions(e){for(let t of this.plugins)t.initFetchLinkTransportOptions&&(e=t.initFetchLinkTransportOptions(e));return e}},CQ=BX(()=>{try{let e;return new Request(`https://example.com`,{method:`POST`,body:new ReadableStream,get duplex(){return e=`half`,`half`}}),e}catch{return}}),wQ=class{origin;fetch;toFetchRequestOptions;fetchInterceptors;constructor(e){e=new SQ(e.plugins).initFetchLinkTransportOptions(e),this.origin=e.origin,this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=e.toFetchRequest,this.fetchInterceptors=e.fetchInterceptors}async send(e,t,n){let r=await QX(this.origin,n,t);r?.endsWith(`/`)&&(r=r.slice(0,-1));let i=`${r??``}${e.url}`,[a,o]=pQ(e.body,e.headers,this.toFetchRequestOptions),s={body:a,headers:hQ(o),method:e.method,signal:n.signal,redirect:`manual`};if(a instanceof ReadableStream){let e=CQ();e!==void 0&&(s.duplex=e)}return gQ(await aZ(this.fetchInterceptors,{...n,url:i,path:t,init:s},({url:e,path:t,init:n,...r})=>this.fetch(e,n,r,t)))}},TQ=class extends vQ{constructor(e){let t=new bQ(e),n=new wQ(e);super(t,n,e)}};function EQ(e){return e==null}function DQ(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let a=r[i],o=e[a];t(o,a)||(n[a]=o)}return n}function OQ(e){if(typeof e==`string`)return e.trim()||void 0}function kQ(e){return Array.isArray(e)?e.flatMap(e=>{let t=OQ(e);return t?[t]:[]}):[]}function AQ(e,t=`Request failed`){let n=OQ(e);if(n)return n;if(typeof e!=`object`||!e)return t;let r=e,i=OQ(r.error)??OQ(r.message)??OQ(r.details)??t;if(r.code===`integration_validation_failed`){let e=kQ(r.invalidIntegrationIds);if(e.length>0)return`${i} (invalid integration IDs: ${e.join(`, `)})`}return i}var jQ=s(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function MQ(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var NQ=MQ;typeof Object.assign==`function`&&(NQ=Object.assign);function PQ(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function FQ(e){return typeof e==`object`&&!!e}function IQ(e){let t;for(t in e)return!1;return!0}function LQ(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function RQ(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function zQ(e){return!(!FQ(e)||e.attributes&&!Array.isArray(e.attributes))}function BQ(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function VQ(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function HQ(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var UQ=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},WQ=class e extends UQ{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},GQ=class e extends UQ{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},KQ=class e extends UQ{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function qQ(e,t){this.key=e,this.attributes=t,this.clear()}qQ.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function JQ(e,t){this.key=e,this.attributes=t,this.clear()}JQ.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function YQ(e,t){this.key=e,this.attributes=t,this.clear()}YQ.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function XQ(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}XQ.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},XQ.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},XQ.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},XQ.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var ZQ=0,QQ=1,$Q=2,e$=3;function t$(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===ZQ){if(s=e._nodes.get(r),!s)throw new GQ(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===e$){if(i=``+i,c=e._edges.get(i),!c)throw new GQ(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new GQ(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new GQ(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===QQ?c.source:c.target,l=i,u=a}return[s,l,u]}function n$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=t$(this,t,n,e,r,i);return a.attributes[o]}}function r$(e,t,n){e.prototype[t]=function(e,r){let[i]=t$(this,t,n,e,r);return i.attributes}}function i$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=t$(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function a$(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=t$(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function o$(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=t$(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new WQ(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function s$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=t$(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function c$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=t$(this,t,n,e,r,i);if(!FQ(o))throw new WQ(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function l$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=t$(this,t,n,e,r,i);if(!FQ(o))throw new WQ(`Graph.${t}: provided attributes are not a plain object.`);return NQ(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function u$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=t$(this,t,n,e,r,i);if(typeof o!=`function`)throw new WQ(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var d$=[{name:e=>`get${e}Attribute`,attacher:n$},{name:e=>`get${e}Attributes`,attacher:r$},{name:e=>`has${e}Attribute`,attacher:i$},{name:e=>`set${e}Attribute`,attacher:a$},{name:e=>`update${e}Attribute`,attacher:o$},{name:e=>`remove${e}Attribute`,attacher:s$},{name:e=>`replace${e}Attributes`,attacher:c$},{name:e=>`merge${e}Attributes`,attacher:l$},{name:e=>`update${e}Attributes`,attacher:u$}];function f$(e){d$.forEach(function({name:t,attacher:n}){n(e,t(`Node`),ZQ),n(e,t(`Source`),QQ),n(e,t(`Target`),$Q),n(e,t(`Opposite`),e$)})}function p$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=PQ(this,a,o,n),!i)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function m$(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=``+e,a=``+arguments[1];if(r=PQ(this,i,a,n),!r)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function h$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=PQ(this,a,o,n),!i)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function g$(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=PQ(this,o,s,n),!a)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function _$(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=PQ(this,o,s,n),!a)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new WQ(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function v$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=PQ(this,a,o,n),!i)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function y$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=PQ(this,a,o,n),!i)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!FQ(r))throw new WQ(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function b$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=PQ(this,a,o,n),!i)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!FQ(r))throw new WQ(`Graph.${t}: provided attributes are not a plain object.`);return NQ(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function x$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new KQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new KQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=PQ(this,a,o,n),!i)throw new GQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new KQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new GQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new WQ(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var S$=[{name:e=>`get${e}Attribute`,attacher:p$},{name:e=>`get${e}Attributes`,attacher:m$},{name:e=>`has${e}Attribute`,attacher:h$},{name:e=>`set${e}Attribute`,attacher:g$},{name:e=>`update${e}Attribute`,attacher:_$},{name:e=>`remove${e}Attribute`,attacher:v$},{name:e=>`replace${e}Attributes`,attacher:y$},{name:e=>`merge${e}Attributes`,attacher:b$},{name:e=>`update${e}Attributes`,attacher:x$}];function C$(e){S$.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var w$=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function T$(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function E$(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function D$(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function O$(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function k$(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function A$(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function j$(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function M$(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function N$(e,t){if(e.size===0)return HQ();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function P$(e,t,n,r,i,a){let o=t?E$:T$,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function F$(e,t,n,r){let i=[];return P$(!1,e,t,n,r,function(e){i.push(e)}),i}function I$(e,t,n){let r=HQ();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=VQ(r,D$(n.in))),t!==`in`&&n.out!==void 0&&(r=VQ(r,D$(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=VQ(r,D$(n.undirected))),r}function L$(e,t,n,r,i,a,o){let s=n?k$:O$,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function R$(e,t,n,r,i){let a=[];return L$(!1,e,t,n,r,i,function(e){a.push(e)}),a}function z$(e,t,n,r){let i=HQ();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=VQ(i,A$(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=VQ(i,A$(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=VQ(i,A$(n.undirected,r))),i}function B$(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return j$(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new GQ(`Graph.${n}: could not find the "${e}" node in the graph.`);return F$(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new GQ(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new GQ(`Graph.${n}: could not find the "${t}" target node in the graph.`);return R$(r,this.multi,i,a,t)}throw new WQ(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function V$(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r===`mixed`||this.type===`mixed`||r===this.type){if(arguments.length===1)return n=e,M$(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new GQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return P$(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new GQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new GQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return L$(!1,r,this.multi,i,o,t,n)}throw new WQ(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new WQ(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new WQ(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function H$(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,M$(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new GQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return P$(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new GQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new GQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return L$(!0,r,this.multi,i,o,t,n)}throw new WQ(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function U$(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return HQ();if(!arguments.length)return N$(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return I$(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new GQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return z$(r,i,n,t)}throw new WQ(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function W$(e){w$.forEach(t=>{B$(e,t),V$(e,t),H$(e,t),U$(e,t)})}var G$=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function K$(){this.A=null,this.B=null}K$.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},K$.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function q$(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function J$(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return q$(e,null,r,r.undirected,i);if(typeof n==`string`)return q$(e,null,r,r[n],i)}let a=new K$,o;if(t!==`undirected`){if(n!==`out`){if(o=q$(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=q$(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=q$(e,a,r,r.undirected,i),e&&o))return o}function Y$(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return J$(!1,e,t,n,function(e){r.push(e)}),r}function X$(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Z$(e,t,n){if(e!==`mixed`){if(e===`undirected`)return X$(null,n,n.undirected);if(typeof t==`string`)return X$(null,n,n[t])}let r=HQ(),i=new K$;return e!==`undirected`&&(t!==`out`&&(r=VQ(r,X$(i,n,n.in))),t!==`in`&&(r=VQ(r,X$(i,n,n.out)))),e!==`directed`&&(r=VQ(r,X$(i,n,n.undirected))),r}function Q$(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new GQ(`Graph.${n}: could not find the "${e}" node in the graph.`);return Y$(r===`mixed`?this.type:r,i,t)}}function $$(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new GQ(`Graph.${a}: could not find the "${e}" node in the graph.`);J$(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new WQ(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function e1(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new GQ(`Graph.${o}: could not find the "${e}" node in the graph.`);return J$(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function t1(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return HQ();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new GQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return Z$(r===`mixed`?this.type:r,i,t)}}function n1(e){G$.forEach(t=>{Q$(e,t),$$(e,t),e1(e,t),t1(e,t)})}function r1(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function i1(e,t){let n={key:e};return IQ(t.attributes)||(n.attributes=NQ({},t.attributes)),n}function a1(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return IQ(n.attributes)||(r.attributes=NQ({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function o1(e){if(!FQ(e))throw new WQ(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new WQ(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!FQ(e.attributes)||e.attributes===null))throw new WQ(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function s1(e){if(!FQ(e))throw new WQ(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new WQ(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new WQ(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!FQ(e.attributes)||e.attributes===null))throw new WQ(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new WQ(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var Jle=BQ(),Yle=new Set([`directed`,`undirected`,`mixed`]),c1=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),Xle=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],Zle={allowSelfLoops:!0,multi:!1,type:`mixed`};function Qle(e,t,n){if(n&&!FQ(n))throw new WQ(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new KQ(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function l1(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function u1(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new KQ(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new KQ(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!FQ(s))throw new WQ(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new KQ(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new GQ(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new GQ(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new KQ(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new KQ(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let d=new XQ(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function $le(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new KQ(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new KQ(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new WQ(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!FQ(s))throw new WQ(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new KQ(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new KQ(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else NQ(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new KQ(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=l1(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=l1(e,o,{}),g=!0),f=new XQ(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function d1(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var f1=class e extends jQ.EventEmitter{constructor(e){if(super(),e=NQ({},Zle,e),typeof e.multi!=`boolean`)throw new WQ(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Yle.has(e.type))throw new WQ(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new WQ(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?qQ:e.type===`directed`?JQ:YQ;LQ(this,`NodeDataClass`,t);let n=`geid_`+Jle()+`_`,r=0;LQ(this,`_attributes`,{}),LQ(this,`_nodes`,new Map),LQ(this,`_edges`,new Map),LQ(this,`_directedSize`,0),LQ(this,`_undirectedSize`,0),LQ(this,`_directedSelfLoopCount`,0),LQ(this,`_undirectedSelfLoopCount`,0),LQ(this,`_edgeKeyGenerator`,()=>{let e;do e=n+r++;while(this._edges.has(e));return e}),LQ(this,`_options`,e),c1.forEach(e=>LQ(this,e,this[e])),RQ(this,`order`,()=>this._nodes.size),RQ(this,`size`,()=>this._edges.size),RQ(this,`directedSize`,()=>this._directedSize),RQ(this,`undirectedSize`,()=>this._undirectedSize),RQ(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),RQ(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),RQ(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),RQ(this,`multi`,this._options.multi),RQ(this,`type`,this._options.type),RQ(this,`allowSelfLoops`,this._options.allowSelfLoops),RQ(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new WQ(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new WQ(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new WQ(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new KQ(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new GQ(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new KQ(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new GQ(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new KQ(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new GQ(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`directed`&&t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new GQ(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new GQ(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new GQ(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new GQ(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new GQ(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new GQ(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new GQ(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new GQ(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new GQ(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new GQ(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Qle(this,e,t).key}mergeNode(e,t){if(t&&!FQ(t))throw new WQ(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(NQ(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new WQ(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new GQ(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do d1(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do d1(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do d1(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=PQ(this,e,n,this.type),!t)throw new GQ(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new GQ(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return d1(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new KQ(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new KQ(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=PQ(this,e,t,`directed`);if(!n)throw new GQ(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return d1(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new KQ(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new KQ(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=PQ(this,e,t,`undirected`);if(!n)throw new GQ(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return d1(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new WQ(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!FQ(e))throw new WQ(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!FQ(e))throw new WQ(`Graph.mergeAttributes: provided attributes are not a plain object.`);return NQ(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new WQ(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new WQ(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!zQ(t))throw new WQ(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new WQ(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!zQ(t))throw new WQ(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new WQ(`Graph.forEachAdjacencyEntry: expecting a callback.`);r1(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new WQ(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);r1(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new WQ(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);r1(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new WQ(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);r1(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new WQ(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new WQ(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new WQ(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new WQ(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new WQ(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new WQ(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new WQ(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new WQ(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=i1(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=a1(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!FQ(t))throw new WQ(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!FQ(t.attributes))throw new WQ(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new WQ(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],o1(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new WQ(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],s1(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(NQ({},this._options,t));return n.replaceAttributes(NQ({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=NQ({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new KQ(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new KQ(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new KQ(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,u1(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,NQ({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!c1.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,LQ(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(f1.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=f1.prototype.inspect),Xle.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?u1:$le;e.generateKey?f1.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:f1.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),f$(f1),C$(f1),W$(f1),n1(f1);var p1=class extends f1{constructor(e){let t=NQ({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new WQ(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new WQ(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},m1=class extends f1{constructor(e){let t=NQ({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new WQ(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new WQ(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},h1=class extends f1{constructor(e){let t=NQ({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new WQ(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},g1=class extends f1{constructor(e){let t=NQ({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new WQ(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new WQ(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},_1=class extends f1{constructor(e){let t=NQ({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new WQ(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new WQ(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function v1(e){e.from=function(t,n){let r=new e(NQ({},t.options,n));return r.import(t),r}}v1(f1),v1(p1),v1(m1),v1(h1),v1(g1),v1(_1),f1.Graph=f1,f1.DirectedGraph=p1,f1.UndirectedGraph=m1,f1.MultiGraph=h1,f1.MultiDirectedGraph=g1,f1.MultiUndirectedGraph=_1,f1.InvalidArgumentsGraphError=WQ,f1.NotFoundGraphError=GQ,f1.UsageGraphError=KQ;var y1={condition:`Condition`,wait:`Wait`,eventSplit:`Event Split`},eue=Ah([`newest-wins`,`first-wins`,`unlimited`]),b1=Ch({startEvents:Eh(Bh),cancelEvents:Eh(Bh),concurrency:eue,allowManualStart:mh(xh),correlationPaths:mh(wh(yh,Bh))}),x1={startEvents:[],cancelEvents:[],concurrency:`unlimited`,allowManualStart:!0},tue=Wh(b1);function S1(e){return tue(e?.lifecycleRules)}function C1(e){return(S1(e)?.cancelEvents.length??0)>0}function w1(e){return e.rules.correlationPaths?.[e.eventName]??e.declaredPath}function nue(e){return e.startEvents.length>0||e.allowManualStart===!0}function T1(e){return e===void 0||e.allowManualStart===!0}var rue={valid:!0},E1=e=>({valid:!1,error:e});function iue(e){return`No Event named "${e}" is defined. Choose an Event this app declares, or ask whoever defines them to add it.`}function D1(e){return e.concurrency!==`unlimited`||e.cancelEvents.length>0}function O1(e){let{rules:t,catalog:n,eventName:r,role:i}=e;if(!(i===`start`&&!D1(t)))return{eventName:r,role:i,declaredPath:Ny(n,r)?.correlationPath,suppliedPath:t.correlationPaths?.[r]}}function aue(e){let{rules:t,catalog:n}=e,r=t.startEvents.map(e=>O1({rules:t,catalog:n,eventName:e,role:`start`})),i=t.cancelEvents.map(e=>O1({rules:t,catalog:n,eventName:e,role:`cancel`}));return Ka([...r,...i])}function k1(e){if(!e.correlationPaths)return e;let t=new Set(e.cancelEvents);if(D1(e))for(let n of e.startEvents)t.add(n);let n=Object.fromEntries(Object.entries(e.correlationPaths).filter(([e])=>t.has(e)));return{...e,correlationPaths:Object.keys(n).length>0?n:void 0}}function oue(e){let{rules:t,catalog:n}=e,r=t.startEvents.find(e=>t.cancelEvents.includes(e));if(r)return E1(`Event "${r}" cannot both start and cancel runs of this workflow. Give it one role, or start on one Event and cancel on another.`);let i=[...t.startEvents,...t.cancelEvents];for(let e of i)if(!Ny(n,e))return E1(iue(e));let a=aue({rules:t,catalog:n}).find(e=>!w1({rules:t,eventName:e.eventName,declaredPath:e.declaredPath}));return a?E1(sue(a.eventName)):nue(t)?rue:E1(`Nothing can start this workflow. Add a Start Event, or allow manual starts.`)}function sue(e){return`Event "${e}" declares no Correlation Path. Enter the payload path holding the value that identifies the entity, or ask whoever defined the Event to declare it.`}var cue=Wh(zh);function lue(e){return cue(e)??null}function uue(e){let t=lue(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}var A1=wh(yh,zh),j1=Ch({byEvent:mh(wh(yh,A1)),manual:mh(A1)}),due=Wh(j1);function fue(e){return due(e?.testPayloads)}function M1(e,t){return t?e?.byEvent?.[t]:e?.manual}var pue=Ch({lifecycleRules:mh(b1),testPayloads:mh(j1)}).annotate({message:`Lifecycle config must be an object`}),N1={label:yh,description:mh(yh),enabled:mh(xh)},mue=Th(Ch({...N1,type:hh(`lifecycle`),config:mh(pue)}),Hh),hue=kh([Ch({actionType:hh(y1.condition),condition:mh(kh([yh,xh])),conditionModel:mh(yh),integrationId:mh(yh)}).annotate({message:`Condition config must be an object`}),Th(Ch({actionType:hh(y1.wait),integrationId:mh(yh),waitDelayTimingMode:mh(yh),waitMode:mh(Ah([`delay`,`event`])),waitFor:mh(gh),waitTimeout:mh(yh),waitTimeoutBehavior:mh(yh),waitDuration:mh(yh),waitUntil:mh(yh),waitOffset:mh(yh),waitGateMode:mh(yh),waitAllowedHoursMode:mh(yh),waitAllowedStartTime:mh(yh),waitAllowedEndTime:mh(yh),waitTimezone:mh(yh)}),Hh).annotate({message:`Wait config must be an object`}),Ch({actionType:hh(y1.eventSplit),integrationId:mh(yh)}).annotate({message:`Event Split config must be an object`}),Th(Ch({actionType:mh(Bh.check(Nh(e=>e===y1.condition||e===y1.wait||e===y1.eventSplit?`Built-in action configs use their own schema arm`:!0))),integrationId:mh(yh)}),Hh)]).annotate({message:`Action config must be an object`}),gue=Th(Ch({...N1,type:hh(`action`),config:mh(hue)}),Hh),_ue=Th(Ch({...N1,type:hh(`add`),config:mh(wh(yh,gh))}),Hh),vue=Ch({entryNodeIds:mh(Uh(Bh)),exitNodeId:mh(Bh),outletHandle:mh(hh(`true`))}).annotate({message:`Group config must be an object`}),yue=kh([mue,gue,_ue,Th(Ch({...N1,type:hh(`group`),config:mh(vue)}),Hh)]).annotate({message:`Node data needs a type of "lifecycle", "action", "add", or "group"`}),P1=Th(Ch({id:Bh,type:mh(Ah([`lifecycle`,`action`,`add`,`group`])),parentId:mh(Bh),width:mh(Fh),height:mh(Fh),position:mh(Ch({x:Fh,y:Fh})),data:yue}),Hh),F1=Th(Ch({id:Bh,source:Bh,target:Bh,sourceHandle:mh(jh(Bh)),targetHandle:mh(jh(Bh)),data:mh(wh(yh,gh))}),Hh),bue=Ch({key:Bh,attributes:P1}),xue=Ch({key:Bh,source:Bh,target:Bh,attributes:F1,undirected:mh(hh(!1))}),I1=Ch({attributes:mh(wh(yh,gh)),options:mh(Ch({allowSelfLoops:mh(xh),multi:mh(xh),type:mh(Ah([`directed`,`undirected`,`mixed`]))})),nodes:Uh(bue),edges:Uh(xue)}),L1={allowSelfLoops:!1,multi:!1,type:`directed`},Sue=sh(I1,Vh);oh(I1,{...Vh,errors:`all`});var Cue=sh(P1,Vh);oh(P1,Vh);var wue=sh(F1,Vh);function R1(e){let t={label:e.label,type:e.type};return e.description!==void 0&&(t.description=e.description),typeof e.config==`object`&&e.config!==null&&!Array.isArray(e.config)&&(t.config={...e.config}),e.enabled!==void 0&&(t.enabled=e.enabled),t}function Tue(e){let t=Cue(e),n={id:t.id,type:t.type,position:t.position??{x:0,y:0},data:R1(t.data)};return t.parentId!==void 0&&(n.parentId=t.parentId),t.width!==void 0&&(n.width=t.width),t.height!==void 0&&(n.height=t.height),n}function Eue(e){let t=wue(e);return{id:t.id,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle,data:t.data}}function Due(e){let t=Tue(e.attributes);if(e.key!==t.id)throw Error(`Node key '${e.key}' must match node attribute id '${t.id}'`);return t}function Oue(e){let t=Eue(e.attributes);if(e.key!==t.id)throw Error(`Edge key '${e.key}' must match edge attribute id '${t.id}'`);if(e.source!==t.source||e.target!==t.target)throw Error(`Edge '${e.key}' source/target must match edge attributes`);return t}function z1(e){let t=new p1({allowSelfLoops:L1.allowSelfLoops,multi:L1.multi});e.attributes&&t.replaceAttributes(e.attributes);for(let n of e.nodes)t.mergeNode(n.id,{...n,data:R1(n.data)});for(let n of e.edges){let e=[n.source,n.target].filter(e=>!t.hasNode(e));if(e.length>0)throw Error(`Edge '${n.id}' names ${e.join(` and `)}, which the graph has no node for`);t.mergeEdgeWithKey(n.id,n.source,n.target,n)}return B1(t.export())}function B1(e){return Sue(e)}function V1(e){let t=B1(e);return{nodes:t.nodes.map(Due),edges:t.edges.map(Oue)}}var H1=`animated`;function U1(e){let{status:t,issues:n,...r}=e.data,i={id:e.id,position:e.position,data:r,type:e.type};return typeof e.width==`number`&&(i.width=e.width),typeof e.height==`number`&&(i.height=e.height),e.measured&&typeof e.measured.width==`number`&&typeof e.measured.height==`number`&&(i.measured={width:e.measured.width,height:e.measured.height}),typeof e.parentId==`string`&&e.parentId.length>0&&(i.parentId=e.parentId),i}function W1(e){return e.filter(e=>e.type!==`add`).map(U1)}function G1(e){let{displayLabel:t,inactive:n,...r}=e.data??{};return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,data:Object.keys(r).length>0?r:void 0}}function K1(e){let t={id:e.id,position:e.position,type:e.type,width:e.width,height:e.height,measured:e.measured,data:{...e.data}};return e.parentId&&(t.parentId=e.parentId,t.extent=`parent`,t.draggable=!1,t.connectable=!1),t}function q1(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle??void 0,targetHandle:e.targetHandle??void 0,data:e.data}}function J1(e){return z1({nodes:W1(e.nodes),edges:e.edges.map(G1)})}var Y1=class extends Error{constructor(e,t){super(t),this.status=e,this.name=`ApiError`}},kue=`/api/rpc`,X1=`http://localhost:3000`;function Z1(){let e=typeof globalThis.location?.origin==`string`?globalThis.location.origin.trim():``;if(!(!e||e===`null`))return e}function Aue(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_RPC_URL;return typeof e==`string`?e:void 0}function jue(e={}){let t=e.rpcUrl??Aue();if(t){let n=t.trim();if(n.length>0)try{return new URL(n).toString()}catch{let t=e.origin?.trim()||Z1()||X1;try{return new URL(n,t).toString()}catch{return new URL(n,X1).toString()}}}let n=`${Sy()}${kue}`,r=e.origin?.trim()||Z1()||X1;try{return new URL(n,r).toString()}catch{return new URL(n,X1).toString()}}function Mue(e){let t=new URL(e);return{origin:t.origin,pathWithQuery:`/${t.pathname.slice(1)}${t.search}`}}var Nue=PZ,Q1=Mue(jue()),$1=JZ(new TQ({origin:Q1.origin,url:Q1.pathWithQuery,fetch:(e,t)=>globalThis.fetch(e,t),interceptors:[async e=>{try{return await e.next()}catch(e){throw e instanceof Y1?e:e instanceof IZ?new Y1(Nue[e.code]??500,AQ(e.data??e.message)):e instanceof Error?new Y1(500,e.message||`Request failed`):new Y1(500,`Request failed`)}}]}));function e0(e){let t=V1(e.graph);return{...e,nodes:t.nodes.map(K1),edges:t.edges.map(q1)}}function t0(e){return e.graph?e.graph:J1({nodes:e.nodes??[],edges:e.edges??[]})}var Pue={create:e=>$1.workflow.create({name:e.name,graph:t0(e),...DQ({description:e.description},EQ)}).then(e0),update:(e,t)=>{let n=t.graph!==void 0||t.nodes!==void 0&&t.edges!==void 0?t0({graph:t.graph,nodes:t.nodes,edges:t.edges}):void 0;return $1.workflow.update({workflowId:e,...DQ({name:t.name,description:t.description,graph:n,mode:t.mode},EQ)}).then(e0)}},n0=cQ($1),r0=()=>n0.integration.getAll.queryOptions({input:{}}),Fue=()=>n0.workflow.getAll.queryOptions({input:{}});function Iue(e){return e.hasUnpublishedChanges}function Lue(e){return n0.workflow.getById.queryOptions({input:{workflowId:e},select:Iue,staleTime:1/0})}function i0(e){return e.invalidateQueries({queryKey:n0.workflow.getAll.key()})}function a0(e,t){e.setQueryData(n0.workflow.getById.queryKey({input:{workflowId:t.id}}),e=>e&&{...e,hasUnpublishedChanges:t.hasUnpublishedChanges,updatedAt:t.updatedAt??e.updatedAt,...t.publishedVersionId===void 0?{}:{publishedVersionId:t.publishedVersionId}})}function o0(e){return Promise.all([e.invalidateQueries({queryKey:n0.workflow.getExecutions.key()}),e.invalidateQueries({queryKey:n0.workflow.getExecutionsGlobal.key()})])}function s0(e){return e.invalidateQueries({queryKey:n0.integration.getAll.key()})}function c0(){let e=(0,Z.c)(3),t=Fe(),n=Gi(),r;return e[0]!==n||e[1]!==t?(r=n0.workflow.delete.mutationOptions({onSuccess:async()=>{Ty.success(`Workflow deleted successfully`),await Promise.all([i0(t),o0(t)]),await n({to:`/`,replace:!0})},meta:{errorMessage:`Failed to delete workflow. Please try again.`}}),e[0]=n,e[1]=t,e[2]=r):r=e[2],Ze(r)}var Rue=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,l0=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Rue[n[e]&63];return t};function u0(e,t){return!t||e?.[t.field]===t.equals}function d0(e,t){return t.filter(t=>u0(e,t.showWhen))}var zue=/\{\{@([^:{}]+):([^{}]+)\}\}/g;function Bue(e){let[t,n,r]=e,i=r.indexOf(`.`);return{raw:t,nodeId:n,nodeLabel:i===-1?r:r.slice(0,i),fieldPath:i===-1?``:r.slice(i+1),start:e.index,end:e.index+t.length}}function f0(e){let t=new RegExp(zue.source,`g`),n=[],r=t.exec(e);for(;r!==null;)n.push(Bue(r)),r=t.exec(e);return n}function p0(e){let t=[],n=0;for(let r of f0(e))r.start>n&&t.push({kind:`literal`,text:e.slice(n,r.start)}),t.push({kind:`token`,token:r}),n=r.end;return n<e.length&&t.push({kind:`literal`,text:e.slice(n)}),t}function m0(e){let t=e.fieldPath?`.${e.fieldPath}`:``;return`{{@${e.nodeId}:${e.nodeLabel}${t}}}`}function h0(e,t){if(typeof e==`string`)return Vue(e,t);if(Array.isArray(e)){let n=!1,r=e.map(e=>{let r=h0(e,t);return r!==e&&(n=!0),r});return n?r:e}if(typeof e==`object`&&e){let n=!1,r={};for(let[i,a]of Object.entries(e)){let e=h0(a,t);e!==a&&(n=!0),r[i]=e}return n?r:e}return e}function Vue(e,t){let n=!1,r=p0(e).map(e=>{if(e.kind===`literal`)return e.text;let r=t(e.token);return r===void 0||r===e.token.raw?e.token.raw:(n=!0,r)}).join(``);return n?r:e}var Hue=/\[(\d+)\]/g,Uue=/^([^[]*)((?:\[\d+\])*)$/;function Wue(e){let t=[];for(let n of e.split(`.`)){let e=n.trim();if(!e)return null;let r=Uue.exec(e);if(!r)return null;let i=r[1];if(i.includes(`]`))return null;i&&t.push({kind:`key`,key:i});for(let n of e.matchAll(Hue)){let e=Number(n[1]);if(!Number.isSafeInteger(e))return null;t.push({kind:`index`,index:e})}}return t.length>0?t:null}function g0(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function _0(e,t,n){return g0(e,t)??n}function v0(e,t){let n=g0(e,t)?.trim();return n&&n.length>0?n:void 0}function y0(e){if(!(!e||e.data.type!==`action`))return g0(e.data.config,`actionType`)}function Gue(e){return e===y1.wait}function b0(e){return!e||e.data.type!==`action`?!1:Gue(y0(e))}function Kue(e){return e?.data.type===`lifecycle`}function x0(e){return!e||e.data.type!==`action`?!1:y0(e)===y1.condition}function S0(e){return!e||e.data.type!==`action`?!1:y0(e)===y1.eventSplit}function C0(e){return e===`true`||e===`false`?e:null}function que(e){let t=C0(e);return t===`true`?`True`:t===`false`?`False`:null}function w0(e){return e===y1.condition}function T0(e){return x0(e)}function E0(e){return e?.data.type===`group`}function D0(e){let t=e?.data.config?.entryNodeIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.length>0):[]}function O0(e){return g0(e?.data.config,`exitNodeId`)}function k0(e){return g0(e?.data.config,`outletHandle`)===`true`?`true`:void 0}function A0(e){return`${e.source}\0${e.sourceHandle??``}`}function j0(e,t){let n=e(t.source);return n!==void 0&&n===e(t.target)}function M0(e,t){return e.has(t.source)&&e.has(t.target)}function N0(e,t,n,r){let i=new Map(e.map(e=>[e.id,e])),a=[];for(let e of n){let t=i.get(e);if(!t)return{ok:!1,error:`Select at least two steps`};let n=tde(t,r);if(n)return{ok:!1,error:n};a.push(t)}if(a.length<2)return{ok:!1,error:`Select at least two steps`};let o=new Set(a.map(e=>e.id)),s=t.filter(e=>M0(o,e)),c=new Map,l=new Map;for(let e of o)c.set(e,0),l.set(e,0);for(let e of s)c.set(e.target,(c.get(e.target)??0)+1),l.set(e.source,(l.get(e.source)??0)+1);let u=a.filter(e=>(c.get(e.id)??0)===0),d=a.filter(e=>(l.get(e.id)??0)===0);if(u.length===0)return{ok:!1,error:`Needs an entry step`};if(d.length!==1)return{ok:!1,error:`Needs exactly one exit step`};let f=d[0];if(!f)return{ok:!1,error:`Needs exactly one exit step`};let p=u.map(e=>e.id);if(H0(p,s,o).size!==o.size)return{ok:!1,error:`Needs a connected lookup group`};for(let e of p)if(!H0([e],s,o).has(f.id))return{ok:!1,error:`Needs a connected lookup group`};let m=new Set(p),h=new Set;for(let e of t){let t=o.has(e.source),n=o.has(e.target);if(t!==n){if(n&&!m.has(e.target))return{ok:!1,error:`Needs an entry step`};if(t&&e.source!==f.id)return{ok:!1,error:`Needs exactly one exit step`};if(t&&e.source===f.id){let t=C0(e.sourceHandle);if(x0(f)&&t===`false`)return{ok:!1,error:`Condition False cannot leave the group`}}n&&m.has(e.target)&&h.add(A0(e))}}return h.size>1?{ok:!1,error:`Parallel lookups must share the same incoming step`}:{ok:!0,entryIds:p,exitId:f.id,memberIds:U0(o,s,p)}}function Jue(e,t){let n=e.find(e=>e.id===t);return E0(n)?O0(n)??t:t}function P0(e){let t=Jue(e.nodes,e.sourceId),n=new Set(e.edges.filter(t=>t.id!==e.excludeEdgeId).map(e=>`${A0(e)}\0${e.target}`)),r=[];for(let i of Yue(e.nodes,e.targetId)){let a=`${A0({source:t,sourceHandle:e.sourceHandle})}\0${i}`;n.has(a)||r.push({source:t,target:i,sourceHandle:e.sourceHandle})}return r}function Yue(e,t){let n=e.find(e=>e.id===t);if(!E0(n))return[t];let r=D0(n);return r.length>0?r:[t]}function F0(e,t,n){let r=t.find(e=>e.id===n);if(!r)return[];let i=e.find(e=>e.id===r.target),a=i?.parentId?e.find(e=>e.id===i.parentId):void 0;if(!E0(a))return[n];let o=new Set(D0(a));return o.has(r.target)?t.filter(e=>e.source===r.source&&(e.sourceHandle??``)===(r.sourceHandle??``)&&o.has(e.target)).map(e=>e.id):[n]}function I0(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=new Map;for(let t of e){if(!E0(t))continue;for(let e of D0(t))r.set(e,t.id);let e=O0(t);e&&i.set(e,t.id)}let a=e=>n.get(e)?.parentId,o=!1,s=t.map(e=>{if(j0(a,e))return e;let t=e,n=a(e.source);n&&i.get(e.source)===n&&(t={...t,source:n});let s=a(e.target);return s&&r.get(e.target)===s&&(t={...t,target:s}),o||=t!==e,t});return nde(o?s:t)}function Xue(e,t){let n=new Map(e.map(e=>[e.id,e]));return I0(e,t).filter(e=>!n.get(e.source)?.parentId&&!n.get(e.target)?.parentId)}function L0(e,t){let n=new Set(t),r=new Map(e.map(e=>[e.id,e]));for(let i of t){let t=r.get(i);if(t){if(E0(t)){for(let t of e)t.parentId===i&&n.add(t.id);continue}if(t.parentId){n.add(t.parentId);for(let r of e)r.parentId===t.parentId&&n.add(r.id)}}}return n}function R0(e,t){return e.filter(e=>e.parentId===t).map(e=>e.id)}function z0(e){let t=new Map;for(let n of e){if(!n.parentId)continue;let e=(t.get(n.parentId)??!0)&&n.data.enabled===!1;t.set(n.parentId,e)}let n=new Set;for(let[e,r]of t)r&&n.add(e);return n}function B0(e){if(!e.some(e=>E0(e))||Zue(e))return e;let t=[],n=[],r=[];for(let i of e)E0(i)?t.push(i):i.parentId?n.push(i):r.push(i);return[...r,...t,...n]}function Zue(e){let t=`rest`;for(let n of e){let e=E0(n)?`groups`:n.parentId?`children`:`rest`;if(e!==t){if(t===`rest`&&e===`groups`){t=`groups`;continue}if(t===`groups`&&e===`children`){t=`children`;continue}return!1}}return!0}function Que(e){let t=new Map;for(let n of e)n.parentId&&t.set(n.parentId,(t.get(n.parentId)??0)+1);return e.filter(e=>E0(e)&&(t.get(e.id)??0)<2).map(e=>e.id)}function $ue(e,t,n){let r=U0(new Set(e),t,n),i=new Map;for(let t of e)i.set(t,[]);for(let e of t)i.get(e.target)?.push(e.source);let a=new Map;for(let e of r){let t=(i.get(e)??[]).filter(e=>a.has(e)).map(e=>a.get(e)??0);a.set(e,t.length===0?0:Math.max(...t)+1)}let o=new Map;return r.map(e=>{let t=a.get(e)??0,n=o.get(t)??0;return o.set(t,n+1),{id:e,row:t,column:n}})}function ede(e){return e.length===0?{rows:1,columns:1}:{rows:Math.max(...e.map(e=>e.row+1)),columns:Math.max(...e.map(e=>e.column+1))}}function V0(e,t,n){let r=$ue(e,t,n);return{slots:r,bounds:ede(r)}}function tde(e,t){if(e.data.type===`lifecycle`||e.data.type===`add`)return`Only lookup and Condition steps can be grouped`;if(E0(e)||e.parentId)return`Already in a group`;if(e.data.type!==`action`)return`Only lookup and Condition steps can be grouped`;let n=y0(e);return n?b0(e)?`Wait cannot be grouped`:S0(e)?`Event Split cannot be grouped`:Py(t,n)?.sideEffect?`A step that changes something outside the workflow stays outside the frame`:null:`Every step needs an action`}function H0(e,t,n){let r=new Map;for(let e of t){let t=r.get(e.source)??[];t.push(e.target),r.set(e.source,t)}let i=new Set,a=[...e];for(;a.length>0;){let e=a.pop();if(!(!e||i.has(e)||!n.has(e))){i.add(e);for(let t of r.get(e)??[])a.push(t)}}return i}function U0(e,t,n){let r=new Map,i=new Map;for(let t of e)r.set(t,0),i.set(t,[]);for(let n of t)!e.has(n.source)||!e.has(n.target)||(r.set(n.target,(r.get(n.target)??0)+1),i.get(n.source)?.push(n.target));let a=n.filter(t=>e.has(t)),o=[],s=new Set;for(;a.length>0;){let e=a.shift();if(!(!e||s.has(e))){s.add(e),o.push(e);for(let t of i.get(e)??[]){let e=(r.get(t)??1)-1;r.set(t,e),e===0&&a.push(t)}}}for(let t of e)s.has(t)||o.push(t);return o}function nde(e){let t=new Set,n=[];for(let r of e){let e=`${r.source}\0${r.sourceHandle??``}\0${r.target}\0${r.targetHandle??``}`;t.has(e)||(t.add(e),n.push(r))}return n.length===e.length?e:n}function W0(e){return e.data.type!==`lifecycle`&&e.type!==`add`}function rde(e,t){let n=e.find(e=>e.id===t);return!n||!W0(n)?new Set:n.selected?L0(e,new Set(e.filter(e=>e.selected&&W0(e)).map(e=>e.id))):L0(e,new Set([n.id]))}function ide(e){let t=e.nodes.filter(t=>W0(t)?e.nodeIds?e.nodeIds.has(t.id):!!t.selected:!1);if(t.length===0)return null;let n=L0(e.nodes,new Set(t.map(e=>e.id))),r=e.nodes.filter(e=>n.has(e.id)),i=e.edges.filter(e=>n.has(e.source)&&n.has(e.target));return{nodes:r.map(ode),edges:i.map(sde)}}function G0(e,t){let n=t.createId??l0,r=new Map;for(let t of e.nodes)r.set(t.id,n());let i=new Set(e.nodes.map(e=>e.id));return{nodes:e.nodes.map(e=>{let n=e.parentId,a=typeof n==`string`&&i.has(n),o=a?K0(r,n):void 0;return{...e,id:K0(r,e.id),parentId:o,position:a?e.position:{x:e.position.x+t.offset.x,y:e.position.y+t.offset.y},selected:!0,dragging:!1,data:{...e.data,config:cde(lde(e.data.config,r),r,e)}}}),edges:e.edges.map(e=>({...e,id:n(),source:K0(r,e.source),target:K0(r,e.target),selected:!0}))}}function ade(e,t){let n=new Set(e.map(e=>e.id)),r=e.filter(e=>!e.parentId||!n.has(e.parentId)),i=r.map(e=>e.position.x),a=r.map(e=>e.position.y);return{x:t.x-Math.min(...i),y:t.y-Math.min(...a)}}function K0(e,t){let n=e.get(t);if(n===void 0)throw Error(`cloneSelection expected extractCopyableSelection output`);return n}function ode(e){return{...K1(U1(e)),selected:!1,dragging:!1}}function sde(e){return{...q1(G1(e)),selected:!1}}function cde(e,t,n){if(!e||!E0(n))return e;let r={...e},i=Array.isArray(e.entryNodeIds)?e.entryNodeIds.map(e=>typeof e==`string`?t.get(e):void 0).filter(e=>typeof e==`string`):[],a=typeof e.exitNodeId==`string`?t.get(e.exitNodeId):void 0;return i.length>0&&(r.entryNodeIds=i),a&&(r.exitNodeId=a),r}function lde(e,t){return e&&h0(e,e=>{let n=t.get(e.nodeId);if(n)return m0({nodeId:n,nodeLabel:e.nodeLabel,fieldPath:e.fieldPath})})}function ude(e,t){return Py(e,t)?.integration}function q0(e,t,n){let r=g0(t.data.config,`actionType`);if(!r)return t;let i=ude(e,r);if(!i)return t;let a=g0(t.data.config,`integrationId`);if(a&&n.some(e=>e.id===a))return t;let o=n.filter(e=>e.type===i);return o.length===1?Y0(t,o[0].id):o.length===0&&a?Y0(t,void 0):t}function J0(e,t,n){let r=!1,i=t.map(t=>{let i=q0(e,t,n);return i!==t&&(r=!0),i});return r?i:t}function Y0(e,t){return{...e,data:{...e.data,config:{...e.data.config,integrationId:t}}}}var X0=jy(`workflow`,`save`),Z0=lA(null),Q0=lA(``),dde=lA(`private`),$0=lA(`live`),e2=lA(!0),t2=lA(null),n2=lA(!1),r2=lA(null),i2=lA(!1),a2=lA(!1),o2=lA(null),s2=lA(Pue);function c2(){My.invalidateQueries({queryKey:n0.workflow.getAll.key(),refetchType:`none`})}var fde=lA(1e3),pde=lA(()=>({timeoutId:null,pending:[],failedPatches:new Map,isFlushing:!1}));function l2(e){return e instanceof Error?e:Error(`Failed to save workflow`,{cause:e})}function mde(e){let{nodes:t,edges:n,...r}=e;return t&&n?{...r,nodes:t.filter(e=>e.type!==`add`),edges:n}:r}var u2=lA(null,async(e,t,n,r)=>{t(a2,!0),t(o2,null);let i=e(Z0);if(!i)return null;let a=e(pde),o=async()=>{if(!a.isFlushing){a.isFlushing=!0,t(i2,!0);try{for(;a.pending.length>0;){let n=a.pending.shift();if(!n)break;let r;try{let i=await e(s2).update(n.workflowId,mde(n.patch));r={ok:!0,workflow:i},t(o2,null),c2(),a0(My,i),!a.pending.some(e=>e.workflowId===n.workflowId)&&!a.failedPatches.has(n.workflowId)&&e(Z0)===n.workflowId&&t(a2,!1)}catch(e){let i=l2(e);r={ok:!1,error:i},t(o2,i);let o=a.pending.find(e=>e.workflowId===n.workflowId);o?o.patch={...n.patch,...o.patch}:a.failedPatches.set(n.workflowId,{...a.failedPatches.get(n.workflowId),...n.patch}),X0.error(`Save failed`,{workflowId:n.workflowId,error:e})}for(let e of n.waiters)e(r)}}finally{a.isFlushing=!1,t(i2,!1)}}},s=new Promise(e=>{let t=a.failedPatches.get(i),r=t?{...t,...n}:n;a.failedPatches.delete(i);let o=a.pending.at(-1);if(o?.workflowId===i){o.patch={...o.patch,...r},o.waiters.push(e);return}a.pending.push({workflowId:i,patch:r,waiters:[e]})});return a.timeoutId&&=(clearTimeout(a.timeoutId),null),r?.immediate?(await o(),await s):(a.timeoutId=setTimeout(()=>{a.timeoutId=null,o().catch(e=>{X0.error(`Save flush failed`,{error:e})})},e(fde)),await s)}),hde=lA(null,async(e,t,n)=>{t(Q0,n),t(t2,null);let r=await t(u2,{name:n});return r?.ok===!1?r.error:null}),gde=lA(null,async(e,t,n)=>await t(u2,{mode:n},{immediate:!0})),_de=lA(null,async(e,t,n)=>{try{let r=await e(s2).create({name:n.name,description:n.description??``,nodes:n.nodes.filter(e=>e.type!==`add`),edges:n.edges});return t(Z0,r.id),t(Q0,r.name),t(t2,null),t(a2,!1),t(o2,null),c2(),a0(My,r),{ok:!0,workflow:r}}catch(e){let n=l2(e);return t(o2,n),{ok:!1,error:n}}}),d2=`sidebar-width`,f2=`sidebar-collapsed`,vde=31536e3,yde=20,bde=50,xde=30;function p2(e){if(!(typeof document>`u`))return document.cookie.split(`; `).find(t=>t.startsWith(`${e}=`))?.split(`=`)[1]}function m2(e,t){document.cookie=`${e}=${t}; path=/; max-age=${vde}`}function Sde(){let e=Number.parseFloat(p2(d2)??``);return e>=yde&&e<=bde?e:xde}var h2=lA(`properties`),g2=lA(!1),_2=lA(!1),v2=lA(p2(f2)===`true`),y2=lA(e=>e(v2),(e,t,n)=>{let r=typeof n==`function`?n(e(v2)):n;t(v2,r),m2(f2,String(r))}),b2=lA(Sde()),x2=lA(e=>e(b2),(e,t,n)=>{t(b2,n),m2(d2,String(n))});function S2(e){return`min(max(${e}%, 320px), 460px)`}var Cde=lA(e=>e(y2)?null:S2(e(x2))),C2=lA(!1),w2=lA(!1),T2=lA(e=>e(h2)===`runs`&&e(e2)?`runs`:`properties`),E2=lA(null),D2=lA(e=>e(T2)===`runs`?e(E2):null,(e,t,n)=>{t(E2,n)});function wde(e){let t=new Map;for(let n of e.edges){let e=t.get(n.source);e?e.push(n.target):t.set(n.source,[n.target])}let n=[];for(let r of e.startIds)n.push(...t.get(r)??[]);let r=new Set;for(;n.length>0;){let e=n.pop();!e||r.has(e)||(r.add(e),n.push(...t.get(e)??[]))}return r}var O2=`started`,k2=`canceled`;function Tde(e){return e===`started`||e===`canceled`}var A2={nodeIds:new Set,outletEdgeIds:new Set};function Ede(e){let t=Dde(e),n=e.nodes.filter(e=>e.data.enabled===!1).map(e=>e.id);if(t.length===0&&n.length===0)return A2;let r=new Set(t.map(e=>e.target)),i=[...r,...n];for(let t of wde({startIds:i,edges:e.edges}))r.add(t);return Ode(e.nodes,r),r.size===0?A2:{nodeIds:r,outletEdgeIds:new Set(t.map(e=>e.id))}}function Dde(e){let t=e.nodes.filter(e=>e.data.type===`lifecycle`);if(t.length===0||t.some(e=>C1(e.data.config)))return[];let n=new Set(t.map(e=>e.id));return e.edges.filter(e=>n.has(e.source)&&e.sourceHandle===`canceled`)}function Ode(e,t){let n=new Map;for(let r of e){if(!r.parentId)continue;let e=t.has(r.id);n.set(r.parentId,(n.get(r.parentId)??!0)&&e)}for(let[e,r]of n)r&&t.add(e)}var j2=`payload`,kde=`event`,Ade=`$event.name`;function jde(e){return e===`within_next`||e===`more_than_from_now`||e===`less_than_ago`||e===`more_than_ago`}function Mde(e){return e===`before`||e===`after`}function M2(e){return jde(e.operator)}function N2(e){return Mde(e.operator)}function Nde(e){return e===`is_set`||e===`is_not_set`}function P2(e){return Nde(e.operator)}function F2(e,t=`rule`){return e.type===`timestamp`?{id:t,field:e.path,fieldType:`timestamp`,operator:`within_next`,amount:1,unit:`days`}:e.type===`number`?{id:t,field:e.path,fieldType:`number`,operator:`equals`,value:0}:e.type===`boolean`?{id:t,field:e.path,fieldType:`boolean`,operator:`is_true`}:{id:t,field:e.path,fieldType:`string`,operator:`equals`,value:``}}function Pde(e,t){let n=!1,r=e.groups.map(e=>({...e,conditions:e.conditions.map(e=>{let r=t.get(e.field);return!r||r.type===e.fieldType?e:(n=!0,F2(r,e.id))})}));return n?{...e,groups:r}:e}function I2(e,t){return{version:2,groupLogic:`and`,groups:[{id:t?.groupId??`group`,logic:`and`,conditions:[F2(e,t?.conditionId??`rule`)]}]}}var Fde=[{value:`and`,label:`AND`},{value:`or`,label:`OR`}],Ide=[{value:`within_next`,label:`is within the next`},{value:`more_than_from_now`,label:`is more than from now`},{value:`less_than_ago`,label:`is less than ago`},{value:`more_than_ago`,label:`is more than ago`},{value:`before`,label:`is before`},{value:`after`,label:`is after`}],L2=[{value:`minutes`,label:`minutes`},{value:`hours`,label:`hours`},{value:`days`,label:`days`},{value:`weeks`,label:`weeks`}],Lde=[{value:`equals`,label:`equals`},{value:`not_equals`,label:`does not equal`},{value:`contains`,label:`contains`}],Rde=[{value:`equals`,label:`equals`},{value:`not_equals`,label:`does not equal`},{value:`greater_than`,label:`is greater than`},{value:`greater_or_equal`,label:`is greater than or equal`},{value:`less_than`,label:`is less than`},{value:`less_or_equal`,label:`is less than or equal`}],zde=[{value:`is_true`,label:`is true`},{value:`is_false`,label:`is false`}],Bde=[{value:`is_set`,label:`is set`},{value:`is_not_set`,label:`is not set`}],Vde=RegExp(`^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|(?:[+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$`),R2=yh.check(Tee(Vde)).pipe(Mh(Mee,Vf)),Hde=ah(R2);ch(R2);var Ude=dh(R2);function z2(e){return Rc(Hde(e.trim()))}function Wde(e){return Ude(e)}function B2(e){return yh.annotate({message:e}).pipe(Mh(yh,Lf())).check(Lh(1).annotate({message:e})).annotateKey({messageMissingKey:e})}function V2(e,t){return e.annotate({message:t}).annotateKey({messageMissingKey:t})}function H2(e){return{id:B2(`Condition id is required`),field:B2(`Condition field is required`),fieldType:hh(e)}}function U2(e,t){return Ch({...H2(e),operator:V2(Ah([`is_set`,`is_not_set`]),t)})}var W2=`Timestamp operator is invalid`,G2=`Timestamp amount must be a positive integer`,K2=`Timestamp absolute operators require a valid date-time`,q2=`String operator is invalid`,J2=`Number operator is invalid`,Y2=`Number conditions require a finite numeric value`,X2=`Boolean operator is invalid`;function Gde(e){return z2(e)!==null}var Kde=[Ch({...H2(`timestamp`),operator:V2(Ah([`within_next`,`more_than_from_now`,`less_than_ago`,`more_than_ago`]),W2),amount:V2(bh,G2).check(Ih().annotate({message:G2}),kee().annotate({message:G2}),Oee(0).annotate({message:G2})),unit:V2(Ah([`minutes`,`hours`,`days`,`weeks`]),`Timestamp unit is invalid`)}),Ch({...H2(`timestamp`),operator:V2(Ah([`before`,`after`]),W2),dateTime:yh.annotate({message:K2}).pipe(Mh(yh,Lf())).check(Nh(e=>Gde(e)?void 0:K2)).annotateKey({messageMissingKey:K2})}),U2(`timestamp`,W2),Ch({...H2(`string`),operator:V2(Ah([`equals`,`not_equals`,`contains`]),q2),value:V2(yh,`String conditions require a text value`)}),U2(`string`,q2),Ch({...H2(`number`),operator:V2(Ah([`equals`,`not_equals`,`greater_than`,`greater_or_equal`,`less_than`,`less_or_equal`]),J2),value:V2(bh,Y2).check(Ih().annotate({message:Y2}))}),U2(`number`,J2),Ch({...H2(`boolean`),operator:V2(Ah([`is_true`,`is_false`]),X2)}),U2(`boolean`,X2)],qde=wh(yh,gh).annotate({message:`Condition must be an object`}).pipe(Mh(kh(Kde).annotate({message:`Condition field type is invalid`}))),Z2=`Each group must contain at least one condition`,Jde=Ch({id:B2(`Group id is required`),logic:V2(Ah([`and`,`or`]),`Group logic is invalid`),conditions:V2(Dh(Eh(qde)),Z2).check(Lh(1).annotate({message:Z2}))}).annotate({message:`Group must be an object`}),Q2=`Condition model must contain at least one group`,Yde=oh(Ch({version:V2(hh(2),`Condition model version must be 2`),groupLogic:V2(Ah([`and`,`or`]),`Condition model group logic is invalid`),groups:V2(Dh(Eh(Jde)),Q2).check(Lh(1).annotate({message:Q2}))}).annotate({message:`Condition model must be an object`})),Xde=df();function Zde(e){let t=e.path?.at(-1);if(t!=null)return typeof t==`object`?t.key:t}function Qde(e){return(e.find(e=>Zde(e)!==`operator`)??e[0])?.message}function $2(e){let t=e;if(typeof e==`string`){let n=e.trim();if(!n)return{valid:!1,error:`Condition model is empty`};try{t=JSON.parse(n)}catch{return{valid:!1,error:`Condition model must be valid JSON`}}}let n=Yde(t);if(Uc(n)){let{issues:e}=Xde(n.failure.issue);return{valid:!1,error:Qde(e)??`Condition model is invalid`}}return{valid:!0,model:n.success}}function e4(e){return JSON.stringify(e)}function t4(e){return JSON.stringify(e)}function n4(e){return e===`and`||e===`or`}function $de(e){return typeof e==`number`&&Number.isFinite(e)&&Number.isInteger(e)&&e>0}function efe(e){return e===`minutes`||e===`hours`||e===`days`||e===`weeks`}function tfe(e){return z2(e)!==null}function nfe(e){switch(e){case`equals`:return`==`;case`not_equals`:return`!=`;case`greater_than`:return`>`;case`greater_or_equal`:return`>=`;case`less_than`:return`<`;case`less_or_equal`:return`<=`;default:return`==`}}function rfe(e,t){if(M2(e)){let n=e.amount;if(!$de(n))return{valid:!1,error:`Timestamp amount must be a positive integer`,incomplete:!0};if(!efe(e.unit))return{valid:!1,error:`Timestamp unit is invalid`};let r=e.unit;return e.operator===`within_next`?{valid:!0,expression:`${t} > now && ${t} < now + ${r}(${n})`}:e.operator===`more_than_from_now`?{valid:!0,expression:`${t} > now + ${r}(${n})`}:e.operator===`less_than_ago`?{valid:!0,expression:`${t} > now - ${r}(${n})`}:{valid:!0,expression:`${t} < now - ${r}(${n})`}}if(!tfe(e.dateTime))return{valid:!1,error:`Timestamp absolute operators require a valid date-time`,incomplete:!0};let n=t4(e.dateTime.trim());return e.operator===`before`?{valid:!0,expression:`${t} < date(${n})`}:{valid:!0,expression:`${t} > date(${n})`}}function ife(e,t){if(!e.value.trim())return{valid:!1,error:`Text conditions require a value`,incomplete:!0};let n=t4(e.value);return e.operator===`equals`?{valid:!0,expression:`${t} == ${n}`}:e.operator===`not_equals`?{valid:!0,expression:`${t} != ${n}`}:{valid:!0,expression:`${t}.contains(${n})`}}function afe(e,t){return Number.isFinite(e.value)?{valid:!0,expression:`${t} ${nfe(e.operator)} ${e.value}`}:{valid:!1,error:`Number conditions require a finite numeric value`,incomplete:!0}}function ofe(e,t){return e.operator===`is_true`?{valid:!0,expression:`${t} == true`}:{valid:!0,expression:`${t} == false`}}function sfe(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)}function cfe(e){let t=Wue(e);if(!t)return null;if(t.every(e=>e.kind===`key`&&sfe(e.key))){let e=t.map(e=>e.key);return{field:`${j2}.${e.join(`.`)}`,presence:e.map((t,n)=>`has(${j2}.${e.slice(0,n+1).join(`.`)})`).join(` && `)}}let n=j2,r=[];for(let e of t)if(e.kind===`key`){let t=t4(e.key);r.push(`${t} in ${n}`),n=`${n}[${t}]`}else r.push(`size(${n}) > ${e.index}`),n=`${n}[${e.index}]`;return{field:n,presence:r.join(` && `)}}function lfe(e,t){return e.operator===`is_set`?{valid:!0,expression:t}:{valid:!0,expression:`!(${t})`}}function r4(e,t){return e.fieldType===`timestamp`?rfe(e,t):e.fieldType===`string`?ife(e,t):e.fieldType===`number`?afe(e,t):ofe(e,t)}function ufe(e){let t=`${kde}.name`;return P2(e)?{valid:!0,expression:e.operator===`is_set`?`${t} != null`:`${t} == null`}:r4(e,t)}function dfe(e){let t=e.field.trim();if(!t)return{valid:!1,error:`Condition field is required`};if(t===`$event.name`)return ufe(e);let n=cfe(t);if(!n)return{valid:!1,error:`Condition field path is invalid`};let{field:r,presence:i}=n;if(P2(e))return lfe(e,i);let a=r4(e,r);return a.valid?{valid:!0,expression:`${i} && (${a.expression})`}:a}function ffe(e){if(e.conditions.length===0)return{valid:!1,error:`Each group must contain at least one condition`};let t=[];for(let n of e.conditions){let e=dfe(n);if(!e.valid)return e;t.push(`(${e.expression})`)}let n=e.logic===`and`?` && `:` || `;return{valid:!0,expression:t.join(n)}}function i4(e){if(!n4(e.groupLogic))return{valid:!1,error:`Condition model group logic is invalid`};if(e.groups.length===0)return{valid:!1,error:`Condition model must contain at least one group`};let t=[];for(let n of e.groups){if(!n4(n.logic))return{valid:!1,error:`Group logic is invalid`};let e=ffe(n);if(!e.valid)return e;t.push(`(${e.expression})`)}let n=e.groupLogic===`and`?` && `:` || `;return{valid:!0,expression:t.join(n)}}function pfe(e){let t=$2(e);return t.valid?i4(t.model):{valid:!1,error:t.error}}var a4=Ch({event:Bh,match:mh(yh)}),mfe=Dh(Eh(a4)).check(Lh(1)),hfe=Ch({waitMode:mh(Ah([`delay`,`event`])),waitFor:mh(mfe),waitTimeout:mh(yh),waitTimeoutBehavior:mh(Ah([`continue`,`skip`])),waitDuration:mh(yh),waitUntil:mh(yh),waitOffset:mh(yh),waitGateMode:mh(Ah([`off`,`require_actual_wait`])),waitAllowedHoursMode:mh(yh),waitAllowedStartTime:mh(yh),waitAllowedEndTime:mh(yh),waitTimezone:mh(yh)}),o4={waitDuration:{type:`duration`,required:!0,owner:{mode:`delay`,timing:`duration`}},waitUntil:{type:`timestamp`,required:!0,owner:{mode:`delay`,timing:`until`}},waitOffset:{type:`duration`,required:!1,owner:{mode:`delay`,timing:`until`}},waitTimeout:{type:`duration`,required:!0,owner:{mode:`event`}}},s4=[`waitDuration`,`waitUntil`,`waitOffset`,`waitTimeout`];function c4(e){let t=e.waitDelayTimingMode;return t===`until`||t===`duration`?t:typeof e.waitUntil==`string`&&e.waitUntil.trim()?`until`:`duration`}function gfe(e){let t=e.waitMode===`event`?`event`:`delay`,n=c4(e);return s4.filter(e=>{let{owner:r}=o4[e];return r.mode===`event`?t===`event`:t===`delay`&&r.timing===n})}function l4(e){let t=new Set(gfe(e));return s4.filter(e=>!t.has(e))}oh(hfe);var _fe=Wh(Dh(Eh(a4)));function u4(e){return _fe(e?.waitFor)??[]}var vfe=/^([01]\d|2[0-3]):([0-5]\d)$/;function d4(e){return typeof e==`string`&&e.trim()===`daily_window`?`daily_window`:`off`}function f4(e){if(typeof e!=`string`)return null;let t=e.trim(),n=vfe.exec(t);if(!n)return null;let[,r,i]=n;return r&&i?Number.parseInt(r,10)*60+Number.parseInt(i,10):null}function yfe(e){let t=[],n=typeof e.mode==`string`?e.mode.trim():d4(e.mode);if(n.length>0&&n!==`off`&&n!==`daily_window`)return t.push({field:`mode`,message:`Allowed-hours mode must be either "off" or "daily_window".`}),t;if(n!==`daily_window`)return t;let r=f4(e.startTime);r===null&&t.push({field:`start`,message:`Allowed-hours start must use HH:MM (24-hour) format.`});let i=f4(e.endTime);return i===null&&t.push({field:`end`,message:`Allowed-hours end must use HH:MM (24-hour) format.`}),r!==null&&i!==null&&r>=i&&t.push({field:`window`,message:`Allowed-hours start must be earlier than end (same-day window only).`}),t}function bfe(e){return e.type===`group`&&`fields`in e&&Array.isArray(e.fields)}function p4(e){return e==null||typeof e==`string`&&e.trim().length===0}function xfe(e){let t=[];for(let n of e){if(bfe(n)){t.push(...n.fields);continue}t.push(n)}return t}function Sfe(e){let{config:t,configFields:n}=e;return xfe(n).filter(e=>e.required===!0&&u0(t,e.showWhen)&&p4(t[e.key])).map(e=>({fieldKey:e.key,fieldLabel:e.label}))}function Cfe(e){return OQ(e.waitMode)===`event`?`event`:`delay`}function wfe(e){if(Cfe(e)===`event`){let t=[];u4(e).length===0&&t.push({fieldKey:`waitFor`,fieldLabel:`Wait for these events`});for(let n of u4(e)){let e=OQ(n.match);if(!e)continue;let r=pfe(e);!r.valid&&r.incomplete&&t.push({fieldKey:`waitFor`,fieldLabel:`Match value for "${n.event}"`})}return p4(e.waitTimeout)&&t.push({fieldKey:`waitTimeout`,fieldLabel:`Stop waiting after`}),t}let t=[];if(c4(e)===`until`?p4(e.waitUntil)&&t.push({fieldKey:`waitUntil`,fieldLabel:`Wait until this date/time`}):p4(e.waitDuration)&&t.push({fieldKey:`waitDuration`,fieldLabel:`Wait for (duration)`}),OQ(e.waitAllowedHoursMode)===`daily_window`){let n=OQ(e.waitAllowedStartTime);(!n||f4(n)===null)&&t.push({fieldKey:`waitAllowedStartTime`,fieldLabel:`Window start (HH:MM)`});let r=OQ(e.waitAllowedEndTime);(!r||f4(r)===null)&&t.push({fieldKey:`waitAllowedEndTime`,fieldLabel:`Window end (HH:MM)`}),p4(e.waitTimezone)&&t.push({fieldKey:`waitTimezone`,fieldLabel:`Timezone`})}return t}function Tfe(e){let{actionType:t,config:n}=e;switch(t){case y1.condition:return p4(n.condition)?[{fieldKey:`condition`,fieldLabel:`Condition`}]:[];case y1.wait:return wfe(n);default:return[]}}function m4(e){let{node:t,actionType:n,actionLabel:r}=e;return OQ(t.data.label)||r||n||t.id}function Efe(e){let{node:t,resolveActionByType:n}=e;if(t.data.type!==`action`||t.data.enabled===!1)return null;let r=t.data.config??{},i=OQ(r.actionType);if(!i)return{nodeId:t.id,nodeLabel:m4({node:t}),missingFields:[{fieldKey:`actionType`,fieldLabel:`Action`}]};let a=n(i),o=Tfe({actionType:i,config:r}),s=a?Sfe({config:r,configFields:a.configFields??[]}):[],c=[...o,...s];return c.length===0?null:{nodeId:t.id,nodeLabel:m4({node:t,actionType:i,actionLabel:a?.label}),missingFields:c}}function Dfe(e){let{nodes:t,resolveActionByType:n}=e;return t.map(e=>Efe({node:e,resolveActionByType:n})).filter(e=>e!==null)}function h4(e){return e.type===`group`}function Ofe(e){let t=[];for(let n of e)h4(n)?t.push(...n.fields):t.push(n);return t}function kfe(e){return t=>Py(e,t)}function g4(e){return OQ(e.node.data.label)||(e.actionLabel?e.actionLabel:e.actionType?e.actionType:e.node.id)}function Afe(e){return Dfe({nodes:e.nodes,resolveActionByType:kfe(e.catalog)}).flatMap(e=>e.missingFields.map(t=>({kind:`missing_required_field`,severity:`blocking`,nodeId:e.nodeId,nodeLabel:e.nodeLabel,fieldKey:t.fieldKey,fieldLabel:t.fieldLabel,message:`Node "${e.nodeLabel}" is missing required field "${t.fieldLabel}"`})))}function jfe(e){let t=new Set(e.integrations.map(e=>e.id)),n=[];for(let r of e.nodes){if(r.data.type!==`action`||r.data.enabled===!1)continue;let i=v0(r.data.config,`actionType`);if(!i)continue;let a=Py(e.catalog,i),o=a?.integration;if(!o)continue;let s=v0(r.data.config,`integrationId`);if(s&&t.has(s))continue;let c=Fy(e.catalog,o)?.label??o,l=g4({node:r,actionLabel:a?.label,actionType:i});n.push({kind:`missing_integration`,severity:`blocking`,nodeId:r.id,nodeLabel:l,integrationType:o,integrationLabel:c,message:`Node "${l}" needs a ${c} connection`})}return n}function Mfe(e){return typeof e==`string`?f0(e).map(e=>({nodeId:e.nodeId,displayText:e.fieldPath?`${e.nodeLabel}.${e.fieldPath}`:e.nodeLabel})):[]}function _4(e,t=``){let n=[];for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;if(typeof i==`string`){for(let t of Mfe(i))n.push({field:e,...t});continue}if(typeof i==`object`&&i&&!Array.isArray(i)){let t={...i};n.push(..._4(t,e))}}return n}function Nfe(e){let t=new Set(e.nodes.map(e=>e.id)),n=[];for(let r of e.nodes){if(r.data.enabled===!1)continue;let i=r.data.config;if(!i||typeof i!=`object`)continue;let a=_4(i).filter(e=>!t.has(e.nodeId));if(a.length===0)continue;let o=v0(i,`actionType`),s=o?Py(e.catalog,o):void 0,c=s?Ofe(s.configFields):[],l=g4({node:r,actionLabel:s?.label,actionType:o});for(let e of a){let t=c.find(t=>t.key===e.field)?.label??e.field;n.push({kind:`broken_reference`,severity:`warning`,nodeId:r.id,nodeLabel:l,fieldKey:e.field,fieldLabel:t,referencedNodeId:e.nodeId,displayText:e.displayText,message:`Node "${l}" references missing step in ${t}`})}}return n}function v4(e){return[...Afe(e),...jfe(e),...Nfe(e)]}function y4(e){return e.some(e=>e.severity===`blocking`)}function b4(e){let t=new Map,n=new Map,r=new Map;for(let i of e)switch(i.kind){case`missing_required_field`:{let e=t.get(i.nodeId);if(e){e.missingFields.push({fieldKey:i.fieldKey,fieldLabel:i.fieldLabel});break}t.set(i.nodeId,{nodeId:i.nodeId,nodeLabel:i.nodeLabel,missingFields:[{fieldKey:i.fieldKey,fieldLabel:i.fieldLabel}]});break}case`broken_reference`:{let e=n.get(i.nodeId);if(e){e.brokenReferences.push({fieldKey:i.fieldKey,fieldLabel:i.fieldLabel,referencedNodeId:i.referencedNodeId,displayText:i.displayText});break}n.set(i.nodeId,{nodeId:i.nodeId,nodeLabel:i.nodeLabel,brokenReferences:[{fieldKey:i.fieldKey,fieldLabel:i.fieldLabel,referencedNodeId:i.referencedNodeId,displayText:i.displayText}]});break}case`missing_integration`:{let e=r.get(i.integrationType);if(e){e.nodeNames.includes(i.nodeLabel)||e.nodeNames.push(i.nodeLabel);break}r.set(i.integrationType,{integrationType:i.integrationType,integrationLabel:i.integrationLabel,nodeNames:[i.nodeLabel]});break}default:throw Error(`Unhandled workflow issue`)}return{missingRequiredFields:Array.from(t.values()),missingIntegrations:Array.from(r.values()),brokenReferences:Array.from(n.values())}}var x4=[],S4=lA(x4),Pfe=lA(e=>{let t=qa(e(S4),e=>e.nodeId),n=new Map(Object.entries(t).map(([e,t])=>{let n=Rfe(t),r=C4.get(e);return[e,r&&Ffe(r,n)?r:n]}));return C4=n,n}),C4=new Map;function Ffe(e,t){return e.severity===t.severity&&e.messages.length===t.messages.length&&e.messages.every((e,n)=>e===t.messages[n])}var Ife=lA(e=>y4(e(S4))),Lfe=new Map;function Rfe(e){return{severity:e.some(e=>e.severity===`blocking`)?`blocking`:`warning`,messages:e.map(e=>e.message)}}function zfe(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.kind===r.kind&&e.nodeId===r.nodeId&&e.message===r.message})}function w4(e=192){return{width:e,height:112}}function T4(e,t){let n=Math.max(e,1),r=Math.max(t,1);return{width:12+n*188+(n-1)*24+12,height:48+r*56+(r-1)*40+12}}var Bfe=132;function E4(e){return e>1?e*Bfe:192}var D4=`size-5`,Vfe=324/212,Hfe=200/96;function Ufe(e){let t=N0(e.nodes,e.edges,e.selectedIds,e.catalog);if(!t.ok)return null;let n=new Map(e.nodes.map(e=>[e.id,e])),r=t.memberIds.map(e=>{let t=n.get(e);if(!t)throw Error(`groupSelection expected analyzeGroupableSelection ids`);return t}),i={x:Math.min(...r.map(e=>e.position.x)),y:Math.min(...r.map(e=>e.position.y))},a=new Set(t.memberIds),o=e.edges.filter(e=>M0(a,e)),{slots:s,bounds:c}=V0(t.memberIds,o,t.entryIds),l=T4(c.columns,c.rows),u=(e.createId??l0)(),d=P4(s,c.columns),f=n.get(t.exitId),p={id:u,type:`group`,position:i,width:l.width,height:l.height,style:{width:l.width,height:l.height},selected:!0,data:{label:`Group`,type:`group`,config:{entryNodeIds:t.entryIds,exitNodeId:t.exitId,...x0(f)?{outletHandle:`true`}:{}}}},m=r.some(e=>e.data.enabled===!1),h=r.map(e=>I4(m?{...e,data:{...e.data,enabled:!1}}:e,u,F4(d,e.id)));return{nodes:B0([...e.nodes.filter(e=>!a.has(e.id)).map(e=>({...e,selected:!1})),p,...h]),edges:Yfe({edges:e.edges,entryIds:t.entryIds,createEdgeId:e.createEdgeId??l0}),analysis:t}}function O4(e,t){let n=e.find(e=>e.id===t);return!n||!E0(n)?e:B0(e.flatMap(e=>e.id===t?[]:e.parentId===t?[Zfe(e,Xfe(n,e))]:[e]))}function Wfe(e,t){let n=new Map;for(let t of e){if(!t.parentId)continue;let e=n.get(t.parentId)??[];e.push(t),n.set(t.parentId,e)}if(n.size===0)return e;let r=new Map,i=new Map;for(let[a,o]of n){let n=e.find(e=>e.id===a),s=o.map(e=>e.id),c=new Set(s),{slots:l,bounds:u}=V0(s,t.filter(e=>M0(c,e)),D0(n));i.set(a,T4(u.columns,u.rows));let d=P4(l,u.columns);for(let e of o)r.set(e.id,I4(e,a,F4(d,e.id)))}return e.map(e=>{if(E0(e)){let t=i.get(e.id);return t?{...e,width:t.width,height:t.height,style:{...e.style,width:t.width,height:t.height}}:e}return r.get(e.id)??e})}var k4=new WeakMap;function Gfe(e,t){let n=new Map(e.map(e=>[e.id,e.parentId])),r=e=>n.get(e),i=!1,a=t.map(e=>{if(!j0(r,e))return e;i=!0;let t=k4.get(e);if(t)return t;let n={...e,selectable:!1,deletable:!1,focusable:!1};return k4.set(e,n),n});return i?a:t}function A4(e){let t=e;for(let e of Que(t))t=O4(t,e);return t}function j4(e){let t=new Set(e.filter(e=>E0(e)).map(e=>e.id));return e.some(e=>e.parentId&&!t.has(e.parentId))?`Ungroup the frame before deleting a step inside it`:null}function M4(e){let t=j4(e);return t&&Ty.error(t),t}function N4(e){return!!(e&&(E0(e)||e.parentId))}function Kfe(e,t){let n=new Set([t]);if(E0(e.find(e=>e.id===t)))for(let r of R0(e,t))n.add(r);return n}function qfe(e,t,n){let r=new Set;for(let i of n)if(i.type===`remove`)for(let n of F0(e,t,i.id))r.add(n);return r.size===0?n:[...n.filter(e=>e.type!==`remove`),...[...r].map(e=>({type:`remove`,id:e}))]}function Jfe(e,t){let n=new Set(e.map(e=>e.id)),r=t.filter(e=>n.has(e.source)&&n.has(e.target));return r.length===t.length?t:r}function Yfe(e){let{edges:t,entryIds:n,createEdgeId:r}=e,i=new Set(n),a=t.filter(e=>i.has(e.target)),o=[],s=new Set;for(let e of a){let t=A0(e);s.has(t)||(s.add(t),o.push(e))}if(o.length!==1)return t;let c=o[0];if(!c)return t;let l=A0(c),u=new Set(t.filter(e=>A0(e)===l).map(e=>e.target)),d=[];for(let e of n)u.has(e)||d.push({id:r(),source:c.source,target:e,sourceHandle:c.sourceHandle,targetHandle:c.targetHandle});return d.length===0?t:[...t,...d]}function P4(e,t){let n=new Map;for(let t of e)n.set(t.row,(n.get(t.row)??0)+1);let r=new Map;for(let i of e){let e=(t-(n.get(i.row)??1))*212/2;r.set(i.id,{x:12+e+i.column*212,y:48+i.row*96})}return r}function F4(e,t){let n=e.get(t);if(!n)throw Error(`Group layout has no slot for member '${t}'`);return n}function I4(e,t,n){return{...e,parentId:t,extent:`parent`,draggable:!1,connectable:!1,selected:!1,width:188,height:56,position:n}}function Xfe(e,t){if(typeof e.width!=`number`)throw Error(`Group '${e.id}' has no width to ungroup around`);let n=e.position.x+e.width/2,r=e.position.x+t.position.x+94,i=t.position.y-36-12;return{x:n+(r-n)*Vfe-96,y:e.position.y+i*Hfe}}function Zfe(e,t){let{extent:n,parentId:r,...i}=e;return{...i,draggable:!0,connectable:!0,width:192,height:112,position:t}}var L4=lA([]),R4=lA([]),z4=lA(null),B4=lA(e=>e(T2)===`runs`?e(z4):null,(e,t,n)=>{t(z4,n===null?null:{nodes:B0(n.nodes),edges:n.edges})}),V4=lA(null),H4=lA(null),U4=lA([]),W4=lA([]);function G4(e){return e(B4)===null}function K4(e,t){let n={nodes:e(L4),edges:e(R4)};t(U4,[...e(U4),n].slice(-50)),t(W4,[])}function q4(e,t,n){t(u2,{nodes:e(L4),edges:e(R4)},n)}var J4=lA(null,(e,t,n)=>{if(!G4(e))return!1;let r=e(L4),i=n.selectedIds??new Set(r.filter(e=>e.selected).map(e=>e.id)),a=Ufe({nodes:r,edges:e(R4),selectedIds:i,catalog:n.catalog});return a?(K4(e,t),t(L4,a.nodes),t(R4,a.edges),t(V4,a.nodes.find(e=>E0(e)&&e.selected)?.id??null),t(H4,null),q4(e,t,{immediate:!0}),!0):!1}),Y4=lA(null,(e,t,n)=>{if(!G4(e))return!1;let r=e(L4),i=r.find(e=>e.id===n),a=E0(i)?n:i?.parentId;if(!a)return!1;let o=O4(r,a);return o!==r&&(K4(e,t),t(L4,o),t(V4,null),t(H4,null),q4(e,t,{immediate:!0}),!0)}),Qfe=lA(null,(e,t,n)=>{if(!G4(e))return!1;let r=e(L4),i=new Set(R0(r,n.groupId));return i.size!==0&&(K4(e,t),t(L4,r.map(e=>i.has(e.id)?{...e,data:{...e.data,enabled:n.enabled}}:e)),q4(e,t),!0)}),$fe=lA(null,(e,t,n)=>{if(!G4(e))return;let r=e(L4),i=k0(r.find(e=>e.id===n.source))??n.sourceHandle,a=e(R4),o=P0({nodes:r,edges:a,sourceId:n.source,targetId:n.target,sourceHandle:i}).map((e,t)=>({...n,id:t===0?n.id:l0(),source:e.source,target:e.target,sourceHandle:e.sourceHandle}));o.length!==0&&(K4(e,t),t(R4,[...a,...o]),q4(e,t,{immediate:!0}))}),X4=lA(null,(e,t,n)=>{if(!G4(e))return;let r=e(R4),i=new Set(F0(e(L4),r,n));if(i.size===0)return;let a=r.filter(e=>!i.has(e.id));a.length!==r.length&&(K4(e,t),t(R4,a),e(H4)&&i.has(e(H4)??``)&&t(H4,null),q4(e,t,{immediate:!0}))}),Z4=lA(e=>e(L4)),Q4=lA(e=>e(R4)),$4=lA(new Map),e3=lA(e=>e(B4)!==null),t3=lA(e=>e(w2)||e(e3)),n3=lA(e=>Ede({nodes:e(B4)?.nodes??e(L4),edges:e(B4)?.edges??e(R4)})),epe={opacity:.5},r3=new WeakMap,tpe=lA(e=>{let t=e(B4),n=t?.nodes??e(L4),r=e($4),{nodeIds:i}=e(n3),a=B0(n),o=z0(n),s=t?Lfe:e(Pfe);if(r.size===0&&i.size===0&&o.size===0&&s.size===0)return a;let c=r.size>0;return a.map(e=>{let t=o.has(e.id),n=i.has(e.id)&&!t&&e.data.enabled!==!1,a=s.get(e.id);if(!(c||t||n||a))return e;let l=c?r.get(e.id)??`idle`:void 0,u=r3.get(e);if(u&&u.status===l&&u.disabledFrame===t&&u.muted===n&&u.issues===a)return u.painted;let d={...e,data:{...e.data,...l?{status:l}:{},...t?{enabled:!1}:{},...a?{issues:a}:{}}},f=n?{...d,style:{...d.style,...epe}}:d;return r3.set(e,{status:l,disabledFrame:t,muted:n,issues:a,painted:f}),f})}),npe=lA(e=>{let t=e(B4)?.nodes??e(L4),n=Gfe(t,I0(t,e(B4)?.edges??e(R4))),{nodeIds:r,outletEdgeIds:i}=e(n3);return r.size===0?n:n.map(e=>r.has(e.target)?{...e,data:{...e.data,inactive:!0,...i.has(e.id)?{displayLabel:`No Cancel Event`}:{}}}:e)}),i3=lA(null),a3=lA(null),o3=lA(!1),rpe=lA(null,(e,t,n)=>{t(L4,B0(n.nodes)),t(R4,n.edges),t(U4,[]),t(W4,[]),t(V4,null),t(H4,null),t(i3,null),t(a2,!1),t(S4,x4)}),ipe=lA(null,(e,t,n)=>{t(rpe,{nodes:n.nodes.map(e=>({...e,selected:!1})),edges:n.edges}),t($4,new Map),t(B4,null),t(D2,null),t(Z0,n.id),t(Q0,n.name),t(dde,n.visibility??`private`),t($0,n.mode??`live`),t(e2,n.isOwner!==!1),t(n2,!1),t(r2,null)}),ape=lA(null,(e,t,n)=>{if(!G4(e))return;let r=e(L4),i=J0(n.catalog,r,n.integrations);i!==r&&(t(L4,i),q4(e,t))}),ope=lA(null,(e,t)=>{G4(e)&&K4(e,t)}),spe=lA(null,(e,t)=>{G4(e)&&(t(L4,e(L4).map(e=>({...e,selected:!1}))),t(R4,e(R4).map(e=>({...e,selected:!1}))),t(V4,null),t(H4,null))}),cpe=lA(null,(e,t,n)=>{G4(e)&&(t(L4,e(L4).map(e=>({...e,selected:e.id===n}))),t(V4,n),t(H4,null))}),lpe=lA(null,(e,t,n)=>{if(!G4(e))return;let r=e(L4),i=n.filter(e=>e.type!==`remove`||r.find(t=>t.id===e.id)?.data.type!==`lifecycle`),a=i.some(e=>e.type===`remove`),o=i.some(e=>e.type===`position`&&e.dragging===!0),s=i.some(e=>e.type===`position`&&e.dragging===!1);o&&!e(o3)&&(K4(e,t),t(o3,!0)),s&&t(o3,!1);let c=A4(bE(i,r));if(t(L4,c),a){let n=Jfe(c,e(R4));t(R4,n);let r=e(H4);r&&!n.some(e=>e.id===r)&&t(H4,null)}let l=c.find(e=>e.selected);if(l){t(V4,l.id),t(H4,null);let n=e(i3);n&&n!==l.id&&t(i3,null)}else if(e(V4)){let n=e(V4);c.find(e=>e.id===n)||t(V4,null),t(i3,null)}a?q4(e,t,{immediate:!0}):s&&q4(e,t)}),upe=lA(null,(e,t,n)=>{if(!G4(e))return;let r=n.some(e=>e.type===`remove`),i=e(R4),a=xE(qfe(e(L4),i,n),i);t(R4,a);let o=a.find(e=>e.selected);if(o)t(H4,o.id),t(V4,null);else if(e(H4)){let n=e(H4);a.find(e=>e.id===n)||t(H4,null)}r&&q4(e,t,{immediate:!0})});function s3(e,t,n){let r=n.nodes.map(e=>({...e,selected:!0})),i=n.edges.map(e=>({...e,selected:!0}));K4(e,t),t(L4,B0([...e(L4).map(e=>({...e,selected:!1})),...r])),t(R4,[...e(R4).map(e=>({...e,selected:!1})),...i]),t(V4,r[0].id),t(H4,null);let a=r.length===1?r[0]:void 0;a?.data.type===`action`&&!a.data.config?.actionType?t(i3,a.id):t(i3,null),q4(e,t,{immediate:!0})}function c3(e,t){let n=e(L4);return ide({nodes:n,edges:e(R4),nodeIds:t?rde(n,t):void 0})}var l3=lA(null,(e,t,n)=>{G4(e)&&s3(e,t,{nodes:[n],edges:[]})}),dpe=lA(e=>e(a3)!==null),u3=lA(null,(e,t,n)=>{let r=c3(e,n);return r?(t(a3,{selection:r,pasteCount:0}),!0):!1}),d3=lA(null,(e,t,n)=>{if(!G4(e))return!1;let r=e(a3);if(!r)return!1;let i=r.pasteCount+1,a=n?ade(r.selection.nodes,n):{x:48*i,y:48*i};return t(a3,{...r,pasteCount:i}),s3(e,t,G0(r.selection,{offset:a})),!0}),f3=lA(null,(e,t,n)=>{if(!G4(e))return!1;let r=c3(e,n);return r?(s3(e,t,G0(r,{offset:{x:48,y:48}})),!0):!1}),fpe=lA(null,(e,t,n)=>{G4(e)&&(K4(e,t),t(L4,n),q4(e,t,{immediate:!0}))}),p3=lA(null,(e,t,{id:n,data:r})=>{if(!G4(e))return;let i=e(L4);K4(e,t);let a=i.find(e=>e.id===n)?.data.label,o=r.label,s=o!==void 0&&a!==o;t(L4,i.map(e=>{if(e.id===n)return{...e,data:{...e.data,...r}};if(s&&a){let t=ppe(e.data.config||{},n,a,o);if(t!==e.data.config)return{...e,data:{...e.data,config:t}}}return e})),q4(e,t)});function ppe(e,t,n,r){return h0(e,e=>{if(e.nodeId===t&&e.nodeLabel===n)return m0({nodeId:t,nodeLabel:r,fieldPath:e.fieldPath})})}var m3=lA(null,(e,t,n)=>{if(!G4(e))return;let r=e(L4),i=r.find(e=>e.id===n);if(i?.data.type===`lifecycle`||i&&M4([i]))return;K4(e,t);let a=Kfe(r,n);t(L4,A4(r.filter(e=>!a.has(e.id)))),t(R4,e(R4).filter(e=>!a.has(e.source)&&!a.has(e.target))),e(V4)&&a.has(e(V4)??``)&&t(V4,null),q4(e,t,{immediate:!0})}),mpe=lA(null,(e,t)=>{if(!G4(e))return;let n=e(L4),r=e(R4),i=n.filter(e=>e.selected);if(M4(i))return;let a=new Set(i.filter(e=>e.data.type!==`lifecycle`).map(e=>e.id));for(let e of n)e.parentId&&a.has(e.parentId)&&a.add(e.id);let o=A4(n.filter(e=>e.data.type===`lifecycle`||!a.has(e.id))),s=new Set(r.filter(e=>e.selected).flatMap(e=>F0(n,r,e.id))),c=r.filter(e=>!s.has(e.id)&&!a.has(e.source)&&!a.has(e.target));(o.length!==n.length||c.length!==r.length)&&(K4(e,t),t(L4,o),t(R4,c),t(V4,null),t(H4,null),q4(e,t,{immediate:!0}))}),h3=lA(null,(e,t)=>{if(!G4(e))return;let n=e(L4),r=n.filter(e=>e.data.type===`lifecycle`);(r.length!==n.length||e(R4).length!==0)&&(K4(e,t),t(L4,r),t(R4,[]),t(V4,null),t(H4,null),q4(e,t,{immediate:!0}))}),g3=lA(null,(e,t)=>{if(!G4(e))return;let n=e(U4),r=n.at(-1);r&&(t(W4,[...e(W4),{nodes:e(L4),edges:e(R4)}]),t(U4,n.slice(0,-1)),t(L4,r.nodes),t(R4,r.edges),q4(e,t,{immediate:!0}))}),_3=lA(null,(e,t)=>{if(!G4(e))return;let n=e(W4),r=n.at(-1);r&&(t(U4,[...e(U4),{nodes:e(L4),edges:e(R4)}]),t(W4,n.slice(0,-1)),t(L4,r.nodes),t(R4,r.edges),q4(e,t,{immediate:!0}))}),hpe=lA(e=>e(U4).length>0),gpe=lA(e=>e(W4).length>0),_pe=lA(null,(e,t)=>{t(B4,null),t($4,new Map)}),vpe=lA(null,(e,t)=>{t($4,new Map)}),v3=lA(null,(e,t,n)=>{if(n.length===0)return;let r=e($4),i=new Map(r),a=!1;for(let{nodeId:e,status:t}of n)r.get(e)!==t&&(i.set(e,t),a=!0);a&&t($4,i)}),ype={database:dte};function y3(e){let t=(0,Z.c)(14),{integration:n,className:r}=e,i=r===void 0?`h-3 w-3`:r,a=xy(),o=ype[n];if(o){let e;t[0]===i?e=t[1]:(e=Q(`text-foreground`,i),t[0]=i,t[1]=e);let n;return t[2]!==o||t[3]!==e?(n=(0,X.jsx)(o,{className:e}),t[2]=o,t[3]=e,t[4]=n):n=t[4],n}let s=a[n];if(s){let e=s.icon,n;t[5]===i?n=t[6]:(n=Q(`text-foreground`,i),t[5]=i,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,X.jsx)(e,{className:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}let c;t[10]===i?c=t[11]:(c=Q(`text-foreground`,i),t[10]=i,t[11]=c);let l;return t[12]===c?l=t[13]:(l=(0,X.jsx)(Zv,{className:c}),t[12]=c,t[13]=l),l}function b3(e){return Object.keys(DQ(e,e=>!e||e.length===0)).length>0}function x3(e){e.status===`success`?Ty.success(e.message||`Connection successful`):Ty.error(e.message||`Connection failed`)}function bpe(e){return e.integrations.toSorted((e,t)=>e.label.localeCompare(t.label))}var xpe=(e,t)=>Fy(e,t)?.label??t;function Spe(e){let t=(0,Z.c)(36),{overlayId:n,onSuccess:r}=e,i=yy(),{push:a}=LY(),[o,s]=(0,Y.useState)(``),c=AY(),l,u,d,f,p,m,h,g;if(t[0]!==i||t[1]!==c||t[2]!==r||t[3]!==n||t[4]!==a||t[5]!==o){let e=o.trim().toLowerCase(),_=bpe(i).filter(t=>!e||t.label.toLowerCase().includes(e)),v;t[14]!==r||t[15]!==a?(v=e=>{a(S3,{type:e,onSuccess:r})},t[14]=r,t[15]=a,t[16]=v):v=t[16];let y=v;l=xX,m=n,h=`Add Connection`,t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Select a service to connect`}),t[17]=g):g=t[17],f=`space-y-3`;let b;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[18]=b):b=t[18];let x=!c,S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>s(e.target.value),t[19]=S):S=t[19],t[20]!==o||t[21]!==x?(p=(0,X.jsxs)(`div`,{className:`relative`,children:[b,(0,X.jsx)(CX,{autoFocus:x,className:`pl-9`,onChange:S,placeholder:`Search services...`,value:o})]}),t[20]=o,t[21]=x,t[22]=p):p=t[22],u=`max-h-[300px] space-y-1 overflow-y-auto`,d=_.length===0?(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`No services found`}):_.map(e=>(0,X.jsxs)(`button`,{className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted/50`,onClick:()=>y(e.type),type:`button`,children:[(0,X.jsx)(y3,{className:`size-5 shrink-0`,integration:e.type}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[` `,`- `,e.description]})]})]},e.type)),t[0]=i,t[1]=c,t[2]=r,t[3]=n,t[4]=a,t[5]=o,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[23]!==u||t[24]!==d?(_=(0,X.jsx)(`div`,{className:u,children:d}),t[23]=u,t[24]=d,t[25]=_):_=t[25];let v;t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,X.jsxs)(`div`,{className:f,children:[p,_]}),t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29];let y;return t[30]!==l||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==v?(y=(0,X.jsxs)(l,{overlayId:m,title:h,children:[g,v]}),t[30]=l,t[31]=m,t[32]=h,t[33]=g,t[34]=v,t[35]=y):y=t[35],y}function Cpe(e){let t=(0,Z.c)(18),{fieldId:n,label:r,configKey:i,placeholder:a,helpText:o,helpLink:s,value:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,X.jsx)(wX,{htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==l?(d=e=>l(i,e.target.value),t[3]=i,t[4]=l,t[5]=d):d=t[5];let f;t[6]!==n||t[7]!==a||t[8]!==d||t[9]!==c?(f=(0,X.jsx)(CX,{className:`flex-1`,id:n,onChange:d,placeholder:a,type:`password`,value:c}),t[6]=n,t[7]=a,t[8]=d,t[9]=c,t[10]=f):f=t[10];let p;t[11]!==s||t[12]!==o?(p=(o||s)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[o,s&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:s.url,rel:`noopener noreferrer`,target:`_blank`,children:s.text})]}),t[11]=s,t[12]=o,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==f||t[16]!==p?(m=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[u,f,p]}),t[14]=u,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}function S3(e){let t=(0,Z.c)(62),{overlayId:n,type:r,onSuccess:i}=e,a=yy(),{push:o,closeAll:s}=LY(),c=Fe(),[l,u]=(0,Y.useState)(``),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Y.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=(e,t)=>{p(n=>({...n,[e]:t}))},t[1]=m):m=t[1];let h=m,g;t[2]!==s||t[3]!==i||t[4]!==c?(g=n0.integration.create.mutationOptions({onSuccess:async e=>{Ty.success(`Connection created`),await s0(c),i?.(e.id),s()},meta:{errorMessage:`Failed to save connection`}}),t[2]=s,t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=Ze(g),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=n0.integration.testCredentials.mutationOptions({meta:{errorShownByCaller:!0}}),t[6]=v):v=t[6];let y=Ze(v),b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=n0.integration.testCredentials.mutationOptions({onSuccess:x3}),t[7]=b):b=t[7];let x=Ze(b),S;t[8]!==a||t[9]!==r?(S=Fy(a,r),t[8]=a,t[9]=r,t[10]=S):S=t[10];let C=S,w=C?.credentialFields,T=C?.hasTest===!0,E=_.isPending||y.isPending,D;t[11]!==f||t[12]!==_||t[13]!==l||t[14]!==r?(D=()=>{_.mutate({name:l.trim(),type:r,config:f})},t[11]=f,t[12]=_,t[13]=l,t[14]=r,t[15]=D):D=t[15];let O=D,k;t[16]!==o||t[17]!==O?(k=e=>{o(SX,{title:`Connection Test Failed`,message:`${e}\n\nDo you want to save anyway?`,confirmLabel:`Save Anyway`,onConfirm:O})},t[16]=o,t[17]=O,t[18]=k):k=t[18];let A=k,j;t[19]!==f||t[20]!==T||t[21]!==A||t[22]!==O||t[23]!==y||t[24]!==r?(j=async()=>{if(!b3(f)){Ty.error(`Please enter credentials`);return}if(!T){O();return}try{let e=await y.mutateAsync({type:r,config:f});if(e.status===`error`){A(`The test failed: ${e.message}`);return}}catch(e){let t=e;A(t instanceof Error?t.message:`Failed to test connection`);return}O()},t[19]=f,t[20]=T,t[21]=A,t[22]=O,t[23]=y,t[24]=r,t[25]=j):j=t[25];let M=j,N;t[26]!==f||t[27]!==x||t[28]!==r?(N=()=>{if(!b3(f)){Ty.error(`Please enter credentials first`);return}x.mutate({type:r,config:f})},t[26]=f,t[27]=x,t[28]=r,t[29]=N):N=t[29];let P=N,F;t[30]!==f||t[31]!==w?(F=()=>w?Object.entries(w).map(e=>{let[t,n]=e;return n.type===`password`?(0,X.jsx)(Cpe,{configKey:t,fieldId:t,helpLink:n.helpLink,helpText:n.helpText,label:n.label,onChange:h,placeholder:n.placeholder,value:f[t]||``},t):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:t,children:n.label}),(0,X.jsx)(CX,{id:t,onChange:e=>h(t,e.target.value),placeholder:n.placeholder,type:n.type,value:f[t]||``}),(n.helpText||n.helpLink)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[n.helpText,n.helpLink&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:n.helpLink.url,rel:`noopener noreferrer`,target:`_blank`,children:n.helpLink.text})]})]},t)}):null,t[30]=f,t[31]=w,t[32]=F):F=t[32];let I=F,L;t[33]!==P||t[34]!==T||t[35]!==E||t[36]!==x?(L=T?[{label:`Test`,variant:`outline`,onClick:P,loading:x.isPending,disabled:E}]:[],t[33]=P,t[34]=T,t[35]=E,t[36]=x,t[37]=L):L=t[37];let R;t[38]!==M||t[39]!==E?(R={label:`Create`,onClick:M,loading:E},t[38]=M,t[39]=E,t[40]=R):R=t[40];let z;t[41]!==L||t[42]!==R?(z=[...L,R],t[41]=L,t[42]=R,t[43]=z):z=t[43];let B;t[44]!==a||t[45]!==r?(B=xpe(a,r),t[44]=a,t[45]=r,t[46]=B):B=t[46];let V=`Add ${B}`,H;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Enter your credentials`}),t[47]=H):H=t[47];let U;t[48]===I?U=t[49]:(U=I(),t[48]=I,t[49]=U);let W;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(wX,{htmlFor:`name`,children:`Label (Optional)`}),t[50]=W):W=t[50];let G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>u(e.target.value),t[51]=G):G=t[51];let K;t[52]===l?K=t[53]:(K=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[W,(0,X.jsx)(CX,{id:`name`,onChange:G,placeholder:`e.g. Production, Personal, Work`,value:l})]}),t[52]=l,t[53]=K);let q;t[54]!==U||t[55]!==K?(q=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[U,K]}),t[54]=U,t[55]=K,t[56]=q):q=t[56];let J;return t[57]!==n||t[58]!==z||t[59]!==V||t[60]!==q?(J=(0,X.jsxs)(xX,{actions:z,overlayId:n,title:V,children:[H,q]}),t[57]=n,t[58]=z,t[59]=V,t[60]=q,t[61]=J):J=t[61],J}var wpe=(e,t)=>e?.label??t;function Tpe(e){let t=(0,Z.c)(35),{fieldId:n,label:r,configKey:i,placeholder:a,helpText:o,helpLink:s,value:c,onChange:l}=e,[u,d]=(0,Y.useState)(!1),f=AY(),p=c.length>0;if(!(u||p)){let e;t[0]!==n||t[1]!==r?(e=(0,X.jsx)(wX,{htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsxs)(`div`,{className:`flex h-9 flex-1 items-center gap-2 rounded-md border bg-muted/30 px-3`,children:[(0,X.jsx)(qv,{className:`size-4 text-success`}),(0,X.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Configured`})]}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>d(!0),t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,(0,X.jsxs)(zv,{onClick:a,type:`button`,variant:`outline`,children:[(0,X.jsx)(oy,{className:`mr-1.5 size-3`}),`Change`]})]}),t[5]=o):o=t[5];let s;return t[6]===e?s=t[7]:(s=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[e,o]}),t[6]=e,t[7]=s),s}let m;t[8]!==n||t[9]!==r?(m=(0,X.jsx)(wX,{htmlFor:n,children:r}),t[8]=n,t[9]=r,t[10]=m):m=t[10];let h=u&&!f,g;t[11]!==i||t[12]!==l?(g=e=>l(i,e.target.value),t[11]=i,t[12]=l,t[13]=g):g=t[13];let _;t[14]!==n||t[15]!==a||t[16]!==h||t[17]!==g||t[18]!==c?(_=(0,X.jsx)(CX,{autoFocus:h,className:`flex-1`,id:n,onChange:g,placeholder:a,type:`password`,value:c}),t[14]=n,t[15]=a,t[16]=h,t[17]=g,t[18]=c,t[19]=_):_=t[19];let v;t[20]!==i||t[21]!==p||t[22]!==u||t[23]!==l?(v=(u||p)&&(0,X.jsx)(zv,{onClick:()=>{l(i,``),d(!1)},size:`icon`,type:`button`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})}),t[20]=i,t[21]=p,t[22]=u,t[23]=l,t[24]=v):v=t[24];let y;t[25]!==_||t[26]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,v]}),t[25]=_,t[26]=v,t[27]=y):y=t[27];let b;t[28]!==s||t[29]!==o?(b=(o||s)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[o,s&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:s.url,rel:`noopener noreferrer`,target:`_blank`,children:s.text})]}),t[28]=s,t[29]=o,t[30]=b):b=t[30];let x;return t[31]!==m||t[32]!==y||t[33]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[m,y,b]}),t[31]=m,t[32]=y,t[33]=b,t[34]=x):x=t[34],x}function C3(e){let t=(0,Z.c)(83),{overlayId:n,integration:r,onSuccess:i,onDelete:a}=e,{push:o,closeAll:s}=LY(),c=Fe(),[l,u]=(0,Y.useState)(r.name),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Y.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=(e,t)=>{p(n=>({...n,[e]:t}))},t[1]=m):m=t[1];let h=m,g;t[2]!==s||t[3]!==i||t[4]!==c?(g=n0.integration.update.mutationOptions({onSuccess:async()=>{Ty.success(`Connection updated`),await s0(c),i?.(),s()},meta:{errorMessage:`Failed to update connection`}}),t[2]=s,t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=Ze(g),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=n0.integration.testCredentials.mutationOptions({meta:{errorShownByCaller:!0}}),t[6]=v):v=t[6];let y=Ze(v),b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=n0.integration.testCredentials.mutationOptions({onSuccess:x3}),t[7]=b):b=t[7];let x=Ze(b),S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=n0.integration.testConnection.mutationOptions({onSuccess:x3}),t[8]=S):S=t[8];let C=Ze(S),w=yy(),T,E,D,O,k;if(t[9]!==w||t[10]!==s||t[11]!==f||t[12]!==r||t[13]!==l||t[14]!==a||t[15]!==n||t[16]!==o||t[17]!==y||t[18]!==x||t[19]!==C||t[20]!==_){let e=Fy(w,r.type),i=e?.credentialFields,c=e?.hasTest===!0,u=_.isPending||y.isPending,d=x.isPending||C.isPending,p;t[26]!==f||t[27]!==r.id||t[28]!==l||t[29]!==_?(p=()=>{_.mutate({integrationId:r.id,name:l.trim(),config:b3(f)?f:void 0})},t[26]=f,t[27]=r.id,t[28]=l,t[29]=_,t[30]=p):p=t[30];let m=p,g;t[31]!==o||t[32]!==m?(g=e=>{o(SX,{title:`Connection Test Failed`,message:`${e}\n\nDo you want to save anyway?`,confirmLabel:`Save Anyway`,onConfirm:m})},t[31]=o,t[32]=m,t[33]=g):g=t[33];let v=g,b;t[34]!==f||t[35]!==c||t[36]!==r.type||t[37]!==v||t[38]!==m||t[39]!==y?(b=async()=>{if(!(b3(f)&&c)){m();return}try{let e=await y.mutateAsync({type:r.type,config:f});if(e.status===`error`){v(`The test failed: ${e.message}`);return}}catch(e){let t=e;v(t instanceof Error?t.message:`Failed to test connection`);return}m()},t[34]=f,t[35]=c,t[36]=r.type,t[37]=v,t[38]=m,t[39]=y,t[40]=b):b=t[40];let S=b,A;t[41]!==f||t[42]!==r.id||t[43]!==r.type||t[44]!==x||t[45]!==C?(A=()=>{if(b3(f)){x.mutate({type:r.type,config:f});return}C.mutate({integrationId:r.id})},t[41]=f,t[42]=r.id,t[43]=r.type,t[44]=x,t[45]=C,t[46]=A):A=t[46];let j=A,M;t[47]!==s||t[48]!==r||t[49]!==a||t[50]!==o?(M=()=>{o(w3,{integration:r,onDismiss:s,onSuccess:a})},t[47]=s,t[48]=r,t[49]=a,t[50]=o,t[51]=M):M=t[51];let N=M;E=()=>i?Object.entries(i).map(e=>{let[t,n]=e;return n.type===`password`?(0,X.jsx)(Tpe,{configKey:t,fieldId:t,helpLink:n.helpLink,helpText:n.helpText,label:n.label,onChange:h,placeholder:n.placeholder,value:f[t]||``},t):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:t,children:n.label}),(0,X.jsx)(CX,{id:t,onChange:e=>h(t,e.target.value),placeholder:n.placeholder,type:n.type,value:f[t]||``}),(n.helpText||n.helpLink)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[n.helpText,n.helpLink&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:n.helpLink.url,rel:`noopener noreferrer`,target:`_blank`,children:n.helpLink.text})]})]},t)}):null,T=xX;let P=u||d,F;t[52]!==N||t[53]!==P?(F={label:`Delete`,variant:`ghost`,onClick:N,disabled:P},t[52]=N,t[53]=P,t[54]=F):F=t[54];let I;t[55]!==j||t[56]!==c||t[57]!==u||t[58]!==d?(I=c?[{label:`Test`,variant:`outline`,onClick:j,loading:d,disabled:u}]:[],t[55]=j,t[56]=c,t[57]=u,t[58]=d,t[59]=I):I=t[59];let L;t[60]!==S||t[61]!==u?(L={label:`Update`,onClick:S,loading:u},t[60]=S,t[61]=u,t[62]=L):L=t[62],t[63]!==F||t[64]!==I||t[65]!==L?(O=[F,...I,L],t[63]=F,t[64]=I,t[65]=L,t[66]=O):O=t[66],k=n,D=wpe(e,r.type),t[9]=w,t[10]=s,t[11]=f,t[12]=r,t[13]=l,t[14]=a,t[15]=n,t[16]=o,t[17]=y,t[18]=x,t[19]=C,t[20]=_,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A=`Edit ${D}`,j;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Update your connection credentials`}),t[67]=j):j=t[67];let M;t[68]===E?M=t[69]:(M=E(),t[68]=E,t[69]=M);let N;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(wX,{htmlFor:`name`,children:`Label (Optional)`}),t[70]=N):N=t[70];let P;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>u(e.target.value),t[71]=P):P=t[71];let F;t[72]===l?F=t[73]:(F=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[N,(0,X.jsx)(CX,{id:`name`,onChange:P,placeholder:`e.g. Production, Personal, Work`,value:l})]}),t[72]=l,t[73]=F);let I;t[74]!==M||t[75]!==F?(I=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[M,F]}),t[74]=M,t[75]=F,t[76]=I):I=t[76];let L;return t[77]!==T||t[78]!==A||t[79]!==I||t[80]!==O||t[81]!==k?(L=(0,X.jsxs)(T,{actions:O,overlayId:k,title:A,children:[j,I]}),t[77]=T,t[78]=A,t[79]=I,t[80]=O,t[81]=k,t[82]=L):L=t[82],L}function w3(e){let t=(0,Z.c)(19),{overlayId:n,integration:r,onDismiss:i,onSuccess:a}=e,{pop:o}=LY(),s=i??o,c=Fe(),l;t[0]!==s||t[1]!==a||t[2]!==c?(l=n0.integration.delete.mutationOptions({onSuccess:async()=>{Ty.success(`Connection deleted`),s(),await s0(c),a?.()},meta:{errorMessage:`Failed to delete connection`}}),t[0]=s,t[1]=a,t[2]=c,t[3]=l):l=t[3];let u=Ze(l),d;t[4]===o?d=t[5]:(d={label:`Cancel`,variant:`outline`,onClick:o},t[4]=o,t[5]=d);let f;t[6]!==u||t[7]!==r?(f=()=>u.mutate({integrationId:r.id}),t[6]=u,t[7]=r,t[8]=f):f=t[8];let p;t[9]!==u.isPending||t[10]!==f?(p={label:`Delete`,variant:`destructive`,onClick:f,loading:u.isPending},t[9]=u.isPending,t[10]=f,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==p?(m=[d,p],t[12]=d,t[13]=p,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Are you sure you want to delete this connection? Workflows using it will fail until a new one is configured.`}),t[15]=h):h=t[15];let g;return t[16]!==n||t[17]!==m?(g=(0,X.jsx)(xX,{actions:m,overlayId:n,title:`Delete Connection`,children:h}),t[16]=n,t[17]=m,t[18]=g):g=t[18],g}function T3(){let e=(0,Z.c)(4),t=Fe(),n=yy(),r=TA(ape),i;return e[0]!==n||e[1]!==t||e[2]!==r?(i=async()=>{r({integrations:await t.fetchQuery(r0()),catalog:n})},e[0]=n,e[1]=t,e[2]=r,e[3]=i):i=e[3],i}function E3(e){let t=(0,Z.c)(23),{displayName:n,selected:r,className:i,disabled:a,onSelect:o,onEdit:s}=e,c=a&&`cursor-not-allowed opacity-50`,l;t[0]!==i||t[1]!==c?(l=Q(i,c),t[0]=i,t[1]=c,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=r?(0,X.jsx)(qv,{className:`size-4 shrink-0 text-success`}):(0,X.jsx)(Qv,{className:`size-4 shrink-0 text-muted-foreground`}),t[3]=r,t[4]=u);let d;t[5]===n?d=t[6]:(d=(0,X.jsx)(`span`,{className:`truncate`,children:n}),t[5]=n,t[6]=d);let f;t[7]!==a||t[8]!==o||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,X.jsxs)(`button`,{"aria-checked":r,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,disabled:a,onClick:o,role:`radio`,type:`button`,children:[u,d]}),t[7]=a,t[8]=o,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===s?p=t[14]:(p=e=>{e.stopPropagation(),s()},t[13]=s,t[14]=p);let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(oy,{className:`size-3`}),t[15]=m):m=t[15];let h;t[16]!==a||t[17]!==p?(h=(0,X.jsx)(zv,{className:`size-6 shrink-0`,disabled:a,onClick:p,size:`icon`,variant:`ghost`,children:m}),t[16]=a,t[17]=p,t[18]=h):h=t[18];let g;return t[19]!==l||t[20]!==f||t[21]!==h?(g=(0,X.jsxs)(`div`,{className:l,children:[f,h]}),t[19]=l,t[20]=f,t[21]=h,t[22]=g):g=t[22],g}function Epe(e){let t=(0,Z.c)(68),{integrationType:n,value:r,onChange:i,onOpenSettings:a,disabled:o,onAddConnection:s}=e,c=yy(),{push:l}=LY(),u=T3(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=r0(),t[0]=d):d=t[0];let{data:f,isPending:p}=Xe(d),m;t[1]===f?m=t[2]:(m=f===void 0?[]:f,t[1]=f,t[2]=m);let h=m,g;if(t[3]!==h||t[4]!==n){let e;t[6]===n?e=t[7]:(e=e=>e.type===n,t[6]=n,t[7]=e),g=h.filter(e),t[3]=h,t[4]=n,t[5]=g}else g=t[5];let _=g,v;t[8]!==i||t[9]!==u?(v=async e=>{await u(),i(e)},t[8]=i,t[9]=u,t[10]=v):v=t[10];let y=v,b;t[11]!==y||t[12]!==n||t[13]!==l?(b=()=>{l(S3,{type:n,onSuccess:y})},t[11]=y,t[12]=n,t[13]=l,t[14]=b):b=t[14];let x=b,S;t[15]!==l||t[16]!==u?(S=e=>{l(C3,{integration:e,onSuccess:u,onDelete:u})},t[15]=l,t[16]=u,t[17]=S):S=t[17];let C=S,w;t[18]!==s||t[19]!==x?(w=()=>{s?s():x()},t[18]=s,t[19]=x,t[20]=w):w=t[20];let T=w;if(p){let e;return t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex flex-col gap-1`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5`,children:[(0,X.jsx)(`div`,{className:`size-4 shrink-0 animate-pulse rounded-full bg-muted`}),(0,X.jsx)(`div`,{className:`h-4 flex-1 animate-pulse rounded bg-muted`}),(0,X.jsx)(`div`,{className:`size-6 shrink-0 animate-pulse rounded bg-muted`})]})}),t[21]=e):e=t[21],e}let E;t[22]!==c||t[23]!==n?(E=Fy(c,n),t[22]=c,t[23]=n,t[24]=E):E=t[24];let D=E?.label||n,O;t[25]===D?O=t[26]:(O=e=>e.name||`${D} API Key`,t[25]=D,t[26]=O);let k=O;if(_.length===0){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(py,{className:`size-4`}),t[27]=e):e=t[27];let n;t[28]===D?n=t[29]:(n=(0,X.jsxs)(`span`,{className:`flex-1 text-left`,children:[`Add `,D,` connection`]}),t[28]=D,t[29]=n);let r;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(cy,{className:`size-4`}),t[30]=r):r=t[30];let i;return t[31]!==o||t[32]!==T||t[33]!==n?(i=(0,X.jsxs)(zv,{className:`w-full justify-start gap-2 border-warning/50 bg-warning/10 text-warning hover:bg-warning/20`,disabled:o,onClick:T,variant:`outline`,children:[e,n,r]}),t[31]=o,t[32]=T,t[33]=n,t[34]=i):i=t[34],i}if(_.length===1){let e=_[0],n;t[35]!==e||t[36]!==k?(n=k(e),t[35]=e,t[36]=k,t[37]=n):n=t[37];let a;t[38]!==e||t[39]!==C?(a=()=>C(e),t[38]=e,t[39]=C,t[40]=a):a=t[40];let s;t[41]!==e.id||t[42]!==i?(s=()=>i(e.id),t[41]=e.id,t[42]=i,t[43]=s):s=t[43];let c=r===e.id,l;return t[44]!==o||t[45]!==e||t[46]!==n||t[47]!==a||t[48]!==s||t[49]!==c?(l=(0,X.jsx)(`div`,{role:`radiogroup`,children:(0,X.jsx)(E3,{className:`flex h-9 w-full items-center gap-2 rounded-md border px-3 text-sm`,disabled:o,displayName:n,integration:e,onEdit:a,onSelect:s,selected:c})}),t[44]=o,t[45]=e,t[46]=n,t[47]=a,t[48]=s,t[49]=c,t[50]=l):l=t[50],l}let A,j,M;if(t[51]!==o||t[52]!==_||t[53]!==k||t[54]!==i||t[55]!==C||t[56]!==r){let[e,n]=Ja(_,Dpe);A=`flex flex-col gap-1`,j=`radiogroup`,M=[...e,...n].map(e=>{let t=r===e.id;return(0,X.jsx)(E3,{className:Q(`flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors`,t?`bg-primary/10 text-primary`:`hover:bg-muted/50`),disabled:o,displayName:k(e),integration:e,onEdit:()=>C(e),onSelect:()=>i(e.id),selected:t},e.id)}),t[51]=o,t[52]=_,t[53]=k,t[54]=i,t[55]=C,t[56]=r,t[57]=A,t[58]=j,t[59]=M}else A=t[57],j=t[58],M=t[59];let N;t[60]!==o||t[61]!==a?(N=a&&(0,X.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-muted-foreground text-sm transition-colors hover:bg-muted/50 hover:text-foreground`,disabled:o,onClick:a,type:`button`,children:[(0,X.jsx)(dy,{className:`size-4 shrink-0`}),(0,X.jsx)(`span`,{children:`Manage all connections`})]}),t[60]=o,t[61]=a,t[62]=N):N=t[62];let P;return t[63]!==A||t[64]!==j||t[65]!==M||t[66]!==N?(P=(0,X.jsxs)(`div`,{className:A,role:j,children:[M,N]}),t[63]=A,t[64]=j,t[65]=M,t[66]=N,t[67]=P):P=t[67],P}function Dpe(e){return!!e.isManaged}function D3(e){let t=Y.useRef(!0);t.current&&(t.current=!1,e())}function Ope(e){let[t,n]=Y.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function O3(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function k3({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Y.useRef(e!==void 0),[a,o]=Y.useState(t);return[i?e:a,Y.useCallback(e=>{i||o(e)},[])]}var A3=Y.createContext(null);function j3(){let e=Y.useContext(A3);if(e===null)throw Error(Gg(60));return e}var M3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},N3={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},kpe={disabled:!1,...N3},P3={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},F3={invalid:void 0,name:void 0,validityData:{state:M3,errors:[],error:``,value:``,initialValue:null},setValidityData:r_,disabled:void 0,setTouched:r_,setDirty:r_,setFilled:r_,setFocused:r_,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:kpe,registerFieldControl:r_,validation:{getValidationProps:(e,t=a_)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:r_,getInputControl:()=>null,commit:async()=>{},change:r_}},I3=Y.createContext(F3);function L3(e=!0){let t=Y.useContext(I3);if(t.setValidityData===r_&&!e)throw Error(Gg(28));return t}function R3(e,t,n,r,i=!0,a){let{registerFieldControl:o}=L3(),s=Eg(()=>Symbol());Mg(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),Mg(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var Ape=Y.createContext({controlId:void 0,registerControlId:r_,labelId:void 0,setLabelId:r_,messageIds:[],setMessageIds:r_,getDescriptionProps:e=>e});function z3(){return Y.useContext(Ape)}function B3(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=z3(),o=NH(t),s=n?i:void 0,c=Eg(()=>Symbol()),l=Y.useRef(!1),u=Y.useRef(t!=null),d=kg(()=>{!l.current||a===r_||(l.current=!1,a(c.current,void 0))});return Mg(()=>{if(a===r_)return;let e;if(n){let n=r?.current;e=ig(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),Y.useEffect(()=>d,[d]),i??o}var V3=(e,t)=>Object.is(e,t);function H3(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function jpe(e,t,n){return!e||e.length===0?!1:e.some(e=>e!==void 0&&H3(t,e,n))}function U3(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&H3(e,t,n))}function W3(e,t,n,r){let i=U3(e,r&&Array.isArray(t)?t[t.length-1]:t,n);return i===-1?null:i}function G3(e,t,n){return e.filter(e=>!H3(t,e,n))}function K3(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function q3(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function J3(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(q3(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Y3(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return K3(e)}function X3(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?K3(e.value):K3(e)}function Z3(e,t,n){function r(){return Y3(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=q3(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Mpe(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,X.jsx)(Y.Fragment,{children:Z3(r,t,n)},i)),e),[])}var Q3={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:X3(t,r)!==``},hasNullItemLabel:(e,t)=>t?J3(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>H3(t,e,n)):H3(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},Npe=Y.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:r_,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function $3(){return Y.useContext(Npe)}function e6(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function t6(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function n6(e,t){return Math.max(0,e-t)}function r6(e,t){if(t<=0)return 0;let n=t6(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Ppe(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=V3,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=$3(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=L3(),F=B3({id:t}),I=M||d,L=j??c,[R,z]=k3({controlled:n,default:y?r??i_:r,name:`Select`,state:`value`}),[B,V]=k3({controlled:a,default:o,name:`Select`,state:`open`}),H=Y.useRef([]),U=Y.useRef([]),W=Y.useRef(null),G=Y.useRef(null),K=Y.useRef(0),q=Y.useRef(null),J=Y.useRef([]),ee=Y.useRef(!1),te=Y.useRef(null),ne=Y.useRef(null),re=Y.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ie=Y.useRef(!1),{mounted:ae,setMounted:oe,transitionStatus:se}=hq(B),{openMethod:ce,triggerProps:le}=oY(B),ue=Eg(()=>new dq({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:B,mounted:ae,transitionStatus:se,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,de=$(ue,Q3.activeIndex),fe=$(ue,Q3.selectedIndex),pe=$(ue,Q3.triggerElement),me=$(ue,Q3.positionerElement),he=Ope(ce),ge=ce??he,_e=Y.useMemo(()=>y?``:X3(R,x),[y,R,x]),ve=Y.useMemo(()=>y&&Array.isArray(R)?R.map(e=>X3(e,x)):X3(R,x),[y,R,x]);R3(PU(pe),F,R,kg(()=>ve),!I,c);let ye=Y.useRef(R),be=y?Array.isArray(R)&&R.length>0:R!=null&&_e!==``;Mg(()=>{A(be)},[be,A]),Mg(function(){let e=R,t=!1;if(y){let n=Array.isArray(R)?R:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:U3(J.current,e,S),r=n===-1?null:n;r===null&&(ne.current=null),!B&&ue.set(`selectedIndex`,r)},[y,B,R,S,ue]);function xe(e){let t=k.initialValue;return Array.isArray(e)&&Array.isArray(t)?!e6(e,t,(e,t)=>H3(e,t,S)):e!==t}iY(R,()=>{T(L),E(xe(R)),N.change(R)});let Se=kg((e,t)=>{s?.(e,t),!t.isCanceled&&(V(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),Ce=kg(()=>{oe(!1),ue.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});_q({enabled:!h,open:B,ref:W,onComplete(){B||Ce()}}),Y.useImperativeHandle(h,()=>({unmount:Ce}),[Ce]);let we=kg((e,t)=>{i?.(e,t),!t.isCanceled&&z(e)}),Te=kg(e=>{let t=n6(e.scrollHeight,e.clientHeight),n=r6(e.scrollTop,t),r=n>0,i=n<t;ue.set(`scrollUpArrowVisible`,r),ue.set(`scrollDownArrowVisible`,i)}),Ee=Hq({open:B,onOpenChange:Se,elements:{reference:pe,floating:me}}),De=HG(Ee,{enabled:!f&&!I,event:`mousedown`}),Oe=JG(Ee),ke=cJ(Ee,{enabled:!f&&!I,listRef:H,activeIndex:de,selectedIndex:fe,disabledIndices:i_,onNavigate(e){e===null&&!B||ue.set(`activeIndex`,e)},focusItemOnHover:C}),Ae=lJ(Ee,{enabled:!f&&!I&&(B||!y),listRef:U,activeIndex:de,selectedIndex:fe,disabledIndices:e=>O3(H.current[e]),onMatch(e){B?ue.set(`activeIndex`,e):we(J.current[e],EH(oH))},onTyping(e){ee.current=e}}),je=Y.useMemo(()=>Fg(Ae.reference,ke.reference,Oe.reference,De.reference,le),[De.reference,Ae.reference,ke.reference,Oe.reference,le]),Me=Y.useMemo(()=>Fg(vq,Ae.floating,ke.floating,Oe.floating),[Ae.floating,ke.floating,Oe.floating]),Ne=ke.item??a_;D3(()=>{ue.update({popupProps:Me,triggerProps:je})}),ue.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:B,mounted:ae,transitionStatus:se,popupProps:Me,triggerProps:je,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:ge});let Pe=Y.useMemo(()=>({store:ue,floatingContext:Ee,required:p,disabled:I,readOnly:f,multiple:y,highlightItemOnHover:C,setValue:we,setOpen:Se,listRef:H,popupRef:W,scrollHandlerRef:G,handleScrollArrowVisibility:Te,scrollArrowsMountedCountRef:K,itemProps:Ne,valueRef:q,valuesRef:J,labelsRef:U,typingRef:ee,selectionRef:re,firstItemTextRef:te,selectedItemTextRef:ne,validation:N,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:ie,initialValueRef:ye}),[ue,Ee,p,I,f,y,C,we,Se,Ne,N,_,Te]),Fe=Qg(g,N.inputRef),Ie=y?void 0:L,Le=Y.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=X3(e,x);return(0,X.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,X.jsxs)(A3.Provider,{value:Pe,children:[w,(0,X.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){ue.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=EH(oH,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=J.current.findIndex(t=>X3(t,x).toLowerCase()===e||Y3(t,b).toLowerCase()===e);r===-1&&(r=J.current.findIndex((t,n)=>{let r=U.current[n];return r!=null&&r.toLowerCase()===e}));let i=J.current[r];i!=null&&we(i,n)}ue.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ie==null?`${F}-hidden-input`:void 0,form:l,name:Ie,autoComplete:u,value:_e,disabled:I,required:p&&!(y&&be),readOnly:f,ref:Fe,style:L?HU:VU,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Le]})}function i6(e,t){return e??t}var a6=5;function o6(e,t){let n=Fpe(t);return e.clientX>=n.left-a6&&e.clientX<=n.right+a6&&e.clientY>=n.top-a6&&e.clientY<=n.bottom+a6}function Fpe(e){let t=e.getBoundingClientRect(),n=tg(e);if($H)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var Ipe=400,Lpe={...nH,...P3,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Rpe=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=L3(),{labelId:m}=z3(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:b,alignItemWithTriggerActiveRef:x,disabled:S}=j3(),C=p||S||a,w=$(h,Q3.open),T=$(h,Q3.mounted),E=$(h,Q3.value),D=$(h,Q3.triggerProps),O=$(h,Q3.positionerElement),k=$(h,Q3.listElement),A=$(h,Q3.popupSide),j=$(h,Q3.id),M=$(h,Q3.labelId),N=$(h,Q3.hasSelectedValue),P=T&&O?A:null,F=i??j,I=i6(m,M);B3({id:F});let L=PU(O),R=Y.useRef(null),{getButtonProps:z,buttonRef:B}=Xg({disabled:C,native:o}),V=h.useStateSetter(`triggerElement`),H=RH(),U=RH(),W=RH();Y.useEffect(()=>{if(w)return W.start(Ipe,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{W.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[w,_,U,W]);let G=Fg(D,{id:F,role:`combobox`,"aria-expanded":w,"aria-haspopup":`listbox`,"aria-controls":w?k?.id??SU(O)?.id:void 0,"aria-labelledby":I,"aria-readonly":y||void 0,"aria-required":b||void 0,tabIndex:C?-1:0,onFocus(e){u(!0),w&&x.current&&g(!1,EH(oH,e.nativeEvent)),H.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){pU(O,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(E))},onMouseDown(e){if(w)return;let t=Jg(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;pU(R.current,t)||pU(L.current,t)||o6(e,R.current)||g(!1,EH(xH,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,z),K=v.getValidationProps(C,G);K.role=`combobox`;let q={...f,open:w,disabled:C,value:E,readOnly:y,popupSide:P,placeholder:!N};return o_(`button`,e,{ref:[t,R,B,V],state:q,stateAttributesMapping:Lpe,props:K})}),zpe={value:()=>null},Bpe=Y.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=j3(),u=$(c,Q3.value),d=$(c,Q3.items),f=$(c,Q3.itemToStringLabel),p=$(c,Q3.hasSelectedValue),m=!p&&a!=null&&i==null,h=$(c,Q3.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Mpe(u,d,f):Z3(u,d,f)),o_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:zpe})}),Vpe=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=j3();return o_(`span`,e,{state:{open:$(o,Q3.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:tH})}),Hpe=Y.forwardRef(function(e,t){let{store:n}=j3(),r=$(n,Q3.mounted),i=$(n,Q3.forceMount);return r||i?(0,X.jsx)(SG,{ref:t,...e}):null}),s6=Y.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Upe(){return Y.useContext(s6)}function c6(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=kg(i),[,o]=Y.useState(!1),s=Eg(Gpe).current,c=Eg(Wpe).current,l=Y.useRef(0),u=Y.useRef(!0),d=Y.useRef([]),f=Y.useRef(null),p=kg(()=>{u.current||(u.current=!0,o(e=>!e))}),m=kg((e,t)=>{c.set(e,t),p()}),h=kg(e=>{c.delete(e),p()}),g=kg(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Jpe(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&l6(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=qpe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=kg(()=>{let[e,t]=Kpe(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});Mg(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Mg(()=>{u.current&&v()}),Mg(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=kg(e=>(s.add(e),()=>{s.delete(e)})),b=Y.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,X.jsx)(s6.Provider,{value:b,children:t})}function Wpe(){return new Map}function Gpe(){return new Set}function Kpe(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>l6(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function qpe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Jpe(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function l6(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var Ype=Y.createContext(void 0);function u6(){return Y.useContext(Ype)?.direction??`ltr`}var Xpe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=ZU(e,t)||{};if(l==null)return{};let f=hW(u),p={x:n,y:r},m=rW(i),h=tW(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=XU(k,j,A),N=!c.arrow&&$U(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Zpe=(e,t)=>({...Xpe(e),options:[e,t]}),Qpe={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},$pe={sideX:`left`,sideY:`top`},d6=`--available-width`,f6=`--available-height`;function p6(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function m6(e,t,n){let{rects:r,placement:i}=e;return{side:p6(t,QU(i),n),align:$U(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function h6(e){return eme(e,Uq)}function eme(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Y.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=kg(A),M=A?j:n,N=PU(n),P=PU(g),F=u6()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=Y.useRef(null),G=PU(a),K=PU(s),q=typeof a==`function`?0:a,J=typeof s==`function`?0:s,ee=[];p&&ee.push(p),ee.push(qK(e=>{let t=m6(e,i,F),n=typeof G.current==`function`?G.current(t):G.current,r=typeof K.current==`function`?K.current(t):K.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[q,J,F,i]));let te=E===`none`&&T!==`shift`,ne=!te&&(u||O||T===`shift`),re=T===`none`?null:XK({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),ie=te?null:JK({...U,rootBoundary:k,mainAxis:E!==`none`,crossAxis:ne,limiter:u||O?void 0:YK(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=nW(QU(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?ee.push(ie,re):ee.push(re,ie),ee.push(ZK({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(d6,`${t}px`),i.setProperty(f6,`${n}px`);let a=tg(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Zpe(e=>({element:W.current||Jg(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=QU(r),l=nW(c),u=W.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(m6(e,i,F)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ne&&l===`y`&&b?S:x),{}}},Qpe,b),Mg(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ae=Y.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:oe,elements:se,x:ce,y:le,middlewareData:ue,update:de,placement:fe,context:pe,isPositioned:me,floatingStyles:he}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:ee,strategy:r,whileElementsMounted:m?void 0:(...e)=>PK(...e,ae),nodeId:y,externalTree:S}),{sideX:ge,sideY:_e}=ue.adaptiveOrigin||$pe,ve=me?r:`fixed`,ye=Y.useMemo(()=>{let e;return e=me?b?{position:ve,[ge]:ce,[_e]:le}:{...he,position:ve}:{position:ve,top:0,left:0},e[d6]=`100vw`,e[f6]=`100vh`,me||(e.opacity=0),e},[b,ve,ge,ce,_e,le,he,me]),be=Y.useRef(null);Mg(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(g6(t)?t.current:t)||null;n!==be.current&&(oe.setPositionReference(n),be.current=n)},[g,oe,M,N]),Y.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&g6(e)&&e.current!==be.current&&(oe.setPositionReference(e.current),be.current=e.current)},[g,oe,M,N]),Y.useEffect(()=>{if(m&&g&&se.reference&&se.floating)return PK(se.reference,se.floating,de,ae)},[m,g,se,de,ae]);let xe=QU(fe),Se=p6(i,xe,F),Ce=$U(fe)||`center`,we=!!ue.hide?.referenceHidden;Mg(()=>{x&&g&&me&&xe!==I&&w(xe)},[x,g,me,xe,I]);let Te=Y.useMemo(()=>({position:`absolute`,top:ue.arrow?.y,left:ue.arrow?.x}),[ue.arrow]),Ee=ue.arrow?.centerOffset!==0;return Y.useMemo(()=>({positionerStyles:ye,arrowStyles:Te,arrowRef:W,arrowUncentered:Ee,side:Se,align:Ce,physicalSide:xe,anchorHidden:we,refs:oe,context:pe,isPositioned:me,update:de}),[ye,Te,W,Ee,Se,Ce,xe,we,oe,pe,me,de])}function g6(e){return e!=null&&`current`in e}var _6=Y.createContext(void 0);function v6(){let e=Y.useContext(_6);if(!e)throw Error(Gg(59));return e}function y6(e,t){e&&Object.assign(e.style,t)}var b6={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function x6(e){return e===`starting`?mG:a_}function S6(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),o_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},x6(r),i],stateAttributesMapping:rH})}var tme=20;function C6(e,t,n,r){let[i,a]=Y.useState(!1);Mg(()=>{if(!e||!t||n==null){a(!1);return}let r=Jg(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-tme)},[e,t,n]),qJ(e&&(!t||i),r)}var nme={position:`fixed`},rme=Y.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=hG,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D,floatingContext:O}=j3(),k=$(y,Q3.open),A=$(y,Q3.mounted),j=$(y,Q3.modal),M=$(y,Q3.value),N=$(y,Q3.openMethod),P=$(y,Q3.positionerElement),F=$(y,Q3.triggerElement),I=$(y,Q3.isItemEqualToValue),L=$(y,Q3.transitionStatus),R=Y.useRef(null),z=Y.useRef(null),[B,V]=Y.useState(h),H=A&&B&&N!==`touch`;!A&&B!==h&&V(h),Y.useImperativeHandle(S,()=>H),C6((H||j)&&k,N===`touch`,P,F);let U=h6({anchor:n,floatingRootContext:O,positionMethod:a,mounted:A,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),W=H?`none`:U.side,G=H?nme:U.positionerStyles,K={open:k,side:W,align:U.align,anchorHidden:U.anchorHidden};Mg(()=>{y.set(`popupSide`,U.side)},[y,U.side]);let q=S6(e,K,{styles:G,transitionStatus:L,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!A,inert:!k}),J=Y.useRef(0),ee=kg(e=>{if(w.current.length===0)return;let t=J.current;if(J.current=e.size,e.size===t)return;let n=EH(oH);if(t!==0&&!y.state.multiple&&M!==null&&U3(w.current,M,I)===-1){let e=T.current,t=e!=null&&U3(w.current,e,I)!==-1?e:null;D(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(M)){let e=M.filter(e=>U3(w.current,e,I)!==-1);e.length!==M.length&&(D(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(k&&H){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};y6(P,e),y6(E.current,e)}}),te=Y.useMemo(()=>({...U,side:W,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:R,scrollDownArrowRef:z}),[U,W,H,V]);return(0,X.jsx)(c6,{elementsRef:b,labelsRef:x,onMapChange:ee,children:(0,X.jsxs)(_6.Provider,{value:te,children:[A&&j&&(0,X.jsx)(FJ,{inert:PJ(!k),cutout:F}),q]})})}),w6=`base-ui-disable-scrollbar`,T6={className:w6,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:w6,precedence:`base-ui:low`,children:`.${w6}{scrollbar-width:none}.${w6}::-webkit-scrollbar{display:none}`})}},ime=Y.createContext(void 0);function E6(e){let t=Y.useContext(ime);if(t===void 0&&!e)throw Error(Gg(69));return t}var ame=Y.createContext(void 0),ome={disableStyleElements:!1};function sme(){return Y.useContext(ame)??ome}var cme={...rH,...YV},lme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v,floatingContext:y}=j3(),{side:b,align:x,alignItemWithTriggerActive:S,isPositioned:C,setControlledAlignItemWithTrigger:w}=v6(),T=E6(!0)!=null,E=u6(),{nonce:D,disableStyleElements:O}=sme(),k=$(s,Q3.id),A=$(s,Q3.open),j=$(s,Q3.openMethod),M=$(s,Q3.mounted),N=$(s,Q3.popupProps),P=$(s,Q3.transitionStatus),F=$(s,Q3.triggerElement),I=$(s,Q3.positionerElement),L=$(s,Q3.listElement),R=Y.useRef(!1),z=Y.useRef(!1),B=Y.useRef({}),V=zU(),H=kg(e=>{if(!I||!c.current||!z.current)return;let t=I.style.top===`0px`,n=I.style.bottom===`0px`;if(R.current||!S||!t&&!n){h(e);return}let r=k6(I),i=A6(I.getBoundingClientRect().height,`y`,r),a=Jg(I),o=tg(I),s=o.getComputedStyle(I),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=D6(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=O6(e),g=null,_=e=>{I.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=t6(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(R.current=!0),h(e);return}f-y>1?g=t?1/0:0:n&&p<m&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=t6(g,0,O6(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(R.current=!0),h(e)});Y.useImperativeHandle(g,()=>H,[H]),_q({open:A,ref:c,onComplete(){A&&l?.(!0)}});let U={open:A,transitionStatus:P,side:b,align:x};Mg(()=>{!I||!c.current||Object.keys(B.current).length||(B.current={top:I.style.top||`0`,left:I.style.left||`0`,right:I.style.right,height:I.style.height,bottom:I.style.bottom,minHeight:I.style.minHeight,maxHeight:I.style.maxHeight,marginTop:I.style.marginTop,marginBottom:I.style.marginBottom})},[c,I]),Mg(()=>{A||S||(z.current=!1,R.current=!1,y6(I,B.current))},[A,S,I,c]),Mg(()=>{let e=c.current;if(!A||!F||!I||!e||S&&!C||s.state.transitionStatus===`ending`)return;if(z.current=!0,e.style.removeProperty(`--transform-origin`),!S){V.request(()=>h(L||e));return}let t=ume(e);try{let t=p.current;t?.isConnected||(t=!Q3.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=tg(I),i=r.getComputedStyle(I),a=r.getComputedStyle(e),o=Jg(F),c=k6(F),l=j6(F.getBoundingClientRect(),c),u=j6(I.getBoundingClientRect(),c),m=l.height,g=L||e,y=g.scrollHeight,b=parseFloat(a.borderBottomWidth),x=parseFloat(i.marginTop)||10,S=parseFloat(i.marginBottom)||10,C=parseFloat(i.minHeight)||100,T=D6(a),D=o.documentElement.clientHeight-x-S,O=o.documentElement.clientWidth,k=D-l.bottom+m,A,j=E===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=j6(n.getBoundingClientRect(),c);A=j6(t.getBoundingClientRect(),c),j=u.left+(E===`rtl`?e.right-A.right:e.left-A.left);let r=e.top-l.top+e.height/2;M=A.top-u.top+A.height/2-r}let N=k+M+S+b,P=Math.min(D,N),z=D-x-S,V=N-P,H=O-5;I.style.left=`${t6(j,5,H-u.width)}px`,I.style.height=`${P}px`,I.style.maxHeight=`none`,I.style.marginTop=`${x}px`,I.style.marginBottom=`${S}px`,e.style.height=`100%`;let U=O6(g),W=V>=U-1;W&&(P=Math.min(D,u.height)-(V-U));let G=l.top<20||l.bottom>D-20||Math.ceil(P)+1<Math.min(y,C),K=(r.visualViewport?.scale??1)!==1&&XH;if(G||K){y6(I,B.current),w(!1);return}let q=Math.max(C,P);if(W){let e=Math.max(0,D-N);I.style.top=u.height>=z?`0`:`${e}px`,I.style.height=`${P}px`,g.scrollTop=O6(g)}else I.style.bottom=`0`,g.scrollTop=V;if(A){let t=u.top,n=u.height,r=A.top+A.height/2,i=t6(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(q===D||P>=T)&&(R.current=!0),h(g),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,A,I,F,d,f,p,c,h,S,w,V,L,_,v,E,C]),Y.useEffect(()=>{if(!S||!I||!A)return;let e=tg(I);function t(e){u(!1,EH(TH,e))}return MU(e,`resize`,t)},[u,S,I,A]);let W={...L?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${k}-list`},onKeyDown(e){T&&wJ.has(e.key)&&e.stopPropagation()},onScroll(e){L||H(e.currentTarget)},...S&&{style:L?{height:`100%`}:b6},className:!L&&S?T6.className:void 0},G=o_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:cme,props:[N,W,x6(P),o]});return(0,X.jsxs)(Y.Fragment,{children:[!O&&T6.getElement(D),(0,X.jsx)(VG,{context:y,modal:!1,disabled:!M,openInteractionType:j,returnFocus:a,restoreFocus:!0,children:G})]})});function D6(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function O6(e){return n6(e.scrollHeight,e.clientHeight)}function k6(e){return jK.getScale(e)}function A6(e,t,n){return e/n[t]}function j6(e,t){return gW({x:A6(e.x,`x`,t),y:A6(e.y,`y`,t),width:A6(e.width,`x`,t),height:A6(e.height,`y`,t)})}var M6=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function ume(e){let{style:t}=e,n={};for(let[e,r]of M6)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of M6){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var dme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=j3(),{alignItemWithTriggerActive:l}=v6(),u=$(o,Q3.hasScrollArrows),d=$(o,Q3.openMethod),f={id:`${$(o,Q3.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:b6},className:u&&d!==`touch`?T6.className:void 0};return o_(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})});function N6(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Upe(),u=Y.useRef(-1),[d,f]=Y.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Y.useRef(null),h=Y.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Mg(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var P6=Y.createContext(void 0);function F6(){let e=Y.useContext(P6);if(!e)throw Error(Gg(57));return e}var fme=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Y.useRef(null),d=N6({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=j3(),C=x||s,w=$(f,Q3.isActive,d.index),T=$(f,Q3.open),E=$(f,Q3.isSelected,a),D=$(f,Q3.isSelectedByFocus,d.index),O=$(f,Q3.isItemEqualToValue),k=d.index,A=Y.useRef(null);Mg(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),Mg(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&H3(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let j=Y.useRef(`mouse`),M=Y.useRef(!1),{getButtonProps:N,buttonRef:P}=Xg({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),F={disabled:C,selected:E,highlighted:w};function I(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?G3(n,a,O):[...n,a];h(r,EH(dH,e))}else h(a,EH(dH,e)),m(!1,EH(dH,e))}function L(){g.current.dragY=0}let R={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=j.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&nU(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!M.current;M.current=!1,!(C||i)&&I(e.nativeEvent)},onPointerEnter(e){j.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){j.current=e.pointerType,M.current=!0,L()},onMouseUp(){if(L(),C||j.current===`touch`||M.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(M.current=!0,A.current?.click(),M.current=!1)}},z=o_(`div`,e,{ref:[P,t,d.ref,A],state:F,props:[p,R,l,N]}),B=Y.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,X.jsx)(P6.Provider,{value:B,children:z})})),pme=Y.forwardRef(function(e,t){let{selected:n}=F6();return e.keepMounted||n?(0,X.jsx)(mme,{...e,ref:t}):null}),mme=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=F6(),c=Y.useRef(null),{transitionStatus:l,setMounted:u}=hq(s),d=o_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:YV});return _q({open:s,ref:c,onComplete(){s||u(!1)}}),d})),hme=Y.memo(Y.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=F6(),{firstItemTextRef:a,selectedItemTextRef:o}=j3(),{render:s,className:c,style:l,...u}=e;return o_(`div`,e,{ref:[Y.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]),t,r],props:u})})),I6=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=j3(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=v6(),_=$(l,c?Q3.scrollUpArrowVisible:Q3.scrollDownArrowVisible),v=$(l,Q3.openMethod),y=_&&v!==`touch`,b=RH(),x=c?g:h,{mounted:S,transitionStatus:C,setMounted:w}=hq(y);Mg(()=>(p.current+=1,l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.set(`hasScrollArrows`,!1)}),[l,p]),_q({open:y,ref:x,onComplete(){y||w(!1)}});let T=o_(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:C},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f(e);let n=n6(e.scrollHeight,e.clientHeight),r=r6(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=gme(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s],stateAttributesMapping:YV});return S||o?T:null});function gme(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?r6(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?r6(l.offsetTop+l.offsetHeight-r+i,a):a}var _me=Y.forwardRef(function(e,t){return(0,X.jsx)(I6,{...e,ref:t,direction:`down`})}),vme=Y.forwardRef(function(e,t){return(0,X.jsx)(I6,{...e,ref:t,direction:`up`})}),L6=Y.createContext(void 0);function yme(){let e=Y.useContext(L6);if(e===void 0)throw Error(Gg(56));return e}var bme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Y.useState(),c=Y.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=o_(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,X.jsx)(L6.Provider,{value:c,children:l})}),xme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=yme(),c=NH(a);return Mg(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),o_(`div`,e,{ref:t,props:[{id:c},o]})}),Sme=Y.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return o_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`presentation`},o]})}),R6=(0,Y.createContext)(new Map);function z6(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(z6).join(` `):(0,Y.isValidElement)(e)?z6(e.props.children):``}function Cme(e){let t=[],n=e=>{Y.Children.forEach(e,e=>{if((0,Y.isValidElement)(e)){if(typeof e.props.value==`string`||e.props.value===null){let n=typeof e.props.label==`string`?e.props.label:z6(e.props.children).trim();n&&t.push({value:e.props.value,label:n})}e.props.children&&n(e.props.children)}})};return n(e),t}function B6(e){let t=(0,Z.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({onValueChange:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;if(t[4]!==n){a=new Map;for(let e of Cme(n))a.set(e.value,e.label);t[4]=n,t[5]=a}else a=t[5];let o=a,s;t[6]===r?s=t[7]:(s=e=>r?.(e),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==i||t[10]!==s?(c=(0,X.jsx)(Ppe,{"data-slot":`select`,multiple:!1,onValueChange:s,...i,children:n}),t[8]=n,t[9]=i,t[10]=s,t[11]=c):c=t[11];let l;return t[12]!==o||t[13]!==c?(l=(0,X.jsx)(R6.Provider,{value:o,children:c}),t[12]=o,t[13]=c,t[14]=l):l=t[14],l}function V6(e){return t=>{t!==null&&e(t)}}function wme(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(bme,{"data-slot":`select-group`,...n}),t[2]=n,t[3]=r),r}function H6(e){let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({placeholder:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,Y.useContext)(R6),a;t[3]!==i||t[4]!==n?(a=e=>i.get(e)??(e||n),t[3]=i,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==n||t[7]!==r||t[8]!==a?(o=(0,X.jsx)(Bpe,{"data-slot":`select-value`,placeholder:n,...r,children:a}),t[6]=n,t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function U6(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,size:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===r?s=t[6]:(s=Q(`flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[size=default]:h-9 data-[size=sm]:h-8 data-[disabled]:cursor-not-allowed data-[invalid]:border-destructive data-[placeholder]:text-muted-foreground data-[disabled]:opacity-50 data-[invalid]:ring-destructive/20 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:data-[invalid]:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(Vpe,{children:(0,X.jsx)(Jv,{className:`size-4 opacity-50`})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,X.jsxs)(Rpe,{className:s,"data-size":o,"data-slot":`select-trigger`,...i,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function W6(e){let t=(0,Z.c)(27),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:r,children:n,side:a,sideOffset:o,align:s,alignOffset:c,alignItemWithTrigger:l,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?`bottom`:a,d=o===void 0?4:o,f=s===void 0?`center`:s,p=c===void 0?0:c,m=l!==void 0&&l,h;t[9]===r?h=t[10]:(h=Q(`data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 max-h-(--available-height) w-max min-w-(--anchor-width) origin-(--transform-origin) overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-closed:animate-out data-open:animate-in`,r),t[9]=r,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(Dme,{}),t[11]=g):g=t[11];let _;t[12]===n?_=t[13]:(_=(0,X.jsx)(dme,{className:`max-h-[inherit] w-max min-w-full overflow-y-auto p-1`,children:n}),t[12]=n,t[13]=_);let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Ome,{}),t[14]=v):v=t[14];let y;t[15]!==m||t[16]!==i||t[17]!==h||t[18]!==_?(y=(0,X.jsxs)(lme,{className:h,"data-align-trigger":m,"data-slot":`select-content`,...i,children:[g,_,v]}),t[15]=m,t[16]=i,t[17]=h,t[18]=_,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==m||t[22]!==p||t[23]!==u||t[24]!==d||t[25]!==y?(b=(0,X.jsx)(Hpe,{children:(0,X.jsx)(rme,{align:f,alignItemWithTrigger:m,alignOffset:p,className:`isolate z-50`,side:u,sideOffset:d,children:y})}),t[20]=f,t[21]=m,t[22]=p,t[23]=u,t[24]=d,t[25]=y,t[26]=b):b=t[26],b}function Tme(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-1.5 text-muted-foreground text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(xme,{className:i,"data-slot":`select-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function G6(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex w-full cursor-default select-none items-center gap-2 whitespace-nowrap rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(pme,{children:(0,X.jsx)(qv,{className:`size-4`})})}),t[6]=o):o=t[6];let s;t[7]===n?s=t[8]:(s=(0,X.jsx)(hme,{children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,X.jsxs)(fme,{className:a,"data-slot":`select-item`,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function Eme(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`pointer-events-none -mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Sme,{className:i,"data-slot":`select-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dme(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex cursor-default items-center justify-center py-1 data-[visible=false]:hidden`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ote,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(vme,{className:i,"data-slot":`select-scroll-up-button`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Ome(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex cursor-default items-center justify-center py-1 data-[visible=false]:hidden`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Jv,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(_me,{className:i,"data-slot":`select-scroll-down-button`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function K6(e,t){let n=new Map;for(let e of t){let t=n.get(e.target);t?t.push(e.source):n.set(e.target,[e.source])}let r=new Set,i=new Set([e]),a=[e];for(;a.length>0;){let e=a.pop();if(e)for(let t of n.get(e)??[])r.add(t),i.has(t)||(i.add(t),a.push(t))}return r}var q6=`event:`;function J6(e){return`${q6}${e}`}function Y6(e){if(typeof e!=`string`||!e.startsWith(q6))return null;let t=e.slice(6).trim();return t.length>0?t:null}function kme(e){return e===y1.eventSplit}function X6(e){return S0(e)}function Z6(e){let{rule:t,event:n}=e,r=t.field.trim();return r===`$event.name`?P2(t)?!0:t.operator===`equals`?t.value===n.name:t.operator!==`not_equals`||t.value!==n.name:P2(t)||e.declaredElsewhere.has(r)?!0:n.payloadFields.some(e=>e.path===r)}function Q6(e){let{rule:t,event:n}=e;return t.field.trim()!==`$event.name`||P2(t)?!0:t.operator===`equals`?t.value!==n.name:t.operator!==`not_equals`||t.value===n.name}function Ame(e){let t=(t,n)=>n?t.every(t=>Z6({...e,rule:t})):t.some(t=>Z6({...e,rule:t})),n=e.model.groups.map(e=>t(e.conditions,e.logic===`and`));return e.model.groupLogic===`and`?n.every(Boolean):n.some(Boolean)}function jme(e){let t=(t,n)=>n?t.some(t=>Q6({...e,rule:t})):t.every(t=>Q6({...e,rule:t})),n=e.model.groups.map(e=>t(e.conditions,e.logic===`and`));return e.model.groupLogic===`and`?n.some(Boolean):n.every(Boolean)}function Mme(e){let{events:t,branch:n}=e;if(!n)return[...t];let r=$2(e.node.data.config?.conditionModel);return r.valid?t.filter(t=>{let i={model:r.model,event:t,declaredElsewhere:e.declaredElsewhere};return n===`true`?Ame(i):jme(i)}):[...t]}function Nme(e){let t=S1(e.entryNode.data.config);return t?Ka((e.handle===`started`?t.startEvents:e.handle===`canceled`?t.cancelEvents:[]).map(t=>Ny(e.catalog,t))):[]}function Pme(e,t){let n=e.data.config?.actionType;if(typeof n!=`string`)return[];let r=Py(t,n);return r?d0(e.data.config,r.outputFields).map(e=>e.path):[]}function Fme(e){let{catalog:t}=e,n=new Map(e.nodes.map(e=>[e.id,e])),r=new Map;for(let t of e.edges){let e=r.get(t.target);e?e.push(t):r.set(t.target,[t])}let i=r=>{let i=new Set,a=e=>{let r=n.get(e);if(r)for(let e of Pme(r,t))i.add(e)};a(r);for(let t of K6(r,e.edges))a(t);return i},a=new Map,o=(e,s)=>{let c=a.get(e);if(c)return c;if(s.has(e))return[];let l=r.get(e)??[];if(l.length===0)return a.set(e,[]),[];let u=new Set(s);u.add(e);let d=null;for(let e of l){let r=n.get(e.source);if(!r)continue;let a=r.data.type===`lifecycle`?Nme({entryNode:r,handle:e.sourceHandle,catalog:t}):Ime({parent:r,handle:e.sourceHandle,events:o(r.id,u),declaredElsewhere:i(r.id)});d=d===null?a:Lme(d,a)}let f=d??[];return a.set(e,f),f};return o(e.targetNodeId,new Set)}function Ime(e){let{parent:t,handle:n,events:r}=e;if(X6(t)){let e=Y6(n);return r.filter(t=>t.name===e)}return r.length>0&&T0(t)?Mme({events:r,node:t,branch:C0(n),declaredElsewhere:e.declaredElsewhere}):r}function Lme(e,t){let n=new Set(t.map(e=>e.name));return e.filter(e=>n.has(e.name))}function Rme(e){let t=Ya(Ka(e.map(e=>e.field.type)));return t.length<2?t[0]?{type:t[0]}:{}:{typeClash:{types:t,events:e.filter(e=>e.field.type).map(e=>e.event.name)}}}function zme(e){return e.find(e=>e.field.description)?.field.description}function Bme(e){return Ya(e.map(e=>(e.field.enumValues??[]).toSorted().join(` `))).length===1&&e[0]?.field.enumValues?[...e[0].field.enumValues]:void 0}function Vme(e){let t=new Map;for(let n of e)for(let e of n.payloadFields){let r=t.get(e.path);r?r.push({event:n,field:e}):t.set(e.path,[{event:n,field:e}])}return Array.from(t.entries()).map(([t,n])=>{let{type:r,typeClash:i}=Rme(n),a=zme(n),o=Bme(n);return{path:t,...a?{description:a}:{},...r?{type:r}:{},...o?{enumValues:o}:{},...i?{typeClash:i}:{},...n.length<e.length||n.some(e=>e.field.nullable)?{nullable:!0}:{},declaredBy:n.map(e=>e.event.name)}})}function $6(e,t){if(t.data.label)return t.data.label;if(t.data.type===`action`){let n=g0(t.data.config,`actionType`);if(n){let t=Py(e,n);if(t?.label)return t.label}return n||`Action`}return t.data.type===`lifecycle`?`Lifecycle`:`Node`}var e8=`Carried by every Event`,Hme=`Event name`;function Ume(e){return Vme(e).map(({declaredBy:t,...n})=>{let[r,i]=Ja(e,e=>t.includes(e.name));return{...n,...i.length>0?{absentOn:i.map(e=>e.label)}:{},...e.length<2?{}:{sourceLabel:i.length===0?e8:r.map(e=>e.label).join(`, `)}}})}function t8(e){return Fme({targetNodeId:e.targetNodeId,nodes:e.nodes,edges:e.edges,catalog:e.catalog})}function Wme(e,t){let n=Py(e,t);return n?[...n.outputFields]:[]}function n8(e,t){let n=g0(e.data.config,`actionType`);if(n){let r=Wme(t.catalog,n);if(r.length>0)return[...d0(e.data.config,r)]}return e.data.type===`lifecycle`?Ume(t8(t)):[]}function r8(e){let{currentNodeId:t,nodes:n,edges:r}=e;if(!t)return[];let i=K6(t,r);return n.filter(e=>i.has(e.id))}function Gme(e){let{currentNodeId:t,nodes:n,edges:r,catalog:i}=e;return t?r8(e).flatMap(e=>{let a=$6(i,e);return n8(e,{targetNodeId:t,nodes:n,edges:r,catalog:i}).map(({sourceLabel:t,...n})=>({...n,sourceNodeId:e.id,sourceNodeName:t??a}))}):[]}function i8(e){return e.type===`timestamp`?`timestamp`:e.type===`string`||e.type===`number`||e.type===`boolean`?e.type:e.type===`duration`||e.type===void 0?`string`:null}function Kme(e,t){let n=Ny(e,t);return n?Ka(n.payloadFields.map(e=>{let r=e.path.trim(),i=i8({...e,sourceNodeId:t,sourceNodeName:n.label});return r&&i?{path:r,label:r,type:i,sourceNodeId:t,sourceNodeLabel:n.label,sourceNodeLabels:[n.label],...e.nullable?{nullable:!0}:{},...e.enumValues?{enumValues:e.enumValues}:{}}:null})).toSorted((e,t)=>e.path.localeCompare(t.path)):[]}function qme(e){let{currentNodeId:t,nodes:n,edges:r,catalog:i}=e,a=r8(e).find(e=>e.data.type===`lifecycle`);if(!(a&&t))return[];let o=t8({targetNodeId:t,nodes:n,edges:r,catalog:i});return o.length<2?[]:[{path:Ade,label:Hme,type:`string`,sourceNodeId:a.id,sourceNodeLabel:e8,sourceNodeLabels:[e8],enumValues:o.map(e=>e.name)}]}function a8(e){let t=new Map(qme(e).map(e=>[e.path,e]));for(let n of Gme(e)){let e=n.path.trim();if(!e||n.typeClash)continue;let r=i8(n);if(!r)continue;let i=t.get(e);if(i){i.sourceNodeLabels.includes(n.sourceNodeName)||(i.sourceNodeLabels.push(n.sourceNodeName),i.sourceNodeLabels.sort((e,t)=>e.localeCompare(t)));continue}t.set(e,{path:e,label:e,type:r,sourceNodeId:n.sourceNodeId,sourceNodeLabel:n.sourceNodeName,sourceNodeLabels:[n.sourceNodeName],...n.nullable?{nullable:!0}:{},...n.enumValues?{enumValues:n.enumValues}:{}})}return Array.from(t.values()).toSorted((e,t)=>e.path.localeCompare(t.path))}function Jme(e,t,n){return!(t&&e.type)||n.allowNumber&&e.type===`number`?!0:e.type===t}function o8(e,t){return Jme(e,t,{allowNumber:!1})}function Yme(e,t,n){return n?2:t&&!e.type?1:0}function Xme(e,t){let n=e.typeClash;if(n&&!(t&&!n.types.some(e=>o8({type:e},t))))return`${n.events.join(` and `)} type this differently. Add an Event Split above this node to use it.`}function s8(e){let t=(0,Z.c)(45),{isOpen:n,position:r,onSelect:i,onClose:a,currentNodeId:o,filter:s,fieldType:c}=e,l=s===void 0?``:s,u=yy(),[d]=EA(Z4),[f]=EA(Q4),[p,m]=(0,Y.useState)(0),h=(0,Y.useRef)(null),g;t[0]!==o||t[1]!==f||t[2]!==d?(g=r8({currentNodeId:o,nodes:d,edges:f}),t[0]=o,t[1]=f,t[2]=d,t[3]=g):g=t[3];let _=g,v;bb0:{if(!o){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[4]=e):e=t[4],v=e;break bb0}let e;if(t[5]!==u||t[6]!==o||t[7]!==f||t[8]!==c||t[9]!==d||t[10]!==_){let n=[];for(let e of _){let t=$6(u,e),r=n8(e,{targetNodeId:o,nodes:d,edges:f,catalog:u});!c&&e.data.type!==`lifecycle`&&r.length&&n.push({type:`node`,rank:0,nodeId:e.id,nodeName:t,template:m0({nodeId:e.id,nodeLabel:t})});for(let i of r){let r=Xme(i,c);(r||o8(i,c))&&n.push({type:`field`,rank:Yme(i,c,r),nodeId:e.id,nodeName:t,field:i.path,description:i.description,template:m0({nodeId:e.id,nodeLabel:t,fieldPath:i.path}),...r?{unusable:r}:{},...i.absentOn?.length?{absentOn:i.absentOn}:{}})}}e=n.toSorted(Qme),t[5]=u,t[6]=o,t[7]=f,t[8]=c,t[9]=d,t[10]=_,t[11]=e}else e=t[11];v=e}let y=v,b;if(t[12]!==l||t[13]!==y){bb1:{let e=l.trim().toLowerCase();if(!e){b=y;break bb1}b=y.filter(t=>t.nodeName.toLowerCase().includes(e)||t.field&&t.field.toLowerCase().includes(e))}t[12]=l,t[13]=y,t[14]=b}else b=t[14];let x=b,S=x.length===0?0:Math.min(p,x.length-1),C=c&&y.length===0?c===`duration`?`No field upstream is a duration. Type a value like 24h.`:`No field upstream is a date and time. Type one, like 2026-03-10T09:00:00Z.`:null,w=x.length>0||C!==null,T;t[15]!==x||t[16]!==a||t[17]!==i||t[18]!==S?(T=e=>{bb87:switch(e.key){case`ArrowDown`:e.preventDefault(),m(e=>e<x.length-1?e+1:e);break bb87;case`ArrowUp`:e.preventDefault(),m(Zme);break bb87;case`Enter`:{e.preventDefault();let t=x[S];t&&!t.unusable&&i(t.template);break bb87}case`Escape`:e.preventDefault(),a()}},t[15]=x,t[16]=a,t[17]=i,t[18]=S,t[19]=T):T=t[19];let E=T,D=n&&w,O;t[20]===D?O=t[21]:(O={enabled:D},t[20]=D,t[21]=O),gY(window,`keydown`,E,O);let k;if(t[22]===S?k=t[23]:(k=()=>{let e=h.current?.children.item(S);e instanceof HTMLElement&&e.scrollIntoView({block:`nearest`})},t[22]=S,t[23]=k),_Y(S,k),!(n&&w)||typeof document>`u`)return null;let A=Math.min(r.top,window.innerHeight-300),j=Math.min(r.left,window.innerWidth-320),M;t[24]!==j||t[25]!==A?(M={top:A,left:j},t[24]=j,t[25]=A,t[26]=M):M=t[26];let N=M,P=`${N.top}px`,F=`${N.left}px`,I;t[27]!==P||t[28]!==F?(I={top:P,left:F},t[27]=P,t[28]=F,t[29]=I):I=t[29];let L;t[30]===C?L=t[31]:(L=C&&(0,X.jsx)(`div`,{className:`px-2 py-1.5 text-muted-foreground text-sm`,children:C}),t[30]=C,t[31]=L);let R;if(t[32]!==x||t[33]!==i||t[34]!==S){let e;t[36]!==i||t[37]!==S?(e=(e,t)=>(0,X.jsxs)(`div`,{className:Q(`flex items-center justify-between rounded px-2 py-1.5 text-sm transition-colors`,e.unusable?`cursor-not-allowed opacity-60`:`cursor-pointer`,t===S?`bg-accent text-accent-foreground`:!e.unusable&&`hover:bg-accent/50`),onMouseDown:t=>{t.preventDefault(),e.unusable||i(e.template)},onMouseEnter:()=>m(t),children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:e.type===`node`?e.nodeName:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.nodeName,`.`]}),e.field]})}),e.description&&(0,X.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.description}),e.absentOn&&(0,X.jsxs)(`div`,{className:`text-warning text-xs dark:text-warning`,children:[`Absent on `,e.absentOn.join(`, `)]}),e.unusable&&(0,X.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.unusable})]}),t===S&&!e.unusable&&(0,X.jsx)(qv,{className:`size-4`})]},`${e.nodeId}-${e.field||`root`}`),t[36]=i,t[37]=S,t[38]=e):e=t[38],R=x.map(e),t[32]=x,t[33]=i,t[34]=S,t[35]=R}else R=t[35];let z;t[39]!==L||t[40]!==R?(z=(0,X.jsxs)(`div`,{className:`max-h-60 overflow-y-auto`,ref:h,children:[L,R]}),t[39]=L,t[40]=R,t[41]=z):z=t[41];let B;return t[42]!==I||t[43]!==z?(B=(0,Xi.createPortal)((0,X.jsx)(`div`,{className:`fixed z-50 w-80 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,style:I,children:z}),document.body),t[42]=I,t[43]=z,t[44]=B):B=t[44],B}function Zme(e){return e>0?e-1:e}function Qme(e,t){return e.rank-t.rank}var c8=`data-placeholder`,l8=`data-filler`,$me=`inline-flex items-center gap-1 rounded bg-info/10 px-1.5 py-0.5 text-info font-mono text-xs border border-info/20 mx-0.5`,ehe=`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive font-mono text-xs border border-destructive/20 mx-0.5`;function the(e,t,n){let r=e.fieldPath?`${e.nodeLabel}.${e.fieldPath}`:e.nodeLabel,i=t.find(t=>t.id===e.nodeId);if(!i)return r;let a=i.data.label;if(!a&&i.data.type===`action`){let e=g0(i.data.config,`actionType`);e&&(a=Py(n,e)?.label)}return a?e.fieldPath?`${a}.${e.fieldPath}`:a:r}function nhe(e){return e instanceof HTMLElement?e.getAttribute(`data-template`):null}function u8(e){return e.start+e.text.length}function d8(e,t){let n=[],r=0;function i(e){n.push(e),r+=e.text.length}function a(e){if(e instanceof Text){i({kind:`text`,node:e,start:r,text:e.data});return}if(!(e instanceof HTMLElement))return;let n=nhe(e);if(n!==null){i({kind:`badge`,node:e,start:r,text:n});return}if(!(e.hasAttribute(c8)||e.hasAttribute(l8))){if(e.tagName===`BR`){i({kind:`break`,node:e,start:r,text:t?`
|
|
100
|
+
`:``});return}for(let t of Array.from(e.childNodes))a(t)}}for(let t of Array.from(e.childNodes))a(t);return n}function f8(e,t){return d8(e,t).map(e=>e.text).join(``)}function rhe(e,t){let{catalog:n}=t,r=t.multiline??!1,i={focused:!1,nodes:[]};function a(e){let t=e.at(-1);return t?u8(t):0}function o(e,t,n){let r=e.find(e=>e.kind===`text`&&e.node===t);if(r)return r.start+Math.min(n,r.text.length);let i=e.find(e=>e.kind!==`text`&&e.node.contains(t));if(i)return n===0?i.start:u8(i);if(t instanceof HTMLElement){let r=Array.from(t.childNodes);for(let t of r.slice(n)){let n=e.find(e=>e.node===t||t.contains(e.node));if(n)return n.start}let i=e.findLast(e=>t.contains(e.node));return i?u8(i):a(e)}return a(e)}function s(e,t,n){let r=e.find(e=>e.kind===`badge`&&(t===`start`?e.start:u8(e))===n);return r?{end:u8(r),start:r.start}:null}function c(){let t=window.getSelection();if(!t||t.rangeCount===0)return null;let n=t.getRangeAt(0);if(!e.contains(n.endContainer))return null;let i=d8(e,r),a=o(i,n.endContainer,n.endOffset);return{badgeAfter:s(i,`start`,a),badgeBefore:s(i,`end`,a),collapsed:n.collapsed,offset:a}}function l(){document.activeElement!==e&&e.focus()}function u(e,t){let n=e.find(e=>e.kind===`badge`&&t>e.start&&t<u8(e));if(n)return u(e,n.start);let r=e.findLast(e=>e.kind===`text`&&e.start<=t&&t<=u8(e));return r?.kind===`text`?{node:r.node,offset:t-r.start}:null}function d(t){let n=d8(e,r),i=u(n,Math.max(0,Math.min(t,a(n))));if(!i){l();return}let o=document.createRange(),s=window.getSelection();try{o.setStart(i.node,i.offset),o.collapse(!0),s?.removeAllRanges(),s?.addRange(o),l()}catch{l()}}function f(){e.appendChild(document.createTextNode(``))}function p(t){if(!r){e.appendChild(document.createTextNode(t));return}let n=t.split(`
|
|
101
|
+
`);n.forEach((t,r)=>{t&&e.appendChild(document.createTextNode(t)),r<n.length-1&&(f(),e.appendChild(document.createElement(`br`)),f())})}function m(t,r){i=r;let a=r.focused?r.caretOffset??c()?.offset??null:null;if(e.innerHTML=``,!(t||r.focused)){let t=document.createElement(`span`);t.setAttribute(c8,``),t.className=`text-muted-foreground pointer-events-none`,t.textContent=r.placeholder??``,e.appendChild(t);return}for(let i of p0(t)){if(i.kind===`literal`){p(i.text);continue}let t=document.createElement(`span`);t.className=r.nodes.some(e=>e.id===i.token.nodeId)?$me:ehe,t.contentEditable=`false`,t.setAttribute(`data-template`,i.token.raw),t.textContent=the(i.token,r.nodes,n),f(),e.appendChild(t),f()}if(!t){let t=document.createElement(`br`);t.setAttribute(l8,``),f(),e.appendChild(t)}r.focused&&a!==null&&d(a)}return{render:m,rerender(t){m(f8(e,r),{...i,nodes:t,caretOffset:void 0})},readText:()=>f8(e,r),readCaret:c,setCaretOffset:d,insertText(e){let t=window.getSelection();if(!t||t.rangeCount===0)return!1;let n=t.getRangeAt(0);n.deleteContents();let r=document.createTextNode(e);return n.insertNode(r),n.setStartAfter(r),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!0},insertLineBreak(){let e=window.getSelection();if(!e||e.rangeCount===0)return!1;let t=e.getRangeAt(0);t.deleteContents();let n=document.createElement(`br`),r=document.createTextNode(``);return t.insertNode(n),n.parentNode?.insertBefore(r,n.nextSibling),n.parentNode?.insertBefore(document.createTextNode(``),n),t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!0}}}function p8(e){let t=(0,Z.c)(52),{value:n,onChange:r,placeholder:i,multiline:a}=e,o=yy(),s=wA(Z4),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(n),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={top:0,left:0},t[0]=h):h=t[0];let[g,_]=(0,Y.useState)(h),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),S;t[1]!==o||t[2]!==a?(S=e=>{if(c.current=e,!e){l.current=null;return}l.current=rhe(e,{multiline:a,catalog:o})},t[1]=o,t[2]=a,t[3]=S):S=t[3];let C=S,w;t[4]!==d||t[5]!==s||t[6]!==i||t[7]!==n?(w=()=>{d||l.current?.render(n,{focused:!1,nodes:s,placeholder:i})},t[4]=d,t[5]=s,t[6]=i,t[7]=n,t[8]=w):w=t[8],_Y(d?m8:n,w);let T;t[9]!==d||t[10]!==s?(T=()=>{d||l.current?.rerender(s)},t[9]=d,t[10]=s,t[11]=T):T=t[11],_Y(d?m8:s,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=e.slice(0,t),r=n.lastIndexOf(`@`),i=r===-1?null:n.slice(r+1),a=f0(e).some(e=>r>=e.start&&r<e.end);if(i===null||a||i.includes(` `)){m(!1);return}y(i),x(r);let o=c.current?.getBoundingClientRect();o&&_({top:o.bottom+window.scrollY+4,left:o.left+window.scrollX}),m(!0)},t[12]=E):E=t[12];let D=E,O;t[13]!==s||t[14]!==r||t[15]!==i?(O=()=>{let e=l.current;if(!e)return;let t=e.readText();if(t===u.current)return;let n=f0(u.current).length,a=f0(t).length;if(u.current=t,r?.(t),n===a){D(t,e.readCaret()?.offset??t.length);return}m(!1),e.render(t,{focused:!0,nodes:s,placeholder:i})},t[13]=s,t[14]=r,t[15]=i,t[16]=O):O=t[16];let k=O,A;t[17]!==b||t[18]!==v||t[19]!==s||t[20]!==r||t[21]!==i?(A=e=>{let t=l.current;if(!t||b===null)return;let n=t.readText(),a=n.slice(0,b),o=n.slice(b+1+v.length),c=a+e+o;u.current=c,r?.(c),m(!1),x(null),f(!0),t.render(c,{caretOffset:a.length+e.length,focused:!0,nodes:s,placeholder:i})},t[17]=b,t[18]=v,t[19]=s,t[20]=r,t[21]=i,t[22]=A):A=t[22];let j=A,M;t[23]!==s||t[24]!==i||t[25]!==n?(M=()=>{f(!0);let e=l.current?.readText()??n;u.current=e,e||l.current?.render(``,{focused:!0,nodes:s,placeholder:i})},t[23]=s,t[24]=i,t[25]=n,t[26]=M):M=t[26];let N=M,P;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{setTimeout(()=>{document.activeElement!==c.current&&(f(!1),m(!1))},ihe)},t[27]=P):P=t[27];let F=P,I;t[28]===k?I=t[29]:(I=e=>{e.preventDefault(),l.current?.insertText(e.clipboardData.getData(`text/plain`))&&k()},t[28]=k,t[29]=I);let L=I,R;t[30]===k?R=t[31]:(R=()=>{l.current?.insertLineBreak()&&k()},t[30]=k,t[31]=R);let z=R,B;t[32]!==s||t[33]!==r||t[34]!==i?(B=e=>{let t=l.current;if(!t)return;let n=t.readText(),a=n.slice(0,e.start)+n.slice(e.end);u.current=a,r?.(a),m(!1),t.render(a,{caretOffset:e.start,focused:!0,nodes:s,placeholder:i})},t[32]=s,t[33]=r,t[34]=i,t[35]=B):B=t[35];let V=B,H;t[36]!==z||t[37]!==a||t[38]!==V?(H=e=>{let t=l.current;if(!t)return;if(a&&e.key===`Enter`){e.preventDefault(),z();return}if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.key===`Backspace`||e.key===`ArrowLeft`,r=e.key===`Delete`||e.key===`ArrowRight`;if(!(n||r))return;let i=t.readCaret();if(!i?.collapsed)return;let o=n?i.badgeBefore:i.badgeAfter;o&&(e.preventDefault(),e.key===`ArrowLeft`?t.setCaretOffset(o.start):e.key===`ArrowRight`?t.setCaretOffset(o.end):V(o))},t[36]=z,t[37]=a,t[38]=V,t[39]=H):H=t[39];let U=H,W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>m(!1),t[40]=W):W=t[40];let G;return t[41]!==C||t[42]!==v||t[43]!==g||t[44]!==j||t[45]!==N||t[46]!==k||t[47]!==U||t[48]!==L||t[49]!==s||t[50]!==p?(G={attachEditor:C,autocompleteFilter:v,autocompletePosition:g,handleBlur:F,handleFocus:N,handleInput:k,handleAutocompleteSelect:j,handleKeyDown:U,handlePaste:L,closeAutocomplete:W,nodes:s,showAutocomplete:p},t[41]=C,t[42]=v,t[43]=g,t[44]=j,t[45]=N,t[46]=k,t[47]=U,t[48]=L,t[49]=s,t[50]=p,t[51]=G):G=t[51],G}var m8=Symbol(`focused`),ihe=200;function h8(e){let t=(0,Z.c)(38),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,fieldType:c,currentNodeId:l,labelledBy:u,ariaLabel:d,required:f,invalid:p}=e,m=n===void 0?``:n,h;t[0]!==r||t[1]!==i||t[2]!==m?(h={value:m,onChange:r,placeholder:i},t[0]=r,t[1]=i,t[2]=m,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=p8(h),O;t[4]===E?O=t[5]:(O=E.find(ahe)?.id,t[4]=E,t[5]=O);let k=O,A=p&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex min-h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=p||void 0,P=p||void 0,F=f||void 0,I=!a,L;t[10]!==d||t[11]!==g||t[12]!==x||t[13]!==S||t[14]!==C||t[15]!==w||t[16]!==T||t[17]!==s||t[18]!==u||t[19]!==I||t[20]!==P||t[21]!==F?(L=(0,X.jsx)(`div`,{"aria-invalid":P,"aria-label":d,"aria-labelledby":u,"aria-required":F,className:`w-full outline-none`,contentEditable:I,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[10]=d,t[11]=g,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=s,t[18]=u,t[19]=I,t[20]=P,t[21]=F,t[22]=L):L=t[22];let R;t[23]!==L||t[24]!==M||t[25]!==N?(R=(0,X.jsx)(`div`,{className:M,"data-invalid":N,children:L}),t[23]=L,t[24]=M,t[25]=N,t[26]=R):R=t[26];let z=l??k??void 0,B;t[27]!==_||t[28]!==v||t[29]!==y||t[30]!==c||t[31]!==b||t[32]!==D||t[33]!==z?(B=(0,X.jsx)(s8,{currentNodeId:z,fieldType:c,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[27]=_,t[28]=v,t[29]=y,t[30]=c,t[31]=b,t[32]=D,t[33]=z,t[34]=B):B=t[34];let V;return t[35]!==R||t[36]!==B?(V=(0,X.jsxs)(X.Fragment,{children:[R,B]}),t[35]=R,t[36]=B,t[37]=V):V=t[37],V}function ahe(e){return e.selected}var ohe=[{label:`North America`,zones:[{value:`America/New_York`,label:`Eastern Time (ET)`},{value:`America/Chicago`,label:`Central Time (CT)`},{value:`America/Denver`,label:`Mountain Time (MT)`},{value:`America/Phoenix`,label:`Arizona Time (MST)`},{value:`America/Los_Angeles`,label:`Pacific Time (PT)`},{value:`America/Anchorage`,label:`Alaska Time (AKT)`},{value:`Pacific/Honolulu`,label:`Hawaii Time (HST)`},{value:`America/Toronto`,label:`Toronto`},{value:`America/Vancouver`,label:`Vancouver`}]},{label:`Europe`,zones:[{value:`Europe/London`,label:`London (GMT/BST)`},{value:`Europe/Paris`,label:`Paris (CET/CEST)`},{value:`Europe/Berlin`,label:`Berlin (CET/CEST)`},{value:`Europe/Rome`,label:`Rome (CET/CEST)`},{value:`Europe/Madrid`,label:`Madrid (CET/CEST)`},{value:`Europe/Amsterdam`,label:`Amsterdam (CET/CEST)`},{value:`Europe/Brussels`,label:`Brussels (CET/CEST)`},{value:`Europe/Stockholm`,label:`Stockholm (CET/CEST)`},{value:`Europe/Warsaw`,label:`Warsaw (CET/CEST)`},{value:`Europe/Athens`,label:`Athens (EET/EEST)`},{value:`Europe/Moscow`,label:`Moscow (MSK)`}]},{label:`Asia`,zones:[{value:`Asia/Dubai`,label:`Dubai (GST)`},{value:`Asia/Kolkata`,label:`India (IST)`},{value:`Asia/Shanghai`,label:`China (CST)`},{value:`Asia/Hong_Kong`,label:`Hong Kong (HKT)`},{value:`Asia/Tokyo`,label:`Tokyo (JST)`},{value:`Asia/Seoul`,label:`Seoul (KST)`},{value:`Asia/Singapore`,label:`Singapore (SGT)`},{value:`Asia/Bangkok`,label:`Bangkok (ICT)`},{value:`Asia/Jakarta`,label:`Jakarta (WIB)`}]},{label:`Australia & Pacific`,zones:[{value:`Australia/Sydney`,label:`Sydney (AEDT/AEST)`},{value:`Australia/Melbourne`,label:`Melbourne (AEDT/AEST)`},{value:`Australia/Brisbane`,label:`Brisbane (AEST)`},{value:`Australia/Perth`,label:`Perth (AWST)`},{value:`Pacific/Auckland`,label:`Auckland (NZDT/NZST)`}]},{label:`South America`,zones:[{value:`America/Sao_Paulo`,label:`São Paulo (BRT)`},{value:`America/Argentina/Buenos_Aires`,label:`Buenos Aires (ART)`},{value:`America/Santiago`,label:`Santiago (CLT)`},{value:`America/Bogota`,label:`Bogotá (COT)`},{value:`America/Lima`,label:`Lima (PET)`}]},{label:`Africa & Middle East`,zones:[{value:`Africa/Cairo`,label:`Cairo (EET)`},{value:`Africa/Johannesburg`,label:`Johannesburg (SAST)`},{value:`Africa/Lagos`,label:`Lagos (WAT)`},{value:`Africa/Nairobi`,label:`Nairobi (EAT)`},{value:`Asia/Jerusalem`,label:`Jerusalem (IST)`}]},{label:`Other`,zones:[{value:`UTC`,label:`UTC (Coordinated Universal Time)`}]}];function she(e){let t=(0,Z.c)(11),{value:n,onValueChange:r,disabled:i,id:a}=e,o;t[0]===r?o=t[1]:(o=V6(r),t[0]=r,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(H6,{placeholder:`Select timezone`}),t[2]=s):s=t[2];let c;t[3]===a?c=t[4]:(c=(0,X.jsx)(U6,{className:`w-full`,id:a,children:s}),t[3]=a,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(W6,{children:ohe.map(che)}),t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==n?(u=(0,X.jsxs)(B6,{disabled:i,onValueChange:o,value:n,children:[c,l]}),t[6]=i,t[7]=o,t[8]=c,t[9]=n,t[10]=u):u=t[10],u}function che(e){return(0,X.jsxs)(wme,{children:[(0,X.jsx)(Tme,{children:e.label}),e.zones.map(lhe)]},e.label)}function lhe(e){return(0,X.jsx)(G6,{value:e.value,children:e.label},e.value)}var g8=Y.createContext(void 0);function _8(e){let t=Y.useContext(g8);if(t===void 0&&!e)throw Error(Gg(72));return t}var uhe={...Bq,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},dhe=class extends dq{constructor(e,t,n){let r=new jq;super(fhe(e,r,t,n),phe(r),uhe)}setOpen=(e,t)=>{Tq(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,EH(sH,e))}};function fhe(e,t,n,r=!1){let i={...Nq(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=Pq(t,n,r),i}function phe(e){return{popupRef:Y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var mhe=nq(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=bq((e,t)=>new dhe({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Dq(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=Oq(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Y.useRef(null);Mg(()=>{m&&t&&p.setOpen(!1,EH(CH))},[m,t,p]),Mg(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Mg(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Y.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,EH(wH))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,X.jsxs)(g8.Provider,{value:p,children:[l&&(0,X.jsx)(xq,{handle:l,store:p}),T&&(0,X.jsx)(hhe,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function hhe({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=JG(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=GG(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Y.useMemo(()=>Fg(a.reference,i.reference),[a.reference,i.reference]);return kq(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??a_}),null}var v8=Y.createContext(void 0);function ghe(){return Y.useContext(v8)}var y8=`data-base-ui-tooltip-trigger`;function b8(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(ig(n))return n}}let t=e.target;return ig(t)?t:null}function _he(e){let t=e;for(;t;){let e=t.closest(`[${y8}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&ig(n.host)?n.host:null}return null}var vhe=rq(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=_8(!0),m=Vq(a)??p;if(!m)throw Error(Gg(82));let h=NH(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Y.useRef(null),b=c??600,x=u??0,{registerTrigger:S,isMountedByThisTrigger:C}=Eq(h,y,m,{payload:o,closeOnClick:l,closeDelay:x}),w=ghe(),{delayRef:T,isInstantPhase:E,hasProvider:D}=jU(v,{open:_}),O=Zq(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=PU(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Y.useRef(!1),F=RH(),I=Y.useRef(void 0);function L(){return D?wU(T.current,`open`)===0?0:c??w??600:b}function R(e){let t=y.current;if(!t||!e)return!1;let n=_he(e);return n!==null&&n!==t&&pU(t,n)}function z(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let B=eJ(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?_J():null,restMs:L,delay(){return u==null&&D?{close:wU(T.current,`close`)}:{close:x}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),V=Kq(v,{enabled:!A}).reference,H=e=>{let t=P.current,n=b8(e),r=z(n),i=y.current,a=i&&n&&pU(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,EH(cH,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&iU(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,EH(cH,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},U=m.useState(`triggerProps`,C);return o_(`button`,e,{state:{open:_},ref:[t,S,y],props:[B,V,C||M!==`none`?U:void 0,{onMouseOver(e){H(e.nativeEvent)},onFocus(e){R(b8(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,"data-trigger-disabled":A?``:void 0,[y8]:A?void 0:``},f],stateAttributesMapping:tH})}),x8=Y.createContext(void 0);function yhe(){let e=Y.useContext(x8);if(e===void 0)throw Error(Gg(70));return e}var bhe=Y.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=xG({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,X.jsxs)(Y.Fragment,{children:[l,c&&Xi.createPortal(n,c)]})}),xhe=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return _8().useState(`mounted`)||n?(0,X.jsx)(x8.Provider,{value:n,children:(0,X.jsx)(bhe,{ref:t,...r})}):null}),S8=Y.createContext(void 0);function C8(){let e=Y.useContext(S8);if(e===void 0)throw Error(Gg(71));return e}var She=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=gG,style:g,..._}=e,v=_8(),y=yhe(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=h6({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=S6(e,Y.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,X.jsx)(S8.Provider,{value:D,children:O})}),Che=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=_8(),{side:s,align:c}=C8(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);_q({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),Qq(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return o_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[vq,f,x6(d),a],stateAttributesMapping:iH})}),whe=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=_8(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=C8();return o_(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:rH})}),The=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Y.useMemo(()=>({open:t,close:n}),[t,n]);return(0,X.jsx)(v8.Provider,{value:t,children:(0,X.jsx)(AU,{delay:i,timeoutMs:r,children:e.children})})};function w8(e){let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,X.jsx)(The,{closeDelay:0,"data-slot":`tooltip-provider`,delay:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function T8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(w8,{children:(0,X.jsx)(mhe,{"data-slot":`tooltip`,...n})}),t[2]=n,t[3]=r),r}function E8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(vhe,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function D8(e){let t=(0,Z.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--transform-origin) text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(whe,{className:`z-50 size-2.5 rotate-45 rounded-[2px] bg-foreground`}),t[7]=c):c=t[7];let l;t[8]!==n||t[9]!==s?(l=(0,X.jsxs)(Che,{className:s,"data-slot":`tooltip-content`,children:[n,c]}),t[8]=n,t[9]=s,t[10]=l):l=t[10];let u;return t[11]!==i||t[12]!==o||t[13]!==l?(u=(0,X.jsx)(xhe,{children:(0,X.jsx)(She,{sideOffset:o,...i,children:l})}),t[11]=i,t[12]=o,t[13]=l,t[14]=u):u=t[14],u}var Ehe=[];function O8(e){let t=(0,Z.c)(5),n=yy(),r=wA(Z4),i=wA(Q4),a;return t[0]!==n||t[1]!==i||t[2]!==e||t[3]!==r?(a=e?t8({targetNodeId:e,nodes:r,edges:i,catalog:n}):Ehe,t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=a):a=t[4],a}function Dhe(e){let t=(0,Z.c)(40),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,rows:c,fieldType:l,labelledBy:u,required:d,invalid:f}=e,p=n===void 0?``:n,m=c===void 0?3:c,h;t[0]!==r||t[1]!==i||t[2]!==p?(h={value:p,onChange:r,placeholder:i,multiline:!0},t[0]=r,t[1]=i,t[2]=p,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=p8(h),O;t[4]===E?O=t[5]:(O=E.find(Ohe)?.id,t[4]=E,t[5]=O);let k=O,A=f&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=f||void 0,P=`${m*1.5}rem`,F;t[10]===P?F=t[11]:(F={minHeight:P},t[10]=P,t[11]=F);let I=f||void 0,L=d||void 0,R=!a,z;t[12]!==g||t[13]!==x||t[14]!==S||t[15]!==C||t[16]!==w||t[17]!==T||t[18]!==s||t[19]!==u||t[20]!==I||t[21]!==L||t[22]!==R?(z=(0,X.jsx)(`div`,{"aria-invalid":I,"aria-labelledby":u,"aria-required":L,className:`w-full whitespace-pre-wrap break-words outline-none`,contentEditable:R,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[12]=g,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=s,t[19]=u,t[20]=I,t[21]=L,t[22]=R,t[23]=z):z=t[23];let B;t[24]!==F||t[25]!==z||t[26]!==M||t[27]!==N?(B=(0,X.jsx)(`div`,{className:M,"data-invalid":N,style:F,children:z}),t[24]=F,t[25]=z,t[26]=M,t[27]=N,t[28]=B):B=t[28];let V=k||void 0,H;t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==l||t[33]!==b||t[34]!==D||t[35]!==V?(H=(0,X.jsx)(s8,{currentNodeId:V,fieldType:l,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[29]=_,t[30]=v,t[31]=y,t[32]=l,t[33]=b,t[34]=D,t[35]=V,t[36]=H):H=t[36];let U;return t[37]!==B||t[38]!==H?(U=(0,X.jsxs)(X.Fragment,{children:[B,H]}),t[37]=B,t[38]=H,t[39]=U):U=t[39],U}function Ohe(e){return e.selected}function khe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=typeof r==`string`?r:``,c;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(h8,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,value:s}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ahe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=n.rows||4,c=typeof r==`string`?r:``,l;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,X.jsx)(Dhe,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,rows:s,value:c}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function jhe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.value),t[0]=i,t[1]=o);let s=typeof r==`string`?r:``,c;return t[2]!==a||t[3]!==n.key||t[4]!==n.placeholder||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(CX,{disabled:a,id:n.key,onChange:o,placeholder:n.placeholder,value:s}),t[2]=a,t[3]=n.key,t[4]=n.placeholder,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Mhe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=typeof r==`number`||typeof r==`string`?`${r}`:``,s;t[0]===i?s=t[1]:(s=e=>{let t=e.target.value.trim();if(!t){i(void 0);return}let n=Number.parseFloat(t);Number.isFinite(n)&&i(n)},t[0]=i,t[1]=s);let c;return t[2]!==a||t[3]!==o||t[4]!==n.key||t[5]!==n.min||t[6]!==n.placeholder||t[7]!==s?(c=(0,X.jsx)(CX,{disabled:a,id:n.key,min:n.min,onChange:s,placeholder:n.placeholder,type:`number`,value:o}),t[2]=a,t[3]=o,t[4]=n.key,t[5]=n.min,t[6]=n.placeholder,t[7]=s,t[8]=c):c=t[8],c}function Nhe(e){let t=(0,Z.c)(15),{field:n,value:r,onChange:i,disabled:a}=e;if(!n.options)return null;let o=typeof r==`string`?r:``,s;t[0]===n.placeholder?s=t[1]:(s=(0,X.jsx)(H6,{placeholder:n.placeholder}),t[0]=n.placeholder,t[1]=s);let c;t[2]!==n.key||t[3]!==s?(c=(0,X.jsx)(U6,{className:`w-full`,id:n.key,children:s}),t[2]=n.key,t[3]=s,t[4]=c):c=t[4];let l;t[5]===n.options?l=t[6]:(l=n.options.map(Phe),t[5]=n.options,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,X.jsx)(W6,{children:l}),t[7]=l,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==o||t[12]!==c||t[13]!==u?(d=(0,X.jsxs)(B6,{disabled:a,onValueChange:i,value:o,children:[c,u]}),t[9]=a,t[10]=i,t[11]=o,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Phe(e){return(0,X.jsx)(G6,{value:e.value,children:e.label},e.value)}var Fhe=0;function k8(){return`kv-${++Fhe}`}function Ihe(e){return typeof e!=`object`||!e||!(`name`in e&&`value`in e)?!1:typeof e.name==`string`&&typeof e.value==`string`}function Lhe(e){if(typeof e!=`string`||!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(Ihe)}catch{}return[]}function Rhe(e){let t=(0,Z.c)(29),{value:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=()=>Lhe(n).map(Bhe),t[0]=n,t[1]=a);let[o,s]=(0,Y.useState)(a),c;t[2]===r?c=t[3]:(c=function(e){s(e),r(JSON.stringify(e.map(zhe)))},t[2]=r,t[3]=c);let l=c,u;t[4]!==o||t[5]!==l?(u=function(){l([...o,{name:``,value:``,_id:k8()}])},t[4]=o,t[5]=l,t[6]=u):u=t[6];let d=u,f;t[7]!==o||t[8]!==l?(f=function(e){l(o.filter(t=>t._id!==e))},t[7]=o,t[8]=l,t[9]=f):f=t[9];let p=f,m;t[10]!==o||t[11]!==l?(m=function(e,t,n){l(o.map(r=>r._id===e?{...r,[t]:n}:r))},t[10]=o,t[11]=l,t[12]=m):m=t[12];let h=m,g;if(t[13]!==i||t[14]!==p||t[15]!==o||t[16]!==h){let e;t[18]!==i||t[19]!==p||t[20]!==h?(e=e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(CX,{className:`flex-1`,disabled:i,onChange:t=>h(e._id,`name`,t.target.value),placeholder:`Name`,value:e.name}),(0,X.jsx)(h8,{ariaLabel:`Value`,className:`flex-1`,disabled:i,onChange:t=>h(e._id,`value`,t??``),placeholder:`Value`,value:e.value}),(0,X.jsx)(zv,{className:`size-8 shrink-0`,disabled:i,onClick:()=>p(e._id),size:`icon`,type:`button`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})})]},e._id),t[18]=i,t[19]=p,t[20]=h,t[21]=e):e=t[21],g=o.map(e),t[13]=i,t[14]=p,t[15]=o,t[16]=h,t[17]=g}else g=t[17];let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(cy,{className:`mr-1 size-3.5`}),t[22]=_):_=t[22];let v;t[23]!==d||t[24]!==i?(v=(0,X.jsxs)(zv,{className:`h-8`,disabled:i,onClick:d,size:`sm`,type:`button`,variant:`outline`,children:[_,`Add`]}),t[23]=d,t[24]=i,t[25]=v):v=t[25];let y;return t[26]!==g||t[27]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[g,v]}),t[26]=g,t[27]=v,t[28]=y):y=t[28],y}function zhe(e){let{name:t,value:n}=e;return{name:t,value:n}}function Bhe(e){return{...e,_id:k8()}}var Vhe={"template-input":khe,"template-textarea":Ahe,text:jhe,number:Mhe,select:Nhe,"key-value":Rhe};function A8(e,t,n,r){if(!u0(t,e.showWhen))return null;let i=t[e.key]??e.defaultValue??``,a=Vhe[e.type];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.label&&(0,X.jsxs)(wX,{className:`ml-1`,htmlFor:e.key,id:`${e.key}-label`,children:[e.label,e.required&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:`*`})]}),(0,X.jsx)(a,{disabled:r,field:e,onChange:t=>n({[e.key]:t}),value:i})]},e.key)}function Hhe(e){let t=(0,Z.c)(19),{label:n,fields:r,config:i,onUpdateConfig:a,disabled:o,defaultExpanded:s}=e,[c,l]=(0,Y.useState)(s!==void 0&&s),u;t[0]===c?u=t[1]:(u=()=>l(!c),t[0]=c,t[1]=u);let d;t[2]===n?d=t[3]:(d=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:n}),t[2]=n,t[3]=d);let f=`size-3.5 text-muted-foreground transition-transform duration-200 ${c?``:`-rotate-90`}`,p;t[4]===f?p=t[5]:(p=(0,X.jsx)(Jv,{className:f}),t[4]=f,t[5]=p);let m;t[6]!==u||t[7]!==d||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`ml-1 flex items-center gap-1 text-left`,onClick:u,type:`button`,children:[d,p]}),t[6]=u,t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==i||t[11]!==o||t[12]!==r||t[13]!==c||t[14]!==a?(h=c&&(0,X.jsx)(`div`,{className:`ml-1 space-y-4 border-primary/50 border-l-2 py-2 pl-3`,children:r.map(e=>A8(e,i,a,o))}),t[10]=i,t[11]=o,t[12]=r,t[13]=c,t[14]=a,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Uhe(e){let t=(0,Z.c)(11),{fields:n,config:r,onUpdateConfig:i,disabled:a}=e,o;if(t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==i){let e;t[5]!==r||t[6]!==a||t[7]!==i?(e=e=>h4(e)?(0,X.jsx)(Hhe,{config:r,defaultExpanded:e.defaultExpanded,disabled:a,fields:e.fields,label:e.label,onUpdateConfig:i},`group-${e.label}`):A8(e,r,i,a),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],o=n.map(e),t[0]=r,t[1]=a,t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,X.jsx)(X.Fragment,{children:o}),t[9]=o,t[10]=s),s}function Whe(e,t,n,r,i,a,o,s,c,l=2){let u=SW(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return vW(n.current,u)?void 0:u}var j8=Y.createContext(void 0),M8=Y.createContext(void 0),N8=Y.createContext(void 0),P8=Y.createContext(!1),F8=Y.createContext(``);function I8(){let e=Y.useContext(j8);if(!e)throw Error(Gg(22));return e}function L8(){let e=Y.useContext(M8);if(!e)throw Error(Gg(23));return e}function R8(){let e=Y.useContext(N8);if(!e)throw Error(Gg(24));return e}function z8(){return Y.useContext(F8)}function Ghe(){return Y.useContext(P8)}var B8={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?J3(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>H3(t,e,n)):H3(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function V8(e){return e==null?void 0:`${e}-popup`}function Khe(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function H8(e){return Array.isArray(e)?e.map(e=>H8(e)).join(`,`):e==null?``:String(e)}var U8=new Map;function qhe(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${H8(e.locale)}|${JSON.stringify(t)}`,r=U8.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=Y3(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=Y3(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=Y3(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return U8.set(n,a),a}var Jhe=qhe;function Yhe(e,t=!1){let{overflowY:n}=vg(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var W8=Symbol(`none`),G8={value:W8,index:-1};function Xhe(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u,onItemHighlighted:d,name:f,form:p,disabled:m=!1,readOnly:h=!1,required:g=!1,inputRef:_,grid:v=!1,items:y,filteredItems:b,filter:x,openOnInputClick:S=!0,autoHighlight:C=!1,keepHighlight:w=!1,highlightItemOnHover:T=!0,loopFocus:E=!0,itemToStringLabel:D,itemToStringValue:O,isItemEqualToValue:k=V3,virtualized:A=!1,inline:j=!1,fillInputOnItemPress:M=!0,modal:N=!1,limit:P=-1,autoComplete:F=`list`,formAutoComplete:I,locale:L,submitOnItemClick:R=!1}=e,{clearErrors:z}=$3(),{setDirty:B,validityData:V,setFilled:H,name:U,disabled:W,setTouched:G,setFocused:K,validationMode:q,validation:J}=L3(),ee=u6(),te=B3({id:t}),ne=Jhe({locale:L}),[re,ie]=Y.useState(!1),[ae,oe]=Y.useState(null),se=Y.useRef([]),ce=Y.useRef([]),le=Y.useRef(null),ue=Y.useRef(null),de=Y.useRef(null),fe=Y.useRef(null),pe=Y.useRef(null),me=Y.useRef(!0),he=Y.useRef(!1),ge=Y.useRef(null),_e=Y.useRef(null),ve=Y.useRef(null),ye=Y.useRef(G8),be=Y.useRef(null),xe=Y.useRef([]),Se=Y.useRef(null),Ce=W||m,we=U??f,Te=u===`multiple`,Ee=u===`single`,De=s!==void 0||o!==void 0,Oe=y!==void 0,ke=b!==void 0,Ae;Ae=C===`always`?`always`:C?`input-change`:!1;let[je,Me]=k3({controlled:i,default:Te?r??i_:r,name:`Combobox`,state:`selectedValue`}),Ne=Y.useMemo(()=>x===null?()=>!0:x===void 0?Khe(ne,D):x,[x,ne,D]),Pe=Eg(()=>De?o??``:Ee?Y3(je,D):``).current,[Fe,Ie]=k3({controlled:s,default:Pe,name:`Combobox`,state:`inputValue`}),[Le,Re]=k3({controlled:c,default:l,name:`Combobox`,state:`open`}),ze=q3(y),Be=ae??String(Fe).trim(),Ve=Ee?Y3(je,D):``,He=Ee&&!re&&Be!==``&&Ve.length===Be.length&&ne.contains(Ve,Be),Ue=He?``:Be,We=Oe&&ke&&He,Ge=Y.useMemo(()=>y?ze?y.flatMap(e=>e.items):y:i_,[y,ze]),Ke=Y.useMemo(()=>{if(b&&!We)return b;if(!y)return i_;if(ze){let e=y,t=[],n=0;for(let r of e){if(P>-1&&n>=P)break;let e=P>-1?P-n:1/0,i=Ue===``?r.items.slice(0,e):[];if(Ue!==``)for(let t of r.items){if(i.length>=e)break;Ne(t,Ue,D)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(Ue===``)return P>-1?Ge.slice(0,P):Ge;let e=[];for(let t of Ge){if(P>-1&&e.length>=P)break;Ne(t,Ue,D)&&e.push(t)}return e},[b,We,y,ze,Ue,P,Ne,D,Ge]),qe=Y.useMemo(()=>ze?Ke.flatMap(e=>e.items):Ke,[Ke,ze]),Je=Eg(()=>{let e=null;return j&&Le&&Oe&&u!==`none`&&(e=W3(qe,je,k,Te)),new uq({id:te,labelId:void 0,selectedValue:je,open:Le,items:y,selectionMode:u,listRef:se,labelsRef:ce,popupRef:le,emptyRef:pe,inputRef:ue,startDismissRef:de,endDismissRef:fe,keyboardActiveRef:me,chipsContainerRef:ge,clearRef:_e,valuesRef:xe,pointerDownItemRef:Se,selectionEventRef:ve,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,isItemEqualToValue:k,modal:N,autoHighlight:Ae,submitOnItemClick:R,hasInputValue:De,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:j,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:a_,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`,onOpenChangeComplete:r_,setOpen:r_,setInputValue:r_,setSelectedValue:r_,setIndices:r_,handleSelection:r_,forceMount:r_,requestSubmit:r_})}).current,Ye=u===`none`?Fe:je,Xe=Y.useMemo(()=>u===`none`?Ye:Array.isArray(je)?je.map(e=>X3(e,O)):X3(je,O),[Ye,O,u,je]),Ze=kg(d),Qe=kg(n),$e=$(Je,B8.activeIndex),et=$(Je,B8.selectedIndex),tt=$(Je,B8.positionerElement),nt=$(Je,B8.listElement),rt=$(Je,B8.triggerElement),it=$(Je,B8.inputElement),at=$(Je,B8.inputGroupElement),ot=$(Je,B8.inline),st=$(Je,B8.inputInsidePopup),ct=$(Je,B8.inputOwnsFormValue),lt=PU(rt),{mounted:ut,setMounted:dt,transitionStatus:ft}=hq(Le),{openMethod:pt,triggerProps:mt}=oY(Le),ht=kg(()=>Xe);R3(st?lt:ue,te,Ye,ht,!Ce,f);let gt=kg(()=>{y?ce.current=qe.map(e=>Y3(e,D)):Je.set(`forceMounted`,!0)}),_t=kg((e,t,n)=>{if(t===-1){if(ye.current===G8)return;ye.current=G8}else ye.current={value:e,index:t};Ze(e,DH(n,void 0,{index:t}))}),vt=kg(e=>{Je.update(e);let t=e.activeIndex;if(t===void 0)return;let n=e.type||`none`;t===null?_t(void 0,-1,n):_t(xe.current[t],t,n)}),yt=kg((t,n)=>{if(he.current=n.reason===mH,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){Le&&ae!==null&&oe(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&ie(!0),be.current={hasQuery:e};let n=Je.state.listElement;if(!Je.state.virtualized&&n){let e=le.current;for(let t of Sg(n.firstElementChild??n)){if(!ag(t)||(e?!pU(e,t):t.getAttribute(`role`)===`dialog`))break;if(Yhe(t)){t.scrollTop=0;break}}}e&&Ae&&Je.state.activeIndex==null&&(Le||ot)&&Je.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Je.state.inputInsidePopup&&(be.current={hasQuery:!1,selection:!0});Ie(t)}}),bt=kg((t,n)=>{if(Le!==t&&(n.reason===`escape-key`&&Oe&&qe.length===0&&!pe.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&st&&!ot&&ae!==null&&(ie(!1),oe(null),Fe!==``&&n.reason!==`input-change`&&yt(``,EH(mH,n.event))),!t&&re&&(Ee?(ot||oe(Be),Be===``&&ie(!1)):Te&&(ot||oe(Be),st&&vt({activeIndex:null}),(!st||ot)&&yt(``,EH(mH,n.event)))),Re(t),!t&&st&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(G(!0),K(!1),q===`onBlur`)))){let e=u===`none`?Fe:je;J.commit(e)}}),xt=kg((e,t)=>{a?.(e,t),!t.isCanceled&&(Me(e),(u===`none`&&le.current&&M||Ee&&!Je.state.inputInsidePopup)&&yt(Y3(e,D),EH(t.reason,t.event)))}),St=kg((e,t)=>{let n=mU(e),r=ve.current??e;ve.current=null;let i=EH(dH,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&bt(!1,i);return}if(Te){let e=Array.isArray(je)?je:[],n=jpe(e,t,k)?G3(e,t,k):[...e,t];if(xt(n,i),i.isCanceled||!(ue.current&&ue.current.value.trim()!==``))return;Je.state.inputInsidePopup?yt(``,EH(mH,i.event)):bt(!1,i)}else{if(xt(t,i),i.isCanceled)return;bt(!1,i)}}),Ct=kg(()=>{let e=J.inputRef.current?.form??Je.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),wt=kg(()=>{if(dt(!1),Qe?.(!1),ie(!1),oe(null),vt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Te&&ue.current&&ue.current.value!==``&&!he.current&&yt(``,EH(mH)),Ee){if(Je.state.inputInsidePopup)ue.current&&ue.current.value!==``&&yt(``,EH(mH));else{let e=Y3(je,D);ue.current&&ue.current.value!==e&&yt(e,EH(e===``?mH:oH))}}}),Tt=Y.useMemo(()=>ot&&tt?{current:tt.closest(`[role="dialog"]`)}:le,[ot,tt]);_q({enabled:!e.actionsRef,open:Le,ref:Tt,onComplete(){Le||wt()}}),Y.useImperativeHandle(e.actionsRef,()=>({unmount:wt}),[wt]),Mg(function(){if(Le||(Se.current=null,u===`none`))return;let e=Oe?Ge:xe.current;vt({selectedIndex:W3(e,je,k,Te)})},[Le,je,u,Te,Oe,Ge,k,vt]),Mg(()=>{y&&(xe.current=qe,se.current.length=qe.length)},[y,qe]),Mg(()=>{let e=be.current;if(e){let t=Le||ot||Je.state.positionerElement?.hidden===!1;if(e.hasQuery)Ae&&t&&Je.set(`activeIndex`,0),be.current=null;else if(String(Fe).trim()===``&&(be.current=null,t)){let t=e.selection;Ae===`always`&&!t&&Je.state.selectionMode===`none`&&Je.set(`activeIndex`,0),queueMicrotask(()=>{if(!Je.state.open&&!Je.state.inline||ue.current&&ue.current.value.trim()!==``)return;let e=Je.state.selectedValue,n=Je.state.selectionMode===`multiple`,r=n&&Array.isArray(e)?e[e.length-1]:e,i=Je.state.selectionMode!==`none`&&r!=null;if(i||t){let t=Oe||ke?qe:xe.current;Je.set(`activeIndex`,i?W3(t,e,Je.state.isItemEqualToValue,n):null)}else Ae===`always`&&Je.set(`activeIndex`,0)})}}if(!Le&&!ot)return;let t=Oe||ke?qe:xe.current,n=Je.state.activeIndex;if(n==null){if(Ae===`always`&&t.length>0){Je.set(`activeIndex`,0);return}_t(void 0,-1,oH);return}if(n>=t.length){_t(void 0,-1,oH),Je.set(`activeIndex`,null);return}let r=t[n],i=ye.current.value,a=i!==W8&&H3(r,i,Je.state.isItemEqualToValue);(ye.current.index!==n||!a)&&_t(r,n,oH)},[$e,Ae,_t,ke,Oe,qe,ot,Le,Je,Fe]),Mg(()=>{if(u===`none`){H(String(Fe)!==``);return}H(Te?Array.isArray(je)&&je.length>0:je!=null)},[H,u,Fe,je,Te]),Y.useEffect(()=>{Oe&&Ae&&qe.length===0&&vt({activeIndex:null})},[Oe,Ae,qe.length,vt]);function Et(e){let t=V.initialValue;return Array.isArray(e)&&Array.isArray(t)?!e6(e,t,(e,t)=>H3(e,t,k)):e!==t}iY(Be,()=>{!Le||Be===``||Be===String(Pe)||ie(!0)});function Dt(){let e=Y3(je,D);Fe!==e&&yt(e,EH(oH))}iY(je,()=>{u!==`none`&&(z(we),B(Et(je)),J.change(je),Ee&&!De&&!st&&Dt())}),iY(Fe,()=>{u===`none`&&(z(we),B(Fe!==V.initialValue),J.change(Fe))}),iY(y,()=>{!Ee||De||st||re||Dt()});let Ot=Hq({open:ot?!0:Le,onOpenChange:bt,elements:{reference:st?rt:it,floating:tt}}),kt=v?`grid`:`listbox`,At=Le||ot,jt=At?`true`:`false`,Mt=Y.useMemo(()=>{let e=it?.tagName===`INPUT`,t=it==null||e,n=t||At,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=jt,r[`aria-haspopup`]=kt,r[`aria-controls`]=At?nt?.id:void 0,r[`aria-autocomplete`]=F),{reference:r,floating:{role:`presentation`}}},[it,At,jt,kt,nt?.id,F]),Nt=HG(Ot,{enabled:!h&&!Ce&&S,event:`mousedown-only`,toggle:!1,touchOpenDelay:st?0:100,reason:hH}),Pt=JG(Ot,{enabled:!h&&!Ce&&!ot,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:ot?!0:void 0,outsidePress(e){let t=mU(e);return!pU(rt,t)&&!pU(_e.current,t)&&!pU(ge.current,t)&&!pU(at,t)}}),Ft=cJ(Ot,{enabled:!h&&!Ce,id:te,listRef:se,activeIndex:$e,selectedIndex:et,virtual:!0,loopFocus:E,allowEscape:E&&!Ae,focusItemOnOpen:re||u===`none`&&!Ae?!1:`auto`,focusItemOnHover:T,resetOnPointerLeave:!w,orientation:v?`horizontal`:void 0,rtl:ee===`rtl`,disabledIndices:i_,grid:v?Whe:void 0,onNavigate(e,t){!t&&!Le||ft===`ending`||vt(t?{activeIndex:e,type:me.current?yH:bH}:{activeIndex:e})}}),It=Y.useMemo(()=>Fg(Ft.reference,{onKeyDown(e){v&&Je.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Pt.reference,Nt.reference,Mt.reference),[Ft.reference,Pt.reference,Nt.reference,Mt.reference,v,Je]),Lt=Y.useMemo(()=>Fg(vq,Pt.floating),[Pt.floating]),Rt=Y.useMemo(()=>Fg(Ft.floating,Mt.floating),[Ft.floating,Mt.floating]),zt=Y.useMemo(()=>{let e=Ft.item;return e?{...e,onFocus:void 0}:a_},[Ft.item]);D3(()=>{Je.update({inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,itemProps:zt,setOpen:bt,setInputValue:yt,setSelectedValue:xt,setIndices:vt,handleSelection:St,forceMount:gt,requestSubmit:Ct,onOpenChangeComplete:Qe})}),Mg(()=>{Je.update({id:te,selectedValue:je,open:Le,mounted:ut,transitionStatus:ft,items:y,inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,openMethod:pt,itemProps:zt,selectionMode:u,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,modal:N,autoHighlight:Ae,isItemEqualToValue:k,submitOnItemClick:R,hasInputValue:De,inputOwnsFormValue:u===`none`&&(j||!Je.state.inputInsidePopup)})},[Je,te,je,Le,ut,ft,y,Lt,Rt,It,zt,pt,mt,u,we,Ce,h,g,v,A,S,D,N,k,R,De,j,Ae,p]);let Bt=Qg(_,J.inputRef),Vt=Y.useMemo(()=>({query:Be,hasItems:Oe,filteredItems:Ke,flatFilteredItems:qe}),[Be,Oe,Ke,qe]),Ht=Y.useMemo(()=>Array.isArray(Ye)?``:X3(Ye,O),[Ye,O]),Ut=Te&&Array.isArray(je)&&je.length>0,Wt=Te||u===`none`&&ct?void 0:we,Gt=Y.useMemo(()=>!Te||!Array.isArray(je)||!we?null:je.map(e=>{let t=X3(e,O);return(0,X.jsx)(`input`,{type:`hidden`,form:p,name:we,value:t,disabled:Ce},t)}),[Te,je,p,we,O,Ce]),Kt=(0,X.jsxs)(Y.Fragment,{children:[e.children,(0,X.jsx)(`input`,{...J.getValidationProps(Ce,{onFocus(){if(st){rt?.focus();return}(ue.current||rt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ce||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=EH(oH,e.nativeEvent),i=()=>xe.current.findIndex(e=>X3(e,O).toLowerCase()===n||Y3(e,D).toLowerCase()===n);function a(){if(Te)return;if(u===`none`){yt(t,r);return}let e=i();e===-1&&(e=xe.current.findIndex((e,t)=>{let r=ce.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:xe.current[e];a!=null&&xt?.(a,r)}Ee&&(gt(),y&&i()===-1&&Je.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:te&&Wt==null?`${te}-hidden-input`:void 0,form:p,name:Wt,autoComplete:I,disabled:Ce,required:g&&!Ut,readOnly:h,value:Ht,ref:Bt,style:Wt?HU:VU,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Gt]});return(0,X.jsx)(j8.Provider,{value:Je,children:(0,X.jsx)(M8.Provider,{value:Ot,children:(0,X.jsx)(P8.Provider,{value:Oe,children:(0,X.jsx)(N8.Provider,{value:Vt,children:(0,X.jsx)(F8.Provider,{value:Fe,children:Kt})})})})})}function Zhe(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,X.jsx)(Xhe,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var K8={...nH,...P3,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},Qhe=Y.createContext(void 0);function $he(){return Y.useContext(Qhe)}var q8=Y.createContext(void 0);function J8(e){let t=Y.useContext(q8);if(t===void 0&&!e)throw Error(Gg(21));return t}var Y8=Y.forwardRef(function(e,t){let n=I8(),{buttonRef:r,getButtonProps:i}=Xg({native:!1}),a=Qg(t,r);function o(e){n.state.setOpen(!1,EH(fH,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,X.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:HU})});function X8(e){let t=$(e,B8.mounted),n=$(e,B8.popupSide),r=$(e,B8.positionerElement);return t&&r?n:null}function Z8(){return R8().filteredItems.length===0}function ege(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function tge(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function Q8(e,t,n){let r=e.state.listRef.current[t];r&&(e.state.selectionEventRef.current=n,r.click(),e.state.selectionEventRef.current=null)}var nge=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:f,validation:p}=L3(),{labelId:m}=z3(),h=$he(),g=!!J8(!0),_=I8(),v=z8(),y=u6(),b=$(_,B8.required),x=$(_,B8.disabled),S=$(_,B8.readOnly),C=$(_,B8.name),w=$(_,B8.form),T=$(_,B8.selectionMode),E=$(_,B8.autoHighlight),D=$(_,B8.inputProps),O=$(_,B8.triggerProps),k=$(_,B8.open),A=$(_,B8.mounted),j=$(_,B8.selectedValue),M=$(_,B8.id),N=$(_,B8.inline),P=$(_,B8.modal),F=!!E,I=X8(_),L=l||x||i,R=Z8(),z=g||N,B=!z||P,V=NH(a??(z?void 0:M)),H=g?N3:c,[U,W]=Y.useState(null),G=Y.useRef(!1),K=Y.useRef(null),q=Y.useRef(!1),J=T===`none`&&!g,ee=kg(e=>{let t=g||_.state.inline;t&&!_.state.hasInputValue&&_.state.setInputValue(``,EH(oH)),_.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:J})}),te=g?s:p.getValidationProps(L,s);function ne(){_.state.setIndices({activeIndex:null,selectedIndex:null,type:_.state.keyboardActiveRef.current?yH:bH})}function re(){_.state.keyboardActiveRef.current=!1}let ie={...H,open:k,disabled:L,readOnly:S,popupSide:I,listEmpty:R};function ae(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,[i,a]=ege(y);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&j.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=tge(n,j.length),ne()),t)}let oe=o_(`input`,e,{state:ie,ref:[t,_.state.inputRef,ee],props:[D,O,{value:U??v,"aria-readonly":S||void 0,"aria-required":b||void 0,"aria-labelledby":m,disabled:L,readOnly:S,required:T===`none`?b:void 0,form:w,...J&&C&&{name:C},id:V,onFocus(){if(d(!0),!N||!q.current)return;q.current=!1;let e=K.current;e==null||!Object.hasOwn(_.state.valuesRef.current,e)||_.state.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=_.state.activeIndex;if(N&&e!==null&&E!==`always`&&(K.current=e,q.current=!0,_.state.setIndices({activeIndex:null})),f===`onBlur`){let e=T===`none`?v:j;p.commit(e)}},onCompositionStart(e){qH||(G.current=!0,W(e.currentTarget.value))},onCompositionEnd(e){G.current=!1;let t=e.currentTarget.value;W(null),_.state.setInputValue(t,EH(pH,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=G.current||!r;function a(e){S||L||!e||!i||(_.state.setOpen(!0,EH(pH,t)),F||ne())}if(G.current){let n=e.currentTarget.value;W(n),n===``&&!_.state.openOnInputClick&&!_.state.inputInsidePopup&&_.state.setOpen(!1,EH(mH,t));let r=n.trim(),i=F&&r!==``;a(r),k&&_.state.activeIndex!==null&&!i&&ne();return}let o=EH(pH,t);if(_.state.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=EH(mH,t);s&&!_.state.inputInsidePopup&&(T===`single`&&_.state.setSelectedValue(null,c),_.state.openOnInputClick||_.state.setOpen(!1,c)),a(e.currentTarget.value.trim()),k&&_.state.activeIndex!==null&&!F&&ne()},onKeyDown(e){if(L||S||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;_.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){eU(e);let n=ZH&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){eU(e);let i=ZH&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!A&&e.key===`Escape`){let t=T===`multiple`&&Array.isArray(j)?j.length===0:j===null,n=EH(_H,e.nativeEvent),r=T===`multiple`?[]:null;_.state.setInputValue(``,n),_.state.setSelectedValue(r,n),!t&&!_.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(j)&&j.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:j.length-1,r=j.filter((e,t)=>t!==n);ne(),_.state.setSelectedValue(r,EH(oH,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=ae(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&_.state.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&k){let t=_.state.activeIndex,n=e.nativeEvent;if(t===null){if(N)return;_.state.setOpen(!1,EH(oH,n));return}eU(e),Q8(_,t,n)}},onPointerMove:re,onPointerDown:re},te],stateAttributesMapping:K8}),se=g?(0,X.jsx)(I3.Provider,{value:F3,children:oe}):oe;return(0,X.jsxs)(Y.Fragment,{children:[k&&B&&(0,X.jsx)(Y8,{ref:_.state.startDismissRef}),se]})});function rge(e,t,n,r,i){if(e.baseUIHandlerPrevented||r)return;let a=mU(e.nativeEvent),o=ig(a)?a:null;o!==e.currentTarget&&(i?.(o)||yU(o))||(e.preventDefault(),!n&&(t.state.inputRef.current?.focus(),t.state.openOnInputClick&&t.state.setOpen(!0,EH(hH,e.nativeEvent))))}var ige=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=L3(),s=I8(),c=$(s,B8.open),l=$(s,B8.disabled),u=$(s,B8.readOnly),d=$(s,B8.hasSelectedValue),f=$(s,B8.selectionMode),p=X8(s),m=l,h=Z8(),g=f!==`none`&&!d,_={...o,open:c,disabled:m,readOnly:u,popupSide:p,listEmpty:h,placeholder:g};return o_(`div`,e,{ref:[t,kg(e=>{s.set(`inputGroupElement`,e)})],props:[{role:`group`,onMouseDown(e){rge(e,s,m,u,e=>pU(s.state.chipsContainerRef.current,e))}},a],state:_,stateAttributesMapping:K8})}),age=Y.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=L3(),{labelId:h}=z3(),g=I8(),_=$(g,B8.selectionMode),v=$(g,B8.disabled),y=$(g,B8.readOnly),b=$(g,B8.required),x=$(g,B8.positionerElement),S=$(g,B8.listElement),C=$(g,B8.popupId),w=$(g,B8.triggerProps),T=$(g,B8.inputInsidePopup),E=$(g,B8.id),D=$(g,B8.labelId),O=$(g,B8.open),k=$(g,B8.selectedValue),A=$(g,B8.activeIndex),j=$(g,B8.selectedIndex),M=$(g,B8.hasSelectedValue),N=L8(),P=z8(),F=RH(),I=u||v||a,L=Z8(),R=X8(g);B3({id:T?o:void 0});let z=T?o??E:o,B=i6(h,D),V;O&&T?V=C??V8(E):O&&(V=S?.id);let H=Y.useRef(``);function U(e){H.current=e.pointerType}let{reference:W}=lJ(N,{enabled:!O&&!y&&!v&&_===`single`,listRef:g.state.labelsRef,activeIndex:A,selectedIndex:j,onMatch(e){let t=g.state.valuesRef.current[e];t!==void 0&&g.state.setSelectedValue(t,EH(oH))}}),{reference:G}=HG(N,{enabled:!y&&!v,event:`mousedown`}),{buttonRef:K,getButtonProps:q}=Xg({native:i,disabled:I}),J={...l,open:O,disabled:I,popupSide:R,listEmpty:L,placeholder:_!==`none`&&!M};return o_(`button`,e,{ref:[t,K,kg(e=>{g.set(`triggerElement`,e)})],state:J,props:[w,G,W,{id:z,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":O,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":V,"aria-required":T&&b||void 0,"aria-labelledby":B,onPointerDown:U,onPointerEnter:U,onFocus(){f(!0),!(I||y)&&F.start(0,g.state.forceMount)},onBlur(e){if(!pU(x,e.relatedTarget)&&(d(!0),f(!1),p===`onBlur`)){let e=_===`none`?P:k;m.commit(e)}},onMouseDown(e){if(I||y||(T||N.set(`domReferenceElement`,e.currentTarget),g.state.forceMount(),H.current!==`touch`&&(g.state.inputRef.current?.focus(),T||e.preventDefault()),O))return;let t=Jg(e.currentTarget);function n(e){let t=g.state.triggerElement;if(!t)return;let n=mU(e),r=g.state.positionerElement,i=g.state.listElement;pU(t,n)||pU(r,n)||pU(i,n)||o6(e,t)||g.state.setOpen(!1,EH(xH,e))}T&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){y||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(eU(e),g.state.setOpen(!0,EH(vH,e.nativeEvent)),g.state.inputRef.current?.focus())}},m.getValidationProps(I,c),q],stateAttributesMapping:K8})}),$8=Y.createContext(null);function oge(){return Y.useContext($8)}function sge(e){let{children:t,items:n}=e,r=Y.useMemo(()=>({items:n}),[n]);return(0,X.jsx)($8.Provider,{value:r,children:t})}function e5(e){let{children:t}=e,{filteredItems:n}=R8(),r=oge(),i=r?r.items:n;return(0,X.jsx)(Y.Fragment,{children:i.map(t)})}var cge=Y.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=I8(),l=L8(),u=!!J8(!0),{filteredItems:d,hasItems:f}=R8(),p=$(c,B8.selectionMode),m=$(c,B8.grid),h=$(c,B8.listProps),g=$(c,B8.virtualized),_=$(c,B8.forceMounted),v=p===`multiple`,y=d.length===0,b=kg(e=>{c.set(`positionerElement`,e)}),x=kg(e=>{c.set(`listElement`,e)}),S=Y.useMemo(()=>typeof o==`function`?n||=(0,X.jsx)(e5,{children:o}):o,[o]),C={empty:y},w=l.useState(`floatingId`),T=o_(`div`,e,{state:C,ref:[t,x,u?null:b],props:[h,{children:S,tabIndex:-1,id:w,role:m?`grid`:`listbox`,"aria-multiselectable":v?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;eU(e),Q8(c,t,e.nativeEvent)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});if(g)return T;let E=f&&!_?void 0:c.state.labelsRef;return(0,X.jsx)(c6,{elementsRef:c.state.listRef,labelsRef:E,children:T})}),lge=``;function uge(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function dge(){let e=RH(),t=Y.useRef(null);return Y.useEffect(()=>{if(GH)return;let n=t.current;if(n==null)return;let r=uge(n);if(r==null)return;let i=r.data,a=`${i}${lge}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var t5=Y.createContext(void 0);function fge(){let e=Y.useContext(t5);if(e===void 0)throw Error(Gg(20));return e}var pge=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=I8(),a=$(i,B8.mounted),o=$(i,B8.forceMounted);return a||n||o?(0,X.jsx)(t5.Provider,{value:n,children:(0,X.jsx)(SG,{ref:t,...r})}):null}),mge=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=hG,style:g,..._}=e,v=I8(),y=L8(),b=fge(),x=$(v,B8.modal),S=$(v,B8.open),C=$(v,B8.mounted),w=$(v,B8.openMethod),T=$(v,B8.positionerElement),E=$(v,B8.triggerElement),D=$(v,B8.inputElement),O=$(v,B8.inputGroupElement),k=$(v,B8.inputInsidePopup),A=$(v,B8.transitionStatus),j=Z8(),M=h6({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});C6(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};Mg(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=kg(e=>{v.set(`positionerElement`,e)}),F=S6(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return(0,X.jsxs)(q8.Provider,{value:M,children:[C&&x&&(0,X.jsx)(FJ,{inert:PJ(!S),cutout:O??D??E}),F]})}),hge={...rH,...YV},gge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=I8(),l=J8(),u=L8(),d=$(c,B8.mounted),f=$(c,B8.open),p=$(c,B8.openMethod),m=$(c,B8.popupProps),h=$(c,B8.transitionStatus),g=$(c,B8.inputInsidePopup),_=$(c,B8.inputElement),v=$(c,B8.modal),y=$(c,B8.id),b=Z8(),x=s.id??(g?V8(y):void 0);Mg(()=>(c.set(`popupId`,c.state.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),_q({open:f,ref:c.state.popupRef,onComplete(){f&&c.state.onOpenChangeComplete(!0)}});let S=o_(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.state.popupRef],props:[m,{id:x,role:g?`dialog`:`presentation`,onFocus(e){let t=mU(e.nativeEvent);p!==`touch`&&(pU(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},x6(h),s],stateAttributesMapping:hge}),C=a===void 0?g?e=>e===`touch`?c.state.popupRef.current:_:!1:a,w;w=o??(g?void 0:!1);let T=!g||v;return(0,X.jsx)(VG,{context:u,disabled:!d,modal:T,openInteractionType:p,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,X.jsxs)(Y.Fragment,{children:[S,T&&(0,X.jsx)(Y8,{ref:c.state.endDismissRef})]})})}),n5=Y.createContext(void 0);function _ge(){let e=Y.useContext(n5);if(e===void 0)throw Error(Gg(18));return e}var vge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,[s,c]=Y.useState(),l=Y.useMemo(()=>({labelId:s,setLabelId:c,items:a}),[s,c,a]),u=o_(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":s},o]}),d=(0,X.jsx)(n5.Provider,{value:l,children:u});return a?(0,X.jsx)(sge,{items:a,children:d}):d}),yge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=_ge(),c=NH(a);return Mg(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),o_(`div`,e,{ref:t,props:[{id:c},o]})}),r5=Y.createContext(void 0);function i5(){let e=Y.useContext(r5);if(!e)throw Error(Gg(19));return e}var bge=Y.createContext(!1);function xge(){return Y.useContext(bge)}function a5(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=Y.useRef(null),m=N6({guess:!0,index:l,textRef:p}),h=I8(),g=xge(),_=Ghe(),v=$(h,B8.selectionMode),y=$(h,B8.disabled),b=$(h,B8.readOnly),x=$(h,B8.isItemEqualToValue),S=y||u,C=v!==`none`,w=l??i??m.index,T=w!==-1,E=$(h,B8.id),D=$(h,B8.isActive,w),O=$(h,B8.isSelected,c),k=$(h,B8.itemProps),A=Y.useRef(null),j=E!=null&&T?`${E}-${w}`:void 0,M=O&&C;Mg(()=>{if(!(T&&(r||l!=null)))return;let e=h.state.listRef.current;return e[w]=A.current,()=>{delete e[w]}},[T,r,w,l,h]),Mg(()=>{if(!T||_)return;let e=h.state.valuesRef.current;return e[w]=c,()=>{delete e[w]}},[T,_,w,c,h]),Mg(()=>{if(!T||_)return;let e=h.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;H3(c,t,x)&&h.set(`selectedIndex`,w)},[T,_,h,w,c,x]);let{getButtonProps:N,buttonRef:P}=Xg({disabled:S,focusableWhenDisabled:!0,native:d,composite:!0}),F={disabled:S,selected:M,highlighted:D};function I(e){function t(){h.state.handleSelection(e,c)}h.state.submitOnItemClick?(Xi.flushSync(t),h.state.requestSubmit()):t()}let L={id:j,role:g?`gridcell`:`option`,"aria-selected":C?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.state.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){S||b||I(e.nativeEvent)},onMouseUp(e){let t=h.state.pointerDownItemRef.current===e.currentTarget;h.state.pointerDownItemRef.current=null,!(S||b||e.button!==0||t||!D)&&I(e.nativeEvent)}},R=o_(`div`,t,{ref:[P,n,m.ref,A],state:F,props:[k,L,f,N]}),z=Y.useMemo(()=>({selected:M,textRef:p}),[M,p]);return(0,X.jsx)(r5.Provider,{value:z,children:R})}function Sge(e){let{componentProps:t,forwardedRef:n}=e,r=$(I8(),B8.isItemEqualToValue),{flatFilteredItems:i}=R8(),a=U3(i,t.value??null,r);return(0,X.jsx)(a5,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var Cge=Y.memo(Y.forwardRef(function(e,t){let n=$(I8(),B8.virtualized);return n&&e.index==null?(0,X.jsx)(Sge,{componentProps:e,forwardedRef:t}):(0,X.jsx)(a5,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),wge=Y.forwardRef(function(e,t){let{selected:n}=i5();return e.keepMounted||n?(0,X.jsx)(Tge,{...e,ref:t}):null}),Tge=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=i5(),c=Y.useRef(null),{transitionStatus:l,setMounted:u}=hq(s),d=o_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:YV});return _q({open:s,ref:c,onComplete(){s||u(!1)}}),d})),Ege=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=R8(),c=I8(),l=dge(),u=s.length===0?a:null;return o_(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function o5(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Zhe,{...e}),t[0]=e,t[1]=n),n}function s5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`relative flex w-full items-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ige,{className:i,"data-slot":`combobox-input-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function c5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent py-1 pr-16 pl-3 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nge,{className:i,"data-slot":`combobox-input`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Dge=`flex size-7 items-center justify-center rounded-sm text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`;function l5(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Dge,`absolute right-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Jv,{className:`size-4 opacity-50`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(age,{className:i,"data-slot":`combobox-trigger`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function u5(e){let t=(0,Z.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,side:a,sideOffset:o,align:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`bottom`:a,l=o===void 0?4:o,u=s===void 0?`start`:s,d;t[7]===r?d=t[8]:(d=Q(`data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in`,r),t[7]=r,t[8]=d);let f;t[9]!==n||t[10]!==i||t[11]!==d?(f=(0,X.jsx)(gge,{className:d,"data-slot":`combobox-content`,...i,children:n}),t[9]=n,t[10]=i,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==c||t[15]!==l||t[16]!==f?(p=(0,X.jsx)(pge,{children:(0,X.jsx)(mge,{align:u,className:`isolate z-50 outline-none`,side:c,sideOffset:l,children:f})}),t[13]=u,t[14]=c,t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function d5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`max-h-64 overflow-y-auto overscroll-contain`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(cge,{className:i,"data-slot":`combobox-list`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function f5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-3 text-muted-foreground text-xs empty:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Ege,{className:i,"data-slot":`combobox-empty`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function p5(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[6]=n,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(wge,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(qv,{className:`size-4`})}),t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(Cge,{className:a,"data-slot":`combobox-item`,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Oge(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(vge,{"data-slot":`combobox-group`,...n}),t[2]=n,t[3]=r),r}function kge(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-1.5 text-muted-foreground text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(yge,{className:i,"data-slot":`combobox-group-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Age=e5;function jge(e){return{path:e,label:`${e} (Unavailable)`,type:`string`,sourceNodeId:``,sourceNodeLabel:`Unavailable`,sourceNodeLabels:[`Unavailable`]}}function Mge(e){let t=new Map;for(let n of e){let e=t.get(n.sourceNodeLabel);e?e.push(n):t.set(n.sourceNodeLabel,[n])}return Array.from(t.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({value:e,items:t.toSorted((e,t)=>e.path.localeCompare(t.path))}))}function Nge(e,t){let n=e.find(e=>e.path===t),r=Mge(e);if(n)return{selected:n,groups:r};let i=jge(t);return{selected:i,groups:[{value:i.sourceNodeLabel,items:[i]},...r]}}function Pge(e,t){let n=t.trim().toLowerCase();return!n||[e.path,e.label,...e.sourceNodeLabels,...e.nullable?[`nullable`]:[]].some(e=>e.toLowerCase().includes(n))}function Fge(e,t){return e.path===t.path}function Ige(e){return e.label}function Lge(e){let t=(0,Z.c)(12),{fields:n,valuePath:r,onValueChange:i,disabled:a}=e,o;t[0]!==n||t[1]!==r?(o=Nge(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let{selected:s,groups:c}=o,l;t[3]===i?l=t[4]:(l=e=>{e&&i(e)},t[3]=i,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsxs)(s5,{className:`min-w-[280px]`,children:[(0,X.jsx)(c5,{"aria-label":`Select field`,placeholder:`Select field`}),(0,X.jsx)(l5,{"aria-label":`Show the fields`})]}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(u5,{className:`w-max min-w-(--anchor-width)`,children:[(0,X.jsx)(f5,{children:`No field matches that.`}),(0,X.jsx)(d5,{children:Rge})]}),t[6]=d):d=t[6];let f;return t[7]!==a||t[8]!==c||t[9]!==s||t[10]!==l?(f=(0,X.jsxs)(o5,{disabled:a,filter:Pge,isItemEqualToValue:Fge,items:c,itemToStringLabel:Ige,onValueChange:l,value:s,children:[u,d]}),t[7]=a,t[8]=c,t[9]=s,t[10]=l,t[11]=f):f=t[11],f}function Rge(e){return(0,X.jsxs)(Oge,{items:e.items,children:[(0,X.jsx)(kge,{children:e.value}),(0,X.jsx)(Age,{children:t=>(0,X.jsx)(p5,{className:`items-start`,value:t,children:(0,X.jsxs)(`span`,{className:`flex w-full flex-col items-start`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t.label,t.nullable&&(0,X.jsx)(`span`,{className:`rounded bg-muted px-1 py-0.5 font-normal text-xs text-muted-foreground leading-none`,children:`nullable`})]}),t.sourceNodeLabels.length>1&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Also from`,` `,t.sourceNodeLabels.filter(t=>t!==e.value).join(`, `)]})]})},t.path)})]},e.value)}function zge(e){return e===`within_next`||e===`more_than_from_now`||e===`less_than_ago`||e===`more_than_ago`}function Bge(e){return e===`before`||e===`after`}function Vge(e){return e===`equals`||e===`not_equals`||e===`contains`}function Hge(e){return e===`equals`||e===`not_equals`||e===`greater_than`||e===`greater_or_equal`||e===`less_than`||e===`less_or_equal`}function Uge(e){return e===`is_true`||e===`is_false`}function Wge(e){return L2.some(t=>t.value===e)}function Gge(e,t){let n=t?Bde:[];return e===`timestamp`?[...Ide,...n]:e===`string`?[...Lde,...n]:e===`number`?[...Rde,...n]:[...zde,...n]}function Kge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function qge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toISOString()}function Jge(e){return I2(e,{groupId:l0(),conditionId:l0()})}function m5(e){return F2(e,l0())}function Yge(e){let{condition:t,operatorValue:n}=e;return zge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,amount:M2(t)?t.amount:1,unit:M2(t)?t.unit:`days`}:Bge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,dateTime:N2(t)?t.dateTime:new Date().toISOString()}:null}function Xge(e){return e===`is_set`||e===`is_not_set`}function Zge(e,t){let n={id:e.id,field:e.field};if(Xge(t))return{...n,fieldType:e.fieldType,operator:t};if(e.fieldType===`timestamp`)return Yge({condition:P2(e)?{...n,fieldType:`timestamp`,operator:`within_next`,amount:1,unit:`days`}:e,operatorValue:t});if(e.fieldType===`string`){if(!Vge(t))return null;let r=!P2(e)&&`value`in e?e.value:``;return{...n,fieldType:`string`,operator:t,value:r}}if(e.fieldType===`number`){if(!Hge(t))return null;let r=!P2(e)&&`value`in e?e.value:0;return{...n,fieldType:`number`,operator:t,value:r}}return Uge(t)?{...n,fieldType:`boolean`,operator:t}:null}function h5(e){let t=(0,Z.c)(6),{value:n,onChange:r,disabled:i}=e,a;t[0]!==i||t[1]!==r||t[2]!==n?(a=Fde.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{className:`rounded-full px-3 py-1 font-medium text-xs transition-colors ${t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,disabled:i,onClick:()=>r(e.value),type:`button`,children:e.label},e.value)}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`div`,{className:`inline-flex items-center rounded-full border bg-card p-0.5`,children:a}),t[4]=a,t[5]=o),o}function Qge(e){let t=(0,Z.c)(56),{condition:n,disabled:r,currentNodeId:i,enumValues:a,onConditionChange:o}=e;if(P2(n))return null;if(n.fieldType===`timestamp`){if(M2(n)){let e;t[0]!==n||t[1]!==o?(e=e=>{let t=Number.parseInt(e.target.value,10);o({...n,amount:Number.isNaN(t)?1:Math.max(t,1)})},t[0]=n,t[1]=o,t[2]=e):e=t[2];let i;t[3]!==n.amount||t[4]!==r||t[5]!==e?(i=(0,X.jsx)(CX,{className:`w-24`,disabled:r,min:1,onChange:e,type:`number`,value:n.amount}),t[3]=n.amount,t[4]=r,t[5]=e,t[6]=i):i=t[6];let a;t[7]!==n||t[8]!==o?(a=V6(e=>{Wge(e)&&o({...n,unit:e})}),t[7]=n,t[8]=o,t[9]=a):a=t[9];let s;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(U6,{className:`w-36`,children:(0,X.jsx)(H6,{})}),t[10]=s):s=t[10];let c;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(W6,{children:L2.map(e_e)}),t[11]=c):c=t[11];let l;t[12]!==n.unit||t[13]!==r||t[14]!==a?(l=(0,X.jsxs)(B6,{disabled:r,onValueChange:a,value:n.unit,children:[s,c]}),t[12]=n.unit,t[13]=r,t[14]=a,t[15]=l):l=t[15];let u;return t[16]!==i||t[17]!==l?(u=(0,X.jsxs)(X.Fragment,{children:[i,l]}),t[16]=i,t[17]=l,t[18]=u):u=t[18],u}let e;t[19]!==n||t[20]!==o?(e=e=>{N2(n)&&o({...n,dateTime:qge(e.target.value)})},t[19]=n,t[20]=o,t[21]=e):e=t[21];let i;t[22]===n?i=t[23]:(i=N2(n)?Kge(n.dateTime):``,t[22]=n,t[23]=i);let a;return t[24]!==r||t[25]!==e||t[26]!==i?(a=(0,X.jsx)(CX,{disabled:r,onChange:e,type:`datetime-local`,value:i}),t[24]=r,t[25]=e,t[26]=i,t[27]=a):a=t[27],a}if(n.fieldType===`string`){if(a&&a.length>0&&(n.operator===`equals`||n.operator===`not_equals`)){let e;t[28]!==n||t[29]!==o?(e=V6(e=>{o({...n,value:e})}),t[28]=n,t[29]=o,t[30]=e):e=t[30];let i=a.includes(n.value)?n.value:null,s;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(U6,{className:`min-w-[240px]`,children:(0,X.jsx)(H6,{placeholder:`Select value`})}),t[31]=s):s=t[31];let c;t[32]===a?c=t[33]:(c=a.map($ge),t[32]=a,t[33]=c);let l;t[34]===c?l=t[35]:(l=(0,X.jsx)(W6,{children:c}),t[34]=c,t[35]=l);let u;return t[36]!==r||t[37]!==e||t[38]!==i||t[39]!==l?(u=(0,X.jsxs)(B6,{disabled:r,onValueChange:e,value:i,children:[s,l]}),t[36]=r,t[37]=e,t[38]=i,t[39]=l,t[40]=u):u=t[40],u}let e;t[41]!==n||t[42]!==o?(e=e=>{o({...n,value:e})},t[41]=n,t[42]=o,t[43]=e):e=t[43];let s;return t[44]!==n.value||t[45]!==i||t[46]!==r||t[47]!==e?(s=(0,X.jsx)(h8,{className:`min-w-[240px]`,currentNodeId:i,disabled:r,onChange:e,placeholder:`value`,value:n.value}),t[44]=n.value,t[45]=i,t[46]=r,t[47]=e,t[48]=s):s=t[48],s}if(n.fieldType===`number`){let e;t[49]!==n||t[50]!==o?(e=e=>{let t=Number.parseFloat(e.target.value);o({...n,value:Number.isNaN(t)?0:t})},t[49]=n,t[50]=o,t[51]=e):e=t[51];let i=String(n.value),a;return t[52]!==r||t[53]!==e||t[54]!==i?(a=(0,X.jsx)(CX,{disabled:r,onChange:e,placeholder:`0`,type:`number`,value:i}),t[52]=r,t[53]=e,t[54]=i,t[55]=a):a=t[55],a}return null}function $ge(e){return(0,X.jsx)(G6,{value:e,children:e},e)}function e_e(e){return(0,X.jsx)(G6,{value:e.value,children:e.label},e.value)}function g5(e){let t=(0,Z.c)(58),{label:n,description:r,fields:i,emptyFieldsMessage:a,value:o,onChange:s,currentNodeId:c,disabled:l}=e,u=i[0]??null,d;t[0]===i?d=t[1]:(d=new Map(i.map(n_e)),t[0]=i,t[1]=d);let f=d,p,m,h,g,_,v,y;if(t[2]!==i||t[3]!==c||t[4]!==r||t[5]!==l||t[6]!==a||t[7]!==f||t[8]!==n||t[9]!==s||t[10]!==u||t[11]!==o){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=o.trim(),d=$2(e),b=d.valid?d.model:null,x;t[19]===s?x=t[20]:(x=e=>{let t=i4(e);s({model:e4(e),expression:t.valid?t.expression:``})},t[19]=s,t[20]=x);let S=x,C;t[21]!==S||t[22]!==u?(C=()=>{u&&S(Jge(u))},t[21]=S,t[22]=u,t[23]=C):C=t[23];let w=C,T=b?Pde(b,f):null;m=T?i4(T):null;let E=(e,t)=>{T&&S({...T,groups:T.groups.map(n=>n.id===e?t(n):n)})},D=(e,t,n)=>{E(e,e=>({...e,conditions:e.conditions.map(e=>e.id===t?n(e):e)}))},O=e=>{T&&u&&E(e,e=>({...e,conditions:[...e.conditions,m5(u)]}))},k=(e,t)=>{T&&E(e,e=>e.conditions.length<=1?e:{...e,conditions:e.conditions.filter(e=>e.id!==t)})};p=()=>{T&&u&&S({...T,groups:[...T.groups,{id:l0(),logic:`and`,conditions:[m5(u)]}]})};let A=e=>{!T||T.groups.length<=1||S({...T,groups:T.groups.filter(t=>t.id!==e)})};if(!T){let o;t[24]===n?o=t[25]:(o=(0,X.jsx)(wX,{className:`text-sm`,children:n}),t[24]=n,t[25]=o);let s;t[26]===r?s=t[27]:(s=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[26]=r,t[27]=s);let c;t[28]!==w||t[29]!==i.length||t[30]!==l||t[31]!==a?(c=i.length>0?(0,X.jsx)(zv,{disabled:l,onClick:w,size:`sm`,type:`button`,variant:`outline`,children:`Configure condition`}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[28]=w,t[29]=i.length,t[30]=l,t[31]=a,t[32]=c):c=t[32],y=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border bg-muted/30 p-3`,children:[o,s,c,e&&!d.valid&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:d.error})]});break bb0}_=`space-y-3 rounded-md border bg-muted/30 p-3`;let j;t[33]===n?j=t[34]:(j=(0,X.jsx)(wX,{className:`text-sm`,children:n}),t[33]=n,t[34]=j);let M;t[35]===r?M=t[36]:(M=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[35]=r,t[36]=M),t[37]!==M||t[38]!==j?(v=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[j,M]}),t[37]=M,t[38]=j,t[39]=v):v=t[39],h=`space-y-3`,g=T.groups.map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`rounded-lg border bg-card`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-muted px-2 py-1 font-medium text-xs`,children:t+1}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Filter group`}),(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[e.conditions.length,` `,e.conditions.length===1?`condition`:`conditions`]})]}),(0,X.jsx)(zv,{disabled:l||T.groups.length<=1,onClick:()=>A(e.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),(0,X.jsxs)(`div`,{className:`space-y-3 p-3`,children:[e.conditions.map((t,n)=>{let r=f.get(t.field),a=Gge(t.fieldType,r?.nullable),o=e.conditions.length>1;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Lge,{disabled:l||i.length===0,fields:i,onValueChange:n=>{n.path!==t.field&&D(e.id,t.id,e=>F2(n,e.id))},valuePath:t.field}),(0,X.jsxs)(B6,{disabled:l,onValueChange:V6(n=>{let r=Zge(t,n);r&&D(e.id,t.id,()=>r)}),value:t.operator,children:[(0,X.jsx)(U6,{className:`min-w-[190px]`,children:(0,X.jsx)(H6,{placeholder:`Select operator`})}),(0,X.jsx)(W6,{children:a.map(t_e)})]}),(0,X.jsx)(Qge,{condition:t,currentNodeId:c,disabled:l,enumValues:r?.enumValues,onConditionChange:n=>{D(e.id,t.id,()=>n)}}),(0,X.jsx)(zv,{disabled:l||!o,onClick:()=>k(e.id,t.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),n<e.conditions.length-1&&(0,X.jsx)(`div`,{className:`py-2 pl-2`,children:(0,X.jsx)(h5,{disabled:l,onChange:t=>{E(e.id,e=>({...e,logic:t}))},value:e.logic})})]},t.id)}),(0,X.jsxs)(zv,{disabled:l||!u,onClick:()=>O(e.id),size:`sm`,type:`button`,variant:`ghost`,children:[(0,X.jsx)(cy,{className:`size-4`}),`Add condition`]})]})]}),t<T.groups.length-1&&(0,X.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,X.jsx)(h5,{disabled:l,onChange:e=>{S({...T,groupLogic:e})},value:T.groupLogic})})]},e.id))}t[2]=i,t[3]=c,t[4]=r,t[5]=l,t[6]=a,t[7]=f,t[8]=n,t[9]=s,t[10]=u,t[11]=o,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y}else p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;t[40]!==h||t[41]!==g?(b=(0,X.jsx)(`div`,{className:h,children:g}),t[40]=h,t[41]=g,t[42]=b):b=t[42];let x=l||!u,S;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(cy,{className:`size-4`}),t[43]=S):S=t[43];let C;t[44]!==p||t[45]!==x?(C=(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsxs)(zv,{disabled:x,onClick:p,size:`sm`,type:`button`,variant:`outline`,children:[S,`Add group`]})}),t[44]=p,t[45]=x,t[46]=C):C=t[46];let w;t[47]===m?w=t[48]:(w=m?.valid===!1&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:m.error}),t[47]=m,t[48]=w);let T;t[49]===m?T=t[50]:(T=m?.valid&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Compiled CEL: `,m.expression]}),t[49]=m,t[50]=T);let E;return t[51]!==C||t[52]!==w||t[53]!==T||t[54]!==_||t[55]!==v||t[56]!==b?(E=(0,X.jsxs)(`div`,{className:_,children:[v,b,C,w,T]}),t[51]=C,t[52]=w,t[53]=T,t[54]=_,t[55]=v,t[56]=b,t[57]=E):E=t[57],E}function t_e(e){return(0,X.jsx)(G6,{value:e.value,children:e.label},e.value)}function n_e(e){return[e.path,e]}function _5(e){let t=(0,Z.c)(18),{children:n,className:r,title:i,variant:a}=e;if((a===void 0?`box`:a)===`text`){let e;t[0]===r?e=t[1]:(e=Q(`text-warning text-xs`,r),t[0]=r,t[1]=e);let i;return t[2]!==n||t[3]!==e?(i=(0,X.jsx)(`p`,{className:e,children:n}),t[2]=n,t[3]=e,t[4]=i):i=t[4],i}let o;t[5]===r?o=t[6]:(o=Q(`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/10 p-2`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(py,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),t[7]=s):s=t[7];let c;t[8]===i?c=t[9]:(c=i?(0,X.jsx)(`p`,{className:`font-medium text-warning text-xs`,children:i}):null,t[8]=i,t[9]=c);let l;t[10]===n?l=t[11]:(l=(0,X.jsx)(`p`,{className:`text-warning text-xs`,children:n}),t[10]=n,t[11]=l);let u;t[12]!==c||t[13]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;return t[15]!==o||t[16]!==u?(d=(0,X.jsxs)(`div`,{className:o,children:[s,u]}),t[15]=o,t[16]=u,t[17]=d):d=t[17],d}function r_e(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function i_e(e,t){return e.name===t.name}function a_e(e){let t=(0,Z.c)(9),{inputId:n,placeholder:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,X.jsx)(c5,{id:n,placeholder:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(l5,{"aria-label":`Show the Events`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,X.jsxs)(s5,{children:[i,a]}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsxs)(u5,{children:[(0,X.jsx)(f5,{children:`No Event matches that.`}),(0,X.jsx)(d5,{children:o_e})]}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,X.jsxs)(X.Fragment,{children:[o,s]}),t[7]=o,t[8]=c),c}function o_e(e){return(0,X.jsxs)(p5,{value:e,children:[(0,X.jsx)(`span`,{className:`block truncate`,children:e.label}),e.label===e.name?null:(0,X.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.name})]},e.name)}function v5(e){let t=(0,Z.c)(16),{choices:n,value:r,onValueChange:i,disabled:a,inputId:o,placeholder:s}=e,c=s===void 0?`Search Events`:s,l;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>n.find(t=>t.name===e)??[],t[3]=n,t[4]=e),l=r.flatMap(e),t[0]=n,t[1]=r,t[2]=l}else l=t[2];let u=l,d;t[5]===i?d=t[6]:(d=e=>i(e.map(s_e)),t[5]=i,t[6]=d);let f;t[7]!==o||t[8]!==c?(f=(0,X.jsx)(a_e,{inputId:o,placeholder:c}),t[7]=o,t[8]=c,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,X.jsx)(o5,{disabled:a,filter:r_e,isItemEqualToValue:i_e,items:n,itemToStringLabel:c_e,multiple:!0,onValueChange:d,value:u,children:f}),t[10]=n,t[11]=a,t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function s_e(e){return e.name}function c_e(e){return e.label}function l_e(e){let t=(0,Z.c)(30),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=u4(n),s=yy(),c=o.map(u_e),l;t[0]===r?l=t[1]:(l=e=>{r({waitFor:e})},t[0]=r,t[1]=l);let u=l,d;t[2]!==o||t[3]!==u?(d=e=>{u(e.map(e=>o.find(t=>t.event===e)??{event:e}))},t[2]=o,t[3]=u,t[4]=d):d=t[4];let f=d,p;t[5]!==o||t[6]!==u?(p=e=>{u(o.filter(t=>t.event!==e))},t[5]=o,t[6]=u,t[7]=p):p=t[7];let m=p,h;t[8]!==o||t[9]!==u?(h=(e,t)=>{u(o.map(n=>n.event===e?{event:n.event,...t?{match:t}:{}}:n))},t[8]=o,t[9]=u,t[10]=h):h=t[10];let g=h,_;t[11]===a?_=t[12]:(_=(0,X.jsx)(wX,{htmlFor:a,children:`Resume when the event is`}),t[11]=a,t[12]=_);let v;t[13]!==s.events||t[14]!==i||t[15]!==a||t[16]!==c||t[17]!==f?(v=s.events.length>0?(0,X.jsx)(v5,{choices:s.events,disabled:i,inputId:a,onValueChange:f,value:c}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This server declares no Events, so there is nothing for a wait to park on. Ask whoever runs it to declare the Event.`}),t[13]=s.events,t[14]=i,t[15]=a,t[16]=c,t[17]=f,t[18]=v):v=t[18];let y;t[19]!==_||t[20]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==m||t[24]!==o||t[25]!==g?(b=o.length===0?(0,X.jsx)(_5,{children:`Name at least one event. A wait with none cannot be resumed by anything, and the workflow will not save.`}):o.map(e=>(0,X.jsx)(d_e,{disabled:i,onMatchChange:g,onRemove:m,subscription:e},e.event)),t[22]=i,t[23]=m,t[24]=o,t[25]=g,t[26]=b):b=t[26];let x;return t[27]!==y||t[28]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[y,b]}),t[27]=y,t[28]=b,t[29]=x):x=t[29],x}function u_e(e){return e.event}function d_e(e){let t=(0,Z.c)(59),{subscription:n,onMatchChange:r,onRemove:i,disabled:a}=e,o=wA(V4),s=wA(Z4),c=yy(),l;t[0]!==c||t[1]!==n.event?(l=Ny(c,n.event),t[0]=c,t[1]=n.event,t[2]=l):l=t[2];let u=l,d;t[3]===s?d=t[4]:(d=s.filter(m_e).map(p_e).find(f_e),t[3]=s,t[4]=d);let f=d,p;t[5]!==c||t[6]!==n.event?(p=Kme(c,n.event),t[5]=c,t[6]=n.event,t[7]=p):p=t[7];let m=p,h;t[8]!==r||t[9]!==n.event?(h=e=>{r(n.event,e.model)},t[8]=r,t[9]=n.event,t[10]=h):h=t[10];let g=h,_;t[11]!==r||t[12]!==n.event?(_=()=>{r(n.event,``)},t[11]=r,t[12]=n.event,t[13]=_):_=t[13];let v=_,y;t[14]!==f||t[15]!==u?.correlationPath||t[16]!==n.event?(y=()=>f?w1({rules:f,eventName:n.event,declaredPath:u?.correlationPath}):u?.correlationPath,t[14]=f,t[15]=u?.correlationPath,t[16]=n.event,t[17]=y):y=t[17],u?.correlationPath;let b;t[18]===y?b=t[19]:(b=y(),t[18]=y,t[19]=b);let x=b,S;t[20]!==m||t[21]!==r||t[22]!==x||t[23]!==n.event?(S=()=>{let e=m.find(e=>e.path===x)??m[0];e&&r(n.event,e4(I2(e,{groupId:`${n.event}-group`,conditionId:`${n.event}-rule`})))},t[20]=m,t[21]=r,t[22]=x,t[23]=n.event,t[24]=S):S=t[24];let C=S,w;t[25]===u?w=t[26]:(w=u?(0,X.jsx)(`p`,{className:`truncate text-xs`,children:u.label}):null,t[25]=u,t[26]=w);let T;t[27]===n.event?T=t[28]:(T=(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:n.event}),t[27]=n.event,t[28]=T);let E;t[29]===u?E=t[30]:(E=u?null:(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:`This app no longer declares this Event; the workflow will not save until it is removed or declared again.`}),t[29]=u,t[30]=E);let D;t[31]!==n.event||t[32]!==T||t[33]!==E||t[34]!==w?(D=(0,X.jsxs)(`div`,{className:`min-w-0`,title:n.event,children:[w,T,E]}),t[31]=n.event,t[32]=T,t[33]=E,t[34]=w,t[35]=D):D=t[35];let O=`Remove ${n.event}`,k;t[36]!==i||t[37]!==n.event?(k=()=>i(n.event),t[36]=i,t[37]=n.event,t[38]=k):k=t[38];let A;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(hy,{className:`size-3.5`}),t[39]=A):A=t[39];let j;t[40]!==a||t[41]!==O||t[42]!==k?(j=(0,X.jsx)(zv,{"aria-label":O,className:`size-7 shrink-0`,disabled:a,onClick:k,size:`icon`,type:`button`,variant:`ghost`,children:A}),t[40]=a,t[41]=O,t[42]=k,t[43]=j):j=t[43];let M;t[44]!==D||t[45]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[D,j]}),t[44]=D,t[45]=j,t[46]=M):M=t[46];let N;t[47]!==a||t[48]!==m||t[49]!==g||t[50]!==v||t[51]!==C||t[52]!==o||t[53]!==n.event||t[54]!==n.match?(N=n.match?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g5,{currentNodeId:o??void 0,description:`Only an arrival satisfying this resumes the run. Compare a payload field against a literal, or against a value from this run.`,disabled:a,emptyFieldsMessage:`This Event declares no fields, so there is nothing to match on.`,fields:m,label:`Match`,onChange:g,value:n.match}),(0,X.jsxs)(zv,{disabled:a,onClick:v,size:`sm`,type:`button`,variant:`ghost`,children:[`Resume on any `,n.event]})]}):(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Any `,n.event,` resumes this run, whatever it carries.`]}),(0,X.jsx)(zv,{disabled:a||m.length===0,onClick:C,size:`sm`,type:`button`,variant:`outline`,children:`Add a match`})]}),t[47]=a,t[48]=m,t[49]=g,t[50]=v,t[51]=C,t[52]=o,t[53]=n.event,t[54]=n.match,t[55]=N):N=t[55];let P;return t[56]!==M||t[57]!==N?(P=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[M,N]}),t[56]=M,t[57]=N,t[58]=P):P=t[58],P}function f_e(e){return e!==void 0}function p_e(e){return S1(e.data.config)}function m_e(e){return e.data.type===`lifecycle`}function y5(e){let t=(0,Z.c)(5),{logoUrl:n,label:r,fallback:i}=e,a;t[0]===n?a=t[1]:(a=n?.trim(),t[0]=n,t[1]=a);let o=a;if(!o)return i;let s=`${r} logo`,c;return t[2]!==o||t[3]!==s?(c=(0,X.jsx)(`img`,{alt:s,className:`size-4 rounded-sm object-contain`,height:16,loading:`lazy`,src:o,width:16}),t[2]=o,t[3]=s,t[4]=c):c=t[4],c}function h_e(e){let t=(0,Z.c)(15),{config:n,onUpdateConfig:r,disabled:i}=e,a=wA(V4),o=wA(Z4),s=wA(Q4),c=yy(),l=a??void 0,u;t[0]!==c||t[1]!==s||t[2]!==o||t[3]!==l?(u=a8({currentNodeId:l,nodes:o,edges:s,catalog:c}),t[0]=c,t[1]=s,t[2]=o,t[3]=l,t[4]=u):u=t[4];let d=u,f;t[5]===r?f=t[6]:(f=e=>{r({conditionModel:e.model,condition:e.expression})},t[5]=r,t[6]=f);let p=f,m=a??void 0,h;t[7]===n?h=t[8]:(h=g0(n,`conditionModel`)??``,t[7]=n,t[8]=h);let g;return t[9]!==i||t[10]!==d||t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,X.jsx)(g5,{currentNodeId:m,description:`Build a condition from the Lifecycle Node and upstream action output fields. Timestamp fields support relative and absolute time filters.`,disabled:i,emptyFieldsMessage:`No upstream fields available. Connect this node to the Lifecycle Node or an action with typed outputs first.`,fields:d,label:`Condition`,onChange:p,value:h}),t[9]=i,t[10]=d,t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function g_e(){let e=(0,Z.c)(3),t=O8(wA(V4)),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Splits On Event`}),e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[n,t.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No Event reaches this node yet. Connect it below the Lifecycle Node, and it draws one outlet per Start Event.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ul`,{className:`space-y-1`,children:t.map(__e)}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A run leaves by the outlet naming the Event it arrived on. An outlet with nothing connected ends the run there.`})]})]}),e[1]=t,e[2]=r),r}function __e(e){return(0,X.jsxs)(`li`,{className:`text-sm`,children:[e.label,(0,X.jsx)(`span`,{className:`ml-2 text-muted-foreground text-xs`,children:e.name})]},e.name)}function v_e(e){let t=(0,Z.c)(87),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=_0(n,`waitGateMode`,`off`),t[0]=n,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=g0(n,`waitUntil`),t[2]=n,t[3]=s);let c=s,l;t[4]===n?l=t[5]:(l=g0(n,`waitDuration`),t[4]=n,t[5]=l);let u=l,d;t[6]===n?d=t[7]:(d=c4(n),t[6]=n,t[7]=d);let f=d,p;t[8]===n?p=t[9]:(p=g0(n,`waitAllowedHoursMode`),t[8]=n,t[9]=p);let m=p===`daily_window`,h;t[10]!==n||t[11]!==r?(h=e=>{let t={...n,waitDelayTimingMode:e},i=Object.fromEntries(l4(t).map(y_e));r({...i,waitDelayTimingMode:e})},t[10]=n,t[11]=r,t[12]=h):h=t[12];let g=h,_;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Time-Based Wait`}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(wX,{htmlFor:`waitDelayTimingMode`,children:`Time input mode`}),t[14]=v):v=t[14];let y;t[15]===g?y=t[16]:(y=V6(g),t[15]=g,t[16]=y);let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(U6,{className:`w-full`,id:`waitDelayTimingMode`,children:(0,X.jsx)(H6,{placeholder:`Select time input mode`})}),t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsxs)(W6,{children:[(0,X.jsx)(G6,{value:`duration`,children:`Wait for duration`}),(0,X.jsx)(G6,{value:`until`,children:`Wait until date/time`})]}),t[18]=x):x=t[18];let S;t[19]!==f||t[20]!==i||t[21]!==y?(S=(0,X.jsxs)(B6,{disabled:i,onValueChange:y,value:f,children:[b,x]}),t[19]=f,t[20]=i,t[21]=y,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Pick one mode. Switching modes clears fields that do not apply.`}),t[23]=C):C=t[23];let w;t[24]===S?w=t[25]:(w=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[v,S,C]}),t[24]=S,t[25]=w);let T;t[26]!==n||t[27]!==u||t[28]!==c||t[29]!==f||t[30]!==i||t[31]!==r?(T=f===`duration`?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`waitDuration`,children:`Wait for (duration)`}),(0,X.jsx)(h8,{disabled:i,fieldType:o4.waitDuration.type,id:`waitDuration`,onChange:e=>r({waitDuration:e}),placeholder:`24h, 90m, 3600000, or P1D`,value:u}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: use `,(0,X.jsx)(`code`,{children:`24h`}),` to continue one day later.`]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`waitUntil`,children:`Wait until this date/time`}),(0,X.jsx)(h8,{disabled:i,fieldType:o4.waitUntil.type,id:`waitUntil`,onChange:e=>r({waitUntil:e}),placeholder:`2026-03-10T09:00:00-05:00 or {{@lifecycle_1:Lifecycle.appointment.startsAt}}`,value:c}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Use this when timing comes from payload data, like an appointment start time.`})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`waitOffset`,children:`Send before/after that time (optional)`}),(0,X.jsx)(h8,{disabled:i,fieldType:o4.waitOffset.type,id:`waitOffset`,onChange:e=>r({waitOffset:e}),placeholder:`-1d, 6h, 30m`,value:g0(n,`waitOffset`)}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: `,(0,X.jsx)(`code`,{children:`-1d`}),` sends one day before the target time.`]})]})]}),t[26]=n,t[27]=u,t[28]=c,t[29]=f,t[30]=i,t[31]=r,t[32]=T):T=t[32];let E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(wX,{htmlFor:`waitGateMode`,children:`Continue only if time actually elapsed`}),t[33]=E):E=t[33];let D;t[34]===r?D=t[35]:(D=e=>r({waitGateMode:e}),t[34]=r,t[35]=D);let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(U6,{className:`w-full`,id:`waitGateMode`,children:(0,X.jsx)(H6,{placeholder:`Select behavior`})}),t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsxs)(W6,{children:[(0,X.jsx)(G6,{value:`off`,children:`Off (continue immediately)`}),(0,X.jsx)(G6,{value:`require_actual_wait`,children:`Skip branch when already due`})]}),t[37]=k):k=t[37];let A;t[38]!==i||t[39]!==D||t[40]!==o?(A=(0,X.jsxs)(B6,{disabled:i,onValueChange:D,value:o,children:[O,k]}),t[38]=i,t[39]=D,t[40]=o,t[41]=A):A=t[41];let j;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Prevents immediate sends when the computed time is now or in the past after an update/reschedule.`}),t[42]=j):j=t[42];let M;t[43]===A?M=t[44]:(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[E,A,j]}),t[43]=A,t[44]=M);let N;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(wX,{htmlFor:`waitAllowedHoursMode`,children:`Allowed send window`}),t[45]=N):N=t[45];let P;t[46]===r?P=t[47]:(P=e=>r({waitAllowedHoursMode:e}),t[46]=r,t[47]=P);let F;t[48]===n?F=t[49]:(F=_0(n,`waitAllowedHoursMode`,`off`),t[48]=n,t[49]=F);let I;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(U6,{className:`w-full`,id:`waitAllowedHoursMode`,children:(0,X.jsx)(H6,{placeholder:`Select window mode`})}),t[50]=I):I=t[50];let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsxs)(W6,{children:[(0,X.jsx)(G6,{value:`off`,children:`Off (allow any time)`}),(0,X.jsx)(G6,{value:`daily_window`,children:`Daily window`})]}),t[51]=L):L=t[51];let R;t[52]!==i||t[53]!==P||t[54]!==F?(R=(0,X.jsxs)(B6,{disabled:i,onValueChange:P,value:F,children:[I,L]}),t[52]=i,t[53]=P,t[54]=F,t[55]=R):R=t[55];let z;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`When enabled, times outside the window shift to the next allowed start.`}),t[56]=z):z=t[56];let B;t[57]===R?B=t[58]:(B=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[N,R,z]}),t[57]=R,t[58]=B);let V;t[59]!==n||t[60]!==i||t[61]!==m||t[62]!==r?(V=m&&(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`waitAllowedStartTime`,children:`Window start`}),(0,X.jsx)(CX,{disabled:i,id:`waitAllowedStartTime`,onChange:e=>r({waitAllowedStartTime:e.target.value}),placeholder:`09:00`,value:g0(n,`waitAllowedStartTime`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`waitAllowedEndTime`,children:`Window end`}),(0,X.jsx)(CX,{disabled:i,id:`waitAllowedEndTime`,onChange:e=>r({waitAllowedEndTime:e.target.value}),placeholder:`17:00`,value:g0(n,`waitAllowedEndTime`)})]}),(0,X.jsx)(`p`,{className:`col-span-2 text-muted-foreground text-xs`,children:`Use 24-hour format (HH:MM). Start must be before end. Requires timezone below.`})]}),t[59]=n,t[60]=i,t[61]=m,t[62]=r,t[63]=V):V=t[63];let H=m?` (required for send window)`:` (optional)`,U;t[64]===H?U=t[65]:(U=(0,X.jsxs)(wX,{htmlFor:`waitTimezone`,children:[`Timezone`,H]}),t[64]=H,t[65]=U);let W;t[66]===r?W=t[67]:(W=e=>r({waitTimezone:e}),t[66]=r,t[67]=W);let G;t[68]===n?G=t[69]:(G=_0(n,`waitTimezone`,`UTC`),t[68]=n,t[69]=G);let K;t[70]!==i||t[71]!==W||t[72]!==G?(K=(0,X.jsx)(she,{disabled:i,id:`waitTimezone`,onValueChange:W,value:G}),t[70]=i,t[71]=W,t[72]=G,t[73]=K):K=t[73];let q=m&&` Also determines when the daily send window applies.`,J;t[74]===q?J=t[75]:(J=(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Used when the target date/time does not include an offset.`,q]}),t[74]=q,t[75]=J);let ee;t[76]!==U||t[77]!==K||t[78]!==J?(ee=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[U,K,J]}),t[76]=U,t[77]=K,t[78]=J,t[79]=ee):ee=t[79];let te;return t[80]!==w||t[81]!==T||t[82]!==M||t[83]!==B||t[84]!==V||t[85]!==ee?(te=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[_,w,T,M,B,V,ee]}),t[80]=w,t[81]=T,t[82]=M,t[83]=B,t[84]=V,t[85]=ee,t[86]=te):te=t[86],te}function y_e(e){return[e,``]}function b_e(e){let t=(0,Z.c)(35),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Wait for Event`}),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=(0,X.jsx)(l_e,{config:n,disabled:i,onUpdateConfig:r}),t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(wX,{htmlFor:`waitTimeout`,children:`Stop waiting after`}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=e=>r({waitTimeout:e}),t[6]=r,t[7]=c);let l;t[8]===n?l=t[9]:(l=g0(n,`waitTimeout`),t[8]=n,t[9]=l);let u;t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,X.jsx)(h8,{disabled:i,fieldType:o4.waitTimeout.type,id:`waitTimeout`,onChange:c,placeholder:`7d`,value:l}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Required. A wait with no end holds a run, and a place in the run list, until somebody notices.`}),t[14]=d):d=t[14];let f;t[15]===u?f=t[16]:(f=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,u,d]}),t[15]=u,t[16]=f);let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(wX,{htmlFor:`waitTimeoutBehavior`,children:`On timeout`}),t[17]=p):p=t[17];let m;t[18]===r?m=t[19]:(m=e=>r({waitTimeoutBehavior:e}),t[18]=r,t[19]=m);let h;t[20]===n?h=t[21]:(h=_0(n,`waitTimeoutBehavior`,`continue`),t[20]=n,t[21]=h);let g;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(U6,{className:`w-full`,id:`waitTimeoutBehavior`,children:(0,X.jsx)(H6,{placeholder:`Select timeout behavior`})}),t[22]=g):g=t[22];let _;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsxs)(W6,{children:[(0,X.jsx)(G6,{value:`continue`,children:`Continue workflow`}),(0,X.jsx)(G6,{value:`skip`,children:`Skip remaining branch`})]}),t[23]=_):_=t[23];let v;t[24]!==i||t[25]!==m||t[26]!==h?(v=(0,X.jsxs)(B6,{disabled:i,onValueChange:m,value:h,children:[g,_]}),t[24]=i,t[25]=m,t[26]=h,t[27]=v):v=t[27];let y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Choose whether to continue downstream nodes or halt the branch when the timeout expires.`}),t[28]=y):y=t[28];let b;t[29]===v?b=t[30]:(b=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,v,y]}),t[29]=v,t[30]=b);let x;return t[31]!==b||t[32]!==o||t[33]!==f?(x=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[a,o,f,b]}),t[31]=b,t[32]=o,t[33]=f,t[34]=x):x=t[34],x}function x_e(e){let t=(0,Z.c)(31),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=_0(n,`waitMode`,`delay`),t[0]=n,t[1]=a);let o=a,s;t[2]!==n||t[3]!==r?(s=e=>{let t={...n,waitMode:e},i=Object.fromEntries(l4(t).map(S_e));r({...i,waitMode:e,...e===`event`&&!(g0(n,`waitTimeout`)??``).trim()?{waitTimeout:`7d`}:{}})},t[2]=n,t[3]=r,t[4]=s):s=t[4];let c=s,l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(wX,{htmlFor:`waitMode`,children:`How should this step wait?`}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=V6(c),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(U6,{className:`w-full`,id:`waitMode`,children:(0,X.jsx)(H6,{placeholder:`Select wait mode`})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsxs)(W6,{children:[(0,X.jsx)(G6,{value:`delay`,children:`Wait for time`}),(0,X.jsx)(G6,{value:`event`,children:`Wait for an event`})]}),t[9]=f):f=t[9];let p;t[10]!==i||t[11]!==u||t[12]!==o?(p=(0,X.jsxs)(B6,{disabled:i,onValueChange:u,value:o,children:[d,f]}),t[10]=i,t[11]=u,t[12]=o,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Resume on a clock, or when an event arrives that this step's match accepts.`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[l,p,m]}),t[15]=p,t[16]=h);let g;t[17]!==n||t[18]!==i||t[19]!==r||t[20]!==o?(g=o===`delay`&&(0,X.jsx)(v_e,{config:n,disabled:i,onUpdateConfig:r}),t[17]=n,t[18]=i,t[19]=r,t[20]=o,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==i||t[24]!==r||t[25]!==o?(_=o===`event`&&(0,X.jsx)(b_e,{config:n,disabled:i,onUpdateConfig:r}),t[22]=n,t[23]=i,t[24]=r,t[25]=o,t[26]=_):_=t[26];let v;return t[27]!==g||t[28]!==_||t[29]!==h?(v=(0,X.jsxs)(X.Fragment,{children:[h,g,_]}),t[27]=g,t[28]=_,t[29]=h,t[30]=v):v=t[30],v}function S_e(e){return[e,``]}function C_e(e){let t=(0,Z.c)(9),{actionType:n,config:r,onUpdateConfig:i,disabled:a}=e;switch(n){case y1.condition:{let e;return t[0]!==r||t[1]!==a||t[2]!==i?(e=(0,X.jsx)(h_e,{config:r,disabled:a,onUpdateConfig:i}),t[0]=r,t[1]=a,t[2]=i,t[3]=e):e=t[3],e}case y1.eventSplit:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(g_e,{}),t[4]=e):e=t[4],e}case y1.wait:{let e;return t[5]!==r||t[6]!==a||t[7]!==i?(e=(0,X.jsx)(x_e,{config:r,disabled:a,onUpdateConfig:i}),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],e}default:return null}}function w_e(){let e=(0,Z.c)(2),t=yy(),n;if(e[0]!==t){let r=yne(t);n=Object.fromEntries(Object.entries(r).map(T_e)),e[0]=t,e[1]=n}else n=e[1];return n}function T_e(e){let[t,n]=e;return[t,n.map(E_e)]}function E_e(e){return{id:e.id,label:e.label,logoUrl:e.logoUrl,integration:e.integration}}function D_e(e,t){return Py(e,t)?.category??null}function O_e(e){let t=(0,Z.c)(81),{config:n,onUpdateConfig:r,disabled:i,isOwner:a}=e,o=a===void 0||a,s=yy(),c=g0(n,`actionType`),l=w_e(),u;t[0]===l?u=t[1]:(u=Object.keys(l).filter(j_e).toSorted(),t[0]=l,t[1]=u);let d=u,f=c&&D_e(s,c)||``,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=r0(),t[2]=p):p=t[2];let{data:m}=Xe(p),h;t[3]===m?h=t[4]:(h=m===void 0?[]:m,t[3]=m,t[4]=h);let g=h,{push:_}=LY(),v;t[5]!==l||t[6]!==r?(v=e=>{let t=l[e]?.[0];t&&r({actionType:t.id})},t[5]=l,t[6]=r,t[7]=v):v=t[7];let y=v,b;t[8]===r?b=t[9]:(b=e=>{r({actionType:e})},t[8]=r,t[9]=b);let x=b,S=c?Py(s,c):void 0,C=S?.integration,w;if(t[10]!==g||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>e.type===C,t[13]=C,t[14]=e),w=g.some(e),t[10]=g,t[11]=C,t[12]=w}else w=t[12];let T=w,E;t[15]!==C||t[16]!==r||t[17]!==_?(E=()=>{C&&_(S3,{type:C,onSuccess:e=>{r({integrationId:e})}})},t[15]=C,t[16]=r,t[17]=_,t[18]=E):E=t[18];let D=E,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(wX,{className:`ml-1`,htmlFor:`actionCategory`,children:`Service`}),t[19]=O):O=t[19];let k;t[20]===y?k=t[21]:(k=V6(y),t[20]=y,t[21]=k);let A=f||void 0,j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(U6,{className:`w-full`,id:`actionCategory`,children:(0,X.jsx)(H6,{placeholder:`Select category`})}),t[22]=j):j=t[22];let M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(G6,{value:`System`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(dy,{className:`size-4`}),(0,X.jsx)(`span`,{children:`System`})]})}),t[23]=M):M=t[23];let N;t[24]===d.length?N=t[25]:(N=d.length>0&&(0,X.jsx)(Eme,{}),t[24]=d.length,t[25]=N);let P;if(t[26]!==l||t[27]!==d){let e;t[29]===l?e=t[30]:(e=e=>{let t=l[e],n=t?.[0]?.integration,r=t?.map(A_e).find(k_e);return(0,X.jsx)(G6,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(y5,{fallback:n?(0,X.jsx)(y3,{className:`size-4`,integration:n}):(0,X.jsx)(gy,{className:`size-4`}),label:e,logoUrl:r}),(0,X.jsx)(`span`,{children:e})]})},e)},t[29]=l,t[30]=e),P=d.map(e),t[26]=l,t[27]=d,t[28]=P}else P=t[28];let F;t[31]!==N||t[32]!==P?(F=(0,X.jsxs)(W6,{children:[M,N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let I;t[34]!==i||t[35]!==k||t[36]!==A||t[37]!==F?(I=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[O,(0,X.jsxs)(B6,{disabled:i,onValueChange:k,value:A,children:[j,F]})]}),t[34]=i,t[35]=k,t[36]=A,t[37]=F,t[38]=I):I=t[38];let L;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(wX,{className:`ml-1`,htmlFor:`actionType`,children:`Action`}),t[39]=L):L=t[39];let R=i||!f,z;t[40]===x?z=t[41]:(z=V6(x),t[40]=x,t[41]=z);let B=c||void 0,V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsx)(U6,{className:`w-full`,id:`actionType`,children:(0,X.jsx)(H6,{placeholder:`Select action`})}),t[42]=V):V=t[42];let H;t[43]!==l||t[44]!==f?(H=f&&l[f]?.map(e=>{let t;return t=f===`System`?(0,X.jsx)(dy,{className:`size-4`}):e.integration?(0,X.jsx)(y3,{className:`size-4`,integration:e.integration}):(0,X.jsx)(gy,{className:`size-4`}),(0,X.jsx)(G6,{value:e.id,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(y5,{fallback:t,label:e.label,logoUrl:e.logoUrl}),(0,X.jsx)(`span`,{children:e.label})]})},e.id)}),t[43]=l,t[44]=f,t[45]=H):H=t[45];let U;t[46]===H?U=t[47]:(U=(0,X.jsx)(W6,{children:H}),t[46]=H,t[47]=U);let W;t[48]!==R||t[49]!==z||t[50]!==B||t[51]!==U?(W=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[L,(0,X.jsxs)(B6,{disabled:R,onValueChange:z,value:B,children:[V,U]})]}),t[48]=R,t[49]=z,t[50]=B,t[51]=U,t[52]=W):W=t[52];let G;t[53]!==I||t[54]!==W?(G=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[I,W]}),t[53]=I,t[54]=W,t[55]=G):G=t[55];let K;t[56]!==n||t[57]!==i||t[58]!==T||t[59]!==C||t[60]!==o||t[61]!==r||t[62]!==D?(K=C&&o&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`ml-1 flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(wX,{children:`Connection`}),(0,X.jsx)(w8,{children:(0,X.jsxs)(T8,{children:[(0,X.jsx)(E8,{render:(0,X.jsx)(`span`,{className:`inline-flex`,children:(0,X.jsx)(Zv,{className:`size-3.5 text-muted-foreground`})}),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Connection help`})}),(0,X.jsx)(D8,{children:(0,X.jsx)(`p`,{children:`API key or OAuth credentials for this service`})})]})})]}),T&&(0,X.jsx)(zv,{"aria-label":`Add connection`,className:`size-6`,disabled:i,onClick:D,size:`icon`,variant:`ghost`,children:(0,X.jsx)(cy,{className:`size-4`})})]}),(0,X.jsx)(Epe,{disabled:i,integrationType:C,onChange:e=>r({integrationId:e}),value:g0(n,`integrationId`)})]}),t[56]=n,t[57]=i,t[58]=T,t[59]=C,t[60]=o,t[61]=r,t[62]=D,t[63]=K):K=t[63];let q;t[64]===n?q=t[65]:(q=g0(n,`actionType`)??``,t[64]=n,t[65]=q);let J;t[66]!==n||t[67]!==i||t[68]!==r||t[69]!==q?(J=(0,X.jsx)(C_e,{actionType:q,config:n,disabled:i,onUpdateConfig:r}),t[66]=n,t[67]=i,t[68]=r,t[69]=q,t[70]=J):J=t[70];let ee;t[71]!==S||t[72]!==n||t[73]!==i||t[74]!==r?(ee=S&&S.configFields.length>0&&(0,X.jsx)(Uhe,{config:n,disabled:i,fields:S.configFields,onUpdateConfig:r}),t[71]=S,t[72]=n,t[73]=i,t[74]=r,t[75]=ee):ee=t[75];let te;return t[76]!==G||t[77]!==K||t[78]!==J||t[79]!==ee?(te=(0,X.jsxs)(X.Fragment,{children:[G,K,J,ee]}),t[76]=G,t[77]=K,t[78]=J,t[79]=ee,t[80]=te):te=t[80],te}function k_e(e){return typeof e==`string`&&e.trim().length>0}function A_e(e){return e.logoUrl}function j_e(e){return e!==`System`}var b5=Y.createContext(void 0);function x5(e){let t=Y.useContext(b5);if(t===void 0&&!e)throw Error(Gg(33));return t}var S5=Y.createContext(void 0);function C5(e){let t=Y.useContext(S5);if(t===void 0&&!e)throw Error(Gg(36));return t}var M_e=Y.createContext(void 0);function w5(e=!0){let t=Y.useContext(M_e);if(t===void 0&&!e)throw Error(Gg(25));return t}function N_e(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=w5(!0),f=d!==void 0;return Y.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:dH})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!JH&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&Yg(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var T5={type:`regular-item`};function E5(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Y.useRef(null),{getButtonProps:d,buttonRef:f}=Xg({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=N_e({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Y.useCallback(e=>Fg(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Qg(u,f);return Y.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var D5=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),O5={checked(e){return e?{[D5.checked]:``}:{[D5.unchecked]:``}},...YV},P_e=Y.createContext(void 0),F_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=N6({guess:!0,label:a}),f=x5(!0),p=NH(i),{store:m}=C5(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=E5({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:T5});return o_(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),k5=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=C5(),{side:c,align:l}=x5(),u=E6(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;_q({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Y.useEffect(()=>{function e(e){s.setOpen(!1,EH(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),Qq(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=o_(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:iH,props:[p,{onKeyDown(e){u&&wJ.has(e.key)&&e.stopPropagation()}},x6(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,X.jsx)(VG,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),A5=Y.createContext(void 0);function I_e(){let e=Y.useContext(A5);if(e===void 0)throw Error(Gg(32));return e}var j5=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=C5();return i.useState(`mounted`)||n?(0,X.jsx)(A5.Provider,{value:n,children:(0,X.jsx)(SG,{ref:t,...r})}):null}),M5=Y.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=hG,style:g,..._}=e,{store:v}=C5(),y=I_e(),b=w5(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Y.useRef(null),R=gq(A),z=n,B=c,V=l,H=s,U=h;x.type===`context-menu`&&(z=n??x.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let W=o,G=H;x.type===`menu`?(W??=`inline-end`,G??=`start`,U=e.collisionAvoidance??gG):x.type===`menubar`&&(W??=x.context.orientation===`vertical`?`inline-end`:`bottom`,G??=`start`);let K=x.type===`context-menu`,q=h6({anchor:z,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:W,sideOffset:B,align:G,alignOffset:V,arrowPadding:K?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:U,shift:K?{crossAxis:!(`side`in U&&U.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Y.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,EH(SH)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Y.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,EH(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let J=RH();Y.useEffect(()=>{T||J.clear()},[T,J]),Y.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?J.isStarted()||J.start(e,()=>{v.setOpen(!1,EH(SH))}):v.setOpen(!1,EH(SH))}else J.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,J]),Y.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Mg(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let ee={open:T,side:q.side,align:q.align,anchorHidden:q.anchorHidden,nested:x.type===`menu`,instant:j},te=x.type===`menubar`&&x.context.modal;C6(T&&(te||E&&N!==`trigger-hover`),D===`touch`,A,O);let ne=S6(e,ee,{styles:q.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),re=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),ie=null;return x.type===`menubar`?ie=x.context.contentElement:x.type===void 0&&(ie=O),(0,X.jsxs)(b5.Provider,{value:q,children:[re&&(0,X.jsx)(FJ,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:PJ(!T),cutout:ie}),(0,X.jsx)(AG,{id:P,children:(0,X.jsx)(c6,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:ne})})]})}),N5=Y.createContext(void 0);function L_e(){let e=Y.useContext(N5);if(e===void 0)throw Error(Gg(34));return e}var R_e=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Y.useState(void 0),[p,m]=k3({controlled:i,default:a,name:`MenuRadioGroup`}),h=kg((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=o_(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Y.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,X.jsx)(P_e.Provider,{value:f,children:(0,X.jsx)(N5.Provider,{value:_,children:g})})})),P5=Y.createContext(void 0);function z_e(){let e=Y.useContext(P5);if(e===void 0)throw Error(Gg(35));return e}var B_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=N6({guess:!0,label:a}),p=x5(!0),m=NH(i),{store:h}=C5(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=L_e(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=E5({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:T5}),E=Y.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=EH(dH,e.nativeEvent,void 0,{preventUnmountOnClose:r_});y(l,t)}let O=o_(`div`,e,{state:E,stateAttributesMapping:O5,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,X.jsx)(P5.Provider,{value:E,children:O})}),V_e=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=z_e(),c=Y.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=hq(s.checked);return _q({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),o_(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:O5,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),H_e=Y.createContext(null);function F5(e){let t=Y.useContext(H_e);if(t===null&&!e)throw Error(Gg(5));return t}var U_e={...Bq,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},W_e=class extends dq{constructor(e){super({...K_e(),...e},G_e(),U_e),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function G_e(){return{positionerRef:Y.createRef(),popupRef:Y.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Y.createRef(),beforeContentFocusGuardRef:Y.createRef(),onOpenChangeComplete:void 0,triggerElements:new jq}}function K_e(){return{...Nq(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new wG,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:a_,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var I5=Y.createContext(void 0);function L5(){return Y.useContext(I5)}var R5=nq(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=w5(!0),_=C5(!0),v=F5(!0),y=L5(),b=Y.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=q_e({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});x.useControlledProp(`openProp`,n),x.useControlledProp(`triggerIdProp`,p),x.useContextCallback(`onOpenChangeComplete`,i);let S=MH(),C=MH(),w=x.useState(`floatingTreeRoot`),T=kG(w),E=DG(),D=x.useState(`open`),O=x.useState(`activeTriggerElement`),k=x.useState(`positionerElement`),A=x.useState(`hoverEnabled`),j=x.useState(`disabled`),M=x.useState(`lastOpenChangeReason`),N=x.useState(`parent`),P=x.useState(`activeIndex`),F=x.useState(`payload`),I=x.useState(`floatingParentNodeId`),L=Y.useRef(null),R=Y.useRef(N.type!==`context-menu`),z=RH(),B=Y.useRef(!0),V=RH(),H=I!=null,{openMethod:U,triggerProps:W}=oY(D);x.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:N.type===void 0?s:void 0,openMethod:U,rootId:S}),Dq(x);let{forceUnmount:G}=Oq(D,x,()=>{x.set(`allowMouseEnter`,!1)});Mg(()=>{g&&!_?x.update({parent:{type:`context-menu`,context:g},floatingNodeId:T,floatingParentNodeId:E}):_&&x.update({floatingNodeId:T,floatingParentNodeId:E})},[g,_,T,E,x]),Y.useEffect(()=>{if(D||(L.current=null),N.type===`context-menu`){if(!D){z.clear(),R.current=!1;return}z.start(500,()=>{R.current=!0})}},[z,D,N.type]),Mg(()=>{!D&&!A&&x.set(`hoverEnabled`,!0)},[D,A,x]);let K=kg((e,t)=>{let n=t.reason;if(!e&&!x.select(`open`)||D===e&&t.trigger===O&&M===n)return;let i=wq(t);if(!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled)return;x.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!B.current)return;e&&n===`trigger-focus`?(B.current=!1,V.start(300,()=>{B.current=!0})):(B.current=!0,V.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};L.current=t.event,Cq(c,e,t.trigger,i()),x.update(c),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?x.set(`instantType`,`group`):o||s?x.set(`instantType`,o?`click`:`dismiss`):x.set(`instantType`,void 0)}),q=mq({popupStore:x,floatingId:C,nested:E!=null,onOpenChange:K}),J=q.context.events;Mg(()=>{let e=({open:e,eventDetails:t})=>K(e,t);return J.on(`setOpen`,e),()=>{J?.off(`setOpen`,e)}},[J,K]);let ee=Y.useCallback(()=>{x.setOpen(!1,EH(wH))},[x]);Y.useImperativeHandle(u,()=>({unmount:G,close:ee}),[G,ee]);let te;N.type===`context-menu`&&(te=N.context),Y.useImperativeHandle(te?.positionerRef,()=>k,[k]),Y.useImperativeHandle(te?.actionsRef,()=>({setOpen:K}),[K]);let ne=JG(q,{enabled:!j,bubbles:{escapeKey:d&&N.type===`menu`},outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`||R.current},externalTree:H?w:void 0}),re=u6(),ie=Y.useCallback(e=>{x.select(`activeIndex`)!==e&&x.set(`activeIndex`,e)},[x]),ae=cJ(q,{enabled:!j,listRef:x.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:c,orientation:l,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:re===`rtl`,disabledIndices:i_,onNavigate:ie,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:H?w:void 0,focusItemOnHover:h}),oe=Y.useCallback(e=>{x.context.typingRef.current=e},[x]),se=lJ(q,{enabled:!j,listRef:x.context.itemLabels,elementsRef:x.context.itemDomElements,activeIndex:P,resetMs:500,onMatch:e=>{D&&e!==P&&x.set(`activeIndex`,e)},onTyping:oe});kq(x,{floatingRootContext:q,activeTriggerProps:Y.useMemo(()=>{let e=Fg(se.reference,ae.reference,ne.reference,{onMouseMove(){x.set(`allowMouseEnter`,!0)}},W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=D,e},[x,se.reference,ae.reference,ne.reference,W,D]),inactiveTriggerProps:Y.useMemo(()=>{let e=Fg(ae.trigger,ne.trigger,W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ae.trigger,ne.trigger,W]),popupProps:Y.useMemo(()=>Fg(vq,{id:C,role:`menu`,"aria-labelledby":O?.id,onMouseMove(){x.set(`allowMouseEnter`,!0),N.type===`menu`&&x.set(`hoverEnabled`,!1)},onClick(){x.select(`hoverEnabled`)&&x.set(`hoverEnabled`,!1)},onKeyDown(e){let t=x.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},se.floating,ae.floating,ne.floating),[O,C,N.type,x,se.floating,ae.floating,ne.floating]),itemProps:ae.item??a_});let ce=Y.useMemo(()=>({store:x,parent:b}),[x,b]),le=(0,X.jsxs)(S5.Provider,{value:ce,children:[f&&(0,X.jsx)(xq,{handle:f,store:x}),typeof t==`function`?t({payload:F}):t]});return N.type===void 0||N.type===`context-menu`?(0,X.jsx)(jG,{externalTree:w,children:le}):le});function q_e(e){return Eg(()=>new W_e(e)).current}function J_e(e){let t=C5().store,n=Y.useMemo(()=>({parentMenu:t}),[t]);return(0,X.jsx)(I5.Provider,{value:n,children:(0,X.jsx)(R5,{...e})})}function Y_e(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=qg(),{ref:i,index:a}=N6(e),o=n===a,s=Y.useRef(null),c=Qg(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function z5(e){let{render:t,className:n,style:r,state:i=a_,props:a=i_,refs:o=i_,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=Y_e({metadata:s});return o_(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function B5(e){if(ag(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!_g(e))return B5(bg(e))}function X_e(e,t){let n=Y.useRef(null);function r(t){Xi.flushSync(()=>{e.setOpen(!1,EH(gH,t.nativeEvent,t.currentTarget))}),qW(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&JW(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Xi.flushSync(()=>{e.setOpen(!1,EH(gH,n.nativeEvent,n.currentTarget))});let i=KW(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&pU(r,i);){let e=i;if(i=UW(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Z_e(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Y.useRef(!1);return Y.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Jg(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:a_,[t,n,r])}var Q_e=rq(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=C5(!0),h=Vq(d)??m?.store;if(!h)throw Error(Gg(85));let g=NH(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Y.useRef(null),S=eve(),C=qg(!0),w=OG(),T=Y.useMemo(()=>w??new wG,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Eq(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:kG(T),floatingParentNodeId:DG(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Xg({disabled:A,native:o});Y.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Y.useRef(null),P=RH(),F=kg(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;pU(N.current,t)||pU(h.select(`positionerElement`),t)||t===N.current||(t==null||B5(t)!==h.select(`rootId`))&&(o6(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:xH}))});Y.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&Jg(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=eJ(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:_J({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=$_e(y,h.select(`lastOpenChangeReason`)),z=HG(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=Kq(v,{enabled:!A&&I}),V=Z_e({open:y,enabled:O,mouseDownAction:`open`}),H=Y.useMemo(()=>Fg(B.reference,z.reference),[B.reference,z.reference]),U=h.useState(`triggerProps`,D),{preFocusGuardRef:W,handlePreFocusGuardFocus:G,handleFocusTargetFocus:K}=X_e(h,x),q={disabled:A,open:y},J=[N,t,M,E,x],ee=[H,L??a_,U,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Jg(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},V,p,j],te=o_(`button`,e,{enabled:!O,stateAttributesMapping:nH,state:q,ref:J,props:ee});return O?(0,X.jsx)(z5,{tag:`button`,render:n,className:r,style:i,state:q,refs:J,props:ee,stateAttributesMapping:nH}):y?(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(UU,{ref:W,onFocus:G},`${g}-pre-focus-guard`),(0,X.jsx)(Y.Fragment,{children:te},g),(0,X.jsx)(UU,{ref:h.context.triggerFocusTargetRef,onFocus:K},`${g}-post-focus-guard`)]}):(0,X.jsx)(Y.Fragment,{children:te},g)});function $_e(e,t){let n=RH(),[r,i]=Y.useState(!1);return Mg(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function eve(){let e=F5(!0);return Y.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var tve=Y.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return o_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),nve={"aria-expanded":void 0},rve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=L5();if(!p?.parentMenu)throw Error(Gg(37));let m=N6({guess:!0,label:a}),h=x5(),{store:g}=C5(),_=NH(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=Sq(_,g),C=Y.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=Y.useRef(null),T=Y.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),j=E.useState(`isActive`,m.index),M=Y.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:N,itemRef:P}=E5({closeOnClick:!1,disabled:k,highlighted:j,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:M,nodeId:h?.context.nodeId}),F=eJ(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:_J({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),I=HG(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??a_,L=g.useState(`triggerProps`,!0);delete L.id;let R={disabled:k,highlighted:j,open:v},z=g.useState(`openMethod`),B=g.useState(`lastOpenChangeReason`)===`list-navigation`||z===`keyboard`;return o_(`div`,e,{state:R,stateAttributesMapping:tH,props:[I,F,L,A,v&&B&&QH?nve:void 0,{"aria-controls":x,tabIndex:v||j?0:-1,onBlur(){j&&E.set(`activeIndex`,null)}},f,N],ref:[t,m.ref,P,C,T]})});function V5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(R5,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function H5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(Q_e,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function U5(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(k5,{className:s,"data-slot":`dropdown-menu-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(j5,{children:(0,X.jsx)(M5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function W5(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Q(`data-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive data-[disabled]:opacity-50 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,X.jsx)(F_e,{className:s,"data-inset":r,"data-slot":`dropdown-menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function ive(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(R_e,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function G5(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(V_e,{children:(0,X.jsx)(Qv,{className:`size-2 fill-current`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,X.jsxs)(B_e,{className:a,"data-slot":`dropdown-menu-radio-item`,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function K5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(tve,{className:i,"data-slot":`dropdown-menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ave(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(J_e,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function ove(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Q(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[highlighted]:bg-accent data-[popup-open]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[popup-open]:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(Xv,{className:`ml-auto size-4`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(rve,{className:o,"data-inset":i,"data-slot":`dropdown-menu-sub-trigger`,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function sve(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(k5,{className:s,"data-slot":`dropdown-menu-sub-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(j5,{children:(0,X.jsx)(M5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function cve(){return`ontouchstart`in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function lve(){return yy().actions}function uve(e){let t=(0,Z.c)(4),{group:n}=e,r=n.actions[0];if(r?.integration){let e;return t[0]===r.integration?e=t[1]:(e=(0,X.jsx)(y3,{className:`size-4`,integration:r.integration}),t[0]=r.integration,t[1]=e),e}if(n.category===`System`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(dy,{className:`size-4`}),t[2]=e):e=t[2],e}let i;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(gy,{className:`size-4`}),t[3]=i):i=t[3],i}function dve(e){let t=(0,Z.c)(11),{action:n,className:r}=e;if(n.integration){let e;return t[0]!==n.integration||t[1]!==r?(e=(0,X.jsx)(y3,{className:r,integration:n.integration}),t[0]=n.integration,t[1]=r,t[2]=e):e=t[2],e}if(n.category===`System`){let e;t[3]===r?e=t[4]:(e=Q(r,`text-muted-foreground`),t[3]=r,t[4]=e);let n;return t[5]===e?n=t[6]:(n=(0,X.jsx)(dy,{className:e}),t[5]=e,t[6]=n),n}let i;t[7]===r?i=t[8]:(i=Q(r,`text-muted-foreground`),t[7]=r,t[8]=i);let a;return t[9]===i?a=t[10]:(a=(0,X.jsx)(gy,{className:i}),t[9]=i,t[10]=a),a}var q5=`workflow-action-grid-hidden-groups`,J5=`workflow-action-grid-view-mode`;function fve(){if(typeof window>`u`)return new Set;try{let e=localStorage.getItem(q5);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function pve(){if(typeof window>`u`)return`list`;try{return localStorage.getItem(J5)===`grid`?`grid`:`list`}catch{return`list`}}function mve(e){let t=(0,Z.c)(72),{onSelectAction:n,disabled:r,isNewlyCreated:i}=e,[a,o]=(0,Y.useState)(``),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Set,t[0]=s):s=t[0];let[c,l]=(0,Y.useState)(s),[u,d]=(0,Y.useState)(fve),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(pve),g=lve(),_;t[1]===m?_=t[2]:(_=()=>{let e=m===`list`?`grid`:`list`;h(e),localStorage.setItem(J5,e)},t[1]=m,t[2]=_);let v=_,y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[3]=y):y=t[3];let b=y,x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),localStorage.setItem(q5,JSON.stringify([...n])),n})},t[4]=x):x=t[4];let S=x,C;if(t[5]!==g||t[6]!==a){let e;t[8]===a?e=t[9]:(e=e=>{let t=a.toLowerCase();return e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.category.toLowerCase().includes(t)},t[8]=a,t[9]=e),C=g.filter(e),t[5]=g,t[6]=a,t[7]=C}else C=t[7];let w=C,T;if(t[10]!==w){let e={};for(let t of w){let n=t.category;e[n]||(e[n]=[]),e[n].push(t)}T=Object.keys(e).toSorted(hve).map(t=>({category:t,actions:e[t]})),t[10]=w,t[11]=T}else T=t[11];let E=T,D;bb0:{if(f){D=E;break bb0}let e;if(t[12]!==E||t[13]!==u){let n;t[15]===u?n=t[16]:(n=e=>!u.has(e.category),t[15]=u,t[16]=n),e=E.filter(n),t[12]=E,t[13]=u,t[14]=e}else e=t[14];D=e}let O=D,k=u.size,A;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[17]=A):A=t[17];let j;t[18]===i?j=t[19]:(j=i===!0&&!cve(),t[18]=i,t[19]=j);let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>o(e.target.value),t[20]=M):M=t[20];let N;t[21]!==r||t[22]!==a||t[23]!==j?(N=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[A,(0,X.jsx)(CX,{autoFocus:j,className:`pl-9`,"data-testid":`action-search-input`,disabled:r,id:`action-filter`,onChange:M,placeholder:`Search actions...`,value:a})]}),t[21]=r,t[22]=a,t[23]=j,t[24]=N):N=t[24];let P;t[25]===v?P=t[26]:(P=(0,X.jsx)(zv,{className:`shrink-0`,onClick:v,size:`icon`,variant:`ghost`}),t[25]=v,t[26]=P);let F;t[27]===m?F=t[28]:(F=m===`list`?(0,X.jsx)(pte,{className:`size-4`}):(0,X.jsx)(vte,{className:`size-4`}),t[27]=m,t[28]=F);let I;t[29]!==P||t[30]!==F?(I=(0,X.jsx)(E8,{render:P,children:F}),t[29]=P,t[30]=F,t[31]=I):I=t[31];let L=m===`list`?`Grid view`:`List view`,R;t[32]===L?R=t[33]:(R=(0,X.jsx)(D8,{children:L}),t[32]=L,t[33]=R);let z;t[34]!==I||t[35]!==R?(z=(0,X.jsx)(w8,{children:(0,X.jsxs)(T8,{children:[I,R]})}),t[34]=I,t[35]=R,t[36]=z):z=t[36];let B;t[37]!==k||t[38]!==f?(B=k>0&&(0,X.jsx)(w8,{children:(0,X.jsxs)(T8,{children:[(0,X.jsx)(E8,{render:(0,X.jsx)(zv,{className:Q(`shrink-0`,f&&`bg-muted`),onClick:()=>p(!f),size:`icon`,variant:`ghost`}),children:f?(0,X.jsx)(ry,{className:`size-4`}):(0,X.jsx)(ny,{className:`size-4`})}),(0,X.jsx)(D8,{children:f?`Hide hidden groups`:`Show ${k} hidden group${k>1?`s`:``}`})]})}),t[37]=k,t[38]=f,t[39]=B):B=t[39];let V;t[40]!==N||t[41]!==z||t[42]!==B?(V=(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[N,z,B]}),t[40]=N,t[41]=z,t[42]=B,t[43]=V):V=t[43];let H;t[44]===w.length?H=t[45]:(H=w.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`No actions found`}),t[44]=w.length,t[45]=H);let U;t[46]!==w.length||t[47]!==O?(U=w.length>0&&O.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`All groups are hidden`}),t[46]=w.length,t[47]=O,t[48]=U):U=t[48];let W;t[49]!==r||t[50]!==w||t[51]!==u||t[52]!==n||t[53]!==f||t[54]!==m||t[55]!==O?(W=m===`grid`&&O.length>0&&(0,X.jsx)(`div`,{className:`grid gap-2 p-1`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(72px, 1fr))`},children:w.filter(e=>f||!u.has(e.category)).map(e=>(0,X.jsxs)(`button`,{className:Q(`flex aspect-square flex-col items-center justify-center gap-1.5 rounded-lg border border-transparent p-2 text-center transition-colors hover:border-border hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:[(0,X.jsx)(dve,{action:e,className:`size-6`}),(0,X.jsx)(`span`,{className:`line-clamp-2 font-medium text-xs leading-tight`,children:e.label})]},e.id))}),t[49]=r,t[50]=w,t[51]=u,t[52]=n,t[53]=f,t[54]=m,t[55]=O,t[56]=W):W=t[56];let G;t[57]!==c||t[58]!==r||t[59]!==u||t[60]!==n||t[61]!==m||t[62]!==O?(G=m===`list`&&O.length>0&&O.map((e,t)=>{let i=c.has(e.category),a=u.has(e.category);return(0,X.jsxs)(`div`,{children:[t>0&&(0,X.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,X.jsxs)(`div`,{className:Q(`sticky top-0 z-10 mb-1 flex items-center gap-2 bg-background px-3 py-2 font-medium text-muted-foreground text-xs uppercase tracking-wider`,a&&`opacity-50`),children:[(0,X.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 text-left hover:text-foreground`,onClick:()=>b(e.category),type:`button`,children:[(0,X.jsx)(Xv,{className:Q(`size-3.5 transition-transform`,!i&&`rotate-90`)}),(0,X.jsx)(uve,{group:e}),e.category]}),(0,X.jsxs)(V5,{children:[(0,X.jsx)(H5,{render:(0,X.jsx)(`button`,{className:`rounded p-0.5 hover:bg-muted hover:text-foreground`,type:`button`}),children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsx)(U5,{align:`end`,children:(0,X.jsx)(W5,{onClick:()=>S(e.category),children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Show group`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Hide group`]})})})]})]}),!i&&e.actions.map(e=>(0,X.jsx)(`button`,{className:Q(`flex w-full items-center rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[` `,`- `,e.description]})]})},e.id))]},e.category)}),t[57]=c,t[58]=r,t[59]=u,t[60]=n,t[61]=m,t[62]=O,t[63]=G):G=t[63];let K;t[64]!==H||t[65]!==U||t[66]!==W||t[67]!==G?(K=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-4`,"data-testid":`action-grid`,children:[H,U,W,G]}),t[64]=H,t[65]=U,t[66]=W,t[67]=G,t[68]=K):K=t[68];let q;return t[69]!==V||t[70]!==K?(q=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[V,K]}),t[69]=V,t[70]=K,t[71]=q):q=t[71],q}function hve(e,t){return e===`System`?-1:t===`System`?1:e.localeCompare(t)}function gve(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function Y5(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...P3}}var _ve=Y.createContext({disabled:!1});function X5(){return Y.useContext(_ve)}function Z5(e,t,n,r=!0,i){let[a,o]=Y.useState(),s=NH(i?`${i}-label`:void 0),c=e??t??a;return Mg(()=>{let i=e||t||!r?void 0:vve(n.current,s);a!==i&&o(i)}),c}function vve(e,t){let n=yve(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function yve(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var bve=Y.createContext(void 0);function xve(){return Y.useContext(bve)}var Q5=Y.createContext(void 0);function Sve(){let e=Y.useContext(Q5);if(e===void 0)throw Error(Gg(14));return e}var Cve=`data-parent`,wve=Y.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=$3(),{disabled:C,name:w,setDirty:T,setFilled:E,setFocused:D,setTouched:O,state:k,validationMode:A,validityData:j,validation:M}=L3(),N=X5(),{labelId:P,controlId:F,registerControlId:I,getDescriptionProps:L}=z3(),R=xve(),z=R?.allValues===void 0?void 0:R.parent,B=z!==void 0,V=C||N.disabled||R?.disabled||o,H=w??d,U=v??H,W=NH(),G=NH(),K=c||F;B&&(p?K=G:U===void 0?K||=G:K=`${z.id}-${U}`);let q={};B&&(p?q=z.getParentProps():U!==void 0&&(q=z.getChildProps(U)));let{checked:J=n,indeterminate:ee=l,onCheckedChange:te,...ne}=q,re=R?.value,ie=Y.useRef(null),ae=Eg(()=>Symbol()),oe=Y.useRef(!1),{getButtonProps:se,buttonRef:ce}=Xg({disabled:V,native:y}),le=R?.validation??M,[ue,de]=k3({controlled:U!==void 0&&re!==void 0&&!p?re.includes(U):J,default:i,name:`Checkbox`,state:`checked`}),fe=B?!!J:ue,pe=B&&ee||l;Mg(()=>{I!==r_&&(oe.current=!0,I(ae.current,K))},[K,I,ae]),Y.useEffect(()=>{let e=ae.current;return()=>{!oe.current||I===r_||(oe.current=!1,I(e,void 0))}},[I,ae]),R3(ie,W,ue,void 0,!R&&!V,d);let me=Y.useRef(null),he=le.registerInput,ge=R?U:void 0,_e=Y.useCallback(e=>he(e,{controlRef:ie,value:ge}),[he,ge]),ve=Qg(u,me,p?void 0:_e),ye=Z5(a,P,me,!y,K??void 0);Mg(()=>{me.current&&(me.current.indeterminate=pe,ue&&E(!0))},[ue,pe,E]),iY(ue,()=>{R||(S(H),E(ue),T(ue!==j.initialValue),le.change(ue))});let be=Fg({checked:ue,disabled:V,form:s,name:p?void 0:H,id:y?void 0:K??void 0,required:g,ref:ve,style:H?HU:VU,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=EH(oH,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(te?.(t,n),!n.isCanceled&&(de(t),U!==void 0&&R!==void 0&&!p&&!B))){let e=t?[...R.value,U]:R.value.filter(e=>e!==U);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){ie.current?.focus()}},v===void 0?a_:{value:(R?ue&&v:v)||``},L,e=>le.getValidationProps(V,e));Y.useEffect(()=>{if(!z||U===void 0)return;let e=z.disabledStatesRef.current;return e.set(U,V),()=>{e.delete(U)}},[z,V,U]);let xe=Y.useMemo(()=>({...k,checked:fe,disabled:V,readOnly:m,required:g,indeterminate:pe}),[k,fe,V,m,g,pe]),Se=Y5(xe),Ce=o_(`span`,e,{state:xe,ref:[ce,ie,t],props:[{id:y?K??void 0:W,role:`checkbox`,"aria-checked":pe?`mixed`:fe,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":ye,[Cve]:p?``:void 0,onFocus(){V||D(!0)},onBlur(){let e=me.current;e&&(O(!0),D(!1),A===`onBlur`&&le.commit(R?re:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=me.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),tg(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||gve(t)?.click()})},onClick(e){if(m||V)return;e.preventDefault();let t=me.current;t&&Yg(t,e)}},x,ne,se,L,e=>le.getValidationProps(V,e)],stateAttributesMapping:Se});return(0,X.jsxs)(Q5.Provider,{value:xe,children:[Ce,!ue&&!R&&H&&!p&&_!==void 0&&(0,X.jsx)(`input`,{type:`hidden`,form:s,name:H,value:_,disabled:V}),(0,X.jsx)(`input`,{...be,suppressHydrationWarning:!0})]})}),Tve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Sve(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=hq(c),f=Y.useRef(null),p={...s,transitionStatus:u};_q({open:c,ref:f,onComplete(){c||d(!1)}});let m={...Y5(s),...YV},h=a||l,g=o_(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function $5(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`peer inline-grid size-4 shrink-0 place-content-center rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[disabled]:cursor-not-allowed data-[checked]:border-primary data-[invalid]:border-destructive data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:opacity-50 data-[invalid]:ring-destructive/20 dark:bg-input/30 dark:data-[checked]:bg-primary dark:data-[invalid]:ring-destructive/40`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Tve,{className:`grid place-content-center text-current transition-none`,"data-slot":`checkbox-indicator`,children:(0,X.jsx)(qv,{className:`size-3.5`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(wve,{className:i,"data-slot":`checkbox`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var e7={checked(e){return e?{"data-checked":``}:{"data-unchecked":``}},...YV,...P3},Eve=`data-composite-item-active`,t7=Y.createContext(void 0);function Dve(){return Y.useContext(t7)}var n7=Y.createContext(void 0);function Ove(){let e=Y.useContext(n7);if(e===void 0)throw Error(Gg(52));return e}var kve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...p}=e,m=Dve(),{disabled:h,readOnly:g,required:_,form:v,checkedValue:y,touched:b=!1,validation:x,name:S,setCheckedValue:C=r_,setTouched:w=r_,registerInputRef:T=r_}=m??{},{setTouched:E,setFilled:D,state:O,disabled:k}=L3(),A=X5(),{labelId:j,getDescriptionProps:M}=z3(),N=k||A.disabled||h||i,P=g||a,F=_||o,I=v,L=m?y===c:c===``,R=Y.useRef(null),z=Y.useRef(null),B=x?.registerInput,V=Qg(l,z,T,Y.useCallback(e=>B?.(e,{controlRef:R,value:void 0}),[B]));Mg(()=>{z.current?.checked&&D(!0)},[D]),Mg(()=>{if(z.current){if(N&&L){T(null);return}T(z.current)}},[L,N,T]);let H=NH(),U=B3({id:d,implicit:!1,controlRef:R}),W=u?void 0:U,G={role:`radio`,"aria-checked":L,"aria-labelledby":Z5(s,j,z,!u,W),[Eve]:L?``:void 0,id:u?U:H,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||N||P)return;e.preventDefault();let t=z.current;t&&Yg(t,e)},onFocus(e){e.defaultPrevented||N||P||!b||(z.current?.click(),w(!1))}},{getButtonProps:K,buttonRef:q}=Xg({disabled:N,native:u,composite:!1}),J={type:`radio`,ref:V,form:I,id:W,name:S,tabIndex:-1,style:S?HU:VU,"aria-hidden":!0,...c===void 0?a_:{value:K3(c)},disabled:N,checked:L,required:F,readOnly:P,onChange(e){if(e.nativeEvent.defaultPrevented||N||P||c===void 0)return;let t=EH(oH,e.nativeEvent);C(c,t),!t.isCanceled&&E(!0)},onClick(e){e.stopPropagation()},onFocus(){R.current?.focus()}},ee=Y.useMemo(()=>({...O,required:F,disabled:N,readOnly:P,checked:L}),[O,N,P,L,F]),te=ee,ne=m!==void 0,re=[t,R,q],ie=[G,p,K,M,x?e=>x.getValidationProps(N,e):a_],ae=o_(`span`,e,{enabled:!ne,state:ee,ref:re,props:ie,stateAttributesMapping:e7});return(0,X.jsxs)(n7.Provider,{value:te,children:[ne?(0,X.jsx)(z5,{tag:`span`,render:n,className:r,style:f,state:ee,refs:re,props:ie,stateAttributesMapping:e7}):ae,(0,X.jsx)(`input`,{...J,suppressHydrationWarning:!0})]})}),Ave=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Ove(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=hq(c),f={...s,transitionStatus:u},p=Y.useRef(null),m=a||l,h=o_(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:e7});return _q({open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null}),jve=[];function Mve(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=jve}=e,[p,m]=Y.useState(0),h=r!=null,g=Y.useRef(null),_=Qg(g,c),v=Y.useRef([]),y=Y.useRef(!1),b=o??p,x=kg((e,t=!1)=>{if((s??m)(e),t){let t=v.current[e];kJ(g.current,t,a,n)}}),S=kg(e=>{if(e.size===0||y.current)return;y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)x(i);else if(CW(t,b,d)){let e=xW(t,{disabledIndices:d});vW(t,e)||x(e)}kJ(g.current,r,a,n)});Mg(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(CW(e,b,d)){let t=xW(e,{disabledIndices:d});vW(e,t)||x(t)}},[d,o,b,v,x]);let C=kg((e,t,n)=>i?i(e,t,n,v):n),w=kg(e=>{let o=e.key===`Home`||e.key===`End`;if(!wJ.has(e.key)||!l&&o||Nve(e,f)||!g.current)return;let s=a===`rtl`,c=s?SJ:CJ,p=s?CJ:SJ,m=n===`vertical`?xJ:c,_=n===`vertical`?bJ:p,y=mU(e.nativeEvent);if(y!=null&&OJ(y)&&!O3(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let S=b,w=yW(v,d),T=bW(v,d);r!=null&&(S=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:b,loopFocus:t,maxIndex:T,minIndex:w,onLoop:C,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?S=w:e.key===`End`&&(S=T)),S===b&&(E||D)&&(t&&S===T&&E?(S=w,i&&(S=i(e,b,S,v))):t&&S===w&&D?(S=T,i&&(S=i(e,b,S,v))):S=xW(v.current,{startingIndex:S,decrement:D,disabledIndices:d})),S!==b&&!vW(v.current,S)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),x(S,!0),queueMicrotask(()=>{v.current[S]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=mU(e.nativeEvent);!t||n==null||!OJ(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:w},highlightedIndex:b,onHighlightedIndexChange:x,elementsRef:v,onMapChange:S,relayKeyboardEvent:w}}function Nve(e,t){for(let n of EJ)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Pve(e){let{render:t,className:n,style:r,refs:i=i_,props:a=i_,state:o=a_,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Mve({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:u6(),disabledIndices:v,modifierKeys:y}),k=o_(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Y.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,X.jsx)(Kg.Provider,{value:A,children:(0,X.jsx)(c6,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}Object.keys(M3);function Fve(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var Ive=Y.createContext(void 0);function Lve(e=!1){let t=Y.useContext(Ive);if(!t&&!e)throw Error(Gg(86));return t}var Rve=[TJ],zve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:g,setFocused:_,validationMode:v,name:y,disabled:b,state:x,validation:S,setDirty:C,setFilled:w,validityData:T}=L3(),{labelId:E}=z3(),{clearErrors:D,elementRef:O}=$3(),k=Lve(!0),A=b||i,j=y??d,M=NH(p),[N,P]=k3({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[F,I]=Y.useState(!1),L=kg((e,t)=>{s?.(e,t),!t.isCanceled&&P(e)}),R=S.getInputControl,z=Y.useMemo(()=>({get current(){return R()}}),[R]),B=Y.useRef(null),V=Y.useRef(null);function H(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),B.current=e,t}let U=kg(e=>{if(!e||e.disabled)return;V.current||=e;let t=B.current,n=e.checked||t==null||t.disabled?H(e):void 0;return()=>{V.current===e&&(V.current=null),B.current===e?n?(n(),B.current=null):H(null):n?.()}}),W=kg(()=>{let e=O.current;if(!e)return N??null;for(let t of S.registeredInputs.keys())if(t.checked&&Fve(t,e))return N??null;return null});R3(z,M,N??null,W,!A,d),iY(N,()=>{D(j),C(N!==T.initialValue),w(N!=null),S.change(N);let e=V.current;N==null&&e&&!e.disabled&&H(e)});let G=E??k?.legendId,K={...x,disabled:A??!1,required:o??!1,readOnly:a??!1},q=Y.useMemo(()=>({checkedValue:N,disabled:A,form:u,validation:S,name:j,readOnly:a,registerInputRef:U,required:o,setCheckedValue:L,setTouched:I,touched:F}),[N,A,u,S,j,a,U,o,L,I,F]),J={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":A||void 0,"aria-readonly":a||void 0,"aria-labelledby":G,onFocus(){_(!0)},onBlur(e){pU(e.currentTarget,e.relatedTarget)||(g(!0),_(!1),v===`onBlur`&&S.commit(N))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(I(!0),_(!0))}};return(0,X.jsx)(t7.Provider,{value:q,children:(0,X.jsx)(Pve,{render:n,className:r,style:m,state:K,props:[J,h,e=>S.getValidationProps(A??!1,e)],refs:[t],stateAttributesMapping:P3,enableHomeAndEndKeys:!1,modifierKeys:Rve})})});function Bve(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`space-y-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(zve,{className:i,"data-slot":`radio-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Vve(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex size-4 shrink-0 items-center justify-center rounded-full border border-input bg-background outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[checked]:border-primary data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Ave,{className:`flex items-center justify-center before:size-1.5 before:rounded-full before:bg-current data-[unchecked]:hidden`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(kve,{className:i,"data-slot":`radio`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Hve(e){let t=(0,Z.c)(95),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=(0,Y.useId)(),s=(0,Y.useId)(),c=(0,Y.useId)(),l=yy(),u,d;t[0]!==l||t[1]!==n?(u=S1(n)??x1,d=oue({rules:u,catalog:l}),t[0]=l,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]);let f=d,p;t[4]===r?p=t[5]:(p=e=>{r({lifecycleRules:e})},t[4]=r,t[5]=p);let m=p,h;t[6]!==u||t[7]!==m?(h=e=>{m(k1({...u,startEvents:e}))},t[6]=u,t[7]=m,t[8]=h):h=t[8];let g=h,_;t[9]!==u||t[10]!==m?(_=e=>{m(k1({...u,cancelEvents:e}))},t[9]=u,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==u||t[13]!==m?(y=e=>{m(k1({...u,concurrency:e}))},t[12]=u,t[13]=m,t[14]=y):y=t[14];let b=y,x;t[15]!==u||t[16]!==m?(x=(e,t)=>{let n=t.trim(),r={...u.correlationPaths};n?r[e]=n:delete r[e],m({...u,correlationPaths:Object.keys(r).length>0?r:void 0})},t[15]=u,t[16]=m,t[17]=x):x=t[17];let S=x,C=l.events.length>0,w;t[18]!==l.events||t[19]!==i||t[20]!==u.startEvents||t[21]!==g||t[22]!==a?(w=(0,X.jsx)(v5,{choices:l.events,disabled:i,inputId:a,onValueChange:g,value:u.startEvents}),t[18]=l.events,t[19]=i,t[20]=u.startEvents,t[21]=g,t[22]=a,t[23]=w):w=t[23];let T;t[24]!==l||t[25]!==i||t[26]!==u||t[27]!==S||t[28]!==g?(T=u.startEvents.map(e=>(0,X.jsx)(i7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>g(u.startEvents.filter(t=>t!==e)),request:O1({rules:u,catalog:l,eventName:e,role:`start`})},e)),t[24]=l,t[25]=i,t[26]=u,t[27]=S,t[28]=g,t[29]=T):T=t[29];let E;t[30]!==a||t[31]!==C||t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(r7,{help:`A run starts when one of these Events arrives. Naming several is how one workflow answers an appointment being booked and being moved: Concurrency decides what happens to the run already going.`,hasEvents:C,inputId:a,label:`Start Events`,children:[w,T]}),t[30]=a,t[31]=C,t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]===s?D=t[36]:(D=(0,X.jsx)(wX,{id:s,children:`Concurrency`}),t[35]=s,t[36]=D);let O=u.concurrency,k;t[37]!==i||t[38]!==u.concurrency?(k=qve.map(e=>(0,X.jsxs)(`label`,{className:Q(`flex w-full cursor-pointer items-start gap-2 rounded-md border p-2 transition-colors`,u.concurrency===e.value?`border-primary bg-muted/50`:`border-input hover:bg-muted/30`,i&&`pointer-events-none opacity-50`),children:[(0,X.jsx)(Vve,{className:`mt-0.5`,value:e.value}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]})]},e.value)),t[37]=i,t[38]=u.concurrency,t[39]=k):k=t[39];let A;t[40]!==s||t[41]!==i||t[42]!==u.concurrency||t[43]!==b||t[44]!==k?(A=(0,X.jsx)(Bve,{"aria-labelledby":s,disabled:i,onValueChange:b,value:O,children:k}),t[40]=s,t[41]=i,t[42]=u.concurrency,t[43]=b,t[44]=k,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The entity is the value at the Correlation Path. A start carrying no payload uses the workflow itself, so every manual run is about the same entity.`}),t[46]=j):j=t[46];let M;t[47]!==D||t[48]!==A?(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[D,A,j]}),t[47]=D,t[48]=A,t[49]=M):M=t[49];let N=u.allowManualStart===!0,P;t[50]!==u||t[51]!==m?(P=e=>m({...u,allowManualStart:e}),t[50]=u,t[51]=m,t[52]=P):P=t[52];let F;t[53]!==i||t[54]!==c||t[55]!==N||t[56]!==P?(F=(0,X.jsx)($5,{checked:N,disabled:i,id:c,onCheckedChange:P}),t[53]=i,t[54]=c,t[55]=N,t[56]=P,t[57]=F):F=t[57];let I;t[58]===c?I=t[59]:(I=(0,X.jsx)(wX,{htmlFor:c,children:`Allow manual runs`}),t[58]=c,t[59]=I);let L;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The Run button and the execute route. With this off, only a Start Event starts a run.`}),t[60]=L):L=t[60];let R;t[61]===u.startEvents.length?R=t[62]:(R=u.startEvents.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A manual run's payload is described by nothing, so downstream nodes are offered no fields to reference. Add a Start Event to give them its payload.`}):null,t[61]=u.startEvents.length,t[62]=R);let z;t[63]!==I||t[64]!==R?(z=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[I,L,R]}),t[63]=I,t[64]=R,t[65]=z):z=t[65];let B;t[66]!==F||t[67]!==z?(B=(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,z]}),t[66]=F,t[67]=z,t[68]=B):B=t[68];let V=l.events.length>0,H;t[69]!==o||t[70]!==l.events||t[71]!==i||t[72]!==u.cancelEvents||t[73]!==v?(H=(0,X.jsx)(v5,{choices:l.events,disabled:i,inputId:o,onValueChange:v,value:u.cancelEvents}),t[69]=o,t[70]=l.events,t[71]=i,t[72]=u.cancelEvents,t[73]=v,t[74]=H):H=t[74];let U;t[75]!==l||t[76]!==i||t[77]!==u||t[78]!==v||t[79]!==S?(U=u.cancelEvents.map(e=>(0,X.jsx)(i7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>v(u.cancelEvents.filter(t=>t!==e)),request:O1({rules:u,catalog:l,eventName:e,role:`cancel`})},e)),t[75]=l,t[76]=i,t[77]=u,t[78]=v,t[79]=S,t[80]=U):U=t[80];let W;t[81]!==o||t[82]!==V||t[83]!==H||t[84]!==U?(W=(0,X.jsxs)(r7,{hasEvents:V,help:`When one of these arrives, Workflow Graph reads its Entity Value at the Correlation Path you set for it and cancels the runs already going for that entity. A canceled run leaves through the Canceled outlet.`,inputId:o,label:`Cancel Events`,children:[H,U]}),t[81]=o,t[82]=V,t[83]=H,t[84]=U,t[85]=W):W=t[85];let G;t[86]!==f.error||t[87]!==f.valid?(G=f.valid?null:(0,X.jsx)(_5,{title:`This will not save`,children:f.error}),t[86]=f.error,t[87]=f.valid,t[88]=G):G=t[88];let K;return t[89]!==E||t[90]!==M||t[91]!==B||t[92]!==W||t[93]!==G?(K=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[E,M,B,W,G]}),t[89]=E,t[90]=M,t[91]=B,t[92]=W,t[93]=G,t[94]=K):K=t[94],K}function r7(e){let t=(0,Z.c)(12),{label:n,inputId:r,hasEvents:i,help:a,children:o}=e,s;t[0]!==r||t[1]!==n?(s=(0,X.jsx)(wX,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c;t[3]!==o||t[4]!==i?(c=i?o:(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`This server declares no Events. Whoever runs it passes them to`,(0,X.jsx)(`code`,{className:`mx-1 font-mono text-xs`,children:`createWfGraphApp`}),`, and they appear here.`]}),t[3]=o,t[4]=i,t[5]=c):c=t[5];let l;t[6]===a?l=t[7]:(l=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[6]=a,t[7]=l);let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function i7(e){let t=(0,Z.c)(19),{eventName:n,label:r,request:i,catalog:a,onCommitPath:o,onRemove:s,disabled:c}=e,l=r??n,u;t[0]!==n||t[1]!==l?(u=(0,X.jsx)(`p`,{className:`min-w-0 truncate text-xs`,title:n,children:l}),t[0]=n,t[1]=l,t[2]=u):u=t[2];let d=`Remove ${n}`,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(hy,{className:`size-3.5`}),t[3]=f):f=t[3];let p;t[4]!==c||t[5]!==s||t[6]!==d?(p=(0,X.jsx)(zv,{"aria-label":d,className:`size-7 shrink-0`,disabled:c,onClick:s,size:`icon`,type:`button`,variant:`ghost`,children:f}),t[4]=c,t[5]=s,t[6]=d,t[7]=p):p=t[7];let m;t[8]!==u||t[9]!==p?(m=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[u,p]}),t[8]=u,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==a||t[12]!==c||t[13]!==o||t[14]!==i?(h=i?(0,X.jsx)(Uve,{catalog:a,disabled:c,onCommit:o,request:i}):null,t[11]=a,t[12]=c,t[13]=o,t[14]=i,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Uve(e){let t=(0,Z.c)(47),{request:n,catalog:r,disabled:i,onCommit:a}=e,o=(0,Y.useId)(),{eventName:s,declaredPath:c,suppliedPath:l}=n,u,d,f,p,m,h,g,_,v,y;if(t[0]!==r||t[1]!==c||t[2]!==i||t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==l){let e=Kve(r,s,c,l);v=`space-y-1`,t[17]!==s||t[18]!==o?(y=(0,X.jsx)(wX,{className:`sr-only`,htmlFor:o,children:s}),t[17]=s,t[18]=o,t[19]=y):y=t[19],d=B6,m=i,t[20]!==c||t[21]!==s||t[22]!==a?(h=e=>a(s,e===c||e===null?``:e),t[20]=c,t[21]=s,t[22]=a,t[23]=h):h=t[23],g=l??c??null;let n;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(H6,{}),t[24]=n):n=t[24],t[25]===o?_=t[26]:(_=(0,X.jsx)(U6,{className:`w-full`,id:o,children:n}),t[25]=o,t[26]=_),u=W6,t[27]===c?f=t[28]:(f=c?null:(0,X.jsx)(G6,{value:null,children:`Choose a path`}),t[27]=c,t[28]=f),p=e.map(Wve),t[0]=r,t[1]=c,t[2]=i,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[29]!==u||t[30]!==f||t[31]!==p?(b=(0,X.jsxs)(u,{children:[f,p]}),t[29]=u,t[30]=f,t[31]=p,t[32]=b):b=t[32];let x;t[33]!==d||t[34]!==m||t[35]!==h||t[36]!==g||t[37]!==_||t[38]!==b?(x=(0,X.jsxs)(d,{disabled:m,onValueChange:h,value:g,children:[_,b]}),t[33]=d,t[34]=m,t[35]=h,t[36]=g,t[37]=_,t[38]=b,t[39]=x):x=t[39];let S=c?`Runs are matched on this payload path. The Event declares ${c}; a path here is read instead.`:`Runs are matched on this payload path. This Event declares none, so choose the one holding the value that identifies the entity.`,C;t[40]===S?C=t[41]:(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:S}),t[40]=S,t[41]=C);let w;return t[42]!==x||t[43]!==C||t[44]!==v||t[45]!==y?(w=(0,X.jsxs)(`div`,{className:v,children:[y,x,C]}),t[42]=x,t[43]=C,t[44]=v,t[45]=y,t[46]=w):w=t[46],w}function Wve(e){return(0,X.jsx)(G6,{value:e,children:e},e)}var Gve=new Set([`string`,`number`]);function Kve(e,t,n,r){return Ya(Ka([...(Ny(e,t)?.payloadFields??[]).filter(e=>Gve.has(e.type??``)).map(e=>e.path),n,r]))}var qve=[{value:`unlimited`,label:`Unlimited`,description:`Every Event starts its own run.`},{value:`newest-wins`,label:`Newest wins`,description:`A new run for the same entity supersedes the ones already going, which end with that status.`},{value:`first-wins`,label:`First wins`,description:`A run already going for the same entity keeps it. The arriving Event is recorded as a Refused Start.`}];function Jve(e){let[t]=a8({currentNodeId:e.nodeId,nodes:e.nodes,edges:e.edges,catalog:e.catalog});if(!t)return;let n=I2(t),r=i4(n);return{conditionModel:e4(n),condition:r.valid?r.expression:``}}function Yve(){let e=(0,Z.c)(17),t=yy(),n=_A(),r=Fe(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={from:`/workflows/$workflowId`},e[0]=i):i=e[0];let a=Gi(i),o=wA(V4),s=TA(p3),c=TA(_pe),l;e[1]!==t||e[2]!==r||e[3]!==o||e[4]!==n||e[5]!==s?(l=e=>{let i=n.get(Z4),a=i.find(e=>e.id===o);if(!a)return;let c=typeof e.actionType==`string`&&!!a.data.config?.integrationId,l={...a.data.config,...e,...c?{integrationId:void 0}:{}};e.actionType===y1.condition&&!l.conditionModel&&Object.assign(l,Jve({nodeId:a.id,nodes:i,edges:n.get(Q4),catalog:t}));let u=r.getQueryData(r0().queryKey),d=u?q0(t,{...a,data:{...a.data,config:l}},u).data.config:l;s({id:a.id,data:{config:d}})},e[1]=t,e[2]=r,e[3]=o,e[4]=n,e[5]=s,e[6]=l):l=e[6];let u=l,d;e[7]===r?d=e[8]:(d=()=>o0(r),e[7]=r,e[8]=d);let f=d,p;e[9]!==c||e[10]!==a||e[11]!==r?(p=n0.workflow.deleteExecutions.mutationOptions({onSuccess:async()=>{c(),a({search:{},replace:!0}),await o0(r),Ty.success(`All runs deleted`)},meta:{errorMessage:`Failed to delete runs`}}),e[9]=c,e[10]=a,e[11]=r,e[12]=p):p=e[12];let m=Ze(p),h;return e[13]!==m||e[14]!==f||e[15]!==u?(h={updateConfig:u,refreshRuns:f,deleteRuns:m},e[13]=m,e[14]=f,e[15]=u,e[16]=h):h=e[16],h}var Xve=[`pending`,`running`,`waiting`,`completed`,`canceled`,`superseded`,`failed`],Zve=[`pending`,`running`,`waiting`];function a7(e){return Zve.some(t=>t===e)}function Qve(e){return{supersededCount:e.supersededCount,refusedStarts:e.refusedStarts.map(e=>({...e,createdAt:new Date(e.createdAt)})),executions:e.items.map(e=>({...e,startedAt:new Date(e.startedAt),waitingAt:e.waitingAt?new Date(e.waitingAt):null,cancelledAt:e.cancelledAt?new Date(e.cancelledAt):null,completedAt:e.completedAt?new Date(e.completedAt):null}))}}function $ve(e){return{logs:o7(e),waits:e.waits.map(e=>({...e,waitUntil:e.waitUntil?new Date(e.waitUntil):null})),execution:{...eye(e.execution),workflowVersionId:e.execution.workflowVersionId}}}function eye(e){return{id:e.id,workflowId:e.workflowId,status:tye(e.status),startSource:e.startSource,runMode:e.runMode,startEventName:e.startEventName,entityValue:e.entityValue,workflowRunId:null,startedAt:new Date(e.startedAt),waitingAt:null,cancelledAt:null,completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,error:e.error}}function tye(e){for(let t of Xve)if(t===e)return t;return`failed`}function nye(e){return oye(o7(e))}function rye(e){return{workflowId:e.execution.workflowId,workflowVersionId:e.execution.workflowVersionId}}function iye(e){return e.events.map(e=>({...e,createdAt:new Date(e.createdAt)}))}function o7(e){return sye(e.logs.map(e=>({id:e.id,nodeId:e.nodeId,nodeName:e.nodeName,nodeType:e.nodeType,status:e.status,startedAt:new Date(e.startedAt),completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,input:e.input,output:e.output,error:e.error})),e.execution.status)}function aye(e){return new Date(e.startedAt).getTime()}function oye(e){let t={};for(let n of e){let e=t[n.nodeId];e?.startedAt!==void 0&&aye(n)<new Date(e.startedAt).getTime()||(t[n.nodeId]={nodeId:n.nodeId,nodeName:n.nodeName,nodeType:n.nodeType,status:n.status,input:n.input,output:n.output,startedAt:n.startedAt,completedAt:n.completedAt})}return t}function sye(e,t){return t!==`canceled`&&t!==`superseded`?e:e.map(e=>e.status===`pending`||e.status===`running`?{...e,status:`cancelled`,error:e.error||`Run cancelled before step completion`}:e)}function s7(){let e=(0,Z.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={from:`/workflows/$workflowId`},e[0]=t):t=e[0];let n=Gi(t),r;return e[1]===n?r=e[2]:(r=()=>{n({search:{},replace:!0})},e[1]=n,e[2]=r),r}function c7(){let e=(0,Z.c)(3),t=s7(),n=TA(h2),r;return e[0]!==t||e[1]!==n?(r=()=>{n(`properties`),t()},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function l7(e,t){return`${e} ${t}${e===1?``:`s`} ago`}function u7(e){let t=new Date,n=new Date(e),r=Math.floor((t.getTime()-n.getTime())/1e3);if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return l7(i,`min`);let a=Math.floor(i/60);if(a<24)return l7(a,`hour`);let o=Math.floor(a/24);if(o<7)return l7(o,`day`);let s=Math.floor(o/7);if(s<4)return l7(s,`week`);let c=Math.floor(o/30);return c<12?l7(c,`month`):l7(Math.floor(o/365),`year`)}function d7(e){let t=(0,Z.c)(5),{refusedStarts:n}=e;if(n.length===0)return null;let r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Kv,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Refused Starts`})]}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=n.map(cye),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[r,(0,X.jsx)(`div`,{className:`divide-y`,children:i})]}),t[3]=i,t[4]=a),a}function cye(e){return(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-2`,children:[(0,X.jsx)(`p`,{className:`text-foreground text-xs`,children:e.message}),(0,X.jsx)(`p`,{className:`shrink-0 text-muted-foreground text-xs tabular-nums`,title:e.createdAt.toLocaleString(),children:u7(e.createdAt)})]},e.id)}var lye=jy(`workflow`,`run`),uye={pending:`muted`,running:`info`,waiting:`pending`,completed:`good`,canceled:`quiet`,superseded:`quiet`,failed:`bad`},dye={pending:`muted`,running:`info`,success:`good`,error:`bad`,cancelled:`quiet`};function f7(e){return uye[e]??dye[e]??`muted`}var fye={good:`bg-success`,bad:`bg-destructive`,info:`bg-info`,pending:`bg-warning`,quiet:`bg-cancelled`,muted:`bg-muted-foreground`},pye={pending:`Pending`,running:`Running`,waiting:`Waiting`,completed:`Completed`,canceled:`Canceled`,superseded:`Superseded`,failed:`Failed`},mye={pending:`Pending`,running:`Running`,success:`Success`,error:`Error`,cancelled:`Cancelled`},hye={good:`border-success/30 bg-success/10 text-success`,bad:`border-destructive/30 bg-destructive/10 text-destructive`,info:`border-info/30 bg-info/10 text-info`,pending:`border-warning/30 bg-warning/10 text-warning`,quiet:`border-cancelled/30 bg-cancelled/10 text-cancelled`,muted:`border-muted bg-muted/40 text-muted-foreground`};function p7(e){return fye[f7(e)]}function m7(e){return pye[e]??mye[e]??`Unknown`}function h7(e){return hye[f7(e)]}function g7(e){let t=Number.parseInt(e,10);return t<1e3?`${e}ms`:`${(t/1e3).toFixed(2)}s`}var gye=Wh(Ch({base64:yh.check(Lh(101))}));function _7(e){return gye(e)?.base64??null}function _ye(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function v7(e){let t=(0,Z.c)(4),{data:n}=e,r;t[0]===n?r=t[1]:(r=JSON.stringify(n,null,2).split(/("https?:\/\/[^"]+"|"[^"]*")/g).map(vye),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(X.Fragment,{children:r}),t[2]=r,t[3]=i),i}function vye(e){if(e.startsWith(`"`)&&e.endsWith(`"`)){let t=e.slice(1,-1);if(_ye(t))return(0,X.jsx)(`a`,{className:`text-info underline underline-offset-2 hover:text-info/80`,href:t,rel:`noopener noreferrer`,target:`_blank`,children:e},t)}return e}function yye({data:e,isError:t=!1}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(zv,{className:`h-7 px-2`,onClick:async n=>{n.stopPropagation();try{let n=t?String(e):JSON.stringify(e,null,2);await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){lye.error(`Failed to copy the run payload`,{error:e})}},size:`sm`,type:`button`,variant:`ghost`,children:n?(0,X.jsx)(qv,{className:`size-3 text-success`}):(0,X.jsx)($v,{className:`size-3`})})}function y7(e){let t=(0,Z.c)(21),{title:n,children:r,defaultExpanded:i,copyData:a,isError:o}=e,s=i!==void 0&&i,c=o!==void 0&&o,[l,u]=(0,Y.useState)(s),d;t[0]===l?d=t[1]:(d=()=>u(!l),t[0]=l,t[1]=d);let f;t[2]===l?f=t[3]:(f=l?(0,X.jsx)(Jv,{className:`size-3 text-muted-foreground`}):(0,X.jsx)(Xv,{className:`size-3 text-muted-foreground`}),t[2]=l,t[3]=f);let p;t[4]===n?p=t[5]:(p=(0,X.jsx)(`span`,{className:`font-medium text-muted-foreground text-sm`,children:n}),t[4]=n,t[5]=p);let m;t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`flex items-center gap-1.5`,onClick:d,type:`button`,children:[f,p]}),t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==c?(h=a===void 0?null:(0,X.jsx)(yye,{data:a,isError:c}),t[10]=a,t[11]=c,t[12]=h):h=t[12];let g;t[13]===h?g=t[14]:(g=(0,X.jsx)(`div`,{className:`flex items-center gap-1`,children:h}),t[13]=h,t[14]=g);let _;t[15]!==m||t[16]!==g?(_=(0,X.jsxs)(`div`,{className:`mb-2 flex w-full items-center justify-between`,children:[m,g]}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v=l?r:null,y;return t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20],y}function bye(e,t){let n=t?.integration;if(!n)return;let r=`${n}/`;if(t.id.startsWith(r))return e[n]?.outputComponents?.[t.id.slice(r.length)]}function xye(e){let t=(0,Z.c)(22),{output:n,input:r,actionType:i}=e,a=yy(),o=xy(),s;t[0]!==i||t[1]!==a||t[2]!==o?(s=i?bye(o,Py(a,i)):void 0,t[0]=i,t[1]=a,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]!==c||t[5]!==n?(l=c?null:_7(n),t[4]=c,t[5]=n,t[6]=l):l=t[6];let u=l,d;t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==n?(d=c?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(c,{input:r,output:n})}):u?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(`img`,{alt:`Step output`,className:`max-h-96 w-auto rounded`,height:384,src:`data:image/png;base64,${u}`,width:384})}):null,t[7]=c,t[8]=u,t[9]=r,t[10]=n,t[11]=d):d=t[11];let f=d,p;t[12]===n?p=t[13]:(p=(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(v7,{data:n})}),t[12]=n,t[13]=p);let m;t[14]!==n||t[15]!==p?(m=(0,X.jsx)(y7,{copyData:n,title:`Output`,children:p}),t[14]=n,t[15]=p,t[16]=m):m=t[16];let h;t[17]===f?h=t[18]:(h=f?(0,X.jsx)(y7,{defaultExpanded:!0,title:`Result`,children:f}):null,t[17]=f,t[18]=h);let g;return t[19]!==m||t[20]!==h?(g=(0,X.jsxs)(X.Fragment,{children:[m,h]}),t[19]=m,t[20]=h,t[21]=g):g=t[21],g}var b7=`grid w-full grid-cols-[1.5rem_minmax(0,1fr)_5rem] items-start gap-3 px-1 py-3 text-left`;function Sye(e){return e.type===`back`?(0,X.jsx)(`button`,{"aria-label":`Back to runs list`,className:`mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-muted`,onClick:e.onBack,type:`button`,children:(0,X.jsx)(ate,{className:`size-4 text-muted-foreground`})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`size-6 shrink-0`})}function Cye(e,t){return t.type===`cancel`?(0,X.jsx)(`div`,{className:`flex w-20 justify-end`,children:(0,X.jsxs)(zv,{className:`w-full`,disabled:t.isCanceling,onClick:()=>t.onCancel(e.id),size:`sm`,variant:`outline`,children:[t.isCanceling?(0,X.jsx)(ay,{className:`mr-1 size-3 animate-spin`}):(0,X.jsx)(Kv,{className:`mr-1 size-3`}),`Cancel`]})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`w-20 shrink-0`})}function wye(e){let t=(0,Z.c)(41),{execution:n,runNumber:r,showStartEventName:i}=e,a;t[0]===n.status?a=t[1]:(a=Q(`mt-1 size-2.5 shrink-0 rounded-full`,p7(n.status)),t[0]=n.status,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,X.jsx)(`div`,{className:a}),t[2]=a,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,X.jsxs)(`span`,{className:`font-medium text-sm`,children:[`Run #`,r]}),t[4]=r,t[5]=s);let c;t[6]===n.status?c=t[7]:(c=Q(`rounded border px-1.5 py-0.5 font-medium text-xs uppercase`,h7(n.status)),t[6]=n.status,t[7]=c);let l;t[8]===n.status?l=t[9]:(l=m7(n.status),t[8]=n.status,t[9]=l);let u;t[10]!==c||t[11]!==l?(u=(0,X.jsx)(`span`,{className:c,children:l}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;t[13]===n.runMode?d=t[14]:(d=n.runMode===`test`?(0,X.jsx)(`span`,{className:`rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 font-medium text-xs text-warning uppercase`,children:`Test Mode`}):null,t[13]=n.runMode,t[14]=d);let f;t[15]!==s||t[16]!==u||t[17]!==d?(f=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,u,d]}),t[15]=s,t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;t[19]===n.startedAt?p=t[20]:(p=u7(n.startedAt),t[19]=n.startedAt,t[20]=p);let m;t[21]===p?m=t[22]:(m=(0,X.jsx)(`span`,{children:p}),t[21]=p,t[22]=m);let h;t[23]===n.startSource?h=t[24]:(h=n.startSource?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`capitalize`,children:n.startSource})]}):null,t[23]=n.startSource,t[24]=h);let g;t[25]!==n.startEventName||t[26]!==i?(g=i&&n.startEventName?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{children:n.startEventName})]}):null,t[25]=n.startEventName,t[26]=i,t[27]=g):g=t[27];let _;t[28]===n.duration?_=t[29]:(_=n.duration?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`font-mono tabular-nums`,children:g7(n.duration)})]}):null,t[28]=n.duration,t[29]=_);let v;t[30]!==m||t[31]!==h||t[32]!==g||t[33]!==_?(v=(0,X.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-muted-foreground text-xs`,children:[m,h,g,_]}),t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v):v=t[34];let y;t[35]!==v||t[36]!==f?(y=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,v]}),t[35]=v,t[36]=f,t[37]=y):y=t[37];let b;return t[38]!==y||t[39]!==o?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[o,y]}),t[38]=y,t[39]=o,t[40]=b):b=t[40],b}function x7(e){let t=(0,Z.c)(21),{execution:n,runNumber:r,leading:i,trailing:a,onClick:o,selected:s,showStartEventName:c}=e,l=s!==void 0&&s,u=c!==void 0&&c,d;t[0]===i?d=t[1]:(d=Sye(i),t[0]=i,t[1]=d);let f;t[2]!==n||t[3]!==r||t[4]!==u?(f=(0,X.jsx)(wye,{execution:n,runNumber:r,showStartEventName:u}),t[2]=n,t[3]=r,t[4]=u,t[5]=f):f=t[5];let p;t[6]!==n||t[7]!==a?(p=Cye(n,a),t[6]=n,t[7]=a,t[8]=p):p=t[8];let m;t[9]!==d||t[10]!==f||t[11]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[d,f,p]}),t[9]=d,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h=m;if(o){let e=l&&`bg-muted/50`,n;t[13]===e?n=t[14]:(n=Q(b7,`transition-colors hover:bg-muted/50`,e),t[13]=e,t[14]=n);let r;return t[15]!==h||t[16]!==o||t[17]!==n?(r=(0,X.jsx)(`button`,{className:n,"data-testid":`workflow-run-summary-row`,onClick:o,type:`button`,children:h}),t[15]=h,t[16]=o,t[17]=n,t[18]=r):r=t[18],r}let g;return t[19]===h?g=t[20]:(g=(0,X.jsx)(`div`,{className:b7,"data-testid":`workflow-run-summary-row`,children:h}),t[19]=h,t[20]=g),g}function Tye(e){let t=(0,Z.c)(36),{log:n,isLast:r}=e,[i,a]=(0,Y.useState)(!1),o;t[0]===r?o=t[1]:(o=r?null:(0,X.jsx)(`div`,{className:`absolute top-5 bottom-0 left-2 w-px bg-border`}),t[0]=r,t[1]=o);let s;t[2]===n.status?s=t[3]:(s=Q(`size-4 rounded-full ring-2 ring-background`,p7(n.status)),t[2]=n.status,t[3]=s);let c;t[4]===s?c=t[5]:(c=(0,X.jsx)(`div`,{className:`relative z-10 mt-1.5 flex shrink-0 items-center justify-center`,children:(0,X.jsx)(`div`,{className:s})}),t[4]=s,t[5]=c);let l;t[6]===i?l=t[7]:(l=()=>a(!i),t[6]=i,t[7]=l);let u=n.nodeName||n.nodeType,d;t[8]===u?d=t[9]:(d=(0,X.jsx)(`span`,{className:`truncate font-medium text-sm transition-colors group-hover:text-foreground`,children:u}),t[8]=u,t[9]=d);let f;t[10]===n.status?f=t[11]:(f=m7(n.status),t[10]=n.status,t[11]=f);let p;t[12]===f?p=t[13]:(p=(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:f}),t[12]=f,t[13]=p);let m;t[14]===n.duration?m=t[15]:(m=n.duration?(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground text-xs tabular-nums`,children:g7(n.duration)}):null,t[14]=n.duration,t[15]=m);let h;t[16]!==d||t[17]!==p||t[18]!==m?(h=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d,p,m]}),t[16]=d,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==h||t[21]!==l?(g=(0,X.jsx)(`button`,{className:`group w-full text-left`,onClick:l,type:`button`,children:h}),t[20]=h,t[21]=l,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==n.error||t[25]!==n.input||t[26]!==n.nodeType||t[27]!==n.output?(_=i?(0,X.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[n.input!==null&&n.input!==void 0?(0,X.jsx)(y7,{copyData:n.input,title:`Input`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(v7,{data:n.input})})}):null,n.output!==null&&n.output!==void 0?(0,X.jsx)(xye,{actionType:n.nodeType,input:n.input,output:n.output}):null,n.error?(0,X.jsx)(y7,{copyData:n.error,defaultExpanded:!0,isError:!0,title:`Error`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border border-destructive/20 bg-destructive/5 p-3 font-mono text-destructive text-xs leading-relaxed`,children:n.error})}):null,n.input||n.output||n.error?null:(0,X.jsx)(`div`,{className:`rounded-lg border bg-muted/30 py-4 text-center text-muted-foreground text-xs`,children:`No data recorded`})]}):null,t[23]=i,t[24]=n.error,t[25]=n.input,t[26]=n.nodeType,t[27]=n.output,t[28]=_):_=t[28];let v;t[29]!==g||t[30]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 pb-4`,children:[g,_]}),t[29]=g,t[30]=_,t[31]=v):v=t[31];let y;return t[32]!==o||t[33]!==v||t[34]!==c?(y=(0,X.jsxs)(`div`,{className:`relative flex gap-3`,children:[o,c,v]}),t[32]=o,t[33]=v,t[34]=c,t[35]=y):y=t[35],y}function Eye(e){let t=(0,Z.c)(7),{logs:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`py-8 text-center text-muted-foreground text-xs`,children:`No steps recorded`}),t[0]=e):e=t[0],e}let r;if(t[1]!==n){let e;t[3]===n.length?e=t[4]:(e=(e,t)=>(0,X.jsx)(Tye,{isLast:t===n.length-1,log:e},e.id),t[3]=n.length,t[4]=e),r=n.map(e),t[1]=n,t[2]=r}else r=t[2];let i;return t[5]===r?i=t[6]:(i=(0,X.jsx)(`div`,{className:`pl-1`,children:r}),t[5]=r,t[6]=i),i}function Dye(e){let t=(0,Z.c)(32),{execution:n,runNumber:r,notice:i,logs:a,events:o,waits:s,isCanceling:c,isResuming:l,onBack:u,onCancel:d,onResume:f}=e,p;t[0]===a?p=t[1]:(p=a.toSorted(kye),t[0]=a,t[1]=p);let m=p,h;t[2]===u?h=t[3]:(h={onBack:u,type:`back`},t[2]=u,t[3]=h);let g;t[4]!==n.status||t[5]!==c||t[6]!==d?(g=a7(n.status)?{isCanceling:c,onCancel:d,type:`cancel`}:{type:`spacer`},t[4]=n.status,t[5]=c,t[6]=d,t[7]=g):g=t[7];let _;t[8]!==n||t[9]!==r||t[10]!==h||t[11]!==g?(_=(0,X.jsx)(x7,{execution:n,leading:h,runNumber:r,showStartEventName:!0,trailing:g}),t[8]=n,t[9]=r,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v;t[13]===i?v=t[14]:(v=i?(0,X.jsx)(`p`,{className:`rounded-md border bg-muted/30 p-2 text-muted-foreground text-xs`,children:i}):null,t[13]=i,t[14]=v);let y;if(t[15]!==l||t[16]!==f||t[17]!==s){let e;t[19]!==l||t[20]!==f?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-1.5 rounded-md border bg-muted/30 p-2`,children:[(0,X.jsxs)(`p`,{className:`font-medium text-xs`,children:[`Parked at `,e.nodeName]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.subscribedEvents.length>0?`Waiting for ${e.subscribedEvents.join(`, `)}`:`Waiting on a timer`}),e.resumeToken?(0,X.jsx)(zv,{disabled:l,onClick:()=>f(e.resumeToken??``),size:`sm`,type:`button`,variant:`outline`,children:`Resume now`}):null]},e.id),t[19]=l,t[20]=f,t[21]=e):e=t[21],y=s.map(e),t[15]=l,t[16]=f,t[17]=s,t[18]=y}else y=t[18];let b;t[22]===m?b=t[23]:(b=(0,X.jsx)(Eye,{logs:m}),t[22]=m,t[23]=b);let x;t[24]===o?x=t[25]:(x=o.length>0?(0,X.jsx)(y7,{title:`Audit Events`,children:(0,X.jsx)(`div`,{className:`space-y-2`,children:o.map(Oye)})}):null,t[24]=o,t[25]=x);let S;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==b||t[30]!==x?(S=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v,y,b,x]}),t[26]=_,t[27]=v,t[28]=y,t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Oye(e){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate font-medium text-xs`,children:e.message}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.eventType})]}),(0,X.jsx)(`div`,{className:`ml-3 shrink-0 text-xs text-muted-foreground`,children:u7(e.createdAt)})]},e.id)}function kye(e,t){return new Date(e.startedAt).getTime()-new Date(t.startedAt).getTime()}function Aye(e){let t=(0,Z.c)(10),{executions:n,selectedId:r,onSelect:i}=e,a;if(t[0]!==n||t[1]!==i||t[2]!==r){let e;t[4]!==n.length||t[5]!==i||t[6]!==r?(e=(e,t)=>{let a=r===e.id,o=n.length-t;return(0,X.jsx)(x7,{execution:e,leading:{type:`spacer`},onClick:()=>i(e.id),runNumber:o,selected:a,trailing:{type:`spacer`}},e.id)},t[4]=n.length,t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[0]=n,t[1]=i,t[2]=r,t[3]=a}else a=t[3];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`divide-y`,children:a}),t[8]=a,t[9]=o),o}var S7=2e3,C7=50,jye=`This run has left the runs list, so what it shows stops here. A newer start supersedes the runs going for the same entity, and the list holds the newest 50.`,Mye=ma(`/workflows/$workflowId`);function Nye(){let e=(0,Z.c)(80),t=wA(Z0),n=wA(D2),r=Fe(),{executionId:i}=Mye.useSearch(),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={from:`/workflows/$workflowId`},e[0]=a):a=e[0];let o=Gi(a),s=s7(),[c,l]=(0,Y.useState)(!1),u=c||i!==void 0,d;e[1]!==t||e[2]!==u?(d=n0.workflow.getExecutions.queryOptions({input:{workflowId:t??``,includeSuperseded:u},select:Qve}),e[1]=t,e[2]=u,e[3]=d):d=e[3];let f=t!==null,p;e[4]!==d||e[5]!==f?(p={...d,enabled:f,staleTime:0,refetchInterval:S7,placeholderData:L},e[4]=d,e[5]=f,e[6]=p):p=e[6];let m=Xe(p),h;e[7]===m.data?.executions?h=e[8]:(h=m.data?.executions??[],e[7]=m.data?.executions,e[8]=h);let g=h,_=m.data?.supersededCount??0,v;e[9]===m.data?.refusedStarts?v=e[10]:(v=m.data?.refusedStarts??[],e[9]=m.data?.refusedStarts,e[10]=v);let y=v,b;e[11]!==i||e[12]!==g?(b=i===void 0?-1:g.findIndex(e=>e.id===i),e[11]=i,e[12]=g,e[13]=b):b=e[13];let x=b,S=x>=0?g[x]:void 0,C=a7(S?.status)?S7:!1,w;e[14]===i?w=e[15]:(w=n0.workflow.getExecutionLogs.queryOptions({input:{executionId:i??``},select:$ve}),e[14]=i,e[15]=w);let T=i!==void 0,E;e[16]!==C||e[17]!==w||e[18]!==T?(E={...w,enabled:T,staleTime:0,refetchInterval:C},e[16]=C,e[17]=w,e[18]=T,e[19]=E):E=e[19];let D=Xe(E),O;e[20]===i?O=e[21]:(O=n0.workflow.getExecutionEvents.queryOptions({input:{executionId:i??``},select:iye}),e[20]=i,e[21]=O);let k=i!==void 0,A;e[22]!==C||e[23]!==O||e[24]!==k?(A={...O,enabled:k,staleTime:0,refetchInterval:C},e[22]=C,e[23]=O,e[24]=k,e[25]=A):A=e[25];let j=Xe(A),M;e[26]===r?M=e[27]:(M=n0.workflow.cancelExecution.mutationOptions({onSuccess:()=>o0(r),meta:{errorMessage:`Failed to cancel run`}}),e[26]=r,e[27]=M);let N=Ze(M),P;e[28]===r?P=e[29]:(P=n0.workflow.resumeWait.mutationOptions({onSuccess:()=>o0(r),meta:{errorMessage:`Failed to resume the run`}}),e[28]=r,e[29]=P);let F=Ze(P),I;e[30]===o?I=e[31]:(I=e=>{o({search:{executionId:e}})},e[30]=o,e[31]=I);let R=I;if(m.isPending&&i===void 0){let t;return e[32]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[32]=t):t=e[32],t}let z;e[33]!==c||e[34]!==_?(z=_>0?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-1 pb-2`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[_===1?`1 run was superseded by a newer start`:`${_} runs were superseded by newer starts`,_>C7?`, of which the newest ${C7} can be shown`:``]}),(0,X.jsx)(zv,{onClick:()=>l(Pye),size:`sm`,type:`button`,variant:`ghost`,children:c?`Hide`:`Show`})]}):null,e[33]=c,e[34]=_,e[35]=z):z=e[35];let B=z;if(i!==void 0){let t=S??D.data?.execution;if(!t){if(!D.isError&&(D.isPending||m.isPending)){let t;return e[36]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[36]=t):t=e[36],t}let t;e[37]===s?t=e[38]:(t=(0,X.jsx)(zv,{"aria-label":`Back to runs list`,onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:`Back`}),e[37]=s,e[38]=t);let n;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This run could not be loaded.`}),e[39]=n):n=e[39];let r;return e[40]===t?r=e[41]:(r=(0,X.jsxs)(`div`,{className:`space-y-2 px-1 py-2`,children:[t,n]}),e[40]=t,e[41]=r),r}let n=x>=0?g.length-x:0,r;e[42]===j.data?r=e[43]:(r=j.data??[],e[42]=j.data,e[43]=r);let i=N.isPending&&N.variables?.executionId===t.id,a;e[44]===D.data?.logs?a=e[45]:(a=D.data?.logs??[],e[44]=D.data?.logs,e[45]=a);let o=S?void 0:jye,c;e[46]===N?c=e[47]:(c=e=>N.mutate({executionId:e}),e[46]=N,e[47]=c);let l;e[48]===F?l=e[49]:(l=e=>F.mutate({token:e}),e[48]=F,e[49]=l);let u;e[50]===D.data?.waits?u=e[51]:(u=D.data?.waits??[],e[50]=D.data?.waits,e[51]=u);let d;return e[52]!==t||e[53]!==s||e[54]!==F.isPending||e[55]!==n||e[56]!==r||e[57]!==i||e[58]!==a||e[59]!==o||e[60]!==c||e[61]!==l||e[62]!==u?(d=(0,X.jsx)(Dye,{events:r,execution:t,isCanceling:i,isResuming:F.isPending,logs:a,notice:o,onBack:s,onCancel:c,onResume:l,runNumber:n,waits:u}),e[52]=t,e[53]=s,e[54]=F.isPending,e[55]=n,e[56]=r,e[57]=i,e[58]=a,e[59]=o,e[60]=c,e[61]=l,e[62]=u,e[63]=d):d=e[63],d}if(g.length===0){let t;e[64]===y?t=e[65]:(t=(0,X.jsx)(d7,{refusedStarts:y}),e[64]=y,e[65]=t);let n;e[66]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,X.jsx)(`div`,{className:`mb-3 rounded-lg border border-dashed p-4`,children:(0,X.jsx)(sy,{className:`size-6 text-muted-foreground`})}),(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:`No runs yet`}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground text-xs`,children:`Execute your workflow to see runs here`})]}),e[66]=n):n=e[66];let r;return e[67]!==B||e[68]!==t?(r=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,t,n]}),e[67]=B,e[68]=t,e[69]=r):r=e[69],r}let V;e[70]===y?V=e[71]:(V=(0,X.jsx)(d7,{refusedStarts:y}),e[70]=y,e[71]=V);let H;e[72]!==g||e[73]!==R||e[74]!==n?(H=(0,X.jsx)(Aye,{executions:g,onSelect:R,selectedId:n}),e[72]=g,e[73]=R,e[74]=n,e[75]=H):H=e[75];let U;return e[76]!==B||e[77]!==V||e[78]!==H?(U=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,V,H]}),e[76]=B,e[77]=V,e[78]=H,e[79]=U):U=e[79],U}function Pye(e){return!e}function w7(){let e=(0,Z.c)(3),t=wA(T2),n=TA(h2),r;return e[0]!==n||e[1]!==t?(r={validActiveTab:t,setActiveTab:n},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function Fye(){let{validActiveTab:e}=w7(),t=wA(V4),n=wA(H4);return e===`runs`?`Runs`:t?`Properties`:n?`Connection`:`Workflow`}function Iye(e){let t=(0,Z.c)(27),{placement:n,activeTab:r,onSelect:i,propertiesLabel:a,showRuns:o}=e;if(n===`bottom`){let e=`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`properties`?`text-foreground`:`text-muted-foreground`}`,n;t[0]===i?n=t[1]:(n=()=>i(`properties`),t[0]=i,t[1]=n);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(uy,{className:`size-5`}),t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==e||t[5]!==n?(c=(0,X.jsxs)(`button`,{className:e,onClick:n,type:`button`,children:[s,a]}),t[3]=a,t[4]=e,t[5]=n,t[6]=c):c=t[6];let l;t[7]!==r||t[8]!==i||t[9]!==o?(l=o?(0,X.jsxs)(`button`,{className:`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`runs`?`text-foreground`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:[(0,X.jsx)(sy,{className:`size-5`}),`Runs`]}):null,t[7]=r,t[8]=i,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==c||t[12]!==l?(u=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-around border-t bg-background pb-safe`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}let s=`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`properties`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,c;t[14]===i?c=t[15]:(c=()=>i(`properties`),t[14]=i,t[15]=c);let l;t[16]!==a||t[17]!==s||t[18]!==c?(l=(0,X.jsx)(`button`,{className:s,onClick:c,type:`button`,children:a}),t[16]=a,t[17]=s,t[18]=c,t[19]=l):l=t[19];let u;t[20]!==r||t[21]!==i||t[22]!==o?(u=o?(0,X.jsx)(`button`,{className:`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`runs`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:`Runs`}):null,t[20]=r,t[21]=i,t[22]=o,t[23]=u):u=t[23];let d;return t[24]!==l||t[25]!==u?(d=(0,X.jsx)(`div`,{className:`shrink-0 border-b px-4 py-2.5`,children:(0,X.jsxs)(`div`,{className:`inline-flex h-9 w-full items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground`,children:[l,u]})}),t[24]=l,t[25]=u,t[26]=d):d=t[26],d}function T7(e){let t=(0,Z.c)(82),{frame:n}=e,{updateConfig:r,refreshRuns:i,deleteRuns:a}=Yve(),{validActiveTab:o,setActiveTab:s}=w7(),c=wA(V4),l=wA(H4),u=wA(Z4),d=wA(Q4),f=wA(w2),p=wA(Z0),m=wA(Q0),h=TA(hde),[g,_]=EA(t2),v=wA(e2),y=TA(p3),b=TA(m3),x=TA(Y4),S=TA(Qfe),C=TA(X4),w=TA(mpe),T=TA(h3),E=c0(),[D,O]=EA(i3),k,A,j,M,N;if(t[0]!==T||t[1]!==p||t[2]!==m||t[3]!==C||t[4]!==b||t[5]!==a||t[6]!==w||t[7]!==E||t[8]!==d||t[9]!==n||t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==v||t[14]!==D||t[15]!==u||t[16]!==h||t[17]!==l||t[18]!==c||t[19]!==s||t[20]!==S||t[21]!==O||t[22]!==_||t[23]!==x||t[24]!==y||t[25]!==o||t[26]!==g){let e;t[32]===c?e=t[33]:(e=e=>e.id===c,t[32]=c,t[33]=e);let P=u.find(e),F;if(t[34]!==d||t[35]!==l){let e;t[37]===l?e=t[38]:(e=e=>e.id===l,t[37]=l,t[38]=e),F=d.find(e),t[34]=d,t[35]=l,t[36]=F}else F=t[36];let I=F,L;t[39]===u?L=t[40]:(L=u.filter(Rye),t[39]=u,t[40]=L);let R=L,z;t[41]===d?z=t[42]:(z=d.filter(Lye),t[41]=d,t[42]=z);let B=z,V=R.length+B.length>1,H;t[43]!==B.length||t[44]!==R.length?(H=[],R.length>0&&H.push(`${R.length} ${R.length===1?`step`:`steps`}`),B.length>0&&H.push(`${B.length} ${B.length===1?`connection`:`connections`}`),t[43]=B.length,t[44]=R.length,t[45]=H):H=t[45];let U=H.join(` and `),W=e=>{P&&y({id:P.id,data:{label:e}})},G=e=>{P&&y({id:P.id,data:{description:e}})},K=P&&E0(P)?z0(u).has(P.id):!1,q=!!(P&&!P.parentId&&(P.data.type===`action`||E0(P))),J=P?E0(P)?K:P.data.enabled===!1:!1,ee=()=>{if(P){if(E0(P)){S({groupId:P.id,enabled:K});return}y({id:P.id,data:{enabled:P.data.enabled===!1}})}},te;t[46]!==h||t[47]!==_?(te=async e=>{let t=await h(e);t&&_(t.message||`Failed to update workflow name`)},t[46]=h,t[47]=_,t[48]=te):te=t[48];let ne=te,re=()=>{if(!P)return;let e=P.id;n.confirm({title:`Delete Step`,message:`Are you sure you want to delete this step? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{b(e),n.dismiss?.()}})},ie;t[49]!==C||t[50]!==n||t[51]!==l?(ie=()=>{l&&n.confirm({title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{C(l),n.dismiss?.()}})},t[49]=C,t[50]=n,t[51]=l,t[52]=ie):ie=t[52];let ae=ie,oe;t[53]!==w||t[54]!==n||t[55]!==U?(oe=()=>{n.confirm({title:`Delete Selected Items`,message:`Are you sure you want to delete ${U}? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{w(),n.dismiss?.()}})},t[53]=w,t[54]=n,t[55]=U,t[56]=oe):oe=t[56];let se=oe,ce;t[57]!==p||t[58]!==a||t[59]!==n?(ce=()=>{n.confirm({title:`Delete All Runs`,message:`Are you sure you want to delete all workflow runs? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{p&&a.mutate({workflowId:p})}})},t[57]=p,t[58]=a,t[59]=n,t[60]=ce):ce=t[60];let le=ce,ue;t[61]!==T||t[62]!==n?(ue=()=>{n.confirm({title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,onConfirm:()=>T()})},t[61]=T,t[62]=n,t[63]=ue):ue=t[63];let de=ue,fe;t[64]!==p||t[65]!==m||t[66]!==E||t[67]!==n?(fe=()=>{n.confirm({title:`Delete Workflow`,message:`Are you sure you want to delete "${m}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,onConfirm:()=>{p&&E.mutate({workflowId:p},{onSuccess:()=>n.dismiss?.()})}})},t[64]=p,t[65]=m,t[66]=E,t[67]=n,t[68]=fe):fe=t[68];let pe=fe,me=P?.data.type===`action`&&!P.data.config?.actionType&&v,he;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`You are viewing a public workflow. Duplicate it to make changes.`})}),t[69]=he):he=t[69];let ge=he,_e=()=>V?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{children:`Selection`}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[U,` selected`]})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:se,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):I&&!P?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`edge-id`,children:`Connection ID`}),(0,X.jsx)(CX,{disabled:!0,id:`edge-id`,value:I.id})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`edge-source`,children:`Source`}),(0,X.jsx)(CX,{disabled:!0,id:`edge-source`,value:I.source})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`edge-target`,children:`Target`}),(0,X.jsx)(CX,{disabled:!0,id:`edge-target`,value:I.target})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:ae,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):P?me?(0,X.jsx)(`div`,{className:`px-4 pt-4`,children:(0,X.jsx)(mve,{disabled:f,isNewlyCreated:P.id===D,onSelectAction:e=>{r({actionType:e}),P.id===D&&O(null)}},P.id)}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[P.data.type===`group`?(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Lookups and a Condition in a single-entry, single-exit frame. Lookups may run side by side and join at the Condition. True continues; False with no outgoing edge ends that path.`}):null,P.data.type===`lifecycle`?(0,X.jsx)(Hve,{config:P.data.config||{},disabled:f||!v,onUpdateConfig:r}):null,P.data.type===`action`&&!P.data.config?.actionType?(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No action configured for this step.`})}):null,P.data.type===`action`&&P.data.config?.actionType?(0,X.jsx)(O_e,{config:P.data.config||{},disabled:f||!v,isOwner:v,onUpdateConfig:r},P.id):null,P.data.type!==`action`||P.data.config?.actionType?(0,X.jsxs)(`div`,{className:P.data.type===`lifecycle`?`space-y-3 rounded-md border border-muted/70 bg-muted/20 p-3`:`space-y-4`,children:[P.data.type===`lifecycle`?(0,X.jsx)(`p`,{className:`font-medium text-muted-foreground text-sm`,children:`Node Metadata`}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`label`,children:`Label`}),(0,X.jsx)(CX,{disabled:f||!v,id:`label`,onChange:e=>W(e.target.value),value:P.data.label})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`description`,children:`Description`}),(0,X.jsx)(CX,{disabled:f||!v,id:`description`,onChange:e=>G(e.target.value),placeholder:`Optional description`,value:P.data.description||``})]})]}):null,v?null:ge,v&&P.parentId?(0,X.jsx)(`p`,{className:`pt-4 text-muted-foreground text-xs`,children:`This step runs with its Group. Select the frame to switch it off.`}):null,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[q?(0,X.jsx)(zv,{onClick:ee,size:`sm`,variant:`outline`,children:J?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Disabled`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Enabled`]})}):null,N4(P)?(0,X.jsxs)(zv,{onClick:()=>x(P.id),size:`sm`,variant:`outline`,children:[(0,X.jsx)(my,{className:`mr-2 size-4`}),`Ungroup`]}):null,j4([P])?null:(0,X.jsxs)(zv,{onClick:re,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`workflow-name`,children:`Workflow Name`}),(0,X.jsx)(CX,{className:g?`border-destructive`:void 0,disabled:!v,id:`workflow-name`,onChange:e=>ne(e.target.value),value:m}),g?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:g}):null]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(wX,{htmlFor:`workflow-id`,children:`Workflow ID`}),(0,X.jsx)(CX,{disabled:!0,id:`workflow-id`,value:p||`Not saved`})]}),v?null:ge,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:de,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear`]}),(0,X.jsxs)(zv,{onClick:pe,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}),ve=P||I||V?`Properties`:`Workflow`,ye;t[70]!==n.tabs||t[71]!==v||t[72]!==s||t[73]!==ve||t[74]!==o?(ye=(0,X.jsx)(Iye,{activeTab:o,onSelect:s,placement:n.tabs,propertiesLabel:ve,showRuns:v}),t[70]=n.tabs,t[71]=v,t[72]=s,t[73]=ve,t[74]=o,t[75]=ye):ye=t[75],N=ye,k=`flex min-h-0 flex-1 flex-col`,A=`properties-panel`,j=n.tabs===`top`?N:null,M=o===`properties`?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-gutter:stable_both-edges]`,children:_e()}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:[(0,X.jsxs)(zv,{onClick:i,size:`sm`,variant:`outline`,children:[(0,X.jsx)(Dte,{className:`mr-2 size-4`}),`Refresh`]}),(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:le,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear All`]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable_both-edges]`,children:(0,X.jsx)(Nye,{})})]}),t[0]=T,t[1]=p,t[2]=m,t[3]=C,t[4]=b,t[5]=a,t[6]=w,t[7]=E,t[8]=d,t[9]=n,t[10]=i,t[11]=r,t[12]=f,t[13]=v,t[14]=D,t[15]=u,t[16]=h,t[17]=l,t[18]=c,t[19]=s,t[20]=S,t[21]=O,t[22]=_,t[23]=x,t[24]=y,t[25]=o,t[26]=g,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31];let P=n.tabs===`bottom`?N:null,F;return t[76]!==k||t[77]!==A||t[78]!==j||t[79]!==M||t[80]!==P?(F=(0,X.jsxs)(`div`,{className:k,"data-testid":A,children:[j,M,P]}),t[76]=k,t[77]=A,t[78]=j,t[79]=M,t[80]=P,t[81]=F):F=t[81],F}function Lye(e){return e.selected}function Rye(e){return e.selected}function E7(e){let t=(0,Z.c)(16),{overlayId:n}=e,{push:r,closeAll:i}=LY(),a=Fye(),o=AY(),s;t[0]!==i||t[1]!==o?(s=()=>{o||i()},t[0]=i,t[1]=o,t[2]=s):s=t[2],_Y(o,s);let c;t[3]===r?c=t[4]:(c=e=>{let{title:t,message:n,confirmLabel:i,onConfirm:a}=e;return r(SX,{title:t,message:n,confirmLabel:i,confirmVariant:`destructive`,destructive:!0,onConfirm:a})},t[3]=r,t[4]=c);let l;t[5]!==i||t[6]!==c?(l={confirm:c,dismiss:i,tabs:`bottom`},t[5]=i,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]!==n||t[9]!==a?(d=(0,X.jsx)(bX,{overlayId:n,title:a}),t[8]=n,t[9]=a,t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,X.jsx)(T7,{frame:u}),t[11]=u,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-full max-h-[80vh] flex-col`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function D7(){let e=(0,Z.c)(11),{open:t,push:n}=LY(),r=c7(),i;e[0]===r?i=e[1]:(i=()=>{kY()&&r()},e[0]=r,e[1]=i);let a=i,o;e[2]!==a||e[3]!==t?(o=()=>{t(E7,{},{onClose:a})},e[2]=a,e[3]=t,e[4]=o):o=e[4];let s=o,c;e[5]!==a||e[6]!==n?(c=()=>{n(E7,{},{onClose:a})},e[5]=a,e[6]=n,e[7]=c):c=e[7];let l=c,u;return e[8]!==s||e[9]!==l?(u={openSheet:s,pushSheet:l},e[8]=s,e[9]=l,e[10]=u):u=e[10],u}function zye(){let e=(0,Z.c)(2),t=rE(Bye),n;return e[0]===t?n=e[1]:(n=()=>{document.documentElement.style.setProperty(`--rf-zoom`,String(t))},e[0]=t,e[1]=n),_Y(t,n),null}function Bye(e){return e.transform[2]}var Vye=e=>{let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`Backspace`,`Delete`],t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=[`Meta`,`Control`,`Shift`],t[4]=a):a=t[4];let o,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(zye,{}),s=(0,X.jsx)(tk,{bgColor:`var(--sidebar)`,color:`var(--border)`,gap:24,size:2}),t[5]=o,t[6]=s):(o=t[5],s=t[6]);let c;return t[7]!==n||t[8]!==r?(c=(0,X.jsxs)(WO,{deleteKeyCode:i,fitView:!0,multiSelectionKeyCode:a,panActivationKeyCode:null,selectionOnDrag:!1,zoomOnDoubleClick:!1,zoomOnPinch:!0,...r,children:[o,s,n]}),t[7]=n,t[8]=r,t[9]=c):c=t[9],c},Hye=16,Uye=16;function O7(e){return mT({...e,borderRadius:Hye,offset:Uye})}var Wye=e=>{let t=(0,Z.c)(15),{fromX:n,fromY:r,fromPosition:i,toX:a,toY:o,toPosition:s}=e,c;t[0]!==i||t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==o?(c=O7({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:o,targetPosition:s}),t[0]=i,t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=o,t[6]=c):c=t[6];let[l]=c,u;t[7]===l?u=t[8]:(u=(0,X.jsx)(`path`,{className:`animated`,d:l,fill:`none`,stroke:`var(--color-ring)`,strokeDasharray:`5, 5`,strokeWidth:1}),t[7]=l,t[8]=u);let d;t[9]!==a||t[10]!==o?(d=(0,X.jsx)(`circle`,{cx:a,cy:o,fill:`#fff`,r:3,stroke:`var(--color-ring)`,strokeWidth:1}),t[9]=a,t[10]=o,t[11]=d):d=t[11];let f;return t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`g`,{children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14],f},Gye=d_(`flex w-fit shrink-0 items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function k7(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=Q(Gye({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,X.jsx)(`div`,{className:a,"data-orientation":r,"data-slot":`button-group`,role:`group`,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var Kye=e=>{let t=(0,Z.c)(33),{onReflow:n,canReflow:r}=e,i=r===void 0||r,{zoomIn:a,zoomOut:o,fitView:s}=RE(),[c,l]=EA(g2),u;t[0]===a?u=t[1]:(u=()=>{a()},t[0]=a,t[1]=u);let d=u,f;t[2]===o?f=t[3]:(f=()=>{o()},t[2]=o,t[3]=f);let p=f,m;t[4]===s?m=t[5]:(m=()=>{s({padding:.2,duration:300})},t[4]=s,t[5]=m);let h=m,g;t[6]!==l||t[7]!==c?(g=()=>{l(!c)},t[6]=l,t[7]=c,t[8]=g):g=t[8];let _=g,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Pte,{className:`size-4`}),t[9]=v):v=t[9];let y;t[10]===d?y=t[11]:(y=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:d,size:`icon`,title:`Zoom in`,variant:`secondary`,children:v}),t[10]=d,t[11]=y);let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(Fte,{className:`size-4`}),t[12]=b):b=t[12];let x;t[13]===p?x=t[14]:(x=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:p,size:`icon`,title:`Zoom out`,variant:`secondary`,children:b}),t[13]=p,t[14]=x);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(xte,{className:`size-4`}),t[15]=S):S=t[15];let C;t[16]===h?C=t[17]:(C=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:h,size:`icon`,title:`Fit view`,variant:`secondary`,children:S}),t[16]=h,t[17]=C);let w=c?`Hide minimap`:`Show minimap`,T;t[18]===c?T=t[19]:(T=c?(0,X.jsx)(bte,{className:`size-4`}):(0,X.jsx)(yte,{className:`size-4`}),t[18]=c,t[19]=T);let E;t[20]!==_||t[21]!==w||t[22]!==T?(E=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:_,size:`icon`,title:w,variant:`secondary`,children:T}),t[20]=_,t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==i||t[25]!==n?(D=n?(0,X.jsx)(zv,{"aria-label":`Reflow nodes`,className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:!i,onClick:n,size:`icon`,title:`Reflow nodes`,variant:`secondary`,children:(0,X.jsx)(Ete,{className:`size-4`})}):null,t[24]=i,t[25]=n,t[26]=D):D=t[26];let O;return t[27]!==C||t[28]!==E||t[29]!==D||t[30]!==y||t[31]!==x?(O=(0,X.jsxs)(k7,{orientation:`vertical`,children:[y,x,C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=y,t[31]=x,t[32]=O):O=t[32],O};function A7(e){return new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function qye(e){navigator.clipboard.writeText(e),Ty.success(`Copied to clipboard`)}function Jye(e){let t=(0,Z.c)(19),{overlayId:n,onCreated:r}=e,{pop:i}=LY(),a=Fe(),[o,s]=(0,Y.useState)(``),c;t[0]!==r||t[1]!==i||t[2]!==a?(c=n0.apiKey.create.mutationOptions({onSuccess:async e=>{r(e.key),Ty.success(`API key created successfully`),await a.invalidateQueries({queryKey:n0.apiKey.key()}),i()},meta:{errorMessage:`Failed to create API key`}}),t[0]=r,t[1]=i,t[2]=a,t[3]=c):c=t[3];let l=Ze(c),u;t[4]!==l||t[5]!==o?(u=()=>l.mutate({name:o||null}),t[4]=l,t[5]=o,t[6]=u):u=t[6];let d;t[7]!==l.isPending||t[8]!==u?(d=[{label:`Create`,onClick:u,loading:l.isPending}],t[7]=l.isPending,t[8]=u,t[9]=d):d=t[9];let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(`p`,{className:`mb-4 text-muted-foreground text-sm`,children:`Create a new API key for webhook authentication`}),t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(wX,{htmlFor:`key-name`,children:`Label (optional)`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>s(e.target.value),t[12]=m):m=t[12];let h;t[13]===o?h=t[14]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,(0,X.jsx)(CX,{id:`key-name`,onChange:m,placeholder:`e.g., Production, Testing`,value:o})]}),t[13]=o,t[14]=h);let g;return t[15]!==n||t[16]!==d||t[17]!==h?(g=(0,X.jsxs)(xX,{actions:d,overlayId:n,title:`Create API Key`,children:[f,h]}),t[15]=n,t[16]=d,t[17]=h,t[18]=g):g=t[18],g}function Yye(e){let t=(0,Z.c)(26),{overlayId:n}=e,{push:r,closeAll:i}=LY(),a=Fe(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...n0.apiKey.getAll.queryOptions({input:{}}),meta:{errorMessage:`Failed to load API keys`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,[d,f]=(0,Y.useState)(null),p;t[3]===a?p=t[4]:(p=n0.apiKey.delete.mutationOptions({onSuccess:async()=>{Ty.success(`API key deleted`),await a.invalidateQueries({queryKey:n0.apiKey.key()})},meta:{errorMessage:`Failed to delete API key`}}),t[3]=a,t[4]=p);let m=Ze(p),h=m.isPending?m.variables?.keyId:void 0,g;t[5]!==m||t[6]!==r?(g=e=>{r(SX,{title:`Delete API Key`,message:`Are you sure you want to delete this API key? Any webhooks using this key will stop working immediately.`,confirmLabel:`Delete`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>m.mutate({keyId:e})})},t[5]=m,t[6]=r,t[7]=g):g=t[7];let _=g,v;t[8]===r?v=t[9]:(v={label:`New API Key`,variant:`outline`,onClick:()=>r(Jye,{onCreated:f})},t[8]=r,t[9]=v);let y;t[10]===i?y=t[11]:(y={label:`Done`,onClick:i},t[10]=i,t[11]=y);let b;t[12]!==v||t[13]!==y?(b=[v,y],t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys for webhook authentication`}),t[15]=x):x=t[15];let S;t[16]!==u||t[17]!==h||t[18]!==c||t[19]!==d||t[20]!==_?(S=c?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[d&&(0,X.jsxs)(`div`,{className:`rounded-md border border-warning/50 bg-warning/10 p-3`,children:[(0,X.jsx)(`p`,{className:`mb-2 font-medium text-sm text-warning`,children:`Copy your API key now. You won't be able to see it again!`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 font-mono text-xs`,children:d}),(0,X.jsx)(zv,{onClick:()=>qye(d),size:`sm`,variant:`outline`,children:(0,X.jsx)($v,{className:`size-4`})})]}),(0,X.jsx)(zv,{className:`mt-2`,onClick:()=>f(null),size:`sm`,variant:`ghost`,children:`Dismiss`})]}),u.length===0?(0,X.jsxs)(`div`,{className:`py-8 text-center text-muted-foreground text-sm`,children:[(0,X.jsx)(iy,{className:`mx-auto mb-2 size-8 opacity-50`}),(0,X.jsx)(`p`,{children:`No API keys yet`}),(0,X.jsx)(`p`,{className:`text-xs`,children:`Create an API key to authenticate webhook requests`})]}):(0,X.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:[e.keyPrefix,`...`]}),e.name&&(0,X.jsx)(`span`,{className:`truncate text-sm`,children:e.name})]}),(0,X.jsxs)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:[`Created `,A7(e.createdAt),e.lastUsedAt&&` · Last used ${A7(e.lastUsedAt)}`]})]}),(0,X.jsx)(zv,{disabled:h===e.id,onClick:()=>_(e.id),size:`sm`,variant:`ghost`,children:h===e.id?(0,X.jsx)(_y,{className:`size-4`}):(0,X.jsx)(fy,{className:`size-4 text-destructive`})})]},e.id))})]}),t[16]=u,t[17]=h,t[18]=c,t[19]=d,t[20]=_,t[21]=S):S=t[21];let C;return t[22]!==n||t[23]!==S||t[24]!==b?(C=(0,X.jsxs)(xX,{actions:b,overlayId:n,title:`API Keys`,children:[x,S]}),t[22]=n,t[23]=S,t[24]=b,t[25]=C):C=t[25],C}function Xye(e){let t=(0,Z.c)(24),{filter:n}=e,r=n===void 0?``:n,i=yy(),{push:a}=LY(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...r0(),meta:{errorMessage:`Failed to load integrations`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=n0.integration.testConnection.mutationOptions({onSuccess:x3,meta:{errorMessage:`Connection test failed`}}),t[3]=d):d=t[3];let f=Ze(d),p;if(t[4]!==i||t[5]!==r||t[6]!==u){let e=r.toLowerCase(),n;t[8]===i?n=t[9]:(n=e=>{let t=Fy(i,e.type);return{...e,label:t?.label??e.type,hasTest:t?.hasTest===!0,known:t!==void 0}},t[8]=i,t[9]=n),p=u.map(n).filter(t=>!r||t.label.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)).toSorted(Zye),t[4]=i,t[5]=r,t[6]=u,t[7]=p}else p=t[7];let m=p,h;t[10]===a?h=t[11]:(h=e=>{a(C3,{integration:e})},t[10]=a,t[11]=h);let g=h,_;t[12]===a?_=t[13]:(_=e=>{a(w3,{integration:e})},t[12]=a,t[13]=_);let v=_,y=f.isPending?f.variables?.integrationId:void 0;if(c){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}),t[14]=e):e=t[14],e}let b;t[15]!==v||t[16]!==g||t[17]!==u.length||t[18]!==m||t[19]!==f||t[20]!==y?(b=()=>u.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections configured yet`})}):m.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections match your filter`})}):(0,X.jsx)(`div`,{className:`space-y-1`,children:m.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(y3,{className:`size-4`,integration:e.type}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:e.name}),e.known?null:(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Not available in this build`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.hasTest&&(0,X.jsx)(zv,{className:`h-7 px-2`,disabled:y===e.id,onClick:()=>f.mutate({integrationId:e.id}),size:`sm`,variant:`outline`,children:y===e.id?(0,X.jsx)(_y,{className:`size-3`}):(0,X.jsx)(`span`,{className:`text-xs`,children:`Test`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>g(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(oy,{className:`size-3`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>v(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(fy,{className:`size-3`})})]})]},e.id))}),t[15]=v,t[16]=g,t[17]=u.length,t[18]=m,t[19]=f,t[20]=y,t[21]=b):b=t[21];let x=b,S;return t[22]===x?S=t[23]:(S=(0,X.jsx)(`div`,{className:`space-y-1`,children:x()}),t[22]=x,t[23]=S),S}function Zye(e,t){let n=e.label.localeCompare(t.label);return n===0?e.name.localeCompare(t.name):n}function Qye(e){let t=(0,Z.c)(25),{overlayId:n}=e,{push:r,closeAll:i}=LY(),[a,o]=(0,Y.useState)(``),s;t[0]===r?s=t[1]:(s=()=>{r(Spe,{})},t[0]=r,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=()=>i(),t[2]=i,t[3]=l);let u=l,d;t[4]===c?d=t[5]:(d={label:`Add Connection`,variant:`outline`,onClick:c},t[4]=c,t[5]=d);let f;t[6]===u?f=t[7]:(f={label:`Done`,onClick:u},t[6]=u,t[7]=f);let p;t[8]!==d||t[9]!==f?(p=[d,f],t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys and credentials used by your workflows`}),t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>o(e.target.value),t[13]=g):g=t[13];let _;t[14]===a?_=t[15]:(_=(0,X.jsxs)(`div`,{className:`relative`,children:[h,(0,X.jsx)(CX,{className:`pl-9`,onChange:g,placeholder:`Filter connections...`,value:a})]}),t[14]=a,t[15]=_);let v;t[16]===a?v=t[17]:(v=(0,X.jsx)(`div`,{className:`max-h-[300px] overflow-y-auto`,children:(0,X.jsx)(Xye,{filter:a})}),t[16]=a,t[17]=v);let y;t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20];let b;return t[21]!==n||t[22]!==y||t[23]!==p?(b=(0,X.jsxs)(xX,{actions:p,overlayId:n,title:`Connections`,children:[m,y]}),t[21]=n,t[22]=y,t[23]=p,t[24]=b):b=t[24],b}var $ye=()=>{let e=(0,Z.c)(25),{theme:t,setTheme:n}=$Y(),{open:r}=LY(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(H5,{render:(0,X.jsx)(zv,{className:`h-9`,size:`sm`,variant:`outline`}),children:`Settings`}),e[0]=i):i=e[0];let a;e[1]===r?a=e[2]:(a=()=>r(Qye),e[1]=r,e[2]=a);let o,s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(wte,{className:`size-4`}),s=(0,X.jsx)(`span`,{children:`Connections`}),e[3]=o,e[4]=s):(o=e[3],s=e[4]);let c;e[5]===a?c=e[6]:(c=(0,X.jsxs)(W5,{onClick:a,children:[o,s]}),e[5]=a,e[6]=c);let l;e[7]===r?l=e[8]:(l=()=>r(Yye),e[7]=r,e[8]=l);let u,d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(iy,{className:`size-4`}),d=(0,X.jsx)(`span`,{children:`API Keys`}),e[9]=u,e[10]=d):(u=e[9],d=e[10]);let f;e[11]===l?f=e[12]:(f=(0,X.jsxs)(W5,{onClick:l,children:[u,d]}),e[11]=l,e[12]=f);let p;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(K5,{}),e[13]=p):p=e[13];let m;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsxs)(ove,{children:[(0,X.jsx)(jte,{className:`size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,X.jsx)(Ste,{className:`absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,X.jsx)(`span`,{children:`Theme`})]}),e[14]=m):m=e[14];let h,g,_;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(G5,{value:`light`,children:`Light`}),g=(0,X.jsx)(G5,{value:`dark`,children:`Dark`}),_=(0,X.jsx)(G5,{value:`system`,children:`System`}),e[15]=h,e[16]=g,e[17]=_):(h=e[15],g=e[16],_=e[17]);let v;e[18]!==n||e[19]!==t?(v=(0,X.jsxs)(ave,{children:[m,(0,X.jsx)(sve,{children:(0,X.jsxs)(ive,{onValueChange:n,value:t,children:[h,g,_]})})]}),e[18]=n,e[19]=t,e[20]=v):v=e[20];let y;return e[21]!==v||e[22]!==c||e[23]!==f?(y=(0,X.jsxs)(V5,{children:[i,(0,X.jsxs)(U5,{align:`end`,className:`w-56`,children:[c,f,p,v]})]}),e[21]=v,e[22]=c,e[23]=f,e[24]=y):y=e[24],y};function ebe(e){let t=(0,Z.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M125.776 0C120.929 1.64945e-05 117 3.9291 117 8.77539V61.4248C117 66.2711 120.929 70.2002 125.776 70.2002H160.875L161.253 70.2051C169.032 70.4023 175.301 76.6734 175.495 84.4531L175.5 84.8252V143.325C175.5 148.171 179.429 152.101 184.276 152.101H219.375L219.753 152.105C227.53 152.303 233.798 158.571 233.995 166.348L234 166.726V225.225C234 230.071 237.929 234 242.776 234H295.425C300.271 234 304.2 230.071 304.2 225.225V172.575C304.2 167.729 300.271 163.8 295.425 163.8H260.25C252.334 163.76 245.905 157.43 245.705 149.553L245.7 149.176V90.6758C245.7 85.8295 241.771 81.9004 236.925 81.9004H201.825C193.874 81.9004 187.405 75.5551 187.205 67.6523L187.2 67.2754V8.77539C187.2 3.9291 183.271 1.64951e-05 178.425 0H125.776Z`}),i=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M67.2755 81.9004C62.4293 81.9004 58.5002 85.8295 58.5002 90.6758V143.325C58.5004 148.171 62.4294 152.101 67.2755 152.101H102.375L102.753 152.105C110.53 152.303 116.798 158.571 116.995 166.348L117 166.726V225.225C117 230.071 120.929 234 125.776 234H178.425C183.271 234 187.2 230.071 187.2 225.225V172.575C187.2 167.729 183.271 163.8 178.425 163.8H143.25C135.334 163.76 128.905 157.43 128.705 149.553L128.7 149.176V90.6758C128.7 85.8295 124.771 81.9004 119.925 81.9004H67.2755Z`}),a=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M8.77454 163.8C3.92844 163.8 0.00012207 167.729 0.00012207 172.575V225.225C0.00012207 230.071 3.92844 234 8.77454 234H61.4249C66.2712 234 70.2003 230.071 70.2003 225.225V172.575C70.2003 167.729 66.2712 163.8 61.4249 163.8H8.77454Z`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,X.jsxs)(`svg`,{className:n,fill:`none`,height:`16`,viewBox:`0 0 305 234`,width:`16`,xmlns:`http://www.w3.org/2000/svg`,children:[r,i,a]}),t[3]=n,t[4]=o),o}function tbe(e){let t=new Set(e.map(e=>e.toLowerCase())),n=`New Workflow`;if(!t.has(`new workflow`))return n;let r=2;for(;t.has(`${n} (${r})`.toLowerCase());)r+=1;return`${n} (${r})`}function j7(e){let t=(0,Z.c)(50),{open:n,onOpenChange:r,existingWorkflowNames:i,onCreated:a}=e,o;t[0]===i?o=t[1]:(o=()=>tbe(i),t[0]=i,t[1]=o);let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(null),d=Fe(),f;if(t[2]!==a||t[3]!==r||t[4]!==d){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{u(e instanceof Y1?e.message:`Failed to create workflow`)},t[6]=e):e=t[6],f=n0.workflow.create.mutationOptions({onSuccess:async e=>{await i0(d),await a(e.id),r(!1),Ty.success(`Workflow created`)},onError:e,meta:{errorShownByCaller:!0}}),t[2]=a,t[3]=r,t[4]=d,t[5]=f}else f=t[5];let p=Ze(f),m=p.isPending,h;t[7]!==p||t[8]!==s?(h=()=>{let e=s.trim();if(!e){u(`Workflow name is required.`);return}u(null),p.mutate({name:e,graph:z1({nodes:[],edges:[]})})},t[7]=p,t[8]=s,t[9]=h):h=t[9];let g=h,_;t[10]!==m||t[11]!==r?(_=e=>{e||m||r(!1)},t[10]=m,t[11]=r,t[12]=_):_=t[12];let v=_,y=!m,b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(dY,{children:[(0,X.jsx)(pY,{children:`Create Workflow`}),(0,X.jsx)(mY,{children:`Choose a name for the new workflow.`})]}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(wX,{htmlFor:`create-workflow-name`,children:`Name`}),t[14]=x):x=t[14];let S=l?!0:void 0,C;t[15]===l?C=t[16]:(C=e=>{c(e.target.value),l&&u(null)},t[15]=l,t[16]=C);let w;t[17]===g?w=t[18]:(w=e=>{e.key===`Enter`&&(e.preventDefault(),g())},t[17]=g,t[18]=w);let T;t[19]!==m||t[20]!==w||t[21]!==S||t[22]!==C||t[23]!==s?(T=(0,X.jsx)(CX,{"aria-invalid":S,autoFocus:!0,disabled:m,id:`create-workflow-name`,onChange:C,onKeyDown:w,placeholder:`Workflow name`,value:s}),t[19]=m,t[20]=w,t[21]=S,t[22]=C,t[23]=s,t[24]=T):T=t[24];let E;t[25]===l?E=t[26]:(E=l?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:l}):null,t[25]=l,t[26]=E);let D;t[27]!==T||t[28]!==E?(D=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[x,T,E]}),t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===r?O=t[31]:(O=()=>{r(!1)},t[30]=r,t[31]=O);let k;t[32]!==m||t[33]!==O?(k=(0,X.jsx)(zv,{disabled:m,onClick:O,type:`button`,variant:`outline`,children:`Cancel`}),t[32]=m,t[33]=O,t[34]=k):k=t[34];let A=m?`Creating...`:`Create Workflow`,j;t[35]!==g||t[36]!==m||t[37]!==A?(j=(0,X.jsx)(zv,{disabled:m,onClick:g,type:`button`,children:A}),t[35]=g,t[36]=m,t[37]=A,t[38]=j):j=t[38];let M;t[39]!==k||t[40]!==j?(M=(0,X.jsxs)(fY,{children:[k,j]}),t[39]=k,t[40]=j,t[41]=M):M=t[41];let N;t[42]!==D||t[43]!==M||t[44]!==y?(N=(0,X.jsxs)(uY,{showCloseButton:y,children:[b,D,M]}),t[42]=D,t[43]=M,t[44]=y,t[45]=N):N=t[45];let P;return t[46]!==v||t[47]!==n||t[48]!==N?(P=(0,X.jsx)(sY,{onOpenChange:v,open:n,children:N}),t[46]=v,t[47]=n,t[48]=N,t[49]=P):P=t[49],P}function nbe(e){let t=(0,Z.c)(10),{isPublishing:n,disabled:r,handlePublish:i}=e,a=r||n,o=n?`Publishing...`:`Publish workflow`,s;t[0]===n?s=t[1]:(s=n?(0,X.jsx)(ay,{className:`size-4 animate-spin`,"data-icon":`inline-start`}):(0,X.jsx)(Nte,{className:`size-4`,"data-icon":`inline-start`}),t[0]=n,t[1]=s);let c=n?`Publishing`:`Publish`,l;t[2]===c?l=t[3]:(l=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:c}),t[2]=c,t[3]=l);let u;return t[4]!==i||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==l?(u=(0,X.jsxs)(zv,{className:`relative gap-1.5`,disabled:a,onClick:i,size:`default`,title:o,variant:`default`,children:[s,l]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s,t[8]=l,t[9]=u):u=t[9],u}function rbe(e){let t=(0,Z.c)(9),{state:n,handleSave:r}=e,i;t[0]===n.nodes?i=t[1]:(i=n.nodes.some(ibe),t[0]=n.nodes,t[1]=i);let a=!i||n.isGenerating||n.isSaving,o=n.isSaving?`Saving...`:`Save workflow`,s;t[2]===n.isSaving?s=t[3]:(s=n.isSaving?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(Ote,{className:`size-4`}),t[2]=n.isSaving,t[3]=s);let c;return t[4]!==r||t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,X.jsx)(zv,{className:`relative border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:a,onClick:r,size:`icon`,title:o,variant:`secondary`,children:s}),t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function ibe(e){return e.type!==`add`}function abe(e){let t=(0,Z.c)(8),{state:n,actions:r}=e,i=n.isExecuting||n.nodes.length===0||n.isGenerating||!n.currentWorkflowId,a;t[0]===r?a=t[1]:(a=()=>r.handleExecute(),t[0]=r,t[1]=a);let o;t[2]===n.isExecuting?o=t[3]:(o=n.isExecuting?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(sy,{className:`size-4`}),t[2]=n.isExecuting,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,X.jsx)(k7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:i,onClick:a,size:`icon`,title:`Run Workflow`,variant:`secondary`,children:o})}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function obe(e){let t=(0,Z.c)(6),{isDuplicating:n,onDuplicate:r}=e,i;t[0]===n?i=t[1]:(i=n?(0,X.jsx)(ay,{className:`mr-2 size-4 animate-spin`}):(0,X.jsx)($v,{className:`mr-2 size-4`}),t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==r||t[4]!==i?(a=(0,X.jsxs)(zv,{className:`h-9 border hover:bg-secondary dark:hover:bg-secondary`,disabled:n,onClick:r,size:`sm`,title:`Duplicate to your workflows`,variant:`secondary`,children:[i,`Duplicate`]}),t[2]=n,t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function sbe(e){let t=(0,Z.c)(79),{workflowId:n,state:r,actions:i}=e,{push:a}=LY(),{openSheet:o}=D7(),[s]=EA(V4),[c]=EA(H4),l=wA(Z4),u=wA(Q4),d=TA(m3),f=TA(X4),{screenToFlowPosition:p}=RE(),m=AY(),h=wA(t3),g;if(t[0]!==l||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>e.id===s,t[3]=s,t[4]=e),g=l.find(e),t[0]=l,t[1]=s,t[2]=g}else g=t[2];let _=g,v;if(t[5]!==u||t[6]!==c){let e;t[8]===c?e=t[9]:(e=e=>e.id===c,t[8]=c,t[9]=e),v=u.find(e),t[5]=u,t[6]=c,t[7]=v}else v=t[7];let y=_||v,b;t[10]!==h||t[11]!==r?(b=h||r.isSaving||!r.nodes.some(cbe),t[10]=h,t[11]=r,t[12]=b):b=t[12];let x=b;if(n&&!r.isOwner)return null;let S;t[13]!==f||t[14]!==d||t[15]!==a||t[16]!==c||t[17]!==s?(S=()=>{let e=s?`Node`:`Connection`;a(SX,{title:`Delete ${e}`,message:`Are you sure you want to delete this ${e.toLowerCase()}? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s?d(s):c&&f(c)}})},t[13]=f,t[14]=d,t[15]=a,t[16]=c,t[17]=s,t[18]=S):S=t[18];let C=S,w;t[19]!==p||t[20]!==r?(w=()=>{let e=document.querySelector(`.react-flow`);if(!e)return;let t=e.getBoundingClientRect(),n=t.left+t.width/2,i=t.top+t.height/2,a=p({x:n,y:i});a.x-=96,a.y-=56;let o={...a},s=!0,c=0;for(;s&&c<20;)s=r.nodes.some(e=>Math.abs(e.position.x-o.x)<192&&Math.abs(e.position.y-o.y)<112),s&&(o.x+=20,o.y+=20,c+=1);let l={id:l0(),type:`action`,position:o,data:{label:``,description:``,type:`action`,config:{},status:`idle`}};r.addNode(l),r.setSelectedNodeId(l.id),r.setActiveTab(`properties`)},t[19]=p,t[20]=r,t[21]=w):w=t[21];let T=w,E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(cy,{className:`size-4`}),t[22]=E):E=t[22];let D;t[23]!==T||t[24]!==r.isGenerating?(D=(0,X.jsx)(k7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:r.isGenerating,onClick:T,size:`icon`,title:`Add Step`,variant:`secondary`,children:E})}),t[23]=T,t[24]=r.isGenerating,t[25]=D):D=t[25];let O=m?``:`hidden`,k;t[26]===O?k=t[27]:(k=Q(`flex`,O),t[26]=O,t[27]=k);let A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(uy,{className:`size-4`}),t[28]=A):A=t[28];let j;t[29]===o?j=t[30]:(j=(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:o,size:`icon`,title:`Configuration`,variant:`secondary`,children:A}),t[29]=o,t[30]=j);let M;t[31]!==C||t[32]!==y?(M=y&&(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:C,size:`icon`,title:`Delete`,variant:`secondary`,children:(0,X.jsx)(fy,{className:`size-4`})}),t[31]=C,t[32]=y,t[33]=M):M=t[33];let N;t[34]!==j||t[35]!==M||t[36]!==k?(N=(0,X.jsxs)(k7,{className:k,orientation:`horizontal`,children:[j,M]}),t[34]=j,t[35]=M,t[36]=k,t[37]=N):N=t[37];let P=!r.canUndo||r.isGenerating,F;t[38]===r?F=t[39]:(F=()=>r.undo(),t[38]=r,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(Mte,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==P||t[42]!==F?(L=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:P,onClick:F,size:`icon`,title:`Undo`,variant:`secondary`,children:I}),t[41]=P,t[42]=F,t[43]=L):L=t[43];let R=!r.canRedo||r.isGenerating,z;t[44]===r?z=t[45]:(z=()=>r.redo(),t[44]=r,t[45]=z);let B;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(Tte,{className:`size-4`}),t[46]=B):B=t[46];let V;t[47]!==R||t[48]!==z?(V=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:R,onClick:z,size:`icon`,title:`Redo`,variant:`secondary`,children:B}),t[47]=R,t[48]=z,t[49]=V):V=t[49];let H;t[50]!==L||t[51]!==V?(H=(0,X.jsxs)(k7,{className:`flex`,orientation:`horizontal`,children:[L,V]}),t[50]=L,t[51]=V,t[52]=H):H=t[52];let U;t[53]!==i.handleSave||t[54]!==r?(U=(0,X.jsx)(rbe,{handleSave:i.handleSave,state:r}),t[53]=i.handleSave,t[54]=r,t[55]=U):U=t[55];let W;t[56]!==i.handlePublish||t[57]!==i.isPublishing||t[58]!==x?(W=(0,X.jsx)(nbe,{disabled:x,handlePublish:i.handlePublish,isPublishing:i.isPublishing}),t[56]=i.handlePublish,t[57]=i.isPublishing,t[58]=x,t[59]=W):W=t[59];let G;t[60]!==U||t[61]!==W?(G=(0,X.jsxs)(k7,{className:`flex`,orientation:`horizontal`,children:[U,W]}),t[60]=U,t[61]=W,t[62]=G):G=t[62];let K;t[63]!==i||t[64]!==r?(K=(0,X.jsx)(abe,{actions:i,state:r}),t[63]=i,t[64]=r,t[65]=K):K=t[65];let q;t[66]!==i||t[67]!==r.isGenerating||t[68]!==r.isSaving||t[69]!==r.workflowMode||t[70]!==n?(q=n&&(0,X.jsx)(k7,{"aria-label":`Workflow mode`,className:`flex`,orientation:`horizontal`,role:`radiogroup`,children:[`live`,`test`].map(e=>{let t=r.workflowMode===e;return(0,X.jsx)(zv,{"aria-checked":t,className:`border`,disabled:r.isSaving||r.isGenerating,onClick:()=>i.handleSetWorkflowMode(e),role:`radio`,size:`default`,variant:t?`default`:`outline`,children:e===`live`?`Live`:`Test`},e)})}),t[66]=i,t[67]=r.isGenerating,t[68]=r.isSaving,t[69]=r.workflowMode,t[70]=n,t[71]=q):q=t[71];let J;return t[72]!==N||t[73]!==H||t[74]!==G||t[75]!==K||t[76]!==q||t[77]!==D?(J=(0,X.jsxs)(X.Fragment,{children:[D,N,H,G,K,q]}),t[72]=N,t[73]=H,t[74]=G,t[75]=K,t[76]=q,t[77]=D,t[78]=J):J=t[78],J}function cbe(e){return e.type!==`add`}function lbe(e){let t=(0,Z.c)(52),{workflowId:n,state:r,actions:i}=e,a=Gi(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(0),u;t[0]===a?u=t[1]:(u=()=>a({to:`/`}),t[0]=a,t[1]=u);let d,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(ebe,{className:`size-4 shrink-0`}),f=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:`Dashboard`}),t[2]=d,t[3]=f):(d=t[2],f=t[3]);let p;t[4]===u?p=t[5]:(p=(0,X.jsxs)(`button`,{className:`flex h-full shrink-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,onClick:u,type:`button`,children:[d,f]}),t[4]=u,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/60`,children:`/`}),t[6]=m):m=t[6];let h;t[7]===i?h=t[8]:(h=e=>e&&i.loadWorkflows(),t[7]=i,t[8]=h);let g=r.workflowName||`Untitled workflow`,_;t[9]===g?_=t[10]:(_=(0,X.jsx)(`p`,{className:`truncate font-medium text-sm`,children:g}),t[9]=g,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Jv,{className:`size-3 shrink-0 opacity-50`}),t[11]=v):v=t[11];let y;t[12]===_?y=t[13]:(y=(0,X.jsxs)(H5,{className:`flex h-full min-w-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,children:[_,v]}),t[12]=_,t[13]=y);let b,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(W5,{className:`flex items-center gap-2`,onClick:()=>{l(fbe),s(!0)},children:[(0,X.jsx)(cy,{className:`size-4`}),`New Workflow...`]}),x=(0,X.jsx)(K5,{}),t[14]=b,t[15]=x):(b=t[14],x=t[15]);let S;t[16]!==a||t[17]!==r.allWorkflows||t[18]!==r.currentWorkflowId?(S=r.allWorkflows.length===0?(0,X.jsx)(W5,{disabled:!0,children:`No workflows found`}):r.allWorkflows.filter(dbe).map(e=>(0,X.jsxs)(W5,{className:`flex items-center justify-between`,onClick:()=>a({to:`/workflows/$workflowId`,params:{workflowId:e.id}}),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),e.id===r.currentWorkflowId&&(0,X.jsx)(qv,{className:`size-4 shrink-0`})]},e.id)),t[16]=a,t[17]=r.allWorkflows,t[18]=r.currentWorkflowId,t[19]=S):S=t[19];let C;t[20]!==i||t[21]!==r.isOwner||t[22]!==n?(C=n&&r.isOwner&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(K5,{}),(0,X.jsxs)(W5,{className:`flex items-center gap-2`,disabled:i.isDuplicating,onClick:i.handleDuplicate,children:[i.isDuplicating?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)($v,{className:`size-4`}),`Duplicate`]}),(0,X.jsxs)(W5,{className:`flex items-center gap-2 text-destructive focus:text-destructive`,onClick:i.handleDeleteWorkflow,children:[(0,X.jsx)(fy,{className:`size-4`}),`Delete Workflow`]})]}),t[20]=i,t[21]=r.isOwner,t[22]=n,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C?(w=(0,X.jsxs)(U5,{align:`start`,className:`w-64`,children:[b,x,S,C]}),t[24]=S,t[25]=C,t[26]=w):w=t[26];let T;t[27]!==y||t[28]!==w||t[29]!==h?(T=(0,X.jsxs)(V5,{onOpenChange:h,children:[y,w]}),t[27]=y,t[28]=w,t[29]=h,t[30]=T):T=t[30];let E;t[31]!==T||t[32]!==p?(E=(0,X.jsxs)(`div`,{className:`flex h-9 max-w-[260px] items-center overflow-hidden rounded-md border bg-secondary text-secondary-foreground sm:max-w-none`,children:[p,m,T]}),t[31]=T,t[32]=p,t[33]=E):E=t[33];let D;t[34]!==r.isOwner||t[35]!==n?(D=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs @xl:hidden`,children:`Read-only`}),t[34]=r.isOwner,t[35]=n,t[36]=D):D=t[36];let O;t[37]!==E||t[38]!==D?(O=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[E,D]}),t[37]=E,t[38]=D,t[39]=O):O=t[39];let k;t[40]===r.allWorkflows?k=t[41]:(k=r.allWorkflows.map(ube),t[40]=r.allWorkflows,t[41]=k);let A;t[42]===a?A=t[43]:(A=e=>a({to:`/workflows/$workflowId`,params:{workflowId:e}}),t[42]=a,t[43]=A);let j;t[44]!==c||t[45]!==o||t[46]!==k||t[47]!==A?(j=(0,X.jsx)(j7,{existingWorkflowNames:k,onCreated:A,onOpenChange:s,open:o},c),t[44]=c,t[45]=o,t[46]=k,t[47]=A,t[48]=j):j=t[48];let M;return t[49]!==O||t[50]!==j?(M=(0,X.jsxs)(X.Fragment,{children:[O,j]}),t[49]=O,t[50]=j,t[51]=M):M=t[51],M}function ube(e){return e.name}function dbe(e){return e.name!==`__current__`}function fbe(e){return e+1}function pbe(e,t){if(!t)return;let n=t.trim();if(!n)return;let r=Ka(n.split(`.`)),i=e;for(let e of r){if(i==null)return;if(Array.isArray(i)){if(!/^\d+$/.test(e))return;let t=Number(e);if(!Number.isSafeInteger(t))return;i=i[t];continue}if(typeof i==`object`){i=i[e];continue}return}return i}function mbe(e,t,n){let r=Ka(t.trim().split(`.`)),i=r.pop();if(!i)return e;let a=e;for(let e of r){let t=a[e],n=typeof t==`object`&&t&&!Array.isArray(t)?t:{};a[e]=n,a=n}return a[i]=n,e}function hbe(e){return!e.path.includes(`[`)&&e.type!==`array`&&e.type!==`object`}function gbe(e){return e.enumValues&&e.enumValues.length>0?`select`:e.type===`boolean`?`checkbox`:e.type===`number`?`number`:e.type===`timestamp`?`datetime`:`text`}function M7(e){return e?e.payloadFields.filter(hbe).map(e=>({path:e.path,...e.description?{description:e.description}:{},control:gbe(e),...e.enumValues?{options:[...e.enumValues]}:{},optional:e.nullable===!0})):[]}function _be(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function N7(e,t){let n={};for(let r of e){let e=pbe(t,r.path);if(e==null){n[r.path]=``;continue}let i=typeof e==`string`?e:JSON.stringify(e);n[r.path]=r.control===`datetime`?_be(i):i}return n}function vbe(e,t){let n=t.trim();if(n){if(e.control===`checkbox`)return n===`true`;if(e.control===`number`){let e=Number(n);return Number.isFinite(e)?e:n}if(e.control===`datetime`){let e=new Date(n);return Number.isNaN(e.getTime())?n:Wde(e)}return n}}function ybe(e,t,n={}){let r=structuredClone(n);for(let n of e){let e=vbe(n,t[n.path]??``);e!==void 0&&mbe(r,n.path,e)}return r}function P7(e){let t=e.trim();if(!t)return{ok:!0,payload:{}};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:`This is not valid JSON.`}}let r=uue(n);return r?{ok:!0,payload:r}:{ok:!1,error:`A payload has to be a JSON object.`}}function F7(e){return e.find(e=>e.data.type===`lifecycle`)}function bbe(e){return S1(F7(e)?.data.config)}function I7(e){return fue(F7(e)?.data.config)??{}}function xbe(e,t){return t.eventName?{...e,byEvent:{...e.byEvent,[t.eventName]:t.input}}:{...e,manual:t.input}}var L7=``;function Sbe(e,t){return Ny(e,t)?.label??t}function Cbe(e){let t=(0,Z.c)(29),{field:n,value:r,onChange:i}=e;if(n.control===`checkbox`){let e=r===`true`,a;t[0]===i?a=t[1]:(a=e=>i(e?`true`:`false`),t[0]=i,t[1]=a);let o;return t[2]!==n.path||t[3]!==e||t[4]!==a?(o=(0,X.jsx)($5,{checked:e,id:n.path,onCheckedChange:a}),t[2]=n.path,t[3]=e,t[4]=a,t[5]=o):o=t[5],o}if(n.control===`select`){let e;t[6]===i?e=t[7]:(e=V6(i),t[6]=i,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(H6,{placeholder:`Choose a value`}),t[8]=a):a=t[8];let o;t[9]===n.path?o=t[10]:(o=(0,X.jsx)(U6,{className:`w-full`,id:n.path,children:a}),t[9]=n.path,t[10]=o);let s;t[11]===n.options?s=t[12]:(s=n.options??[],t[11]=n.options,t[12]=s);let c;t[13]===s?c=t[14]:(c=s.map(wbe),t[13]=s,t[14]=c);let l;t[15]===c?l=t[16]:(l=(0,X.jsx)(W6,{children:c}),t[15]=c,t[16]=l);let u;return t[17]!==e||t[18]!==o||t[19]!==l||t[20]!==r?(u=(0,X.jsxs)(B6,{onValueChange:e,value:r,children:[o,l]}),t[17]=e,t[18]=o,t[19]=l,t[20]=r,t[21]=u):u=t[21],u}let a;t[22]===i?a=t[23]:(a=e=>i(e.target.value),t[22]=i,t[23]=a);let o=n.control===`number`?`number`:n.control===`datetime`?`datetime-local`:`text`,s;return t[24]!==n.path||t[25]!==a||t[26]!==o||t[27]!==r?(s=(0,X.jsx)(CX,{id:n.path,onChange:a,type:o,value:r}),t[24]=n.path,t[25]=a,t[26]=o,t[27]=r,t[28]=s):s=t[28],s}function wbe(e){return(0,X.jsx)(G6,{value:e,children:e},e)}function Tbe(e){let t=(0,Z.c)(10),{fields:n,values:r,onChange:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This Event declares no payload field the form can draw. Use the JSON tab to write the payload.`}),t[0]=e):e=t[0],e}let a;if(t[1]!==n||t[2]!==i||t[3]!==r){let e;t[5]!==i||t[6]!==r?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(wX,{className:`font-mono text-xs`,htmlFor:e.path,children:[e.path,e.optional&&(0,X.jsx)(`span`,{className:`ml-2 font-sans text-muted-foreground`,children:`optional`})]}),(0,X.jsx)(Cbe,{field:e,onChange:t=>i(e.path,t),value:r[e.path]??``}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]},e.path),t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[1]=n,t[2]=i,t[3]=r,t[4]=a}else a=t[4];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`space-y-4`,children:a}),t[8]=a,t[9]=o),o}function Ebe(e){let t=(0,Z.c)(92),{overlayId:n,startEvents:r,allowManualStart:i,hasEventSplit:a,savedPayloads:o,onRun:s}=e,c=yy(),{closeAll:l}=LY(),[u,d]=(0,Y.useState)(r[0]??L7),[f,p]=(0,Y.useState)(`form`),m=u===L7?void 0:u,h;t[0]!==m||t[1]!==o?(h=M1(o,m),t[0]=m,t[1]=o,t[2]=h):h=t[2];let g=h,_;t[3]!==c||t[4]!==m?(_=M7(m?Ny(c,m):void 0),t[3]=c,t[4]=m,t[5]=_):_=t[5];let v=_,y;t[6]!==v||t[7]!==g?(y=()=>N7(v,g),t[6]=v,t[7]=g,t[8]=y):y=t[8];let[b,x]=(0,Y.useState)(y),S;t[9]===g?S=t[10]:(S=()=>JSON.stringify(g??{},null,2),t[9]=g,t[10]=S);let[C,w]=(0,Y.useState)(S),[T,E]=(0,Y.useState)(null),D;t[11]===g?D=t[12]:(D=()=>g??{},t[11]=g,t[12]=D);let[O,k]=(0,Y.useState)(D),A;t[13]!==c||t[14]!==o?(A=e=>{d(e);let t=e===L7?void 0:e,n=M1(o,t)??{},r=M7(t?Ny(c,t):void 0);x(N7(r,n)),w(JSON.stringify(n,null,2)),k(n),E(null)},t[13]=c,t[14]=o,t[15]=A):A=t[15];let j=A,M;t[16]!==O||t[17]!==v||t[18]!==b?(M=()=>ybe(v,b,O),t[16]=O,t[17]=v,t[18]=b,t[19]=M):M=t[19];let N=M,P;t[20]===N?P=t[21]:(P=()=>{w(JSON.stringify(N(),null,2)),E(null),p(`json`)},t[20]=N,t[21]=P);let F=P,I;t[22]!==v||t[23]!==C?(I=()=>{let e=P7(C);if(!e.ok){E(e.error);return}x(N7(v,e.payload)),k(e.payload),E(null),p(`form`)},t[22]=v,t[23]=C,t[24]=I):I=t[24];let L=I,R=!a||m!==void 0,z;t[25]!==l||t[26]!==N||t[27]!==m||t[28]!==C||t[29]!==s||t[30]!==f?(z=()=>{if(f===`json`){let e=P7(C);if(!e.ok){E(e.error);return}s({...m?{eventName:m}:{},input:e.payload}),l();return}s({...m?{eventName:m}:{},input:N()}),l()},t[25]=l,t[26]=N,t[27]=m,t[28]=C,t[29]=s,t[30]=f,t[31]=z):z=t[31];let B=z,V;t[32]===l?V=t[33]:(V={label:`Cancel`,variant:`outline`,onClick:l},t[32]=l,t[33]=V);let H=!R,U;t[34]!==B||t[35]!==H?(U={label:`Run`,onClick:B,disabled:H},t[34]=B,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==V||t[38]!==U?(W=[V,U],t[37]=V,t[38]=U,t[39]=W):W=t[39];let G;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,X.jsx)(wX,{htmlFor:`testRunEvent`,children:`Which Event does this run stand in for?`}),t[40]=G):G=t[40];let K;t[41]===j?K=t[42]:(K=V6(j),t[41]=j,t[42]=K);let q;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(U6,{className:`w-full`,id:`testRunEvent`,children:(0,X.jsx)(H6,{placeholder:`Choose an Event`})}),t[43]=q):q=t[43];let J;if(t[44]!==c||t[45]!==r){let e;t[47]===c?e=t[48]:(e=e=>(0,X.jsx)(G6,{value:e,children:Sbe(c,e)},e),t[47]=c,t[48]=e),J=r.map(e),t[44]=c,t[45]=r,t[46]=J}else J=t[46];let ee;t[49]!==i||t[50]!==a?(ee=i&&(0,X.jsx)(G6,{disabled:a,value:L7,children:`No Event (manual start)`}),t[49]=i,t[50]=a,t[51]=ee):ee=t[51];let te;t[52]!==J||t[53]!==ee?(te=(0,X.jsxs)(W6,{children:[J,ee]}),t[52]=J,t[53]=ee,t[54]=te):te=t[54];let ne;t[55]!==u||t[56]!==K||t[57]!==te?(ne=(0,X.jsxs)(B6,{onValueChange:K,value:u,children:[q,te]}),t[55]=u,t[56]=K,t[57]=te,t[58]=ne):ne=t[58];let re;t[59]===a?re=t[60]:(re=a&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This workflow splits on the Event a run is on, so a run has to name one.`}),t[59]=a,t[60]=re);let ie;t[61]!==ne||t[62]!==re?(ie=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[G,ne,re]}),t[61]=ne,t[62]=re,t[63]=ie):ie=t[63];let ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Payload`}),t[64]=ae):ae=t[64];let oe=f===`form`?`secondary`:`ghost`,se;t[65]!==L||t[66]!==oe?(se=(0,X.jsx)(zv,{onClick:L,size:`sm`,variant:oe,children:`Form`}),t[65]=L,t[66]=oe,t[67]=se):se=t[67];let ce=f===`json`?`secondary`:`ghost`,le;t[68]!==F||t[69]!==ce?(le=(0,X.jsx)(zv,{onClick:F,size:`sm`,variant:ce,children:`JSON`}),t[68]=F,t[69]=ce,t[70]=le):le=t[70];let ue;t[71]!==se||t[72]!==le?(ue=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[ae,(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[se,le]})]}),t[71]=se,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==v||t[75]!==C||t[76]!==f||t[77]!==b?(de=f===`form`?(0,X.jsx)(Tbe,{fields:v,onChange:(e,t)=>x(n=>({...n,[e]:t})),values:b}):(0,X.jsx)(`textarea`,{"aria-label":`Payload JSON`,className:`min-h-64 w-full rounded-md border border-input bg-transparent p-3 font-mono text-xs shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,onChange:e=>{w(e.target.value),E(null)},spellCheck:!1,value:C}),t[74]=v,t[75]=C,t[76]=f,t[77]=b,t[78]=de):de=t[78];let fe;t[79]===T?fe=t[80]:(fe=T&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:T}),t[79]=T,t[80]=fe);let pe;t[81]!==ue||t[82]!==de||t[83]!==fe?(pe=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[ue,de,fe]}),t[81]=ue,t[82]=de,t[83]=fe,t[84]=pe):pe=t[84];let me;t[85]!==ie||t[86]!==pe?(me=(0,X.jsxs)(`div`,{className:`space-y-6`,children:[ie,pe]}),t[85]=ie,t[86]=pe,t[87]=me):me=t[87];let he;return t[88]!==n||t[89]!==W||t[90]!==me?(he=(0,X.jsx)(xX,{actions:W,description:`A test run carries the payload an Event would have sent, so every template downstream resolves the way it will in production.`,overlayId:n,title:`Test run`,children:me}),t[88]=n,t[89]=W,t[90]=me,t[91]=he):he=t[91],he}function R7(e){let t=(0,Z.c)(38),{overlayId:n,issues:r,onGoToStep:i,onRunAnyway:a,allowRunAnyway:o}=e,s=o!==void 0&&o,{push:c,closeAll:l}=LY(),{pushSheet:u}=D7(),d=AY(),f=T3(),{brokenReferences:p,missingRequiredFields:m,missingIntegrations:h}=r,g=p.length+m.length+h.length,_;t[0]!==l||t[1]!==d||t[2]!==i||t[3]!==u?(_=(e,t)=>{i(e,t),d?u():l()},t[0]=l,t[1]=d,t[2]=i,t[3]=u,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==f?(y=e=>{c(S3,{type:e,onSuccess:()=>void f()})},t[5]=c,t[6]=f,t[7]=y):y=t[7];let b=y,x;t[8]!==l||t[9]!==a?(x=()=>{a&&(l(),a())},t[8]=l,t[9]=a,t[10]=x):x=t[10];let S=x,C=m.length+h.length,w;t[11]!==s||t[12]!==l||t[13]!==S||t[14]!==a?(w=s&&a?[{label:`Run Anyway`,variant:`outline`,onClick:S},{label:`Cancel`,onClick:l}]:[{label:`Close`,onClick:l}],t[11]=s,t[12]=l,t[13]=S,t[14]=a,t[15]=w):w=t[15];let T=`Workflow Issues (${g})`,E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-warning`,children:[(0,X.jsx)(py,{className:`size-5`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This workflow has issues that may cause it to fail.`})]}),t[16]=E):E=t[16];let D;t[17]===C?D=t[18]:(D=C>0&&(0,X.jsx)(`p`,{className:`mt-2 text-destructive text-sm`,children:`Resolve blocking issues before running this workflow.`}),t[17]=C,t[18]=D);let O;t[19]!==b||t[20]!==h?(O=h.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Connections`}),h.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,X.jsx)(y3,{className:`size-4 shrink-0`,integration:e.integrationType}),(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.integrationLabel}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — `,e.nodeNames.length>3?`${e.nodeNames.slice(0,3).join(`, `)} +${e.nodeNames.length-3} more`:e.nodeNames.join(`, `)]})]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>b(e.integrationType),size:`sm`,variant:`outline`,children:`Add`})]},e.integrationType))]}),t[19]=b,t[20]=h,t[21]=O):O=t[21];let k;t[22]!==p||t[23]!==v?(k=p.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Broken References`}),p.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.brokenReferences.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:t.displayText}),` in `,t.fieldLabel]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}-${t.displayText}-${t.fieldLabel}`))})]},e.nodeId))]}),t[22]=p,t[23]=v,t[24]=k):k=t[24];let A;t[25]!==v||t[26]!==m?(A=m.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Required Fields`}),m.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.missingFields.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:t.fieldLabel}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}`))})]},e.nodeId))]}),t[25]=v,t[26]=m,t[27]=A):A=t[27];let j;t[28]!==k||t[29]!==A||t[30]!==O?(j=(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[O,k,A]}),t[28]=k,t[29]=A,t[30]=O,t[31]=j):j=t[31];let M;return t[32]!==n||t[33]!==j||t[34]!==w||t[35]!==T||t[36]!==D?(M=(0,X.jsxs)(xX,{actions:w,overlayId:n,title:T,children:[E,D,j]}),t[32]=n,t[33]=j,t[34]=w,t[35]=T,t[36]=D,t[37]=M):M=t[37],M}function z7(e){return e instanceof HTMLElement&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable)}var Dbe=jy(`workflow`,`run`),B7={workflow_paused:`Workflow is paused and cannot start new runs.`,concurrency_first_wins:`A run for this entity is already going, and this workflow keeps the first one.`,entity_value_missing:`This payload carries nothing at the workflow's Correlation Path, and its Concurrency needs an entity to compare.`,manual_start_not_allowed:`This workflow does not list manual runs as a start source.`,start_event_required:`This workflow splits on the Event a run is on, so a run has to name one.`};function V7(e,t,n){t(e.map(e=>({nodeId:e.id,status:n})))}function Obe(e){let t=F7(e.nodes);t&&e.updateNodeData({id:t.id,data:{config:{...t.data.config,testPayloads:xbe(I7(e.nodes),e.request)}}})}async function kbe({runWorkflow:e,nodes:t,setNodeStatuses:n,setIsExecuting:r,navigateToExecution:i}){V7(t,n,`idle`),n(t.filter(e=>e.data.type===`lifecycle`).map(e=>({nodeId:e.id,status:`running`})));try{let a=await e();if(a.status!==`running`||!a.executionId){Ty.message(a.status===`ignored`?B7[a.reason]:`Execution completed without starting a new run.`),r(!1),V7(t,n,`idle`);return}if(typeof a.supersededExecutions==`number`&&a.supersededExecutions>0){let e=Array.isArray(a.failedToSupersede)?a.failedToSupersede.length:0,t=`Superseded ${a.supersededExecutions} run${a.supersededExecutions===1?``:`s`} for this entity and started a new one.`;e>0?Ty.error(`${t} ${e} could not be signalled and may still be running. Cancel them from the Runs panel.`):Ty.success(t)}await i(a.executionId)}catch(e){Dbe.error(`Failed to execute the workflow`,{error:e}),V7(t,n,`error`),r(!1)}}function Abe(e){let t=(0,Z.c)(53),{currentWorkflowId:n,workflowName:r,nodes:i,edges:a,updateNodeData:o,isExecuting:s,setIsExecuting:c,setCurrentWorkflowName:l,setWorkflowNameError:u,setIsTransitioningFromHomepage:d,setActiveTab:f,setSelectedNodeId:p,userIntegrations:m}=e,h=yy(),[g,_]=(0,Y.useState)(null),{open:v}=LY(),y=Gi(),b=Fe(),x=TA(spe),S=TA(B4),C=TA(v3),w=TA(u2),T=TA(_de),E;t[0]===b?E=t[1]:(E=n0.workflow.execute.mutationOptions({onSuccess:()=>o0(b)}),t[0]=b,t[1]=E);let D=Ze(E),O;t[2]!==T||t[3]!==n||t[4]!==a||t[5]!==y||t[6]!==i||t[7]!==w||t[8]!==l||t[9]!==d||t[10]!==u||t[11]!==r?(O=async()=>{if(!i.some(jbe)){u(`Add at least one step before saving.`);return}let e=r.trim();if(!e){u(`Workflow name is required.`);return}if(n){let t=await w({name:e,nodes:i,edges:a},{immediate:!0});if(t&&!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}l(e),u(null);return}let t=await T({name:e,nodes:i,edges:a});if(!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}d(!0),await y({to:`/workflows/$workflowId`,params:{workflowId:t.workflow.id},replace:!0})},t[2]=T,t[3]=n,t[4]=a,t[5]=y,t[6]=i,t[7]=w,t[8]=l,t[9]=d,t[10]=u,t[11]=r,t[12]=O):O=t[12];let k=O,A;t[13]!==x||t[14]!==n||t[15]!==y||t[16]!==i||t[17]!==D||t[18]!==f||t[19]!==S||t[20]!==c||t[21]!==C||t[22]!==p||t[23]!==o?(A=async e=>{if(!n){Ty.error(`Please save the workflow before executing`);return}Obe({nodes:i,updateNodeData:o,request:e}),f(`runs`),S(null),x(),p(null),c(!0),await kbe({runWorkflow:()=>D.mutateAsync({workflowId:n,input:e.input,...e.eventName?{eventName:e.eventName}:{}}),nodes:i,setNodeStatuses:C,setIsExecuting:c,navigateToExecution:e=>y({to:`/workflows/$workflowId`,params:{workflowId:n},search:{executionId:e}})})},t[13]=x,t[14]=n,t[15]=y,t[16]=i,t[17]=D,t[18]=f,t[19]=S,t[20]=c,t[21]=C,t[22]=p,t[23]=o,t[24]=A):A=t[24];let j=A,M;t[25]!==j||t[26]!==i||t[27]!==v?(M=()=>{let e=bbe(i)??x1;v(Ebe,{startEvents:e.startEvents,allowManualStart:T1(e),hasEventSplit:i.some(X6),savedPayloads:I7(i),onRun:e=>{j(e)}})},t[25]=j,t[26]=i,t[27]=v,t[28]=M):M=t[28];let N=M,P;t[29]!==f||t[30]!==p?(P=(e,t)=>{p(e),f(`properties`),_(t??null)},t[29]=f,t[30]=p,t[31]=P):P=t[31];let F=P,I;t[32]===g?I=t[33]:(I=()=>{if(!g)return;_(null);let e=document.getElementById(g);e&&(e.focus(),e.scrollIntoView({behavior:`smooth`,block:`center`}))},t[32]=g,t[33]=I),vY(g,I);let L;t[34]!==h||t[35]!==F||t[36]!==s||t[37]!==i||t[38]!==v||t[39]!==N||t[40]!==m?(L=async()=>{if(s)return;let e=v4({nodes:W1(i),catalog:h,integrations:m});if(e.length>0){let t=y4(e);v(R7,{issues:b4(e),onGoToStep:F,onRunAnyway:t?void 0:N,allowRunAnyway:!t});return}N()},t[34]=h,t[35]=F,t[36]=s,t[37]=i,t[38]=v,t[39]=N,t[40]=m,t[41]=L):L=t[41];let R=L,z;t[42]!==h||t[43]!==F||t[44]!==i||t[45]!==v||t[46]!==m?(z=()=>{let e=v4({nodes:W1(i),catalog:h,integrations:m});v(R7,{issues:b4(e),onGoToStep:F,allowRunAnyway:!1})},t[42]=h,t[43]=F,t[44]=i,t[45]=v,t[46]=m,t[47]=z):z=t[47];let B=z,V;return t[48]!==R||t[49]!==F||t[50]!==k||t[51]!==B?(V={handleSave:k,handleExecute:R,handleShowIssues:B,handleGoToStep:F},t[48]=R,t[49]=F,t[50]=k,t[51]=B,t[52]=V):V=t[52],V}function jbe(e){return e.type!==`add`}function Mbe(){let e=(0,Z.c)(33),t=wA(Z4),n=wA(Q4),[r,i]=EA(C2),[a]=EA(w2),o=TA(h3),s=TA(p3),[c]=EA(Z0),[l,u]=EA(Q0),[d,f]=EA($0),p=TA(t2),m=TA(_2),h=wA(e2),g=wA(i2),_=wA(a2),v=TA(g3),y=TA(_3),b=TA(l3),[x]=EA(hpe),[S]=EA(gpe),C=TA(h2),w=TA(V4),T;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=r0(),e[0]=T):T=e[0];let{data:E}=Xe(T),D;e[1]===E?D=e[2]:(D=E===void 0?[]:E,e[1]=E,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=Fue(),e[3]=k):k=e[3];let{data:A}=Xe(k),j;e[4]===A?j=e[5]:(j=A===void 0?[]:A,e[4]=A,e[5]=j);let M=j,N;return e[6]!==b||e[7]!==M||e[8]!==S||e[9]!==x||e[10]!==o||e[11]!==c||e[12]!==n||e[13]!==_||e[14]!==r||e[15]!==a||e[16]!==h||e[17]!==g||e[18]!==t||e[19]!==y||e[20]!==C||e[21]!==f||e[22]!==u||e[23]!==i||e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==v||e[28]!==s||e[29]!==O||e[30]!==d||e[31]!==l?(N={nodes:t,edges:n,isExecuting:r,setIsExecuting:i,isGenerating:a,clearWorkflow:o,updateNodeData:s,currentWorkflowId:c,workflowName:l,workflowMode:d,setCurrentWorkflowName:u,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,isOwner:h,isSaving:g,hasUnsavedChanges:_,undo:v,redo:y,addNode:b,canUndo:x,canRedo:S,allWorkflows:M,setActiveTab:C,setSelectedNodeId:w,userIntegrations:O},e[6]=b,e[7]=M,e[8]=S,e[9]=x,e[10]=o,e[11]=c,e[12]=n,e[13]=_,e[14]=r,e[15]=a,e[16]=h,e[17]=g,e[18]=t,e[19]=y,e[20]=C,e[21]=f,e[22]=u,e[23]=i,e[24]=m,e[25]=w,e[26]=p,e[27]=v,e[28]=s,e[29]=O,e[30]=d,e[31]=l,e[32]=N):N=e[32],N}function Nbe(e){let t=(0,Z.c)(62),n=yy(),{open:r}=LY(),i=Gi(),a=Fe(),o=c0(),s=TA(gde),{currentWorkflowId:c,workflowName:l,workflowMode:u,setCurrentWorkflowName:d,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,clearWorkflow:b,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C}=e,w;t[0]!==c||t[1]!==g||t[2]!==v||t[3]!==h||t[4]!==x||t[5]!==d||t[6]!==y||t[7]!==m||t[8]!==S||t[9]!==p||t[10]!==_||t[11]!==C||t[12]!==l?(w={currentWorkflowId:c,workflowName:l,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,setCurrentWorkflowName:d,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C},t[0]=c,t[1]=g,t[2]=v,t[3]=h,t[4]=x,t[5]=d,t[6]=y,t[7]=m,t[8]=S,t[9]=p,t[10]=_,t[11]=C,t[12]=l,t[13]=w):w=t[13];let{handleSave:T,handleExecute:E,handleShowIssues:D,handleGoToStep:O}=Abe(w),k;t[14]===E?k=t[15]:(k=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(z7(e.target)||(e.preventDefault(),e.stopPropagation(),E()))},t[14]=E,t[15]=k);let A=k,j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j={capture:!0},t[16]=j):j=t[16],gY(document,`keydown`,A,j);let M;t[17]!==b||t[18]!==r?(M=()=>{r(SX,{title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{b()}})},t[17]=b,t[18]=r,t[19]=M):M=t[19];let N=M,P;t[20]!==c||t[21]!==o||t[22]!==r||t[23]!==l?(P=()=>{r(SX,{title:`Delete Workflow`,message:`Are you sure you want to delete "${l}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{c&&o.mutate({workflowId:c})}})},t[20]=c,t[21]=o,t[22]=r,t[23]=l,t[24]=P):P=t[24];let F=P,I;t[25]===a?I=t[26]:(I=()=>i0(a),t[25]=a,t[26]=I);let L=I,R;t[27]!==L||t[28]!==i?(R=n0.workflow.duplicate.mutationOptions({onSuccess:async e=>{Ty.success(`Workflow duplicated successfully`),await L(),await i({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},meta:{errorMessage:`Failed to duplicate workflow. Please try again.`}}),t[27]=L,t[28]=i,t[29]=R):R=t[29];let z=Ze(R),B;t[30]!==L||t[31]!==a?(B=n0.workflow.publish.mutationOptions({onSuccess:e=>{Ty.success(`Published version ${e.publishedVersion}`),a0(a,e),L()}}),t[30]=L,t[31]=a,t[32]=B):B=t[32];let V=Ze(B),H;t[33]!==c||t[34]!==z?(H=()=>{c&&z.mutate({workflowId:c})},t[33]=c,t[34]=z,t[35]=H):H=t[35];let U=H,W;t[36]!==n||t[37]!==c||t[38]!==g||t[39]!==O||t[40]!==h||t[41]!==r||t[42]!==V||t[43]!==C?(W=()=>{if(!c)return;let e=v4({nodes:W1(h),catalog:n,integrations:C});if(y4(e)){r(R7,{issues:b4(e),onGoToStep:O,allowRunAnyway:!1});return}V.mutate({workflowId:c,graph:J1({nodes:h,edges:g})})},t[36]=n,t[37]=c,t[38]=g,t[39]=O,t[40]=h,t[41]=r,t[42]=V,t[43]=C,t[44]=W):W=t[44];let G=W,K;t[45]!==c||t[46]!==f||t[47]!==s||t[48]!==u?(K=async e=>{if(!c||u===e)return;let t=await s(e);if(!t?.ok){Ty.error(`Failed to update workflow mode`);return}f(t.workflow.mode),Ty.success(e===`test`?`Workflow set to Test mode`:`Workflow set to Live mode`)},t[45]=c,t[46]=f,t[47]=s,t[48]=u,t[49]=K):K=t[49];let q=K,J;return t[50]!==z.isPending||t[51]!==N||t[52]!==F||t[53]!==U||t[54]!==E||t[55]!==G||t[56]!==T||t[57]!==q||t[58]!==D||t[59]!==L||t[60]!==V.isPending?(J={handleSave:T,handleExecute:E,handleShowIssues:D,handleClearWorkflow:N,handleDeleteWorkflow:F,loadWorkflows:L,handleDuplicate:U,isDuplicating:z.isPending,handlePublish:G,isPublishing:V.isPending,handleSetWorkflowMode:q},t[50]=z.isPending,t[51]=N,t[52]=F,t[53]=U,t[54]=E,t[55]=G,t[56]=T,t[57]=q,t[58]=D,t[59]=L,t[60]=V.isPending,t[61]=J):J=t[61],J}function Pbe(e){let t=(0,Z.c)(7),{onOpen:n}=e,r=wA(S4),i=wA(Ife),a=wA(e2),o=`${r.length} ${r.length===1?`issue`:`issues`}`;if(!a)return null;let s;t[0]!==i||t[1]!==r.length||t[2]!==o||t[3]!==n?(s=r.length>0&&(0,X.jsxs)(`button`,{className:Q(`flex items-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 font-medium text-xs transition-colors`,i?`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20`:`bg-card text-muted-foreground hover:bg-accent`),onClick:n,title:`Show what is wrong with this workflow`,type:`button`,children:[(0,X.jsx)(py,{className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:o})]}),t[0]=i,t[1]=r.length,t[2]=o,t[3]=n,t[4]=s):s=t[4];let c;return t[5]===s?c=t[6]:(c=(0,X.jsx)(`output`,{"aria-live":`polite`,className:`shrink-0`,children:s}),t[5]=s,t[6]=c),c}function Fbe(e){let t=(0,Z.c)(3),{isPublished:n,hasUnpublishedChanges:r}=e;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:`Never published`}),t[0]=e):e=t[0],e}let i=r?`Unpublished changes`:`Published`,a;return t[1]===i?a=t[2]:(a=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:i}),t[1]=i,t[2]=a),a}function Ibe(e){return e.isSaving?`saving`:e.lastSaveError?`failed`:e.hasUnsavedChanges?`unsaved`:`saved`}var Lbe={saving:`Saving`,unsaved:`Unsaved changes`,failed:`Save failed`,saved:`Saved`},Rbe={saving:`text-muted-foreground`,unsaved:`text-warning`,failed:`text-destructive`,saved:`text-muted-foreground`};function zbe(){let e=(0,Z.c)(14),t=wA(i2),n=wA(a2),r=wA(o2),i=wA(e2),a;e[0]!==n||e[1]!==t||e[2]!==r?(a=Ibe({isSaving:t,hasUnsavedChanges:n,lastSaveError:r}),e[0]=n,e[1]=t,e[2]=r,e[3]=a):a=e[3];let o=a,s=i&&(n||t),c;if(e[4]===s?c=e[5]:(c={enabled:s},e[4]=s,e[5]=c),gY(window,`beforeunload`,Bbe,c),!i)return null;let l=Rbe[o],u;e[6]===l?u=e[7]:(u=Q(`flex shrink-0 items-center gap-1.5 whitespace-nowrap px-1 font-medium text-xs`,l),e[6]=l,e[7]=u);let d;e[8]===o?d=e[9]:(d=o===`saving`&&(0,X.jsx)(ay,{className:`size-3 animate-spin`}),e[8]=o,e[9]=d);let f=Lbe[o],p;return e[10]!==u||e[11]!==d||e[12]!==f?(p=(0,X.jsxs)(`output`,{"aria-live":`polite`,className:u,children:[d,f]}),e[10]=u,e[11]=d,e[12]=f,e[13]=p):p=e[13],p}function Bbe(e){e.preventDefault()}var Vbe=e=>{let t=(0,Z.c)(57),{workflowId:n}=e,r=Mbe(),i=Nbe(r),a;if(t[0]!==r.allWorkflows||t[1]!==r.currentWorkflowId){let e;t[3]===r.currentWorkflowId?e=t[4]:(e=e=>e.id===r.currentWorkflowId,t[3]=r.currentWorkflowId,t[4]=e),a=r.allWorkflows.find(e),t[0]=r.allWorkflows,t[1]=r.currentWorkflowId,t[2]=a}else a=t[2];let o=!!a?.publishedVersionId,s=n??``,c;t[5]===s?c=t[6]:(c=Lue(s),t[5]=s,t[6]=c);let l=!!n,u;t[7]!==c||t[8]!==l?(u={...c,enabled:l},t[7]=c,t[8]=l,t[9]=u):u=t[9];let{data:d}=Xe(u),f=d!==void 0&&d,p;t[10]!==i||t[11]!==r||t[12]!==n?(p=(0,X.jsx)(lbe,{actions:i,state:r,workflowId:n}),t[10]=i,t[11]=r,t[12]=n,t[13]=p):p=t[13];let m;t[14]!==r.workflowMode||t[15]!==n?(m=n&&r.workflowMode===`test`&&(0,X.jsx)(`span`,{className:`rounded-md border border-warning/40 bg-warning/10 px-2 py-1 font-medium text-warning text-xs`,children:`Test mode`}),t[14]=r.workflowMode,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==f||t[18]!==o||t[19]!==n?(h=n&&(0,X.jsx)(Fbe,{hasUnpublishedChanges:f,isPublished:o}),t[17]=f,t[18]=o,t[19]=n,t[20]=h):h=t[20];let g;t[21]!==r.isOwner||t[22]!==n?(g=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Read-only`}),t[21]=r.isOwner,t[22]=n,t[23]=g):g=t[23];let _;t[24]===i.handleShowIssues?_=t[25]:(_=(0,X.jsx)(Pbe,{onOpen:i.handleShowIssues}),t[24]=i.handleShowIssues,t[25]=_);let v;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(zbe,{}),t[26]=v):v=t[26];let y;t[27]!==g||t[28]!==_||t[29]!==p||t[30]!==m||t[31]!==h?(y=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 flex-wrap items-center gap-2`,children:[p,m,h,g,_,v]}),t[27]=g,t[28]=_,t[29]=p,t[30]=m,t[31]=h,t[32]=y):y=t[32];let b;t[33]!==i||t[34]!==r||t[35]!==n?(b=(0,X.jsx)(sbe,{actions:i,state:r,workflowId:n}),t[33]=i,t[34]=r,t[35]=n,t[36]=b):b=t[36];let x;t[37]!==i.handleDuplicate||t[38]!==i.isDuplicating||t[39]!==r.isOwner||t[40]!==n?(x=n&&!r.isOwner&&(0,X.jsx)(obe,{isDuplicating:i.isDuplicating,onDuplicate:i.handleDuplicate}),t[37]=i.handleDuplicate,t[38]=i.isDuplicating,t[39]=r.isOwner,t[40]=n,t[41]=x):x=t[41];let S;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)($ye,{}),t[42]=S):S=t[42];let C;t[43]===x?C=t[44]:(C=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x,S]}),t[43]=x,t[44]=C);let w;t[45]!==b||t[46]!==C?(w=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2 overflow-x-auto @xl:justify-end`,children:[b,C]}),t[45]=b,t[46]=C,t[47]=w):w=t[47];let T;t[48]!==y||t[49]!==w?(T=(0,X.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-4 top-4 z-10 flex flex-col items-stretch gap-2 @container @xl:flex-row @xl:items-start @xl:justify-between`,children:[y,w]}),t[48]=y,t[49]=w,t[50]=T):T=t[50];let E;t[51]!==r.workflowMode||t[52]!==n?(E=n&&r.workflowMode===`test`&&(0,X.jsxs)(`div`,{className:`-translate-x-1/2 pointer-events-none absolute bottom-4 left-1/2 z-10 max-w-xl rounded-md border border-warning/30 bg-warning/10 px-4 py-2 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-warning`,children:`Test mode active`}),(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:`No real email or SMS is sent unless a node is configured to route to a test recipient.`})]}),t[51]=r.workflowMode,t[52]=n,t[53]=E):E=t[53];let D;return t[54]!==T||t[55]!==E?(D=(0,X.jsxs)(X.Fragment,{children:[T,E]}),t[54]=T,t[55]=E,t[56]=D):D=t[56],D};function H7(e,t){return e?.data.label?.trim()||t}function Hbe(e){return e.data.type===`lifecycle`||T0(e)||X6(e)}function Ube(e){return C0(e.sourceHandle)||(typeof e.sourceHandle==`string`&&e.sourceHandle.length>0?e.sourceHandle:``)}function Wbe(e){let{joinNodeId:t,predecessorIds:n,edges:r}=e;if(n.length===0)return new Set;let i=null;for(let e of n){let t=K6(e,r);if(!i){i=t;continue}for(let e of i)t.has(e)||i.delete(e)}let a=K6(t,r);for(let e of i??[])a.delete(e);return a}function Gbe(e){if(e.nodeById.get(e.nodeId)?.data.type===`lifecycle`)return!0;for(let t of K6(e.nodeId,e.edges))if(e.nodeById.get(t)?.data.type===`lifecycle`)return!0;return!1}function Kbe(e){let{joinNodeId:t,nodes:n,edges:r}=e,i=new Map(n.map(e=>[e.id,e])),a=H7(i.get(t),t),o=r.filter(e=>e.target===t).map(e=>e.source),s=K6(t,r);for(let e of o)if(!Gbe({nodeId:e,nodeById:i,edges:r}))return`Node "${a}" cannot join an unreachable branch (found "${H7(i.get(e),e)}")`;let c=new Map;for(let e of r){if(e.target!==t&&!s.has(e.target))continue;let n=i.get(e.source);if(!n||!Hbe(n))continue;let r=c.get(n.id)??new Set;r.add(Ube(e)),c.set(n.id,r)}for(let[e,t]of c){if(t.size<=1)continue;let n=i.get(e);return n?.data.type===`lifecycle`?`Node "${a}" cannot join the Started and Canceled branches`:`Node "${a}" cannot join mutually exclusive branches from "${H7(n,e)}"`}for(let e of Wbe({joinNodeId:t,predecessorIds:o,edges:r})){let t=i.get(e);if(t&&b0(t))return`Node "${a}" cannot join branches that include a Wait (found "${H7(t,e)}")`}return null}function qbe(e){let t=new Map;for(let n of e.edges)t.set(n.target,(t.get(n.target)??0)+1);for(let[n,r]of t){if(r<=1)continue;let t=Kbe({joinNodeId:n,nodes:e.nodes,edges:e.edges});if(t)return t}return null}function Jbe(e,t){return que(e)??t?.displayLabel??null}var U7=(e,t,n,r)=>{let i=e.internals.handleBounds?.[t];if(!(i&&i.length>0))return[0,0];let a=(r?i.find(e=>(e.id??null)===r):void 0)??i.find(e=>e.position===n)??i[0];if(!a)return[0,0];let o=a.width/2,s=a.height/2;switch(n){case _w.Left:o=0;break;case _w.Right:o=a.width;break;case _w.Top:s=0;break;case _w.Bottom:s=a.height;break;default:throw Error(`Invalid handle position`)}return[e.internals.positionAbsolute.x+a.x+o,e.internals.positionAbsolute.y+a.y+s]},Ybe=(e,t,n,r)=>{let i=_w.Bottom,[a,o]=U7(e,`source`,i,n),s=_w.Top,[c,l]=U7(t,`target`,s,r);return{sx:a,sy:o,tx:c,ty:l,sourcePos:i,targetPos:s}},Xbe={Animated:(0,Y.memo)(function(e){let t=(0,Z.c)(27),{id:n,source:r,sourceHandleId:i,target:a,targetHandleId:o,style:s,selected:c,data:l}=e,u=JO(r),d=JO(a);if(!(u&&d))return null;let f;if(t[0]!==i||t[1]!==u||t[2]!==o||t[3]!==d){let{sx:e,sy:n,tx:r,ty:a,sourcePos:s,targetPos:c}=Ybe(u,d,i,o);f=O7({sourceX:e,sourceY:n,sourcePosition:s,targetX:r,targetY:a,targetPosition:c}),t[0]=i,t[1]=u,t[2]=o,t[3]=d,t[4]=f}else f=t[4];let[p,m,h]=f,g;t[5]!==l||t[6]!==i?(g=Jbe(i,l),t[5]=l,t[6]=i,t[7]=g):g=t[7];let _=g,v=l?.inactive===!0,y=c?`var(--primary)`:v?`var(--canvas-line-muted)`:`var(--canvas-line)`,b=v?`4, 8`:`5`,x;t[8]===v?x=t[9]:(x=v?{}:{animation:`dashdraw 0.5s linear infinite`},t[8]=v,t[9]=x);let S;t[10]!==s||t[11]!==y||t[12]!==b||t[13]!==x?(S={...s,stroke:y,strokeWidth:2,strokeDasharray:b,...x},t[10]=s,t[11]=y,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]!==p||t[16]!==n||t[17]!==S?(C=(0,X.jsx)(GD,{id:n,path:p,style:S}),t[15]=p,t[16]=n,t[17]=S,t[18]=C):C=t[18];let w;t[19]!==_||t[20]!==v||t[21]!==m||t[22]!==h?(w=_&&(0,X.jsx)(KO,{children:(0,X.jsx)(`div`,{className:`pointer-events-none absolute rounded-sm border bg-background px-1.5 py-0.5 font-medium text-xs text-muted-foreground leading-none`,style:{transform:`translate(-50%, -50%) translate(${m}px,${h}px)`,...v?{opacity:.7}:{}},children:_})}),t[19]=_,t[20]=v,t[21]=m,t[22]=h,t[23]=w):w=t[23];let T;return t[24]!==C||t[25]!==w?(T=(0,X.jsxs)(X.Fragment,{children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26],T})},Zbe=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`m-4 rounded-md border bg-card p-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(cE,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function Qbe(e,t){let n=t.filter(t=>t.source===e);return n.some(e=>C0(e.sourceHandle)===`true`)?n.some(e=>C0(e.sourceHandle)===`false`)?`true`:`false`:`true`}function $be(e){let{nodes:t,edges:n,sourceNodeId:r,catalog:i}=e,a=t8({targetNodeId:r,nodes:t,edges:n,catalog:i}),o=new Set(n.filter(e=>e.source===r).map(e=>e.sourceHandle)),s=a.find(e=>!o.has(J6(e.name)))??a[0];return s?J6(s.name):null}function W7(e){let{nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:a}=e,o=C0(i);if(o)return o;let s=t.find(e=>e.id===r);if(E0(s))return k0(s)??i??null;if(s?.data.type===`lifecycle`)return Tde(i)?i:O2;if(X6(s)){let e=Y6(i);return e?J6(e):$be({nodes:t,edges:n,sourceNodeId:r,catalog:a})}return T0(s)?Qbe(r,n):i??null}var exe=e=>{let t=(0,Z.c)(12),{className:n}=e,r;t[0]===n?r=t[1]:(r=Q(`pointer-events-none absolute inset-0 animate-border-mask rounded-[inherit]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(`svg`,{className:`size-full overflow-visible`,xmlns:`http://www.w3.org/2000/svg`,children:(0,X.jsx)(`rect`,{fill:`none`,height:`calc(100% - 2px)`,rx:`6`,stroke:`var(--info)`,strokeWidth:`2`,width:`calc(100% - 2px)`,x:`1`,y:`1`})}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,X.jsx)(`div`,{className:r,children:i}),t[3]=r,t[4]=a);let o;t[5]===n?o=t[6]:(o=Q(`pointer-events-none absolute inset-0 rounded-[inherit] border-2 border-info/20`,n),t[5]=n,t[6]=o);let s;t[7]===o?s=t[8]:(s=(0,X.jsx)(`div`,{className:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,X.jsxs)(X.Fragment,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c},txe=d_(`flex flex-col rounded-xl border text-card-foreground shadow-sm`,{variants:{size:{default:`gap-6 py-6`,sm:`gap-4 py-4`}},defaultVariants:{size:`default`}});function nxe(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Q(txe({size:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,X.jsx)(`div`,{className:o,"data-size":a,"data-slot":`card`,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function rxe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ixe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var axe={running:{label:`Running`,Icon:ay,className:`bg-primary/5 text-foreground`,iconClassName:`animate-spin motion-reduce:animate-none`},success:{label:`Succeeded`,Icon:qv,className:`bg-success/10 text-success`,iconClassName:``},error:{label:`Failed`,Icon:cte,className:`bg-destructive/10 text-destructive`,iconClassName:``},cancelled:{label:`Cancelled`,Icon:Kv,className:`bg-cancelled/10 text-cancelled`,iconClassName:``}},oxe=e=>{let t=(0,Z.c)(11),{status:n}=e;if(!n||n===`idle`)return null;let r=axe[n],i;t[0]===r.className?i=t[1]:(i=Q(`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-sm py-0.5 pr-2 pl-1.5 font-medium text-xs leading-none`,r.className),t[0]=r.className,t[1]=i);let a=r.Icon,o;t[2]===r.iconClassName?o=t[3]:(o=Q(`size-3`,r.iconClassName),t[2]=r.iconClassName,t[3]=o);let s;t[4]!==r.Icon||t[5]!==o?(s=(0,X.jsx)(a,{className:o,strokeWidth:2.5}),t[4]=r.Icon,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==r.label||t[8]!==i||t[9]!==s?(c=(0,X.jsxs)(`div`,{className:i,role:`status`,children:[s,r.label]}),t[7]=r.label,t[8]=i,t[9]=s,t[10]=c):c=t[10],c};function G7(e,t){return t===!1?null:t===!0?(0,X.jsx)(dD,{position:e===`source`?_w.Bottom:_w.Top,type:e}):t.map(t=>{let n=[e,t.position,t.style?.top,t.style?.right,t.style?.bottom,t.style?.left].join(`:`);return(0,X.jsx)(dD,{className:t.className,id:t.id,position:t.position,style:t.style,type:e},t.id??n)})}var K7=e=>{let t=(0,Z.c)(25),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({handles:r,className:n,status:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===`success`&&`border-2 border-success`,s=a===`error`&&`border-2 border-destructive`,c=a===`cancelled`&&`border-2 border-cancelled`,l;t[5]!==n||t[6]!==o||t[7]!==s||t[8]!==c?(l=Q(`node-container relative flex flex-col items-center justify-center gap-0 overflow-visible rounded-md border-[1.5px] border-canvas-line bg-card p-0 shadow-none transition-all duration-150 ease-out`,o,s,c,n),t[5]=n,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=a===`running`&&(0,X.jsx)(exe,{}),t[10]=a,t[11]=u);let d;t[12]===a?d=t[13]:(d=(0,X.jsx)(oxe,{status:a}),t[12]=a,t[13]=d);let f;t[14]===r.target?f=t[15]:(f=G7(`target`,r.target),t[14]=r.target,t[15]=f);let p;t[16]===r.source?p=t[17]:(p=G7(`source`,r.source),t[16]=r.source,t[17]=p);let m;return t[18]!==i||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p?(m=(0,X.jsxs)(nxe,{className:l,...i,children:[u,d,f,p,i.children]}),t[18]=i,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m):m=t[24],m},q7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-base`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(rxe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},J7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ixe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},Y7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex w-full flex-col items-center justify-center gap-1 px-3 py-2 text-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function sxe(e){if(!e)return``;let t=e.messages.length,n=t===1?`issue`:`issues`;return e.severity===`blocking`?`${t} blocking ${n}`:`${t} ${n}`}function X7(e){let t=(0,Z.c)(13),{issues:n,placement:r}=e,i=r===void 0?`corner`:r;if(!n)return null;let a,o;t[0]===n.messages?(a=t[1],o=t[2]):([a,...o]=n.messages,t[0]=n.messages,t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=sxe(n),t[3]=n,t[4]=s);let c=i===`corner`?`absolute top-2 left-2 z-10`:`shrink-0`,l=n.severity===`blocking`?`bg-warning/50`:`bg-muted-foreground/40`,u;t[5]!==c||t[6]!==l?(u=Q(`rounded-full p-1`,c,l),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=o.length>0?`${a} and ${o.length} more`:a,f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(py,{className:`size-3.5 text-background`}),t[8]=f):f=t[8];let p;return t[9]!==s||t[10]!==u||t[11]!==d?(p=(0,X.jsx)(`div`,{"aria-label":s,className:u,role:`img`,title:d,children:f}),t[9]=s,t[10]=u,t[11]=d,t[12]=p):p=t[12],p}var cxe=/(-?\d+(?:\.\d+)?)\s*(ms|s|m|h|d|w)/gi,lxe=/(Z|[+-]\d{2}:\d{2})$/i,uxe=/^(-)?P(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/i,dxe=/^-?\d+(?:\.\d+)?$/,fxe=/^\d+$/,pxe=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Z7(e){switch(e){case`ms`:return 1;case`s`:return 1e3;case`m`:return 6e4;case`h`:return 36e5;case`d`:return 864e5;case`w`:return 6048e5;default:return NaN}}function mxe(e){let t=uxe.exec(e.trim());if(!t)return null;let n=t[1]?-1:1,r=Number.parseFloat(t[2]??`0`),i=Number.parseFloat(t[3]??`0`),a=Number.parseFloat(t[4]??`0`),o=Number.parseFloat(t[5]??`0`),s=Number.parseFloat(t[6]??`0`);return n*(r*Z7(`w`)+i*Z7(`d`)+a*Z7(`h`)+o*Z7(`m`)+s*Z7(`s`))}function Q7(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;if(dxe.test(t))return Number.parseFloat(t);let n=mxe(t);if(n!==null)return n;let r=0,i=!1;for(let e of t.matchAll(cxe)){let t=Number.parseFloat(e[1]),n=Z7(e[2].toLowerCase());if(!Number.isFinite(t)||Number.isNaN(n))return null;i=!0,r+=t*n}return i?r:null}function hxe(e){let t=pxe.exec(e);return t?{year:Number.parseInt(t[1],10),month:Number.parseInt(t[2],10),day:Number.parseInt(t[3],10),hour:Number.parseInt(t[4]??`0`,10),minute:Number.parseInt(t[5]??`0`,10),second:Number.parseInt(t[6]??`0`,10)}:null}function $7(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).formatToParts(e),r=Object.fromEntries(n.map(e=>[e.type,e.value]));return Date.UTC(Number.parseInt(r.year,10),Number.parseInt(r.month,10)-1,Number.parseInt(r.day,10),Number.parseInt(r.hour,10),Number.parseInt(r.minute,10),Number.parseInt(r.second,10))-e.getTime()}function gxe(e,t){let n=hxe(e);if(!n)return null;let r=new Date(Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)),i=$7(r,t),a=new Date(r.getTime()-i),o=$7(a,t);return o===i?a:new Date(r.getTime()-o)}function e9(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==`number`)return t9(e);if(typeof e!=`string`)return null;let n=e.trim();return n?_xe(n)??vxe(n)??yxe(n,t):null}function t9(e){if(typeof e==`number`&&!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function _xe(e){if(!fxe.test(e))return null;let t=Number.parseInt(e,10);return t9(e.length<=10?t*1e3:t)}function vxe(e){return lxe.test(e)?t9(e):null}function yxe(e,t){if(t){let n=gxe(e,t);if(n)return n}return t9(e)}function bxe(e,t,n,r){let i=$7(e,r),a=e.getTime()+i,o=new Date(a),s=o.getUTCHours()*60+o.getUTCMinutes();if(s>=t&&s<n)return e;let c=Math.floor(t/60),l=t%60,u=s<t?0:1,d=new Date(a);d.setUTCDate(d.getUTCDate()+u),d.setUTCHours(c,l,0,0);let f=new Date(d.getTime()-i),p=$7(f,r);return p===i?f:new Date(d.getTime()-p)}function xxe(e){let t=d4(e.waitAllowedHoursMode);if(t===`off`)return{date:e.candidate};let n=yfe({mode:t,startTime:e.waitAllowedStartTime,endTime:e.waitAllowedEndTime});if(n.length>0)return{date:e.candidate,error:n.map(e=>e.message).join(` `)};if(!e.timeZone)return{date:e.candidate,error:`Timezone is required when allowed-hours window is enabled.`};let r=f4(e.waitAllowedStartTime),i=f4(e.waitAllowedEndTime);return r===null||i===null?{date:e.candidate,error:`Invalid allowed-hours time format after validation.`}:{date:bxe(e.candidate,r,i,e.timeZone)}}function n9(e){let t=e.now??new Date,n=typeof e.waitTimezone==`string`&&e.waitTimezone.trim()?e.waitTimezone.trim():void 0,r;if(e.waitUntil!==void 0&&e.waitUntil!==``){let t=e9(e.waitUntil,n);if(!t)return{error:`Invalid waitUntil value. Use an ISO timestamp or unix epoch.`};let i=Q7(e.waitOffset);if(e.waitOffset!==void 0&&e.waitOffset!==``&&i===null)return{error:`Invalid waitOffset value. Use duration like -1d, 6h, 30m, or ISO duration.`};r=new Date(t.getTime()+(i??0))}else{let n=Q7(e.waitDuration);if(n===null)return{error:`Invalid waitDuration value. Use milliseconds, duration tokens (e.g. 24h), or ISO duration.`};r=new Date(t.getTime()+n)}let i=xxe({candidate:r,waitAllowedHoursMode:e.waitAllowedHoursMode,waitAllowedStartTime:e.waitAllowedStartTime,waitAllowedEndTime:e.waitAllowedEndTime,timeZone:n});return i.error?{error:i.error}:{waitUntil:i.date}}var Sxe={};function Cxe(){let e=(0,Z.c)(5),t=wA(D2),n;e[0]===t?n=e[1]:(n=n0.workflow.getExecutionLogs.queryOptions({input:{executionId:t??``},select:nye}),e[0]=t,e[1]=n);let r=t!==null,i;e[2]!==n||e[3]!==r?(i={...n,enabled:r},e[2]=n,e[3]=r,e[4]=i):i=e[4];let{data:a}=Xe(i);return a??Sxe}var wxe=Wh(Ch({waitMode:ph(Rh),waitTimezone:ph(Rh),waitDuration:ph(gh),waitUntil:ph(gh),waitOffset:ph(gh),waitTimeout:ph(gh)}));function r9(e){return typeof e==`string`&&e.includes(`{{`)&&e.includes(`}}`)}function i9(e){let t=Math.max(Math.floor(e/1e3),0),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return`${n} ${n===1?`day`:`days`} ${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function a9(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0,timeZoneName:`short`}),r=Object.fromEntries(n.formatToParts(e).map(e=>[e.type,e.value])),i=r.dayPeriod?` ${r.dayPeriod.toUpperCase()}`:``,a=r.timeZoneName?` ${r.timeZoneName}`:``;return`${r.month} ${r.day}, ${r.year} ${r.hour}:${r.minute}${i}${a}`}function Txe(e,t){let n=(0,Z.c)(15),r=_0(t,`waitMode`,`delay`),i=e===y1.wait&&(r===`delay`||r===`event`),a=t?.waitDuration,o=t?.waitUntil,s=t?.waitOffset,c;n[0]===t?c=n[1]:(c=typeof t?.waitTimezone==`string`&&t.waitTimezone.trim()?t.waitTimezone.trim():void 0,n[0]=t,n[1]=c);let l=c,u=r9(a)||r9(o)||r9(s),d;bb0:{if(!i||u||r===`event`){d=null;break bb0}let e;n[2]!==a||n[3]!==s||n[4]!==l||n[5]!==o?(e=n9({waitDuration:a,waitUntil:o,waitOffset:s,waitTimezone:l}),n[2]=a,n[3]=s,n[4]=l,n[5]=o,n[6]=e):e=n[6],d=e}let f=d;if(!i)return null;if(r===`event`){let e;return n[7]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Waiting for event`,triggerTime:`Resumes when a matching event arrives`},n[7]=e):e=n[7],e}if(u){let e;return n[8]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Runtime-calculated`,triggerTime:`Trigger time comes from workflow data`},n[8]=e):e=n[8],e}if(!f?.waitUntil){let e;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Set wait duration`,triggerTime:`Add a valid wait time`},n[9]=e):e=n[9],e}let p;n[10]!==f.waitUntil||n[11]!==l?(p=a9(f.waitUntil,l),n[10]=f.waitUntil,n[11]=l,n[12]=p):p=n[12];let m;return n[13]===p?m=n[14]:(m={countdown:`Delay configured`,triggerTime:p},n[13]=p,n[14]=m),m}function Exe(e,t,n){let r=(0,Z.c)(16),i=e===y1.wait&&t!==null&&n!==void 0&&(n.status===`running`||n.status===`pending`),a;r[0]===i?a=r[1]:(a={intervalMs:1e3,enabled:i},r[0]=i,r[1]=a);let o=xY(a);n?.input;let s;bb0:{if(!i){s=null;break bb0}let e;r[2]===n?.input?e=r[3]:(e=wxe(n?.input)??null,r[2]=n?.input,r[3]=e),s=e}let c=s,l,u,d;if(r[4]!==n||r[5]!==o||r[6]!==c||r[7]!==i){d=Symbol.for(`react.early_return_sentinel`);bb1:{let e=i&&n?.startedAt!==void 0?e9(n.startedAt):null;if(!(i&&c&&e)){d=null;break bb1}let t=c.waitMode||`delay`,a=c.waitTimezone||void 0;if(t===`event`){let t=n9({now:e,waitDuration:c.waitTimeout});if(!t.waitUntil){d={countdown:`Waiting for event`,triggerTime:`Resumes when matching event arrives`};break bb1}d={countdown:i9(t.waitUntil.getTime()-o),triggerTime:a9(t.waitUntil,a)};break bb1}let s=n9({now:e,waitDuration:c.waitDuration,waitUntil:c.waitUntil,waitOffset:c.waitOffset,waitTimezone:a});if(!s.waitUntil){d={countdown:`Runtime-calculated`,triggerTime:`Waiting timestamp unavailable`};break bb1}let f=s.waitUntil.getTime()-o;r[11]===f?l=r[12]:(l=i9(f),r[11]=f,r[12]=l),u=a9(s.waitUntil,a)}r[4]=n,r[5]=o,r[6]=c,r[7]=i,r[8]=l,r[9]=u,r[10]=d}else l=r[8],u=r[9],d=r[10];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;return r[13]!==l||r[14]!==u?(f={countdown:l,triggerTime:u},r[13]=l,r[14]=u,r[15]=f):f=r[15],f}var Dxe=e=>({"gpt-5":`GPT-5`,"openai/gpt-5.1-instant":`GPT-5.1 Instant`,"openai/gpt-5.1-codex":`GPT-5.1 Codex`,"openai/gpt-5.1-codex-mini":`GPT-5.1 Codex Mini`,"openai/gpt-5.1-thinking":`GPT-5.1 Thinking`,"gpt-4":`GPT-4`,"gpt-4o":`GPT-4o`,"gpt-4o-mini":`GPT-4o Mini`,"claude-3-5-sonnet":`Claude 3.5`,"claude-3-opus":`Claude 3 Opus`,"anthropic/claude-opus-4.5":`Claude Opus 4.5`,"anthropic/claude-sonnet-4.5":`Claude Sonnet 4.5`,"anthropic/claude-haiku-4.5":`Claude Haiku 4.5`,"google/gemini-3-pro-preview":`Gemini 3 Pro Preview`,"google/gemini-2.5-flash-lite":`Gemini 2.5 Flash Lite`,"google/gemini-2.5-flash":`Gemini 2.5 Flash`,"google/gemini-2.5-pro":`Gemini 2.5 Pro`,"meta/llama-4-scout":`Llama 4 Scout`,"meta/llama-3.3-70b":`Llama 3.3 70B`,"meta/llama-3.1-8b":`Llama 3.1 8B`,"moonshotai/kimi-k2-0905":`Kimi K2`,"openai/gpt-oss-120b":`GPT OSS 120B`,"openai/gpt-oss-safeguard-20b":`GPT OSS Safeguard 20B`,"openai/gpt-oss-20b":`GPT OSS 20B`,"o1-preview":`o1 Preview`,"o1-mini":`o1 Mini`,"bfl/flux-2-pro":`FLUX.2 Pro`,"bfl/flux-1-pro":`FLUX.1 Pro`,"openai/dall-e-3":`DALL-E 3`,"google/imagen-4.0-generate":`Imagen 4.0`})[e]||e,Oxe=(e,t)=>{let n=Py(e,t)?.integration;return n&&Fy(e,n)?.label||`System`},o9=e=>{let t=(0,Z.c)(19),{actionType:n,catalog:r,className:i}=e,a=i===void 0?D4:i,o=xy();switch(n){case y1.condition:{let e;t[0]===a?e=t[1]:(e=Q(a,`text-node-condition`),t[0]=a,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(fte,{className:e,strokeWidth:1.5}),t[2]=e,t[3]=n),n}case y1.eventSplit:{let e;t[4]===a?e=t[5]:(e=Q(a,`text-node-split`),t[4]=a,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,X.jsx)(Ate,{className:e,strokeWidth:1.5}),t[6]=e,t[7]=n),n}case y1.wait:{let e;t[8]===a?e=t[9]:(e=Q(a,`text-node-wait`),t[8]=a,t[9]=e);let n;return t[10]===e?n=t[11]:(n=(0,X.jsx)(hte,{className:e,strokeWidth:1.5}),t[10]=e,t[11]=n),n}}let s=Py(r,n)?.integration;if(s){let e=o[s];if(e){let n=e.icon,r;return t[12]!==n||t[13]!==a?(r=(0,X.jsx)(n,{className:a}),t[12]=n,t[13]=a,t[14]=r):r=t[14],r}}let c;t[15]===a?c=t[16]:(c=Q(a,`text-node-wait`),t[15]=a,t[16]=c);let l;return t[17]===c?l=t[18]:(l=(0,X.jsx)(gy,{className:c,strokeWidth:1.5}),t[17]=c,t[18]=l),l};function kxe(e){let t=(0,Z.c)(14),{base64:n}=e,[r,i]=(0,Y.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Q(D4,`relative cursor-zoom-in overflow-hidden rounded-lg transition-transform hover:scale-105`),o=e=>{e.stopPropagation(),i(!0)},t[0]=a,t[1]=o):(a=t[0],o=t[1]);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=Q(D4,`object-cover`),t[2]=s):s=t[2];let c=`data:image/png;base64,${n}`,l;t[3]===c?l=t[4]:(l=(0,X.jsx)(`button`,{className:a,onClick:o,type:`button`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:s,height:20,src:c,width:20})}),t[3]=c,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(pY,{className:`sr-only`,children:`Generated Image`}),t[5]=u):u=t[5];let d=`data:image/png;base64,${n}`,f;t[6]===d?f=t[7]:(f=(0,X.jsxs)(uY,{className:`max-w-3xl p-2`,showCloseButton:!1,children:[u,(0,X.jsx)(`div`,{className:`relative aspect-square w-full overflow-hidden rounded-lg`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:`h-auto w-full object-contain`,height:768,src:d,width:768})})]}),t[6]=d,t[7]=f);let p;t[8]!==r||t[9]!==f?(p=(0,X.jsx)(sY,{onOpenChange:i,open:r,children:f}),t[8]=r,t[9]=f,t[10]=p):p=t[10];let m;return t[11]!==l||t[12]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[l,p]}),t[11]=l,t[12]=p,t[13]=m):m=t[13],m}var s9=`38%`,c9=`62%`;function l9(e,t){return`${(e+.5)/t*100}%`}var u9=`group-child-handle`,Axe=[{position:_w.Top,className:u9}],jxe=[{position:_w.Bottom,className:u9}],Mxe=[{id:`true`,position:_w.Bottom,className:u9,style:{left:s9}},{id:`false`,position:_w.Bottom,className:u9,style:{left:c9}}];function Nxe(e){let t=(0,Z.c)(26),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=g0(n?.config,`actionType`),c=w0(s),l;if(t[0]!==i||t[1]!==o?(l=()=>{o(i)},t[0]=i,t[1]=o,t[2]=l):l=t[2],vY(c,l),!n)return null;let u=n.label||(s?Py(a,s)?.label:void 0)||s||`Action`,d=r&&`border-primary`,f=n.enabled===!1&&`opacity-50`,p;t[3]!==d||t[4]!==f?(p=Q(`nodrag flex h-14 w-[188px] flex-row items-center shadow-none transition-all duration-150 ease-out`,d,f),t[3]=d,t[4]=f,t[5]=p):p=t[5];let m=`action-node-${i}`,h=c?Mxe:jxe,g;t[6]===h?g=t[7]:(g={target:Axe,source:h},t[6]=h,t[7]=g);let _;t[8]!==s||t[9]!==a?(_=s?(0,X.jsx)(o9,{actionType:s,catalog:a,className:Q(D4,`shrink-0`)}):(0,X.jsx)(gy,{className:Q(D4,`shrink-0 text-muted-foreground`),strokeWidth:1.5}),t[8]=s,t[9]=a,t[10]=_):_=t[10];let v;t[11]===u?v=t[12]:(v=(0,X.jsx)(q7,{className:`truncate text-sm`,children:u}),t[11]=u,t[12]=v);let y;t[13]!==n.enabled||t[14]!==n.issues?(y=n.enabled!==!1&&(0,X.jsx)(X7,{issues:n.issues,placement:`inline`}),t[13]=n.enabled,t[14]=n.issues,t[15]=y):y=t[15];let b;t[16]!==y||t[17]!==_||t[18]!==v?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 px-3`,children:[_,v,y]}),t[16]=y,t[17]=_,t[18]=v,t[19]=b):b=t[19];let x;return t[20]!==n.status||t[21]!==b||t[22]!==p||t[23]!==m||t[24]!==g?(x=(0,X.jsx)(K7,{className:p,"data-testid":m,handles:g,status:n.status,children:b}),t[20]=n.status,t[21]=b,t[22]=p,t[23]=m,t[24]=g,t[25]=x):x=t[25],x}var d9=(0,Y.memo)(e=>{let t=(0,Z.c)(99),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=wA(D2),c=Cxe()[i],l,u,d;t[0]===n?.config?(l=t[1],u=t[2],d=t[3]):(l=g0(n?.config,`actionType`),u=w0(l),d=kme(l),t[0]=n?.config,t[1]=l,t[2]=u,t[3]=d);let f=d,p=O8(f?i:null),m=Exe(l??``,s,c),h=Txe(l??``,n?.config),g=m??h,_;t[4]!==f||t[5]!==p?(_=f?p.map(Pxe).join(`|`):null,t[4]=f,t[5]=p,t[6]=_):_=t[6];let v=_,y;if(t[7]!==i||t[8]!==u||t[9]!==f||t[10]!==o?(y=()=>{(u||f)&&o(i)},t[7]=i,t[8]=u,t[9]=f,t[10]=o,t[11]=y):y=t[11],vY(u?i:v,y),!n)return null;let b=n.status,x;t[12]!==l||t[13]!==c?.output||t[14]!==s?(x=s&&l===`Generate Image`?_7(c?.output):null,t[12]=l,t[13]=c?.output,t[14]=s,t[15]=x):x=t[15];let S=x;if(!l){let e=n.enabled===!1,a=r&&`border-primary`,o=e&&`opacity-50`,s;t[16]!==a||t[17]!==o?(s=Q(a,o),t[16]=a,t[17]=o,t[18]=s):s=t[18];let c=`action-node-${i}`,l;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(l={target:!0,source:!0},t[19]=l):l=t[19];let u;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(u=w4(),t[20]=u):u=t[20];let d;t[21]===e?d=t[22]:(d=e&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[21]=e,t[22]=d);let f;t[23]!==n.issues||t[24]!==e?(f=!e&&(0,X.jsx)(X7,{issues:n.issues}),t[23]=n.issues,t[24]=e,t[25]=f):f=t[25];let p;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(gy,{className:Q(D4,`text-muted-foreground`),strokeWidth:1.5}),t[26]=p):p=t[26];let m=n.label||`Action`,h;t[27]===m?h=t[28]:(h=(0,X.jsx)(q7,{children:m}),t[27]=m,t[28]=h);let g;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(J7,{children:`Select an action`}),t[29]=g):g=t[29];let _;t[30]===h?_=t[31]:(_=(0,X.jsxs)(Y7,{children:[p,h,g]}),t[30]=h,t[31]=_);let v;return t[32]!==b||t[33]!==d||t[34]!==f||t[35]!==_||t[36]!==s||t[37]!==c?(v=(0,X.jsxs)(K7,{className:s,"data-testid":c,handles:l,status:b,style:u,children:[d,f,_]}),t[32]=b,t[33]=d,t[34]=f,t[35]=_,t[36]=s,t[37]=c,t[38]=v):v=t[38],v}let C;t[39]!==l||t[40]!==a?(C=Py(a,l),t[39]=l,t[40]=a,t[41]=C):C=t[41];let w=C,T=n.label||w?.label||l,E;t[42]!==l||t[43]!==n.config?(E=()=>l===`Generate Text`?_0(n.config,`aiModel`,`meta/llama-4-scout`):l===`Generate Image`?_0(n.config,`imageModel`,`google/imagen-4.0-generate`):null,t[42]=l,t[43]=n.config,t[44]=E):E=t[44];let D=E,O,k;if(t[45]!==l||t[46]!==a||t[47]!==n.description||t[48]!==n.enabled||t[49]!==D||t[50]!==g){let e=D();O=n.enabled===!1,k=g?g.countdown:e?Dxe(e):n.description||Oxe(a,l),t[45]=l,t[46]=a,t[47]=n.description,t[48]=n.enabled,t[49]=D,t[50]=g,t[51]=O,t[52]=k}else O=t[51],k=t[52];let A=k,j=r&&`border-primary`,M=O&&`opacity-50`,N;t[53]!==j||t[54]!==M?(N=Q(j,M),t[53]=j,t[54]=M,t[55]=N):N=t[55];let P=`action-node-${i}`,F;t[56]!==u||t[57]!==f||t[58]!==p?(F=u?[{id:`true`,position:_w.Bottom,style:{left:s9,width:12,height:12}},{id:`false`,position:_w.Bottom,style:{left:c9,width:12,height:12}}]:!f||p.map((e,t)=>({id:J6(e.name),position:_w.Bottom,style:{left:l9(t,p.length),width:12,height:12}})),t[56]=u,t[57]=f,t[58]=p,t[59]=F):F=t[59];let I;t[60]===F?I=t[61]:(I={target:!0,source:F},t[60]=F,t[61]=I);let L;t[62]!==f||t[63]!==p?(L=w4(f?E4(p.length):192),t[62]=f,t[63]=p,t[64]=L):L=t[64];let R;t[65]===O?R=t[66]:(R=O&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[65]=O,t[66]=R);let z;t[67]!==n.issues||t[68]!==O?(z=!O&&(0,X.jsx)(X7,{issues:n.issues}),t[67]=n.issues,t[68]=O,t[69]=z):z=t[69];let B;t[70]===u?B=t[71]:(B=u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[38%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`True`}),(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[62%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`False`})]}),t[70]=u,t[71]=B);let V;t[72]!==f||t[73]!==p?(V=f&&p.map((e,t)=>(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 max-w-28 -translate-x-1/2 truncate rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:l9(t,p.length)},title:e.name,children:e.label},e.name)),t[72]=f,t[73]=p,t[74]=V):V=t[74];let H;t[75]!==l||t[76]!==a||t[77]!==S?(H=S?(0,X.jsx)(kxe,{base64:S}):(0,X.jsx)(o9,{actionType:l,catalog:a}),t[75]=l,t[76]=a,t[77]=S,t[78]=H):H=t[78];let U;t[79]===T?U=t[80]:(U=(0,X.jsx)(q7,{children:T}),t[79]=T,t[80]=U);let W;t[81]!==A||t[82]!==g?(W=A&&(0,X.jsx)(J7,{className:g?`font-medium tabular-nums`:void 0,children:A}),t[81]=A,t[82]=g,t[83]=W):W=t[83];let G;t[84]!==H||t[85]!==U||t[86]!==W?(G=(0,X.jsxs)(Y7,{children:[H,U,W]}),t[84]=H,t[85]=U,t[86]=W,t[87]=G):G=t[87];let K;return t[88]!==b||t[89]!==N||t[90]!==P||t[91]!==I||t[92]!==L||t[93]!==R||t[94]!==z||t[95]!==B||t[96]!==V||t[97]!==G?(K=(0,X.jsxs)(K7,{className:N,"data-testid":P,handles:I,status:b,style:L,children:[R,z,B,V,G]}),t[88]=b,t[89]=N,t[90]=P,t[91]=I,t[92]=L,t[93]=R,t[94]=z,t[95]=B,t[96]=V,t[97]=G,t[98]=K):K=t[98],K});d9.displayName=`StandaloneActionNode`;var f9=(0,Y.memo)(e=>{let t=(0,Z.c)(4);if(e.parentId){let n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Nxe,{...e}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(d9,{...e}),t[2]=e,t[3]=n),n});f9.displayName=`ActionNode`;function Pxe(e){return e.name}function Fxe(e){let t=(0,Z.c)(3),{data:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(cy,{className:`size-4`}),t[0]=r):r=t[0];let i;return t[1]===n.onClick?i=t[2]:(i=(0,X.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-border border-dashed bg-background/50 p-8 backdrop-blur-sm`,children:(0,X.jsxs)(zv,{className:`gap-2 shadow-lg`,onClick:n.onClick,size:`default`,children:[r,`Add a Step`]})}),t[1]=n.onClick,t[2]=i),i}var p9=(0,Y.memo)(e=>{let t=(0,Z.c)(19),{data:n,selected:r,id:i}=e;if(!n||!E0({data:n}))return null;let a=n.enabled===!1,o=r&&`border-primary`,s=a&&`opacity-50`,c;t[0]!==o||t[1]!==s?(c=Q(`flex h-full w-full flex-col rounded-md border-[1.5px] border-canvas-line bg-muted shadow-none`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=`group-node-${i}`,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(dD,{position:_w.Top,type:`target`}),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a&&(0,X.jsx)(`span`,{className:`rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[4]=a,t[5]=d);let f=n.label||`Group`,p;t[6]!==d||t[7]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-canvas-line/60 border-b px-3 font-medium text-sm`,children:[d,f]}),t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==n||t[10]!==i?(m=k0({data:n,id:i}),t[9]=n,t[10]=i,t[11]=m):m=t[11];let h;t[12]===m?h=t[13]:(h=(0,X.jsx)(dD,{id:m,position:_w.Bottom,type:`source`}),t[12]=m,t[13]=h);let g;return t[14]!==h||t[15]!==c||t[16]!==l||t[17]!==p?(g=(0,X.jsxs)(`div`,{className:c,"data-testid":l,children:[u,p,h]}),t[14]=h,t[15]=c,t[16]=l,t[17]=p,t[18]=g):g=t[18],g});p9.displayName=`GroupNode`;var m9=`25%`,h9=`75%`;function Ixe(e){let t=S1(e);return t?.startEvents.length?`On ${t.startEvents.join(`, `)}`:T1(t)?`Manual runs only`:`Nothing starts this yet`}var g9=(0,Y.memo)(e=>{let t=(0,Z.c)(33),{data:n,selected:r}=e;if(!n)return null;let i=n.label||`Lifecycle`,a;t[0]===n.config?a=t[1]:(a=Ixe(n.config),t[0]=n.config,t[1]=a);let o=a,s=n.description||o,c=n.status,l;t[2]===n.config?l=t[3]:(l=C1(n.config),t[2]=n.config,t[3]=l);let u=!l,d=r&&`border-primary`,f;t[4]===d?f=t[5]:(f=Q(d),t[4]=d,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p={id:O2,position:_w.Bottom,style:{left:m9,width:12,height:12}},t[6]=p):p=t[6];let m;t[7]===u?m=t[8]:(m={target:!1,source:[p,{id:k2,position:_w.Bottom,style:{left:h9,width:12,height:12,...u?{opacity:.45}:{}}}]},t[7]=u,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=w4(),t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:m9},children:`Started`}),t[10]=g):g=t[10];let _=u&&`opacity-50`,v;t[11]===_?v=t[12]:(v=Q(`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,_),t[11]=_,t[12]=v);let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y={left:h9},t[13]=y):y=t[13];let b;t[14]===v?b=t[15]:(b=(0,X.jsx)(`div`,{className:v,style:y,children:`Canceled`}),t[14]=v,t[15]=b);let x;t[16]===n.issues?x=t[17]:(x=(0,X.jsx)(X7,{issues:n.issues}),t[16]=n.issues,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(sy,{className:Q(D4,`text-node-lifecycle`),strokeWidth:1.5}),t[18]=S):S=t[18];let C;t[19]===i?C=t[20]:(C=(0,X.jsx)(q7,{children:i}),t[19]=i,t[20]=C);let w;t[21]===s?w=t[22]:(w=s&&(0,X.jsx)(J7,{children:s}),t[21]=s,t[22]=w);let T;t[23]!==C||t[24]!==w?(T=(0,X.jsxs)(Y7,{children:[S,C,w]}),t[23]=C,t[24]=w,t[25]=T):T=t[25];let E;return t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==T||t[30]!==f||t[31]!==m?(E=(0,X.jsxs)(K7,{className:f,handles:m,status:c,style:h,children:[g,b,x,T]}),t[26]=c,t[27]=b,t[28]=x,t[29]=T,t[30]=f,t[31]=m,t[32]=E):E=t[32],E});g9.displayName=`LifecycleNode`;function Lxe(e){let t=(0,Z.c)(8),n=TA(u3),r=TA(d3),i=TA(f3),a=TA(J4),o=yy(),s;t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==a||t[4]!==r?(s=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||z7(e.target))return;let t=e.key.toLowerCase();if(t===`c`){n()&&e.preventDefault();return}if(t===`v`){r()&&e.preventDefault();return}if(t===`d`){i()&&e.preventDefault();return}t===`g`&&a({catalog:o})&&e.preventDefault()},t[0]=o,t[1]=n,t[2]=i,t[3]=a,t[4]=r,t[5]=s):s=t[5];let c=s,l;t[6]===e?l=t[7]:(l={enabled:e},t[6]=e,t[7]=l),gY(window,`keydown`,c,l)}var Rxe=300;function zxe(){let e=(0,Z.c)(8),t=wA(Z4),n=yy(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=r0(),e[0]=r):r=e[0];let{data:i}=Xe(r),a=TA(S4),o=yY(t,Rxe),s;bb0:{if(!i){s=x4;break bb0}let t;e[1]!==n||e[2]!==i||e[3]!==o?(t=v4({nodes:W1(o),catalog:n,integrations:i}),e[1]=n,e[2]=i,e[3]=o,e[4]=t):t=e[4],s=t}let c=s,l;e[5]!==c||e[6]!==a?(l=()=>{a(e=>zfe(e,c)?e:c)},e[5]=c,e[6]=a,e[7]=l):l=e[7],_Y(c,l)}var Bxe=8,Vxe=280;function Hxe(e){let t=(0,Z.c)(106),{menuState:n,onClose:r}=e,i=wA(Z4),a=wA(Q4),o=TA(m3),s=TA(X4),c=TA(l3),l=TA(u3),u=TA(d3),d=TA(f3),f=TA(J4),p=TA(Y4),m=wA(dpe),h=TA(V4),g=TA(h2),_=yy(),{open:v}=LY(),{openSheet:y}=D7(),b=AY(),x=(0,Y.useRef)(null),S;t[0]!==o||t[1]!==n||t[2]!==r||t[3]!==v?(S=()=>{if(n?.nodeId){let e=n.nodeId;r(),v(SX,{title:`Delete Step`,message:`Are you sure you want to delete this node? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{o(e)}})}},t[0]=o,t[1]=n,t[2]=r,t[3]=v,t[4]=S):S=t[4];let C=S,w;t[5]!==b||t[6]!==n||t[7]!==r||t[8]!==y||t[9]!==g||t[10]!==h?(w=()=>{if(n?.nodeId){let e=n.nodeId;r(),h(e),g(`properties`),b&&y()}},t[5]=b,t[6]=n,t[7]=r,t[8]=y,t[9]=g,t[10]=h,t[11]=w):w=t[11];let T=w,E;t[12]!==s||t[13]!==n||t[14]!==r||t[15]!==v?(E=()=>{if(n?.edgeId){let e=n.edgeId;r(),v(SX,{title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s(e)}})}},t[12]=s,t[13]=n,t[14]=r,t[15]=v,t[16]=E):E=t[16];let D=E,O;t[17]!==c||t[18]!==n||t[19]!==r||t[20]!==g||t[21]!==h?(O=()=>{if(n?.flowPosition){let e={id:l0(),type:`action`,position:{x:n.flowPosition.x,y:n.flowPosition.y-56},data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};c(e),h(e.id),g(`properties`)}r()},t[17]=c,t[18]=n,t[19]=r,t[20]=g,t[21]=h,t[22]=O):O=t[22];let k=O,A;t[23]!==l||t[24]!==n||t[25]!==r?(A=()=>{n?.nodeId&&l(n.nodeId),r()},t[23]=l,t[24]=n,t[25]=r,t[26]=A):A=t[26];let j=A,M;t[27]!==d||t[28]!==n||t[29]!==r?(M=()=>{n?.nodeId&&d(n.nodeId),r()},t[27]=d,t[28]=n,t[29]=r,t[30]=M):M=t[30];let N=M,P;t[31]!==_||t[32]!==f||t[33]!==n||t[34]!==r?(P=()=>{if(n?.type!==`node`){r();return}f({catalog:_,selectedIds:n.selectedIds??new Set}),r()},t[31]=_,t[32]=f,t[33]=n,t[34]=r,t[35]=P):P=t[35];let F=P,I;t[36]!==n||t[37]!==r||t[38]!==p?(I=()=>{n?.nodeId&&p(n.nodeId),r()},t[36]=n,t[37]=r,t[38]=p,t[39]=I):I=t[39];let L=I,R;t[40]!==n?.flowPosition||t[41]!==r||t[42]!==u?(R=()=>{u(n?.flowPosition),r()},t[40]=n?.flowPosition,t[41]=r,t[42]=u,t[43]=R):R=t[43];let z=R,B;t[44]===r?B=t[45]:(B=e=>{let t=e.target;x.current&&!(t instanceof globalThis.Node&&x.current.contains(t))&&r()},t[44]=r,t[45]=B);let V=B,H;t[46]===r?H=t[47]:(H=e=>{e.key===`Escape`&&r()},t[46]=r,t[47]=H);let U=H,W=n!==null,G;t[48]===W?G=t[49]:(G={deferAttach:!0,enabled:W},t[48]=W,t[49]=G),gY(document,`mousedown`,V,G);let K;t[50]===W?K=t[51]:(K={enabled:W},t[50]=W,t[51]=K),gY(document,`keydown`,U,K);let q;if(t[52]===W?q=t[53]:(q={enabled:W},t[52]=W,t[53]=q),gY(window,`resize`,r,q),!n)return null;let J,ee,te,ne,re,ie;if(t[54]!==_||t[55]!==a||t[56]!==n.nodeId||t[57]!==n.selectedIds||t[58]!==i){ee=n.nodeId?i.find(e=>e.id===n.nodeId):void 0,ne=ee?.data.type===`lifecycle`;let e;t[65]===n.selectedIds?e=t[66]:(e=n.selectedIds??new Set,t[65]=n.selectedIds,t[66]=e);let r=e,o;t[67]!==_||t[68]!==a||t[69]!==r||t[70]!==i?(o=N0(i,a,r,_),t[67]=_,t[68]=a,t[69]=r,t[70]=i,t[71]=o):o=t[71],te=o,J=te.ok,re=N4(ee),ie=ee?j4([ee]):null,t[54]=_,t[55]=a,t[56]=n.nodeId,t[57]=n.selectedIds,t[58]=i,t[59]=J,t[60]=ee,t[61]=te,t[62]=ne,t[63]=re,t[64]=ie}else J=t[59],ee=t[60],te=t[61],ne=t[62],re=t[63],ie=t[64];let ae=ie,oe=n.position.y+Vxe+Bxe>window.innerHeight,se=ee?.data.label||`Step`,ce=`min(${n.position.x}px, calc(100vw - 296px))`,le;t[72]!==n.position.y||t[73]!==oe?(le=oe?{bottom:`calc(100vh - ${n.position.y}px)`}:{top:n.position.y},t[72]=n.position.y,t[73]=oe,t[74]=le):le=t[74];let ue;t[75]!==ce||t[76]!==le?(ue={left:ce,...le},t[75]=ce,t[76]=le,t[77]=ue):ue=t[77];let de;t[78]!==J||t[79]!==ae||t[80]!==te.error||t[81]!==te.ok||t[82]!==j||t[83]!==C||t[84]!==N||t[85]!==T||t[86]!==F||t[87]!==L||t[88]!==ne||t[89]!==n.type||t[90]!==se||t[91]!==re?(de=n.type===`node`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(v9,{icon:(0,X.jsx)(kte,{className:`size-4`}),label:`Edit ${se}`,onClick:T}),(0,X.jsx)(v9,{disabled:ne,icon:(0,X.jsx)($v,{className:`size-4`}),label:`Copy`,onClick:j,shortcut:_9(`C`)}),(0,X.jsx)(v9,{disabled:ne,icon:(0,X.jsx)(ute,{className:`size-4`}),label:`Duplicate`,onClick:N,shortcut:_9(`D`)}),(0,X.jsx)(v9,{disabled:!J,hint:!J&&!te.ok?te.error:void 0,icon:(0,X.jsx)(mte,{className:`size-4`}),label:`Group`,onClick:F,shortcut:_9(`G`)}),(0,X.jsx)(v9,{disabled:!re,icon:(0,X.jsx)(my,{className:`size-4`}),label:`Ungroup`,onClick:L}),(0,X.jsx)(v9,{disabled:ne||!!ae,hint:ae??void 0,icon:(0,X.jsx)(fy,{className:`size-4`}),label:`Delete ${se}`,onClick:C,variant:`destructive`})]}),t[78]=J,t[79]=ae,t[80]=te.error,t[81]=te.ok,t[82]=j,t[83]=C,t[84]=N,t[85]=T,t[86]=F,t[87]=L,t[88]=ne,t[89]=n.type,t[90]=se,t[91]=re,t[92]=de):de=t[92];let fe;t[93]!==D||t[94]!==n.type?(fe=n.type===`edge`&&(0,X.jsx)(v9,{icon:(0,X.jsx)(_te,{className:`size-4`}),label:`Delete Connection`,onClick:D,variant:`destructive`}),t[93]=D,t[94]=n.type,t[95]=fe):fe=t[95];let pe;t[96]!==k||t[97]!==z||t[98]!==m||t[99]!==n.type?(pe=n.type===`pane`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(v9,{icon:(0,X.jsx)(cy,{className:`size-4`}),label:`Add Step`,onClick:k}),(0,X.jsx)(v9,{disabled:!m,icon:(0,X.jsx)(lte,{className:`size-4`}),label:`Paste`,onClick:z,shortcut:_9(`V`)})]}),t[96]=k,t[97]=z,t[98]=m,t[99]=n.type,t[100]=pe):pe=t[100];let me;return t[101]!==ue||t[102]!==de||t[103]!==fe||t[104]!==pe?(me=(0,Xi.createPortal)((0,X.jsxs)(`div`,{className:`fade-in-0 zoom-in-95 fixed z-50 max-h-[calc(100vh-1rem)] w-fit min-w-[8rem] max-w-72 animate-in overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md`,ref:x,style:ue,children:[de,fe,pe]}),document.body),t[101]=ue,t[102]=de,t[103]=fe,t[104]=pe,t[105]=me):me=t[105],me}function _9(e){return typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?`⌘${e}`:`Ctrl+${e}`}function v9(e){let t=(0,Z.c)(23),{icon:n,label:r,onClick:i,variant:a,disabled:o,hint:s,shortcut:c}=e,l=(a===void 0?`default`:a)===`destructive`&&`text-destructive hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive`,u=o&&`pointer-events-none opacity-50`,d;t[0]!==l||t[1]!==u?(d=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none`,`hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground`,l,u),t[0]=l,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,X.jsx)(`span`,{className:`shrink-0`,children:n}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,X.jsx)(`span`,{className:`w-full truncate`,children:r}),t[5]=r,t[6]=p);let m;t[7]===s?m=t[8]:(m=s?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs leading-tight`,children:s}):null,t[7]=s,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col items-start text-left`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==o||t[13]!==c?(g=c&&!o?(0,X.jsx)(`span`,{className:`ml-auto shrink-0 pl-4 text-muted-foreground text-xs tracking-widest`,children:c}):null,t[12]=o,t[13]=c,t[14]=g):g=t[14];let _;return t[15]!==o||t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==f||t[20]!==h||t[21]!==g?(_=(0,X.jsxs)(`button`,{className:d,disabled:o,onClick:i,title:s,type:`button`,children:[f,h,g]}),t[15]=o,t[16]=s,t[17]=i,t[18]=d,t[19]=f,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}function Uxe(e,t,n){let r=(0,Z.c)(12),i;r[0]!==n||r[1]!==t?(i=(e,r)=>{e.preventDefault(),t({type:`node`,position:{x:e.clientX,y:e.clientY},nodeId:r.id,selectedIds:n()})},r[0]=n,r[1]=t,r[2]=i):i=r[2];let a=i,o;r[3]===t?o=r[4]:(o=(e,n)=>{e.preventDefault(),t({type:`edge`,position:{x:e.clientX,y:e.clientY},edgeId:n.id})},r[3]=t,r[4]=o);let s=o,c;r[5]!==e||r[6]!==t?(c=n=>{n.preventDefault();let r=e({x:n.clientX,y:n.clientY});t({type:`pane`,position:{x:n.clientX,y:n.clientY},flowPosition:r})},r[5]=e,r[6]=t,r[7]=c):c=r[7];let l=c,u;return r[8]!==s||r[9]!==a||r[10]!==l?(u={onNodeContextMenu:a,onEdgeContextMenu:s,onPaneContextMenu:l},r[8]=s,r[9]=a,r[10]=l,r[11]=u):u=r[11],u}var y9=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),b9=y9((e,t)=>{var n=Object.defineProperty,r=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t,n)=>r(e,typeof t==`symbol`?t:t+``,n),o=i((e,t)=>{var n=class{constructor(e){a(this,`_isDirected`,!0),a(this,`_isMultigraph`,!1),a(this,`_isCompound`,!1),a(this,`_label`),a(this,`_defaultNodeLabelFn`,()=>{}),a(this,`_defaultEdgeLabelFn`,()=>{}),a(this,`_nodes`,{}),a(this,`_in`,{}),a(this,`_preds`,{}),a(this,`_out`,{}),a(this,`_sucs`,{}),a(this,`_edgeObjs`,{}),a(this,`_edgeLabels`,{}),a(this,`_nodeCount`,0),a(this,`_edgeCount`,0),a(this,`_parent`),a(this,`_children`),e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){var t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,a=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(e,t,n);var u=s(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n),a=this._edgeObjs[r];return a&&(e=a.v,t=a.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}filterEdges(e,t,n){if(e){var r=Object.values(e);return n?r.filter(function(e){return e.v===t&&e.w===n||e.v===n&&e.w===t}):r}}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function s(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function c(e,t){return o(e,t.v,t.w,t.name)}t.exports=n}),s=i((e,t)=>{t.exports=`3.0.2`}),c=i((e,t)=>{t.exports={Graph:o(),version:s()}}),l=i((e,t)=>{var n=o();t.exports={write:r,read:s};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function s(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}),u=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r,a){return i(e,String(t),r||n,a||function(t){return e.outEdges(t)})}function i(e,t,n,r){var i={},a=!0,o=0,s=e.nodes(),c=function(e){var t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){var n=t.v===e?t.v:t.w;c({v:n,w:n===t.v?t.w:t.v})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0}});for(var u=s.length,d=1;d<u&&(a=!1,o++,l(),a);d++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}}),d=i((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}}),f=i((e,t)=>{t.exports=class{constructor(){a(this,`_arr`,[]),a(this,`_keyIndices`,{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}}),p=i((e,t)=>{var n=f();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}}),m=i((e,t)=>{var n=p();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}}),h=i((e,t)=>{t.exports=n;function n(e,t,n){if(e[t].predecessor!==void 0)throw Error(`Invalid source vertex`);if(e[n].predecessor===void 0&&n!==t)throw Error(`Invalid destination vertex`);return{weight:e[n].distance,path:r(e,t,n)}}function r(e,t,n){for(var r=[],i=n;i!==t;)r.push(i),i=e[i].predecessor;return r.push(t),r.reverse()}}),g=i((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}}),_=i((e,t)=>{var n=g();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}}),v=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}}),y=i((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r}),b=i((e,t)=>{var n=y();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}}),x=i((e,t)=>{t.exports=n;function n(e,t,n,i,a){Array.isArray(t)||(t=[t]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);a=r(e,t,n===`post`,s,o,i,a)}),a}function r(e,t,n,i,a,o,s){return Object.hasOwn(i,t)||(i[t]=!0,n||(s=o(s,t)),a(t).forEach(function(t){s=r(e,t,n,i,a,o,s)}),n&&(s=o(s,t))),s}}),S=i((e,t)=>{var n=x();t.exports=r;function r(e,t,r){return n(e,t,r,function(e,t){return e.push(t),e},[])}}),C=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`post`)}}),w=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`pre`)}}),T=i((e,t)=>{var n=o(),r=f();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}e.nodeEdges(s).forEach(c)}return i}}),E=i((e,t)=>{var n=p(),r=u();t.exports=i;function i(e,t,n,r){return a(e,t,n,r||function(t){return e.outEdges(t)})}function a(e,t,i,a){if(i===void 0)return n(e,t,i,a);for(var o=!1,s=e.nodes(),c=0;c<s.length;c++){for(var l=a(s[c]),u=0;u<l.length;u++){var d=l[u],f=d.v===s[c]?d.v:d.w;i({v:f,w:f===d.v?d.w:d.v})<0&&(o=!0)}if(o)return r(e,t,i,a)}return n(e,t,i,a)}}),D=i((e,t)=>{t.exports={bellmanFord:u(),components:d(),dijkstra:p(),dijkstraAll:m(),extractPath:h(),findCycles:_(),floydWarshall:v(),isAcyclic:b(),postorder:C(),preorder:w(),prim:T(),shortestPaths:E(),reduce:x(),tarjan:g(),topsort:y()}}),O=c();t.exports={Graph:O.Graph,json:l(),alg:D(),version:O.version}}),Wxe=y9((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n}),Gxe=y9((e,t)=>{var n=b9().Graph,r=Wxe();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}}),x9=y9((e,t)=>{var n=b9().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}}),Kxe=y9((e,t)=>{var n=Gxe(),r=x9().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}}),qxe=y9((e,t)=>{var n=x9();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}}),S9=y9((e,t)=>{var{applyWithChunking:n}=x9();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}),C9=y9((e,t)=>{var n=b9().Graph,r=S9().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}}),Jxe=y9((e,t)=>{var n=C9(),r=S9().slack,i=S9().longestPath,a=b9().alg.preorder,o=b9().alg.postorder,s=x9().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}}),Yxe=y9((e,t)=>{var n=S9().longestPath,r=C9(),i=Jxe();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}}),Xxe=y9((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}}),Zxe=y9((e,t)=>{var n=x9();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}),Qxe=y9((e,t)=>{var n=x9();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}}),$xe=y9((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}}),eSe=y9((e,t)=>{var n=x9();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}}),tSe=y9((e,t)=>{var n=x9().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}}),nSe=y9((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}}),rSe=y9((e,t)=>{var n=x9();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}}),iSe=y9((e,t)=>{var n=x9();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}),aSe=y9((e,t)=>{var n=nSe(),r=rSe(),i=iSe();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}}),oSe=y9((e,t)=>{var n=b9().Graph,r=x9();t.exports=i;function i(e,t,r,i){i||=e.nodes();let o=a(e),s=new n({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(n=>{let i=e.node(n),a=e.parent(n);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(s.setNode(n),s.setParent(n,a||o),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=s.edge(r,n),a=i===void 0?0:i.weight;s.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&s.setNode(n,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),s}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}}),sSe=y9((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}}),cSe=y9((e,t)=>{var n=eSe(),r=tSe(),i=aSe(),a=oSe(),o=sSe(),s=b9().Graph,c=x9();t.exports=l;function l(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t.disableOptimalOrderHeuristic)return;let p=1/0,m,h=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2,h),s=c.buildLayerMatrix(e);let i=r(e,s);i<p?(n=0,m=Object.assign({},s),p=i):i===p&&(m=structuredClone(s))}f(e,m)}function u(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return a(e,t,n,r.get(t)||[])})}function d(e,t,n){let r=new s;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let a=e.graph().root,s=i(e,a,r,t);s.vs.forEach((t,n)=>e.node(t).order=n),o(e,r,s.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}}),lSe=y9((e,t)=>{var n=b9().Graph,r=x9();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}}),uSe=y9((e,t)=>{var n=x9(),r=lSe().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=e.graph().rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}}),dSe=y9((e,t)=>{var n=Kxe(),r=qxe(),i=Yxe(),a=x9().normalizeRanks,o=Xxe(),s=x9().removeEmptyRanks,c=Zxe(),l=Qxe(),u=$xe(),d=cSe(),f=uSe(),p=x9(),m=b9().Graph;t.exports=h;function h(e,t={}){let n=t.debugTiming?p.time:p.notime;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));return n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r)),r})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>I(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>L(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>R(e)),t(` removeBorderNodes`,()=>F(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`,rankalign:`center`},b=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=B(e.graph());return t.setGraph(Object.assign({},y,z(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=z(B(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=B(e.edge(n));t.setEdge(n,Object.assign({},w,z(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function F(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function I(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function L(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function R(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function z(e,t){return p.mapValues(p.pick(e,t),Number)}function B(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}}),fSe=y9((e,t)=>{var n=x9(),r=b9().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}}),pSe=y9((e,t)=>{t.exports=`2.0.4`}),w9=y9((e,t)=>{t.exports={graphlib:b9(),layout:dSe(),debug:fSe(),util:{time:x9().time,notime:x9().notime},version:pSe()}})();function mSe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function hSe(){return this.eachAfter(mSe)}function gSe(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function _Se(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function vSe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function ySe(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function bSe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function xSe(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function SSe(e){for(var t=this,n=CSe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function CSe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function wSe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function TSe(){return Array.from(this)}function ESe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function DSe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*OSe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function T9(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=jSe)):t===void 0&&(t=ASe);for(var n=new E9(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new E9(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(NSe)}function kSe(){return T9(this).eachBefore(MSe)}function ASe(e){return e.children}function jSe(e){return Array.isArray(e)?e[1]:null}function MSe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function NSe(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function E9(e){this.data=e,this.depth=this.height=0,this.parent=null}E9.prototype=T9.prototype={constructor:E9,count:hSe,each:gSe,eachAfter:vSe,eachBefore:_Se,find:ySe,sum:bSe,sort:xSe,path:SSe,ancestors:wSe,descendants:TSe,leaves:ESe,links:DSe,copy:kSe,[Symbol.iterator]:OSe};function PSe(e,t){return e.parent===t.parent?1:2}function D9(e){var t=e.children;return t?t[0]:e.t}function O9(e){var t=e.children;return t?t[t.length-1]:e.t}function FSe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function ISe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function LSe(e,t,n){return e.a.parent===t.parent?e.a:n}function k9(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}k9.prototype=Object.create(E9.prototype);function RSe(e){for(var t=new k9(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new k9(a[o],o)),i.parent=n;return(t.parent=new k9(null,0)).children=[t],t}function zSe(){var e=PSe,t=1,n=1,r=null;function i(i){var s=RSe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.x<l.x&&(l=e),e.x>u.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){ISe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=O9(o),i=D9(i),o&&i;)s=D9(s),a=O9(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(FSe(LSe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!O9(a)&&(a.t=o,a.m+=u-l),i&&!D9(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var BSe=`TB`,A9=40,j9=`__workflow-root__`;function VSe(e,t){return e.x!==t.x||e.y!==t.y}function HSe(e){return e.sourceHandle===`true`?4:e.sourceHandle===`false`?3:Y6(e.sourceHandle)?4:6}function USe(e){return typeof e==`number`&&Number.isFinite(e)&&e<1024?{nodeSpacing:96,rankSpacing:72}:{nodeSpacing:132,rankSpacing:88}}function WSe(e,t){let n=e.node(t);return n?.x===void 0||n.y===void 0?null:{x:n.x,y:n.y}}var GSe=[O2,k2],KSe=[`true`,`false`],qSe=2**53-1;function M9(e,t){return{width:192,height:112,outletHandles:e,holdsOutletsOpen:t}}function JSe(e){if(E0(e.node)){let t=e.nodes.filter(t=>t.parentId===e.node.id).map(e=>e.id),n=new Set(t),{bounds:r}=V0(t,e.edges.filter(e=>n.has(e.source)&&n.has(e.target)),D0(e.node)),i=T4(r.columns,r.rows);return{width:i.width,height:i.height,outletHandles:[],holdsOutletsOpen:!1}}if(Kue(e.node))return M9(GSe,!0);if(x0(e.node))return M9(KSe,!0);if(!X6(e.node))return M9([],!1);let t=t8({targetNodeId:e.node.id,nodes:e.nodes,edges:e.edges,catalog:e.catalog});return{width:E4(t.length),height:112,outletHandles:t.map(e=>J6(e.name)),holdsOutletsOpen:!1}}function N9(e,t){return e.get(t??``)??qSe}function YSe(e){let t=t=>e.positionXById.get(t)??0;return e.edges.toSorted((n,r)=>{let i=N9(e.ranks,n.sourceHandle)-N9(e.ranks,r.sourceHandle);return i===0?t(n.target)-t(r.target):i})}function XSe(e){let t=new Set(e.edges.map(e=>e.sourceHandle??``)),n=e.shape.holdsOutletsOpen?e.shape.outletHandles.filter(e=>!t.has(e)):[];return n.length===0||n.length===e.shape.outletHandles.length?e.edges.map(e=>e.target):[...e.edges.map(t=>({rank:N9(e.ranks,t.sourceHandle),child:t.target})),...n.map(t=>({rank:N9(e.ranks,t),child:null}))].toSorted((e,t)=>e.rank-t.rank).map(e=>e.child)}function ZSe(e){let t=new Map(e.nodes.map(e=>[e.id,e.position.x])),n=new Map(e.nodes.map(e=>[e.id,[]]));for(let t of e.edges)n.get(t.source)?.push(t);let r=new Map,i=new Map;for(let a of e.nodes){let o=JSe({node:a,nodes:e.allNodes,edges:e.allEdges,catalog:e.catalog});r.set(a.id,{width:o.width,height:o.height});let s=new Map(o.outletHandles.map((e,t)=>[e,t])),c=YSe({edges:n.get(a.id)??[],ranks:s,positionXById:t});n.set(a.id,c),i.set(a.id,XSe({edges:c,shape:o,ranks:s}))}return{nodes:e.nodes.toSorted((e,t)=>e.position.x-t.position.x),sizeById:r,outEdgesBySource:n,treeChildrenBySource:i}}function P9(e,t){return e.sizeById.get(t)??{width:192,height:112}}function QSe(e){let t=new w9.graphlib.Graph({directed:!0,multigraph:!1,compound:!1});t.setGraph({rankdir:BSe,nodesep:e.spacing.nodeSpacing,ranksep:e.spacing.rankSpacing,marginx:A9,marginy:A9}),t.setDefaultEdgeLabel(()=>({}));for(let n of e.model.nodes)t.setNode(n.id,P9(e.model,n.id));for(let n of e.model.nodes)for(let r of e.model.outEdgesBySource.get(n.id)??[])t.setEdge(r.source,r.target,{weight:HSe(r)});w9.layout(t);let n=new Map;for(let r of e.model.nodes){let i=WSe(t,r.id);if(!i)continue;let a=P9(e.model,r.id);n.set(r.id,{x:Math.round(i.x-a.width/2),y:Math.round(i.y-a.height/2)})}return n}function $Se(e){let t=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.outEdgesBySource.values())for(let e of n)if(e.source===e.target||(t.set(e.target,(t.get(e.target)??0)+1),(t.get(e.target)??0)>1))return null;let n=e.nodes.filter(e=>(t.get(e.id)??0)===0);if(n.length===0)return null;let r=new Set,i=new Set;function a(t){if(i.has(t))return null;i.add(t),r.add(t);let n=[];for(let r of e.treeChildrenBySource.get(t)??[]){if(r===null){n.push({id:null});continue}let e=a(r);if(!e)return null;n.push(e)}return i.delete(t),n.length===0?{id:t}:{id:t,children:n}}let o=[];for(let e of n){let t=a(e.id);if(!t)return null;o.push(t)}return r.size===e.nodes.length?{id:j9,children:o}:null}function eCe(e){let t=0;for(let n of e.placed)t=Math.max(t,n.depth);let n=Array.from({length:t},()=>0);for(let t of e.placed){let r=t.depth-1;n[r]=Math.max(n[r],e.heightOf(t.id))}let r=Array.from({length:t},()=>0),i=0;for(let a=0;a<t;a+=1)r[a]=i,i+=n[a]+e.rankSpacing;return{tops:r,heights:n}}function tCe(e){let t=$Se(e.model);if(!t)return null;let n=t=>t===null?192:P9(e.model,t).width,r=t=>P9(e.model,t).height,i=T9(t,e=>e.children??[]),a=192+e.spacing.nodeSpacing;zSe().nodeSize([a,112+e.spacing.rankSpacing]).separation((t,r)=>{let i=t.parent===r.parent?e.spacing.nodeSpacing:e.spacing.nodeSpacing*2;return(n(t.data.id)/2+n(r.data.id)/2+i)/a})(i);let o=[];for(let e of i.descendants()){let t=e.data.id;t!==null&&t!==j9&&o.push({id:t,depth:e.depth,centerX:e.x??0})}if(o.length===0)return new Map;let s=eCe({placed:o,heightOf:r,rankSpacing:e.spacing.rankSpacing}),c=new Map;for(let e of o){let t=e.depth-1;c.set(e.id,{x:e.centerX-n(e.id)/2,y:(s.tops[t]??0)+((s.heights[t]??0)-r(e.id))/2})}let l=Array.from(c.values()),u=Math.min(...l.map(e=>e.x)),d=Math.min(...l.map(e=>e.y)),f=new Map;for(let[e,t]of c)f.set(e,{x:Math.round(t.x-u+A9),y:Math.round(t.y-d+A9)});return f}function nCe(e){return e.type!==`add`&&!e.parentId}function rCe(e){let t=e.nodes.filter(nCe);if(t.length===0)return{nodes:e.nodes,changed:!1};let n=new Set(t.map(e=>e.id)),r=Xue(e.nodes,e.edges).filter(e=>n.has(e.source)&&n.has(e.target)),i=USe(e.availableWidth),a=ZSe({nodes:t,allNodes:e.nodes,edges:r,allEdges:e.edges,catalog:e.catalog}),o=tCe({model:a,spacing:i})??QSe({model:a,spacing:i}),s=Wfe(e.nodes.map(e=>{let t=o.get(e.id);return t?{...e,position:t}:e}),e.edges),c=new Map(e.nodes.map(e=>[e.id,e]));return{nodes:s,changed:s.some(e=>{let t=c.get(e.id);return!t||VSe(t.position,e.position)||t.width!==e.width||t.height!==e.height})}}var iCe={[H1]:Xbe.Animated},aCe={type:H1},oCe={lifecycle:g9,action:f9,add:Fxe,group:p9};function sCe(){let e=yy(),t=wA(tpe),n=wA(npe),r=wA(Q4),i=wA(t3),a=wA(Z0),[o]=EA(g2),s=AY(),{openSheet:c}=D7(),l=wA(Cde),u=s?null:l,[d,f]=EA(_2),p=TA(lpe),m=TA(upe),h=TA(V4),g=TA(H4),_=TA(l3),v=TA(fpe),y=TA($fe),b=TA(cpe),x=TA(ope),S=TA(g3),C=TA(_3),w=TA(h2),{screenToFlowPosition:T,fitView:E,getViewport:D,setViewport:O}=RE(),k=(0,Y.useRef)(null),A=(0,Y.useRef)(null),j=(0,Y.useRef)(null),M=(0,Y.useRef)(!1),N=(0,Y.useRef)(!1),P=(0,Y.useRef)(null),F=(0,Y.useRef)(0),I=(0,Y.useRef)(!1),[L,R]=(0,Y.useState)(!1),[z,B]=(0,Y.useState)(!1),[V,H]=(0,Y.useState)(null),U=(0,Y.useRef)(new Set);gY(window,`pointerdown`,e=>{e.button===2&&(U.current=new Set(t.filter(e=>e.selected).map(e=>e.id)))},{capture:!0,enabled:!i});let{onNodeContextMenu:W,onEdgeContextMenu:G,onPaneContextMenu:K}=Uxe(T,H,(0,Y.useCallback)(()=>U.current,[])),q=(0,Y.useCallback)(()=>{H(null)},[]),J=t.some(e=>e.type!==`add`),ee=(0,Y.useMemo)(()=>t.filter(e=>e.type!==`add`).length,[t]),te=(0,Y.useRef)(!1);_Y(d,()=>{if(!d||te.current||(te.current=!0,document.cookie.split(`; `).find(e=>e.startsWith(`sidebar-collapsed=`))?.split(`=`)[1]===`true`))return;let e=D(),t=window.innerWidth*.3/2;O({...e,x:e.x-t},{duration:0})}),vY(a,()=>{if(d&&N.current){R(!0),f(!1);return}E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0),f(!1)}),vY(!a&&J,()=>{a||!J||(E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0))});let ne=(0,Y.useCallback)(e=>{!(e.metaKey||e.ctrlKey)||e.key.toLowerCase()!==`z`||z7(e.target)||i||(e.preventDefault(),e.shiftKey?C():S())},[S,C,i]);gY(window,`keydown`,ne),Lxe(!i),zxe();let re=(0,Y.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`/`&&(e.preventDefault(),E({padding:.2,duration:300}))},[E]);gY(window,`keydown`,re);let ie=(0,Y.useCallback)(()=>{if(i||ee<2||I.current)return;I.current=!0,B(!0);let r=F.current+1;F.current=r;try{let i=P.current?.getBoundingClientRect().width??(typeof window<`u`?window.innerWidth:void 0),{nodes:a,changed:o}=rCe({nodes:t,edges:n,availableWidth:i,catalog:e});if(r!==F.current)return;o&&v(a),window.requestAnimationFrame(()=>{Promise.resolve(E({maxZoom:1,minZoom:.5,padding:.2,duration:300})).catch(()=>void 0)})}finally{r===F.current&&(I.current=!1,B(!1))}},[v,n,E,i,t,ee,e]),ae=(0,Y.useCallback)((e,n)=>{let r=t.find(t=>t.id===e);return!r||r.type===`add`||r.parentId?!1:n!==`target`||r.type!==`lifecycle`},[t]),oe=(0,Y.useCallback)(i=>{let a=i.source,o=i.target;if(!(a&&o)||a===o)return!1;let s=t.find(e=>e.id===a),c=t.find(e=>e.id===o);if(s?.parentId||c?.parentId)return!1;let l=`id`in i&&typeof i.id==`string`?i.id:null,u=W7({nodes:t,edges:n,sourceNodeId:a,sourceHandle:`sourceHandle`in i?i.sourceHandle:void 0,catalog:e}),d=P0({nodes:t,edges:r,sourceId:a,targetId:o,sourceHandle:u,excludeEdgeId:l});if(d.length===0)return!1;let f=[...r.filter(e=>e.id!==l),...d];return!qbe({nodes:t,edges:f})},[e,n,t,r]),se=(0,Y.useCallback)((r,i)=>W7({nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:e}),[t,n,e]),ce=(0,Y.useCallback)(e=>{if(!(e.source&&e.target)||!oe(e))return;let t=se(e.source,e.sourceHandle),n={id:l0(),...e,sourceHandle:t};y(n)},[se,oe,y]),le=(0,Y.useCallback)(({nodes:e,edges:t})=>!(e.some(e=>e.data.type!==`lifecycle`)||t.length>0)||M4(e)?Promise.resolve(!1):(x(),Promise.resolve(!0)),[x]),ue=(0,Y.useCallback)((e,t)=>{h(t.id),w(`properties`),s&&c()},[h,w,s,c]),de=(0,Y.useCallback)((e,t)=>{k.current=t.nodeId,A.current=t.handleType,j.current=t.handleId??null},[]),fe=(0,Y.useCallback)(e=>({clientX:`changedTouches`in e?e.changedTouches[0].clientX:e.clientX,clientY:`changedTouches`in e?e.changedTouches[0].clientY:e.clientY}),[]),pe=(0,Y.useCallback)((e,t,n)=>{let r=(e.target instanceof Element?e.target:void 0)?.closest(`.react-flow`)?.getBoundingClientRect();return{adjustedX:r?t-r.left:t,adjustedY:r?n-r.top:n}},[]),me=(0,Y.useCallback)(e=>{let t=e.getAttribute(`data-id`),n=A.current===`source`,r=n?`target`:`source`,i=k.current;if(t&&i&&t!==i&&ae(t,r)){let e=n?i:t,r=n?t:i,a=se(e,n?j.current:null),o=n?null:j.current;ce({source:e,target:r,sourceHandle:a,targetHandle:o})}},[ae,se,ce]),he=(0,Y.useCallback)((e,t,n)=>{let r=k.current;if(!r)return;let i=A.current===`source`;if(!(i||oe({source:`__new_node__`,target:r,sourceHandle:null,targetHandle:null})))return;let{adjustedX:a,adjustedY:o}=pe(e,t,n),s=T({x:a,y:o});s.y-=56;let c={id:l0(),type:`action`,position:s,data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};_(c),h(c.id),w(`properties`),setTimeout(()=>{b(c.id)},50);let l=i?r:c.id,u=i?c.id:r,d=se(l,i?j.current:null),f=i?null:j.current;ce({source:l,target:u,sourceHandle:d,targetHandle:f}),M.current=!0,setTimeout(()=>{M.current=!1},100)},[pe,T,_,b,h,w,se,ce,oe]),ge=(0,Y.useCallback)(e=>{if(!k.current)return;let{clientX:t,clientY:n}=fe(e),r;if(r=`changedTouches`in e?document.elementFromPoint(t,n):e.target instanceof Element?e.target:null,!r){k.current=null,A.current=null,j.current=null;return}let i=r.closest(`.react-flow__node`),a=r.closest(`.react-flow__handle`);if(i&&!a&&A.current){me(i),k.current=null,A.current=null,j.current=null;return}i||a||he(e,t,n),k.current=null,A.current=null,j.current=null},[fe,me,he]),_e=(0,Y.useCallback)(()=>{M.current||(h(null),g(null),q())},[h,g,q]),ve=(0,Y.useCallback)(({nodes:e})=>{M.current&&e.length===0||(e.length===0?h(null):e.length===1&&h(e[0].id))},[h]);return(0,X.jsxs)(`div`,{className:`relative h-full bg-background`,"data-testid":`workflow-canvas`,ref:P,style:{opacity:+!!L,width:u?`calc(100% - ${u})`:`100%`,transition:`opacity 300ms`},children:[(0,X.jsx)(`div`,{className:`pointer-events-auto`,children:(0,X.jsx)(Vbe,{workflowId:a??void 0})}),(0,X.jsxs)(Vye,{className:`bg-background`,connectionLineComponent:Wye,connectionMode:dw.Strict,defaultEdgeOptions:aCe,edges:n,edgeTypes:iCe,elementsSelectable:!i,isValidConnection:oe,nodes:t,nodesConnectable:!i,nodesDraggable:!i,nodeTypes:oCe,onBeforeDelete:le,onConnect:i?void 0:ce,onConnectEnd:i?void 0:ge,onConnectStart:i?void 0:de,onEdgeContextMenu:i?void 0:G,onEdgesChange:i?void 0:m,onNodeClick:i?void 0:ue,onNodeContextMenu:i?void 0:W,onNodesChange:i?void 0:p,onPaneClick:_e,onPaneContextMenu:i?void 0:K,onSelectionChange:i?void 0:ve,children:[(0,X.jsx)(Zbe,{className:`workflow-controls-panel border-none bg-transparent p-0`,position:`bottom-left`,children:(0,X.jsx)(Kye,{canReflow:!i&&ee>1&&!z,onReflow:i?void 0:ie})}),o&&(0,X.jsx)(Ek,{bgColor:`var(--sidebar)`,className:`rounded-lg border shadow-sm`,maskColor:`color-mix(in oklch, var(--muted) 60%, transparent)`,nodeColor:`var(--muted-foreground)`,nodeStrokeColor:`var(--border)`})]}),(0,X.jsx)(Hxe,{menuState:V,onClose:q})]})}var cCe=/^\/workflows\/[^/]+$/;function lCe(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={select:uCe},e[0]=t):t=e[0];let n=za(t);if(!cCe.test(n))return null;let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`div`,{className:`fixed inset-0 z-0`,children:(0,X.jsx)(sCe,{})}),e[1]=r):r=e[1],r}function uCe(e){return e.location.pathname}var F9=pA(),I9=`The workflow could not be loaded. Try again.`;function dCe(e){return e instanceof Y1&&e.status===404?{notFound:!0,message:null}:{notFound:!1,message:I9}}function fCe(e){return e?`runs`:null}var pCe=ma(`/workflows/$workflowId`);function mCe(){let e=(0,Z.c)(19),t=wA(Z0),[n,r]=EA(D2),i=TA(B4),a=TA(vpe),{executionId:o}=pCe.useSearch(),s;e[0]===o?s=e[1]:(s=n0.workflow.getExecutionLogs.queryOptions({input:{executionId:o??``},select:rye}),e[0]=o,e[1]=s);let c=o!==void 0,l;e[2]!==s||e[3]!==c?(l={...s,enabled:c,staleTime:0},e[2]=s,e[3]=c,e[4]=l):l=e[4];let u=Xe(l),d=u.data?.workflowVersionId,f;e[5]===d?f=e[6]:(f=n0.workflow.getVersionGraph.queryOptions({input:{versionId:d??``},select:gCe}),e[5]=d,e[6]=f);let p=d!==void 0,m;e[7]!==f||e[8]!==p?(m={...f,enabled:p,staleTime:1/0},e[7]=f,e[8]=p,e[9]=m):m=e[9];let h=Xe(m),g=u.data,_=h.data,v=g!==void 0&&_!==void 0&&g.workflowId===t,y;e[10]!==t||e[11]!==g||e[12]!==o||e[13]!==_||e[14]!==a||e[15]!==n||e[16]!==i||e[17]!==r?(y=()=>{if(o===void 0){r(null),i(null);return}if(n!==o&&a(),r(o),g===void 0||_===void 0||g.workflowId!==t){i(null);return}let e=V1(_);i({nodes:e.nodes.map(hCe),edges:e.edges.map(q1)})},e[10]=t,e[11]=g,e[12]=o,e[13]=_,e[14]=a,e[15]=n,e[16]=i,e[17]=r,e[18]=y):y=e[18],_Y(o===void 0?`closed`:v?`ready:${o}:${t}`:`open:${o}:${t??``}`,y)}function hCe(e){return{...K1(e),selected:!1}}function gCe(e){return e.graph}function _Ce(){return mCe(),null}function vCe(e){return $J(`alert-dialog`,e)}function L9(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(vCe,{"data-slot":`alert-dialog`,...n}),t[2]=n,t[3]=r),r}function yCe(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(IJ,{"data-slot":`alert-dialog-portal`,...n}),t[2]=n,t[3]=r),r}function bCe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`data-[starting-style]:fade-in-0 data-[ending-style]:fade-out-0 fixed inset-0 z-50 bg-foreground/50 data-[closed]:animate-out data-[open]:animate-in`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(aH,{className:i,"data-slot":`alert-dialog-overlay`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function R9(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(bCe,{}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 grid w-full max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[closed]:animate-out data-[open]:animate-in`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,X.jsxs)(yCe,{children:[i,(0,X.jsx)(tY,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:(0,X.jsx)(NJ,{className:a,"data-slot":`alert-dialog-content`,...r})})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function z9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function V9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold text-lg`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nY,{className:i,"data-slot":`alert-dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function H9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(PH,{className:i,"data-slot":`alert-dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U9(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=Q(Rv({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,X.jsx)(OH,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function W9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Rv({variant:`outline`}),n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(OH,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function xCe(e){let t=(0,Z.c)(18),{open:n,onOpenChange:r,onConfirm:i,title:a,description:o,confirmLabel:s}=e,c=a===void 0?`Delete`:a,l=o===void 0?`Are you sure? This action cannot be undone.`:o,u=s===void 0?`Delete`:s,d;t[0]===c?d=t[1]:(d=(0,X.jsx)(V9,{children:c}),t[0]=c,t[1]=d);let f;t[2]===l?f=t[3]:(f=(0,X.jsx)(H9,{children:l}),t[2]=l,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,X.jsxs)(z9,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(W9,{children:`Cancel`}),t[7]=m):m=t[7];let h;t[8]!==u||t[9]!==i?(h=(0,X.jsxs)(B9,{children:[m,(0,X.jsx)(U9,{onClick:i,variant:`destructive`,children:u})]}),t[8]=u,t[9]=i,t[10]=h):h=t[10];let g;t[11]!==p||t[12]!==h?(g=(0,X.jsxs)(R9,{children:[p,h]}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;return t[14]!==r||t[15]!==n||t[16]!==g?(_=(0,X.jsx)(L9,{onOpenChange:r,open:n,children:g}),t[14]=r,t[15]=n,t[16]=g,t[17]=_):_=t[17],_}var SCe=4;function CCe(){let e=(0,Z.c)(11),[t,n]=(0,Y.useState)(null),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={confirm:n,tabs:`top`},e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(T7,{frame:i}),e[1]=a):a=e[1];let o=t?.confirmLabel,s=t?.message,c;e[2]===t?c=e[3]:(c=()=>t?.onConfirm(),e[2]=t,e[3]=c);let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{e||n(null)},e[4]=l):l=e[4];let u=t!==null,d=t?.title,f;return e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==u||e[9]!==d?(f=(0,X.jsxs)(`aside`,{className:`flex size-full flex-col overflow-hidden bg-card`,children:[a,(0,X.jsx)(xCe,{confirmLabel:o,description:s,onConfirm:c,onOpenChange:l,open:u,title:d})]}),e[5]=o,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f):f=e[10],f}function wCe(){let e=(0,Z.c)(29),t=AY(),[n,r]=EA(y2),[i,a]=EA(x2),o=wA(V4),{hasOverlays:s}=LY(),{openSheet:c}=D7(),l=c7(),u;e[0]!==s||e[1]!==t||e[2]!==c||e[3]!==o?(u=()=>{t&&o&&!s&&c()},e[0]=s,e[1]=t,e[2]=c,e[3]=o,e[4]=u):u=e[4],_Y(t,u);let d;e[5]!==l||e[6]!==r?(d=e=>{e&&l(),r(e)},e[5]=l,e[6]=r,e[7]=d):d=e[7];let f=d,[p,m]=(0,Y.useState)(!1),h=(0,Y.useRef)(!1),g;e[8]!==n||e[9]!==f?(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`b`&&(e.preventDefault(),f(!n))},e[8]=n,e[9]=f,e[10]=g):g=e[10],gY(window,`keydown`,g);let _;e[11]!==n||e[12]!==f||e[13]!==a?(_=e=>{e.preventDefault(),h.current=!0,m(!0);let t=e.clientX,r=!1,i=e=>{if(!h.current||(Math.abs(e.clientX-t)>SCe&&(r=!0),!r))return;let n=(window.innerWidth-e.clientX)/window.innerWidth*100;a(Math.min(50,Math.max(20,n)))},o=()=>{h.current=!1,m(!1),document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,o),document.removeEventListener(`pointercancel`,o),document.body.style.cursor=``,document.body.style.userSelect=``,r||f(!n)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,o),document.addEventListener(`pointercancel`,o),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},e[11]=n,e[12]=f,e[13]=a,e[14]=_):_=e[14];let v=_,y;e[15]!==t||e[16]!==n||e[17]!==f?(y=!t&&n&&(0,X.jsx)(`button`,{className:`pointer-events-auto absolute top-1/2 right-0 z-20 flex size-6 -translate-y-1/2 items-center justify-center rounded-l-full border border-r-0 bg-background shadow-sm transition-colors hover:bg-muted`,onClick:()=>{f(!1)},type:`button`,children:(0,X.jsx)(Yv,{className:`size-4`})}),e[15]=t,e[16]=n,e[17]=f,e[18]=y):y=e[18];let b;e[19]!==v||e[20]!==p||e[21]!==t||e[22]!==n||e[23]!==i||e[24]!==f?(b=!t&&(0,X.jsxs)(`div`,{className:`workflow-sidebar-panel pointer-events-auto absolute inset-y-0 right-0 z-20 border-l bg-sidebar transition-transform duration-200 ease-out`,style:{width:S2(i),transform:n?`translateX(100%)`:`translateX(0)`},children:[(0,X.jsxs)(`div`,{"aria-label":`Resize properties panel. Click to collapse.`,"aria-orientation":`vertical`,"aria-valuenow":i,className:`group absolute inset-y-0 left-0 z-10 w-3 cursor-col-resize`,onPointerDown:v,role:`separator`,tabIndex:0,children:[(0,X.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1 bg-transparent transition-colors group-hover:bg-ring group-active:bg-primary`}),!(p||n)&&(0,X.jsx)(`button`,{"aria-label":`Collapse panel`,className:`absolute top-1/2 left-0 flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border bg-background shadow-sm transition-opacity hover:bg-muted focus-visible:opacity-100 lg:opacity-0 lg:group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),f(!0)},onPointerDown:TCe,type:`button`,children:(0,X.jsx)(Xv,{className:`size-4`})})]}),(0,X.jsx)(CCe,{})]}),e[19]=v,e[20]=p,e[21]=t,e[22]=n,e[23]=i,e[24]=f,e[25]=b):b=e[25];let x;return e[26]!==y||e[27]!==b?(x=(0,X.jsxs)(X.Fragment,{children:[y,b]}),e[26]=y,e[27]=b,e[28]=x):x=e[28],x}function TCe(e){return e.stopPropagation()}var ECe=500,DCe=()=>{let e=(0,Z.c)(33),t=wA(w2),n=wA(o2),r=wA(Z4),i=wA(Q4),[a]=EA(Z0),[o]=EA(D2),s=wA(e3),c=TA(C2),l=TA(u2),u=TA(v3),d=wA(n2),f=wA(r2),p;e[0]===n?p=e[1]:(p=()=>{n&&Ty.error(n.message||`Failed to save workflow`)},e[0]=n,e[1]=p),_Y(n,p);let m;e[2]!==a||e[3]!==i||e[4]!==t||e[5]!==r||e[6]!==l?(m=async()=>{if(!a||t)return;let e=await l({nodes:r,edges:i},{immediate:!0});e&&!e.ok&&Ty.error(e.error.message||`Failed to save workflow`)},e[2]=a,e[3]=i,e[4]=t,e[5]=r,e[6]=l,e[7]=m):m=e[7];let h=m,g;e[8]===h?g=e[9]:(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),e.stopPropagation(),h())},e[8]=h,e[9]=g);let _=g,v;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={capture:!0},e[10]=v):v=e[10],gY(document,`keydown`,_,v);let y;e[11]===o?y=e[12]:(y=n0.workflow.getExecutionStatus.queryOptions({input:{executionId:o??``}}),e[11]=o,e[12]=y);let b=o!==null,x;e[13]!==y||e[14]!==b?(x={...y,enabled:b,staleTime:0,refetchIntervalInBackground:!1,refetchInterval:OCe},e[13]=y,e[14]=b,e[15]=x):x=e[15];let S=Xe(x).data,C;e[16]===S?.nodeStatuses?C=e[17]:(C=S?.nodeStatuses.map(kCe).join(`,`)??``,e[16]=S?.nodeStatuses,e[17]=C);let w=C,T;e[18]!==S||e[19]!==r||e[20]!==o||e[21]!==c||e[22]!==u?(T=()=>{if(!o){u(r.map(ACe)),c(!1);return}S&&(u(S.nodeStatuses.map(jCe)),c(a7(S.status)))},e[18]=S,e[19]=r,e[20]=o,e[21]=c,e[22]=u,e[23]=T):T=e[23],_Y(o===null?`idle`:`${o}:${s}:${S===void 0?`loading`:`${S.status}:${w}`}`,T);let E;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(_Ce,{}),e[24]=E):E=e[24];let D;e[25]===d?D=e[26]:(D=d&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Workflow Not Found`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:`The workflow you're looking for doesn't exist or has been deleted.`}),(0,X.jsx)(zv,{render:(0,X.jsx)(fa,{to:`/`}),children:`Go to Dashboard`})]})}),e[25]=d,e[26]=D);let O;e[27]===f?O=e[28]:(O=f&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Couldn't Load Workflow`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:f}),(0,X.jsx)(zv,{onClick:MCe,children:`Try Again`})]})}),e[27]=f,e[28]=O);let k;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(wCe,{}),e[29]=k):k=e[29];let A;return e[30]!==D||e[31]!==O?(A=(0,X.jsxs)(`div`,{className:`flex h-dvh w-full flex-col overflow-hidden`,children:[E,D,O,k]}),e[30]=D,e[31]=O,e[32]=A):A=e[32],A};function OCe(e){return a7(e.state.data?.status)?ECe:!1}function kCe(e){return`${e.nodeId}=${e.status}`}function ACe(e){return{nodeId:e.id,status:`idle`}}function jCe(e){return{nodeId:e.nodeId,status:e.status===`pending`?`idle`:e.status}}function MCe(){return window.location.reload()}var NCe=jy(`workflows`),G9=3,K9=[`running`,`waiting`,`failed`,`completed`,`canceled`,`pending`],PCe=[...K9,`superseded`];function FCe(e){if(!e)return`-`;let t=Number.parseInt(e,10);return Number.isNaN(t)?e:t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}var ICe=100;function LCe(e){return e.toSorted(RCe)}function RCe(e,t){return new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()}function zCe(e){return e===`pause`?`Paused`:e===`resume`?`Resumed`:`Deleted`}function q9(e,t,n){return e===1?t:n}function BCe(){let e=(0,Z.c)(165),t=Gi(),n=Fe(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,e[0]=r):r=e[0];let[i,a]=(0,Y.useState)(r),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Set,e[1]=o):o=e[1];let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(0),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(null),y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=n0.workflow.getAll.queryOptions({input:{},select:LCe,meta:{errorMessage:`Failed to load workflows`}}),e[2]=y):y=e[2];let{data:b,isPending:x}=Xe(y),S;e[3]===b?S=e[4]:(S=b===void 0?[]:b,e[3]=b,e[4]=S);let C=S,w;e[5]===C?w=e[6]:(w=C.filter(ZCe),e[5]=C,e[6]=w);let T=w,E;e[7]===i?E=e[8]:(E=Array.from(i),e[7]=i,e[8]=E);let D=E,O;e[9]!==D||e[10]!==T?(O=D.filter(e=>T.some(t=>t.id===e&&t.isOwner!==!1)),e[9]=D,e[10]=T,e[11]=O):O=e[11];let k=O,A;e[12]!==i||e[13]!==T?(A=T.length>0&&T.every(e=>i.has(e.id)),e[12]=i,e[13]=T,e[14]=A):A=e[14];let j=A,M=l&&k.length>0,N;e[15]!==M||e[16]!==k||e[17]!==s?(N=DQ({workflowIds:M?k.toSorted():void 0,statuses:s.size>0?Array.from(s).toSorted():K9.toSorted(),limit:ICe},EQ),e[15]=M,e[16]=k,e[17]=s,e[18]=N):N=e[18];let P=N,F;e[19]===P?F=e[20]:(F=n0.workflow.getExecutionsGlobal.infiniteOptions({input:e=>({...P,cursor:e}),initialPageParam:void 0,getNextPageParam:XCe,meta:{errorMessage:`Failed to load workflow runs`}}),e[19]=P,e[20]=F);let I=Qe(F),L;e[21]===I.data?.pages?L=e[22]:(L=I.data?.pages.flatMap(YCe)??[],e[21]=I.data?.pages,e[22]=L);let R=L,z=I.isPending,B=I.isFetchingNextPage,V;e[23]===n?V=e[24]:(V=()=>i0(n),e[23]=n,e[24]=V);let H=V,U;e[25]===n?U=e[26]:(U=()=>o0(n),e[25]=n,e[26]=U);let W=U,G;e[27]===H?G=e[28]:(G=n0.workflow.update.mutationOptions({onSuccess:async(e,t)=>{let{mode:n}=t;await H(),Ty.success(n===`test`?`Switched workflow to Test mode`:`Switched workflow to Live mode`)},meta:{errorMessage:`Failed to switch workflow mode`}}),e[27]=H,e[28]=G);let K=Ze(G),q;e[29]===T?q=e[30]:(q=e=>{if(!e){a(new Set);return}a(new Set(T.map(JCe)))},e[29]=T,e[30]=q);let J=q,ee;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(e,t)=>{a(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},e[31]=ee):ee=e[31];let te=ee,ne;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},e[32]=ne):ne=e[32];let re=ne,ie;e[33]===n?ie=e[34]:(ie=n0.workflow.bulkLifecycle.mutationOptions({onSuccess:async(e,t)=>{let{action:r}=t;if(e.summary.failed===0?Ty.success(`${zCe(r)} ${e.summary.succeeded} workflow${q9(e.summary.succeeded,``,`s`)}`):Ty.error(`${r} finished with ${e.summary.failed} failure${q9(e.summary.failed,``,`s`)}`),await i0(n),r!==`delete`)return;let i=new Set(e.results.filter(qCe).map(KCe));a(e=>{let t=new Set;for(let n of e)i.has(n)||t.add(n);return t}),await o0(n)},onError:GCe,meta:{errorShownByCaller:!0}}),e[33]=n,e[34]=ie);let ae=Ze(ie),oe=ae.isPending?ae.variables.action:null,se=ae.mutate,ce;e[35]===se?ce=e[36]:(ce=(e,t)=>{t.length!==0&&se({workflowIds:t,action:e})},e[35]=se,e[36]=ce);let le=ce,ue;e[37]===C?ue=e[38]:(ue=e=>{if(e.length===0)return;let t=new Map(C.map(WCe)),n=e.map(e=>t.get(e)??`Untitled workflow`),r=e.length===1?`Delete Workflow`:`Delete Workflows`,i=e.length===1?`This will permanently delete "${n[0]}" and all of its runs and events. This cannot be undone.`:`This will permanently delete ${e.length} workflows and all of their runs and events. This cannot be undone.`;v({workflowIds:e,workflowNames:n,title:r,description:i})},e[37]=C,e[38]=ue);let de=ue,fe;e[39]!==j||e[40]!==x||e[41]!==oe||e[42]!==t||e[43]!==de||e[44]!==le||e[45]!==i||e[46]!==K||e[47]!==J||e[48]!==T?(fe=()=>x&&T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading workflows...`}):T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No workflows found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`w-10 px-4 py-2`,children:(0,X.jsx)($5,{"aria-label":`Select all workflows`,checked:j,onCheckedChange:e=>{J(e)}})}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Name`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`State`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Mode`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Updated`}),(0,X.jsx)(`th`,{className:`w-10`})]})}),(0,X.jsx)(`tbody`,{children:T.map(e=>{let n=i.has(e.id),r=e.isOwner!==!1,a=e.isPaused?`border-amber-500/30 bg-amber-500/10 text-amber-700`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-700`,o=e.isPaused?`Paused`:`Active`,s=e.mode===`test`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-zinc-500/30 bg-zinc-500/10 text-zinc-700`,c=e.mode===`test`?`Test`:`Live`,l=e.isPaused?`resume`:`pause`,u=e.isPaused?`Resume`:`Pause`;return(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsx)(`td`,{className:`px-4 py-3`,children:(0,X.jsx)($5,{"aria-label":`Select ${e.name}`,checked:n,onCheckedChange:t=>{te(e.id,t)}})}),(0,X.jsxs)(`td`,{className:`px-2 py-3`,children:[(0,X.jsx)(`button`,{className:`text-left font-medium text-foreground hover:underline`,onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},type:`button`,children:e.name}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.id})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs transition-colors duration-200 ${a}`,children:o})}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase transition-colors duration-200 ${s}`,children:c})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:u7(e.updatedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsxs)(V5,{children:[(0,X.jsx)(H5,{className:`inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50`,disabled:!r||oe!==null,children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsxs)(U5,{align:`end`,children:[(0,X.jsx)(W5,{onClick:()=>{K.mutate({workflowId:e.id,mode:e.mode===`test`?`live`:`test`})},children:e.mode===`test`?`Switch to Live`:`Switch to Test`}),(0,X.jsx)(W5,{onClick:()=>{le(l,[e.id])},children:u}),(0,X.jsx)(K5,{}),(0,X.jsx)(W5,{onClick:()=>{de([e.id])},variant:`destructive`,children:`Delete`})]})]})})]},e.id)})})]}),e[39]=j,e[40]=x,e[41]=oe,e[42]=t,e[43]=de,e[44]=le,e[45]=i,e[46]=K,e[47]=J,e[48]=T,e[49]=fe):fe=e[49];let pe=fe,me;e[50]!==z||e[51]!==t||e[52]!==R?(me=()=>z&&R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading runs...`}):R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No runs found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`px-4 py-2`,children:`Workflow`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Status`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Started`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Duration`}),(0,X.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Open`})]})}),(0,X.jsx)(`tbody`,{children:R.map(e=>(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:e.workflowName}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.workflowId})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase ${h7(e.status)}`,children:e.status})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:u7(e.startedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:FCe(e.duration)}),(0,X.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,X.jsx)(zv,{onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.workflowId},search:{executionId:e.id}})},size:`sm`,type:`button`,variant:`outline`,children:`Open`})})]},e.id))})]}),e[50]=z,e[51]=t,e[52]=R,e[53]=me):me=e[53];let he=me,ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(`h1`,{className:`font-semibold text-2xl text-foreground`,children:`Workflow Dashboard`}),e[54]=ge):ge=e[54];let _e;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[ge,(0,X.jsx)(zv,{onClick:()=>{m(UCe),f(!0)},type:`button`,children:`New Workflow`})]}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Manage workflows in bulk and review runs across every workflow. Paused workflows block new starts. Test mode makes runs execute with test-mode action behavior.`})]}),e[55]=_e):_e=e[55];let ve;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`Workflows`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Select one or more workflows to run bulk actions.`})]}),e[56]=ve):ve=e[56];let ye=x||oe!==null,be;e[57]!==H||e[58]!==ye?(be=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[ve,(0,X.jsx)(zv,{disabled:ye,onClick:H,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[57]=H,e[58]=ye,e[59]=be):be=e[59];let xe=k.length===0||oe!==null,Se;e[60]!==le||e[61]!==k?(Se=()=>{le(`pause`,k)},e[60]=le,e[61]=k,e[62]=Se):Se=e[62];let Ce;e[63]!==xe||e[64]!==Se?(Ce=(0,X.jsx)(zv,{disabled:xe,onClick:Se,size:`sm`,type:`button`,variant:`outline`,children:`Pause Selected`}),e[63]=xe,e[64]=Se,e[65]=Ce):Ce=e[65];let we=k.length===0||oe!==null,Te;e[66]!==le||e[67]!==k?(Te=()=>{le(`resume`,k)},e[66]=le,e[67]=k,e[68]=Te):Te=e[68];let Ee;e[69]!==we||e[70]!==Te?(Ee=(0,X.jsx)(zv,{disabled:we,onClick:Te,size:`sm`,type:`button`,variant:`outline`,children:`Resume Selected`}),e[69]=we,e[70]=Te,e[71]=Ee):Ee=e[71];let De=k.length===0||oe!==null,Oe;e[72]!==de||e[73]!==k?(Oe=()=>{de(k)},e[72]=de,e[73]=k,e[74]=Oe):Oe=e[74];let ke;e[75]!==De||e[76]!==Oe?(ke=(0,X.jsx)(zv,{disabled:De,onClick:Oe,size:`sm`,type:`button`,variant:`destructive`,children:`Delete Selected`}),e[75]=De,e[76]=Oe,e[77]=ke):ke=e[77];let Ae;e[78]!==Ce||e[79]!==Ee||e[80]!==ke?(Ae=(0,X.jsx)(`div`,{className:`border-b px-4 py-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ce,Ee,ke]})}),e[78]=Ce,e[79]=Ee,e[80]=ke,e[81]=Ae):Ae=e[81];let je;e[82]===pe?je=e[83]:(je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:pe()}),e[82]=pe,e[83]=je);let Me;e[84]!==be||e[85]!==Ae||e[86]!==je?(Me=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[be,Ae,je]}),e[84]=be,e[85]=Ae,e[86]=je,e[87]=Me):Me=e[87];let Ne;e[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`All Runs`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Combined run history across workflows.`})]}),e[88]=Ne):Ne=e[88];let Pe=z||B,Ie;e[89]===W?Ie=e[90]:(Ie=()=>{W()},e[89]=W,e[90]=Ie);let Le;e[91]!==Pe||e[92]!==Ie?(Le=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[Ne,(0,X.jsx)(zv,{disabled:Pe,onClick:Ie,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[91]=Pe,e[92]=Ie,e[93]=Le):Le=e[93];let Re;e[94]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>{c(new Set)},e[94]=Re):Re=e[94];let ze=s.size===0?`secondary`:`outline`,Be;e[95]===ze?Be=e[96]:(Be=(0,X.jsx)(zv,{onClick:Re,size:`sm`,type:`button`,variant:ze,children:`All statuses`}),e[95]=ze,e[96]=Be);let Ve;e[97]===s?Ve=e[98]:(Ve=PCe.map(e=>(0,X.jsx)(zv,{onClick:()=>{re(e)},size:`sm`,type:`button`,variant:s.has(e)?`secondary`:`outline`,children:e},e)),e[97]=s,e[98]=Ve);let He=k.length===0,Ue;e[99]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=()=>{u(HCe)},e[99]=Ue):Ue=e[99];let We=l?`secondary`:`outline`,Ge=l?`Showing selected workflows`:`Show selected workflows only`,Ke;e[100]!==He||e[101]!==We||e[102]!==Ge?(Ke=(0,X.jsx)(zv,{disabled:He,onClick:Ue,size:`sm`,type:`button`,variant:We,children:Ge}),e[100]=He,e[101]=We,e[102]=Ge,e[103]=Ke):Ke=e[103];let qe;e[104]!==Be||e[105]!==Ve||e[106]!==Ke?(qe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b px-4 py-2`,children:[Be,Ve,Ke]}),e[104]=Be,e[105]=Ve,e[106]=Ke,e[107]=qe):qe=e[107];let Je;e[108]===he?Je=e[109]:(Je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:he()}),e[108]=he,e[109]=Je);let Ye;e[110]!==B||e[111]!==I?(Ye=I.hasNextPage?(0,X.jsx)(`div`,{className:`border-t px-4 py-3`,children:(0,X.jsx)(zv,{disabled:B,onClick:()=>{I.fetchNextPage()},size:`sm`,type:`button`,variant:`outline`,children:B?`Loading...`:`Load more`})}):null,e[110]=B,e[111]=I,e[112]=Ye):Ye=e[112];let $e;e[113]!==Le||e[114]!==qe||e[115]!==Je||e[116]!==Ye?($e=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[Le,qe,Je,Ye]}),e[113]=Le,e[114]=qe,e[115]=Je,e[116]=Ye,e[117]=$e):$e=e[117];let et;e[118]!==Me||e[119]!==$e?(et=(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1600px] flex-col gap-6 p-6`,children:[_e,(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 xl:grid-cols-[1fr_1.5fr]`,children:[Me,$e]})]}),e[118]=Me,e[119]=$e,e[120]=et):et=e[120];let tt;e[121]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>{e||(v(null),g(``))},e[121]=tt):tt=e[121];let nt=_!==null,rt=_?.title,it;e[122]===rt?it=e[123]:(it=(0,X.jsx)(V9,{children:rt}),e[122]=rt,e[123]=it);let at=_?.description,ot;e[124]===at?ot=e[125]:(ot=(0,X.jsx)(H9,{children:at}),e[124]=at,e[125]=ot);let st;e[126]!==it||e[127]!==ot?(st=(0,X.jsxs)(z9,{children:[it,ot]}),e[126]=it,e[127]=ot,e[128]=st):st=e[128];let ct;e[129]===_?ct=e[130]:(ct=_&&_.workflowNames.length>1?(0,X.jsxs)(`ul`,{className:`list-disc pl-5 text-muted-foreground text-sm`,children:[_.workflowIds.slice(0,3).map((e,t)=>(0,X.jsx)(`li`,{children:_.workflowNames[t]},e)),_.workflowNames.length>3?(0,X.jsxs)(`li`,{children:[`and `,_.workflowNames.length-3,` more`]}):null]}):null,e[129]=_,e[130]=ct);let lt;e[131]!==_||e[132]!==h?(lt=_&&_.workflowIds.length>G9?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(wX,{htmlFor:`delete-challenge`,children:[`Type `,_.workflowIds.length,` to confirm`]}),(0,X.jsx)(CX,{autoComplete:`off`,id:`delete-challenge`,inputMode:`numeric`,onChange:e=>{g(e.target.value)},value:h})]}):null,e[131]=_,e[132]=h,e[133]=lt):lt=e[133];let ut;e[134]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,X.jsx)(W9,{children:`Cancel`}),e[134]=ut):ut=e[134];let dt;e[135]!==_||e[136]!==h?(dt=_!==null&&_.workflowIds.length>G9&&h.trim()!==String(_.workflowIds.length),e[135]=_,e[136]=h,e[137]=dt):dt=e[137];let ft;e[138]!==_||e[139]!==le?(ft=()=>{_&&(le(`delete`,_.workflowIds),v(null),g(``))},e[138]=_,e[139]=le,e[140]=ft):ft=e[140];let pt;e[141]!==dt||e[142]!==ft?(pt=(0,X.jsxs)(B9,{children:[ut,(0,X.jsx)(U9,{disabled:dt,onClick:ft,variant:`destructive`,children:`Delete`})]}),e[141]=dt,e[142]=ft,e[143]=pt):pt=e[143];let mt;e[144]!==st||e[145]!==ct||e[146]!==lt||e[147]!==pt?(mt=(0,X.jsxs)(R9,{children:[st,ct,lt,pt]}),e[144]=st,e[145]=ct,e[146]=lt,e[147]=pt,e[148]=mt):mt=e[148];let ht;e[149]!==nt||e[150]!==mt?(ht=(0,X.jsx)(L9,{onOpenChange:tt,open:nt,children:mt}),e[149]=nt,e[150]=mt,e[151]=ht):ht=e[151];let gt;e[152]===C?gt=e[153]:(gt=C.map(VCe),e[152]=C,e[153]=gt);let _t;e[154]===t?_t=e[155]:(_t=e=>t({to:`/workflows/$workflowId`,params:{workflowId:e}}),e[154]=t,e[155]=_t);let vt;e[156]!==p||e[157]!==d||e[158]!==gt||e[159]!==_t?(vt=(0,X.jsx)(j7,{existingWorkflowNames:gt,onCreated:_t,onOpenChange:f,open:d},p),e[156]=p,e[157]=d,e[158]=gt,e[159]=_t,e[160]=vt):vt=e[160];let yt;return e[161]!==et||e[162]!==ht||e[163]!==vt?(yt=(0,X.jsxs)(`div`,{className:`pointer-events-auto h-dvh overflow-auto bg-background`,children:[et,ht,vt]}),e[161]=et,e[162]=ht,e[163]=vt,e[164]=yt):yt=e[164],yt}function VCe(e){return e.name}function HCe(e){return!e}function UCe(e){return e+1}function WCe(e){return[e.id,e.name]}function GCe(e,t){let{action:n}=t;NCe.error(`Failed to ${n} workflows`,{action:n,error:e}),Ty.error(`Failed to ${n} workflows`)}function KCe(e){return e.workflowId}function qCe(e){return e.ok&&e.deleted===!0}function JCe(e){return e.id}function YCe(e){return e.items}function XCe(e){return e.nextCursor??void 0}function ZCe(e){return e.name!==`__current__`}function QCe(e){return{executionId:typeof e.executionId==`string`&&e.executionId.length>0?e.executionId:void 0}}function $Ce(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(lCe,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(BO,{children:[t,(0,X.jsx)(`div`,{className:`pointer-events-none relative z-10`,children:(0,X.jsx)(ka,{})})]}),e[1]=n):n=e[1],n}function ewe(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(sX,{attribute:`class`,defaultTheme:`system`,disableTransitionOnChange:!0,enableSystem:!0,children:(0,X.jsx)(vA,{store:F9,children:(0,X.jsxs)(PY,{children:[(0,X.jsx)($Ce,{}),(0,X.jsx)(uX,{}),(0,X.jsx)(KY,{})]})})}),e[0]=t):t=e[0],t}function J9(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(DCe,{}),e[0]=t):t=e[0],t}var Y9=ya({component:ewe}),twe=_a({getParentRoute:()=>Y9,path:`/`,component:BCe}),nwe=_a({getParentRoute:()=>Y9,path:`/workflows`,component:()=>(0,X.jsx)(Ki,{replace:!0,to:`/`})}),rwe=_a({getParentRoute:()=>Y9,path:`/workflows/$workflowId`,validateSearch:QCe,beforeLoad:({search:e})=>{let t=fCe(e.executionId);t!==null&&F9.set(h2,t)},loader:async({params:e})=>{F9.set(n2,!1),F9.set(r2,null);let[t,n]=await Promise.allSettled([My.fetchQuery(n0.workflow.getById.queryOptions({input:{workflowId:e.workflowId},staleTime:0})),My.fetchQuery(r0())]);if(t.status===`rejected`){let e=dCe(t.reason);throw F9.set(n2,e.notFound),F9.set(r2,e.message),t.reason}if(n.status===`rejected`)throw F9.set(r2,I9),n.reason;let r=e0(t.value);F9.set(ipe,{...r,nodes:J0(By(),r.nodes,n.value)})},errorComponent:J9,component:J9}),iwe=Fa({routeTree:Y9.addChildren([twe,nwe,rwe]),defaultPreload:`intent`,basepath:Sy()}),X9=e=>typeof e==`string`&&e.includes(`ResizeObserver loop`);function awe(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)return e.message}(()=>{if(window.__resizeObserverPatched||!window.ResizeObserver)return;let e=window.ResizeObserver;window.ResizeObserver=class extends e{constructor(e){super((t,n)=>{window.requestAnimationFrame(()=>e(t,n))})}},window.__resizeObserverPatched=!0})(),window.addEventListener(`error`,e=>{X9(e.message)&&(e.preventDefault(),e.stopImmediatePropagation())}),window.addEventListener(`unhandledrejection`,e=>{X9(awe(e.reason))&&e.preventDefault()});var Z9=document.getElementById(`root`);if(!Z9)throw Error(`Root element not found`);var Q9=(0,Pee.createRoot)(Z9);Q9.render((0,X.jsx)(Ite,{}));var $9=await One();Q9.render($9.ok?(0,X.jsx)(Bte,{value:By(),children:(0,X.jsx)(Vte,{value:Qh,children:(0,X.jsx)(Ie,{client:My,children:(0,X.jsx)(Ra,{router:iwe})})})}):(0,X.jsx)(Rte,{endpoint:`${Sy()}/api/extensions`,reason:$9.reason}));
|