toolroll 0.9.55 → 0.9.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +24 -8
- package/dist/action-ledger.d.ts +2 -4
- package/dist/action-ledger.js +2 -10
- package/dist/approval-policy.d.ts +5 -5
- package/dist/approval-policy.js +4 -4
- package/dist/approval-rules-ui.js +2 -2
- package/dist/assignment-adapters.d.ts +5 -0
- package/dist/assignment.d.ts +24 -3
- package/dist/assignment.js +36 -10
- package/dist/browser/workspace.js +5 -5
- package/dist/browser-workspace.d.ts +12 -12
- package/dist/browser-workspace.js +1 -1
- package/dist/budget-alerts.js +3 -3
- package/dist/chat-actions.d.ts +23 -18
- package/dist/chat-actions.js +110 -88
- package/dist/chat-ask.d.ts +2 -2
- package/dist/chat-ask.js +5 -5
- package/dist/chat-channel.d.ts +15 -15
- package/dist/chat-channel.js +20 -20
- package/dist/chat-controls.d.ts +0 -4
- package/dist/chat-controls.js +0 -1
- package/dist/chat-core.js +1 -1
- package/dist/chat-delivery-state.js +2 -2
- package/dist/chat-delivery.d.ts +2 -2
- package/dist/chat-delivery.js +30 -37
- package/dist/chat-flow.js +3 -3
- package/dist/chat-messages.d.ts +1 -1
- package/dist/chat-messages.js +4 -4
- package/dist/chat-migration.d.ts +1 -1
- package/dist/chat-migration.js +11 -11
- package/dist/chat-rooms.js +3 -3
- package/dist/chat-voice.js +1 -1
- package/dist/chat-warmth.d.ts +2 -2
- package/dist/check-levels.d.ts +3 -0
- package/dist/check-levels.js +5 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +6 -7
- package/dist/contracts/chat-actions.d.ts +32 -27
- package/dist/contracts/chat-actions.js +29 -11
- package/dist/contracts/chat-content.d.ts +1 -1
- package/dist/contracts/chat-content.js +1 -1
- package/dist/contracts/chat-tables.js +4 -4
- package/dist/contracts/console-api.d.ts +6 -6
- package/dist/contracts/console-api.js +7 -7
- package/dist/contracts/flow-propose.d.ts +3 -3
- package/dist/contracts/flow.d.ts +132 -125
- package/dist/contracts/flow.js +27 -12
- package/dist/contracts/lead-context.d.ts +1 -1
- package/dist/contracts/lead-context.js +2 -2
- package/dist/contracts/lead-tools.d.ts +20 -18
- package/dist/contracts/lead-tools.js +15 -15
- package/dist/contracts/stage-output.d.ts +1 -1
- package/dist/contracts/stage-output.js +1 -1
- package/dist/contracts/store-json.d.ts +23 -22
- package/dist/contracts/store-json.js +17 -17
- package/dist/contracts/{teammate-turn.d.ts → subagent-turn.d.ts} +5 -5
- package/dist/contracts/{teammate-turn.js → subagent-turn.js} +7 -7
- package/dist/converse.d.ts +23 -23
- package/dist/converse.js +28 -28
- package/dist/coordinator-proposals.d.ts +2 -2
- package/dist/coordinator-proposals.js +1 -1
- package/dist/coordinator.js +1 -1
- package/dist/deprecations.d.ts +12 -0
- package/dist/deprecations.js +20 -0
- package/dist/desktop-update-gate.js +8 -4
- package/dist/desktop-update.js +6 -1
- package/dist/discord-chat.js +6 -6
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +1 -1
- package/dist/dispose.js +0 -5
- package/dist/envelope.js +0 -1
- package/dist/export-ui.js +1 -1
- package/dist/export.js +7 -7
- package/dist/flow-engine.d.ts +2 -2
- package/dist/flow-engine.js +21 -21
- package/dist/flow-insights.d.ts +1 -1
- package/dist/flow-share.js +13 -8
- package/dist/flow-steps.d.ts +5 -5
- package/dist/flow-steps.js +19 -19
- package/dist/flow-triggers.d.ts +1 -1
- package/dist/flow-triggers.js +1 -1
- package/dist/flows-cli.js +1 -1
- package/dist/flows-ui.js +20 -20
- package/dist/flows.js +19 -19
- package/dist/guides.js +4 -3
- package/dist/invoke.js +1 -1
- package/dist/kits-ui.js +5 -5
- package/dist/kits.d.ts +12 -12
- package/dist/kits.js +31 -31
- package/dist/{mate-cli.d.ts → lead-cli.d.ts} +11 -11
- package/dist/{mate-cli.js → lead-cli.js} +38 -38
- package/dist/lead-commitments.js +4 -4
- package/dist/lead-context.d.ts +2 -2
- package/dist/lead-context.js +9 -9
- package/dist/{mate-contract.d.ts → lead-contract.d.ts} +3 -3
- package/dist/{mate-contract.js → lead-contract.js} +7 -6
- package/dist/{mate-doors.d.ts → lead-doors.d.ts} +6 -6
- package/dist/{mate-doors.js → lead-doors.js} +24 -24
- package/dist/lead-follow.d.ts +5 -5
- package/dist/lead-follow.js +9 -9
- package/dist/lead-people.d.ts +5 -5
- package/dist/lead-people.js +14 -14
- package/dist/{mate-progress.d.ts → lead-progress.d.ts} +9 -9
- package/dist/{mate-progress.js → lead-progress.js} +3 -3
- package/dist/lead-status.d.ts +1 -1
- package/dist/lead-status.js +2 -2
- package/dist/{mate-tools.d.ts → lead-tools.d.ts} +19 -19
- package/dist/{mate-tools.js → lead-tools.js} +109 -101
- package/dist/{mate.d.ts → lead.d.ts} +27 -27
- package/dist/{mate.js → lead.js} +102 -102
- package/dist/limits-ui.d.ts +1 -1
- package/dist/limits-ui.js +1 -1
- package/dist/mcp-connect.d.ts +1 -1
- package/dist/mcp-connect.js +3 -3
- package/dist/mcp-core.js +1 -1
- package/dist/memory-pass.d.ts +2 -2
- package/dist/memory-pass.js +7 -7
- package/dist/notification-rows.d.ts +2 -2
- package/dist/operate.d.ts +3 -3
- package/dist/operate.js +52 -42
- package/dist/policy.d.ts +1 -1
- package/dist/principal.d.ts +1 -1
- package/dist/principal.js +2 -2
- package/dist/project-delete-ui.js +1 -1
- package/dist/project-delete.d.ts +1 -1
- package/dist/project-delete.js +26 -26
- package/dist/project-memory.js +1 -1
- package/dist/project-tools.d.ts +1 -1
- package/dist/project-tools.js +1 -1
- package/dist/proof.d.ts +9 -0
- package/dist/proof.js +12 -0
- package/dist/recipe-ui.js +1 -1
- package/dist/release-coverage.d.ts +16 -0
- package/dist/release-coverage.js +92 -0
- package/dist/retention.js +4 -4
- package/dist/scope.d.ts +2 -2
- package/dist/scout-report.d.ts +1 -1
- package/dist/scout-report.js +1 -1
- package/dist/serve.js +40 -45
- package/dist/server/chat.d.ts +4 -4
- package/dist/server/chat.js +105 -103
- package/dist/server/chrome.js +3 -3
- package/dist/server/flows.js +69 -62
- package/dist/server/guards.js +3 -3
- package/dist/server/http.d.ts +3 -3
- package/dist/server/http.js +1 -1
- package/dist/server/live.js +6 -6
- package/dist/server/people-tokens.js +1 -1
- package/dist/server/remote.js +12 -10
- package/dist/server/render-chat.d.ts +30 -30
- package/dist/server/render-chat.js +33 -33
- package/dist/server/render-pages.js +2 -2
- package/dist/server/render-results.d.ts +4 -1
- package/dist/server/render-results.js +23 -9
- package/dist/server/render-settings.d.ts +7 -0
- package/dist/server/render-settings.js +3 -0
- package/dist/server/route-table.js +9 -7
- package/dist/server/runtime.d.ts +13 -13
- package/dist/server/settings.js +14 -13
- package/dist/server/tasks.js +34 -30
- package/dist/setup-guide.d.ts +2 -2
- package/dist/slack-chat.d.ts +2 -2
- package/dist/slack-chat.js +6 -6
- package/dist/spend-ui.d.ts +3 -3
- package/dist/spend-ui.js +9 -9
- package/dist/spend.d.ts +14 -14
- package/dist/spend.js +31 -31
- package/dist/store-baseline.d.ts +19 -0
- package/dist/store-baseline.js +2873 -0
- package/dist/store.d.ts +200 -254
- package/dist/store.js +830 -3152
- package/dist/subagent-admin.d.ts +53 -0
- package/dist/{teammate-admin.js → subagent-admin.js} +37 -37
- package/dist/{teammate-desk.d.ts → subagent-desk.d.ts} +22 -23
- package/dist/{teammate-desk.js → subagent-desk.js} +26 -35
- package/dist/{teammate-memory.d.ts → subagent-memory.d.ts} +17 -17
- package/dist/{teammate-memory.js → subagent-memory.js} +41 -41
- package/dist/{teammate-question.d.ts → subagent-question.d.ts} +6 -6
- package/dist/{teammate-question.js → subagent-question.js} +17 -17
- package/dist/{teammate-tools.d.ts → subagent-tools.d.ts} +18 -18
- package/dist/{teammate-tools.js → subagent-tools.js} +36 -36
- package/dist/{teammate-week.d.ts → subagent-week.d.ts} +10 -10
- package/dist/{teammate-week.js → subagent-week.js} +23 -23
- package/dist/{teammate-work.d.ts → subagent-work.d.ts} +21 -21
- package/dist/{teammate-work.js → subagent-work.js} +50 -50
- package/dist/subagents-ui.d.ts +22 -0
- package/dist/{teammates-ui.js → subagents-ui.js} +45 -45
- package/dist/{teammates.d.ts → subagents.d.ts} +11 -11
- package/dist/{teammates.js → subagents.js} +21 -21
- package/dist/subscription-chat.d.ts +13 -13
- package/dist/subscription-chat.js +19 -19
- package/dist/surface.d.ts +19 -2
- package/dist/surface.js +7 -31
- package/dist/task-outcome-cli.js +3 -1
- package/dist/task-status.d.ts +59 -7
- package/dist/task-status.js +132 -16
- package/dist/team-cli.d.ts +1 -0
- package/dist/team-cli.js +14 -2
- package/dist/team-leads.js +13 -13
- package/dist/team-runtime.d.ts +2 -2
- package/dist/team-runtime.js +9 -9
- package/dist/teams-chat.js +6 -6
- package/dist/telegram-flow.d.ts +3 -3
- package/dist/telegram-flow.js +3 -3
- package/dist/{telegram-mate.d.ts → telegram-lead.d.ts} +5 -5
- package/dist/{telegram-mate.js → telegram-lead.js} +27 -27
- package/dist/telegram-status.d.ts +11 -4
- package/dist/telegram-status.js +18 -11
- package/dist/telegram-team.d.ts +1 -1
- package/dist/telegram-team.js +5 -5
- package/dist/telegram.d.ts +1 -1
- package/dist/telegram.js +13 -34
- package/dist/text-limits.d.ts +18 -18
- package/dist/text-limits.js +18 -18
- package/dist/toolroll-update.d.ts +8 -0
- package/dist/toolroll-update.js +45 -8
- package/dist/work-index.d.ts +6 -1
- package/dist/work-index.js +50 -8
- package/dist/workspace-ui.js +2 -1
- package/package.json +1 -2
- package/dist/teammate-admin.d.ts +0 -53
- package/dist/teammates-ui.d.ts +0 -21
|
@@ -47,7 +47,7 @@ Error generating stack: `+n.message+`
|
|
|
47
47
|
`)},KI=function(){var e=parseInt(document.body.getAttribute(Pu)||"0",10);return isFinite(e)?e:0},Cz=function(){Ou.useEffect(function(){return document.body.setAttribute(Pu,(KI()+1).toString()),function(){var e=KI()-1;e<=0?document.body.removeAttribute(Pu):document.body.setAttribute(Pu,e.toString())}},[])},D1=function(e){var t=e.noRelative,a=e.noImportant,n=e.gapMode,o=n===void 0?"margin":n;Cz();var r=Ou.useMemo(function(){return A1(o)},[o]);return Ou.createElement(wz,{styles:Sz(r,!t,o,a?"":"!important")})};var _1=!1;if(typeof window<"u")try{Vd=Object.defineProperty({},"passive",{get:function(){return _1=!0,!0}}),window.addEventListener("test",Vd,Vd),window.removeEventListener("test",Vd,Vd)}catch{_1=!1}var Vd,Ei=_1?{passive:!1}:!1;var kz=function(e){return e.tagName==="TEXTAREA"},ZI=function(e,t){if(!(e instanceof Element))return!1;var a=window.getComputedStyle(e);return a[t]!=="hidden"&&!(a.overflowY===a.overflowX&&!kz(e)&&a[t]==="visible")},Lz=function(e){return ZI(e,"overflowY")},Iz=function(e){return ZI(e,"overflowX")},P1=function(e,t){var a=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var o=QI(e,n);if(o){var r=JI(e,n),s=r[1],i=r[2];if(s>i)return!0}n=n.parentNode}while(n&&n!==a.body);return!1},Nz=function(e){var t=e.scrollTop,a=e.scrollHeight,n=e.clientHeight;return[t,a,n]},Rz=function(e){var t=e.scrollLeft,a=e.scrollWidth,n=e.clientWidth;return[t,a,n]},QI=function(e,t){return e==="v"?Lz(t):Iz(t)},JI=function(e,t){return e==="v"?Nz(t):Rz(t)},Tz=function(e,t){return e==="h"&&t==="rtl"?-1:1},e4=function(e,t,a,n,o){var r=Tz(e,window.getComputedStyle(t).direction),s=r*n,i=a.target,l=t.contains(i),c=!1,f=s>0,u=0,d=0;do{if(!i)break;var m=JI(e,i),g=m[0],b=m[1],v=m[2],x=b-v-r*g;(g||x)&&QI(e,i)&&(u+=x,d+=g);var y=i.parentNode;i=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!l&&i!==document.body||l&&(t.contains(i)||t===i));return(f&&(o&&Math.abs(u)<1||!o&&s>u)||!f&&(o&&Math.abs(d)<1||!o&&-s>d))&&(c=!0),c};var _h=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},t4=function(e){return[e.deltaX,e.deltaY]},a4=function(e){return e&&"current"in e?e.current:e},Mz=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Ez=function(e){return`
|
|
48
48
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
50
|
-
`)},Az=0,zu=[];function n4(e){var t=vt.useRef([]),a=vt.useRef([0,0]),n=vt.useRef(),o=vt.useState(Az++)[0],r=vt.useState(Ud)[0],s=vt.useRef(e);vt.useEffect(function(){s.current=e},[e]),vt.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=qI([e.lockRef.current],(e.shards||[]).map(a4),!0).filter(Boolean);return b.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var i=vt.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!s.current.allowPinchZoom;var x=_h(b),y=a.current,h="deltaX"in b?b.deltaX:y[0]-x[0],w="deltaY"in b?b.deltaY:y[1]-x[1],S,C=b.target,I=Math.abs(h)>Math.abs(w)?"h":"v";if("touches"in b&&I==="h"&&C.type==="range")return!1;var L=window.getSelection(),T=L&&L.anchorNode,A=T?T===C||T.contains(C):!1;if(A)return!1;var D=P1(I,C);if(!D)return!0;if(D?S=I:(S=I==="v"?"h":"v",D=P1(I,C)),!D)return!1;if(!n.current&&"changedTouches"in b&&(h||w)&&(n.current=S),!S)return!0;var H=n.current||S;return e4(H,v,b,H==="h"?h:w,!0)},[]),l=vt.useCallback(function(b){var v=b;if(!(!zu.length||zu[zu.length-1]!==r)){var x="deltaY"in v?t4(v):_h(v),y=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Mz(S.delta,x)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var h=(s.current.shards||[]).map(a4).filter(Boolean).filter(function(S){return S.contains(v.target)}),w=h.length>0?i(v,h[0]):!s.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),c=vt.useCallback(function(b,v,x,y){var h={name:b,delta:v,target:x,should:y,shadowParent:Dz(x)};t.current.push(h),setTimeout(function(){t.current=t.current.filter(function(w){return w!==h})},1)},[]),f=vt.useCallback(function(b){a.current=_h(b),n.current=void 0},[]),u=vt.useCallback(function(b){c(b.type,t4(b),b.target,i(b,e.lockRef.current))},[]),d=vt.useCallback(function(b){c(b.type,_h(b),b.target,i(b,e.lockRef.current))},[]);vt.useEffect(function(){return zu.push(r),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:d}),document.addEventListener("wheel",l,Ei),document.addEventListener("touchmove",l,Ei),document.addEventListener("touchstart",f,Ei),function(){zu=zu.filter(function(b){return b!==r}),document.removeEventListener("wheel",l,Ei),document.removeEventListener("touchmove",l,Ei),document.removeEventListener("touchstart",f,Ei)}},[]);var m=e.removeScrollBar,g=e.inert;return vt.createElement(vt.Fragment,null,g?vt.createElement(r,{styles:Ez(o)}):null,m?vt.createElement(D1,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Dz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var o4=N1(Dh,n4);var r4=Ph.forwardRef(function(e,t){return Ph.createElement(qd,dn({},e,{ref:t,sideCar:o4}))});r4.classNames=qd.classNames;var Ai=r4;var _z=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Bu=new WeakMap,Oh=new WeakMap,zh={},O1=0,s4=function(e){return e&&(e.host||s4(e.parentNode))},Pz=function(e,t){return t.map(function(a){if(e.contains(a))return a;var n=s4(a);return n&&e.contains(n)?n:(console.error("aria-hidden",a,"in not contained inside",e,". Doing nothing"),null)}).filter(function(a){return!!a})},Oz=function(e,t,a,n){var o=Pz(t,Array.isArray(e)?e:[e]);zh[a]||(zh[a]=new WeakMap);var r=zh[a],s=[],i=new Set,l=new Set(o),c=function(u){!u||i.has(u)||(i.add(u),c(u.parentNode))};o.forEach(c);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(d){if(i.has(d))f(d);else try{var m=d.getAttribute(n),g=m!==null&&m!=="false",b=(Bu.get(d)||0)+1,v=(r.get(d)||0)+1;Bu.set(d,b),r.set(d,v),s.push(d),b===1&&g&&Oh.set(d,!0),v===1&&d.setAttribute(a,"true"),g||d.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",d,x)}})};return f(t),i.clear(),O1++,function(){s.forEach(function(u){var d=Bu.get(u)-1,m=r.get(u)-1;Bu.set(u,d),r.set(u,m),d||(Oh.has(u)||u.removeAttribute(n),Oh.delete(u)),m||u.removeAttribute(a)}),O1--,O1||(Bu=new WeakMap,Bu=new WeakMap,Oh=new WeakMap,zh={})}},Fu=function(e,t,a){a===void 0&&(a="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=t||_z(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),Oz(n,o,a,"aria-hidden")):function(){return null}};var It=j(fe(),1),zz=Object.defineProperty,Dn=(e,t)=>zz(e,"name",{value:t,configurable:!0}),B1="Dialog",[i4,$Q]=xt(B1),[Bz,vo]=i4(B1),l4=Dn(e=>{let{__scopeDialog:t,children:a,open:n,defaultOpen:o,onOpenChange:r,modal:s=!0}=e,i=ht.useRef(null),l=ht.useRef(null),[c,f]=Ma({prop:n,defaultProp:o??!1,onChange:r,caller:B1}),[u,d]=ht.useState(0),[m,g]=ht.useState(0);return(0,It.jsx)(Bz,{scope:t,triggerRef:i,contentRef:l,contentId:Ga(),titleId:Ga(),descriptionId:Ga(),titlePresent:u>0,descriptionPresent:m>0,setTitleCount:d,setDescriptionCount:g,open:c,onOpenChange:f,onOpenToggle:ht.useCallback(()=>f(b=>!b),[f]),modal:s,children:a})},"Dialog"),Fz="DialogTrigger",u4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(Fz,n),s=Te(a,r.triggerRef);return(0,It.jsx)(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":Bh(r.open),...o,ref:s,onClick:ke(t.onClick,r.onOpenToggle)})},"DialogTrigger")),c4="DialogPortal",[Hz,d4]=i4(c4,{forceMount:void 0}),f4=Dn(e=>{let{__scopeDialog:t,forceMount:a,children:n,container:o}=e,r=vo(c4,t);return(0,It.jsx)(Hz,{scope:t,forceMount:a,children:ht.Children.map(n,s=>(0,It.jsx)(An,{present:a||r.open,children:(0,It.jsx)(Au,{asChild:!0,container:o,children:s})}))})},"DialogPortal"),z1="DialogOverlay",p4=ht.forwardRef(Dn(function(t,a){let n=d4(z1,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,s=vo(z1,t.__scopeDialog);return s.modal?(0,It.jsx)(An,{present:o||s.open,children:(0,It.jsx)(Uz,{...r,ref:a})}):null},"DialogOverlay")),qz=Ea("DialogOverlay.RemoveScroll"),Uz=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(z1,n),s=p1(),i=Te(a,s);return(0,It.jsx)(Ai,{as:qz,allowPinchZoom:!0,shards:[r.contentRef],children:(0,It.jsx)(Re.div,{"data-state":Bh(r.open),...o,ref:i,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),Gd="DialogContent",m4=ht.forwardRef(Dn(function(t,a){let n=d4(Gd,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,s=vo(Gd,t.__scopeDialog);return(0,It.jsx)(An,{present:o||s.open,children:s.modal?(0,It.jsx)(Vz,{...r,ref:a}):(0,It.jsx)(Gz,{...r,ref:a})})},"DialogContent")),Vz=ht.forwardRef(Dn(function(t,a){let n=vo(Gd,t.__scopeDialog),o=ht.useRef(null),r=Te(a,n.contentRef,o);return ht.useEffect(()=>{let s=o.current;if(s)return Fu(s)},[]),(0,It.jsx)(h4,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ke(t.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ke(t.onPointerDownOutside,s=>{let i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ke(t.onFocusOutside,s=>s.preventDefault())})},"DialogContentModal")),Gz=ht.forwardRef(Dn(function(t,a){let n=vo(Gd,t.__scopeDialog),o=ht.useRef(!1),r=ht.useRef(!1);return(0,It.jsx)(h4,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||n.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));let i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})},"DialogContentNonModal")),h4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...i}=t,l=vo(Gd,n);return ws(),(0,It.jsx)(It.Fragment,{children:(0,It.jsx)(Eu,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:(0,It.jsx)(Mu,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":Bh(l.open),...i,ref:a,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},"DialogContentImpl")),$z="DialogTitle",g4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo($z,n),{setTitleCount:s}=r;return Ze(()=>(s(i=>i+1),()=>s(i=>i-1)),[s]),(0,It.jsx)(Re.h2,{id:r.titleId,...o,ref:a})},"DialogTitle")),jz="DialogDescription",x4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(jz,n),{setDescriptionCount:s}=r;return Ze(()=>(s(i=>i+1),()=>s(i=>i-1)),[s]),(0,It.jsx)(Re.p,{id:r.descriptionId,...o,ref:a})},"DialogDescription")),Wz="DialogClose",v4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(Wz,n);return(0,It.jsx)(Re.button,{type:"button",...o,ref:a,onClick:ke(t.onClick,()=>r.onOpenChange(!1))})},"DialogClose"));function Bh(e){return e?"open":"closed"}Dn(Bh,"getState");var Da=j(fe(),1);function Ot(...e){return e.filter(Boolean).join(" ")}function _e({className:e,variant:t="primary",size:a="default",asChild:n=!1,type:o,...r}){return(0,Da.jsx)(n?Nh:"button",{"data-slot":"button","data-variant":t,"data-size":a,className:Ot("ui-button",`ui-button--${t}`,`ui-button--${a}`,e),...n?{}:{type:o??"button"},...r})}function F1({className:e,tone:t="neutral",...a}){return(0,Da.jsx)("span",{"data-slot":"badge","data-tone":t,className:Ot("ui-badge",`ui-badge--${t}`,e),...a})}function Di({className:e,...t}){return(0,Da.jsx)("input",{className:Ot("ui-input",e),...t})}function Ss({className:e,...t}){return(0,Da.jsx)("textarea",{className:Ot("ui-textarea",e),...t})}function _i({className:e,...t}){return(0,Da.jsx)("label",{className:Ot("ui-label",e),...t})}function eo({summary:e,className:t,children:a,...n}){return(0,Da.jsxs)("details",{className:Ot("ui-disclosure",t),...n,children:[(0,Da.jsx)("summary",{className:"ui-disclosure-trigger",children:e}),(0,Da.jsx)("div",{className:"ui-disclosure-content",children:a})]})}function fn({className:e,tone:t="info",...a}){return(0,Da.jsx)("div",{role:t==="error"?"alert":"status","data-tone":t,className:Ot("ui-alert",`ui-alert--${t}`,e),...a})}var H1=l4,q1=u4,U1=v4;function V1({className:e,children:t,...a}){return(0,Da.jsxs)(f4,{children:[(0,Da.jsx)(p4,{className:"ui-dialog-overlay"}),(0,Da.jsx)(m4,{className:Ot("ui-dialog-content",e),...a,children:t})]})}function G1({className:e,...t}){return(0,Da.jsx)(g4,{className:Ot("ui-dialog-title",e),...t})}function $1({className:e,...t}){return(0,Da.jsx)(x4,{className:Ot("ui-dialog-description",e),...t})}var ba=j(he(),1);var Yz={damping:.7,stiffness:.05,mass:1.25},Kz=70,Zz=1e3/60,Qz=350,Fh=!1;globalThis.document?.addEventListener("mousedown",()=>{Fh=!0});globalThis.document?.addEventListener("mouseup",()=>{Fh=!1});globalThis.document?.addEventListener("click",()=>{Fh=!1});var b4=(e={})=>{let[t,a]=(0,ba.useState)(!1),[n,o]=(0,ba.useState)(e.initial!==!1),[r,s]=(0,ba.useState)(!1),i=(0,ba.useRef)(null);i.current=e;let l=(0,ba.useCallback)(()=>{if(!Fh)return!1;let y=window.getSelection();if(!y||!y.rangeCount)return!1;let h=y.getRangeAt(0);return h.commonAncestorContainer.contains(v.current)||v.current?.contains(h.commonAncestorContainer)},[]),c=(0,ba.useCallback)(y=>{u.isAtBottom=y,o(y)},[]),f=(0,ba.useCallback)(y=>{u.escapedFromLock=y,a(y)},[]),u=(0,ba.useMemo)(()=>{let y;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return v.current?.scrollTop??0},set scrollTop(h){if(v.current){let{scrollBehavior:w}=getComputedStyle(v.current);w!=="auto"&&(v.current.style.scrollBehavior="auto"),v.current.scrollTop=h,u.ignoreScrollToTop=v.current.scrollTop,w!=="auto"&&(v.current.style.scrollBehavior=w)}},get targetScrollTop(){return!v.current||!x.current?0:v.current.scrollHeight-1-v.current.clientHeight},get calculatedTargetScrollTop(){if(!v.current||!x.current)return 0;let{targetScrollTop:h}=this;if(!e.targetScrollTop)return h;if(y?.targetScrollTop===h)return y.calculatedScrollTop;let w=Math.max(Math.min(e.targetScrollTop(h,{scrollElement:v.current,contentElement:x.current}),h),0);return y={targetScrollTop:h,calculatedScrollTop:w},requestAnimationFrame(()=>{y=void 0}),w},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Kz}}},[]),d=(0,ba.useCallback)((y={})=>{typeof y=="string"&&(y={animation:y}),y.preserveScrollPosition||c(!0);let h=Date.now()+(Number(y.wait)||0),w=W1(i.current,y.animation),{ignoreEscapes:S=!1}=y,C,I=u.calculatedTargetScrollTop;y.duration instanceof Promise?y.duration.finally(()=>{C=Date.now()}):C=h+(y.duration??0);let L=async()=>{let T=new Promise(requestAnimationFrame).then(()=>{if(!u.isAtBottom)return u.animation=void 0,!1;let{scrollTop:A}=u,D=performance.now(),H=(D-(u.lastTick??D))/Zz;if(u.animation||(u.animation={behavior:w,promise:T,ignoreEscapes:S}),u.animation.behavior===w&&(u.lastTick=D),l()||h>Date.now())return L();if(A<Math.min(I,u.calculatedTargetScrollTop)){if(u.animation?.behavior===w){if(w==="instant")return u.scrollTop=u.calculatedTargetScrollTop,L();u.velocity=(w.damping*u.velocity+w.stiffness*u.scrollDifference)/w.mass,u.accumulated+=u.velocity*H,u.scrollTop+=u.accumulated,u.scrollTop!==A&&(u.accumulated=0)}return L()}return C>Date.now()?(I=u.calculatedTargetScrollTop,L()):(u.animation=void 0,u.scrollTop<u.calculatedTargetScrollTop?d({animation:W1(i.current,i.current.resize),ignoreEscapes:S,duration:Math.max(0,C-Date.now())||void 0}):u.isAtBottom)});return T.then(A=>(requestAnimationFrame(()=>{u.animation||(u.lastTick=void 0,u.velocity=0)}),A))};return y.wait!==!0&&(u.animation=void 0),u.animation?.behavior===w?u.animation.promise:L()},[c,l,u]),m=(0,ba.useCallback)(()=>{f(!0),c(!1)},[f,c]),g=(0,ba.useCallback)(({target:y})=>{if(y!==v.current)return;let{scrollTop:h,ignoreScrollToTop:w}=u,{lastScrollTop:S=h}=u;u.lastScrollTop=h,u.ignoreScrollToTop=void 0,w&&w>h&&(S=w),s(u.isNearBottom),setTimeout(()=>{if(u.resizeDifference||h===w)return;if(l()){f(!0),c(!1);return}let C=h>S,I=h<S;if(u.animation?.ignoreEscapes){u.scrollTop=S;return}I&&(f(!0),c(!1)),C&&f(!1),!u.escapedFromLock&&u.isNearBottom&&c(!0)},1)},[f,c,l,u]),b=(0,ba.useCallback)(({target:y,deltaY:h})=>{let w=y;for(;!["scroll","auto"].includes(getComputedStyle(w).overflow);){if(!w.parentElement)return;w=w.parentElement}w===v.current&&h<0&&v.current.scrollHeight>v.current.clientHeight&&!u.animation?.ignoreEscapes&&(f(!0),c(!1))},[f,c,u]),v=y4(y=>{v.current?.removeEventListener("scroll",g),v.current?.removeEventListener("wheel",b),y?.addEventListener("scroll",g,{passive:!0}),y?.addEventListener("wheel",b,{passive:!0})},[]),x=y4(y=>{if(u.resizeObserver?.disconnect(),u.resizeObserver=void 0,!y)return;let h;u.resizeObserver=new ResizeObserver(([w])=>{let{height:S}=w.contentRect,C=S-(h??S);if(u.resizeDifference=C,u.scrollTop>u.targetScrollTop&&(u.scrollTop=u.targetScrollTop),s(u.isNearBottom),C>=0){let I=W1(i.current,h?i.current.resize:i.current.initial);d({animation:I,wait:!0,preserveScrollPosition:!0,duration:I==="instant"?void 0:Qz})}else u.isNearBottom&&(f(!1),c(!0));h=S,requestAnimationFrame(()=>{setTimeout(()=>{u.resizeDifference===C&&(u.resizeDifference=0)},1)})}),u.resizeObserver?.observe(y)},[]);return{contentRef:x,scrollRef:v,scrollToBottom:d,stopScroll:m,isAtBottom:n||r,isNearBottom:r,escapedFromLock:t,state:u}};function y4(e,t){let a=(0,ba.useCallback)(n=>(a.current=n,e(n)),t);return a}var j1=new Map;function W1(...e){let t={...Yz},a=!1;for(let o of e){if(o==="instant"){a=!0;continue}typeof o=="object"&&(a=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}let n=JSON.stringify(t);return j1.has(n)||j1.set(n,Object.freeze(t)),a?"instant":j1.get(n)}var Pi=j(he(),1),pn=j(he(),1);var w4=(0,pn.createContext)(null),Jz=typeof window<"u"?pn.useLayoutEffect:pn.useEffect;function $d({instance:e,children:t,resize:a,initial:n,mass:o,damping:r,stiffness:s,targetScrollTop:i,contextRef:l,...c}){let f=(0,pn.useRef)(null),u=Pi.useCallback((S,C)=>(w?.targetScrollTop??i)?.(S,C)??S,[i]),d=b4({mass:o,damping:r,stiffness:s,resize:a,initial:n,targetScrollTop:u}),{scrollRef:m,contentRef:g,scrollToBottom:b,stopScroll:v,isAtBottom:x,escapedFromLock:y,state:h}=e??d,w=(0,pn.useMemo)(()=>({scrollToBottom:b,stopScroll:v,scrollRef:m,isAtBottom:x,escapedFromLock:y,contentRef:g,state:h,get targetScrollTop(){return f.current},set targetScrollTop(S){f.current=S}}),[b,x,g,m,v,y,h]);return(0,pn.useImperativeHandle)(l,()=>w,[w]),Jz(()=>{m.current&&getComputedStyle(m.current).overflow==="visible"&&(m.current.style.overflow="auto")},[]),Pi.createElement(w4.Provider,{value:w},Pi.createElement("div",{...c},typeof t=="function"?t(w):t))}(function(e){function t({children:a,scrollClassName:n,...o}){let r=X1();return Pi.createElement("div",{ref:r.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:n},Pi.createElement("div",{...o,ref:r.contentRef},typeof a=="function"?a(r):a))}e.Content=t})($d||($d={}));function X1(){let e=(0,pn.useContext)(w4);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}var _n=j(fe(),1);function S4({className:e,...t}){return(0,_n.jsx)($d,{className:Ot("ui-conversation",e),initial:"instant",resize:"instant",role:"log","aria-label":"Conversation",...t})}function C4({className:e,...t}){return(0,_n.jsx)($d.Content,{className:Ot("ui-conversation-content",e),...t})}function k4({className:e,children:t,onClick:a,...n}){let{isAtBottom:o,scrollToBottom:r}=X1();return o?null:(0,_n.jsx)(_e,{className:Ot("ui-conversation-scroll",e),variant:"secondary",size:"sm",onClick:s=>{a?.(s),s.defaultPrevented||r({animation:"instant"})},...n,children:t??"Latest message"})}function L4({className:e,title:t="Start a conversation",description:a,children:n,...o}){return(0,_n.jsx)("div",{className:Ot("ui-conversation-empty",e),...o,children:n??(0,_n.jsxs)(_n.Fragment,{children:[(0,_n.jsx)("h2",{children:t}),a&&(0,_n.jsx)("p",{children:a})]})})}function Hh({className:e,from:t,...a}){return(0,_n.jsx)("article",{className:Ot("ui-message",`ui-message--${t}`,e),"data-from":t,...a})}function jd({className:e,...t}){return(0,_n.jsx)("div",{className:Ot("ui-message-content",e),...t})}var Y1=j(he(),1);var K1=j(fe(),1);var tJ=(0,Y1.createContext)(null);function I4({className:e,...t}){return(0,K1.jsx)("section",{className:Ot("ui-artifact",e),...t})}function N4({className:e,...t}){return(0,K1.jsx)("div",{className:Ot("ui-artifact-content",e),...t})}var R4=j(fe(),1);var Hu=j(he(),1),qh=j(fe(),1),Z1=(0,Hu.createContext)(""),$e=(0,Hu.forwardRef)(function({children:t,...a},n){let o=(0,Hu.useContext)(Z1);return(0,qh.jsxs)("form",{ref:n,method:"post",...a,children:[(0,qh.jsx)("input",{type:"hidden",name:"csrf",value:o}),t]})});var Q1="standing-orders:workspace-draft:",M4="standing-orders:workspace-carry:",J1=/^[a-f0-9]{32}$/;function E4(){return Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")}function Uh(e,t){return`${e}${encodeURIComponent(t.user)}:${e===Q1?`${t.session}:`:""}${encodeURIComponent(t.task??"")}`}function Vh(e,t=Date.now()){return{text:"",request:e,submitted:!1,pending:null,at:t}}function Nt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function eB(e,t){return Nt(e)&&typeof e.request=="string"&&J1.test(e.request)&&typeof e.text=="string"&&e.text.length<=t}function A4(e,t,a,n,o=Date.now()){let r=Vh(a,o);try{let s=Uh(Q1,t),i=JSON.parse(e.getItem(s)??"null");if(Nt(i)&&i.user===t.user&&i.session===t.session&&i.task===t.task&&typeof i.at=="number"&&i.at>o-864e5&&i.at<=o&&typeof i.text=="string"&&i.text.length<=n&&typeof i.request=="string"&&J1.test(i.request)&&typeof i.submitted=="boolean"&&(i.pending===null||eB(i.pending,n)))return{text:i.text,request:i.request,submitted:i.submitted,pending:i.pending,at:i.at};e.removeItem(s);let l=Uh(M4,t),c=JSON.parse(e.getItem(l)??"null");if(e.removeItem(l),Nt(c)&&c.user===t.user&&c.task===t.task&&typeof c.at=="number"&&c.at>o-864e5&&c.at<=o&&typeof c.text=="string"&&c.text.length<=n)return{...r,text:c.text}}catch{}return r}function D4(e,t,a){try{let n=Uh(Q1,t);return a.text||a.pending?e.setItem(n,JSON.stringify({...t,...a})):e.removeItem(n),!0}catch{return!1}}function _4(e,t,a,n=Date.now()){try{return t.user&&a.trim()&&e.setItem(Uh(M4,t),JSON.stringify({user:t.user,task:t.task,text:a,at:n})),!0}catch{return!1}}function P4(e,t,a=E4,n=Date.now()){return{...e,text:t,request:e.submitted?a():e.request,submitted:!1,at:n}}function O4(e,t=Date.now()){return e.pending||!e.text.trim()?e:{...e,submitted:!0,pending:{request:e.request,text:e.text},at:t}}function z4(e,t,a,n=E4,o=Date.now()){return!t||!a?.received||a.request!==t||e.pending?.request!==t?e:e.submitted&&e.request===t&&e.text===e.pending.text?Vh(n(),o):{...e,pending:null,at:o}}function B4(e,t){return e.pending?.request===t?{...e,pending:null,submitted:!1}:e}function F4(e,t){return e.user===t.user&&e.conversation?.sessionId===t.conversation?.sessionId&&e.conversation?.taskId===t.conversation?.taskId&&e.conversation?.resultRunId===t.conversation?.resultRunId&&(e.conversation?.project??null)===(t.conversation?.project??null)}function tB(e){if(!e.startsWith("/")||e.startsWith("//"))throw new Error("Unexpected workspace address");return e}function aB(e){return Nt(e)&&(e.sandbox===null||typeof e.sandbox=="string")&&Array.isArray(e.steps)&&e.steps.every(t=>Nt(t)&&typeof t.key=="string"&&typeof t.title=="string"&&typeof t.done=="boolean"&&(t.action===null||Nt(t.action)&&(t.action.kind==="command"?typeof t.action.command=="string":t.action.kind==="link"&&typeof t.action.label=="string"&&typeof t.action.href=="string"&&t.action.href.startsWith("/"))))&&Array.isArray(e.suggestions)&&e.suggestions.every(t=>Nt(t)&&typeof t.label=="string"&&typeof t.draft=="string"&&typeof t.source=="string")}function eb(e){if(!Nt(e)||e.version!==1||typeof e.path!="string"||typeof e.title!="string"||typeof e.user!="string"||typeof e.csrf!="string"||typeof e.refreshUrl!="string"||typeof e.sensitive!="boolean"||typeof e.crewTruncated!="boolean"||typeof e.catchUpHtml!="string"||typeof e.controlsHtml!="string"||!Array.isArray(e.notices)||!e.notices.every(a=>typeof a=="string")||!(e.pageHtml===null||typeof e.pageHtml=="string")||!Array.isArray(e.navigation)||!e.navigation.every(a=>Nt(a)&&typeof a.label=="string"&&typeof a.href=="string"&&typeof a.active=="boolean"&&(a.count===void 0||typeof a.count=="number"))||e.view!==void 0&&e.view!==null&&!(Nt(e.view)&&typeof e.view.kind=="string")||e.signIn!==void 0&&!(Array.isArray(e.signIn)&&e.signIn.every(a=>Nt(a)&&[a.provider,a.title,a.command,a.detail,a.resumeLabel,a.resumeHref].every(n=>typeof n=="string")&&String(a.resumeHref).startsWith("/")))||e.firstRun!==void 0&&!aB(e.firstRun)||e.refreshSeconds!==void 0&&!(typeof e.refreshSeconds=="number"&&Number.isFinite(e.refreshSeconds)&&e.refreshSeconds>=5)||e.chats!==void 0&&!(Array.isArray(e.chats)&&e.chats.every(a=>Nt(a)&&(a.kind==="project"||a.kind==="task")&&typeof a.title=="string"&&typeof a.href=="string"&&a.href.startsWith("/")&&typeof a.active=="boolean"&&(a.at===null||typeof a.at=="string")))||!Array.isArray(e.projects)||!e.projects.every(a=>Nt(a)&&[a.name,a.path,a.href,a.knowledgeHref].every(n=>typeof n=="string"))||!Array.isArray(e.crew)||!e.crew.every(a=>Nt(a)&&[a.id,a.title,a.state,a.label,a.tone,a.href].every(n=>typeof n=="string")&&(a.project===null||typeof a.project=="string")&&(a.resultHref===null||typeof a.resultHref=="string")&&(a.action===null||Nt(a.action)&&typeof a.action.label=="string"&&typeof a.action.href=="string"))||!(e.focus===null||Nt(e.focus)&&typeof e.focus.id=="string"&&typeof e.focus.title=="string"&&typeof e.focus.html=="string")||!(e.result===null||Nt(e.result)&&typeof e.result.runId=="number"&&typeof e.result.html=="string")||!(e.receipt===null||Nt(e.receipt)&&typeof e.receipt.request=="string"&&typeof e.receipt.received=="boolean"))return!1;let t=e.conversation;return t===null||Nt(t)&&typeof t.sessionId=="number"&&typeof t.user=="string"&&typeof t.version=="string"&&typeof t.requestId=="string"&&J1.test(t.requestId)&&typeof t.maxChars=="number"&&t.maxChars>0&&(t.taskId===null||typeof t.taskId=="string")&&(t.resultRunId===null||typeof t.resultRunId=="number")&&(t.project===void 0||t.project===null||typeof t.project=="string")&&(t.pendingTurnId===null||typeof t.pendingTurnId=="number")&&Array.isArray(t.messages)&&t.messages.every(T4)&&(t.previous===void 0||t.previous===null||Nt(t.previous)&&Array.isArray(t.previous.messages)&&t.previous.messages.every(T4))}function T4(e){return Nt(e)&&typeof e.id=="number"&&(e.role==="operator"||e.role==="assistant")&&typeof e.text=="string"&&typeof e.html=="string"&&typeof e.cardsHtml=="string"&&typeof e.createdAt=="string"&&(e.activity===null||typeof e.activity=="string")&&(e.cards===void 0||Array.isArray(e.cards)&&e.cards.every(t=>Nt(t)&&typeof t.id=="number"&&typeof t.kind=="string"&&typeof t.label=="string"&&typeof t.state=="string"&&typeof t.body=="string"&&Array.isArray(t.links)&&typeof t.dismissable=="boolean"))}var Nr=class extends Error{};async function H4(e,t,a=fetch,n={}){let o=new URL(tB(e.refreshUrl),window.location.origin);o.searchParams.set("format","workspace"),t?o.searchParams.set("request",t):o.searchParams.delete("request");let r=t||n.force?null:n.etag,s=await a(o.pathname+o.search,{credentials:"same-origin",cache:"no-store",headers:{accept:"application/json",...r?{"if-none-match":r}:{}},signal:AbortSignal.timeout(12e3)});if(s.status===401||s.status===403||s.redirected)throw new Nr("Sign in again to reconnect. Your draft stays in this tab.");if(s.status===304){if(!r)throw new Error("The update was incomplete. Your current view is preserved.");return{kind:"unchanged",etag:s.headers.get("etag")??r}}if(!s.ok)throw new Error("Updates are unavailable. Your work is still saved.");let i=await s.json();if(!eb(i))throw new Error("The update was incomplete. Your current view is preserved.");return{kind:"changed",workspace:i,etag:s.headers.get("etag")}}async function q4(e,t,a=fetch,n=null){let o=e.conversation;if(!o)throw new Nr("Reconnect to the conversation before sending.");let r=new URLSearchParams({csrf:e.csrf,message:t.text,request:t.request,"request-session":String(o.sessionId)});n!==null&&o.taskId&&r.set("mode",n),o.taskId?r.set("task",o.taskId):o.project&&r.set("project",o.project),o.resultRunId!==null&&r.set("result",String(o.resultRunId));let s=await a("/chat",{method:"POST",credentials:"same-origin",body:r,headers:{accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(s.status===401||s.status===403)throw new Nr("Sign in again to reconnect. Your draft stays in this tab.");if(s.headers.get("content-type")?.includes("application/json")){let i=await s.json();if(Nt(i)&&i.ok===!1)return{refused:!0,message:typeof i.said=="string"?i.said:"Message not sent. Your draft is saved."}}return{refused:!1,message:null}}var Rt=j(he(),1);var Gh=j(he(),1),nB="so:live",oB=["change","here","gone","turn"],rB=3e4,qu=(e,t,a)=>{let n=new URLSearchParams;for(let[r,s]of Object.entries(a??{}))s!=null&&s!==!1&&n.set(r,s===!0?"1":String(s));let o=n.toString();return`${e}${t==null?"":`:${encodeURIComponent(String(t))}`}${o===""?"":`?${o}`}`},tb=class{subscriptions=new Map;next=0;source=null;url="";scheduled=!1;watching=!1;subscribe(t,a){let n=this.next++;return this.subscriptions.set(n,{room:t,listener:a}),this.schedule(),()=>{this.subscriptions.delete(n),this.schedule()}}schedule(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.reconcile()}))}wanted(){let t=[...new Set([...this.subscriptions.values()].map(a=>a.room))].sort();return t.length===0?"":`/live?${t.map(a=>`room=${encodeURIComponent(a)}`).join("&")}`}reconcile(){if(typeof EventSource>"u"||typeof document>"u")return;this.watching||(this.watching=!0,document.addEventListener("visibilitychange",()=>this.reconcile()),window.addEventListener("online",()=>this.reconcile()));let t=document.hidden?"":this.wanted();if(t===this.url&&(t===""||this.source!==null))return;if(this.source?.close(),this.source=null,this.url=t,t===""){delete document.documentElement.dataset.live;return}document.documentElement.dataset.live="1";let a=new EventSource(t);this.source=a;let n=(o,r)=>{let s={};try{let l=JSON.parse(r);l!==null&&typeof l=="object"&&!Array.isArray(l)&&(s=l)}catch{}let i=typeof s.room=="string"?s.room:null;for(let l of[...this.subscriptions.values()])(i===null||l.room===i)&&l.listener(o,s);window.dispatchEvent(new CustomEvent(nB,{detail:{room:i,event:o,data:s}}))};for(let o of oB)a.addEventListener(o,r=>n(o,r.data));a.addEventListener("reload",()=>n("reload","{}")),a.addEventListener("error",()=>{a.readyState!==EventSource.CLOSED||this.source!==a||(this.source=null,this.url="",n("lost","{}"),window.setTimeout(()=>this.reconcile(),rB))})}},sB=new tb;function jo(e,t){let a=(0,Gh.useRef)(t);a.current=t,(0,Gh.useEffect)(()=>{if(e!==null)return sB.subscribe(e,(n,o)=>a.current(n,o))},[e])}var $h=j(he(),1);var U4=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function V4(e,t,a=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:U4(e),size:24,node:t,...a.length>0?{aliases:a}:{}}}var G4=e=>{let t="",a=!1;for(let n of e){if(n==="-"||n==="_"||n<=" "){a=t.length>0;continue}t.length===0?t+=n.toLowerCase():t+=a?n.toUpperCase():n,a=!1}return t};var $4=e=>{let t=G4(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Xd=j(he(),1);var Wd=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var Cs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function ab(e){return e!=null}function j4(e,t={}){let a=t.attributeNames??{},n=d=>a[d]??d,o=e.size??e.width??Cs.width,r=e.size??e.height??Cs.height,s=e.aliases?.filter(d=>typeof d=="string"&&d.trim()!=="").map(d=>`lucide-${d}`)??[],i=[...e.name?[`lucide-${e.name}`]:[],...s],l=t.className?.split(" ").filter(Boolean)??[],c=t.includeDefaultClasses===!1?Wd(...l):Wd("lucide",...i,...l),f=t.absoluteStrokeWidth?Number(t.strokeWidth??Cs["stroke-width"])*Number(e.size??e.width??Cs.width)/Number(t.size??t.width??Cs.width):t.strokeWidth??Cs["stroke-width"];return["svg",{...Object.entries(Cs).reduce((d,[m,g])=>(d[n(m)]=g,d),{}),..."color"in t&&t.color&&{[n("stroke")]:t.color},..."size"in t&&ab(t.size)&&{[n("width")]:t.size,[n("height")]:t.size},..."width"in t&&ab(t.width)&&{[n("width")]:t.width},..."height"in t&&ab(t.height)&&{[n("height")]:t.height},[n("stroke-width")]:f,...c&&{[n("class")]:c},[n("viewBox")]:`0 0 ${o} ${r}`,...t.hasA11yProp===!1?{[n("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(d=>{let[m,g,b]=d,v=t.nonScalingStroke?{[n("vector-effect")]:"non-scaling-stroke",...g}:g;return b?[m,v,b]:[m,v]})]}function W4(e,t={}){return j4(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var X4=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var Uu=j(he(),1);var iB=(0,Uu.createContext)({});var Y4=()=>(0,Uu.useContext)(iB);var K4=(0,Xd.forwardRef)(({color:e,size:t,width:a,height:n,strokeWidth:o,absoluteStrokeWidth:r,nonScalingStroke:s,className:i="",children:l,iconNode:c=[],icon:f={node:c,aliases:[],size:24},...u},d)=>{let{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:b=!1,nonScalingStroke:v=!1,color:x="currentColor",className:y=""}=Y4()??{},h=!!l||X4(u),[w,S,C=[]]=W4(f,{color:e??x,width:a??t??m,height:n??t??m,strokeWidth:o??g,absoluteStrokeWidth:r??b,nonScalingStroke:s??v,className:Wd(y,i),hasA11yProp:h,attributes:u});return(0,Xd.createElement)(w,{ref:d,...S},[...C.map(([I,L])=>(0,Xd.createElement)(I,L)),...Array.isArray(l)?l:[l]])});function J(e,t=[],a=[]){let n=typeof e=="string"?V4(e,t,a):e,o=(0,$h.forwardRef)(({className:r,...s},i)=>(0,$h.createElement)(K4,{ref:i,icon:n,className:r,...s}));return n.name&&(o.displayName=$4(n.name)),o}var Z4={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};Z4.node;var Yd=J(Z4);var Q4={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};Q4.node;var ks=J(Q4);var J4={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};J4.node;var Kd=J(J4);var eN={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};eN.node;var Zd=J(eN);var tN={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};tN.node;var Oi=J(tN);var aN={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};aN.node;var zi=J(aN);var nN={name:"briefcase",size:24,node:[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]};nN.node;var Qd=J(nN);var oN={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};oN.node;var Jd=J(oN);var rN={name:"chart-line",size:24,node:[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],aliases:["line-chart"]};rN.node;var Wo=J(rN);var sN={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};sN.node;var ja=J(sN);var iN={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};iN.node;var Xo=J(iN);var lN={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};lN.node;var sa=J(lN);var uN={name:"circle-dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};uN.node;var Bi=J(uN);var cN={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};cN.node;var Fi=J(cN);var dN={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};dN.node;var ef=J(dN);var fN={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};fN.node;var Ls=J(fN);var pN={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};pN.node;var tf=J(pN);var mN={name:"cpu",size:24,node:[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]};mN.node;var af=J(mN);var hN={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};hN.node;var nf=J(hN);var gN={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};gN.node;var Hi=J(gN);var xN={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};xN.node;var Yo=J(xN);var vN={name:"file-check",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]};vN.node;var of=J(vN);var yN={name:"file-plus-corner",size:24,node:[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],aliases:["file-plus-2"]};yN.node;var Is=J(yN);var bN={name:"flag",size:24,node:[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]};bN.node;var rf=J(bN);var wN={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};wN.node;var Vu=J(wN);var SN={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};SN.node;var sf=J(SN);var CN={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};CN.node;var lf=J(CN);var kN={name:"git-pull-request",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]};kN.node;var Ns=J(kN);var LN={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};LN.node;var uf=J(LN);var IN={name:"hammer",size:24,node:[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]]};IN.node;var cf=J(IN);var NN={name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]};NN.node;var df=J(NN);var RN={name:"hourglass",size:24,node:[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]};RN.node;var ff=J(RN);var TN={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};TN.node;var qi=J(TN);var MN={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};MN.node;var pf=J(MN);var EN={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};EN.node;var mf=J(EN);var AN={name:"list-checks",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]};AN.node;var to=J(AN);var DN={name:"list-ordered",size:24,node:[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]};DN.node;var hf=J(DN);var _N={name:"list-todo",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]};_N.node;var gf=J(_N);var PN={name:"lock",size:24,node:[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]};PN.node;var xf=J(PN);var ON={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};ON.node;var Gu=J(ON);var zN={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};zN.node;var vf=J(zN);var BN={name:"message-circle-question-mark",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["message-circle-question"]};BN.node;var Rs=J(BN);var FN={name:"message-square-reply",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"m10 8-3 3 3 3",key:"fp6dz7"}],["path",{d:"M17 14v-1a2 2 0 0 0-2-2H7",key:"1tkjnz"}]]};FN.node;var yf=J(FN);var HN={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};HN.node;var Ts=J(HN);var qN={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]};qN.node;var bf=J(qN);var UN={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};UN.node;var wf=J(UN);var VN={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};VN.node;var $u=J(VN);var GN={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-3"]};GN.node;var Ms=J(GN);var $N={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};$N.node;var Sf=J($N);var jN={name:"plug",size:24,node:[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]};jN.node;var Cf=J(jN);var WN={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};WN.node;var Yt=J(WN);var XN={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};XN.node;var kf=J(XN);var YN={name:"repeat",size:24,node:[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]};YN.node;var Lf=J(YN);var KN={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};KN.node;var If=J(KN);var ZN={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};ZN.node;var Nf=J(ZN);var QN={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};QN.node;var Rf=J(QN);var JN={name:"signpost",size:24,node:[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M2.354 10.354a1.207 1.207 0 0 1 0-1.708l2.06-2.06A2 2 0 0 1 5.828 6h12.344a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H5.828a2 2 0 0 1-1.414-.586z",key:"1tm261"}]]};JN.node;var Tf=J(JN);var eR={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};eR.node;var Ko=J(eR);var tR={name:"split",size:24,node:[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]};tR.node;var ju=J(tR);var aR={name:"square-kanban",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]],aliases:["kanban-square"]};aR.node;var Es=J(aR);var nR={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};nR.node;var Mf=J(nR);var oR={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};oR.node;var mn=J(oR);var rR={name:"user-check",size:24,node:[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};rR.node;var Ef=J(rR);var sR={name:"webhook",size:24,node:[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]};sR.node;var Af=J(sR);var iR={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};iR.node;var Ui=J(iR);var lR={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};lR.node;var Vi=J(lR);var uR={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};uR.node;var At=J(uR);var cR={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};cR.node;var As=J(cR);var Zf=j(he(),1);var ao=j(he(),1);var pR=Symbol("html"),Df=class{#e;constructor(t,a){if(t!==pR)throw new TypeError("Html is made by html`…`");this.#e=a}static markupOf(t){return t.#e}toString(){if(dR)throw new Error("Html coerced to a string: interpolate it with html`…` or hand it to a sink");return this.#e}toJSON(){if(dR)throw new Error("Html serialized as JSON: convert it with htmlString() first");return this.#e}},dR=typeof process<"u"&&process.env.VITEST!==void 0,lB=e=>new Df(pR,e);var uB={"&":"&","<":"<",">":">",'"':""","'":"'"},cB=e=>e.replace(/[&<>"']/g,t=>uB[t]);function mR(e){if(e==null||typeof e=="boolean")return"";if(e instanceof Df)return Df.markupOf(e);if(Array.isArray(e))return e.map(mR).join("");if(typeof e=="string")return cB(e);if(typeof e=="number"||typeof e=="bigint")return String(e);throw new TypeError(`html: cannot interpolate ${typeof e}`)}var fR=new WeakSet,dB=/<form\b[^>]*\bmethod\s*=\s*["']?post\b/i,fB=/\bname\s*=\s*["']?csrf\b/i;function pB(e){if(fR.has(e))return;let t=e.join("\0");if(dB.test(t))throw new Error("html: write POST forms with postForm, which adds the CSRF field");if(fB.test(t))throw new Error("html: postForm adds the CSRF field; don't write one");fR.add(e)}function Gi(e,...t){pB(e);let a=e[0];for(let n=0;n<t.length;n++)a+=mR(t[n])+e[n+1];return lB(a)}var mB=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],hB=864e5,hR=new Map;function gB(e){let t=hR.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),hR.set(e,t)),t}function nb(e,t){let a=o=>Object.fromEntries(gB(o).formatToParts(e).map(r=>[r.type,r.value])),n;try{n=a(t)}catch{n=a("UTC")}return{year:Number(n.year),month:Number(n.month),day:Number(n.day),clock:`${n.hour}:${n.minute}`}}var gR=e=>Math.floor(Date.UTC(e.year,e.month-1,e.day)/hB);function $i(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Wu(e,t=new Date,a="UTC",n=!1){let o=new Date(e);if(Number.isNaN(o.getTime()))return e;let r=nb(o,a),s=nb(t,a),i=gR(r)-gR(s);if(i===0)return r.clock;if(i===-1)return`Yesterday ${r.clock}`;if(i===1)return`Tomorrow ${r.clock}`;let l=`${mB[r.month-1]} ${r.day}`;return`${r.year===s.year?l:`${l} ${r.year}`}${n?` ${r.clock}`:""}`}function jh(e,t=new Date,a=$i()){if(Number.isNaN(new Date(e.at).getTime()))return e.label;let n=Wu(e.at,t,a,!0);return/^(?:\d|Tomorrow|Yesterday)/.test(n)?`${e.label} ${n}`:`${e.label.replace(/ at$/,"")} ${n}`}function xR(e,t=new Date){let a=new Date(e).getTime();if(Number.isNaN(a))return"";let n=Math.max(0,Math.floor((t.getTime()-a)/6e4));if(n<1)return"now";if(n<60)return`${n}m`;let o=Math.floor(n/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function Wh(e,t="UTC"){let a=new Date(e);if(Number.isNaN(a.getTime()))return e;let n=nb(a,t);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")} ${n.clock}${t==="UTC"?" UTC":""}`}function vR(e,t=new Date,a=$i()){e.querySelectorAll("time[data-when][datetime]").forEach(n=>{let o=n.getAttribute("datetime")??"";if(o===""||Number.isNaN(new Date(o).getTime()))return;if(n.getAttribute("data-when")==="exact"){let i=xB(o,a);n.textContent!==i&&(n.textContent=i);return}let r=Wu(o,t,a),s=Wh(o,a);n.title!==s&&(n.title=s),n.textContent!==r&&(n.textContent=r)})}function xB(e,t="UTC"){let a=new Date(e);if(Number.isNaN(a.getTime()))return e;let n=String(a.getUTCSeconds()).padStart(2,"0"),o=Wh(e,t);return t==="UTC"?o.replace(/ UTC$/,`:${n} UTC`):`${o}:${n}`}var Ds=j(fe(),1),ob=!1;function rb(){ob||(ob=!0,queueMicrotask(()=>{ob=!1,vR(document),window.dispatchEvent(new CustomEvent("standing-orders:workspace-rendered"))}))}function yR(e){return e.contains(document.activeElement)&&document.activeElement?.matches("input, textarea, select, [contenteditable=true]")===!0||e.querySelector("form.approve-form, details[open] form")!==null}function Kt({html:e,immutable:t=!1,className:a=""}){let n=(0,ao.useRef)(null),o=(0,ao.useRef)(null),r=(0,ao.useRef)(!1),[s,i]=(0,ao.useState)(0),[l,c]=(0,ao.useState)(!1),[f,u]=(0,ao.useState)(!1);return(0,ao.useEffect)(()=>{let d=n.current,m=()=>i(g=>g+1);return d?.addEventListener("toggle",m,!0),()=>d?.removeEventListener("toggle",m,!0)},[]),(0,ao.useLayoutEffect)(()=>{let d=n.current;if(!d||o.current===e||t&&o.current!==null)return;if(o.current!==null&&(r.current||yR(d))){let b=d.querySelector("[data-approval]"),v=new DOMParser().parseFromString(e,"text/html").querySelector("[data-approval]");!!d.querySelector("form.approve-form")&&b?.dataset.approval!==v?.dataset.approval?(c(!0),d.querySelectorAll('form.approve-form button[type="submit"], form.approve-form input[type="submit"]').forEach(y=>{y.disabled=!0})):d.querySelector("form.approve-form")||u(!0);return}let m=o.current===null;d.innerHTML=e,o.current=e;let g=m?d.querySelector("[autofocus]"):null;g!==null&&(document.activeElement===null||document.activeElement===document.body)&&g.focus(),u(!1),rb()},[e,t,s]),(0,Ds.jsxs)("div",{className:`so-native-region ${a}`,"data-workspace-native":!0,children:[l&&(0,Ds.jsxs)(fn,{tone:"error",children:["The plan changed. ",(0,Ds.jsx)("a",{href:window.location.href,children:"Review the current plan"})," before approving."]}),f&&(0,Ds.jsxs)("p",{className:"so-deferred",role:"status",children:["Updates are available. Your form is preserved. ",(0,Ds.jsx)("a",{href:window.location.href,children:"Reload"})]}),(0,Ds.jsx)("div",{ref:n,onInput:()=>{r.current=!0},onChange:()=>{r.current=!0},onBlur:()=>i(d=>d+1)})]})}function bR(e){var t,a,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(a=bR(e[t]))&&(n&&(n+=" "),n+=a)}else for(a in e)e[a]&&(n&&(n+=" "),n+=a);return n}function Xh(){for(var e,t,a=0,n="",o=arguments.length;a<o;a++)(e=arguments[a])&&(t=bR(e))&&(n&&(n+=" "),n+=t);return n}var vB=(e,t)=>{let a=new Array(e.length+t.length);for(let n=0;n<e.length;n++)a[n]=e[n];for(let n=0;n<t.length;n++)a[e.length+n]=t[n];return a},yB=(e,t)=>({classGroupId:e,validator:t}),IR=(e=new Map,t=null,a)=>({nextPart:e,validators:t,classGroupId:a});var wR=[],bB="arbitrary..",wB=e=>{let t=CB(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return SB(s);let i=s.split("-"),l=i[0]===""&&i.length>1?1:0;return NR(i,l,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let l=n[s],c=a[s];return l?c?vB(c,l):l:c||wR}return a[s]||wR}}},NR=(e,t,a)=>{if(e.length-t===0)return a.classGroupId;let o=e[t],r=a.nextPart.get(o);if(r){let c=NR(e,t+1,r);if(c)return c}let s=a.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),l=s.length;for(let c=0;c<l;c++){let f=s[c];if(f.validator(i))return f.classGroupId}},SB=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),a=t.indexOf(":"),n=t.slice(0,a);return n?bB+n:void 0})(),CB=e=>{let{theme:t,classGroups:a}=e;return kB(a,t)},kB=(e,t)=>{let a=IR();for(let n in e){let o=e[n];ib(o,a,n,t)}return a},ib=(e,t,a,n)=>{let o=e.length;for(let r=0;r<o;r++){let s=e[r];LB(s,t,a,n)}},LB=(e,t,a,n)=>{if(typeof e=="string"){IB(e,t,a);return}if(typeof e=="function"){NB(e,t,a,n);return}RB(e,t,a,n)},IB=(e,t,a)=>{let n=e===""?t:RR(t,e);n.classGroupId=a},NB=(e,t,a,n)=>{if(TB(e)){ib(e(n),t,a,n);return}t.validators===null&&(t.validators=[]),t.validators.push(yB(a,e))},RB=(e,t,a,n)=>{let o=Object.entries(e),r=o.length;for(let s=0;s<r;s++){let[i,l]=o[s];ib(l,RR(t,i),a,n)}},RR=(e,t)=>{let a=e,n=t.split("-"),o=n.length;for(let r=0;r<o;r++){let s=n[r],i=a.nextPart.get(s);i||(i=IR(),a.nextPart.set(s,i)),a=i}return a},TB=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,MB=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=Object.create(null),n=Object.create(null),o=(r,s)=>{a[r]=s,t++,t>e&&(t=0,n=a,a=Object.create(null))};return{get(r){let s=a[r];if(s!==void 0)return s;if((s=n[r])!==void 0)return o(r,s),s},set(r,s){r in a?a[r]=s:o(r,s)}}};var EB=[],SR=(e,t,a,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:a,maybePostfixModifierPosition:n,isExternal:o}),AB=e=>{let{prefix:t,experimentalParseClassName:a}=e,n=o=>{let r=[],s=0,i=0,l=0,c,f=o.length;for(let b=0;b<f;b++){let v=o[b];if(s===0&&i===0){if(v===":"){r.push(o.slice(l,b)),l=b+1;continue}if(v==="/"){c=b;continue}}v==="["?s++:v==="]"?s--:v==="("?i++:v===")"&&i--}let u=r.length===0?o:o.slice(l),d=u,m=!1;u.endsWith("!")?(d=u.slice(0,-1),m=!0):u.startsWith("!")&&(d=u.slice(1),m=!0);let g=c&&c>l?c-l:void 0;return SR(r,m,d,g)};if(t){let o=t+":",r=n;n=s=>s.startsWith(o)?r(s.slice(o.length)):SR(EB,!1,s,void 0,!0)}if(a){let o=n;n=r=>a({className:r,parseClassName:o})}return n},DB=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((a,n)=>{t.set(a,1e6+n)}),a=>{let n=[],o=[];for(let r=0;r<a.length;r++){let s=a[r],i=s[0]==="[",l=t.has(s);i||l?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(s)):o.push(s)}return o.length>0&&(o.sort(),n.push(...o)),n}},_B=e=>({cache:MB(e.cacheSize),parseClassName:AB(e),sortModifiers:DB(e),postfixLookupClassGroupIds:PB(e),...wB(e)}),PB=e=>{let t=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let n=0;n<a.length;n++)t[a[n]]=!0;return t},OB=/\s+/,zB=(e,t)=>{let{parseClassName:a,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:r,postfixLookupClassGroupIds:s}=t,i=[],l=e.trim().split(OB),c="";for(let f=l.length-1;f>=0;f-=1){let u=l[f],{isExternal:d,modifiers:m,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=a(u);if(d){c=u+(c.length>0?" "+c:c);continue}let x=!!v,y;if(x){let I=b.substring(0,v);y=n(I);let L=y&&s[y]?n(b):void 0;L&&L!==y&&(y=L,x=!1)}else y=n(b);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(b),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}let h=m.length===0?"":m.length===1?m[0]:r(m).join(":"),w=g?h+"!":h,S=w+y;if(i.indexOf(S)>-1)continue;i.push(S);let C=o(y,x);for(let I=0;I<C.length;++I){let L=C[I];i.push(w+L)}c=u+(c.length>0?" "+c:c)}return c},BB=(...e)=>{let t=0,a,n,o="";for(;t<e.length;)(a=e[t++])&&(n=TR(a))&&(o&&(o+=" "),o+=n);return o},TR=e=>{if(typeof e=="string")return e;let t,a="";for(let n=0;n<e.length;n++)e[n]&&(t=TR(e[n]))&&(a&&(a+=" "),a+=t);return a},FB=(e,...t)=>{let a,n,o,r,s=l=>{let c=t.reduce((f,u)=>u(f),e());return a=_B(c),n=a.cache.get,o=a.cache.set,r=i,i(l)},i=l=>{let c=n(l);if(c)return c;let f=zB(l,a);return o(l,f),f};return r=s,(...l)=>r(BB(...l))},HB=[],Zt=e=>{let t=a=>a[e]||HB;return t.isThemeGetter=!0,t.themeKey=e,t},MR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ER=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qB=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,UB=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,VB=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,GB=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,$B=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jB=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_s=e=>qB.test(e),Fe=e=>!!e&&!Number.isNaN(Number(e)),Zo=e=>!!e&&Number.isInteger(Number(e)),sb=e=>e.endsWith("%")&&Fe(e.slice(0,-1)),Rr=e=>UB.test(e),AR=()=>!0,WB=e=>VB.test(e)&&!GB.test(e),lb=()=>!1,XB=e=>$B.test(e),YB=e=>jB.test(e),KB=e=>!ye(e)&&!Se(e),ZB=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),QB=e=>Ps(e,PR,lb),ye=e=>MR.test(e),ji=e=>Ps(e,OR,WB),CR=e=>Ps(e,sF,Fe),JB=e=>Ps(e,BR,AR),eF=e=>Ps(e,zR,lb),kR=e=>Ps(e,DR,lb),tF=e=>Ps(e,_R,YB),Yh=e=>Ps(e,FR,XB),Se=e=>ER.test(e),_f=e=>Wi(e,OR),aF=e=>Wi(e,zR),LR=e=>Wi(e,DR),nF=e=>Wi(e,PR),oF=e=>Wi(e,_R),Kh=e=>Wi(e,FR,!0),rF=e=>Wi(e,BR,!0),Ps=(e,t,a)=>{let n=MR.exec(e);return n?n[1]?t(n[1]):a(n[2]):!1},Wi=(e,t,a=!1)=>{let n=ER.exec(e);return n?n[1]?t(n[1]):a:!1},DR=e=>e==="position"||e==="percentage",_R=e=>e==="image"||e==="url",PR=e=>e==="length"||e==="size"||e==="bg-size",OR=e=>e==="length",sF=e=>e==="number",zR=e=>e==="family-name",BR=e=>e==="number"||e==="weight",FR=e=>e==="shadow";var iF=()=>{let e=Zt("color"),t=Zt("font"),a=Zt("text"),n=Zt("font-weight"),o=Zt("tracking"),r=Zt("leading"),s=Zt("breakpoint"),i=Zt("container"),l=Zt("spacing"),c=Zt("radius"),f=Zt("shadow"),u=Zt("inset-shadow"),d=Zt("text-shadow"),m=Zt("drop-shadow"),g=Zt("blur"),b=Zt("perspective"),v=Zt("aspect"),x=Zt("ease"),y=Zt("animate"),h=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...w(),Se,ye],C=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],L=()=>[Se,ye,l],T=()=>[_s,"full","auto",...L()],A=()=>[Zo,"none","subgrid",Se,ye],D=()=>["auto",{span:["full",Zo,Se,ye]},Zo,Se,ye],H=()=>[Zo,"auto",Se,ye],V=()=>["auto","min","max","fr",Se,ye],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...L()],_=()=>[_s,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],z=()=>[i,_s,"screen","full","dvw","lvw","svw","min","max","fit",...L()],q=()=>[_s,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],O=()=>[e,Se,ye],W=()=>[...w(),LR,kR,{position:[Se,ye]}],ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],de=()=>["auto","cover","contain",nF,QB,{size:[Se,ye]}],ne=()=>[sb,_f,ji],re=()=>["","none","full",c,Se,ye],ue=()=>["",Fe,_f,ji],ce=()=>["solid","dashed","dotted","double"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[Fe,sb,LR,kR],se=()=>["","none",g,Se,ye],le=()=>["none",Fe,Se,ye],B=()=>["none",Fe,Se,ye],G=()=>[Fe,Se,ye],oe=()=>[_s,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Rr],breakpoint:[Rr],color:[AR],container:[Rr],"drop-shadow":[Rr],ease:["in","out","in-out"],font:[KB],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Rr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Rr],shadow:[Rr],spacing:["px",Fe],text:[Rr],"text-shadow":[Rr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",_s,ye,Se,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Se,ye]}],"container-named":[ZB],columns:[{columns:[Fe,"auto",ye,Se,i]}],"break-after":[{"break-after":h()}],"break-before":[{"break-before":h()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Zo,"auto",Se,ye]}],basis:[{basis:[_s,"full","auto",i,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,_s,"auto","initial","none",ye]}],grow:[{grow:["",Fe,Se,ye]}],shrink:[{shrink:["",Fe,Se,ye]}],order:[{order:[Zo,"first","last","none",Se,ye]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[i,"screen",..._()]}],"min-w":[{"min-w":[i,"screen","none",..._()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh","none",..._()]}],"font-size":[{text:["base",a,_f,ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,rF,JB]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sb,ye]}],"font-family":[{font:[aF,eF,t]}],"font-features":[{"font-features":[ye]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Se,ye]}],"line-clamp":[{"line-clamp":[Fe,"none",Se,CR]}],leading:[{leading:["none",r,...L()]}],"list-image":[{"list-image":["none",Se,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Se,ji]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Fe,"auto",Se,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"tab-size":[{tab:[Zo,Se,ye]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Se,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:de()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zo,Se,ye],radial:["",Se,ye],conic:["",Zo,Se,ye]},oF,tF]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Se,ye]}],"outline-w":[{outline:["",Fe,_f,ji]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","inner","none",f,Kh,Yh]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",u,Kh,Yh]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Fe,ji]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",d,Kh,Yh]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Fe,Se,ye]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[Se,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:de()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,ye]}],filter:[{filter:["","none",Se,ye]}],blur:[{blur:se()}],brightness:[{brightness:[Fe,Se,ye]}],contrast:[{contrast:[Fe,Se,ye]}],"drop-shadow":[{"drop-shadow":["","none",m,Kh,Yh]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Fe,Se,ye]}],"hue-rotate":[{"hue-rotate":[Fe,Se,ye]}],invert:[{invert:["",Fe,Se,ye]}],saturate:[{saturate:[Fe,Se,ye]}],sepia:[{sepia:["",Fe,Se,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,ye]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Se,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Se,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Se,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Se,ye]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Se,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Se,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Se,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Se,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Se,ye]}],ease:[{ease:["linear","initial",x,Se,ye]}],delay:[{delay:[Fe,Se,ye]}],animate:[{animate:["none",y,Se,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Se,ye]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[Se,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],zoom:[{zoom:[Zo,Se,ye]}],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Se,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Se,ye]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Fe,_f,ji,CR]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var HR=FB(iF);function te(...e){return HR(Xh(e))}var qR=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,UR=Xh,Zh=(e,t)=>a=>{var n;if(t?.variants==null)return UR(e,a?.class,a?.className);let{variants:o,defaultVariants:r}=t,s=Object.keys(o).map(c=>{let f=a?.[c],u=r?.[c];if(f===null)return null;let d=qR(f)||qR(u);return o[c][d]}),i=a&&Object.entries(a).reduce((c,f)=>{let[u,d]=f;return d===void 0||(c[u]=d),c},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,f)=>{let{class:u,className:d,...m}=f;return Object.entries(m).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...r,...i}[b]):{...r,...i}[b]===v})?[...c,u,d]:c},[]);return UR(e,s,l,a?.class,a?.className)};var VR=j(fe(),1),lF=Zh("inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-[13px] font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",attention:"bg-attention text-on-attention hover:bg-[var(--so-signal-hover)]",destructive:"bg-destructive-soft text-destructive hover:bg-destructive/15",outline:"bg-card text-foreground shadow-[var(--so-pill-shadow)] hover:bg-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent",ghost:"text-muted-foreground hover:bg-accent hover:text-foreground",link:"text-foreground underline underline-offset-4 decoration-border hover:decoration-muted-foreground"},size:{default:"h-8 px-3 phone:h-11 phone:px-4",sm:"h-7 px-2.5 text-[12.5px] phone:h-11 phone:px-3 phone:text-[13px]",lg:"h-10 px-5",icon:"size-8 phone:size-11"}},defaultVariants:{variant:"default",size:"default"}});function Z({className:e,variant:t,size:a,asChild:n=!1,type:o,...r}){return(0,VR.jsx)(n?Nh:"button",{"data-slot":"button",className:te(lF({variant:t,size:a}),e),...n?{}:{type:o??"button"},...r})}var GR=j(fe(),1),Qh=Zh("inline-flex w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-[5px] px-1.5 py-px text-[11.5px] font-medium leading-[18px] [&_svg]:size-3",{variants:{tone:{neutral:"bg-neutral-soft text-neutral-ink",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",attention:"bg-attention-soft text-attention",danger:"bg-destructive-soft text-destructive",info:"bg-info-soft text-info"}},defaultVariants:{tone:"neutral"}});function wa({className:e,tone:t,...a}){return(0,GR.jsx)("span",{"data-slot":"badge",className:te(Qh({tone:t}),e),...a})}var Pf=j(fe(),1);function Sa({className:e,...t}){return(0,Pf.jsx)("section",{"data-slot":"card",className:te("flex flex-col gap-4 rounded-[10px] border border-border bg-card p-5 text-card-foreground phone:gap-3 phone:p-3.5",e),...t})}function $R({className:e,...t}){return(0,Pf.jsx)("div",{"data-slot":"card-header",className:te("flex items-start justify-between gap-3",e),...t})}function jR({className:e,...t}){return(0,Pf.jsx)("h2",{"data-slot":"card-title",className:te("text-base font-semibold leading-snug",e),...t})}function WR({className:e,...t}){return(0,Pf.jsx)("p",{"data-slot":"card-description",className:te("text-sm text-muted-foreground",e),...t})}var la=j(he(),1);var yo=j(he(),1);var Jh=j(fe(),1),hn=j(he(),1);var Xi=j(fe(),1),uF=Object.defineProperty,ia=(e,t)=>uF(e,"name",{value:t,configurable:!0});function Yi(e){let t=e+"CollectionProvider",[a,n]=xt(t),[o,r]=a(t,{collectionRef:{current:null},itemMap:new Map}),s=ia(b=>{let{scope:v,children:x}=b,y=yo.useRef(null),h=yo.useRef(new Map).current;return(0,Jh.jsx)(o,{scope:v,itemMap:h,collectionRef:y,children:x})},"CollectionProvider");s.displayName=t;let i=e+"CollectionSlot",l=Ea(i),c=yo.forwardRef((b,v)=>{let{scope:x,children:y}=b,h=r(i,x),w=Te(v,h.collectionRef);return(0,Jh.jsx)(l,{ref:w,children:y})});c.displayName=i;let f=e+"CollectionItemSlot",u="data-radix-collection-item",d=Ea(f),m=yo.forwardRef((b,v)=>{let{scope:x,children:y,...h}=b,w=yo.useRef(null),S=Te(v,w),C=r(f,x);return yo.useEffect(()=>(C.itemMap.set(w,{ref:w,...h}),()=>{C.itemMap.delete(w)})),(0,Jh.jsx)(d,{[u]:"",ref:S,children:y})});m.displayName=f;function g(b){let v=r(e+"CollectionConsumer",b);return yo.useCallback(()=>{let y=v.collectionRef.current;if(!y)return[];let h=Array.from(y.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((C,I)=>h.indexOf(C.ref.current)-h.indexOf(I.ref.current))},[v.collectionRef,v.itemMap])}return ia(g,"useCollection"),[{Provider:s,Slot:c,ItemSlot:m},g,n]}ia(Yi,"createCollection");var XR=new WeakMap,ub=class Os extends Map{static{ia(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],XR.set(this,!0)}set(t,a){return XR.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,a),this}insert(t,a,n){let o=this.has(a),r=this.#e.length,s=db(t),i=s>=0?s:r+s,l=i<0||i>=r?-1:i;if(l===this.size||o&&l===this.size-1||l===-1)return this.set(a,n),this;let c=this.size+(o?0:1);s<0&&i++;let f=[...this.#e],u,d=!1;for(let m=i;m<c;m++)if(i===m){let g=f[m];f[m]===a&&(g=f[m+1]),o&&this.delete(a),u=this.get(g),this.set(a,n)}else{!d&&f[m-1]===a&&(d=!0);let g=f[d?m:m-1],b=u;u=this.get(g),this.delete(g),this.set(g,b)}return this}with(t,a,n){let o=new Os(this);return o.insert(t,a,n),o}before(t){let a=this.#e.indexOf(t)-1;if(!(a<0))return this.entryAt(a)}setBefore(t,a,n){let o=this.#e.indexOf(t);return o===-1?this:this.insert(o,a,n)}after(t){let a=this.#e.indexOf(t);if(a=a===-1||a===this.size-1?-1:a+1,a!==-1)return this.entryAt(a)}setAfter(t,a,n){let o=this.#e.indexOf(t);return o===-1?this:this.insert(o+1,a,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){let a=super.delete(t);return a&&this.#e.splice(this.#e.indexOf(t),1),a}deleteAt(t){let a=this.keyAt(t);return a!==void 0?this.delete(a):!1}at(t){let a=eg(this.#e,t);if(a!==void 0)return this.get(a)}entryAt(t){let a=eg(this.#e,t);if(a!==void 0)return[a,this.get(a)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return eg(this.#e,t)}from(t,a){let n=this.indexOf(t);if(n===-1)return;let o=n+a;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(t,a){let n=this.indexOf(t);if(n===-1)return;let o=n+a;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(t,a){let n=0;for(let o of this){if(Reflect.apply(t,a,[o,n,this]))return o;n++}}findIndex(t,a){let n=0;for(let o of this){if(Reflect.apply(t,a,[o,n,this]))return n;n++}return-1}filter(t,a){let n=[],o=0;for(let r of this)Reflect.apply(t,a,[r,o,this])&&n.push(r),o++;return new Os(n)}map(t,a){let n=[],o=0;for(let r of this)n.push([r[0],Reflect.apply(t,a,[r,o,this])]),o++;return new Os(n)}reduce(...t){let[a,n]=t,o=0,r=n??this.at(0);for(let s of this)o===0&&t.length===1?r=s:r=Reflect.apply(a,this,[r,s,o,this]),o++;return r}reduceRight(...t){let[a,n]=t,o=n??this.at(-1);for(let r=this.size-1;r>=0;r--){let s=this.at(r);r===this.size-1&&t.length===1?o=s:o=Reflect.apply(a,this,[o,s,r,this])}return o}toSorted(t){let a=[...this.entries()].sort(t);return new Os(a)}toReversed(){let t=new Os;for(let a=this.size-1;a>=0;a--){let n=this.keyAt(a),o=this.get(n);t.set(n,o)}return t}toSpliced(...t){let a=[...this.entries()];return a.splice(...t),new Os(a)}slice(t,a){let n=new Os,o=this.size-1;if(t===void 0)return n;t<0&&(t=t+this.size),a!==void 0&&a>0&&(o=a-1);for(let r=t;r<=o;r++){let s=this.keyAt(r),i=this.get(s);n.set(s,i)}return n}every(t,a){let n=0;for(let o of this){if(!Reflect.apply(t,a,[o,n,this]))return!1;n++}return!0}some(t,a){let n=0;for(let o of this){if(Reflect.apply(t,a,[o,n,this]))return!0;n++}return!1}};function eg(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=YR(e,t);return a===-1?void 0:e[a]}ia(eg,"at");function YR(e,t){let a=e.length,n=db(t),o=n>=0?n:a+n;return o<0||o>=a?-1:o}ia(YR,"toSafeIndex");function db(e){return e!==e||e===0?0:Math.trunc(e)}ia(db,"toSafeInteger");function cF(e){let t=e+"CollectionProvider",[a,n]=xt(t),[o,r]=a(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new ub,setItemMap:ia(()=>{},"setItemMap")}),s=ia(({state:h,...w})=>h?(0,Xi.jsx)(l,{...w,state:h}):(0,Xi.jsx)(i,{...w}),"CollectionProvider");s.displayName=t;let i=ia(h=>{let w=v();return(0,Xi.jsx)(l,{...h,state:w})},"CollectionInit");i.displayName=t+"Init";let l=ia(h=>{let{scope:w,children:S,state:C}=h,I=hn.useRef(null),[L,T]=hn.useState(null),A=Te(I,T),[D,H]=C;return hn.useEffect(()=>{if(!L)return;let V=QR(()=>{});return V.observe(L,{childList:!0,subtree:!0}),()=>{V.disconnect()}},[L]),(0,Xi.jsx)(o,{scope:w,itemMap:D,setItemMap:H,collectionRef:A,collectionRefObject:I,collectionElement:L,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";let c=e+"CollectionSlot",f=Ea(c),u=hn.forwardRef((h,w)=>{let{scope:S,children:C}=h,I=r(c,S),L=Te(w,I.collectionRef);return(0,Xi.jsx)(f,{ref:L,children:C})});u.displayName=c;let d=e+"CollectionItemSlot",m="data-radix-collection-item",g=Ea(d),b=hn.forwardRef((h,w)=>{let{scope:S,children:C,...I}=h,L=hn.useRef(null),[T,A]=hn.useState(null),D=Te(w,L,A),H=r(d,S),{setItemMap:V}=H,N=hn.useRef(I);KR(N.current,I)||(N.current=I);let P=N.current;return hn.useEffect(()=>{let E=P;return V(_=>T?_.has(T)?_.set(T,{...E,element:T}).toSorted(cb):(_.set(T,{...E,element:T}),_.toSorted(cb)):_),()=>{V(_=>!T||!_.has(T)?_:(_.delete(T),new ub(_)))}},[T,P,V]),(0,Xi.jsx)(g,{[m]:"",ref:D,children:C})});b.displayName=d;function v(){return hn.useState(new ub)}ia(v,"useInitCollection");function x(h){let{itemMap:w}=r(e+"CollectionConsumer",h);return w}return ia(x,"useCollection"),[{Provider:s,Slot:u,ItemSlot:b},{createCollectionScope:n,useCollection:x,useInitCollection:v}]}ia(cF,"createCollection");function KR(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;let a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(let o of a)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}ia(KR,"shallowEqual");function ZR(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ia(ZR,"isElementPreceding");function cb(e,t){return!e[1].element||!t[1].element?0:ZR(e[1].element,t[1].element)?-1:1}ia(cb,"sortByDocumentPosition");function QR(e){return new MutationObserver(a=>{for(let n of a)if(n.type==="childList"){e();return}})}ia(QR,"getChildListObserver");var tg=j(he(),1),pF=j(fe(),1),dF=Object.defineProperty,fF=(e,t)=>dF(e,"name",{value:t,configurable:!0}),mF=tg.createContext(void 0);function Tr(e){let t=tg.useContext(mF);return e||t||"ltr"}fF(Tr,"useDirection");var gF=j(he(),1),ag=j(he(),1),hF=Object.defineProperty,pb=(e,t)=>hF(e,"name",{value:t,configurable:!0}),fb=!1;function JR(){let[e,t]=ag.useState(fb);return ag.useEffect(()=>{fb||(fb=!0,t(!0))},[]),e}pb(JR,"useIsHydrated");var e5=gF[" useSyncExternalStore ".trim().toString()];function t5(){return()=>{}}pb(t5,"subscribe");function a5(){return e5(t5,()=>!0,()=>!1)}pb(a5,"useIsHydratedModern");var n5=typeof e5=="function"?a5:JR;var zs=j(fe(),1),xF=Object.defineProperty,Ki=(e,t)=>xF(e,"name",{value:t,configurable:!0}),mb="rovingFocusGroup.onEntryFocus",vF={bubbles:!1,cancelable:!0},ng="RovingFocusGroup",[hb,o5,yF]=Yi(ng),[bF,Xu]=xt(ng,[yF]),[wF,SF]=bF(ng),CF=la.forwardRef(Ki(function(t,a){return(0,zs.jsx)(hb.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,zs.jsx)(hb.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,zs.jsx)(kF,{...t,ref:a})})})},"RovingFocusGroup")),kF=la.forwardRef(Ki(function(t,a){let{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...d}=t,m=la.useRef(null),g=Te(a,m),b=Tr(s),[v,x]=Ma({prop:i,defaultProp:l??null,onChange:c,caller:ng}),[y,h]=la.useState(!1),w=oa(f),S=o5(n),C=la.useRef(!1),[I,L]=la.useState(0);return la.useEffect(()=>{let T=m.current;if(T)return T.addEventListener(mb,w),()=>T.removeEventListener(mb,w)},[w]),(0,zs.jsx)(wF,{scope:n,orientation:o,dir:b,loop:r,currentTabStopId:v,onItemFocus:la.useCallback(T=>x(T),[x]),onItemShiftTab:la.useCallback(()=>h(!0),[]),onFocusableItemAdd:la.useCallback(()=>L(T=>T+1),[]),onFocusableItemRemove:la.useCallback(()=>L(T=>T-1),[]),children:(0,zs.jsx)(Re.div,{tabIndex:y||I===0?-1:0,"data-orientation":o,...d,ref:g,style:{outline:"none",...t.style},onMouseDown:ke(t.onMouseDown,()=>{C.current=!0}),onFocus:ke(t.onFocus,T=>{let A=!C.current;if(T.target===T.currentTarget&&A&&!y){let D=new CustomEvent(mb,vF);if(T.currentTarget.dispatchEvent(D),!D.defaultPrevented){let H=S().filter(_=>_.focusable),V=H.find(_=>_.active),N=H.find(_=>_.id===v),E=[V,N,...H].filter(Boolean).map(_=>_.ref.current);gb(E,u)}}C.current=!1}),onBlur:ke(t.onBlur,()=>h(!1))})})},"RovingFocusGroupImpl")),LF="RovingFocusGroupItem",IF=la.forwardRef(Ki(function(t,a){let{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:i,...l}=t,c=Ga(),f=s||c,u=SF(LF,n),d=u.currentTabStopId===f,m=o5(n),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:v}=u,x=n5();return Ze(()=>{if(!(!x||!o))return g(),()=>b()},[x,o,g,b]),la.useEffect(()=>{if(!(x||!o))return g(),()=>b()},[x,o,g,b]),(0,zs.jsx)(hb.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:(0,zs.jsx)(Re.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:a,onMouseDown:ke(t.onMouseDown,y=>{o?u.onItemFocus(f):y.preventDefault()}),onFocus:ke(t.onFocus,()=>u.onItemFocus(f)),onKeyDown:ke(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;let h=s5(y,u.orientation,u.dir);if(h!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let S=m().filter(C=>C.focusable).map(C=>C.ref.current);if(h==="last")S.reverse();else if(h==="prev"||h==="next"){h==="prev"&&S.reverse();let C=S.indexOf(y.currentTarget);S=u.loop?i5(S,C+1):S.slice(C+1)}setTimeout(()=>gb(S))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:v!=null}):i})})},"RovingFocusGroupItem")),NF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function r5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Ki(r5,"getDirectionAwareKey");function s5(e,t,a){let n=r5(e.key,a);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return NF[n]}Ki(s5,"getFocusIntent");function gb(e,t=!1){let a=document.activeElement;for(let n of e)if(n===a||(n.focus({preventScroll:t}),document.activeElement!==a))return}Ki(gb,"focusFirst");function i5(e,t){return e.map((a,n)=>e[(t+n)%e.length])}Ki(i5,"wrapArray");var og=CF,rg=IF;var RF=j(fe(),1);var Wa=j(he(),1);var Ca=j(he(),1);var u5=j(he(),1);var TF=Object.defineProperty,MF=(e,t)=>TF(e,"name",{value:t,configurable:!0});function Zi(e){let[t,a]=u5.useState(void 0);return Ze(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let r=o[0],s,i;if("borderBoxSize"in r){let l=r.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,i=c.blockSize}else s=e.offsetWidth,i=e.offsetHeight;a({width:s,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else a(void 0)},[e]),t}MF(Zi,"useSize");var Yu=j(fe(),1),Pa=j(fe(),1),EF=Object.defineProperty,_a=(e,t)=>EF(e,"name",{value:t,configurable:!0}),c5="Radio",[AF,d5]=xt(c5),[DF,sg]=AF(c5);function f5(e){let{__scopeRadio:t,checked:a=!1,children:n,disabled:o,form:r,name:s,onCheck:i,required:l,value:c="on",internal_do_not_use_render:f}=e,[u,d]=Ca.useState(null),[m,g]=Ca.useState(null),b=Ca.useRef(!1),[v,x]=Ca.useReducer(w=>w+1,0),y=u?!!r||!!u.closest("form"):!0,h={checked:a,disabled:o,required:l,name:s,form:r,value:c,control:u,setControl:d,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:x,isFormControl:y,bubbleInput:m,setBubbleInput:g,onCheck:_a(()=>i?.(),"onCheck")};return(0,Yu.jsx)(DF,{scope:t,...h,children:p5(f)?f(h):n})}_a(f5,"RadioProvider");var _F="RadioTrigger",PF=Ca.forwardRef(_a(function({__scopeRadio:t,onClick:a,...n},o){let{checked:r,disabled:s,value:i,setControl:l,onCheck:c,hasConsumerStoppedPropagationRef:f,onUserInteraction:u,isFormControl:d,bubbleInput:m}=sg(_F,t),g=Te(o,l);return(0,Yu.jsx)(Re.button,{type:"button",role:"radio","aria-checked":r,"data-state":xb(r),"data-disabled":s?"":void 0,disabled:s,value:i,...n,ref:g,onClick:ke(a,b=>{r||(u(),c()),m&&d&&(f.current=b.isPropagationStopped(),f.current||b.stopPropagation())})})},"RadioTrigger")),OF="RadioIndicator",zF=Ca.forwardRef(_a(function(t,a){let{__scopeRadio:n,forceMount:o,...r}=t,s=sg(OF,n);return(0,Yu.jsx)(An,{present:o||s.checked,children:(0,Yu.jsx)(Re.span,{"data-state":xb(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:a})})},"RadioIndicator")),BF="RadioBubbleInput",FF=Ca.forwardRef(_a(function({__scopeRadio:t,onClick:a,...n},o){let{control:r,checked:s,required:i,disabled:l,name:c,value:f,form:u,bubbleInput:d,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=sg(BF,t),v=Te(o,m),x=Zi(r),y=Ca.useRef(!1),h=Ca.useRef(s),w=Ca.useRef(b);Ca.useEffect(()=>{let C=d;if(!C)return;let I=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(I,"checked").set,A=b!==w.current;w.current=b;let D=h.current!==s;h.current=s;let H=!(A&&g.current);if(D&&T){y.current=!A;let V=new Event("click",{bubbles:H});T.call(C,s),C.dispatchEvent(V),y.current=!1}},[d,s,g,b]);let S=Ca.useRef(s);return(0,Yu.jsx)(Re.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:i,disabled:l,name:c,value:f,form:u,...n,tabIndex:-1,ref:v,onClick:ke(a,C=>{y.current&&C.stopPropagation()}),style:{...n.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function p5(e){return typeof e=="function"}_a(p5,"isFunction");function xb(e){return e?"checked":"unchecked"}_a(xb,"getState");var HF=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],vb="RadioGroup",[qF,_oe]=xt(vb,[Xu,d5]),m5=Xu(),ig=d5(),[UF,VF]=qF(vb),h5=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,name:o,form:r,defaultValue:s,value:i,required:l=!1,disabled:c=!1,orientation:f,dir:u,loop:d=!0,onValueChange:m,...g}=t,b=m5(n),v=Tr(u),[x,y]=Ma({prop:i,defaultProp:s??null,onChange:m,caller:vb}),[h,w]=Wa.useState(null),S=Te(a,w),C=Wa.useRef(x);return Wa.useEffect(()=>{let I=r?h?.ownerDocument.getElementById(r):h?.closest("form");if(I instanceof HTMLFormElement){let L=_a(()=>y(C.current),"reset");return I.addEventListener("reset",L),()=>I.removeEventListener("reset",L)}},[h,r,y]),(0,Pa.jsx)(UF,{scope:n,name:o,form:r,required:l,disabled:c,value:x,onValueChange:y,children:(0,Pa.jsx)(og,{asChild:!0,...b,orientation:f,dir:v,loop:d,children:(0,Pa.jsx)(Re.div,{role:"radiogroup","aria-required":l,"aria-orientation":f,"data-disabled":c?"":void 0,dir:v,...g,ref:S})})})},"RadioGroup")),GF="RadioGroupItemProvider",$F="RadioGroupItemTrigger";function g5(e){let{__scopeRadioGroup:t,value:a,disabled:n,children:o,internal_do_not_use_render:r}=e,s=VF(GF,t),i=ig(t),l=s.disabled||n;return(0,Pa.jsx)(f5,{...i,checked:s.value===a,disabled:l,required:s.required,name:s.name,form:s.form,value:a,onCheck:()=>s.onValueChange(a),internal_do_not_use_render:r,children:o})}_a(g5,"RadioGroupItemProvider");var jF=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,...o}=t,r=m5(n),s=ig(n),{checked:i,disabled:l}=sg($F,s.__scopeRadio),c=Wa.useRef(null),f=Te(a,c),u=Wa.useRef(!1);return Wa.useEffect(()=>{let d=_a(g=>{HF.includes(g.key)&&(u.current=!0)},"handleKeyDown"),m=_a(()=>u.current=!1,"handleKeyUp");return document.addEventListener("keydown",d),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",d),document.removeEventListener("keyup",m)}},[]),(0,Pa.jsx)(rg,{asChild:!0,...r,focusable:!l,active:i,children:(0,Pa.jsx)(PF,{...s,...o,ref:f,onKeyDown:ke(o.onKeyDown,d=>{d.key==="Enter"&&d.preventDefault()}),onFocus:ke(o.onFocus,()=>{u.current&&c.current?.click()})})})},"RadioGroupItemTrigger")),x5=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,value:o,disabled:r,...s}=t;return(0,Pa.jsx)(g5,{__scopeRadioGroup:n,value:o,disabled:r,internal_do_not_use_render:({isFormControl:i})=>(0,Pa.jsxs)(Pa.Fragment,{children:[(0,Pa.jsx)(jF,{...s,ref:a,__scopeRadioGroup:n}),i&&(0,Pa.jsx)(WF,{__scopeRadioGroup:n})]})})},"RadioGroupItem")),WF=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,...o}=t,r=ig(n);return(0,Pa.jsx)(FF,{...r,...o,ref:a})},"RadioGroupItemBubbleInput")),v5=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,...o}=t,r=ig(n);return(0,Pa.jsx)(zF,{...r,...o,ref:a})},"RadioGroupIndicator"));var bo=j(fe(),1);function lg({className:e,...t}){return(0,bo.jsx)(h5,{"data-slot":"radio-group",className:te("grid gap-2",e),...t})}function YF({className:e,...t}){return(0,bo.jsx)(x5,{"data-slot":"radio-group-item",className:te("mt-0.5 aspect-square size-4 shrink-0 rounded-full border border-input text-primary outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-primary",e),...t,children:(0,bo.jsx)(v5,{className:"flex items-center justify-center",children:(0,bo.jsx)(Fi,{className:"size-2 fill-current"})})})}function Of({value:e,id:t,title:a,description:n,className:o}){return(0,bo.jsxs)("label",{htmlFor:t,className:te("flex cursor-pointer items-start gap-3 rounded-lg border border-border bg-card p-3.5 transition-colors phone:min-h-11 phone:px-3 phone:py-2.5 hover:bg-accent has-[[data-state=checked]]:border-primary has-[[data-state=checked]]:bg-accent",o),children:[(0,bo.jsx)(YF,{value:e,id:t}),(0,bo.jsxs)("span",{className:"grid gap-0.5",children:[(0,bo.jsx)("span",{className:"text-sm font-semibold",children:a}),n&&(0,bo.jsx)("span",{className:"text-[13px] text-muted-foreground phone:leading-[1.35]",children:n})]})]})}var xe=j(he(),1),Mb=j($r(),1);var KF=Object.defineProperty,ZF=(e,t)=>KF(e,"name",{value:t,configurable:!0});function ug(e,[t,a]){return Math.min(a,Math.max(t,e))}ZF(ug,"clamp");var Oa=j(he(),1);var w5=["top","right","bottom","left"];var Qo=Math.min,wo=Math.max,Bf=Math.round,Ff=Math.floor,Jo=e=>({x:e,y:e}),QF={left:"right",right:"left",bottom:"top",top:"bottom"};function yb(e,t,a){return wo(e,Qo(t,a))}function er(e,t){return typeof e=="function"?e(t):e}function Mr(e){return e.split("-")[0]}function Qi(e){return e.split("-")[1]}function dg(e){return e==="x"?"y":"x"}function fg(e){return e==="y"?"height":"width"}function So(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function pg(e){return dg(So(e))}function S5(e,t,a){a===void 0&&(a=!1);let n=Qi(e),o=pg(e),r=fg(o),s=o==="x"?n===(a?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=zf(s)),[s,zf(s)]}function C5(e){let t=zf(e);return[cg(e),t,cg(t)]}function cg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var y5=["left","right"],b5=["right","left"],JF=["top","bottom"],eH=["bottom","top"];function tH(e,t,a){switch(e){case"top":case"bottom":return a?t?b5:y5:t?y5:b5;case"left":case"right":return t?JF:eH;default:return[]}}function k5(e,t,a,n){let o=Qi(e),r=tH(Mr(e),a==="start",n);return o&&(r=r.map(s=>s+"-"+o),t&&(r=r.concat(r.map(cg)))),r}function zf(e){let t=Mr(e);return QF[t]+e.slice(t.length)}function aH(e){var t,a,n,o;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(n=e.bottom)!=null?n:0,left:(o=e.left)!=null?o:0}}function bb(e){return typeof e!="number"?aH(e):{top:e,right:e,bottom:e,left:e}}function Ji(e){let{x:t,y:a,width:n,height:o}=e;return{width:n,height:o,top:a,left:t,right:t+n,bottom:a+o,x:t,y:a}}function L5(e,t,a){let{reference:n,floating:o}=e,r=So(t),s=pg(t),i=fg(s),l=Mr(t),c=r==="y",f=n.x+n.width/2-o.width/2,u=n.y+n.height/2-o.height/2,d=n[i]/2-o[i]/2,m;switch(l){case"top":m={x:f,y:n.y-o.height};break;case"bottom":m={x:f,y:n.y+n.height};break;case"right":m={x:n.x+n.width,y:u};break;case"left":m={x:n.x-o.width,y:u};break;default:m={x:n.x,y:n.y}}let g=Qi(t);return g&&(m[s]+=d*(g==="end"?1:-1)*(a&&c?-1:1)),m}async function R5(e,t){var a;t===void 0&&(t={});let{x:n,y:o,platform:r,rects:s,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:m=0}=er(t,e),g=bb(m),v=i[d?u==="floating"?"reference":"floating":u],x=Ji(await r.getClippingRect({element:(a=await(r.isElement==null?void 0:r.isElement(v)))==null||a?v:v.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(i.floating)),boundary:c,rootBoundary:f,strategy:l})),y=u==="floating"?{x:n,y:o,width:s.floating.width,height:s.floating.height}:s.reference,h=await(r.getOffsetParent==null?void 0:r.getOffsetParent(i.floating)),w=await(r.isElement==null?void 0:r.isElement(h))&&await(r.getScale==null?void 0:r.getScale(h))||{x:1,y:1},S=Ji(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:y,offsetParent:h,strategy:l}):y);return{top:(x.top-S.top+g.top)/w.y,bottom:(S.bottom-x.bottom+g.bottom)/w.y,left:(x.left-S.left+g.left)/w.x,right:(S.right-x.right+g.right)/w.x}}var nH=50,T5=async(e,t,a)=>{let{placement:n="bottom",strategy:o="absolute",middleware:r=[],platform:s}=a,i=s.detectOverflow?s:{...s,detectOverflow:R5},l=await(s.isRTL==null?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=L5(c,n,l),d=n,m=0,g={};for(let b=0;b<r.length;b++){let v=r[b];if(!v)continue;let{name:x,fn:y}=v,{x:h,y:w,data:S,reset:C}=await y({x:f,y:u,initialPlacement:n,placement:d,strategy:o,middlewareData:g,rects:c,platform:i,elements:{reference:e,floating:t}});f=h??f,u=w??u,g[x]={...g[x],...S},C&&m<nH&&(m++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:f,y:u}=L5(c,d,l)),b=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:g}},M5=e=>({name:"arrow",options:e,async fn(t){let{x:a,y:n,placement:o,rects:r,platform:s,elements:i,middlewareData:l}=t,{element:c,padding:f=0}=er(e,t)||{};if(c==null)return{};let u=bb(f),d={x:a,y:n},m=pg(o),g=fg(m),b=await s.getDimensions(c),v=m==="y",x=v?"top":"left",y=v?"bottom":"right",h=v?"clientHeight":"clientWidth",w=r.reference[g]+r.reference[m]-d[m]-r.floating[g],S=d[m]-r.reference[m],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),I=C?C[h]:0;(!I||!await(s.isElement==null?void 0:s.isElement(C)))&&(I=i.floating[h]||r.floating[g]);let L=w/2-S/2,T=I/2-b[g]/2-1,A=Qo(u[x],T),D=Qo(u[y],T),H=I-b[g]-D,V=I/2-b[g]/2+L,N=yb(A,V,H),P=!l.arrow&&Qi(o)!=null&&V!==N&&r.reference[g]/2-(V<A?A:D)-b[g]/2<0,E=P?V<A?V-A:V-H:0;return{[m]:d[m]+E,data:{[m]:N,centerOffset:V-N-E,...P&&{alignmentOffset:E}},reset:P}}});var E5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var a,n;let{placement:o,middlewareData:r,rects:s,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=er(e,t);if((a=r.arrow)!=null&&a.alignmentOffset)return{};let x=Mr(o),y=So(i),h=Mr(i)===i,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=d||(h||!b?[zf(i)]:C5(i)),C=g!=="none";!d&&C&&S.push(...k5(i,b,g,w));let I=[i,...S],L=await l.detectOverflow(t,v),T=[],A=((n=r.flip)==null?void 0:n.overflows)||[];if(f&&T.push(L[x]),u){let N=S5(o,s,w);T.push(L[N[0]],L[N[1]])}if(A=[...A,{placement:o,overflows:T}],!T.every(N=>N<=0)){var D,H;let N=(((D=r.flip)==null?void 0:D.index)||0)+1,P=I[N];if(P&&(!(u==="alignment"?y!==So(P):!1)||A.every(z=>So(z.placement)===y?z.overflows[0]>0:!0)))return{data:{index:N,overflows:A},reset:{placement:P}};let E=(H=A.filter(_=>_.overflows[0]<=0).sort((_,z)=>_.overflows[1]-z.overflows[1])[0])==null?void 0:H.placement;if(!E)switch(m){case"bestFit":{var V;let _=(V=A.filter(z=>{if(C){let q=So(z.placement);return q===y||q==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(q=>q>0).reduce((q,O)=>q+O,0)]).sort((z,q)=>z[1]-q[1])[0])==null?void 0:V[0];_&&(E=_);break}case"initialPlacement":E=i;break}if(o!==E)return{reset:{placement:E}}}return{}}}};function I5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function N5(e){return w5.some(t=>e[t]>=0)}var A5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){let{rects:a,platform:n}=t,{strategy:o="referenceHidden",...r}=er(e,t);switch(o){case"referenceHidden":{let s=await n.detectOverflow(t,{...r,elementContext:"reference"}),i=I5(s,a.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:N5(i)}}}case"escaped":{let s=await n.detectOverflow(t,{...r,altBoundary:!0}),i=I5(s,a.floating);return{data:{escapedOffsets:i,escaped:N5(i)}}}default:return{}}}}};var D5=new Set(["left","top"]);async function oH(e,t){let{placement:a,platform:n,elements:o}=e,r=await(n.isRTL==null?void 0:n.isRTL(o.floating)),s=Mr(a),i=Qi(a),l=So(a)==="y",c=D5.has(s)?-1:1,f=r&&l?-1:1,u=er(t,e),{mainAxis:d,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&typeof g=="number"&&(m=i==="end"?g*-1:g),l?{x:m*f,y:d*c}:{x:d*c,y:m*f}}var _5=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,n;let{x:o,y:r,placement:s,middlewareData:i}=t,l=await oH(t,e);return s===((a=i.offset)==null?void 0:a.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:o+l.x,y:r+l.y,data:{...l,placement:s}}}}},P5=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:a,y:n,placement:o,platform:r}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:y=>{let{x:h,y:w}=y;return{x:h,y:w}}},...c}=er(e,t),f={x:a,y:n},u=await r.detectOverflow(t,c),d=So(o),m=dg(d),g=f[m],b=f[d],v=(y,h)=>yb(h+u[y==="y"?"top":"left"],h,h-u[y==="y"?"bottom":"right"]);s&&(g=v(m,g)),i&&(b=v(d,b));let x=l.fn({...t,[m]:g,[d]:b});return{...x,data:{x:x.x-a,y:x.y-n,enabled:{[m]:s,[d]:i}}}}}},O5=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,n;let{x:o,y:r,placement:s,rects:i,middlewareData:l}=t,{offset:c=0,mainAxis:f=!0,crossAxis:u=!0}=er(e,t),d={x:o,y:r},m=So(s),g=dg(m),b=d[g],v=d[m],x=er(c,t),y=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(a=x.mainAxis)!=null?a:0,crossAxis:(n=x.crossAxis)!=null?n:0};if(f){let S=g==="y"?"height":"width",C=i.reference[g]-i.floating[S]+y.mainAxis,I=i.reference[g]+i.reference[S]-y.mainAxis;b<C?b=C:b>I&&(b=I)}if(u){var h,w;let S=g==="y"?"width":"height",C=D5.has(Mr(s)),I=i.reference[m]-i.floating[S]+(C&&((h=l.offset)==null?void 0:h[m])||0)+(C?0:y.crossAxis),L=i.reference[m]+i.reference[S]+(C?0:((w=l.offset)==null?void 0:w[m])||0)-(C?y.crossAxis:0);v<I?v=I:v>L&&(v=L)}return{[g]:b,[m]:v}}}},z5=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:a,rects:n,platform:o,elements:r}=t,{apply:s=()=>{},...i}=er(e,t),l=await o.detectOverflow(t,i),c=Mr(a),f=Qi(a),u=So(a)==="y",{width:d,height:m}=n.floating,g,b;c==="top"||c==="bottom"?(g=c,b=f===(await(o.isRTL==null?void 0:o.isRTL(r.floating))?"start":"end")?"left":"right"):(b=c,g=f==="end"?"top":"bottom");let v=m-l.top-l.bottom,x=d-l.left-l.right,y=Qo(m-l[g],v),h=Qo(d-l[b],x),w=t.middlewareData.shift,S=!w,C=y,I=h;w!=null&&w.enabled.x&&(I=x),w!=null&&w.enabled.y&&(C=v),S&&!f&&(u?I=d-2*wo(l.left,l.right):C=m-2*wo(l.top,l.bottom)),await s({...t,availableWidth:I,availableHeight:C});let L=await o.getDimensions(r.floating);return d!==L.width||m!==L.height?{reset:{rects:!0}}:{}}}};function mg(){return typeof window<"u"}function al(e){return F5(e)?(e.nodeName||"").toLowerCase():"#document"}function Xa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function tr(e){var t;return(t=(F5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function F5(e){return mg()?e instanceof Node||e instanceof Xa(e).Node:!1}function Co(e){return mg()?e instanceof Element||e instanceof Xa(e).Element:!1}function Er(e){return mg()?e instanceof HTMLElement||e instanceof Xa(e).HTMLElement:!1}function B5(e){return!mg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xa(e).ShadowRoot}function Hf(e){let{overflow:t,overflowX:a,overflowY:n,display:o}=ko(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+a)&&o!=="inline"&&o!=="contents"}function H5(e){return/^(table|td|th)$/.test(al(e))}function qf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var rH=/transform|translate|scale|rotate|perspective|filter/,sH=/paint|layout|strict|content/,el=e=>!!e&&e!=="none",wb;function hg(e){let t=Co(e)?ko(e):e;return el(t.transform)||el(t.translate)||el(t.scale)||el(t.rotate)||el(t.perspective)||!gg()&&(el(t.backdropFilter)||el(t.filter))||rH.test(t.willChange||"")||sH.test(t.contain||"")}function q5(e){let t=Bs(e);for(;Er(t)&&!Ku(t);){if(hg(t))return t;if(qf(t))return null;t=Bs(t)}return null}function gg(){return wb==null&&(wb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),wb}function Ku(e){return/^(html|body|#document)$/.test(al(e))}function ko(e){return Xa(e).getComputedStyle(e)}function Uf(e){return Co(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bs(e){if(al(e)==="html")return e;let t=e.assignedSlot||e.parentNode||B5(e)&&e.host||tr(e);return B5(t)?t.host:t}function U5(e){let t=Bs(e);return Ku(t)?(e.ownerDocument||e).body:Er(t)&&Hf(t)?t:U5(t)}function tl(e,t,a){var n;t===void 0&&(t=[]),a===void 0&&(a=!0);let o=U5(e),r=o===((n=e.ownerDocument)==null?void 0:n.body),s=Xa(o);if(r){let i=xg(s);return t.concat(s,s.visualViewport||[],Hf(o)?o:[],i&&a?tl(i):[])}else return t.concat(o,tl(o,[],a))}function xg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $5(e){let t=ko(e),a=parseFloat(t.width)||0,n=parseFloat(t.height)||0,o=Er(e),r=o?e.offsetWidth:a,s=o?e.offsetHeight:n,i=Bf(a)!==r||Bf(n)!==s;return i&&(a=r,n=s),{width:a,height:n,$:i}}function Cb(e){return Co(e)?e:e.contextElement}function Zu(e){let t=Cb(e);if(!Er(t))return Jo(1);let a=t.getBoundingClientRect(),{width:n,height:o,$:r}=$5(t),s=(r?Bf(a.width):a.width)/n,i=(r?Bf(a.height):a.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!i||!Number.isFinite(i))&&(i=1),{x:s,y:i}}var iH=Jo(0);function j5(e){let t=Xa(e);return!gg()||!t.visualViewport?iH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lH(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Xa(e)}function nl(e,t,a,n){t===void 0&&(t=!1),a===void 0&&(a=!1);let o=e.getBoundingClientRect(),r=Cb(e),s=Jo(1);t&&(n?Co(n)&&(s=Zu(n)):s=Zu(e));let i=lH(r,a,n)?j5(r):Jo(0),l=(o.left+i.x)/s.x,c=(o.top+i.y)/s.y,f=o.width/s.x,u=o.height/s.y;if(r&&n){let d=Xa(r),m=Co(n)?Xa(n):n,g=d,b=xg(g);for(;b&&m!==g;){let v=Zu(b),x=b.getBoundingClientRect(),y=ko(b),h=x.left+(b.clientLeft+parseFloat(y.paddingLeft))*v.x,w=x.top+(b.clientTop+parseFloat(y.paddingTop))*v.y;l*=v.x,c*=v.y,f*=v.x,u*=v.y,l+=h,c+=w,g=Xa(b),b=xg(g)}}return Ji({width:f,height:u,x:l,y:c})}function vg(e,t){let a=Uf(e).scrollLeft;return t?t.left+a:nl(tr(e)).left+a}function W5(e,t){let a=e.getBoundingClientRect(),n=a.left+t.scrollLeft-vg(e,a),o=a.top+t.scrollTop;return{x:n,y:o}}function uH(e){let{elements:t,rect:a,offsetParent:n,strategy:o}=e,r=o==="fixed",s=tr(n),i=t?qf(t.floating):!1;if(n===s||i&&r)return a;let l={scrollLeft:0,scrollTop:0},c=Jo(1),f=Jo(0),u=Er(n);if((u||!r)&&((al(n)!=="body"||Hf(s))&&(l=Uf(n)),u)){let m=nl(n);c=Zu(n),f.x=m.x+n.clientLeft,f.y=m.y+n.clientTop}let d=s&&!u&&!r?W5(s,l):Jo(0);return{width:a.width*c.x,height:a.height*c.y,x:a.x*c.x-l.scrollLeft*c.x+f.x+d.x,y:a.y*c.y-l.scrollTop*c.y+f.y+d.y}}function cH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function dH(e){let t=Uf(e),a=e.ownerDocument.body,n=wo(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),o=wo(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight),r=-t.scrollLeft+vg(e),s=-t.scrollTop;return ko(a).direction==="rtl"&&(r+=wo(e.clientWidth,a.clientWidth)-n),{width:n,height:o,x:r,y:s}}var fH=25;function pH(e,t,a){a===void 0&&(a="viewport");let n=a==="layoutViewport",o=Xa(e),r=tr(e),s=o.visualViewport,i=r.clientWidth,l=r.clientHeight,c=0,f=0;if(s){let d=!gg()||t==="fixed";n?d||(c=-s.offsetLeft,f=-s.offsetTop):(i=s.width,l=s.height,d&&(c=s.offsetLeft,f=s.offsetTop))}if(vg(r)<=0){let d=r.ownerDocument,m=d.body,g=getComputedStyle(m),b=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-b),x=getComputedStyle(r).scrollbarGutter==="stable both-edges"?v/2:v;x<=fH&&(i-=x)}return{width:i,height:l,x:c,y:f}}function mH(e,t){let a=nl(e,!0,t==="fixed"),n=a.top+e.clientTop,o=a.left+e.clientLeft,r=Zu(e),s=e.clientWidth*r.x,i=e.clientHeight*r.y,l=o*r.x,c=n*r.y;return{width:s,height:i,x:l,y:c}}function V5(e,t,a){let n;if(t==="viewport"||t==="layoutViewport")n=pH(e,a,t);else if(t==="document")n=dH(tr(e));else if(Co(t))n=mH(t,a);else{let o=j5(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ji(n)}function hH(e,t){let a=t.get(e);if(a)return a;let n=tl(e,[],!1).filter(i=>Co(i)&&al(i)!=="body"),o=null,r=ko(e).position==="fixed",s=r?Bs(e):e;for(;Co(s)&&!Ku(s);){let i=ko(s),l=hg(s),c=o?o.position:r?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&i.position==="static")?n=n.filter(u=>u!==s):o=i,s=Bs(s)}return t.set(e,n),n}function gH(e){let{element:t,boundary:a,rootBoundary:n,strategy:o}=e,s=[...a==="clippingAncestors"?qf(t)?[]:hH(t,this._c):[].concat(a),n],i=V5(t,s[0],o),l=i.top,c=i.right,f=i.bottom,u=i.left;for(let d=1;d<s.length;d++){let m=V5(t,s[d],o);l=wo(m.top,l),c=Qo(m.right,c),f=Qo(m.bottom,f),u=wo(m.left,u)}return{width:c-u,height:f-l,x:u,y:l}}function xH(e){let{width:t,height:a}=$5(e);return{width:t,height:a}}function vH(e,t,a){let n=Er(t),o=tr(t),r=a==="fixed",s=nl(e,!0,r,t),i={scrollLeft:0,scrollTop:0},l=Jo(0);if((n||!r)&&((al(t)!=="body"||Hf(o))&&(i=Uf(t)),n)){let d=nl(t,!0,r,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}!n&&o&&(l.x=vg(o));let c=o&&!n&&!r?W5(o,i):Jo(0),f=s.left+i.scrollLeft-l.x-c.x,u=s.top+i.scrollTop-l.y-c.y;return{x:f,y:u,width:s.width,height:s.height}}function Sb(e){return ko(e).position==="static"}function G5(e,t){if(!Er(e)||ko(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return tr(e)===a&&(a=a.ownerDocument.body),a}function X5(e,t){let a=Xa(e);if(qf(e))return a;if(!Er(e)){let o=Bs(e);for(;o&&!Ku(o);){if(Co(o)&&!Sb(o))return o;o=Bs(o)}return a}let n=G5(e,t);for(;n&&H5(n)&&Sb(n);)n=G5(n,t);return n&&Ku(n)&&Sb(n)&&!hg(n)?a:n||q5(e)||a}var yH=async function(e){let t=this.getOffsetParent||X5,a=this.getDimensions,n=await a(e.floating);return{reference:vH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function bH(e){return ko(e).direction==="rtl"}var Y5={convertOffsetParentRelativeRectToViewportRelativeRect:uH,getDocumentElement:tr,getClippingRect:gH,getOffsetParent:X5,getElementRects:yH,getClientRects:cH,getDimensions:xH,getScale:Zu,isElement:Co,isRTL:bH};function K5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wH(e,t,a){let n=null,o,r=tr(e);function s(){var f;clearTimeout(o),(f=n)==null||f.disconnect(),n=null}function i(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),s();let d=e.getBoundingClientRect(),{left:m,top:g,width:b,height:v}=d;if(f||t(),!b||!v)return;let x=Ff(g),y=Ff(r.clientWidth-(m+b)),h=Ff(r.clientHeight-(g+v)),w=Ff(m),C={rootMargin:-x+"px "+-y+"px "+-h+"px "+-w+"px",threshold:wo(0,Qo(1,u))||1},I=!0;function L(T){let A=T[0].intersectionRatio;if(!K5(d,e.getBoundingClientRect()))return i();if(A!==u){if(!I)return i();A?i(!1,A):o=setTimeout(()=>{i(!1,1e-7)},1e3)}I=!1}try{n=new IntersectionObserver(L,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(L,C)}n.observe(e)}let l=Xa(e),c=()=>i(a);return l.addEventListener("resize",c),i(!0),()=>{l.removeEventListener("resize",c),s()}}function kb(e,t,a,n){n===void 0&&(n={});let{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=Cb(e),f=o||r?[...c?tl(c):[],...t?tl(t):[]]:[];f.forEach(x=>{o&&x.addEventListener("scroll",a),r&&x.addEventListener("resize",a)});let u=c&&i?wH(c,a,r):null,d=-1,m=null;s&&(m=new ResizeObserver(x=>{let[y]=x;y&&y.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var h;(h=m)==null||h.observe(t)})),a()}),c&&!l&&m.observe(c),t&&m.observe(t));let g,b=l?nl(e):null;l&&v();function v(){let x=nl(e);b&&!K5(b,x)&&a(),b=x,g=requestAnimationFrame(v)}return a(),()=>{var x;f.forEach(y=>{o&&y.removeEventListener("scroll",a),r&&y.removeEventListener("resize",a)}),u?.(),(x=m)==null||x.disconnect(),m=null,l&&cancelAnimationFrame(g)}}var Z5=_5;var Q5=P5,J5=E5,eT=z5,tT=A5,Lb=M5;var aT=O5,Ib=(e,t,a)=>{let n=new Map,o=a??{},r={...Y5,...o.platform,_c:n};return T5(e,t,{...o,platform:r})};var Ut=j(he(),1),oT=j(he(),1),rT=j($r(),1),SH=typeof document<"u",CH=function(){},yg=SH?oT.useLayoutEffect:CH;function bg(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 a,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(n=a;n--!==0;)if(!bg(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),a=o.length,a!==Object.keys(t).length)return!1;for(n=a;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=a;n--!==0;){let r=o[n];if(!(r==="_owner"&&e.$$typeof)&&!bg(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function sT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nT(e,t){let a=sT(e);return Math.round(t*a)/a}function Nb(e){let t=Ut.useRef(e);return yg(()=>{t.current=e}),t}function iT(e){e===void 0&&(e={});let{placement:t="bottom",strategy:a="absolute",middleware:n=[],platform:o,elements:{reference:r,floating:s}={},transform:i=!0,whileElementsMounted:l,open:c}=e,[f,u]=Ut.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[d,m]=Ut.useState(n);bg(d,n)||m(n);let[g,b]=Ut.useState(null),[v,x]=Ut.useState(null),y=Ut.useCallback(z=>{z!==C.current&&(C.current=z,b(z))},[]),h=Ut.useCallback(z=>{z!==I.current&&(I.current=z,x(z))},[]),w=r||g,S=s||v,C=Ut.useRef(null),I=Ut.useRef(null),L=Ut.useRef(f),T=l!=null,A=Nb(l),D=Nb(o),H=Nb(c),V=Ut.useCallback(()=>{if(!C.current||!I.current)return;let z={placement:t,strategy:a,middleware:d};D.current&&(z.platform=D.current),Ib(C.current,I.current,z).then(q=>{let O={...q,isPositioned:H.current!==!1};N.current&&!bg(L.current,O)&&(L.current=O,rT.flushSync(()=>{u(O)}))})},[d,t,a,D,H]);yg(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(z=>({...z,isPositioned:!1})))},[c]);let N=Ut.useRef(!1);yg(()=>(N.current=!0,()=>{N.current=!1}),[]),yg(()=>{if(w&&(C.current=w),S&&(I.current=S),w&&S){if(A.current)return A.current(w,S,V);V()}},[w,S,V,A,T]);let P=Ut.useMemo(()=>({reference:C,floating:I,setReference:y,setFloating:h}),[y,h]),E=Ut.useMemo(()=>({reference:w,floating:S}),[w,S]),_=Ut.useMemo(()=>{let z={position:a,left:0,top:0};if(!E.floating)return z;let q=nT(E.floating,f.x),O=nT(E.floating,f.y);return i?{...z,transform:"translate("+q+"px, "+O+"px)",...sT(E.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:q,top:O}},[a,i,E.floating,f.x,f.y]);return Ut.useMemo(()=>({...f,update:V,refs:P,elements:E,floatingStyles:_}),[f,V,P,E,_])}var kH=e=>{function t(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:e,fn(a){let{element:n,padding:o}=typeof e=="function"?e(a):e;return n&&t(n)?n.current!=null?Lb({element:n.current,padding:o}).fn(a):{}:n?Lb({element:n,padding:o}).fn(a):{}}}},lT=(e,t)=>{let a=Z5(e);return{name:a.name,fn:a.fn,options:[e,t]}},uT=(e,t)=>{let a=Q5(e);return{name:a.name,fn:a.fn,options:[e,t]}},cT=(e,t)=>({fn:aT(e).fn,options:[e,t]}),dT=(e,t)=>{let a=J5(e);return{name:a.name,fn:a.fn,options:[e,t]}},fT=(e,t)=>{let a=eT(e);return{name:a.name,fn:a.fn,options:[e,t]}};var pT=(e,t)=>{let a=tT(e);return{name:a.name,fn:a.fn,options:[e,t]}};var mT=(e,t)=>{let a=kH(e);return{name:a.name,fn:a.fn,options:[e,t]}};var Qu=j(fe(),1),LH=Object.defineProperty,Fs=(e,t)=>LH(e,"name",{value:t,configurable:!0});var hT="Popper",[gT,Ju]=xt(hT),[IH,xT]=gT(hT),NH=Fs(e=>{let{__scopePopper:t,children:a}=e,[n,o]=Oa.useState(null),[r,s]=Oa.useState(void 0);return(0,Qu.jsx)(IH,{scope:t,anchor:n,onAnchorChange:o,placementState:r,setPlacementState:s,children:a})},"Popper"),RH="PopperAnchor",TH=Oa.forwardRef(Fs(function(t,a){let{__scopePopper:n,virtualRef:o,...r}=t,s=xT(RH,n),i=Oa.useRef(null),l=s.onAnchorChange,c=Oa.useCallback(b=>{i.current=b,b&&l(b)},[l]),f=Te(a,c),u=Oa.useRef(null);Oa.useEffect(()=>{if(!o)return;let b=u.current;u.current=o.current,b!==u.current&&l(u.current)});let d=s.placementState&&wg(s.placementState),m=d?.[0],g=d?.[1];return o?null:(0,Qu.jsx)(Re.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...r,ref:f})},"PopperAnchor")),vT="PopperContent",[MH,cre]=gT(vT),EH=Oa.forwardRef(Fs(function(t,a){let{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:b,...v}=t,x=xT(vT,n),[y,h]=Oa.useState(null),w=Te(a,h),[S,C]=Oa.useState(null),I=Zi(S),L=I?.width??0,T=I?.height??0,A=o+(s!=="center"?"-"+s:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},H=Array.isArray(f)?f:[f],V=H.length>0,N={padding:D,boundary:H.filter(yT),altBoundary:V},{refs:P,floatingStyles:E,placement:_,isPositioned:z,middlewareData:q}=iT({strategy:"fixed",placement:A,whileElementsMounted:Fs((...M)=>kb(...M,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:x.anchor},middleware:[lT({mainAxis:r+T,alignmentAxis:i}),c&&uT({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cT():void 0,...N}),c&&dT({...N}),fT({...N,apply:Fs(({elements:M,rects:se,availableWidth:le,availableHeight:B})=>{let{width:G,height:oe}=se.reference,Y=M.floating.style;Y.setProperty("--radix-popper-available-width",`${le}px`),Y.setProperty("--radix-popper-available-height",`${B}px`),Y.setProperty("--radix-popper-anchor-width",`${G}px`),Y.setProperty("--radix-popper-anchor-height",`${oe}px`)},"apply")}),S&&mT({element:S,padding:l}),AH({arrowWidth:L,arrowHeight:T}),m&&pT({strategy:"referenceHidden",...N,boundary:V?N.boundary:void 0})]}),O=x.setPlacementState;Ze(()=>(O(_),()=>{O(void 0)}),[_,O]);let[W,ee]=wg(_),de=oa(b);Ze(()=>{z&&de?.()},[z,de]);let ne=q.arrow?.x,re=q.arrow?.y,ue=q.arrow?.centerOffset!==0,[ce,U]=Oa.useState();return Ze(()=>{y&&U(window.getComputedStyle(y).zIndex)},[y]),(0,Qu.jsx)("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...E,transform:z?E.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,Qu.jsx)(MH,{scope:n,placedSide:W,placedAlign:ee,onArrowChange:C,arrowX:ne,arrowY:re,shouldHideArrow:ue,children:(0,Qu.jsx)(Re.div,{"data-side":W,"data-align":ee,...v,ref:w,style:{...v.style,animation:z?v.style?.animation:"none"}})})})},"PopperContent"));function yT(e){return e!==null}Fs(yT,"isNotNull");var AH=Fs(e=>({name:"transformOrigin",options:e,fn(t){let{placement:a,rects:n,middlewareData:o}=t,s=o.arrow?.centerOffset!==0,i=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,f]=wg(a),u={start:"0%",center:"50%",end:"100%"}[f],d=(o.arrow?.x??0)+i/2,m=(o.arrow?.y??0)+l/2,g="",b="";return c==="bottom"?(g=s?u:`${d}px`,b=`${-l}px`):c==="top"?(g=s?u:`${d}px`,b=`${n.floating.height+l}px`):c==="right"?(g=`${-l}px`,b=s?u:`${m}px`):c==="left"&&(g=`${n.floating.width+l}px`,b=s?u:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function wg(e){let[t,a="center"]=e.split("-");return[t,a]}Fs(wg,"getSideAndAlignFromPlacement");var Sg=NH,Cg=TH,kg=EH;var Lg=j(he(),1),DH=Object.defineProperty,_H=(e,t)=>DH(e,"name",{value:t,configurable:!0});function Rb(e){let t=Lg.useRef({value:e,previous:e});return Lg.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}_H(Rb,"usePrevious");var PH=j(he(),1);var OH=j(fe(),1);var wT=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});var Ee=j(fe(),1),BH=Object.defineProperty,rt=(e,t)=>BH(e,"name",{value:t,configurable:!0}),FH=[" ","Enter","ArrowUp","ArrowDown"],HH=[" ","Enter"],ec="Select",[Ng,Eb,qH]=Yi(ec),[rl,Pre]=xt(ec,[qH,Ju]),Ab=Ju(),[UH,Hs]=rl(ec),[VH,GH]=rl(ec);function kT(e){let{__scopeSelect:t,children:a,open:n,defaultOpen:o,onOpenChange:r,value:s,defaultValue:i,onValueChange:l,dir:c,name:f,autoComplete:u,disabled:d,required:m,form:g,internal_do_not_use_render:b}=e,v=Ab(t),[x,y]=xe.useState(null),[h,w]=xe.useState(null),[S,C]=xe.useState(!1),I=Tr(c),[L,T]=Ma({prop:n,defaultProp:o??!1,onChange:r,caller:ec}),[A,D]=Ma({prop:s,defaultProp:i,onChange:l,caller:ec}),H=xe.useRef(null),V=xe.useRef(A);xe.useEffect(()=>{let ee=g?x?.ownerDocument.getElementById(g):x?.form;if(ee instanceof HTMLFormElement){let de=rt(()=>D(V.current),"reset");return ee.addEventListener("reset",de),()=>ee.removeEventListener("reset",de)}},[g,x,D]);let N=x?!!g||!!x.closest("form"):!0,[P,E]=xe.useState(new Set),_=Ga(),z=Array.from(P).map(ee=>ee.props.value).join(";"),q=xe.useCallback(ee=>{E(de=>new Set(de).add(ee))},[]),O=xe.useCallback(ee=>{E(de=>{let ne=new Set(de);return ne.delete(ee),ne})},[]),W={required:m,trigger:x,onTriggerChange:y,valueNode:h,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:_,value:A,onValueChange:D,open:L,onOpenChange:T,dir:I,triggerPointerDownPosRef:H,disabled:d,name:f,autoComplete:u,form:g,nativeOptions:P,nativeSelectKey:z,isFormControl:N};return(0,Ee.jsx)(Sg,{...v,children:(0,Ee.jsx)(UH,{scope:t,...W,children:(0,Ee.jsx)(Ng.Provider,{scope:t,children:(0,Ee.jsx)(VH,{scope:t,onNativeOptionAdd:q,onNativeOptionRemove:O,children:zT(b)?b(W):a})})})})}rt(kT,"SelectProvider");var LT=rt(e=>{let{__scopeSelect:t,children:a,...n}=e;return(0,Ee.jsx)(kT,{__scopeSelect:t,...n,internal_do_not_use_render:({isFormControl:o})=>(0,Ee.jsxs)(Ee.Fragment,{children:[a,o?(0,Ee.jsx)(sq,{__scopeSelect:t}):null]})})},"Select"),$H="SelectTrigger",IT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,disabled:o=!1,...r}=t,s=Ab(n),i=Hs($H,n),l=i.disabled||o,c=Te(a,i.onTriggerChange),f=Eb(n),u=xe.useRef("touch"),[d,m,g]=Db(v=>{let x=f().filter(w=>!w.disabled),y=x.find(w=>w.value===i.value),h=_b(x,v,y);h!==void 0&&i.onValueChange(h.value)}),b=rt(v=>{l||(i.onOpenChange(!0),g()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})},"handleOpen");return(0,Ee.jsx)(Cg,{asChild:!0,...s,children:(0,Ee.jsx)(Re.button,{type:"button",role:"combobox","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Vf(i.value)?"":void 0,...r,ref:c,onClick:ke(r.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&b(v)}),onPointerDown:ke(r.onPointerDown,v=>{u.current=v.pointerType;let x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(b(v),v.preventDefault())}),onKeyDown:ke(r.onKeyDown,v=>{let x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(x&&v.key===" ")&&FH.includes(v.key)&&(b(),v.preventDefault())})})})},"SelectTrigger")),jH="SelectValue",NT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,className:o,style:r,children:s,placeholder:i="",...l}=t,c=Hs(jH,n),{onValueNodeHasChildrenChange:f}=c,u=s!==void 0,d=Te(a,c.onValueNodeChange);Ze(()=>{f(u)},[f,u]);let m=Vf(c.value);return(0,Ee.jsx)(Re.span,{...l,asChild:m?!1:l.asChild,ref:d,style:{pointerEvents:"none"},children:(0,Ee.jsx)(xe.Fragment,{children:m?i:s},m?"placeholder":"value")})},"SelectValue")),RT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,children:o,...r}=t;return(0,Ee.jsx)(Re.span,{"aria-hidden":!0,...r,ref:a,children:o||"▼"})},"SelectIcon")),WH="SelectPortal",[XH,YH]=rl(WH,{forceMount:void 0}),TT=rt(e=>{let{__scopeSelect:t,forceMount:a,...n}=e;return(0,Ee.jsx)(XH,{scope:e.__scopeSelect,forceMount:a,children:(0,Ee.jsx)(Au,{asChild:!0,...n})})},"SelectPortal"),ol="SelectContent",MT=xe.forwardRef(rt(function(t,a){let n=YH(ol,t.__scopeSelect),{forceMount:o=n.forceMount,...r}=t,s=Hs(ol,t.__scopeSelect),[i,l]=xe.useState();return Ze(()=>{l(new DocumentFragment)},[]),(0,Ee.jsx)(An,{present:o||s.open,children:({present:c})=>c?(0,Ee.jsx)(QH,{...r,ref:a}):(0,Ee.jsx)(KH,{...r,fragment:i})})},"SelectContent")),KH=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,children:o,fragment:r}=t;return r?Mb.createPortal((0,Ee.jsx)(ET,{scope:n,children:(0,Ee.jsx)(Ng.Slot,{scope:n,children:(0,Ee.jsx)("div",{ref:a,children:o})})}),r):null},"SelectContentFragment")),Lo=10,[ET,Rg]=rl(ol),ZH=Ea("SelectContent.RemoveScroll"),QH=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n}=t,{position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:f,alignOffset:u,arrowPadding:d,collisionBoundary:m,collisionPadding:g,sticky:b,hideWhenDetached:v,avoidCollisions:x,...y}=t,h=Hs(ol,n),[w,S]=xe.useState(null),[C,I]=xe.useState(null),L=Te(a,S),[T,A]=xe.useState(null),[D,H]=xe.useState(null),V=Eb(n),[N,P]=xe.useState(!1),E=xe.useRef(!1);xe.useEffect(()=>{if(w)return Fu(w)},[w]),ws();let _=xe.useCallback(U=>{let[M,...se]=V().map(G=>G.ref.current),[le]=se.slice(-1),B=document.activeElement;for(let G of U)if(G===B||(G?.scrollIntoView({block:"nearest"}),G===M&&C&&(C.scrollTop=0),G===le&&C&&(C.scrollTop=C.scrollHeight),G?.focus(),document.activeElement!==B))return},[V,C]),z=xe.useCallback(()=>_([T,w]),[_,T,w]);xe.useEffect(()=>{N&&z()},[N,z]);let{onOpenChange:q,triggerPointerDownPosRef:O}=h;xe.useEffect(()=>{if(w){let U={x:0,y:0},M=rt(le=>{U={x:Math.abs(Math.round(le.pageX)-(O.current?.x??0)),y:Math.abs(Math.round(le.pageY)-(O.current?.y??0))}},"handlePointerMove"),se=rt(le=>{U.x<=10&&U.y<=10?le.preventDefault():le.composedPath().includes(w)||q(!1),document.removeEventListener("pointermove",M),O.current=null},"handlePointerUp");return O.current!==null&&(document.addEventListener("pointermove",M),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",se,{capture:!0})}}},[w,q,O]),xe.useEffect(()=>{let U=rt(()=>q(!1),"close");return window.addEventListener("blur",U),window.addEventListener("resize",U),()=>{window.removeEventListener("blur",U),window.removeEventListener("resize",U)}},[q]);let[W,ee]=Db(U=>{let M=V().filter(B=>!B.disabled),se=M.find(B=>B.ref.current===document.activeElement),le=_b(M,U,se);le&&setTimeout(()=>le.ref.current?.focus())}),de=xe.useCallback((U,M,se)=>{let le=!E.current&&!se;(h.value!==void 0&&h.value===M||le)&&(A(U),le&&(E.current=!0))},[h.value]),ne=xe.useCallback(()=>w?.focus(),[w]),re=xe.useCallback((U,M,se)=>{let le=!E.current&&!se;(h.value!==void 0&&h.value===M||le)&&H(U)},[h.value]),ue=o==="popper"?ST:JH,ce=ue===ST?{side:l,sideOffset:c,align:f,alignOffset:u,arrowPadding:d,collisionBoundary:m,collisionPadding:g,sticky:b,hideWhenDetached:v,avoidCollisions:x}:{};return(0,Ee.jsx)(ET,{scope:n,content:w,viewport:C,onViewportChange:I,itemRefCallback:de,selectedItem:T,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:z,selectedItemText:D,position:o,isPositioned:N,searchRef:W,children:(0,Ee.jsx)(Ai,{as:ZH,allowPinchZoom:!0,children:(0,Ee.jsx)(Eu,{asChild:!0,trapped:h.open,onMountAutoFocus:U=>{U.preventDefault()},onUnmountAutoFocus:ke(r,U=>{h.trigger?.focus({preventScroll:!0}),U.preventDefault()}),children:(0,Ee.jsx)(Mu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:U=>U.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:(0,Ee.jsx)(ue,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:U=>U.preventDefault(),...y,...ce,onPlaced:()=>P(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ke(y.onKeyDown,U=>{let M=U.ctrlKey||U.altKey||U.metaKey;if(U.key==="Tab"&&U.preventDefault(),!M&&U.key.length===1&&ee(U.key),["ArrowUp","ArrowDown","Home","End"].includes(U.key)){let le=V().filter(B=>!B.disabled).map(B=>B.ref.current);if(["ArrowUp","End"].includes(U.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(U.key)){let B=U.target,G=le.indexOf(B);le=le.slice(G+1)}setTimeout(()=>_(le)),U.preventDefault()}})})})})})})},"SelectContentImpl")),JH=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,onPlaced:o,...r}=t,s=Hs(ol,n),i=Rg(ol,n),[l,c]=xe.useState(null),[f,u]=xe.useState(null),d=Te(a,u),m=Eb(n),g=xe.useRef(!1),b=xe.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:y,focusSelectedItem:h}=i,w=xe.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&f&&v&&x&&y){let L=s.trigger.getBoundingClientRect(),T=f.getBoundingClientRect(),A=s.valueNode.getBoundingClientRect(),D=y.getBoundingClientRect();if(s.dir!=="rtl"){let B=D.left-T.left,G=A.left-B,oe=L.left-G,Y=L.width+oe,Le=Math.max(Y,T.width),ze=window.innerWidth-Lo,bt=ug(G,[Lo,Math.max(Lo,ze-Le)]);l.style.minWidth=Y+"px",l.style.left=bt+"px"}else{let B=T.right-D.right,G=window.innerWidth-A.right-B,oe=window.innerWidth-L.right-G,Y=L.width+oe,Le=Math.max(Y,T.width),ze=window.innerWidth-Lo,bt=ug(G,[Lo,Math.max(Lo,ze-Le)]);l.style.minWidth=Y+"px",l.style.right=bt+"px"}let H=m(),V=window.innerHeight-Lo*2,N=v.scrollHeight,P=window.getComputedStyle(f),E=parseInt(P.borderTopWidth,10),_=parseInt(P.paddingTop,10),z=parseInt(P.borderBottomWidth,10),q=parseInt(P.paddingBottom,10),O=E+_+N+q+z,W=Math.min(x.offsetHeight*5,O),ee=window.getComputedStyle(v),de=parseInt(ee.paddingTop,10),ne=parseInt(ee.paddingBottom,10),re=L.top+L.height/2-Lo,ue=V-re,ce=x.offsetHeight/2,U=x.offsetTop+ce,M=E+_+U,se=O-M;if(M<=re){let B=H.length>0&&x===H[H.length-1].ref.current;l.style.bottom="0px";let G=f.clientHeight-v.offsetTop-v.offsetHeight,oe=Math.max(ue,ce+(B?ne:0)+G+z),Y=M+oe;l.style.height=Y+"px"}else{let B=H.length>0&&x===H[0].ref.current;l.style.top="0px";let oe=Math.max(re,E+v.offsetTop+(B?de:0)+ce)+se;l.style.height=oe+"px",v.scrollTop=M-re+v.offsetTop}l.style.margin=`${Lo}px 0`,l.style.minHeight=W+"px",l.style.maxHeight=V+"px",o?.(),requestAnimationFrame(()=>g.current=!0)}},[m,s.trigger,s.valueNode,l,f,v,x,y,s.dir,o]);Ze(()=>w(),[w]);let[S,C]=xe.useState();Ze(()=>{f&&C(window.getComputedStyle(f).zIndex)},[f]);let I=xe.useCallback(L=>{L&&b.current===!0&&(w(),h?.(),b.current=!1)},[w,h]);return(0,Ee.jsx)(eq,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:I,children:(0,Ee.jsx)("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,Ee.jsx)(Re.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})},"SelectItemAlignedPosition")),ST=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,align:o="start",collisionPadding:r=Lo,...s}=t,i=Ab(n);return(0,Ee.jsx)(kg,{...i,...s,ref:a,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[eq,tq]=rl(ol,{}),CT="SelectViewport",AT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,nonce:o,...r}=t,s=Rg(CT,n),i=tq(CT,n),l=Te(a,s.onViewportChange),c=xe.useRef(0);return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),(0,Ee.jsx)(Ng.Slot,{scope:n,children:(0,Ee.jsx)(Re.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:ke(r.onScroll,f=>{let u=f.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:m}=i;if(m?.current&&d){let g=Math.abs(c.current-u.scrollTop);if(g>0){let b=window.innerHeight-Lo*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),y=Math.max(v,x);if(y<b){let h=y+g,w=Math.min(b,h),S=h-w;d.style.height=w+"px",d.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})},"SelectViewport")),aq="SelectGroup",[Ore,zre]=rl(aq);var Tb="SelectItem",[nq,DT]=rl(Tb),_T=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...i}=t,l=Hs(Tb,n),c=Rg(Tb,n),f=l.value===o,[u,d]=xe.useState(s??""),[m,g]=xe.useState(!1),b=oa(w=>c.itemRefCallback?.(w,o,r)),v=Te(a,b),x=Ga(),y=xe.useRef("touch"),h=rt(()=>{r||(l.onValueChange(o),l.onOpenChange(!1))},"handleSelect");return(0,Ee.jsx)(nq,{scope:n,value:o,disabled:r,textId:x,isSelected:f,onItemTextChange:xe.useCallback(w=>{d(S=>S||(w?.textContent??"").trim())},[]),children:(0,Ee.jsx)(Ng.ItemSlot,{scope:n,value:o,disabled:r,textValue:u,children:(0,Ee.jsx)(Re.div,{role:"option","aria-labelledby":x,"data-highlighted":m?"":void 0,"aria-selected":f&&m,"data-state":f?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:v,onFocus:ke(i.onFocus,()=>g(!0)),onBlur:ke(i.onBlur,()=>g(!1)),onClick:ke(i.onClick,()=>{y.current!=="mouse"&&h()}),onPointerUp:ke(i.onPointerUp,()=>{y.current==="mouse"&&h()}),onPointerDown:ke(i.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:ke(i.onPointerMove,w=>{y.current=w.pointerType,r?c.onItemLeave?.():y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ke(i.onPointerLeave,w=>{w.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ke(i.onKeyDown,w=>{r||w.target!==w.currentTarget||c.searchRef?.current!==""&&w.key===" "||(HH.includes(w.key)&&h(),w.key===" "&&w.preventDefault())})})})})},"SelectItem")),Ig="SelectItemText",PT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,className:o,style:r,...s}=t,i=Hs(Ig,n),l=Rg(Ig,n),c=DT(Ig,n),f=GH(Ig,n),[u,d]=xe.useState(null),m=oa(h=>l.itemTextRefCallback?.(h,c.value,c.disabled)),g=Te(a,d,c.onItemTextChange,m),b=u?.textContent,v=xe.useMemo(()=>(0,Ee.jsx)("option",{value:c.value,disabled:c.disabled,children:b},c.value),[c.disabled,c.value,b]),{onNativeOptionAdd:x,onNativeOptionRemove:y}=f;return Ze(()=>(x(v),()=>y(v)),[x,y,v]),(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)(Re.span,{id:c.textId,...s,ref:g}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren&&!Vf(i.value)?Mb.createPortal(s.children,i.valueNode):null]})},"SelectItemText")),oq="SelectItemIndicator",OT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,...o}=t;return DT(oq,n).isSelected?(0,Ee.jsx)(Re.span,{"aria-hidden":!0,...o,ref:a}):null},"SelectItemIndicator"));var rq="SelectBubbleInput",sq=xe.forwardRef(rt(function({__scopeSelect:t,...a},n){let o=Hs(rq,t),{value:r,onValueChange:s,required:i,disabled:l,name:c,autoComplete:f,form:u}=o,{nativeOptions:d,nativeSelectKey:m}=o,g=xe.useRef(null),b=Te(n,g),v=r??"",x=Rb(v),y=Array.from(d).some(h=>(h.props.value??"")==="");return xe.useEffect(()=>{let h=g.current;if(!h)return;let w=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(w,"value").set;if(x!==v&&C){let I=new Event("change",{bubbles:!0});C.call(h,v),h.dispatchEvent(I)}},[x,v]),(0,Ee.jsxs)(Re.select,{"aria-hidden":!0,required:i,tabIndex:-1,name:c,autoComplete:f,disabled:l,form:u,onChange:h=>s(h.target.value),...a,style:{...wT,...a.style},ref:b,defaultValue:v,children:[Vf(r)&&!y?(0,Ee.jsx)("option",{value:""}):null,Array.from(d)]},m)},"SelectBubbleInput"));function zT(e){return typeof e=="function"}rt(zT,"isFunction");function Vf(e){return e===""||e===void 0}rt(Vf,"shouldShowPlaceholder");function Db(e){let t=oa(e),a=xe.useRef(""),n=xe.useRef(0),o=xe.useCallback(s=>{let i=a.current+s;t(i),rt((function l(c){a.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>l(""),1e3))}),"updateSearch")(i)},[t]),r=xe.useCallback(()=>{a.current="",window.clearTimeout(n.current)},[]);return xe.useEffect(()=>()=>window.clearTimeout(n.current),[]),[a,o,r]}rt(Db,"useTypeaheadSearch");function _b(e,t,a){let o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,r=a?e.indexOf(a):-1,s=BT(e,Math.max(r,0));o.length===1&&(s=s.filter(c=>c!==a));let l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==a?l:void 0}rt(_b,"findNextItem");function BT(e,t){return e.map((a,n)=>e[(t+n)%e.length])}rt(BT,"wrapArray");var Pn=j(fe(),1),Gf=LT,$f=NT;function jf({className:e,children:t,...a}){return(0,Pn.jsxs)(IT,{"data-slot":"select-trigger",className:te("flex h-8 w-full items-center justify-between gap-2 rounded-md border border-input bg-card px-2.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring phone:h-11 phone:text-base [&>span]:truncate",e),...a,children:[t,(0,Pn.jsx)(RT,{asChild:!0,children:(0,Pn.jsx)(Xo,{className:"size-4 opacity-60"})})]})}function Wf({className:e,children:t,position:a="popper",...n}){return(0,Pn.jsx)(TT,{children:(0,Pn.jsx)(MT,{"data-slot":"select-content",position:a,sideOffset:4,className:te("relative z-[120] max-h-[min(22rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-lg",e),...n,children:(0,Pn.jsx)(AT,{className:"p-1",children:t})})})}function tc({className:e,children:t,...a}){return(0,Pn.jsxs)(_T,{"data-slot":"select-item",className:te("relative flex w-full cursor-default select-none items-center rounded-[5px] py-1.5 pr-8 pl-2 text-[13px] outline-none data-[highlighted]:bg-accent data-[disabled]:opacity-50 phone:min-h-11",e),...a,children:[(0,Pn.jsx)(PT,{children:t}),(0,Pn.jsx)("span",{className:"absolute right-2 flex size-4 items-center justify-center",children:(0,Pn.jsx)(OT,{children:(0,Pn.jsx)(ja,{className:"size-4"})})})]})}var Vt=j(he(),1);var no=j(fe(),1),lq=Object.defineProperty,qs=(e,t)=>lq(e,"name",{value:t,configurable:!0}),Pb="Switch",[uq,Wre]=xt(Pb),[cq,Ob]=uq(Pb);function FT(e){let{__scopeSwitch:t,checked:a,children:n,defaultChecked:o,disabled:r,form:s,name:i,onCheckedChange:l,required:c,value:f="on",internal_do_not_use_render:u}=e,[d,m]=Ma({prop:a,defaultProp:o??!1,onChange:l,caller:Pb}),[g,b]=Vt.useState(null),[v,x]=Vt.useState(null),y=Vt.useRef(!1),[h,w]=Vt.useReducer(I=>I+1,0),S=g?!!s||!!g.closest("form"):!0,C={checked:d,setChecked:m,disabled:r,control:g,setControl:b,name:i,form:s,value:f,hasConsumerStoppedPropagationRef:y,userInteractionCount:h,onUserInteraction:w,required:c,defaultChecked:o,isFormControl:S,bubbleInput:v,setBubbleInput:x};return(0,no.jsx)(cq,{scope:t,...C,children:UT(u)?u(C):n})}qs(FT,"SwitchProvider");var dq="SwitchTrigger",fq=Vt.forwardRef(qs(function({__scopeSwitch:t,onClick:a,...n},o){let{control:r,form:s,value:i,disabled:l,checked:c,required:f,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=Ob(dq,t),x=Te(o,u),y=Vt.useRef(c);return Vt.useEffect(()=>{let h=s?r?.ownerDocument.getElementById(s):r?.form;if(h instanceof HTMLFormElement){let w=qs(()=>d(y.current),"reset");return h.addEventListener("reset",w),()=>h.removeEventListener("reset",w)}},[r,s,d]),(0,no.jsx)(Re.button,{type:"button",role:"switch","aria-checked":c,"aria-required":f,"data-state":zb(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:x,onClick:ke(a,h=>{g(),d(w=>!w),v&&b&&(m.current=h.isPropagationStopped(),m.current||h.stopPropagation())})})},"SwitchTrigger")),HT=Vt.forwardRef(qs(function(t,a){let{__scopeSwitch:n,name:o,checked:r,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:f,form:u,...d}=t;return(0,no.jsx)(FT,{__scopeSwitch:n,checked:r,defaultChecked:s,disabled:l,required:i,onCheckedChange:f,name:o,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>(0,no.jsxs)(no.Fragment,{children:[(0,no.jsx)(fq,{...d,ref:a,__scopeSwitch:n}),m&&(0,no.jsx)(hq,{__scopeSwitch:n})]})})},"Switch")),pq="SwitchThumb",qT=Vt.forwardRef(qs(function(t,a){let{__scopeSwitch:n,...o}=t,r=Ob(pq,n);return(0,no.jsx)(Re.span,{"data-state":zb(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:a})},"SwitchThumb")),mq="SwitchBubbleInput",hq=Vt.forwardRef(qs(function({__scopeSwitch:t,onClick:a,...n},o){let{control:r,hasConsumerStoppedPropagationRef:s,userInteractionCount:i,checked:l,defaultChecked:c,required:f,disabled:u,name:d,value:m,form:g,bubbleInput:b,setBubbleInput:v}=Ob(mq,t),x=Te(o,v),y=Zi(r),h=Vt.useRef(!1),w=Vt.useRef(l),S=Vt.useRef(i);Vt.useEffect(()=>{let I=b;if(!I)return;let L=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(L,"checked").set,D=i!==S.current;S.current=i;let H=w.current!==l;w.current=l;let V=!(D&&s.current);if(H&&A){h.current=!D;let N=new Event("click",{bubbles:V});A.call(I,l),I.dispatchEvent(N),h.current=!1}},[b,l,s,i]);let C=Vt.useRef(l);return(0,no.jsx)(Re.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??C.current,required:f,disabled:u,name:d,value:m,form:g,...n,tabIndex:-1,ref:x,onClick:ke(a,I=>{h.current&&I.stopPropagation()}),style:{...n.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function UT(e){return typeof e=="function"}qs(UT,"isFunction");function zb(e){return e?"checked":"unchecked"}qs(zb,"getState");var Bb=j(fe(),1);function Fb({className:e,...t}){return(0,Bb.jsx)(HT,{"data-slot":"switch",className:te("relative inline-flex h-6 w-11 shrink-0 items-center rounded-full phone:after:absolute phone:after:-inset-x-0.5 phone:after:-inset-y-[12px] border-2 border-transparent bg-input transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:bg-primary",e),...t,children:(0,Bb.jsx)(qT,{className:"pointer-events-none block size-5 rounded-full bg-card shadow transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"})})}var VT=j(he(),1);var GT=j(fe(),1),xq=Object.defineProperty,vq=(e,t)=>xq(e,"name",{value:t,configurable:!0}),yq=VT.forwardRef(vq(function(t,a){return(0,GT.jsx)(Re.label,{...t,ref:a,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}})},"Label")),$T=yq;var XT=j(he(),1);var YT=j(fe(),1),wq=Object.defineProperty,WT=(e,t)=>wq(e,"name",{value:t,configurable:!0}),jT="horizontal",Sq=["horizontal","vertical"],Cq=XT.forwardRef(WT(function(t,a){let{decorative:n,orientation:o=jT,...r}=t,s=KT(o)?o:jT,l=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return(0,YT.jsx)(Re.div,{"data-orientation":s,...l,...r,ref:a})},"Separator"));function KT(e){return Sq.includes(e)}WT(KT,"isValidOrientation");var ZT=Cq;var Xf=j(fe(),1);function Ct({className:e,...t}){return(0,Xf.jsx)($T,{"data-slot":"label",className:te("flex items-center gap-2 text-sm font-medium leading-none",e),...t})}function ve({className:e,type:t,...a}){return(0,Xf.jsx)("input",{type:t,"data-slot":"input",className:te("flex h-8 w-full min-w-0 rounded-md border border-input bg-card px-2.5 text-[13px] outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring phone:h-11 phone:text-base",e),...a})}function zt({className:e,...t}){return(0,Xf.jsx)("textarea",{"data-slot":"textarea",className:te("flex min-h-20 w-full rounded-md border border-input bg-card px-2.5 py-2 text-[13px] outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring phone:text-base",e),...t})}function ac({className:e,orientation:t="horizontal",...a}){return(0,Xf.jsx)(ZT,{"data-slot":"separator",orientation:t,className:te("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...a})}var ka=j(he(),1);var sl=j(fe(),1),Lq=Object.defineProperty,Yf=(e,t)=>Lq(e,"name",{value:t,configurable:!0}),Hb="Collapsible",[Iq,lse]=xt(Hb),[Nq,qb]=Iq(Hb),Rq=ka.forwardRef(Yf(function(t,a){let{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:i,...l}=t,[c,f]=Ma({prop:o,defaultProp:r??!1,onChange:i,caller:Hb});return(0,sl.jsx)(Nq,{scope:n,disabled:s,contentId:Ga(),open:c,onOpenToggle:ka.useCallback(()=>f(u=>!u),[f]),children:(0,sl.jsx)(Re.div,{"data-state":Tg(c),"data-disabled":s?"":void 0,...l,ref:a})})},"Collapsible")),Tq="CollapsibleTrigger",Mq=ka.forwardRef(Yf(function(t,a){let{__scopeCollapsible:n,...o}=t,r=qb(Tq,n);return(0,sl.jsx)(Re.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":Tg(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:a,onClick:ke(t.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),QT="CollapsibleContent",Eq=ka.forwardRef(Yf(function(t,a){let{forceMount:n,...o}=t,r=qb(QT,t.__scopeCollapsible);return(0,sl.jsx)(An,{present:n||r.open,children:({present:s})=>(0,sl.jsx)(Aq,{...o,ref:a,present:s})})},"CollapsibleContent")),Aq=ka.forwardRef(Yf(function(t,a){let{__scopeCollapsible:n,present:o,children:r,...s}=t,i=qb(QT,n),[l,c]=ka.useState(o),f=ka.useRef(null),u=Te(a,f),d=ka.useRef(0),m=d.current,g=ka.useRef(0),b=g.current,v=i.open||l,x=ka.useRef(v),y=ka.useRef(void 0);return ka.useEffect(()=>{let h=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(h)},[]),Ze(()=>{let h=f.current;if(h){y.current=y.current||{transitionDuration:h.style.transitionDuration,animationName:h.style.animationName},h.style.transitionDuration="0s",h.style.animationName="none";let w=h.getBoundingClientRect();d.current=w.height,g.current=w.width,x.current||(h.style.transitionDuration=y.current.transitionDuration,h.style.animationName=y.current.animationName),c(o)}},[i.open,o]),(0,sl.jsx)(Re.div,{"data-state":Tg(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!v,...s,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...t.style},children:v&&r})},"CollapsibleContentImpl"));function Tg(e){return e?"open":"closed"}Yf(Tg,"getState");var JT=Rq,eM=Mq,tM=Eq;var nc=JT,oc=eM,rc=tM;var pe=j(he(),1),rM=j($r(),1);function _q(e){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",t.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}var Pq=e=>{switch(e){case"success":return Bq;case"info":return Hq;case"warning":return Fq;case"error":return qq;default:return null}},Oq=Array(12).fill(0),zq=({visible:e,className:t})=>pe.default.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},pe.default.createElement("div",{className:"sonner-spinner"},Oq.map((a,n)=>pe.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Bq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Fq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Hq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),qq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Uq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},pe.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Vq=()=>{let[e,t]=pe.default.useState(document.hidden);return pe.default.useEffect(()=>{let a=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",a),()=>document.removeEventListener("visibilitychange",a)},[]),e},Gq=1,$q=100,aM=e=>{var t;return typeof e?.id=="number"||(e==null||(t=e.id)==null?void 0:t.length)>0?e.id:Gq++},Ub=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),this.getActiveToasts().forEach(a=>t(a)),()=>{let a=this.subscribers.indexOf(t);this.subscribers.splice(a,1)}),this.publish=t=>{this.subscribers.forEach(a=>a(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t],this.trimHistory()},this.trimHistory=()=>{let t=this.toasts.length-$q;t<=0||(this.toasts=this.toasts.filter(a=>t>0&&this.dismissedToasts.has(a.id)?(this.dismissedToasts.delete(a.id),t--,!1):!0))},this.create=t=>{let{message:a,...n}=t,o=aM(t),r=this.pendingDismissals.get(o);r!==void 0&&(cancelAnimationFrame(r),this.pendingDismissals.delete(o),this.dismissedToasts.delete(o));let s=this.dismissedToasts.has(o),i=t.dismissible===void 0?!0:t.dismissible;return s&&(this.dismissedToasts.delete(o),this.toasts=this.toasts.filter(c=>c.id!==o)),(s?void 0:this.toasts.find(c=>c.id===o))?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...t,id:o,title:a}),{...c,...t,id:o,dismissible:i,title:a}):c):this.addToast({title:a,...n,dismissible:i,id:o}),o},this.dismiss=t=>{if(t==null)return this.getActiveToasts().forEach(n=>{this.dismissedToasts.add(n.id),this.subscribers.forEach(o=>o({id:n.id,dismiss:!0}))}),t;this.dismissedToasts.add(t);let a=this.pendingDismissals.get(t);return a!==void 0&&cancelAnimationFrame(a),this.pendingDismissals.set(t,requestAnimationFrame(()=>{this.pendingDismissals.delete(t),this.subscribers.forEach(n=>n({id:t,dismiss:!0}))})),t},this.message=(t,a)=>this.create({...a,message:t,type:void 0}),this.error=(t,a)=>this.create({...a,message:t,type:"error"}),this.success=(t,a)=>this.create({...a,type:"success",message:t}),this.info=(t,a)=>this.create({...a,type:"info",message:t}),this.warning=(t,a)=>this.create({...a,type:"warning",message:t}),this.loading=(t,a)=>this.create({...a,type:"loading",message:t}),this.promise=(t,a)=>{if(!a)return;let n;a.loading!==void 0&&(n=this.create({...a,promise:t,type:"loading",message:a.loading,description:typeof a.description!="function"?a.description:void 0}));let o=Promise.resolve(t instanceof Function?t():t),r=n!==void 0,s,i=o.then(async c=>{if(s=["resolve",c],pe.default.isValidElement(c))r=!1,this.create({id:n,type:"default",message:c});else if(Wq(c)&&!c.ok){r=!1;let u=typeof a.error=="function"?await a.error(`HTTP error! status: ${c.status}`):a.error,d=typeof a.description=="function"?await a.description(`HTTP error! status: ${c.status}`):a.description,g=typeof u=="object"&&!pe.default.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:d,...g})}else if(c instanceof Error){r=!1;let u=typeof a.error=="function"?await a.error(c):a.error,d=typeof a.description=="function"?await a.description(c):a.description,g=typeof u=="object"&&!pe.default.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:d,...g})}else if(a.success!==void 0){r=!1;let u=typeof a.success=="function"?await a.success(c):a.success,d=typeof a.description=="function"?await a.description(c):a.description,g=typeof u=="object"&&!pe.default.isValidElement(u)?u:{message:u};this.create({id:n,type:"success",description:d,...g})}}).catch(async c=>{if(s=["reject",c],a.error!==void 0){r=!1;let f=typeof a.error=="function"?await a.error(c):a.error,u=typeof a.description=="function"?await a.description(c):a.description,m=typeof f=="object"&&!pe.default.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:u,...m})}}).finally(()=>{r&&(this.dismiss(n),n=void 0),a.finally==null||a.finally.call(a)}),l=()=>new Promise((c,f)=>i.then(()=>s[0]==="reject"?f(s[1]):c(s[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,a)=>{let n=aM(a);return this.create({...a,jsx:t(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},gn=new Ub,jq=(e,t)=>gn.message(e,t),Wq=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Xq=jq,Yq=()=>gn.toasts,Kq=()=>gn.getActiveToasts(),xn=Object.assign(Xq,{success:gn.success,info:gn.info,warning:gn.warning,error:gn.error,custom:gn.custom,message:gn.message,promise:gn.promise,dismiss:gn.dismiss,loading:gn.loading},{getHistory:Yq,getToasts:Kq});_q("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Mg(e){return e.label!==void 0}var Zq=3,Qq="24px",Jq="16px",nM=4e3,eU=356,tU=14,aU=45,nU=200;function ar(...e){return e.filter(Boolean).join(" ")}function oU(e){let[t,a]=e.split("-"),n=[];return t&&n.push(t),a&&n.push(a),n}var rU=e=>{var t,a,n,o,r,s,i,l,c;let{invert:f,toast:u,unstyled:d,interacting:m,setHeights:g,visibleToasts:b,heights:v,index:x,toasts:y,expanded:h,removeToast:w,defaultRichColors:S,closeButton:C,style:I,cancelButtonStyle:L,actionButtonStyle:T,className:A="",descriptionClassName:D="",duration:H,position:V,gap:N,expandByDefault:P,classNames:E,icons:_,closeButtonAriaLabel:z="Close toast"}=e,[q,O]=pe.default.useState(null),[W,ee]=pe.default.useState(null),[de,ne]=pe.default.useState(!1),[re,ue]=pe.default.useState(!1),[ce,U]=pe.default.useState(!1),[M,se]=pe.default.useState(!1),[le,B]=pe.default.useState(!1),[G,oe]=pe.default.useState(0),[Y,Le]=pe.default.useState(0),ze=pe.default.useRef(u.duration||H||nM),bt=pe.default.useRef(null),st=pe.default.useRef(null),Gt=x===0,Ge=x+1<=b,at=u.type,Ba=at??"default",Tt=u.dismissible!==!1,bn=u.className||"",lo=u.descriptionClassName||"",en=pe.default.useMemo(()=>v.findIndex(Ae=>Ae.toastId===u.id)||0,[v,u.id]),lr=pe.default.useMemo(()=>{var Ae;return(Ae=u.closeButton)!=null?Ae:C},[u.closeButton,C]),Rl=pe.default.useMemo(()=>u.duration||H||nM,[u.duration,H]),ai=pe.default.useRef(0),qr=pe.default.useRef(0),Ap=pe.default.useRef(0),Ur=pe.default.useRef(null),[Kx,Zx]=V.split("-"),Dp=pe.default.useMemo(()=>v.reduce((Ae,Bt,Jt)=>Jt>=en?Ae:Ae+Bt.height,0),[v,en]),_p=Vq(),zn=pe.default.useMemo(()=>{var Ae;return(Ae=e.swipeDirections)!=null?Ae:oU(V)},[e.swipeDirections,V]),Qx=u.invert||f,_c=at==="loading";qr.current=pe.default.useMemo(()=>en*N+Dp,[en,Dp]),pe.default.useEffect(()=>{ze.current=Rl},[Rl]),pe.default.useEffect(()=>{ne(!0)},[]),pe.default.useEffect(()=>{let Ae=st.current;if(Ae){let Bt=Ae.getBoundingClientRect().height;return Le(Bt),g(Jt=>[{toastId:u.id,height:Bt,position:u.position},...Jt]),()=>g(Jt=>Jt.filter(Ia=>Ia.toastId!==u.id))}},[g,u.id]),pe.default.useLayoutEffect(()=>{if(!de)return;let Ae=st.current,Bt=Ae.style.height;Ae.style.height="auto";let Jt=Ae.getBoundingClientRect().height;Ae.style.height=Bt,Le(Jt),g(Ia=>Ia.find($t=>$t.toastId===u.id)?Ia.map($t=>$t.toastId===u.id?{...$t,height:Jt}:$t):[{toastId:u.id,height:Jt,position:u.position},...Ia])},[de,u.title,u.description,g,u.id,u.jsx,u.action,u.cancel]);let Mo=pe.default.useCallback(()=>{ue(!0),oe(qr.current),g(Ae=>Ae.filter(Bt=>Bt.toastId!==u.id)),setTimeout(()=>{w(u)},nU)},[u,w,g,qr]);pe.default.useEffect(()=>{if(u.promise&&at==="loading"||u.duration===1/0||u.type==="loading")return;let Ae;return h||m||_p?(()=>{if(Ap.current<ai.current){let Ia=new Date().getTime()-ai.current;ze.current=ze.current-Ia}Ap.current=new Date().getTime()})():ze.current!==1/0&&(ai.current=new Date().getTime(),Ae=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),Mo()},ze.current)),()=>clearTimeout(Ae)},[h,m,u,at,_p,Mo]),pe.default.useEffect(()=>{u.delete&&(Mo(),u.onDismiss==null||u.onDismiss.call(u,u))},[Mo,u.delete]);function Pp(){var Ae;if(_?.loading){var Bt;return pe.default.createElement("div",{className:ar(E?.loader,u==null||(Bt=u.classNames)==null?void 0:Bt.loader,"sonner-loader"),"data-visible":at==="loading"},_.loading)}return pe.default.createElement(zq,{className:ar(E?.loader,u==null||(Ae=u.classNames)==null?void 0:Ae.loader),visible:at==="loading"})}let Jx=u.icon||_?.[at]||Pq(at);var Op,zp;return pe.default.createElement("li",{tabIndex:0,ref:st,className:ar(A,bn,E?.toast,u==null||(t=u.classNames)==null?void 0:t.toast,E?.[Ba],u==null||(a=u.classNames)==null?void 0:a[Ba]),"data-sonner-toast":"","data-rich-colors":(Op=u.richColors)!=null?Op:S,"data-styled":!(u.jsx||u.unstyled||d),"data-mounted":de,"data-promise":!!u.promise,"data-swiped":le,"data-removed":re,"data-visible":Ge,"data-y-position":Kx,"data-x-position":Zx,"data-index":x,"data-front":Gt,"data-swiping":ce,"data-dismissible":Tt,"data-type":at,"data-invert":Qx,"data-swipe-out":M,"data-swipe-direction":W,"data-expanded":!!(h||P&&de),"data-testid":u.testId,style:{"--index":x,"--toasts-before":x,"--z-index":y.length-x,"--offset":`${re?G:qr.current}px`,"--initial-height":P?"auto":`${Y}px`,...I,...u.style},onDragEnd:()=>{U(!1),O(null),Ur.current=null},onPointerDown:Ae=>{Ae.button!==2&&(_c||!Tt||(bt.current=new Date,oe(qr.current),Ae.target.setPointerCapture(Ae.pointerId),Ae.target.tagName!=="BUTTON"&&(U(!0),Ur.current={x:Ae.clientX,y:Ae.clientY})))},onPointerUp:()=>{var Ae,Bt,Jt;if(M||!Tt)return;Ur.current=null;let Ia=Number(((Ae=st.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ni=Number(((Bt=st.current)==null?void 0:Bt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),$t=new Date().getTime()-((Jt=bt.current)==null?void 0:Jt.getTime()),tn=q==="x"?Ia:ni,Bn=Math.abs(tn)/$t;if((q==="x"?zn.includes(Ia>0?"right":"left"):zn.includes(ni>0?"bottom":"top"))&&(Math.abs(tn)>=aU||Bn>.11)){oe(qr.current),u.onDismiss==null||u.onDismiss.call(u,u),ee(q==="x"?Ia>0?"right":"left":ni>0?"down":"up"),Mo(),se(!0);return}else{var Fn,Oc;(Fn=st.current)==null||Fn.style.setProperty("--swipe-amount-x","0px"),(Oc=st.current)==null||Oc.style.setProperty("--swipe-amount-y","0px")}B(!1),U(!1),O(null)},onPointerMove:Ae=>{var Bt,Jt,Ia;if(!Ur.current||!Tt||((Bt=window.getSelection())==null?void 0:Bt.toString().length)>0)return;let $t=Ae.clientY-Ur.current.y,tn=Ae.clientX-Ur.current.x;!q&&(Math.abs(tn)>1||Math.abs($t)>1)&&O(Math.abs(tn)>Math.abs($t)?"x":"y");let Bn={x:0,y:0},Pc=Fn=>1/(1.5+Math.abs(Fn)/20);if(q==="y"){if(zn.includes("top")||zn.includes("bottom"))if(zn.includes("top")&&$t<0||zn.includes("bottom")&&$t>0)Bn.y=$t;else{let Fn=$t*Pc($t);Bn.y=Math.abs(Fn)<Math.abs($t)?Fn:$t}}else if(q==="x"&&(zn.includes("left")||zn.includes("right")))if(zn.includes("left")&&tn<0||zn.includes("right")&&tn>0)Bn.x=tn;else{let Fn=tn*Pc(tn);Bn.x=Math.abs(Fn)<Math.abs(tn)?Fn:tn}(Math.abs(Bn.x)>0||Math.abs(Bn.y)>0)&&B(!0),(Jt=st.current)==null||Jt.style.setProperty("--swipe-amount-x",`${Bn.x}px`),(Ia=st.current)==null||Ia.style.setProperty("--swipe-amount-y",`${Bn.y}px`)}},lr&&!u.jsx&&at!=="loading"?pe.default.createElement("button",{"aria-label":z,"data-disabled":_c,"data-close-button":!0,onClick:_c||!Tt?()=>{}:()=>{Mo(),u.onDismiss==null||u.onDismiss.call(u,u)},className:ar(E?.closeButton,u==null||(n=u.classNames)==null?void 0:n.closeButton)},(zp=_?.close)!=null?zp:Uq):null,(at||u.icon||u.promise)&&u.icon!==null&&(_?.[at]!==null||u.icon)?pe.default.createElement("div",{"data-icon":"",className:ar(E?.icon,u==null||(o=u.classNames)==null?void 0:o.icon)},at==="loading"?u.icon||Pp():u.promise?Pp():null,at!=="loading"?Jx:null):null,pe.default.createElement("div",{"data-content":"",className:ar(E?.content,u==null||(r=u.classNames)==null?void 0:r.content)},pe.default.createElement("div",{"data-title":"",className:ar(E?.title,u==null||(s=u.classNames)==null?void 0:s.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?pe.default.createElement("div",{"data-description":"",className:ar(D,lo,E?.description,u==null||(i=u.classNames)==null?void 0:i.description)},typeof u.description=="function"?u.description():u.description):null),pe.default.isValidElement(u.cancel)?u.cancel:u.cancel&&Mg(u.cancel)?pe.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||L,onClick:Ae=>{Mg(u.cancel)&&Tt&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,Ae),Mo())},className:ar(E?.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,pe.default.isValidElement(u.action)?u.action:u.action&&Mg(u.action)?pe.default.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||T,onClick:Ae=>{Mg(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,Ae),!Ae.defaultPrevented&&Mo())},className:ar(E?.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function oM(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function sU(e,t){let a={};return[e,t].forEach((n,o)=>{let r=o===1,s=r?"--mobile-offset":"--offset",i=r?Jq:Qq;function l(c){["top","right","bottom","left"].forEach(f=>{a[`${s}-${f}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?a[`${s}-${c}`]=i:a[`${s}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):l(i)}),a}var sM=pe.default.forwardRef(function(t,a){let{id:n,invert:o,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:l,className:c,offset:f,mobileOffset:u,theme:d="light",richColors:m,duration:g,style:b,visibleToasts:v=Zq,toastOptions:x,dir:y=oM(),gap:h=tU,icons:w,customAriaLabel:S,containerAriaLabel:C="Notifications"}=t,[I,L]=pe.default.useState([]),T=pe.default.useMemo(()=>n?I.filter(ne=>ne.toasterId===n):I.filter(ne=>!ne.toasterId),[I,n]),A=pe.default.useMemo(()=>Array.from(new Set([r].concat(T.filter(ne=>ne.position).map(ne=>ne.position)))),[T,r]),[D,H]=pe.default.useState([]),[V,N]=pe.default.useState(!1),[P,E]=pe.default.useState(!1),[_,z]=pe.default.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=pe.default.useRef(null),O=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=pe.default.useRef(null),ee=pe.default.useRef(!1),de=pe.default.useCallback(ne=>{L(re=>{var ue;return(ue=re.find(ce=>ce.id===ne.id))!=null&&ue.delete||gn.dismiss(ne.id),re.filter(({id:ce})=>ce!==ne.id)})},[]);return pe.default.useEffect(()=>gn.subscribe(ne=>{if(ne.dismiss){requestAnimationFrame(()=>{L(re=>re.map(ue=>ue.id===ne.id?{...ue,delete:!0}:ue))});return}setTimeout(()=>{rM.default.flushSync(()=>{L(re=>{let ue=re.findIndex(ce=>ce.id===ne.id);return ue!==-1?[...re.slice(0,ue),{...re[ue],...ne},...re.slice(ue+1)]:[ne,...re]})})})}),[]),pe.default.useEffect(()=>{if(d!=="system"){z(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;let ne=window.matchMedia("(prefers-color-scheme: dark)");try{ne.addEventListener("change",({matches:re})=>{z(re?"dark":"light")})}catch{ne.addListener(({matches:ue})=>{try{z(ue?"dark":"light")}catch(ce){console.error(ce)}})}},[d]),pe.default.useEffect(()=>{I.length<=1&&N(!1)},[I]),pe.default.useEffect(()=>{let ne=re=>{var ue;if(s.length>0&&s.every(M=>re[M]||re.code===M)){var U;N(!0),(U=q.current)==null||U.focus()}re.code==="Escape"&&(document.activeElement===q.current||(ue=q.current)!=null&&ue.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[s]),pe.default.useEffect(()=>{if(q.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,ee.current=!1)}},[q.current]),pe.default.createElement("section",{ref:a,"aria-label":S??`${C} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},A.map((ne,re)=>{var ue;let[ce,U]=ne.split("-");return T.length?pe.default.createElement("ol",{key:ne,dir:y==="auto"?oM():y,tabIndex:-1,ref:q,className:c,"data-sonner-toaster":!0,"data-sonner-theme":_,"data-y-position":ce,"data-x-position":U,style:{"--front-toast-height":`${((ue=D[0])==null?void 0:ue.height)||0}px`,"--width":`${eU}px`,"--gap":`${h}px`,...b,...sU(f,u)},onBlur:M=>{ee.current&&!M.currentTarget.contains(M.relatedTarget)&&(ee.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:M=>{M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false"||ee.current||(ee.current=!0,W.current=M.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{P||N(!1)},onDragEnd:()=>N(!1),onPointerDown:M=>{M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false"||E(!0)},onPointerUp:()=>E(!1)},T.filter(M=>!M.position&&re===0||M.position===ne).map((M,se)=>{var le,B;return pe.default.createElement(rU,{key:M.id,icons:w,index:se,toast:M,defaultRichColors:m,duration:(le=x?.duration)!=null?le:g,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:o,visibleToasts:v,closeButton:(B=x?.closeButton)!=null?B:l,interacting:P,position:ne,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:de,toasts:T.filter(G=>G.position==M.position),heights:D.filter(G=>G.position==M.position),setHeights:H,expandByDefault:i,gap:h,expanded:V,swipeDirections:t.swipeDirections})})):null}))});var lM=j(fe(),1);function iM(){return(0,lM.jsx)(sM,{position:"bottom-center",toastOptions:{classNames:{toast:"!bg-card !text-foreground !border !border-border !shadow-lg",description:"!text-muted-foreground"}}})}var Io=j(he(),1);var Pe=j(he(),1);var ut=j(fe(),1),iU=Object.defineProperty,ct=(e,t)=>iU(e,"name",{value:t,configurable:!0}),Vb=["Enter"," "],lU=["ArrowDown","PageUp","Home"],cM=["ArrowUp","PageDown","End"],uU=[...lU,...cM],Mse={ltr:[...Vb,"ArrowRight"],rtl:[...Vb,"ArrowLeft"]};var Ag="Menu",[Gb,cU,dU]=Yi(Ag),[il,jb]=xt(Ag,[dU,Ju,Xu]),Wb=Ju(),dM=Xu(),[fU,Kf]=il(Ag),[pU,Xb]=il(Ag),mU=ct(e=>{let{__scopeMenu:t,open:a=!1,children:n,dir:o,onOpenChange:r,modal:s=!0}=e,i=Wb(t),[l,c]=Pe.useState(null),f=Pe.useRef(!1),u=oa(r),d=Tr(o);return Pe.useEffect(()=>{let m=ct(()=>{f.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=ct(()=>f.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),Pe.useEffect(()=>{if(!a)return;let m=ct(()=>u(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[a,u]),(0,ut.jsx)(Sg,{...i,children:(0,ut.jsx)(fU,{scope:t,open:a,onOpenChange:u,content:l,onContentChange:c,children:(0,ut.jsx)(pU,{scope:t,onClose:Pe.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:d,modal:s,children:n})})})},"Menu"),hU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,...o}=t,r=Wb(n);return(0,ut.jsx)(Cg,{...r,...o,ref:a})},"MenuAnchor")),fM="MenuPortal",[gU,xU]=il(fM,{forceMount:void 0}),vU=ct(e=>{let{__scopeMenu:t,forceMount:a,children:n,container:o}=e,r=Kf(fM,t);return(0,ut.jsx)(gU,{scope:t,forceMount:a,children:(0,ut.jsx)(An,{present:a||r.open,children:(0,ut.jsx)(Au,{asChild:!0,container:o,children:n})})})},"MenuPortal"),Us="MenuContent",[yU,pM]=il(Us),bU=Pe.forwardRef(ct(function(t,a){let n=xU(Us,t.__scopeMenu),{forceMount:o=n.forceMount,...r}=t,s=Kf(Us,t.__scopeMenu),i=Xb(Us,t.__scopeMenu);return(0,ut.jsx)(Gb.Provider,{scope:t.__scopeMenu,children:(0,ut.jsx)(An,{present:o||s.open,children:(0,ut.jsx)(Gb.Slot,{scope:t.__scopeMenu,children:i.modal?(0,ut.jsx)(wU,{...r,ref:a}):(0,ut.jsx)(SU,{...r,ref:a})})})})},"MenuContent")),wU=Pe.forwardRef(ct(function(t,a){let n=Kf(Us,t.__scopeMenu),o=Pe.useRef(null),r=Te(a,o);return Pe.useEffect(()=>{let s=o.current;if(s)return Fu(s)},[]),(0,ut.jsx)(mM,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ke(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentModal")),SU=Pe.forwardRef(ct(function(t,a){let n=Kf(Us,t.__scopeMenu);return(0,ut.jsx)(mM,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentNonModal")),CU=Ea("MenuContent.ScrollLock"),mM=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...v}=t,x=Kf(Us,n),y=Xb(Us,n),h=Wb(n),w=dM(n),S=cU(n),[C,I]=Pe.useState(null),L=Pe.useRef(null),T=Te(a,L,x.onContentChange),A=Pe.useRef(0),D=Pe.useRef(""),H=Pe.useRef(0),V=Pe.useRef(null),N=Pe.useRef("right"),P=Pe.useRef(0),E=b?Ai:Pe.Fragment,_=b?{as:CU,allowPinchZoom:!0}:void 0,z=ct(O=>{let W=D.current+O,ee=S().filter(U=>!U.disabled),de=document.activeElement,ne=ee.find(U=>U.ref.current===de)?.textValue,re=ee.map(U=>U.textValue),ue=yM(re,W,ne),ce=ee.find(U=>U.textValue===ue)?.ref.current;ct((function U(M){D.current=M,window.clearTimeout(A.current),M!==""&&(A.current=window.setTimeout(()=>U(""),1e3))}),"updateSearch")(W),ce&&setTimeout(()=>ce.focus())},"handleTypeaheadSearch");Pe.useEffect(()=>()=>window.clearTimeout(A.current),[]),ws();let q=Pe.useCallback(O=>N.current===V.current?.side&&wM(O,V.current?.area),[]);return(0,ut.jsx)(yU,{scope:n,searchRef:D,onItemEnter:Pe.useCallback(O=>{q(O)&&O.preventDefault()},[q]),onItemLeave:Pe.useCallback(O=>{q(O)||(L.current?.focus(),I(null))},[q]),onTriggerLeave:Pe.useCallback(O=>{q(O)&&O.preventDefault()},[q]),pointerGraceTimerRef:H,onPointerGraceIntentChange:Pe.useCallback(O=>{V.current=O},[]),children:(0,ut.jsx)(E,{..._,children:(0,ut.jsx)(Eu,{asChild:!0,trapped:r,onMountAutoFocus:ke(s,O=>{O.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:(0,ut.jsx)(Mu,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:m,onDismiss:g,children:(0,ut.jsx)(og,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:o,currentTabStopId:C,onCurrentTabStopIdChange:I,onEntryFocus:ke(c,O=>{y.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ut.jsx)(kg,{role:"menu","aria-orientation":"vertical","data-state":hM(x.open),"data-radix-menu-content":"",dir:y.dir,...h,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:ke(v.onKeyDown,O=>{let ee=O.target.closest("[data-radix-menu-content]")===O.currentTarget,de=O.ctrlKey||O.altKey||O.metaKey,ne=O.key.length===1;ee&&(O.key==="Tab"&&O.preventDefault(),!de&&ne&&z(O.key));let re=L.current;if(O.target!==re||!uU.includes(O.key))return;O.preventDefault();let ce=S().filter(U=>!U.disabled).map(U=>U.ref.current);cM.includes(O.key)&&ce.reverse(),xM(ce)}),onBlur:ke(t.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(A.current),D.current="")}),onPointerMove:ke(t.onPointerMove,Eg(O=>{let W=O.target,ee=P.current!==O.clientX;if(O.currentTarget.contains(W)&&ee){let de=O.clientX>P.current?"right":"left";N.current=de,P.current=O.clientX}}))})})})})})})},"MenuContentImpl"));var kU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,...o}=t;return(0,ut.jsx)(Re.div,{...o,ref:a})},"MenuLabel")),$b="MenuItem",uM="menu.itemSelect",LU=Pe.forwardRef(ct(function(t,a){let{disabled:n=!1,onSelect:o,...r}=t,s=Pe.useRef(null),i=Xb($b,t.__scopeMenu),l=pM($b,t.__scopeMenu),c=Te(a,s),f=Pe.useRef(!1),u=ct(()=>{let d=s.current;if(!n&&d){let m=new CustomEvent(uM,{bubbles:!0,cancelable:!0});d.addEventListener(uM,g=>o?.(g),{once:!0}),Hd(d,m),m.defaultPrevented?f.current=!1:i.onClose()}},"handleSelect");return(0,ut.jsx)(IU,{...r,ref:c,disabled:n,onClick:ke(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),f.current=!0},onPointerUp:ke(t.onPointerUp,d=>{f.current||d.currentTarget?.click()}),onKeyDown:ke(t.onKeyDown,d=>{n||d.target!==d.currentTarget||l.searchRef.current!==""&&d.key===" "||Vb.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})},"MenuItem")),IU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=t,i=pM($b,n),l=dM(n),c=Pe.useRef(null),f=Te(a,c),[u,d]=Pe.useState(!1),[m,g]=Pe.useState("");return Pe.useEffect(()=>{let b=c.current;b&&g((b.textContent??"").trim())},[s.children]),(0,ut.jsx)(Gb.ItemSlot,{scope:n,disabled:o,textValue:r??m,children:(0,ut.jsx)(rg,{asChild:!0,...l,focusable:!o,children:(0,ut.jsx)(Re.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:ke(t.onPointerMove,Eg(b=>{o?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ke(t.onPointerLeave,Eg(b=>i.onItemLeave(b))),onFocus:ke(t.onFocus,()=>d(!0)),onBlur:ke(t.onBlur,()=>d(!1))})})})},"MenuItemImpl"));var NU="MenuRadioGroup",[Ese,Ase]=il(NU,{value:void 0,onValueChange:ct(()=>{},"onValueChange")});var RU="MenuItemIndicator",[Dse,_se]=il(RU,{checked:!1});var TU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,...o}=t;return(0,ut.jsx)(Re.div,{role:"separator","aria-orientation":"horizontal",...o,ref:a})},"MenuSeparator"));var MU="MenuSub",[Pse,Ose]=il(MU);function hM(e){return e?"open":"closed"}ct(hM,"getOpenState");function gM(e){return e==="indeterminate"}ct(gM,"isIndeterminate");function EU(e){return gM(e)?"indeterminate":e?"checked":"unchecked"}ct(EU,"getCheckedState");function xM(e){let t=document.activeElement;for(let a of e)if(a===t||(a.focus(),document.activeElement!==t))return}ct(xM,"focusFirst");function vM(e,t){return e.map((a,n)=>e[(t+n)%e.length])}ct(vM,"wrapArray");function yM(e,t,a){let o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,r=a?e.indexOf(a):-1,s=vM(e,Math.max(r,0));o.length===1&&(s=s.filter(c=>c!==a));let l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==a?l:void 0}ct(yM,"getNextMatch");function bM(e,t){let{x:a,y:n}=e,o=!1;for(let r=0,s=t.length-1;r<t.length;s=r++){let i=t[r],l=t[s],c=i.x,f=i.y,u=l.x,d=l.y;f>n!=d>n&&a<(u-c)*(n-f)/(d-f)+c&&(o=!o)}return o}ct(bM,"isPointInPolygon");function wM(e,t){if(!t)return!1;let a={x:e.clientX,y:e.clientY};return bM(a,t)}ct(wM,"isPointerInGraceArea");function Eg(e){return t=>t.pointerType==="mouse"?e(t):void 0}ct(Eg,"whenMouse");var SM=mU,CM=hU,kM=vU,LM=bU;var IM=kU,NM=LU;var RM=TU;var nr=j(fe(),1),DU=Object.defineProperty,ll=(e,t)=>DU(e,"name",{value:t,configurable:!0}),Yb="DropdownMenu",[_U,Jse]=xt(Yb,[jb]),ul=jb(),[PU,TM]=_U(Yb),OU=ll(e=>{let{__scopeDropdownMenu:t,children:a,dir:n,open:o,defaultOpen:r,onOpenChange:s,modal:i=!0}=e,l=ul(t),c=Io.useRef(null),[f,u]=Ma({prop:o,defaultProp:r??!1,onChange:s,caller:Yb});return(0,nr.jsx)(PU,{scope:t,triggerId:Ga(),triggerRef:c,contentId:Ga(),open:f,onOpenChange:u,onOpenToggle:Io.useCallback(()=>u(d=>!d),[u]),modal:i,children:(0,nr.jsx)(SM,{...l,open:f,onOpenChange:u,dir:n,modal:i,children:a})})},"DropdownMenu"),zU="DropdownMenuTrigger",BU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,disabled:o=!1,...r}=t,s=TM(zU,n),i=ul(n),l=Te(a,s.triggerRef);return(0,nr.jsx)(CM,{asChild:!0,...i,children:(0,nr.jsx)(Re.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:l,onPointerDown:ke(t.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:ke(t.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),FU=ll(e=>{let{__scopeDropdownMenu:t,...a}=e,n=ul(t);return(0,nr.jsx)(kM,{...n,...a})},"DropdownMenuPortal"),HU="DropdownMenuContent",qU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=TM(HU,n),s=ul(n),i=Io.useRef(!1);return(0,nr.jsx)(LM,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:a,onCloseAutoFocus:ke(t.onCloseAutoFocus,l=>{i.current||r.triggerRef.current?.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:ke(t.onInteractOutside,l=>{let c=l.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0,u=c.button===2||f;(!r.modal||u)&&(i.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent"));var UU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=ul(n);return(0,nr.jsx)(IM,{...r,...o,ref:a})},"DropdownMenuLabel")),VU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=ul(n);return(0,nr.jsx)(NM,{...r,...o,ref:a})},"DropdownMenuItem"));var GU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=ul(n);return(0,nr.jsx)(RM,{...r,...o,ref:a})},"DropdownMenuSeparator"));var MM=OU,EM=BU,AM=FU,DM=qU;var _M=UU,PM=VU;var OM=GU;var sc=j(fe(),1),ic=MM,lc=EM;function uc({className:e,sideOffset:t=4,...a}){return(0,sc.jsx)(AM,{children:(0,sc.jsx)(DM,{"data-slot":"dropdown-menu-content",sideOffset:t,className:te("z-[120] min-w-44 overflow-hidden rounded-[10px] border-0 bg-popover p-1 text-popover-foreground shadow-[var(--so-shadow-overlay)]",e),...a})})}function cc({className:e,...t}){return(0,sc.jsx)(PM,{"data-slot":"dropdown-menu-item",className:te("relative flex cursor-default select-none items-center gap-2 rounded-[6px] px-2 py-1.5 text-[13px] outline-none data-[highlighted]:bg-accent phone:min-h-11 [&_svg]:size-4",e),...t})}function Kb({className:e,...t}){return(0,sc.jsx)(_M,{className:te("px-2 py-1.5 text-xs font-semibold text-muted-foreground",e),...t})}var zM=({className:e,...t})=>(0,sc.jsx)(OM,{className:te("-mx-1 my-1 h-px bg-border",e),...t});var Qe=j(fe(),1),BM=e=>e.charAt(0).toUpperCase()+e.slice(1);async function jU(e,t,a,n){let o=new URLSearchParams({csrf:a});t==="confirm"&&n&&o.set("confirm","yes");try{let r=await fetch(`/chat/proposal/${e.id}/${t}`,{method:"POST",body:o,credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(2e4)});if(!r.headers.get("content-type")?.includes("application/json"))return{ok:!1,said:"That didn't go through. Reload the conversation and try again."};let s=await r.json(),i=typeof s=="object"&&s!==null?s:{};return{ok:i.ok===!0,said:typeof i.said=="string"?BM(i.said):"Done."}}catch{return{ok:!1,said:"That didn't go through. Check your connection and try again."}}}function WU({card:e,csrf:t,onChanged:a}){let[n,o]=(0,Zf.useState)(null),[r,s]=(0,Zf.useState)(!1),i=(0,Zf.useId)(),l=async d=>{o(d);let m=await jU(e,d,t,r);d==="confirm"?(m.ok?xn.success:xn.error)(m.said):m.ok||xn.error(m.said),o(null),a()},c=e.primary,f=c?.kind==="confirm"&&c.irreversible&&!r,u=e.state==="confirmed"||e.state==="refused"||e.state==="dismissed"||e.state==="expired";return(0,Qe.jsxs)("section",{"data-view":"chat-card","data-action-card":e.id,"data-card-kind":e.kind,"data-card-state":e.state,className:te("mt-3 overflow-hidden rounded-lg border border-border bg-card text-card-foreground",e.state==="pending"&&"border-primary/40",u&&"opacity-90"),children:[(0,Qe.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-4 py-2.5 text-[13px] font-semibold text-muted-foreground",children:[(0,Qe.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.state==="confirmed"&&(0,Qe.jsxs)("span",{className:"inline-flex items-center gap-1 text-success",children:[(0,Qe.jsx)(ja,{className:"size-3.5","aria-hidden":"true"}),"Done"]}),e.state==="refused"&&(0,Qe.jsxs)("span",{className:"inline-flex items-center gap-1 text-destructive",children:[(0,Qe.jsx)(At,{className:"size-3.5","aria-hidden":"true"}),"Not done"]})]}),e.body!==""&&(0,Qe.jsx)("div",{className:"px-4 py-3",children:(0,Qe.jsx)(Kt,{html:e.body,immutable:!0,className:"so-card-body"})}),(0,Qe.jsxs)("footer",{className:"flex flex-col gap-2 px-4 pb-3.5 pt-1",children:[e.said!==null&&(0,Qe.jsx)("p",{className:te("text-[13px]",e.state==="refused"?"text-destructive":"text-success"),children:BM(e.said)}),e.links.length>0&&(0,Qe.jsx)("div",{className:"flex flex-wrap gap-2",children:e.links.map(d=>(0,Qe.jsx)(Z,{asChild:!0,variant:"outline",size:"sm",children:(0,Qe.jsx)("a",{href:d.href,children:d.label})},d.href))}),e.note!==null&&(0,Qe.jsx)("p",{className:"text-[13px] text-muted-foreground",children:e.note}),c?.kind==="confirm"&&c.irreversible&&(0,Qe.jsxs)("label",{htmlFor:i,className:"flex items-center gap-2 text-[13px]",children:[(0,Qe.jsx)("input",{id:i,type:"checkbox",checked:r,onChange:d=>s(d.target.checked),className:"size-4 accent-[var(--so-accent)]"}),"I understand this cannot be undone"]}),(c!==null||e.dismissable)&&(0,Qe.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c?.kind==="link"&&(0,Qe.jsx)(Z,{asChild:!0,size:"sm",children:(0,Qe.jsx)("a",{href:c.href,children:c.label})}),c?.kind==="confirm"&&c.native&&(0,Qe.jsxs)($e,{action:`/chat/proposal/${e.id}/confirm`,children:[(0,Qe.jsx)("input",{type:"hidden",name:"return",value:window.location.pathname+window.location.search}),c.irreversible&&r&&(0,Qe.jsx)("input",{type:"hidden",name:"confirm",value:"yes"}),(0,Qe.jsx)(Z,{type:"submit",size:"sm",disabled:f,children:c.label})]}),c?.kind==="confirm"&&!c.native&&(0,Qe.jsx)(Z,{size:"sm",disabled:n!==null||f,onClick:()=>{l("confirm")},"data-card-confirm":!0,children:n==="confirm"?"Working…":c.label}),e.dismissable&&(0,Qe.jsx)(Z,{variant:"ghost",size:"sm",disabled:n!==null,onClick:()=>{l("dismiss")},"data-card-dismiss":!0,children:n==="dismiss"?"Dismissing…":"Dismiss"})]})]})]})}function Qf({cards:e,csrf:t,onChanged:a,readOnly:n=!1}){return(0,Qe.jsx)("div",{className:"so-action-cards",children:e.map(o=>(0,Qe.jsx)(WU,{card:n?{...o,primary:null,dismissable:!1}:o,csrf:t,onChanged:a},`${o.id}:${o.state}`))})}var Zb={lead:[{command:"new",hint:"File a new task",text:"File a task: "},{command:"flow",hint:"Make a flow for how work moves",text:"Make a flow for "},{command:"status",hint:"What needs you right now",text:"What needs my attention right now?"},{command:"next",hint:"What to work on next",text:"What should we work on next?"}],task:[{command:"status",hint:"Where this task stands",text:"Where does this task stand?"},{command:"next",hint:"Take the next step",text:"Move this forward"},{command:"revise",hint:"Request changes",text:"Request changes: "},{command:"diff",hint:"Walk through the changes",text:"Walk me through the changes file by file."},{command:"log",hint:"What the checks said",text:"What does the check log say?"},{command:"steer",hint:"Guide the next attempt",text:"For the next attempt: "},{command:"stop",hint:"Stop the running attempt",text:"Stop this task."},{command:"resume",hint:"Resume a stopped attempt",text:"Resume this task."},{command:"complete",hint:"Mark the result complete",text:"Mark this result complete."}],result:[{command:"summary",hint:"What changed",text:"Summarize what changed."},{command:"diff",hint:"Walk through the changes",text:"Walk me through the changes file by file."},{command:"log",hint:"What the checks said",text:"What does the check log say?"},{command:"risks",hint:"Anything to worry about",text:"Are there any risks in this change?"},{command:"revise",hint:"Request changes",text:"Request changes: "},{command:"complete",hint:"Mark the result complete",text:"Mark this result complete."}],tasks:[{command:"new",hint:"File a new task here",text:"File a task: "},{command:"flow",hint:"Make a flow for this project",text:"Make a flow for "},{command:"status",hint:"What needs you here",text:"What needs my attention here?"},{command:"next",hint:"What to build next",text:"What should we build next?"}]};var X=j(fe(),1),Dg=()=>({text:"",requestId:crypto.randomUUID(),uncertain:!1});function XU(e){try{let t=JSON.parse(sessionStorage.getItem(e)??"null");if(t&&typeof t=="object"&&typeof t.text=="string"&&typeof t.requestId=="string")return t}catch{}return Dg()}function FM(e){return{queued:"Queued",running:"Working",failed:"Could not finish",cancelled:"Stopped",uncertain:"Delivery unconfirmed",answered:null}[e.status]}function YU(e,t){return e.split(/(\/(?:t\/[^\s<>"')]+|r\/\d+(?:\?[^\s<>"')]+)?|chat\?task=[^\s<>"')]+))/g).map((a,n)=>{if(!/^\/(?:t\/|r\/|chat\?task=)/.test(a))return a;let o=a.replace(/[.,;!]+$/,""),r=t&&o.startsWith("/chat?")?o+"&conversation="+encodeURIComponent(t):o;return(0,X.jsxs)("span",{children:[(0,X.jsx)("a",{href:r,children:r.startsWith("/r/")||r.includes("result=")?"Open result":"Open task"}),a.slice(o.length)]},n)})}function Qb({projects:e}){return(0,X.jsxs)("fieldset",{className:"so-team-projects",children:[(0,X.jsx)("legend",{children:"Projects"}),e.length===0?(0,X.jsx)("p",{children:"Add a project before creating a lead."}):e.map(t=>(0,X.jsxs)("label",{children:[(0,X.jsx)("input",{type:"checkbox",name:"projects",value:t,defaultChecked:e.length===1}),(0,X.jsx)("span",{title:t,children:t.split("/").pop()||t})]},t))]})}function KU({proposals:e,csrf:t,onChanged:a,readOnly:n}){return e.length?(0,X.jsx)("div",{className:"so-team-proposals",children:e.map(o=>o.card?(0,X.jsx)(Qf,{cards:[o.card],csrf:t,onChanged:a,readOnly:n},o.id):(0,X.jsxs)("article",{children:[(0,X.jsx)("strong",{children:o.title}),(0,X.jsx)(F1,{children:o.state==="pending"?"Proposed":o.state}),(0,X.jsx)("a",{href:o.href,children:o.state==="pending"?"Review action":"Open outcome"})]},o.id))}):null}function HM({initial:e,user:t,csrf:a,onSnapshot:n}){let[o,r]=(0,Rt.useState)(e),s=o.selected,i=`standing-orders:team-draft:${t}:${s?.id??"new"}`,[l,c]=(0,Rt.useState)(()=>XU(i)),[f,u]=(0,Rt.useState)(""),[d,m]=(0,Rt.useState)(!1),[g,b]=(0,Rt.useState)(!1),[v,x]=(0,Rt.useState)(!1),[y,h]=(0,Rt.useState)(null),[w,S]=(0,Rt.useState)(!1),[C,I]=(0,Rt.useState)(!1),L=(0,Rt.useRef)({snapshot:o,draft:l});L.current={snapshot:o,draft:l};let T=(0,Rt.useRef)(!1),A=(0,Rt.useRef)(null),D=o.leads.find(M=>M.id===s?.leadId),H=typeof window>"u"?null:new URL(window.location.href).searchParams.get("lead"),V=D?.id??o.leads.find(M=>M.id===H)?.id??o.leads[0]?.id??"",[N,P]=(0,Rt.useState)(V),E=o.leads.find(M=>M.id===N);(0,Rt.useEffect)(()=>{o.leads.some(M=>M.id===N)||P(V)},[o.leads,N,V]);let _=(0,Rt.useCallback)(M=>{c(M),I(!1);try{sessionStorage.setItem(i,JSON.stringify(M)),S(!1)}catch{S(!0)}},[i]),z=(0,Rt.useCallback)(M=>{r(M),n?.(M);let se=L.current.draft;se.text&&M.messages.some(le=>le.author===t&&le.requestId===se.requestId)&&_(Dg())},[_,t,n]),q=(0,Rt.useCallback)(async()=>{let M=await fetch("/api/team"+(s?"?conversation="+encodeURIComponent(s.id):""),{credentials:"same-origin",cache:"no-store"}),se=await M.json();if(M.status===401||M.status===403){x(!0),u(se.message);return}if(!se.ok||!se.snapshot)throw new Error(se.message||"Updates are unavailable.");z(se.snapshot),m(!1)},[s?.id,z]);jo(v?null:qu("team",null,{conversation:s?.id}),M=>{M==="change"||M==="reload"?q().catch(()=>m(!0)):M==="gone"?(x(!0),u("Your access changed. Reopen Chat or sign in again.")):M==="lost"&&m(!0)}),(0,Rt.useEffect)(()=>{A.current?.scrollIntoView({block:"nearest"})},[o.messages.length]);let O=o.messages.at(-1)?.id;(0,Rt.useEffect)(()=>{!s||!O||v||document.hidden||fetch("/api/team",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":a},body:JSON.stringify({operation:"read",args:{conversationId:s.id,messageId:O}})}).catch(()=>{})},[s?.id,O,v,a]);async function W(M,se){if(T.current||v)return null;T.current=!0,b(!0),u("");try{let B=await(await fetch("/api/team",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":a},body:JSON.stringify({operation:M,args:se})})).json();return B.snapshot&&z(B.snapshot),B.ok?B:(u(B.message),B.code==="delivery-unconfirmed"&&M==="send"&&_({...L.current.draft,uncertain:!0}),null)}catch{return M==="send"&&_({...L.current.draft,uncertain:!0}),u("The response was not confirmed. Check saved messages before sending again."),null}finally{T.current=!1,b(!1)}}async function ee(M){if(M.preventDefault(),!s||!l.text.trim()||l.uncertain)return;await W("send",{conversationId:s.id,text:l.text,requestId:l.requestId})&&_(Dg())}async function de(M,se){M.preventDefault();let le=new FormData(M.currentTarget),B=le.getAll("projects");if(!B.length){u("Choose at least one project.");return}let G=await W(se,se==="create-lead"?{name:le.get("name"),instructions:le.get("instructions")??"",projects:B}:{leadId:N,title:le.get("title"),visibility:le.get("visibility"),projects:B}),oe=G?.result&&typeof G.result=="object"?G.result:{};G?.ok&&se==="create-lead"&&typeof oe.leadId=="string"?window.location.assign("/chat?lead="+encodeURIComponent(oe.leadId)):G?.snapshot?.selected?window.location.assign("/chat?conversation="+encodeURIComponent(G.snapshot.selected.id)):G?.ok&&await q()}let ne=(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{de(M,"create-conversation")},children:[o.leads.length>1&&(0,X.jsxs)("label",{children:["Lead",(0,X.jsx)("select",{name:"leadId",value:N,onChange:M=>P(M.target.value),children:o.leads.map(M=>(0,X.jsx)("option",{value:M.id,children:M.name},M.id))})]}),(0,X.jsxs)("label",{children:["Conversation title",(0,X.jsx)(Di,{name:"title",required:!0,maxLength:160,placeholder:"What are we working on?"})]}),(0,X.jsxs)("label",{children:["Audience",(0,X.jsxs)("select",{name:"visibility",defaultValue:"team",children:[(0,X.jsx)("option",{value:"team",children:"Team — invited people"}),(0,X.jsx)("option",{value:"private",children:"Private — only you"})]})]}),(0,X.jsx)(Qb,{projects:E?.projects??[]},N),(0,X.jsx)(_e,{type:"submit",disabled:g||!E,children:"Create conversation"})]}),re="canCreateLead"in o&&o.canCreateLead===!0,ue=new Map(o.messages.filter(M=>M.role==="assistant"&&M.turnId!==null).map(M=>[M.turnId,M.id])),ce=new Map;for(let M of o.proposals??[]){if(M.state==="drafting")continue;let se=ue.get(M.turnId)??null,le=ce.get(se)??[];le.push(M),ce.set(se,le)}let U=M=>(0,X.jsx)(KU,{proposals:ce.get(M)??[],csrf:a,readOnly:v,onChanged:()=>{q().catch(()=>m(!0))}});return(0,X.jsxs)("section",{className:"so-team-chat","aria-label":"Team conversation",children:[(0,X.jsxs)("div",{className:"so-team-toolbar",children:[o.leads.length>1&&(0,X.jsxs)("label",{className:"so-team-lead-select",children:[(0,X.jsx)("span",{className:"so-sr-only",children:"Lead"}),(0,X.jsx)("select",{"aria-label":"Lead",value:V,onChange:M=>window.location.assign("/chat?lead="+encodeURIComponent(M.target.value)),children:o.leads.map(M=>(0,X.jsx)("option",{value:M.id,children:M.name},M.id))})]}),s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"so-team-title",children:[(0,X.jsx)("h2",{children:s.title}),o.leads.length===1&&(0,X.jsx)("span",{children:D?.name??"Lead"})]}),(0,X.jsxs)(eo,{summary:s.visibility==="team"?"Team":"Private",className:"so-team-audience",children:[(0,X.jsx)("h3",{children:"People"}),(0,X.jsx)("ul",{children:o.participants.filter(M=>M.active).map(M=>(0,X.jsxs)("li",{children:[(0,X.jsx)("span",{children:M.account}),(0,X.jsx)("span",{children:M.role}),o.canManage&&M.account!==t&&(0,X.jsx)(_e,{variant:"ghost",onClick:()=>{W("member",{conversationId:s.id,account:M.account,role:M.role,active:!1,expectedRevision:s.revision})},disabled:g,children:"Remove"})]},M.account))}),o.canManage&&s.visibility==="team"&&(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{M.preventDefault();let se=new FormData(M.currentTarget);W("member",{conversationId:s.id,account:se.get("account"),role:se.get("role"),active:!0,expectedRevision:s.revision,joinLead:!0,expectedLeadRevision:D?.revision})},children:[(0,X.jsxs)("label",{children:["Person",(0,X.jsx)("select",{name:"account",required:!0,children:o.accounts.filter(M=>!o.participants.some(se=>se.account===M&&se.active)).map(M=>(0,X.jsx)("option",{children:M},M))})]}),(0,X.jsxs)("label",{children:["Access",(0,X.jsxs)("select",{name:"role",defaultValue:"contributor",children:[(0,X.jsx)("option",{value:"viewer",children:"Viewer"}),(0,X.jsx)("option",{value:"contributor",children:"Contributor"}),(0,X.jsx)("option",{value:"manager",children:"Manager"})]})]}),(0,X.jsxs)("p",{className:"so-team-small",children:["Adds access to this conversation and ",D?.name??"the lead"," for these projects: ",D?.projects.map(M=>M.split("/").pop()).join(", "),". Existing private conversations stay private."]}),(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Add person"})]}),(0,X.jsxs)("p",{className:"so-team-small",children:["Projects: ",s.projects.map(M=>M.split("/").pop()).join(", ")]})]})]}):(0,X.jsx)("h2",{children:o.leads.length?"Start a conversation":"Your team lead"})]}),(0,X.jsxs)("div",{className:"so-team-content",children:[(f||v)&&(0,X.jsxs)(fn,{tone:"error",children:[f||"Your access changed.",v&&(0,X.jsxs)(X.Fragment,{children:[" ",(0,X.jsx)("a",{href:"/chat",children:"Reopen Chat"})]})]}),d&&!v&&(0,X.jsxs)(fn,{children:["Live updates disconnected. ",(0,X.jsx)(_e,{variant:"ghost",onClick:()=>{q().catch(()=>u("Updates are still unavailable. Your draft is saved."))},children:"Check messages"})]}),!s&&o.leads.length>0&&(0,X.jsxs)(X.Fragment,{children:[o.conversations.length>0&&(0,X.jsx)("nav",{className:"so-team-room-list","aria-label":"Conversations",children:o.conversations.map(M=>(0,X.jsxs)("a",{href:"/chat?conversation="+encodeURIComponent(M.id),children:[(0,X.jsx)("strong",{children:M.title}),(0,X.jsx)("span",{children:M.visibility==="team"?"Team":"Private"})]},M.id))}),ne]}),!s&&o.leads.length===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("p",{children:re?"Create a lead, then invite people into a conversation.":"Ask a team administrator to invite you to a conversation."}),re&&(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{de(M,"create-lead")},children:[(0,X.jsxs)("label",{children:["Lead name",(0,X.jsx)(Di,{name:"name",defaultValue:"Team lead",required:!0,maxLength:100})]}),(0,X.jsx)(Qb,{projects:o.projects}),(0,X.jsx)(eo,{summary:"Working instructions",children:(0,X.jsx)(Ss,{name:"instructions",rows:4,placeholder:"What should this lead focus on?"})}),(0,X.jsx)(_e,{type:"submit",disabled:g||!o.projects.length,children:"Create lead"})]})]}),s&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"so-team-messages","aria-live":"polite","aria-relevant":"additions text",children:[o.messages.length===0&&(0,X.jsxs)("div",{className:"so-team-empty",children:[(0,X.jsx)("h3",{children:"What would you like to work on?"}),(0,X.jsx)("p",{children:s.visibility==="team"?"People you invite can join this conversation.":"Only you can read this conversation."})]}),o.messages.map(M=>(0,X.jsxs)("article",{className:"so-team-message so-team-message--"+M.role,"data-team-message":M.id,children:[(0,X.jsxs)("div",{className:"so-team-message-meta",children:[(0,X.jsx)("strong",{children:M.author}),FM(M)&&(0,X.jsx)(F1,{tone:["failed","uncertain"].includes(M.status)?"danger":"neutral",children:FM(M)})]}),y===M.id?(0,X.jsxs)("form",{className:"so-team-form",onSubmit:se=>{se.preventDefault();let le=new FormData(se.currentTarget);W("edit",{conversationId:s.id,messageId:M.id,expectedRevision:M.revision,text:le.get("text")}).then(B=>{B&&h(null)})},children:[(0,X.jsx)(_i,{htmlFor:"team-edit-"+M.id,children:"Edit queued message"}),(0,X.jsx)(Ss,{id:"team-edit-"+M.id,name:"text",defaultValue:M.text,required:!0,maxLength:2e3,rows:3}),(0,X.jsxs)("div",{children:[(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Save edit"}),(0,X.jsx)(_e,{variant:"ghost",onClick:()=>h(null),children:"Cancel"})]})]}):(0,X.jsx)("p",{className:"so-team-message-text",children:YU(M.text,s.id)}),M.error&&(0,X.jsx)(fn,{tone:"error",children:M.error}),M.status==="queued"&&M.author===t&&!v&&(0,X.jsxs)("div",{className:"so-team-message-actions",children:[(0,X.jsx)(_e,{variant:"ghost",onClick:()=>h(M.id),disabled:g,children:"Edit"}),(0,X.jsx)(_e,{variant:"ghost",onClick:()=>{W("withdraw",{conversationId:s.id,messageId:M.id,expectedRevision:M.revision})},disabled:g,children:"Withdraw"})]}),U(M.id)]},M.id))]}),o.truncated&&(0,X.jsx)("p",{className:"so-team-small",children:"Showing the most recent messages."})]}),U(null),(0,X.jsx)("div",{ref:A}),(0,X.jsxs)(eo,{summary:"Conversations",className:"so-team-settings",children:[s&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("nav",{className:"so-team-room-list","aria-label":"Other conversations",children:o.conversations.filter(M=>M.id!==s.id).map(M=>(0,X.jsx)("a",{href:"/chat?conversation="+encodeURIComponent(M.id),children:M.title},M.id))}),(0,X.jsx)("h3",{children:"New conversation"}),ne]}),(0,X.jsx)("a",{href:"/chat?private=1",children:"Previous private chat"}),o.canManage&&D&&(0,X.jsx)(eo,{summary:"Lead settings",children:(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{M.preventDefault();let se=new FormData(M.currentTarget);W("update-lead",{leadId:D.id,expectedRevision:D.revision,name:se.get("name"),instructions:se.get("instructions"),status:se.get("status")})},children:[(0,X.jsxs)("label",{children:["Lead name",(0,X.jsx)(Di,{name:"name",defaultValue:D.name,required:!0,maxLength:100})]}),(0,X.jsxs)("label",{children:["Working instructions",(0,X.jsx)(Ss,{name:"instructions",defaultValue:D.instructions,rows:4})]}),(0,X.jsxs)("label",{children:["Status",(0,X.jsxs)("select",{name:"status",defaultValue:D.status,children:[(0,X.jsx)("option",{value:"active",children:"Active"}),(0,X.jsx)("option",{value:"paused",children:"Paused"})]})]}),(0,X.jsxs)("p",{className:"so-team-small",children:["Projects: ",D.projects.map(M=>M.split("/").pop()).join(", ")]}),(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Save lead"})]})}),re&&o.leads.length>0&&(0,X.jsx)(eo,{summary:"Add a lead",children:(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{de(M,"create-lead")},children:[(0,X.jsxs)("label",{children:["Lead name",(0,X.jsx)(Di,{name:"name",required:!0,maxLength:100})]}),(0,X.jsx)(Qb,{projects:o.projects}),(0,X.jsxs)("label",{children:["Working instructions",(0,X.jsx)(Ss,{name:"instructions",rows:3})]}),(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Create lead"})]})})]})]}),s&&(0,X.jsxs)("div",{className:"so-team-composer",children:[(0,X.jsx)(ZU,{snapshot:o,execute:W,busy:g}),o.canSend&&!v?(0,X.jsxs)("form",{onSubmit:M=>{ee(M)},children:[(0,X.jsxs)(_i,{htmlFor:"team-message",className:"so-sr-only",children:["Message ",D?.name??"the lead"]}),(0,X.jsx)(Ss,{id:"team-message",rows:3,value:l.text,placeholder:"Message "+(D?.name??"your lead"),onChange:M=>_({text:M.target.value,requestId:l.uncertain?crypto.randomUUID():l.requestId,uncertain:!1}),disabled:g||l.uncertain,maxLength:2e3}),(0,X.jsxs)("div",{className:"so-team-compose-actions",children:[o.messages.some(M=>M.status==="running")&&(0,X.jsx)(_e,{variant:"secondary",onClick:()=>{W("stop",{conversationId:s.id,messageId:o.messages.find(M=>M.status==="running")?.id})},disabled:g,children:"Stop"}),l.uncertain?(0,X.jsx)(_e,{onClick:()=>{q().then(()=>{L.current.draft.uncertain&&(I(!0),u("This message is not in saved history. You can send the saved message with its original request identity."))}).catch(()=>u("Saved messages could not be checked. Your draft is preserved."))},children:"Check messages"}):(0,X.jsx)(_e,{type:"submit",disabled:g||!l.text.trim()||!o.chatAuthorization?.enabled,children:g?"Saving…":"Send"}),l.uncertain&&C&&(0,X.jsx)(_e,{disabled:g,onClick:()=>{W("send",{conversationId:s.id,text:l.text,requestId:l.requestId}).then(M=>{M&&_(Dg())})},children:"Send saved message"})]})]}):!v&&(0,X.jsx)("p",{className:"so-team-small",children:"You can read this conversation. Ask a manager for permission to send messages."}),w&&(0,X.jsx)(fn,{children:"Keep this tab open until your message is sent; draft storage is unavailable."})]})]})}function ZU({snapshot:e,execute:t,busy:a}){let n=e.chatAuthorization;return!e.selected||!n||!e.canSend?null:n.waitingReason?(0,X.jsx)(fn,{children:n.waitingReason}):n.enabled?null:(0,X.jsxs)("div",{className:"so-team-consent",children:[(0,X.jsxs)("p",{children:["Enable ",n.provider," · ",n.model," for your messages in this conversation, using the installation’s configured provider account."]}),(0,X.jsxs)("p",{children:[n.dailyTurns," turns per day",n.weeklyCeilingUsd===null?". Your provider subscription limits apply.":`, $${n.weeklyCeilingUsd} per week and $${n.conversationCeilingUsd} for this conversation.`," Execution approvals still apply."]}),(0,X.jsx)(_e,{disabled:a,onClick:()=>{t("authorize",{conversationId:e.selected.id,termsDigest:n.termsDigest,ceilingUsd:n.conversationCeilingUsd})},children:"Enable chat"})]})}var cl=j(he(),1);var Ya=j(fe(),1),Jb=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function QU(e){return!Jb(e)||!Array.isArray(e.steps)?null:{steps:e.steps.flatMap((a,n)=>!Jb(a)||!Array.isArray(a.tools)||typeof a.text!="string"?[]:[{tools:a.tools.flatMap((r,s)=>{if(typeof r!="string")return[];let i=Array.isArray(a.toolCalls)?a.toolCalls[s]:null;if(Jb(i)&&typeof i.id=="string"&&i.label===r){if(i.state==="succeeded"||i.state==="running")return[{id:i.id,label:r,state:i.state}];if(i.state==="failed"&&typeof i.reason=="string"&&i.reason.trim()!=="")return[{id:i.id,label:r,state:"failed",reason:i.reason}]}return[{id:`unknown:${n}:${s}`,label:r,state:"unknown"}]}),text:a.text}]),done:e.done===!0}}function ew(e,t,a){let[n,o]=(0,cl.useState)(null),r=(0,cl.useRef)(a);r.current=a;let s=(0,cl.useRef)(t);return s.current=t,(0,cl.useEffect)(()=>{o(null)},[e?.sessionId,e?.taskId,e?.project,t]),jo(e===null?null:qu("chat",null,e.taskId?{task:e.taskId}:{project:e.project??null}),(i,l)=>{if(!s.current)return;if(i==="lost"){o(f=>f===null?null:{...f,disconnected:!0});return}if(i!=="turn")return;let c=QU(l);c!==null&&(o(c),c.done&&r.current())}),t?n:null}function tw({live:e,leadName:t}){let a=e?.steps??[],n=!e?.done&&!e?.disconnected,o=a.flatMap(i=>i.tools),r=[...a].reverse().find(i=>i.text.trim()!=="")?.text??"",s=n&&a.length>0&&a.at(-1).text.trim()!=="";return(0,Ya.jsxs)(Hh,{from:"assistant",className:"so-live-reply","data-live-reply":!0,children:[(0,Ya.jsx)("div",{className:"so-message-label",children:t}),(0,Ya.jsxs)(jd,{children:[o.length>0&&(0,Ya.jsx)("ul",{className:"so-live-steps","aria-label":"Tool steps",children:o.map(i=>{let l=i.state==="running"&&!n?"unknown":i.state,c=l==="succeeded"?"Done":l==="failed"?"Failed":l==="running"?"Running":"Outcome not reported";return(0,Ya.jsx)("li",{"data-state":l,"data-done":l==="succeeded"?"true":"false",children:(0,Ya.jsxs)("div",{children:[(0,Ya.jsx)("span",{children:i.label}),(0,Ya.jsxs)("span",{className:"so-tool-status",children:[" · ",c]}),i.state==="failed"&&(0,Ya.jsx)("p",{className:"so-tool-reason",children:i.reason})]})},i.id)})}),r!==""&&(0,Ya.jsxs)("p",{className:"so-live-text",children:[r,s&&(0,Ya.jsx)("span",{className:"so-live-caret","aria-hidden":"true"})]}),n&&(s||!o.some(i=>i.state==="running"))&&(0,Ya.jsxs)("div",{className:"so-working",role:"status",children:[(0,Ya.jsx)("span",{className:"so-live-dot"}),s?"Writing…":"Thinking…"]})]})]})}var qM={task:{label:"Open task",target:"task"},approval:{label:"Review & start",target:"task"},planning:{label:"Approve plan",target:"task"},recovery:{label:"Review recovery options",target:"task"},cancel:{label:"Cancel task",target:"task"},result:{label:"Open result",target:"task"},acceptance:{label:"Inspect result",target:"task"},publish:{label:"Review publication",target:"task"},projects:{label:"Manage projects",href:"/projects"},code:{label:"Open coding workspace",href:"/code"},flows:{label:"Open flows",href:"/flows"},recipes:{label:"Browse workflows",href:"/recipes"},workers:{label:"Manage workers",href:"/fleet"},slack:{label:"Manage Slack",href:"/settings/slack"},discord:{label:"Manage Discord",href:"/settings/discord"},lead:{label:"Name your lead",href:"/settings/lead"},integrations:{label:"Set up integrations",href:"/settings/integrations"},settings:{label:"Open settings",href:"/settings"},permissions:{label:"Review permissions",href:"/settings"},providers:{label:"Connect an agent",href:"/settings#providers"},skills:{label:"Manage skills",href:"/settings/skills"},tools:{label:"Manage tools",href:"/settings/tools"},knowledge:{label:"Edit project knowledge",href:"/settings/knowledge"},learning:{label:"Review learning history",href:"/settings/learning"},mode:{label:"Review automatic approvals",href:"/mode"},policy:{label:"Review organisation policy",href:"/settings/policy"}};function _g(e,t,a="summary"){return`/chat?task=${encodeURIComponent(e)}&result=${t}${a==="summary"?"":`&tab=${a}`}`}function UM(e,t,a,n){let o=qM[e];if(e==="skills"||e==="tools")return qM[e].href+(typeof n=="string"&&n?"?repo="+encodeURIComponent(n):"");if("href"in o)return o.href;if(e==="acceptance")return`/review?result=${encodeURIComponent(t)}&run=${Number.isSafeInteger(a)&&Number(a)>0?a:0}&tab=checks`;if(e==="result"&&Number.isSafeInteger(a)&&Number(a)>0)return _g(t,Number(a));let r="/chat?task="+encodeURIComponent(t);return e==="cancel"||e==="recovery"||e==="publish"?"/t/"+encodeURIComponent(t):r+(e==="approval"||e==="planning"?"#task-chat-action":"")}function JU(e){let t=e.primaryAction;if(t===null)return null;let{taskId:a,runId:n,decisionId:o}=t.target;if(o!==null)return`/d/${o}`;if(t.code==="inspect-decisions")return"/";if(t.code==="sign-in")return"/settings#providers";if(t.code==="confirm-stopped")return`/t/${encodeURIComponent(e.rootId)}#confirm-stopped`;if(t.code==="open-result"&&n!==null)return _g(a,n);if(t.code==="open-pr"&&/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/\d+$/.test(e.publicationUrl??""))return e.publicationUrl;if(n!==null&&(t.code==="open-pr"||t.code==="retry-review"))return`/review?result=${encodeURIComponent(a)}&run=${n}`;if(n!==null&&(t.code==="inspect-run"||t.code==="reconcile-run"))return`/r/${n}`;let r=t.code==="approve-scope"?"#approve":t.code==="inspect-stop"||t.code==="resume-run"?"#task-control":t.code==="unhold"?"#task-actions":t.code==="write-scope"||t.code==="select-agent"?"#scope":t.code==="inspect-hold"?"#holds":t.code==="start-worker"||t.code==="repair-dependency"?"#run-status":"";return`/t/${encodeURIComponent(e.rootId)}?version=${encodeURIComponent(a)}`+r}function VM(e,t){let a=o=>t&&o.startsWith("/chat?")?o+"&conversation="+encodeURIComponent(t):o,n=e.items.map(o=>{let r=o.status,s=m=>m.trim().replace(/\s+/g," ").replace(/[.!?]+$/,"").toLowerCase(),i=["Waiting","Failed","Needs you"].includes(r.label)&&s(r.detail)!==""&&s(r.detail)!==s(r.label)?r.detail:void 0,l=o.resultRunId===null||o.resultTaskId===null||o.resultOutcome!=="built"&&o.resultOutcome!=="no-change"?null:_g(o.resultTaskId,o.resultRunId),c=UM("task",o.rootId),f=o.primaryAction,u=JU(o);return{item:{id:o.rootId,title:o.title,project:o.repo,state:o.assignmentState,label:r.label,tone:r.tone,href:a(c),resultHref:l===null?null:a(l),action:f===null||u===null?null:{label:f.label,href:a(u)},updatedAt:o.updatedAt,...i===void 0?{}:{detail:i},...o.lead===void 0?{}:{lead:o.lead}},rank:r.rank}});return n.sort((o,r)=>o.rank-r.rank),{crew:n.map(o=>o.item),crewTruncated:e.nextCursor!==null}}var ep=j(he(),1);var Ce=j(fe(),1);function Jf({command:e}){let[t,a]=(0,ep.useState)(!1);return(0,Ce.jsxs)("span",{className:"so-first-run-command",children:[(0,Ce.jsx)("code",{children:e}),(0,Ce.jsx)(_e,{variant:"ghost",size:"sm",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{a(!0),window.setTimeout(()=>a(!1),1500)},()=>{})},"aria-label":`Copy ${e}`,children:t?"Copied":"Copy"})]})}function GM(e,t){return e.trim()===""?t:e.includes(t)?e:`${e.trimEnd()}
|
|
50
|
+
`)},Az=0,zu=[];function n4(e){var t=vt.useRef([]),a=vt.useRef([0,0]),n=vt.useRef(),o=vt.useState(Az++)[0],r=vt.useState(Ud)[0],s=vt.useRef(e);vt.useEffect(function(){s.current=e},[e]),vt.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=qI([e.lockRef.current],(e.shards||[]).map(a4),!0).filter(Boolean);return b.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var i=vt.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!s.current.allowPinchZoom;var x=_h(b),y=a.current,h="deltaX"in b?b.deltaX:y[0]-x[0],w="deltaY"in b?b.deltaY:y[1]-x[1],S,C=b.target,I=Math.abs(h)>Math.abs(w)?"h":"v";if("touches"in b&&I==="h"&&C.type==="range")return!1;var L=window.getSelection(),T=L&&L.anchorNode,A=T?T===C||T.contains(C):!1;if(A)return!1;var D=P1(I,C);if(!D)return!0;if(D?S=I:(S=I==="v"?"h":"v",D=P1(I,C)),!D)return!1;if(!n.current&&"changedTouches"in b&&(h||w)&&(n.current=S),!S)return!0;var H=n.current||S;return e4(H,v,b,H==="h"?h:w,!0)},[]),l=vt.useCallback(function(b){var v=b;if(!(!zu.length||zu[zu.length-1]!==r)){var x="deltaY"in v?t4(v):_h(v),y=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&Mz(S.delta,x)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var h=(s.current.shards||[]).map(a4).filter(Boolean).filter(function(S){return S.contains(v.target)}),w=h.length>0?i(v,h[0]):!s.current.noIsolation;w&&v.cancelable&&v.preventDefault()}}},[]),c=vt.useCallback(function(b,v,x,y){var h={name:b,delta:v,target:x,should:y,shadowParent:Dz(x)};t.current.push(h),setTimeout(function(){t.current=t.current.filter(function(w){return w!==h})},1)},[]),f=vt.useCallback(function(b){a.current=_h(b),n.current=void 0},[]),u=vt.useCallback(function(b){c(b.type,t4(b),b.target,i(b,e.lockRef.current))},[]),d=vt.useCallback(function(b){c(b.type,_h(b),b.target,i(b,e.lockRef.current))},[]);vt.useEffect(function(){return zu.push(r),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:d}),document.addEventListener("wheel",l,Ei),document.addEventListener("touchmove",l,Ei),document.addEventListener("touchstart",f,Ei),function(){zu=zu.filter(function(b){return b!==r}),document.removeEventListener("wheel",l,Ei),document.removeEventListener("touchmove",l,Ei),document.removeEventListener("touchstart",f,Ei)}},[]);var m=e.removeScrollBar,g=e.inert;return vt.createElement(vt.Fragment,null,g?vt.createElement(r,{styles:Ez(o)}):null,m?vt.createElement(D1,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Dz(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var o4=N1(Dh,n4);var r4=Ph.forwardRef(function(e,t){return Ph.createElement(qd,dn({},e,{ref:t,sideCar:o4}))});r4.classNames=qd.classNames;var Ai=r4;var _z=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Bu=new WeakMap,Oh=new WeakMap,zh={},O1=0,s4=function(e){return e&&(e.host||s4(e.parentNode))},Pz=function(e,t){return t.map(function(a){if(e.contains(a))return a;var n=s4(a);return n&&e.contains(n)?n:(console.error("aria-hidden",a,"in not contained inside",e,". Doing nothing"),null)}).filter(function(a){return!!a})},Oz=function(e,t,a,n){var o=Pz(t,Array.isArray(e)?e:[e]);zh[a]||(zh[a]=new WeakMap);var r=zh[a],s=[],i=new Set,l=new Set(o),c=function(u){!u||i.has(u)||(i.add(u),c(u.parentNode))};o.forEach(c);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(d){if(i.has(d))f(d);else try{var m=d.getAttribute(n),g=m!==null&&m!=="false",b=(Bu.get(d)||0)+1,v=(r.get(d)||0)+1;Bu.set(d,b),r.set(d,v),s.push(d),b===1&&g&&Oh.set(d,!0),v===1&&d.setAttribute(a,"true"),g||d.setAttribute(n,"true")}catch(x){console.error("aria-hidden: cannot operate on ",d,x)}})};return f(t),i.clear(),O1++,function(){s.forEach(function(u){var d=Bu.get(u)-1,m=r.get(u)-1;Bu.set(u,d),r.set(u,m),d||(Oh.has(u)||u.removeAttribute(n),Oh.delete(u)),m||u.removeAttribute(a)}),O1--,O1||(Bu=new WeakMap,Bu=new WeakMap,Oh=new WeakMap,zh={})}},Fu=function(e,t,a){a===void 0&&(a="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),o=t||_z(e);return o?(n.push.apply(n,Array.from(o.querySelectorAll("[aria-live], script"))),Oz(n,o,a,"aria-hidden")):function(){return null}};var It=j(fe(),1),zz=Object.defineProperty,Dn=(e,t)=>zz(e,"name",{value:t,configurable:!0}),B1="Dialog",[i4,$Q]=xt(B1),[Bz,vo]=i4(B1),l4=Dn(e=>{let{__scopeDialog:t,children:a,open:n,defaultOpen:o,onOpenChange:r,modal:s=!0}=e,i=ht.useRef(null),l=ht.useRef(null),[c,f]=Ma({prop:n,defaultProp:o??!1,onChange:r,caller:B1}),[u,d]=ht.useState(0),[m,g]=ht.useState(0);return(0,It.jsx)(Bz,{scope:t,triggerRef:i,contentRef:l,contentId:Ga(),titleId:Ga(),descriptionId:Ga(),titlePresent:u>0,descriptionPresent:m>0,setTitleCount:d,setDescriptionCount:g,open:c,onOpenChange:f,onOpenToggle:ht.useCallback(()=>f(b=>!b),[f]),modal:s,children:a})},"Dialog"),Fz="DialogTrigger",u4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(Fz,n),s=Te(a,r.triggerRef);return(0,It.jsx)(Re.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":Bh(r.open),...o,ref:s,onClick:ke(t.onClick,r.onOpenToggle)})},"DialogTrigger")),c4="DialogPortal",[Hz,d4]=i4(c4,{forceMount:void 0}),f4=Dn(e=>{let{__scopeDialog:t,forceMount:a,children:n,container:o}=e,r=vo(c4,t);return(0,It.jsx)(Hz,{scope:t,forceMount:a,children:ht.Children.map(n,s=>(0,It.jsx)(An,{present:a||r.open,children:(0,It.jsx)(Au,{asChild:!0,container:o,children:s})}))})},"DialogPortal"),z1="DialogOverlay",p4=ht.forwardRef(Dn(function(t,a){let n=d4(z1,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,s=vo(z1,t.__scopeDialog);return s.modal?(0,It.jsx)(An,{present:o||s.open,children:(0,It.jsx)(Uz,{...r,ref:a})}):null},"DialogOverlay")),qz=Ea("DialogOverlay.RemoveScroll"),Uz=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(z1,n),s=p1(),i=Te(a,s);return(0,It.jsx)(Ai,{as:qz,allowPinchZoom:!0,shards:[r.contentRef],children:(0,It.jsx)(Re.div,{"data-state":Bh(r.open),...o,ref:i,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),Gd="DialogContent",m4=ht.forwardRef(Dn(function(t,a){let n=d4(Gd,t.__scopeDialog),{forceMount:o=n.forceMount,...r}=t,s=vo(Gd,t.__scopeDialog);return(0,It.jsx)(An,{present:o||s.open,children:s.modal?(0,It.jsx)(Vz,{...r,ref:a}):(0,It.jsx)(Gz,{...r,ref:a})})},"DialogContent")),Vz=ht.forwardRef(Dn(function(t,a){let n=vo(Gd,t.__scopeDialog),o=ht.useRef(null),r=Te(a,n.contentRef,o);return ht.useEffect(()=>{let s=o.current;if(s)return Fu(s)},[]),(0,It.jsx)(h4,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:ke(t.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ke(t.onPointerDownOutside,s=>{let i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ke(t.onFocusOutside,s=>s.preventDefault())})},"DialogContentModal")),Gz=ht.forwardRef(Dn(function(t,a){let n=vo(Gd,t.__scopeDialog),o=ht.useRef(!1),r=ht.useRef(!1);return(0,It.jsx)(h4,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{t.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||n.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{t.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));let i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})},"DialogContentNonModal")),h4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...i}=t,l=vo(Gd,n);return ws(),(0,It.jsx)(It.Fragment,{children:(0,It.jsx)(Eu,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:s,children:(0,It.jsx)(Mu,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionPresent?l.descriptionId:void 0,"aria-labelledby":l.titlePresent?l.titleId:void 0,"data-state":Bh(l.open),...i,ref:a,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})},"DialogContentImpl")),$z="DialogTitle",g4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo($z,n),{setTitleCount:s}=r;return Ze(()=>(s(i=>i+1),()=>s(i=>i-1)),[s]),(0,It.jsx)(Re.h2,{id:r.titleId,...o,ref:a})},"DialogTitle")),jz="DialogDescription",x4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(jz,n),{setDescriptionCount:s}=r;return Ze(()=>(s(i=>i+1),()=>s(i=>i-1)),[s]),(0,It.jsx)(Re.p,{id:r.descriptionId,...o,ref:a})},"DialogDescription")),Wz="DialogClose",v4=ht.forwardRef(Dn(function(t,a){let{__scopeDialog:n,...o}=t,r=vo(Wz,n);return(0,It.jsx)(Re.button,{type:"button",...o,ref:a,onClick:ke(t.onClick,()=>r.onOpenChange(!1))})},"DialogClose"));function Bh(e){return e?"open":"closed"}Dn(Bh,"getState");var Da=j(fe(),1);function Ot(...e){return e.filter(Boolean).join(" ")}function _e({className:e,variant:t="primary",size:a="default",asChild:n=!1,type:o,...r}){return(0,Da.jsx)(n?Nh:"button",{"data-slot":"button","data-variant":t,"data-size":a,className:Ot("ui-button",`ui-button--${t}`,`ui-button--${a}`,e),...n?{}:{type:o??"button"},...r})}function F1({className:e,tone:t="neutral",...a}){return(0,Da.jsx)("span",{"data-slot":"badge","data-tone":t,className:Ot("ui-badge",`ui-badge--${t}`,e),...a})}function Di({className:e,...t}){return(0,Da.jsx)("input",{className:Ot("ui-input",e),...t})}function Ss({className:e,...t}){return(0,Da.jsx)("textarea",{className:Ot("ui-textarea",e),...t})}function _i({className:e,...t}){return(0,Da.jsx)("label",{className:Ot("ui-label",e),...t})}function eo({summary:e,className:t,children:a,...n}){return(0,Da.jsxs)("details",{className:Ot("ui-disclosure",t),...n,children:[(0,Da.jsx)("summary",{className:"ui-disclosure-trigger",children:e}),(0,Da.jsx)("div",{className:"ui-disclosure-content",children:a})]})}function fn({className:e,tone:t="info",...a}){return(0,Da.jsx)("div",{role:t==="error"?"alert":"status","data-tone":t,className:Ot("ui-alert",`ui-alert--${t}`,e),...a})}var H1=l4,q1=u4,U1=v4;function V1({className:e,children:t,...a}){return(0,Da.jsxs)(f4,{children:[(0,Da.jsx)(p4,{className:"ui-dialog-overlay"}),(0,Da.jsx)(m4,{className:Ot("ui-dialog-content",e),...a,children:t})]})}function G1({className:e,...t}){return(0,Da.jsx)(g4,{className:Ot("ui-dialog-title",e),...t})}function $1({className:e,...t}){return(0,Da.jsx)(x4,{className:Ot("ui-dialog-description",e),...t})}var ba=j(he(),1);var Yz={damping:.7,stiffness:.05,mass:1.25},Kz=70,Zz=1e3/60,Qz=350,Fh=!1;globalThis.document?.addEventListener("mousedown",()=>{Fh=!0});globalThis.document?.addEventListener("mouseup",()=>{Fh=!1});globalThis.document?.addEventListener("click",()=>{Fh=!1});var b4=(e={})=>{let[t,a]=(0,ba.useState)(!1),[n,o]=(0,ba.useState)(e.initial!==!1),[r,s]=(0,ba.useState)(!1),i=(0,ba.useRef)(null);i.current=e;let l=(0,ba.useCallback)(()=>{if(!Fh)return!1;let y=window.getSelection();if(!y||!y.rangeCount)return!1;let h=y.getRangeAt(0);return h.commonAncestorContainer.contains(v.current)||v.current?.contains(h.commonAncestorContainer)},[]),c=(0,ba.useCallback)(y=>{u.isAtBottom=y,o(y)},[]),f=(0,ba.useCallback)(y=>{u.escapedFromLock=y,a(y)},[]),u=(0,ba.useMemo)(()=>{let y;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return v.current?.scrollTop??0},set scrollTop(h){if(v.current){let{scrollBehavior:w}=getComputedStyle(v.current);w!=="auto"&&(v.current.style.scrollBehavior="auto"),v.current.scrollTop=h,u.ignoreScrollToTop=v.current.scrollTop,w!=="auto"&&(v.current.style.scrollBehavior=w)}},get targetScrollTop(){return!v.current||!x.current?0:v.current.scrollHeight-1-v.current.clientHeight},get calculatedTargetScrollTop(){if(!v.current||!x.current)return 0;let{targetScrollTop:h}=this;if(!e.targetScrollTop)return h;if(y?.targetScrollTop===h)return y.calculatedScrollTop;let w=Math.max(Math.min(e.targetScrollTop(h,{scrollElement:v.current,contentElement:x.current}),h),0);return y={targetScrollTop:h,calculatedScrollTop:w},requestAnimationFrame(()=>{y=void 0}),w},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Kz}}},[]),d=(0,ba.useCallback)((y={})=>{typeof y=="string"&&(y={animation:y}),y.preserveScrollPosition||c(!0);let h=Date.now()+(Number(y.wait)||0),w=W1(i.current,y.animation),{ignoreEscapes:S=!1}=y,C,I=u.calculatedTargetScrollTop;y.duration instanceof Promise?y.duration.finally(()=>{C=Date.now()}):C=h+(y.duration??0);let L=async()=>{let T=new Promise(requestAnimationFrame).then(()=>{if(!u.isAtBottom)return u.animation=void 0,!1;let{scrollTop:A}=u,D=performance.now(),H=(D-(u.lastTick??D))/Zz;if(u.animation||(u.animation={behavior:w,promise:T,ignoreEscapes:S}),u.animation.behavior===w&&(u.lastTick=D),l()||h>Date.now())return L();if(A<Math.min(I,u.calculatedTargetScrollTop)){if(u.animation?.behavior===w){if(w==="instant")return u.scrollTop=u.calculatedTargetScrollTop,L();u.velocity=(w.damping*u.velocity+w.stiffness*u.scrollDifference)/w.mass,u.accumulated+=u.velocity*H,u.scrollTop+=u.accumulated,u.scrollTop!==A&&(u.accumulated=0)}return L()}return C>Date.now()?(I=u.calculatedTargetScrollTop,L()):(u.animation=void 0,u.scrollTop<u.calculatedTargetScrollTop?d({animation:W1(i.current,i.current.resize),ignoreEscapes:S,duration:Math.max(0,C-Date.now())||void 0}):u.isAtBottom)});return T.then(A=>(requestAnimationFrame(()=>{u.animation||(u.lastTick=void 0,u.velocity=0)}),A))};return y.wait!==!0&&(u.animation=void 0),u.animation?.behavior===w?u.animation.promise:L()},[c,l,u]),m=(0,ba.useCallback)(()=>{f(!0),c(!1)},[f,c]),g=(0,ba.useCallback)(({target:y})=>{if(y!==v.current)return;let{scrollTop:h,ignoreScrollToTop:w}=u,{lastScrollTop:S=h}=u;u.lastScrollTop=h,u.ignoreScrollToTop=void 0,w&&w>h&&(S=w),s(u.isNearBottom),setTimeout(()=>{if(u.resizeDifference||h===w)return;if(l()){f(!0),c(!1);return}let C=h>S,I=h<S;if(u.animation?.ignoreEscapes){u.scrollTop=S;return}I&&(f(!0),c(!1)),C&&f(!1),!u.escapedFromLock&&u.isNearBottom&&c(!0)},1)},[f,c,l,u]),b=(0,ba.useCallback)(({target:y,deltaY:h})=>{let w=y;for(;!["scroll","auto"].includes(getComputedStyle(w).overflow);){if(!w.parentElement)return;w=w.parentElement}w===v.current&&h<0&&v.current.scrollHeight>v.current.clientHeight&&!u.animation?.ignoreEscapes&&(f(!0),c(!1))},[f,c,u]),v=y4(y=>{v.current?.removeEventListener("scroll",g),v.current?.removeEventListener("wheel",b),y?.addEventListener("scroll",g,{passive:!0}),y?.addEventListener("wheel",b,{passive:!0})},[]),x=y4(y=>{if(u.resizeObserver?.disconnect(),u.resizeObserver=void 0,!y)return;let h;u.resizeObserver=new ResizeObserver(([w])=>{let{height:S}=w.contentRect,C=S-(h??S);if(u.resizeDifference=C,u.scrollTop>u.targetScrollTop&&(u.scrollTop=u.targetScrollTop),s(u.isNearBottom),C>=0){let I=W1(i.current,h?i.current.resize:i.current.initial);d({animation:I,wait:!0,preserveScrollPosition:!0,duration:I==="instant"?void 0:Qz})}else u.isNearBottom&&(f(!1),c(!0));h=S,requestAnimationFrame(()=>{setTimeout(()=>{u.resizeDifference===C&&(u.resizeDifference=0)},1)})}),u.resizeObserver?.observe(y)},[]);return{contentRef:x,scrollRef:v,scrollToBottom:d,stopScroll:m,isAtBottom:n||r,isNearBottom:r,escapedFromLock:t,state:u}};function y4(e,t){let a=(0,ba.useCallback)(n=>(a.current=n,e(n)),t);return a}var j1=new Map;function W1(...e){let t={...Yz},a=!1;for(let o of e){if(o==="instant"){a=!0;continue}typeof o=="object"&&(a=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}let n=JSON.stringify(t);return j1.has(n)||j1.set(n,Object.freeze(t)),a?"instant":j1.get(n)}var Pi=j(he(),1),pn=j(he(),1);var w4=(0,pn.createContext)(null),Jz=typeof window<"u"?pn.useLayoutEffect:pn.useEffect;function $d({instance:e,children:t,resize:a,initial:n,mass:o,damping:r,stiffness:s,targetScrollTop:i,contextRef:l,...c}){let f=(0,pn.useRef)(null),u=Pi.useCallback((S,C)=>(w?.targetScrollTop??i)?.(S,C)??S,[i]),d=b4({mass:o,damping:r,stiffness:s,resize:a,initial:n,targetScrollTop:u}),{scrollRef:m,contentRef:g,scrollToBottom:b,stopScroll:v,isAtBottom:x,escapedFromLock:y,state:h}=e??d,w=(0,pn.useMemo)(()=>({scrollToBottom:b,stopScroll:v,scrollRef:m,isAtBottom:x,escapedFromLock:y,contentRef:g,state:h,get targetScrollTop(){return f.current},set targetScrollTop(S){f.current=S}}),[b,x,g,m,v,y,h]);return(0,pn.useImperativeHandle)(l,()=>w,[w]),Jz(()=>{m.current&&getComputedStyle(m.current).overflow==="visible"&&(m.current.style.overflow="auto")},[]),Pi.createElement(w4.Provider,{value:w},Pi.createElement("div",{...c},typeof t=="function"?t(w):t))}(function(e){function t({children:a,scrollClassName:n,...o}){let r=X1();return Pi.createElement("div",{ref:r.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:n},Pi.createElement("div",{...o,ref:r.contentRef},typeof a=="function"?a(r):a))}e.Content=t})($d||($d={}));function X1(){let e=(0,pn.useContext)(w4);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}var _n=j(fe(),1);function S4({className:e,...t}){return(0,_n.jsx)($d,{className:Ot("ui-conversation",e),initial:"instant",resize:"instant",role:"log","aria-label":"Conversation",...t})}function C4({className:e,...t}){return(0,_n.jsx)($d.Content,{className:Ot("ui-conversation-content",e),...t})}function k4({className:e,children:t,onClick:a,...n}){let{isAtBottom:o,scrollToBottom:r}=X1();return o?null:(0,_n.jsx)(_e,{className:Ot("ui-conversation-scroll",e),variant:"secondary",size:"sm",onClick:s=>{a?.(s),s.defaultPrevented||r({animation:"instant"})},...n,children:t??"Latest message"})}function L4({className:e,title:t="Start a conversation",description:a,children:n,...o}){return(0,_n.jsx)("div",{className:Ot("ui-conversation-empty",e),...o,children:n??(0,_n.jsxs)(_n.Fragment,{children:[(0,_n.jsx)("h2",{children:t}),a&&(0,_n.jsx)("p",{children:a})]})})}function Hh({className:e,from:t,...a}){return(0,_n.jsx)("article",{className:Ot("ui-message",`ui-message--${t}`,e),"data-from":t,...a})}function jd({className:e,...t}){return(0,_n.jsx)("div",{className:Ot("ui-message-content",e),...t})}var Y1=j(he(),1);var K1=j(fe(),1);var tJ=(0,Y1.createContext)(null);function I4({className:e,...t}){return(0,K1.jsx)("section",{className:Ot("ui-artifact",e),...t})}function N4({className:e,...t}){return(0,K1.jsx)("div",{className:Ot("ui-artifact-content",e),...t})}var R4=j(fe(),1);var Hu=j(he(),1),qh=j(fe(),1),Z1=(0,Hu.createContext)(""),$e=(0,Hu.forwardRef)(function({children:t,...a},n){let o=(0,Hu.useContext)(Z1);return(0,qh.jsxs)("form",{ref:n,method:"post",...a,children:[(0,qh.jsx)("input",{type:"hidden",name:"csrf",value:o}),t]})});var Q1="standing-orders:workspace-draft:",M4="standing-orders:workspace-carry:",J1=/^[a-f0-9]{32}$/;function E4(){return Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,"0")).join("")}function Uh(e,t){return`${e}${encodeURIComponent(t.user)}:${e===Q1?`${t.session}:`:""}${encodeURIComponent(t.task??"")}`}function Vh(e,t=Date.now()){return{text:"",request:e,submitted:!1,pending:null,at:t}}function Nt(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function eB(e,t){return Nt(e)&&typeof e.request=="string"&&J1.test(e.request)&&typeof e.text=="string"&&e.text.length<=t}function A4(e,t,a,n,o=Date.now()){let r=Vh(a,o);try{let s=Uh(Q1,t),i=JSON.parse(e.getItem(s)??"null");if(Nt(i)&&i.user===t.user&&i.session===t.session&&i.task===t.task&&typeof i.at=="number"&&i.at>o-864e5&&i.at<=o&&typeof i.text=="string"&&i.text.length<=n&&typeof i.request=="string"&&J1.test(i.request)&&typeof i.submitted=="boolean"&&(i.pending===null||eB(i.pending,n)))return{text:i.text,request:i.request,submitted:i.submitted,pending:i.pending,at:i.at};e.removeItem(s);let l=Uh(M4,t),c=JSON.parse(e.getItem(l)??"null");if(e.removeItem(l),Nt(c)&&c.user===t.user&&c.task===t.task&&typeof c.at=="number"&&c.at>o-864e5&&c.at<=o&&typeof c.text=="string"&&c.text.length<=n)return{...r,text:c.text}}catch{}return r}function D4(e,t,a){try{let n=Uh(Q1,t);return a.text||a.pending?e.setItem(n,JSON.stringify({...t,...a})):e.removeItem(n),!0}catch{return!1}}function _4(e,t,a,n=Date.now()){try{return t.user&&a.trim()&&e.setItem(Uh(M4,t),JSON.stringify({user:t.user,task:t.task,text:a,at:n})),!0}catch{return!1}}function P4(e,t,a=E4,n=Date.now()){return{...e,text:t,request:e.submitted?a():e.request,submitted:!1,at:n}}function O4(e,t=Date.now()){return e.pending||!e.text.trim()?e:{...e,submitted:!0,pending:{request:e.request,text:e.text},at:t}}function z4(e,t,a,n=E4,o=Date.now()){return!t||!a?.received||a.request!==t||e.pending?.request!==t?e:e.submitted&&e.request===t&&e.text===e.pending.text?Vh(n(),o):{...e,pending:null,at:o}}function B4(e,t){return e.pending?.request===t?{...e,pending:null,submitted:!1}:e}function F4(e,t){return e.user===t.user&&e.conversation?.sessionId===t.conversation?.sessionId&&e.conversation?.taskId===t.conversation?.taskId&&e.conversation?.resultRunId===t.conversation?.resultRunId&&(e.conversation?.project??null)===(t.conversation?.project??null)}function tB(e){if(!e.startsWith("/")||e.startsWith("//"))throw new Error("Unexpected workspace address");return e}function aB(e){return Nt(e)&&(e.sandbox===null||typeof e.sandbox=="string")&&Array.isArray(e.steps)&&e.steps.every(t=>Nt(t)&&typeof t.key=="string"&&typeof t.title=="string"&&typeof t.done=="boolean"&&(t.action===null||Nt(t.action)&&(t.action.kind==="command"?typeof t.action.command=="string":t.action.kind==="link"&&typeof t.action.label=="string"&&typeof t.action.href=="string"&&t.action.href.startsWith("/"))))&&Array.isArray(e.suggestions)&&e.suggestions.every(t=>Nt(t)&&typeof t.label=="string"&&typeof t.draft=="string"&&typeof t.source=="string")}function eb(e){if(!Nt(e)||e.version!==1||typeof e.path!="string"||typeof e.title!="string"||typeof e.user!="string"||typeof e.csrf!="string"||typeof e.refreshUrl!="string"||typeof e.sensitive!="boolean"||typeof e.crewTruncated!="boolean"||typeof e.catchUpHtml!="string"||typeof e.controlsHtml!="string"||!Array.isArray(e.notices)||!e.notices.every(a=>typeof a=="string")||!(e.pageHtml===null||typeof e.pageHtml=="string")||!Array.isArray(e.navigation)||!e.navigation.every(a=>Nt(a)&&typeof a.label=="string"&&typeof a.href=="string"&&typeof a.active=="boolean"&&(a.count===void 0||typeof a.count=="number"))||e.view!==void 0&&e.view!==null&&!(Nt(e.view)&&typeof e.view.kind=="string")||e.signIn!==void 0&&!(Array.isArray(e.signIn)&&e.signIn.every(a=>Nt(a)&&[a.provider,a.title,a.command,a.detail,a.resumeLabel,a.resumeHref].every(n=>typeof n=="string")&&String(a.resumeHref).startsWith("/")))||e.firstRun!==void 0&&!aB(e.firstRun)||e.refreshSeconds!==void 0&&!(typeof e.refreshSeconds=="number"&&Number.isFinite(e.refreshSeconds)&&e.refreshSeconds>=5)||e.chats!==void 0&&!(Array.isArray(e.chats)&&e.chats.every(a=>Nt(a)&&(a.kind==="project"||a.kind==="task")&&typeof a.title=="string"&&typeof a.href=="string"&&a.href.startsWith("/")&&typeof a.active=="boolean"&&(a.at===null||typeof a.at=="string")))||!Array.isArray(e.projects)||!e.projects.every(a=>Nt(a)&&[a.name,a.path,a.href,a.knowledgeHref].every(n=>typeof n=="string"))||!Array.isArray(e.crew)||!e.crew.every(a=>Nt(a)&&[a.id,a.title,a.state,a.label,a.tone,a.href].every(n=>typeof n=="string")&&(a.project===null||typeof a.project=="string")&&(a.resultHref===null||typeof a.resultHref=="string")&&(a.action===null||Nt(a.action)&&typeof a.action.label=="string"&&typeof a.action.href=="string"))||!(e.focus===null||Nt(e.focus)&&typeof e.focus.id=="string"&&typeof e.focus.title=="string"&&typeof e.focus.html=="string")||!(e.result===null||Nt(e.result)&&typeof e.result.runId=="number"&&typeof e.result.html=="string")||!(e.receipt===null||Nt(e.receipt)&&typeof e.receipt.request=="string"&&typeof e.receipt.received=="boolean"))return!1;let t=e.conversation;return t===null||Nt(t)&&typeof t.sessionId=="number"&&typeof t.user=="string"&&typeof t.version=="string"&&typeof t.requestId=="string"&&J1.test(t.requestId)&&typeof t.maxChars=="number"&&t.maxChars>0&&(t.taskId===null||typeof t.taskId=="string")&&(t.resultRunId===null||typeof t.resultRunId=="number")&&(t.project===void 0||t.project===null||typeof t.project=="string")&&(t.pendingTurnId===null||typeof t.pendingTurnId=="number")&&Array.isArray(t.messages)&&t.messages.every(T4)&&(t.previous===void 0||t.previous===null||Nt(t.previous)&&Array.isArray(t.previous.messages)&&t.previous.messages.every(T4))}function T4(e){return Nt(e)&&typeof e.id=="number"&&(e.role==="operator"||e.role==="assistant")&&typeof e.text=="string"&&typeof e.html=="string"&&typeof e.cardsHtml=="string"&&typeof e.createdAt=="string"&&(e.activity===null||typeof e.activity=="string")&&(e.cards===void 0||Array.isArray(e.cards)&&e.cards.every(t=>Nt(t)&&typeof t.id=="number"&&typeof t.kind=="string"&&typeof t.label=="string"&&typeof t.state=="string"&&typeof t.body=="string"&&Array.isArray(t.links)&&typeof t.dismissable=="boolean"))}var Nr=class extends Error{};async function H4(e,t,a=fetch,n={}){let o=new URL(tB(e.refreshUrl),window.location.origin);o.searchParams.set("format","workspace"),t?o.searchParams.set("request",t):o.searchParams.delete("request");let r=t||n.force?null:n.etag,s=await a(o.pathname+o.search,{credentials:"same-origin",cache:"no-store",headers:{accept:"application/json",...r?{"if-none-match":r}:{}},signal:AbortSignal.timeout(12e3)});if(s.status===401||s.status===403||s.redirected)throw new Nr("Sign in again to reconnect. Your draft stays in this tab.");if(s.status===304){if(!r)throw new Error("The update was incomplete. Your current view is preserved.");return{kind:"unchanged",etag:s.headers.get("etag")??r}}if(!s.ok)throw new Error("Updates are unavailable. Your work is still saved.");let i=await s.json();if(!eb(i))throw new Error("The update was incomplete. Your current view is preserved.");return{kind:"changed",workspace:i,etag:s.headers.get("etag")}}async function q4(e,t,a=fetch,n=null){let o=e.conversation;if(!o)throw new Nr("Reconnect to the conversation before sending.");let r=new URLSearchParams({csrf:e.csrf,message:t.text,request:t.request,"request-session":String(o.sessionId)});n!==null&&o.taskId&&r.set("mode",n),o.taskId?r.set("task",o.taskId):o.project&&r.set("project",o.project),o.resultRunId!==null&&r.set("result",String(o.resultRunId));let s=await a("/chat",{method:"POST",credentials:"same-origin",body:r,headers:{accept:"application/json"},signal:AbortSignal.timeout(15e3)});if(s.status===401||s.status===403)throw new Nr("Sign in again to reconnect. Your draft stays in this tab.");if(s.headers.get("content-type")?.includes("application/json")){let i=await s.json();if(Nt(i)&&i.ok===!1)return{refused:!0,message:typeof i.said=="string"?i.said:"Message not sent. Your draft is saved."}}return{refused:!1,message:null}}var Rt=j(he(),1);var Gh=j(he(),1),nB="so:live",oB=["change","here","gone","turn"],rB=3e4,qu=(e,t,a)=>{let n=new URLSearchParams;for(let[r,s]of Object.entries(a??{}))s!=null&&s!==!1&&n.set(r,s===!0?"1":String(s));let o=n.toString();return`${e}${t==null?"":`:${encodeURIComponent(String(t))}`}${o===""?"":`?${o}`}`},tb=class{subscriptions=new Map;next=0;source=null;url="";scheduled=!1;watching=!1;subscribe(t,a){let n=this.next++;return this.subscriptions.set(n,{room:t,listener:a}),this.schedule(),()=>{this.subscriptions.delete(n),this.schedule()}}schedule(){this.scheduled||(this.scheduled=!0,queueMicrotask(()=>{this.scheduled=!1,this.reconcile()}))}wanted(){let t=[...new Set([...this.subscriptions.values()].map(a=>a.room))].sort();return t.length===0?"":`/live?${t.map(a=>`room=${encodeURIComponent(a)}`).join("&")}`}reconcile(){if(typeof EventSource>"u"||typeof document>"u")return;this.watching||(this.watching=!0,document.addEventListener("visibilitychange",()=>this.reconcile()),window.addEventListener("online",()=>this.reconcile()));let t=document.hidden?"":this.wanted();if(t===this.url&&(t===""||this.source!==null))return;if(this.source?.close(),this.source=null,this.url=t,t===""){delete document.documentElement.dataset.live;return}document.documentElement.dataset.live="1";let a=new EventSource(t);this.source=a;let n=(o,r)=>{let s={};try{let l=JSON.parse(r);l!==null&&typeof l=="object"&&!Array.isArray(l)&&(s=l)}catch{}let i=typeof s.room=="string"?s.room:null;for(let l of[...this.subscriptions.values()])(i===null||l.room===i)&&l.listener(o,s);window.dispatchEvent(new CustomEvent(nB,{detail:{room:i,event:o,data:s}}))};for(let o of oB)a.addEventListener(o,r=>n(o,r.data));a.addEventListener("reload",()=>n("reload","{}")),a.addEventListener("error",()=>{a.readyState!==EventSource.CLOSED||this.source!==a||(this.source=null,this.url="",n("lost","{}"),window.setTimeout(()=>this.reconcile(),rB))})}},sB=new tb;function jo(e,t){let a=(0,Gh.useRef)(t);a.current=t,(0,Gh.useEffect)(()=>{if(e!==null)return sB.subscribe(e,(n,o)=>a.current(n,o))},[e])}var $h=j(he(),1);var U4=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function V4(e,t,a=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:U4(e),size:24,node:t,...a.length>0?{aliases:a}:{}}}var G4=e=>{let t="",a=!1;for(let n of e){if(n==="-"||n==="_"||n<=" "){a=t.length>0;continue}t.length===0?t+=n.toLowerCase():t+=a?n.toUpperCase():n,a=!1}return t};var $4=e=>{let t=G4(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Xd=j(he(),1);var Wd=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var Cs={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function ab(e){return e!=null}function j4(e,t={}){let a=t.attributeNames??{},n=d=>a[d]??d,o=e.size??e.width??Cs.width,r=e.size??e.height??Cs.height,s=e.aliases?.filter(d=>typeof d=="string"&&d.trim()!=="").map(d=>`lucide-${d}`)??[],i=[...e.name?[`lucide-${e.name}`]:[],...s],l=t.className?.split(" ").filter(Boolean)??[],c=t.includeDefaultClasses===!1?Wd(...l):Wd("lucide",...i,...l),f=t.absoluteStrokeWidth?Number(t.strokeWidth??Cs["stroke-width"])*Number(e.size??e.width??Cs.width)/Number(t.size??t.width??Cs.width):t.strokeWidth??Cs["stroke-width"];return["svg",{...Object.entries(Cs).reduce((d,[m,g])=>(d[n(m)]=g,d),{}),..."color"in t&&t.color&&{[n("stroke")]:t.color},..."size"in t&&ab(t.size)&&{[n("width")]:t.size,[n("height")]:t.size},..."width"in t&&ab(t.width)&&{[n("width")]:t.width},..."height"in t&&ab(t.height)&&{[n("height")]:t.height},[n("stroke-width")]:f,...c&&{[n("class")]:c},[n("viewBox")]:`0 0 ${o} ${r}`,...t.hasA11yProp===!1?{[n("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(d=>{let[m,g,b]=d,v=t.nonScalingStroke?{[n("vector-effect")]:"non-scaling-stroke",...g}:g;return b?[m,v,b]:[m,v]})]}function W4(e,t={}){return j4(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var X4=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var Uu=j(he(),1);var iB=(0,Uu.createContext)({});var Y4=()=>(0,Uu.useContext)(iB);var K4=(0,Xd.forwardRef)(({color:e,size:t,width:a,height:n,strokeWidth:o,absoluteStrokeWidth:r,nonScalingStroke:s,className:i="",children:l,iconNode:c=[],icon:f={node:c,aliases:[],size:24},...u},d)=>{let{size:m=24,strokeWidth:g=2,absoluteStrokeWidth:b=!1,nonScalingStroke:v=!1,color:x="currentColor",className:y=""}=Y4()??{},h=!!l||X4(u),[w,S,C=[]]=W4(f,{color:e??x,width:a??t??m,height:n??t??m,strokeWidth:o??g,absoluteStrokeWidth:r??b,nonScalingStroke:s??v,className:Wd(y,i),hasA11yProp:h,attributes:u});return(0,Xd.createElement)(w,{ref:d,...S},[...C.map(([I,L])=>(0,Xd.createElement)(I,L)),...Array.isArray(l)?l:[l]])});function J(e,t=[],a=[]){let n=typeof e=="string"?V4(e,t,a):e,o=(0,$h.forwardRef)(({className:r,...s},i)=>(0,$h.createElement)(K4,{ref:i,icon:n,className:r,...s}));return n.name&&(o.displayName=$4(n.name)),o}var Z4={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};Z4.node;var Yd=J(Z4);var Q4={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};Q4.node;var ks=J(Q4);var J4={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};J4.node;var Kd=J(J4);var eN={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};eN.node;var Zd=J(eN);var tN={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};tN.node;var Oi=J(tN);var aN={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};aN.node;var zi=J(aN);var nN={name:"briefcase",size:24,node:[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]};nN.node;var Qd=J(nN);var oN={name:"calendar-clock",size:24,node:[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338",key:"7hb8p4"}],["path",{d:"M3 9h5.859",key:"numkqi"}],["path",{d:"M8 2v3",key:"1ioesn"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]};oN.node;var Jd=J(oN);var rN={name:"chart-line",size:24,node:[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]],aliases:["line-chart"]};rN.node;var Wo=J(rN);var sN={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};sN.node;var ja=J(sN);var iN={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};iN.node;var Xo=J(iN);var lN={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};lN.node;var sa=J(lN);var uN={name:"circle-dot",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};uN.node;var Bi=J(uN);var cN={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};cN.node;var Fi=J(cN);var dN={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};dN.node;var ef=J(dN);var fN={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};fN.node;var Ls=J(fN);var pN={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};pN.node;var tf=J(pN);var mN={name:"cpu",size:24,node:[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]};mN.node;var af=J(mN);var hN={name:"database",size:24,node:[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]};hN.node;var nf=J(hN);var gN={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]};gN.node;var Hi=J(gN);var xN={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};xN.node;var Yo=J(xN);var vN={name:"file-check",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]};vN.node;var of=J(vN);var yN={name:"file-plus-corner",size:24,node:[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],aliases:["file-plus-2"]};yN.node;var Is=J(yN);var bN={name:"flag",size:24,node:[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]};bN.node;var rf=J(bN);var wN={name:"folder-open",size:24,node:[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]};wN.node;var Vu=J(wN);var SN={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};SN.node;var sf=J(SN);var CN={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};CN.node;var lf=J(CN);var kN={name:"git-pull-request",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]};kN.node;var Ns=J(kN);var LN={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};LN.node;var uf=J(LN);var IN={name:"hammer",size:24,node:[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]]};IN.node;var cf=J(IN);var NN={name:"hard-drive",size:24,node:[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]]};NN.node;var df=J(NN);var RN={name:"hourglass",size:24,node:[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]};RN.node;var ff=J(RN);var TN={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};TN.node;var qi=J(TN);var MN={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};MN.node;var pf=J(MN);var EN={name:"layout-grid",size:24,node:[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]};EN.node;var mf=J(EN);var AN={name:"list-checks",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]};AN.node;var to=J(AN);var DN={name:"list-ordered",size:24,node:[["path",{d:"M11 5h10",key:"1cz7ny"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 19h10",key:"11t30w"}],["path",{d:"M4 4h1v5",key:"10yrso"}],["path",{d:"M4 9h2",key:"r1h2o0"}],["path",{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02",key:"xtkcd5"}]]};DN.node;var hf=J(DN);var _N={name:"list-todo",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]};_N.node;var gf=J(_N);var PN={name:"lock",size:24,node:[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]};PN.node;var xf=J(PN);var ON={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};ON.node;var Gu=J(ON);var zN={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};zN.node;var vf=J(zN);var BN={name:"message-circle-question-mark",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["message-circle-question"]};BN.node;var Rs=J(BN);var FN={name:"message-square-reply",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"m10 8-3 3 3 3",key:"fp6dz7"}],["path",{d:"M17 14v-1a2 2 0 0 0-2-2H7",key:"1tkjnz"}]]};FN.node;var yf=J(FN);var HN={name:"message-square",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]};HN.node;var Ts=J(HN);var qN={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]};qN.node;var bf=J(qN);var UN={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};UN.node;var wf=J(UN);var VN={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};VN.node;var $u=J(VN);var GN={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-3"]};GN.node;var Ms=J(GN);var $N={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};$N.node;var Sf=J($N);var jN={name:"plug",size:24,node:[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]};jN.node;var Cf=J(jN);var WN={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};WN.node;var Yt=J(WN);var XN={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};XN.node;var kf=J(XN);var YN={name:"repeat",size:24,node:[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]};YN.node;var Lf=J(YN);var KN={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};KN.node;var If=J(KN);var ZN={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};ZN.node;var Nf=J(ZN);var QN={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};QN.node;var Rf=J(QN);var JN={name:"signpost",size:24,node:[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M2.354 10.354a1.207 1.207 0 0 1 0-1.708l2.06-2.06A2 2 0 0 1 5.828 6h12.344a2 2 0 0 1 1.414.586l2.06 2.06a1.207 1.207 0 0 1 0 1.708l-2.06 2.06a2 2 0 0 1-1.414.586H5.828a2 2 0 0 1-1.414-.586z",key:"1tm261"}]]};JN.node;var Tf=J(JN);var eR={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};eR.node;var Ko=J(eR);var tR={name:"split",size:24,node:[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]};tR.node;var ju=J(tR);var aR={name:"square-kanban",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]],aliases:["kanban-square"]};aR.node;var Es=J(aR);var nR={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};nR.node;var Mf=J(nR);var oR={name:"triangle-alert",size:24,node:[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["alert-triangle"]};oR.node;var mn=J(oR);var rR={name:"user-check",size:24,node:[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};rR.node;var Ef=J(rR);var sR={name:"webhook",size:24,node:[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]};sR.node;var Af=J(sR);var iR={name:"workflow",size:24,node:[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]};iR.node;var Ui=J(iR);var lR={name:"wrench",size:24,node:[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]};lR.node;var Vi=J(lR);var uR={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};uR.node;var At=J(uR);var cR={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};cR.node;var As=J(cR);var Zf=j(he(),1);var ao=j(he(),1);var pR=Symbol("html"),Df=class{#e;constructor(t,a){if(t!==pR)throw new TypeError("Html is made by html`…`");this.#e=a}static markupOf(t){return t.#e}toString(){if(dR)throw new Error("Html coerced to a string: interpolate it with html`…` or hand it to a sink");return this.#e}toJSON(){if(dR)throw new Error("Html serialized as JSON: convert it with htmlString() first");return this.#e}},dR=typeof process<"u"&&process.env.VITEST!==void 0,lB=e=>new Df(pR,e);var uB={"&":"&","<":"<",">":">",'"':""","'":"'"},cB=e=>e.replace(/[&<>"']/g,t=>uB[t]);function mR(e){if(e==null||typeof e=="boolean")return"";if(e instanceof Df)return Df.markupOf(e);if(Array.isArray(e))return e.map(mR).join("");if(typeof e=="string")return cB(e);if(typeof e=="number"||typeof e=="bigint")return String(e);throw new TypeError(`html: cannot interpolate ${typeof e}`)}var fR=new WeakSet,dB=/<form\b[^>]*\bmethod\s*=\s*["']?post\b/i,fB=/\bname\s*=\s*["']?csrf\b/i;function pB(e){if(fR.has(e))return;let t=e.join("\0");if(dB.test(t))throw new Error("html: write POST forms with postForm, which adds the CSRF field");if(fB.test(t))throw new Error("html: postForm adds the CSRF field; don't write one");fR.add(e)}function Gi(e,...t){pB(e);let a=e[0];for(let n=0;n<t.length;n++)a+=mR(t[n])+e[n+1];return lB(a)}var mB=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],hB=864e5,hR=new Map;function gB(e){let t=hR.get(e);return t===void 0&&(t=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),hR.set(e,t)),t}function nb(e,t){let a=o=>Object.fromEntries(gB(o).formatToParts(e).map(r=>[r.type,r.value])),n;try{n=a(t)}catch{n=a("UTC")}return{year:Number(n.year),month:Number(n.month),day:Number(n.day),clock:`${n.hour}:${n.minute}`}}var gR=e=>Math.floor(Date.UTC(e.year,e.month-1,e.day)/hB);function $i(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Wu(e,t=new Date,a="UTC",n=!1){let o=new Date(e);if(Number.isNaN(o.getTime()))return e;let r=nb(o,a),s=nb(t,a),i=gR(r)-gR(s);if(i===0)return r.clock;if(i===-1)return`Yesterday ${r.clock}`;if(i===1)return`Tomorrow ${r.clock}`;let l=`${mB[r.month-1]} ${r.day}`;return`${r.year===s.year?l:`${l} ${r.year}`}${n?` ${r.clock}`:""}`}function jh(e,t=new Date,a=$i()){if(Number.isNaN(new Date(e.at).getTime()))return e.label;let n=Wu(e.at,t,a,!0);return/^(?:\d|Tomorrow|Yesterday)/.test(n)?`${e.label} ${n}`:`${e.label.replace(/ at$/,"")} ${n}`}function xR(e,t=new Date){let a=new Date(e).getTime();if(Number.isNaN(a))return"";let n=Math.max(0,Math.floor((t.getTime()-a)/6e4));if(n<1)return"now";if(n<60)return`${n}m`;let o=Math.floor(n/60);return o<24?`${o}h`:`${Math.floor(o/24)}d`}function Wh(e,t="UTC"){let a=new Date(e);if(Number.isNaN(a.getTime()))return e;let n=nb(a,t);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")} ${n.clock}${t==="UTC"?" UTC":""}`}function vR(e,t=new Date,a=$i()){e.querySelectorAll("time[data-when][datetime]").forEach(n=>{let o=n.getAttribute("datetime")??"";if(o===""||Number.isNaN(new Date(o).getTime()))return;if(n.getAttribute("data-when")==="exact"){let i=xB(o,a);n.textContent!==i&&(n.textContent=i);return}let r=Wu(o,t,a),s=Wh(o,a);n.title!==s&&(n.title=s),n.textContent!==r&&(n.textContent=r)})}function xB(e,t="UTC"){let a=new Date(e);if(Number.isNaN(a.getTime()))return e;let n=String(a.getUTCSeconds()).padStart(2,"0"),o=Wh(e,t);return t==="UTC"?o.replace(/ UTC$/,`:${n} UTC`):`${o}:${n}`}var Ds=j(fe(),1),ob=!1;function rb(){ob||(ob=!0,queueMicrotask(()=>{ob=!1,vR(document),window.dispatchEvent(new CustomEvent("standing-orders:workspace-rendered"))}))}function yR(e){return e.contains(document.activeElement)&&document.activeElement?.matches("input, textarea, select, [contenteditable=true]")===!0||e.querySelector("form.approve-form, details[open] form")!==null}function Kt({html:e,immutable:t=!1,className:a=""}){let n=(0,ao.useRef)(null),o=(0,ao.useRef)(null),r=(0,ao.useRef)(!1),[s,i]=(0,ao.useState)(0),[l,c]=(0,ao.useState)(!1),[f,u]=(0,ao.useState)(!1);return(0,ao.useEffect)(()=>{let d=n.current,m=()=>i(g=>g+1);return d?.addEventListener("toggle",m,!0),()=>d?.removeEventListener("toggle",m,!0)},[]),(0,ao.useLayoutEffect)(()=>{let d=n.current;if(!d||o.current===e||t&&o.current!==null)return;if(o.current!==null&&(r.current||yR(d))){let b=d.querySelector("[data-approval]"),v=new DOMParser().parseFromString(e,"text/html").querySelector("[data-approval]");!!d.querySelector("form.approve-form")&&b?.dataset.approval!==v?.dataset.approval?(c(!0),d.querySelectorAll('form.approve-form button[type="submit"], form.approve-form input[type="submit"]').forEach(y=>{y.disabled=!0})):d.querySelector("form.approve-form")||u(!0);return}let m=o.current===null;d.innerHTML=e,o.current=e;let g=m?d.querySelector("[autofocus]"):null;g!==null&&(document.activeElement===null||document.activeElement===document.body)&&g.focus(),u(!1),rb()},[e,t,s]),(0,Ds.jsxs)("div",{className:`so-native-region ${a}`,"data-workspace-native":!0,children:[l&&(0,Ds.jsxs)(fn,{tone:"error",children:["The plan changed. ",(0,Ds.jsx)("a",{href:window.location.href,children:"Review the current plan"})," before approving."]}),f&&(0,Ds.jsxs)("p",{className:"so-deferred",role:"status",children:["Updates are available. Your form is preserved. ",(0,Ds.jsx)("a",{href:window.location.href,children:"Reload"})]}),(0,Ds.jsx)("div",{ref:n,onInput:()=>{r.current=!0},onChange:()=>{r.current=!0},onBlur:()=>i(d=>d+1)})]})}function bR(e){var t,a,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(a=bR(e[t]))&&(n&&(n+=" "),n+=a)}else for(a in e)e[a]&&(n&&(n+=" "),n+=a);return n}function Xh(){for(var e,t,a=0,n="",o=arguments.length;a<o;a++)(e=arguments[a])&&(t=bR(e))&&(n&&(n+=" "),n+=t);return n}var vB=(e,t)=>{let a=new Array(e.length+t.length);for(let n=0;n<e.length;n++)a[n]=e[n];for(let n=0;n<t.length;n++)a[e.length+n]=t[n];return a},yB=(e,t)=>({classGroupId:e,validator:t}),IR=(e=new Map,t=null,a)=>({nextPart:e,validators:t,classGroupId:a});var wR=[],bB="arbitrary..",wB=e=>{let t=CB(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return SB(s);let i=s.split("-"),l=i[0]===""&&i.length>1?1:0;return NR(i,l,t)},getConflictingClassGroupIds:(s,i)=>{if(i){let l=n[s],c=a[s];return l?c?vB(c,l):l:c||wR}return a[s]||wR}}},NR=(e,t,a)=>{if(e.length-t===0)return a.classGroupId;let o=e[t],r=a.nextPart.get(o);if(r){let c=NR(e,t+1,r);if(c)return c}let s=a.validators;if(s===null)return;let i=t===0?e.join("-"):e.slice(t).join("-"),l=s.length;for(let c=0;c<l;c++){let f=s[c];if(f.validator(i))return f.classGroupId}},SB=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{let t=e.slice(1,-1),a=t.indexOf(":"),n=t.slice(0,a);return n?bB+n:void 0})(),CB=e=>{let{theme:t,classGroups:a}=e;return kB(a,t)},kB=(e,t)=>{let a=IR();for(let n in e){let o=e[n];ib(o,a,n,t)}return a},ib=(e,t,a,n)=>{let o=e.length;for(let r=0;r<o;r++){let s=e[r];LB(s,t,a,n)}},LB=(e,t,a,n)=>{if(typeof e=="string"){IB(e,t,a);return}if(typeof e=="function"){NB(e,t,a,n);return}RB(e,t,a,n)},IB=(e,t,a)=>{let n=e===""?t:RR(t,e);n.classGroupId=a},NB=(e,t,a,n)=>{if(TB(e)){ib(e(n),t,a,n);return}t.validators===null&&(t.validators=[]),t.validators.push(yB(a,e))},RB=(e,t,a,n)=>{let o=Object.entries(e),r=o.length;for(let s=0;s<r;s++){let[i,l]=o[s];ib(l,RR(t,i),a,n)}},RR=(e,t)=>{let a=e,n=t.split("-"),o=n.length;for(let r=0;r<o;r++){let s=n[r],i=a.nextPart.get(s);i||(i=IR(),a.nextPart.set(s,i)),a=i}return a},TB=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,MB=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=Object.create(null),n=Object.create(null),o=(r,s)=>{a[r]=s,t++,t>e&&(t=0,n=a,a=Object.create(null))};return{get(r){let s=a[r];if(s!==void 0)return s;if((s=n[r])!==void 0)return o(r,s),s},set(r,s){r in a?a[r]=s:o(r,s)}}};var EB=[],SR=(e,t,a,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:a,maybePostfixModifierPosition:n,isExternal:o}),AB=e=>{let{prefix:t,experimentalParseClassName:a}=e,n=o=>{let r=[],s=0,i=0,l=0,c,f=o.length;for(let b=0;b<f;b++){let v=o[b];if(s===0&&i===0){if(v===":"){r.push(o.slice(l,b)),l=b+1;continue}if(v==="/"){c=b;continue}}v==="["?s++:v==="]"?s--:v==="("?i++:v===")"&&i--}let u=r.length===0?o:o.slice(l),d=u,m=!1;u.endsWith("!")?(d=u.slice(0,-1),m=!0):u.startsWith("!")&&(d=u.slice(1),m=!0);let g=c&&c>l?c-l:void 0;return SR(r,m,d,g)};if(t){let o=t+":",r=n;n=s=>s.startsWith(o)?r(s.slice(o.length)):SR(EB,!1,s,void 0,!0)}if(a){let o=n;n=r=>a({className:r,parseClassName:o})}return n},DB=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((a,n)=>{t.set(a,1e6+n)}),a=>{let n=[],o=[];for(let r=0;r<a.length;r++){let s=a[r],i=s[0]==="[",l=t.has(s);i||l?(o.length>0&&(o.sort(),n.push(...o),o=[]),n.push(s)):o.push(s)}return o.length>0&&(o.sort(),n.push(...o)),n}},_B=e=>({cache:MB(e.cacheSize),parseClassName:AB(e),sortModifiers:DB(e),postfixLookupClassGroupIds:PB(e),...wB(e)}),PB=e=>{let t=Object.create(null),a=e.postfixLookupClassGroups;if(a)for(let n=0;n<a.length;n++)t[a[n]]=!0;return t},OB=/\s+/,zB=(e,t)=>{let{parseClassName:a,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:r,postfixLookupClassGroupIds:s}=t,i=[],l=e.trim().split(OB),c="";for(let f=l.length-1;f>=0;f-=1){let u=l[f],{isExternal:d,modifiers:m,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:v}=a(u);if(d){c=u+(c.length>0?" "+c:c);continue}let x=!!v,y;if(x){let I=b.substring(0,v);y=n(I);let L=y&&s[y]?n(b):void 0;L&&L!==y&&(y=L,x=!1)}else y=n(b);if(!y){if(!x){c=u+(c.length>0?" "+c:c);continue}if(y=n(b),!y){c=u+(c.length>0?" "+c:c);continue}x=!1}let h=m.length===0?"":m.length===1?m[0]:r(m).join(":"),w=g?h+"!":h,S=w+y;if(i.indexOf(S)>-1)continue;i.push(S);let C=o(y,x);for(let I=0;I<C.length;++I){let L=C[I];i.push(w+L)}c=u+(c.length>0?" "+c:c)}return c},BB=(...e)=>{let t=0,a,n,o="";for(;t<e.length;)(a=e[t++])&&(n=TR(a))&&(o&&(o+=" "),o+=n);return o},TR=e=>{if(typeof e=="string")return e;let t,a="";for(let n=0;n<e.length;n++)e[n]&&(t=TR(e[n]))&&(a&&(a+=" "),a+=t);return a},FB=(e,...t)=>{let a,n,o,r,s=l=>{let c=t.reduce((f,u)=>u(f),e());return a=_B(c),n=a.cache.get,o=a.cache.set,r=i,i(l)},i=l=>{let c=n(l);if(c)return c;let f=zB(l,a);return o(l,f),f};return r=s,(...l)=>r(BB(...l))},HB=[],Zt=e=>{let t=a=>a[e]||HB;return t.isThemeGetter=!0,t.themeKey=e,t},MR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ER=/^\((?:(\w[\w-]*):)?(.+)\)$/i,qB=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,UB=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,VB=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,GB=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,$B=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jB=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_s=e=>qB.test(e),Fe=e=>!!e&&!Number.isNaN(Number(e)),Zo=e=>!!e&&Number.isInteger(Number(e)),sb=e=>e.endsWith("%")&&Fe(e.slice(0,-1)),Rr=e=>UB.test(e),AR=()=>!0,WB=e=>VB.test(e)&&!GB.test(e),lb=()=>!1,XB=e=>$B.test(e),YB=e=>jB.test(e),KB=e=>!ye(e)&&!Se(e),ZB=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),QB=e=>Ps(e,PR,lb),ye=e=>MR.test(e),ji=e=>Ps(e,OR,WB),CR=e=>Ps(e,sF,Fe),JB=e=>Ps(e,BR,AR),eF=e=>Ps(e,zR,lb),kR=e=>Ps(e,DR,lb),tF=e=>Ps(e,_R,YB),Yh=e=>Ps(e,FR,XB),Se=e=>ER.test(e),_f=e=>Wi(e,OR),aF=e=>Wi(e,zR),LR=e=>Wi(e,DR),nF=e=>Wi(e,PR),oF=e=>Wi(e,_R),Kh=e=>Wi(e,FR,!0),rF=e=>Wi(e,BR,!0),Ps=(e,t,a)=>{let n=MR.exec(e);return n?n[1]?t(n[1]):a(n[2]):!1},Wi=(e,t,a=!1)=>{let n=ER.exec(e);return n?n[1]?t(n[1]):a:!1},DR=e=>e==="position"||e==="percentage",_R=e=>e==="image"||e==="url",PR=e=>e==="length"||e==="size"||e==="bg-size",OR=e=>e==="length",sF=e=>e==="number",zR=e=>e==="family-name",BR=e=>e==="number"||e==="weight",FR=e=>e==="shadow";var iF=()=>{let e=Zt("color"),t=Zt("font"),a=Zt("text"),n=Zt("font-weight"),o=Zt("tracking"),r=Zt("leading"),s=Zt("breakpoint"),i=Zt("container"),l=Zt("spacing"),c=Zt("radius"),f=Zt("shadow"),u=Zt("inset-shadow"),d=Zt("text-shadow"),m=Zt("drop-shadow"),g=Zt("blur"),b=Zt("perspective"),v=Zt("aspect"),x=Zt("ease"),y=Zt("animate"),h=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...w(),Se,ye],C=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],L=()=>[Se,ye,l],T=()=>[_s,"full","auto",...L()],A=()=>[Zo,"none","subgrid",Se,ye],D=()=>["auto",{span:["full",Zo,Se,ye]},Zo,Se,ye],H=()=>[Zo,"auto",Se,ye],V=()=>["auto","min","max","fr",Se,ye],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...L()],_=()=>[_s,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],z=()=>[i,_s,"screen","full","dvw","lvw","svw","min","max","fit",...L()],q=()=>[_s,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],O=()=>[e,Se,ye],W=()=>[...w(),LR,kR,{position:[Se,ye]}],ee=()=>["no-repeat",{repeat:["","x","y","space","round"]}],de=()=>["auto","cover","contain",nF,QB,{size:[Se,ye]}],ne=()=>[sb,_f,ji],re=()=>["","none","full",c,Se,ye],ue=()=>["",Fe,_f,ji],ce=()=>["solid","dashed","dotted","double"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>[Fe,sb,LR,kR],se=()=>["","none",g,Se,ye],le=()=>["none",Fe,Se,ye],B=()=>["none",Fe,Se,ye],G=()=>[Fe,Se,ye],oe=()=>[_s,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Rr],breakpoint:[Rr],color:[AR],container:[Rr],"drop-shadow":[Rr],ease:["in","out","in-out"],font:[KB],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Rr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Rr],shadow:[Rr],spacing:["px",Fe],text:[Rr],"text-shadow":[Rr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",_s,ye,Se,v]}],container:["container"],"container-type":[{"@container":["","normal","size",Se,ye]}],"container-named":[ZB],columns:[{columns:[Fe,"auto",ye,Se,i]}],"break-after":[{"break-after":h()}],"break-before":[{"break-before":h()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Zo,"auto",Se,ye]}],basis:[{basis:[_s,"full","auto",i,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,_s,"auto","initial","none",ye]}],grow:[{grow:["",Fe,Se,ye]}],shrink:[{shrink:["",Fe,Se,ye]}],order:[{order:[Zo,"first","last","none",Se,ye]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...q()]}],"min-block-size":[{"min-block":["auto",...q()]}],"max-block-size":[{"max-block":["none",...q()]}],w:[{w:[i,"screen",..._()]}],"min-w":[{"min-w":[i,"screen","none",..._()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh","none",..._()]}],"font-size":[{text:["base",a,_f,ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,rF,JB]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sb,ye]}],"font-family":[{font:[aF,eF,t]}],"font-features":[{"font-features":[ye]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Se,ye]}],"line-clamp":[{"line-clamp":[Fe,"none",Se,CR]}],leading:[{leading:["none",r,...L()]}],"list-image":[{"list-image":["none",Se,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Se,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",Se,ji]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[Fe,"auto",Se,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"tab-size":[{tab:[Zo,Se,ye]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Se,ye]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Se,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:W()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:de()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zo,Se,ye],radial:["",Se,ye],conic:["",Zo,Se,ye]},oF,tF]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:re()}],"rounded-s":[{"rounded-s":re()}],"rounded-e":[{"rounded-e":re()}],"rounded-t":[{"rounded-t":re()}],"rounded-r":[{"rounded-r":re()}],"rounded-b":[{"rounded-b":re()}],"rounded-l":[{"rounded-l":re()}],"rounded-ss":[{"rounded-ss":re()}],"rounded-se":[{"rounded-se":re()}],"rounded-ee":[{"rounded-ee":re()}],"rounded-es":[{"rounded-es":re()}],"rounded-tl":[{"rounded-tl":re()}],"rounded-tr":[{"rounded-tr":re()}],"rounded-br":[{"rounded-br":re()}],"rounded-bl":[{"rounded-bl":re()}],"border-w":[{border:ue()}],"border-w-x":[{"border-x":ue()}],"border-w-y":[{"border-y":ue()}],"border-w-s":[{"border-s":ue()}],"border-w-e":[{"border-e":ue()}],"border-w-bs":[{"border-bs":ue()}],"border-w-be":[{"border-be":ue()}],"border-w-t":[{"border-t":ue()}],"border-w-r":[{"border-r":ue()}],"border-w-b":[{"border-b":ue()}],"border-w-l":[{"border-l":ue()}],"divide-x":[{"divide-x":ue()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ue()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-bs":[{"border-bs":O()}],"border-color-be":[{"border-be":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,Se,ye]}],"outline-w":[{outline:["",Fe,_f,ji]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","inner","none",f,Kh,Yh]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",u,Kh,Yh]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:ue()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[Fe,ji]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":ue()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",d,Kh,Yh]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[Fe,Se,ye]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":M()}],"mask-image-linear-to-pos":[{"mask-linear-to":M()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":M()}],"mask-image-t-to-pos":[{"mask-t-to":M()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":M()}],"mask-image-r-to-pos":[{"mask-r-to":M()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":M()}],"mask-image-b-to-pos":[{"mask-b-to":M()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":M()}],"mask-image-l-to-pos":[{"mask-l-to":M()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":M()}],"mask-image-x-to-pos":[{"mask-x-to":M()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":M()}],"mask-image-y-to-pos":[{"mask-y-to":M()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[Se,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":M()}],"mask-image-radial-to-pos":[{"mask-radial-to":M()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":M()}],"mask-image-conic-to-pos":[{"mask-conic-to":M()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:W()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:de()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Se,ye]}],filter:[{filter:["","none",Se,ye]}],blur:[{blur:se()}],brightness:[{brightness:[Fe,Se,ye]}],contrast:[{contrast:[Fe,Se,ye]}],"drop-shadow":[{"drop-shadow":["","none",m,Kh,Yh]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",Fe,Se,ye]}],"hue-rotate":[{"hue-rotate":[Fe,Se,ye]}],invert:[{invert:["",Fe,Se,ye]}],saturate:[{saturate:[Fe,Se,ye]}],sepia:[{sepia:["",Fe,Se,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",Se,ye]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,Se,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,Se,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,Se,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,Se,ye]}],"backdrop-invert":[{"backdrop-invert":["",Fe,Se,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,Se,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,Se,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,Se,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Se,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",Se,ye]}],ease:[{ease:["linear","initial",x,Se,ye]}],delay:[{delay:[Fe,Se,ye]}],animate:[{animate:["none",y,Se,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,Se,ye]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:B()}],"scale-x":[{"scale-x":B()}],"scale-y":[{"scale-y":B()}],"scale-z":[{"scale-z":B()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[Se,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:oe()}],"translate-x":[{"translate-x":oe()}],"translate-y":[{"translate-y":oe()}],"translate-z":[{"translate-z":oe()}],"translate-none":["translate-none"],zoom:[{zoom:[Zo,Se,ye]}],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Se,ye]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":O()}],"scrollbar-track-color":[{"scrollbar-track":O()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Se,ye]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[Fe,_f,ji,CR]}],stroke:[{stroke:["none",...O()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}};var HR=FB(iF);function te(...e){return HR(Xh(e))}var qR=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,UR=Xh,Zh=(e,t)=>a=>{var n;if(t?.variants==null)return UR(e,a?.class,a?.className);let{variants:o,defaultVariants:r}=t,s=Object.keys(o).map(c=>{let f=a?.[c],u=r?.[c];if(f===null)return null;let d=qR(f)||qR(u);return o[c][d]}),i=a&&Object.entries(a).reduce((c,f)=>{let[u,d]=f;return d===void 0||(c[u]=d),c},{}),l=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((c,f)=>{let{class:u,className:d,...m}=f;return Object.entries(m).every(g=>{let[b,v]=g;return Array.isArray(v)?v.includes({...r,...i}[b]):{...r,...i}[b]===v})?[...c,u,d]:c},[]);return UR(e,s,l,a?.class,a?.className)};var VR=j(fe(),1),lF=Zh("inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-[13px] font-medium transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",attention:"bg-attention text-on-attention hover:bg-[var(--so-signal-hover)]",destructive:"bg-destructive-soft text-destructive hover:bg-destructive/15",outline:"bg-card text-foreground shadow-[var(--so-pill-shadow)] hover:bg-accent",secondary:"bg-secondary text-secondary-foreground hover:bg-accent",ghost:"text-muted-foreground hover:bg-accent hover:text-foreground",link:"text-foreground underline underline-offset-4 decoration-border hover:decoration-muted-foreground"},size:{default:"h-8 px-3 phone:h-11 phone:px-4",sm:"h-7 px-2.5 text-[12.5px] phone:h-11 phone:px-3 phone:text-[13px]",lg:"h-10 px-5",icon:"size-8 phone:size-11"}},defaultVariants:{variant:"default",size:"default"}});function Z({className:e,variant:t,size:a,asChild:n=!1,type:o,...r}){return(0,VR.jsx)(n?Nh:"button",{"data-slot":"button",className:te(lF({variant:t,size:a}),e),...n?{}:{type:o??"button"},...r})}var GR=j(fe(),1),Qh=Zh("inline-flex w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-[5px] px-1.5 py-px text-[11.5px] font-medium leading-[18px] [&_svg]:size-3",{variants:{tone:{neutral:"bg-neutral-soft text-neutral-ink",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",attention:"bg-attention-soft text-attention",danger:"bg-destructive-soft text-destructive",info:"bg-info-soft text-info"}},defaultVariants:{tone:"neutral"}});function wa({className:e,tone:t,...a}){return(0,GR.jsx)("span",{"data-slot":"badge",className:te(Qh({tone:t}),e),...a})}var Pf=j(fe(),1);function Sa({className:e,...t}){return(0,Pf.jsx)("section",{"data-slot":"card",className:te("flex flex-col gap-4 rounded-[10px] border border-border bg-card p-5 text-card-foreground phone:gap-3 phone:p-3.5",e),...t})}function $R({className:e,...t}){return(0,Pf.jsx)("div",{"data-slot":"card-header",className:te("flex items-start justify-between gap-3",e),...t})}function jR({className:e,...t}){return(0,Pf.jsx)("h2",{"data-slot":"card-title",className:te("text-base font-semibold leading-snug",e),...t})}function WR({className:e,...t}){return(0,Pf.jsx)("p",{"data-slot":"card-description",className:te("text-sm text-muted-foreground",e),...t})}var la=j(he(),1);var yo=j(he(),1);var Jh=j(fe(),1),hn=j(he(),1);var Xi=j(fe(),1),uF=Object.defineProperty,ia=(e,t)=>uF(e,"name",{value:t,configurable:!0});function Yi(e){let t=e+"CollectionProvider",[a,n]=xt(t),[o,r]=a(t,{collectionRef:{current:null},itemMap:new Map}),s=ia(b=>{let{scope:v,children:x}=b,y=yo.useRef(null),h=yo.useRef(new Map).current;return(0,Jh.jsx)(o,{scope:v,itemMap:h,collectionRef:y,children:x})},"CollectionProvider");s.displayName=t;let i=e+"CollectionSlot",l=Ea(i),c=yo.forwardRef((b,v)=>{let{scope:x,children:y}=b,h=r(i,x),w=Te(v,h.collectionRef);return(0,Jh.jsx)(l,{ref:w,children:y})});c.displayName=i;let f=e+"CollectionItemSlot",u="data-radix-collection-item",d=Ea(f),m=yo.forwardRef((b,v)=>{let{scope:x,children:y,...h}=b,w=yo.useRef(null),S=Te(v,w),C=r(f,x);return yo.useEffect(()=>(C.itemMap.set(w,{ref:w,...h}),()=>{C.itemMap.delete(w)})),(0,Jh.jsx)(d,{[u]:"",ref:S,children:y})});m.displayName=f;function g(b){let v=r(e+"CollectionConsumer",b);return yo.useCallback(()=>{let y=v.collectionRef.current;if(!y)return[];let h=Array.from(y.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((C,I)=>h.indexOf(C.ref.current)-h.indexOf(I.ref.current))},[v.collectionRef,v.itemMap])}return ia(g,"useCollection"),[{Provider:s,Slot:c,ItemSlot:m},g,n]}ia(Yi,"createCollection");var XR=new WeakMap,ub=class Os extends Map{static{ia(this,"OrderedDict")}#e;constructor(t){super(t),this.#e=[...super.keys()],XR.set(this,!0)}set(t,a){return XR.get(this)&&(this.has(t)?this.#e[this.#e.indexOf(t)]=t:this.#e.push(t)),super.set(t,a),this}insert(t,a,n){let o=this.has(a),r=this.#e.length,s=db(t),i=s>=0?s:r+s,l=i<0||i>=r?-1:i;if(l===this.size||o&&l===this.size-1||l===-1)return this.set(a,n),this;let c=this.size+(o?0:1);s<0&&i++;let f=[...this.#e],u,d=!1;for(let m=i;m<c;m++)if(i===m){let g=f[m];f[m]===a&&(g=f[m+1]),o&&this.delete(a),u=this.get(g),this.set(a,n)}else{!d&&f[m-1]===a&&(d=!0);let g=f[d?m:m-1],b=u;u=this.get(g),this.delete(g),this.set(g,b)}return this}with(t,a,n){let o=new Os(this);return o.insert(t,a,n),o}before(t){let a=this.#e.indexOf(t)-1;if(!(a<0))return this.entryAt(a)}setBefore(t,a,n){let o=this.#e.indexOf(t);return o===-1?this:this.insert(o,a,n)}after(t){let a=this.#e.indexOf(t);if(a=a===-1||a===this.size-1?-1:a+1,a!==-1)return this.entryAt(a)}setAfter(t,a,n){let o=this.#e.indexOf(t);return o===-1?this:this.insert(o+1,a,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(t){let a=super.delete(t);return a&&this.#e.splice(this.#e.indexOf(t),1),a}deleteAt(t){let a=this.keyAt(t);return a!==void 0?this.delete(a):!1}at(t){let a=eg(this.#e,t);if(a!==void 0)return this.get(a)}entryAt(t){let a=eg(this.#e,t);if(a!==void 0)return[a,this.get(a)]}indexOf(t){return this.#e.indexOf(t)}keyAt(t){return eg(this.#e,t)}from(t,a){let n=this.indexOf(t);if(n===-1)return;let o=n+a;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(t,a){let n=this.indexOf(t);if(n===-1)return;let o=n+a;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(t,a){let n=0;for(let o of this){if(Reflect.apply(t,a,[o,n,this]))return o;n++}}findIndex(t,a){let n=0;for(let o of this){if(Reflect.apply(t,a,[o,n,this]))return n;n++}return-1}filter(t,a){let n=[],o=0;for(let r of this)Reflect.apply(t,a,[r,o,this])&&n.push(r),o++;return new Os(n)}map(t,a){let n=[],o=0;for(let r of this)n.push([r[0],Reflect.apply(t,a,[r,o,this])]),o++;return new Os(n)}reduce(...t){let[a,n]=t,o=0,r=n??this.at(0);for(let s of this)o===0&&t.length===1?r=s:r=Reflect.apply(a,this,[r,s,o,this]),o++;return r}reduceRight(...t){let[a,n]=t,o=n??this.at(-1);for(let r=this.size-1;r>=0;r--){let s=this.at(r);r===this.size-1&&t.length===1?o=s:o=Reflect.apply(a,this,[o,s,r,this])}return o}toSorted(t){let a=[...this.entries()].sort(t);return new Os(a)}toReversed(){let t=new Os;for(let a=this.size-1;a>=0;a--){let n=this.keyAt(a),o=this.get(n);t.set(n,o)}return t}toSpliced(...t){let a=[...this.entries()];return a.splice(...t),new Os(a)}slice(t,a){let n=new Os,o=this.size-1;if(t===void 0)return n;t<0&&(t=t+this.size),a!==void 0&&a>0&&(o=a-1);for(let r=t;r<=o;r++){let s=this.keyAt(r),i=this.get(s);n.set(s,i)}return n}every(t,a){let n=0;for(let o of this){if(!Reflect.apply(t,a,[o,n,this]))return!1;n++}return!0}some(t,a){let n=0;for(let o of this){if(Reflect.apply(t,a,[o,n,this]))return!0;n++}return!1}};function eg(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);let a=YR(e,t);return a===-1?void 0:e[a]}ia(eg,"at");function YR(e,t){let a=e.length,n=db(t),o=n>=0?n:a+n;return o<0||o>=a?-1:o}ia(YR,"toSafeIndex");function db(e){return e!==e||e===0?0:Math.trunc(e)}ia(db,"toSafeInteger");function cF(e){let t=e+"CollectionProvider",[a,n]=xt(t),[o,r]=a(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new ub,setItemMap:ia(()=>{},"setItemMap")}),s=ia(({state:h,...w})=>h?(0,Xi.jsx)(l,{...w,state:h}):(0,Xi.jsx)(i,{...w}),"CollectionProvider");s.displayName=t;let i=ia(h=>{let w=v();return(0,Xi.jsx)(l,{...h,state:w})},"CollectionInit");i.displayName=t+"Init";let l=ia(h=>{let{scope:w,children:S,state:C}=h,I=hn.useRef(null),[L,T]=hn.useState(null),A=Te(I,T),[D,H]=C;return hn.useEffect(()=>{if(!L)return;let V=QR(()=>{});return V.observe(L,{childList:!0,subtree:!0}),()=>{V.disconnect()}},[L]),(0,Xi.jsx)(o,{scope:w,itemMap:D,setItemMap:H,collectionRef:A,collectionRefObject:I,collectionElement:L,children:S})},"CollectionProviderImpl");l.displayName=t+"Impl";let c=e+"CollectionSlot",f=Ea(c),u=hn.forwardRef((h,w)=>{let{scope:S,children:C}=h,I=r(c,S),L=Te(w,I.collectionRef);return(0,Xi.jsx)(f,{ref:L,children:C})});u.displayName=c;let d=e+"CollectionItemSlot",m="data-radix-collection-item",g=Ea(d),b=hn.forwardRef((h,w)=>{let{scope:S,children:C,...I}=h,L=hn.useRef(null),[T,A]=hn.useState(null),D=Te(w,L,A),H=r(d,S),{setItemMap:V}=H,N=hn.useRef(I);KR(N.current,I)||(N.current=I);let P=N.current;return hn.useEffect(()=>{let E=P;return V(_=>T?_.has(T)?_.set(T,{...E,element:T}).toSorted(cb):(_.set(T,{...E,element:T}),_.toSorted(cb)):_),()=>{V(_=>!T||!_.has(T)?_:(_.delete(T),new ub(_)))}},[T,P,V]),(0,Xi.jsx)(g,{[m]:"",ref:D,children:C})});b.displayName=d;function v(){return hn.useState(new ub)}ia(v,"useInitCollection");function x(h){let{itemMap:w}=r(e+"CollectionConsumer",h);return w}return ia(x,"useCollection"),[{Provider:s,Slot:u,ItemSlot:b},{createCollectionScope:n,useCollection:x,useInitCollection:v}]}ia(cF,"createCollection");function KR(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;let a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;for(let o of a)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}ia(KR,"shallowEqual");function ZR(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}ia(ZR,"isElementPreceding");function cb(e,t){return!e[1].element||!t[1].element?0:ZR(e[1].element,t[1].element)?-1:1}ia(cb,"sortByDocumentPosition");function QR(e){return new MutationObserver(a=>{for(let n of a)if(n.type==="childList"){e();return}})}ia(QR,"getChildListObserver");var tg=j(he(),1),pF=j(fe(),1),dF=Object.defineProperty,fF=(e,t)=>dF(e,"name",{value:t,configurable:!0}),mF=tg.createContext(void 0);function Tr(e){let t=tg.useContext(mF);return e||t||"ltr"}fF(Tr,"useDirection");var gF=j(he(),1),ag=j(he(),1),hF=Object.defineProperty,pb=(e,t)=>hF(e,"name",{value:t,configurable:!0}),fb=!1;function JR(){let[e,t]=ag.useState(fb);return ag.useEffect(()=>{fb||(fb=!0,t(!0))},[]),e}pb(JR,"useIsHydrated");var e5=gF[" useSyncExternalStore ".trim().toString()];function t5(){return()=>{}}pb(t5,"subscribe");function a5(){return e5(t5,()=>!0,()=>!1)}pb(a5,"useIsHydratedModern");var n5=typeof e5=="function"?a5:JR;var zs=j(fe(),1),xF=Object.defineProperty,Ki=(e,t)=>xF(e,"name",{value:t,configurable:!0}),mb="rovingFocusGroup.onEntryFocus",vF={bubbles:!1,cancelable:!0},ng="RovingFocusGroup",[hb,o5,yF]=Yi(ng),[bF,Xu]=xt(ng,[yF]),[wF,SF]=bF(ng),CF=la.forwardRef(Ki(function(t,a){return(0,zs.jsx)(hb.Provider,{scope:t.__scopeRovingFocusGroup,children:(0,zs.jsx)(hb.Slot,{scope:t.__scopeRovingFocusGroup,children:(0,zs.jsx)(kF,{...t,ref:a})})})},"RovingFocusGroup")),kF=la.forwardRef(Ki(function(t,a){let{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...d}=t,m=la.useRef(null),g=Te(a,m),b=Tr(s),[v,x]=Ma({prop:i,defaultProp:l??null,onChange:c,caller:ng}),[y,h]=la.useState(!1),w=oa(f),S=o5(n),C=la.useRef(!1),[I,L]=la.useState(0);return la.useEffect(()=>{let T=m.current;if(T)return T.addEventListener(mb,w),()=>T.removeEventListener(mb,w)},[w]),(0,zs.jsx)(wF,{scope:n,orientation:o,dir:b,loop:r,currentTabStopId:v,onItemFocus:la.useCallback(T=>x(T),[x]),onItemShiftTab:la.useCallback(()=>h(!0),[]),onFocusableItemAdd:la.useCallback(()=>L(T=>T+1),[]),onFocusableItemRemove:la.useCallback(()=>L(T=>T-1),[]),children:(0,zs.jsx)(Re.div,{tabIndex:y||I===0?-1:0,"data-orientation":o,...d,ref:g,style:{outline:"none",...t.style},onMouseDown:ke(t.onMouseDown,()=>{C.current=!0}),onFocus:ke(t.onFocus,T=>{let A=!C.current;if(T.target===T.currentTarget&&A&&!y){let D=new CustomEvent(mb,vF);if(T.currentTarget.dispatchEvent(D),!D.defaultPrevented){let H=S().filter(_=>_.focusable),V=H.find(_=>_.active),N=H.find(_=>_.id===v),E=[V,N,...H].filter(Boolean).map(_=>_.ref.current);gb(E,u)}}C.current=!1}),onBlur:ke(t.onBlur,()=>h(!1))})})},"RovingFocusGroupImpl")),LF="RovingFocusGroupItem",IF=la.forwardRef(Ki(function(t,a){let{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:i,...l}=t,c=Ga(),f=s||c,u=SF(LF,n),d=u.currentTabStopId===f,m=o5(n),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:v}=u,x=n5();return Ze(()=>{if(!(!x||!o))return g(),()=>b()},[x,o,g,b]),la.useEffect(()=>{if(!(x||!o))return g(),()=>b()},[x,o,g,b]),(0,zs.jsx)(hb.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:(0,zs.jsx)(Re.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...l,ref:a,onMouseDown:ke(t.onMouseDown,y=>{o?u.onItemFocus(f):y.preventDefault()}),onFocus:ke(t.onFocus,()=>u.onItemFocus(f)),onKeyDown:ke(t.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;let h=s5(y,u.orientation,u.dir);if(h!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let S=m().filter(C=>C.focusable).map(C=>C.ref.current);if(h==="last")S.reverse();else if(h==="prev"||h==="next"){h==="prev"&&S.reverse();let C=S.indexOf(y.currentTarget);S=u.loop?i5(S,C+1):S.slice(C+1)}setTimeout(()=>gb(S))}}),children:typeof i=="function"?i({isCurrentTabStop:d,hasTabStop:v!=null}):i})})},"RovingFocusGroupItem")),NF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function r5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}Ki(r5,"getDirectionAwareKey");function s5(e,t,a){let n=r5(e.key,a);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return NF[n]}Ki(s5,"getFocusIntent");function gb(e,t=!1){let a=document.activeElement;for(let n of e)if(n===a||(n.focus({preventScroll:t}),document.activeElement!==a))return}Ki(gb,"focusFirst");function i5(e,t){return e.map((a,n)=>e[(t+n)%e.length])}Ki(i5,"wrapArray");var og=CF,rg=IF;var RF=j(fe(),1);var Wa=j(he(),1);var Ca=j(he(),1);var u5=j(he(),1);var TF=Object.defineProperty,MF=(e,t)=>TF(e,"name",{value:t,configurable:!0});function Zi(e){let[t,a]=u5.useState(void 0);return Ze(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});let n=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;let r=o[0],s,i;if("borderBoxSize"in r){let l=r.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,i=c.blockSize}else s=e.offsetWidth,i=e.offsetHeight;a({width:s,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else a(void 0)},[e]),t}MF(Zi,"useSize");var Yu=j(fe(),1),Pa=j(fe(),1),EF=Object.defineProperty,_a=(e,t)=>EF(e,"name",{value:t,configurable:!0}),c5="Radio",[AF,d5]=xt(c5),[DF,sg]=AF(c5);function f5(e){let{__scopeRadio:t,checked:a=!1,children:n,disabled:o,form:r,name:s,onCheck:i,required:l,value:c="on",internal_do_not_use_render:f}=e,[u,d]=Ca.useState(null),[m,g]=Ca.useState(null),b=Ca.useRef(!1),[v,x]=Ca.useReducer(w=>w+1,0),y=u?!!r||!!u.closest("form"):!0,h={checked:a,disabled:o,required:l,name:s,form:r,value:c,control:u,setControl:d,hasConsumerStoppedPropagationRef:b,userInteractionCount:v,onUserInteraction:x,isFormControl:y,bubbleInput:m,setBubbleInput:g,onCheck:_a(()=>i?.(),"onCheck")};return(0,Yu.jsx)(DF,{scope:t,...h,children:p5(f)?f(h):n})}_a(f5,"RadioProvider");var _F="RadioTrigger",PF=Ca.forwardRef(_a(function({__scopeRadio:t,onClick:a,...n},o){let{checked:r,disabled:s,value:i,setControl:l,onCheck:c,hasConsumerStoppedPropagationRef:f,onUserInteraction:u,isFormControl:d,bubbleInput:m}=sg(_F,t),g=Te(o,l);return(0,Yu.jsx)(Re.button,{type:"button",role:"radio","aria-checked":r,"data-state":xb(r),"data-disabled":s?"":void 0,disabled:s,value:i,...n,ref:g,onClick:ke(a,b=>{r||(u(),c()),m&&d&&(f.current=b.isPropagationStopped(),f.current||b.stopPropagation())})})},"RadioTrigger")),OF="RadioIndicator",zF=Ca.forwardRef(_a(function(t,a){let{__scopeRadio:n,forceMount:o,...r}=t,s=sg(OF,n);return(0,Yu.jsx)(An,{present:o||s.checked,children:(0,Yu.jsx)(Re.span,{"data-state":xb(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:a})})},"RadioIndicator")),BF="RadioBubbleInput",FF=Ca.forwardRef(_a(function({__scopeRadio:t,onClick:a,...n},o){let{control:r,checked:s,required:i,disabled:l,name:c,value:f,form:u,bubbleInput:d,setBubbleInput:m,hasConsumerStoppedPropagationRef:g,userInteractionCount:b}=sg(BF,t),v=Te(o,m),x=Zi(r),y=Ca.useRef(!1),h=Ca.useRef(s),w=Ca.useRef(b);Ca.useEffect(()=>{let C=d;if(!C)return;let I=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(I,"checked").set,A=b!==w.current;w.current=b;let D=h.current!==s;h.current=s;let H=!(A&&g.current);if(D&&T){y.current=!A;let V=new Event("click",{bubbles:H});T.call(C,s),C.dispatchEvent(V),y.current=!1}},[d,s,g,b]);let S=Ca.useRef(s);return(0,Yu.jsx)(Re.input,{type:"radio","aria-hidden":!0,defaultChecked:S.current,required:i,disabled:l,name:c,value:f,form:u,...n,tabIndex:-1,ref:v,onClick:ke(a,C=>{y.current&&C.stopPropagation()}),style:{...n.style,...x,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"RadioBubbleInput"));function p5(e){return typeof e=="function"}_a(p5,"isFunction");function xb(e){return e?"checked":"unchecked"}_a(xb,"getState");var HF=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],vb="RadioGroup",[qF,_oe]=xt(vb,[Xu,d5]),m5=Xu(),ig=d5(),[UF,VF]=qF(vb),h5=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,name:o,form:r,defaultValue:s,value:i,required:l=!1,disabled:c=!1,orientation:f,dir:u,loop:d=!0,onValueChange:m,...g}=t,b=m5(n),v=Tr(u),[x,y]=Ma({prop:i,defaultProp:s??null,onChange:m,caller:vb}),[h,w]=Wa.useState(null),S=Te(a,w),C=Wa.useRef(x);return Wa.useEffect(()=>{let I=r?h?.ownerDocument.getElementById(r):h?.closest("form");if(I instanceof HTMLFormElement){let L=_a(()=>y(C.current),"reset");return I.addEventListener("reset",L),()=>I.removeEventListener("reset",L)}},[h,r,y]),(0,Pa.jsx)(UF,{scope:n,name:o,form:r,required:l,disabled:c,value:x,onValueChange:y,children:(0,Pa.jsx)(og,{asChild:!0,...b,orientation:f,dir:v,loop:d,children:(0,Pa.jsx)(Re.div,{role:"radiogroup","aria-required":l,"aria-orientation":f,"data-disabled":c?"":void 0,dir:v,...g,ref:S})})})},"RadioGroup")),GF="RadioGroupItemProvider",$F="RadioGroupItemTrigger";function g5(e){let{__scopeRadioGroup:t,value:a,disabled:n,children:o,internal_do_not_use_render:r}=e,s=VF(GF,t),i=ig(t),l=s.disabled||n;return(0,Pa.jsx)(f5,{...i,checked:s.value===a,disabled:l,required:s.required,name:s.name,form:s.form,value:a,onCheck:()=>s.onValueChange(a),internal_do_not_use_render:r,children:o})}_a(g5,"RadioGroupItemProvider");var jF=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,...o}=t,r=m5(n),s=ig(n),{checked:i,disabled:l}=sg($F,s.__scopeRadio),c=Wa.useRef(null),f=Te(a,c),u=Wa.useRef(!1);return Wa.useEffect(()=>{let d=_a(g=>{HF.includes(g.key)&&(u.current=!0)},"handleKeyDown"),m=_a(()=>u.current=!1,"handleKeyUp");return document.addEventListener("keydown",d),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",d),document.removeEventListener("keyup",m)}},[]),(0,Pa.jsx)(rg,{asChild:!0,...r,focusable:!l,active:i,children:(0,Pa.jsx)(PF,{...s,...o,ref:f,onKeyDown:ke(o.onKeyDown,d=>{d.key==="Enter"&&d.preventDefault()}),onFocus:ke(o.onFocus,()=>{u.current&&c.current?.click()})})})},"RadioGroupItemTrigger")),x5=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,value:o,disabled:r,...s}=t;return(0,Pa.jsx)(g5,{__scopeRadioGroup:n,value:o,disabled:r,internal_do_not_use_render:({isFormControl:i})=>(0,Pa.jsxs)(Pa.Fragment,{children:[(0,Pa.jsx)(jF,{...s,ref:a,__scopeRadioGroup:n}),i&&(0,Pa.jsx)(WF,{__scopeRadioGroup:n})]})})},"RadioGroupItem")),WF=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,...o}=t,r=ig(n);return(0,Pa.jsx)(FF,{...r,...o,ref:a})},"RadioGroupItemBubbleInput")),v5=Wa.forwardRef(_a(function(t,a){let{__scopeRadioGroup:n,...o}=t,r=ig(n);return(0,Pa.jsx)(zF,{...r,...o,ref:a})},"RadioGroupIndicator"));var bo=j(fe(),1);function lg({className:e,...t}){return(0,bo.jsx)(h5,{"data-slot":"radio-group",className:te("grid gap-2",e),...t})}function YF({className:e,...t}){return(0,bo.jsx)(x5,{"data-slot":"radio-group-item",className:te("mt-0.5 aspect-square size-4 shrink-0 rounded-full border border-input text-primary outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:border-primary",e),...t,children:(0,bo.jsx)(v5,{className:"flex items-center justify-center",children:(0,bo.jsx)(Fi,{className:"size-2 fill-current"})})})}function Of({value:e,id:t,title:a,description:n,className:o}){return(0,bo.jsxs)("label",{htmlFor:t,className:te("flex cursor-pointer items-start gap-3 rounded-lg border border-border bg-card p-3.5 transition-colors phone:min-h-11 phone:px-3 phone:py-2.5 hover:bg-accent has-[[data-state=checked]]:border-primary has-[[data-state=checked]]:bg-accent",o),children:[(0,bo.jsx)(YF,{value:e,id:t}),(0,bo.jsxs)("span",{className:"grid gap-0.5",children:[(0,bo.jsx)("span",{className:"text-sm font-semibold",children:a}),n&&(0,bo.jsx)("span",{className:"text-[13px] text-muted-foreground phone:leading-[1.35]",children:n})]})]})}var xe=j(he(),1),Mb=j($r(),1);var KF=Object.defineProperty,ZF=(e,t)=>KF(e,"name",{value:t,configurable:!0});function ug(e,[t,a]){return Math.min(a,Math.max(t,e))}ZF(ug,"clamp");var Oa=j(he(),1);var w5=["top","right","bottom","left"];var Qo=Math.min,wo=Math.max,Bf=Math.round,Ff=Math.floor,Jo=e=>({x:e,y:e}),QF={left:"right",right:"left",bottom:"top",top:"bottom"};function yb(e,t,a){return wo(e,Qo(t,a))}function er(e,t){return typeof e=="function"?e(t):e}function Mr(e){return e.split("-")[0]}function Qi(e){return e.split("-")[1]}function dg(e){return e==="x"?"y":"x"}function fg(e){return e==="y"?"height":"width"}function So(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function pg(e){return dg(So(e))}function S5(e,t,a){a===void 0&&(a=!1);let n=Qi(e),o=pg(e),r=fg(o),s=o==="x"?n===(a?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=zf(s)),[s,zf(s)]}function C5(e){let t=zf(e);return[cg(e),t,cg(t)]}function cg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}var y5=["left","right"],b5=["right","left"],JF=["top","bottom"],eH=["bottom","top"];function tH(e,t,a){switch(e){case"top":case"bottom":return a?t?b5:y5:t?y5:b5;case"left":case"right":return t?JF:eH;default:return[]}}function k5(e,t,a,n){let o=Qi(e),r=tH(Mr(e),a==="start",n);return o&&(r=r.map(s=>s+"-"+o),t&&(r=r.concat(r.map(cg)))),r}function zf(e){let t=Mr(e);return QF[t]+e.slice(t.length)}function aH(e){var t,a,n,o;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(n=e.bottom)!=null?n:0,left:(o=e.left)!=null?o:0}}function bb(e){return typeof e!="number"?aH(e):{top:e,right:e,bottom:e,left:e}}function Ji(e){let{x:t,y:a,width:n,height:o}=e;return{width:n,height:o,top:a,left:t,right:t+n,bottom:a+o,x:t,y:a}}function L5(e,t,a){let{reference:n,floating:o}=e,r=So(t),s=pg(t),i=fg(s),l=Mr(t),c=r==="y",f=n.x+n.width/2-o.width/2,u=n.y+n.height/2-o.height/2,d=n[i]/2-o[i]/2,m;switch(l){case"top":m={x:f,y:n.y-o.height};break;case"bottom":m={x:f,y:n.y+n.height};break;case"right":m={x:n.x+n.width,y:u};break;case"left":m={x:n.x-o.width,y:u};break;default:m={x:n.x,y:n.y}}let g=Qi(t);return g&&(m[s]+=d*(g==="end"?1:-1)*(a&&c?-1:1)),m}async function R5(e,t){var a;t===void 0&&(t={});let{x:n,y:o,platform:r,rects:s,elements:i,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:m=0}=er(t,e),g=bb(m),v=i[d?u==="floating"?"reference":"floating":u],x=Ji(await r.getClippingRect({element:(a=await(r.isElement==null?void 0:r.isElement(v)))==null||a?v:v.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(i.floating)),boundary:c,rootBoundary:f,strategy:l})),y=u==="floating"?{x:n,y:o,width:s.floating.width,height:s.floating.height}:s.reference,h=await(r.getOffsetParent==null?void 0:r.getOffsetParent(i.floating)),w=await(r.isElement==null?void 0:r.isElement(h))&&await(r.getScale==null?void 0:r.getScale(h))||{x:1,y:1},S=Ji(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:y,offsetParent:h,strategy:l}):y);return{top:(x.top-S.top+g.top)/w.y,bottom:(S.bottom-x.bottom+g.bottom)/w.y,left:(x.left-S.left+g.left)/w.x,right:(S.right-x.right+g.right)/w.x}}var nH=50,T5=async(e,t,a)=>{let{placement:n="bottom",strategy:o="absolute",middleware:r=[],platform:s}=a,i=s.detectOverflow?s:{...s,detectOverflow:R5},l=await(s.isRTL==null?void 0:s.isRTL(t)),c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=L5(c,n,l),d=n,m=0,g={};for(let b=0;b<r.length;b++){let v=r[b];if(!v)continue;let{name:x,fn:y}=v,{x:h,y:w,data:S,reset:C}=await y({x:f,y:u,initialPlacement:n,placement:d,strategy:o,middlewareData:g,rects:c,platform:i,elements:{reference:e,floating:t}});f=h??f,u=w??u,g[x]={...g[x],...S},C&&m<nH&&(m++,typeof C=="object"&&(C.placement&&(d=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:f,y:u}=L5(c,d,l)),b=-1)}return{x:f,y:u,placement:d,strategy:o,middlewareData:g}},M5=e=>({name:"arrow",options:e,async fn(t){let{x:a,y:n,placement:o,rects:r,platform:s,elements:i,middlewareData:l}=t,{element:c,padding:f=0}=er(e,t)||{};if(c==null)return{};let u=bb(f),d={x:a,y:n},m=pg(o),g=fg(m),b=await s.getDimensions(c),v=m==="y",x=v?"top":"left",y=v?"bottom":"right",h=v?"clientHeight":"clientWidth",w=r.reference[g]+r.reference[m]-d[m]-r.floating[g],S=d[m]-r.reference[m],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),I=C?C[h]:0;(!I||!await(s.isElement==null?void 0:s.isElement(C)))&&(I=i.floating[h]||r.floating[g]);let L=w/2-S/2,T=I/2-b[g]/2-1,A=Qo(u[x],T),D=Qo(u[y],T),H=I-b[g]-D,V=I/2-b[g]/2+L,N=yb(A,V,H),P=!l.arrow&&Qi(o)!=null&&V!==N&&r.reference[g]/2-(V<A?A:D)-b[g]/2<0,E=P?V<A?V-A:V-H:0;return{[m]:d[m]+E,data:{[m]:N,centerOffset:V-N-E,...P&&{alignmentOffset:E}},reset:P}}});var E5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var a,n;let{placement:o,middlewareData:r,rects:s,initialPlacement:i,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=er(e,t);if((a=r.arrow)!=null&&a.alignmentOffset)return{};let x=Mr(o),y=So(i),h=Mr(i)===i,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=d||(h||!b?[zf(i)]:C5(i)),C=g!=="none";!d&&C&&S.push(...k5(i,b,g,w));let I=[i,...S],L=await l.detectOverflow(t,v),T=[],A=((n=r.flip)==null?void 0:n.overflows)||[];if(f&&T.push(L[x]),u){let N=S5(o,s,w);T.push(L[N[0]],L[N[1]])}if(A=[...A,{placement:o,overflows:T}],!T.every(N=>N<=0)){var D,H;let N=(((D=r.flip)==null?void 0:D.index)||0)+1,P=I[N];if(P&&(!(u==="alignment"?y!==So(P):!1)||A.every(z=>So(z.placement)===y?z.overflows[0]>0:!0)))return{data:{index:N,overflows:A},reset:{placement:P}};let E=(H=A.filter(_=>_.overflows[0]<=0).sort((_,z)=>_.overflows[1]-z.overflows[1])[0])==null?void 0:H.placement;if(!E)switch(m){case"bestFit":{var V;let _=(V=A.filter(z=>{if(C){let q=So(z.placement);return q===y||q==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(q=>q>0).reduce((q,O)=>q+O,0)]).sort((z,q)=>z[1]-q[1])[0])==null?void 0:V[0];_&&(E=_);break}case"initialPlacement":E=i;break}if(o!==E)return{reset:{placement:E}}}return{}}}};function I5(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function N5(e){return w5.some(t=>e[t]>=0)}var A5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){let{rects:a,platform:n}=t,{strategy:o="referenceHidden",...r}=er(e,t);switch(o){case"referenceHidden":{let s=await n.detectOverflow(t,{...r,elementContext:"reference"}),i=I5(s,a.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:N5(i)}}}case"escaped":{let s=await n.detectOverflow(t,{...r,altBoundary:!0}),i=I5(s,a.floating);return{data:{escapedOffsets:i,escaped:N5(i)}}}default:return{}}}}};var D5=new Set(["left","top"]);async function oH(e,t){let{placement:a,platform:n,elements:o}=e,r=await(n.isRTL==null?void 0:n.isRTL(o.floating)),s=Mr(a),i=Qi(a),l=So(a)==="y",c=D5.has(s)?-1:1,f=r&&l?-1:1,u=er(t,e),{mainAxis:d,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&typeof g=="number"&&(m=i==="end"?g*-1:g),l?{x:m*f,y:d*c}:{x:d*c,y:m*f}}var _5=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,n;let{x:o,y:r,placement:s,middlewareData:i}=t,l=await oH(t,e);return s===((a=i.offset)==null?void 0:a.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:o+l.x,y:r+l.y,data:{...l,placement:s}}}}},P5=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:a,y:n,placement:o,platform:r}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:y=>{let{x:h,y:w}=y;return{x:h,y:w}}},...c}=er(e,t),f={x:a,y:n},u=await r.detectOverflow(t,c),d=So(o),m=dg(d),g=f[m],b=f[d],v=(y,h)=>yb(h+u[y==="y"?"top":"left"],h,h-u[y==="y"?"bottom":"right"]);s&&(g=v(m,g)),i&&(b=v(d,b));let x=l.fn({...t,[m]:g,[d]:b});return{...x,data:{x:x.x-a,y:x.y-n,enabled:{[m]:s,[d]:i}}}}}},O5=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,n;let{x:o,y:r,placement:s,rects:i,middlewareData:l}=t,{offset:c=0,mainAxis:f=!0,crossAxis:u=!0}=er(e,t),d={x:o,y:r},m=So(s),g=dg(m),b=d[g],v=d[m],x=er(c,t),y=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:(a=x.mainAxis)!=null?a:0,crossAxis:(n=x.crossAxis)!=null?n:0};if(f){let S=g==="y"?"height":"width",C=i.reference[g]-i.floating[S]+y.mainAxis,I=i.reference[g]+i.reference[S]-y.mainAxis;b<C?b=C:b>I&&(b=I)}if(u){var h,w;let S=g==="y"?"width":"height",C=D5.has(Mr(s)),I=i.reference[m]-i.floating[S]+(C&&((h=l.offset)==null?void 0:h[m])||0)+(C?0:y.crossAxis),L=i.reference[m]+i.reference[S]+(C?0:((w=l.offset)==null?void 0:w[m])||0)-(C?y.crossAxis:0);v<I?v=I:v>L&&(v=L)}return{[g]:b,[m]:v}}}},z5=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){let{placement:a,rects:n,platform:o,elements:r}=t,{apply:s=()=>{},...i}=er(e,t),l=await o.detectOverflow(t,i),c=Mr(a),f=Qi(a),u=So(a)==="y",{width:d,height:m}=n.floating,g,b;c==="top"||c==="bottom"?(g=c,b=f===(await(o.isRTL==null?void 0:o.isRTL(r.floating))?"start":"end")?"left":"right"):(b=c,g=f==="end"?"top":"bottom");let v=m-l.top-l.bottom,x=d-l.left-l.right,y=Qo(m-l[g],v),h=Qo(d-l[b],x),w=t.middlewareData.shift,S=!w,C=y,I=h;w!=null&&w.enabled.x&&(I=x),w!=null&&w.enabled.y&&(C=v),S&&!f&&(u?I=d-2*wo(l.left,l.right):C=m-2*wo(l.top,l.bottom)),await s({...t,availableWidth:I,availableHeight:C});let L=await o.getDimensions(r.floating);return d!==L.width||m!==L.height?{reset:{rects:!0}}:{}}}};function mg(){return typeof window<"u"}function al(e){return F5(e)?(e.nodeName||"").toLowerCase():"#document"}function Xa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function tr(e){var t;return(t=(F5(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function F5(e){return mg()?e instanceof Node||e instanceof Xa(e).Node:!1}function Co(e){return mg()?e instanceof Element||e instanceof Xa(e).Element:!1}function Er(e){return mg()?e instanceof HTMLElement||e instanceof Xa(e).HTMLElement:!1}function B5(e){return!mg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xa(e).ShadowRoot}function Hf(e){let{overflow:t,overflowX:a,overflowY:n,display:o}=ko(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+a)&&o!=="inline"&&o!=="contents"}function H5(e){return/^(table|td|th)$/.test(al(e))}function qf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}var rH=/transform|translate|scale|rotate|perspective|filter/,sH=/paint|layout|strict|content/,el=e=>!!e&&e!=="none",wb;function hg(e){let t=Co(e)?ko(e):e;return el(t.transform)||el(t.translate)||el(t.scale)||el(t.rotate)||el(t.perspective)||!gg()&&(el(t.backdropFilter)||el(t.filter))||rH.test(t.willChange||"")||sH.test(t.contain||"")}function q5(e){let t=Bs(e);for(;Er(t)&&!Ku(t);){if(hg(t))return t;if(qf(t))return null;t=Bs(t)}return null}function gg(){return wb==null&&(wb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),wb}function Ku(e){return/^(html|body|#document)$/.test(al(e))}function ko(e){return Xa(e).getComputedStyle(e)}function Uf(e){return Co(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bs(e){if(al(e)==="html")return e;let t=e.assignedSlot||e.parentNode||B5(e)&&e.host||tr(e);return B5(t)?t.host:t}function U5(e){let t=Bs(e);return Ku(t)?(e.ownerDocument||e).body:Er(t)&&Hf(t)?t:U5(t)}function tl(e,t,a){var n;t===void 0&&(t=[]),a===void 0&&(a=!0);let o=U5(e),r=o===((n=e.ownerDocument)==null?void 0:n.body),s=Xa(o);if(r){let i=xg(s);return t.concat(s,s.visualViewport||[],Hf(o)?o:[],i&&a?tl(i):[])}else return t.concat(o,tl(o,[],a))}function xg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $5(e){let t=ko(e),a=parseFloat(t.width)||0,n=parseFloat(t.height)||0,o=Er(e),r=o?e.offsetWidth:a,s=o?e.offsetHeight:n,i=Bf(a)!==r||Bf(n)!==s;return i&&(a=r,n=s),{width:a,height:n,$:i}}function Cb(e){return Co(e)?e:e.contextElement}function Zu(e){let t=Cb(e);if(!Er(t))return Jo(1);let a=t.getBoundingClientRect(),{width:n,height:o,$:r}=$5(t),s=(r?Bf(a.width):a.width)/n,i=(r?Bf(a.height):a.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!i||!Number.isFinite(i))&&(i=1),{x:s,y:i}}var iH=Jo(0);function j5(e){let t=Xa(e);return!gg()||!t.visualViewport?iH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lH(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Xa(e)}function nl(e,t,a,n){t===void 0&&(t=!1),a===void 0&&(a=!1);let o=e.getBoundingClientRect(),r=Cb(e),s=Jo(1);t&&(n?Co(n)&&(s=Zu(n)):s=Zu(e));let i=lH(r,a,n)?j5(r):Jo(0),l=(o.left+i.x)/s.x,c=(o.top+i.y)/s.y,f=o.width/s.x,u=o.height/s.y;if(r&&n){let d=Xa(r),m=Co(n)?Xa(n):n,g=d,b=xg(g);for(;b&&m!==g;){let v=Zu(b),x=b.getBoundingClientRect(),y=ko(b),h=x.left+(b.clientLeft+parseFloat(y.paddingLeft))*v.x,w=x.top+(b.clientTop+parseFloat(y.paddingTop))*v.y;l*=v.x,c*=v.y,f*=v.x,u*=v.y,l+=h,c+=w,g=Xa(b),b=xg(g)}}return Ji({width:f,height:u,x:l,y:c})}function vg(e,t){let a=Uf(e).scrollLeft;return t?t.left+a:nl(tr(e)).left+a}function W5(e,t){let a=e.getBoundingClientRect(),n=a.left+t.scrollLeft-vg(e,a),o=a.top+t.scrollTop;return{x:n,y:o}}function uH(e){let{elements:t,rect:a,offsetParent:n,strategy:o}=e,r=o==="fixed",s=tr(n),i=t?qf(t.floating):!1;if(n===s||i&&r)return a;let l={scrollLeft:0,scrollTop:0},c=Jo(1),f=Jo(0),u=Er(n);if((u||!r)&&((al(n)!=="body"||Hf(s))&&(l=Uf(n)),u)){let m=nl(n);c=Zu(n),f.x=m.x+n.clientLeft,f.y=m.y+n.clientTop}let d=s&&!u&&!r?W5(s,l):Jo(0);return{width:a.width*c.x,height:a.height*c.y,x:a.x*c.x-l.scrollLeft*c.x+f.x+d.x,y:a.y*c.y-l.scrollTop*c.y+f.y+d.y}}function cH(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function dH(e){let t=Uf(e),a=e.ownerDocument.body,n=wo(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),o=wo(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight),r=-t.scrollLeft+vg(e),s=-t.scrollTop;return ko(a).direction==="rtl"&&(r+=wo(e.clientWidth,a.clientWidth)-n),{width:n,height:o,x:r,y:s}}var fH=25;function pH(e,t,a){a===void 0&&(a="viewport");let n=a==="layoutViewport",o=Xa(e),r=tr(e),s=o.visualViewport,i=r.clientWidth,l=r.clientHeight,c=0,f=0;if(s){let d=!gg()||t==="fixed";n?d||(c=-s.offsetLeft,f=-s.offsetTop):(i=s.width,l=s.height,d&&(c=s.offsetLeft,f=s.offsetTop))}if(vg(r)<=0){let d=r.ownerDocument,m=d.body,g=getComputedStyle(m),b=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,v=Math.abs(r.clientWidth-m.clientWidth-b),x=getComputedStyle(r).scrollbarGutter==="stable both-edges"?v/2:v;x<=fH&&(i-=x)}return{width:i,height:l,x:c,y:f}}function mH(e,t){let a=nl(e,!0,t==="fixed"),n=a.top+e.clientTop,o=a.left+e.clientLeft,r=Zu(e),s=e.clientWidth*r.x,i=e.clientHeight*r.y,l=o*r.x,c=n*r.y;return{width:s,height:i,x:l,y:c}}function V5(e,t,a){let n;if(t==="viewport"||t==="layoutViewport")n=pH(e,a,t);else if(t==="document")n=dH(tr(e));else if(Co(t))n=mH(t,a);else{let o=j5(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ji(n)}function hH(e,t){let a=t.get(e);if(a)return a;let n=tl(e,[],!1).filter(i=>Co(i)&&al(i)!=="body"),o=null,r=ko(e).position==="fixed",s=r?Bs(e):e;for(;Co(s)&&!Ku(s);){let i=ko(s),l=hg(s),c=o?o.position:r?"fixed":"";!l&&(c==="fixed"||c==="absolute"&&i.position==="static")?n=n.filter(u=>u!==s):o=i,s=Bs(s)}return t.set(e,n),n}function gH(e){let{element:t,boundary:a,rootBoundary:n,strategy:o}=e,s=[...a==="clippingAncestors"?qf(t)?[]:hH(t,this._c):[].concat(a),n],i=V5(t,s[0],o),l=i.top,c=i.right,f=i.bottom,u=i.left;for(let d=1;d<s.length;d++){let m=V5(t,s[d],o);l=wo(m.top,l),c=Qo(m.right,c),f=Qo(m.bottom,f),u=wo(m.left,u)}return{width:c-u,height:f-l,x:u,y:l}}function xH(e){let{width:t,height:a}=$5(e);return{width:t,height:a}}function vH(e,t,a){let n=Er(t),o=tr(t),r=a==="fixed",s=nl(e,!0,r,t),i={scrollLeft:0,scrollTop:0},l=Jo(0);if((n||!r)&&((al(t)!=="body"||Hf(o))&&(i=Uf(t)),n)){let d=nl(t,!0,r,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}!n&&o&&(l.x=vg(o));let c=o&&!n&&!r?W5(o,i):Jo(0),f=s.left+i.scrollLeft-l.x-c.x,u=s.top+i.scrollTop-l.y-c.y;return{x:f,y:u,width:s.width,height:s.height}}function Sb(e){return ko(e).position==="static"}function G5(e,t){if(!Er(e)||ko(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return tr(e)===a&&(a=a.ownerDocument.body),a}function X5(e,t){let a=Xa(e);if(qf(e))return a;if(!Er(e)){let o=Bs(e);for(;o&&!Ku(o);){if(Co(o)&&!Sb(o))return o;o=Bs(o)}return a}let n=G5(e,t);for(;n&&H5(n)&&Sb(n);)n=G5(n,t);return n&&Ku(n)&&Sb(n)&&!hg(n)?a:n||q5(e)||a}var yH=async function(e){let t=this.getOffsetParent||X5,a=this.getDimensions,n=await a(e.floating);return{reference:vH(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function bH(e){return ko(e).direction==="rtl"}var Y5={convertOffsetParentRelativeRectToViewportRelativeRect:uH,getDocumentElement:tr,getClippingRect:gH,getOffsetParent:X5,getElementRects:yH,getClientRects:cH,getDimensions:xH,getScale:Zu,isElement:Co,isRTL:bH};function K5(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function wH(e,t,a){let n=null,o,r=tr(e);function s(){var f;clearTimeout(o),(f=n)==null||f.disconnect(),n=null}function i(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),s();let d=e.getBoundingClientRect(),{left:m,top:g,width:b,height:v}=d;if(f||t(),!b||!v)return;let x=Ff(g),y=Ff(r.clientWidth-(m+b)),h=Ff(r.clientHeight-(g+v)),w=Ff(m),C={rootMargin:-x+"px "+-y+"px "+-h+"px "+-w+"px",threshold:wo(0,Qo(1,u))||1},I=!0;function L(T){let A=T[0].intersectionRatio;if(!K5(d,e.getBoundingClientRect()))return i();if(A!==u){if(!I)return i();A?i(!1,A):o=setTimeout(()=>{i(!1,1e-7)},1e3)}I=!1}try{n=new IntersectionObserver(L,{...C,root:r.ownerDocument})}catch{n=new IntersectionObserver(L,C)}n.observe(e)}let l=Xa(e),c=()=>i(a);return l.addEventListener("resize",c),i(!0),()=>{l.removeEventListener("resize",c),s()}}function kb(e,t,a,n){n===void 0&&(n={});let{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=Cb(e),f=o||r?[...c?tl(c):[],...t?tl(t):[]]:[];f.forEach(x=>{o&&x.addEventListener("scroll",a),r&&x.addEventListener("resize",a)});let u=c&&i?wH(c,a,r):null,d=-1,m=null;s&&(m=new ResizeObserver(x=>{let[y]=x;y&&y.target===c&&m&&t&&(m.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var h;(h=m)==null||h.observe(t)})),a()}),c&&!l&&m.observe(c),t&&m.observe(t));let g,b=l?nl(e):null;l&&v();function v(){let x=nl(e);b&&!K5(b,x)&&a(),b=x,g=requestAnimationFrame(v)}return a(),()=>{var x;f.forEach(y=>{o&&y.removeEventListener("scroll",a),r&&y.removeEventListener("resize",a)}),u?.(),(x=m)==null||x.disconnect(),m=null,l&&cancelAnimationFrame(g)}}var Z5=_5;var Q5=P5,J5=E5,eT=z5,tT=A5,Lb=M5;var aT=O5,Ib=(e,t,a)=>{let n=new Map,o=a??{},r={...Y5,...o.platform,_c:n};return T5(e,t,{...o,platform:r})};var Ut=j(he(),1),oT=j(he(),1),rT=j($r(),1),SH=typeof document<"u",CH=function(){},yg=SH?oT.useLayoutEffect:CH;function bg(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 a,n,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(n=a;n--!==0;)if(!bg(e[n],t[n]))return!1;return!0}if(o=Object.keys(e),a=o.length,a!==Object.keys(t).length)return!1;for(n=a;n--!==0;)if(!{}.hasOwnProperty.call(t,o[n]))return!1;for(n=a;n--!==0;){let r=o[n];if(!(r==="_owner"&&e.$$typeof)&&!bg(e[r],t[r]))return!1}return!0}return e!==e&&t!==t}function sT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nT(e,t){let a=sT(e);return Math.round(t*a)/a}function Nb(e){let t=Ut.useRef(e);return yg(()=>{t.current=e}),t}function iT(e){e===void 0&&(e={});let{placement:t="bottom",strategy:a="absolute",middleware:n=[],platform:o,elements:{reference:r,floating:s}={},transform:i=!0,whileElementsMounted:l,open:c}=e,[f,u]=Ut.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[d,m]=Ut.useState(n);bg(d,n)||m(n);let[g,b]=Ut.useState(null),[v,x]=Ut.useState(null),y=Ut.useCallback(z=>{z!==C.current&&(C.current=z,b(z))},[]),h=Ut.useCallback(z=>{z!==I.current&&(I.current=z,x(z))},[]),w=r||g,S=s||v,C=Ut.useRef(null),I=Ut.useRef(null),L=Ut.useRef(f),T=l!=null,A=Nb(l),D=Nb(o),H=Nb(c),V=Ut.useCallback(()=>{if(!C.current||!I.current)return;let z={placement:t,strategy:a,middleware:d};D.current&&(z.platform=D.current),Ib(C.current,I.current,z).then(q=>{let O={...q,isPositioned:H.current!==!1};N.current&&!bg(L.current,O)&&(L.current=O,rT.flushSync(()=>{u(O)}))})},[d,t,a,D,H]);yg(()=>{c===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,u(z=>({...z,isPositioned:!1})))},[c]);let N=Ut.useRef(!1);yg(()=>(N.current=!0,()=>{N.current=!1}),[]),yg(()=>{if(w&&(C.current=w),S&&(I.current=S),w&&S){if(A.current)return A.current(w,S,V);V()}},[w,S,V,A,T]);let P=Ut.useMemo(()=>({reference:C,floating:I,setReference:y,setFloating:h}),[y,h]),E=Ut.useMemo(()=>({reference:w,floating:S}),[w,S]),_=Ut.useMemo(()=>{let z={position:a,left:0,top:0};if(!E.floating)return z;let q=nT(E.floating,f.x),O=nT(E.floating,f.y);return i?{...z,transform:"translate("+q+"px, "+O+"px)",...sT(E.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:q,top:O}},[a,i,E.floating,f.x,f.y]);return Ut.useMemo(()=>({...f,update:V,refs:P,elements:E,floatingStyles:_}),[f,V,P,E,_])}var kH=e=>{function t(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:e,fn(a){let{element:n,padding:o}=typeof e=="function"?e(a):e;return n&&t(n)?n.current!=null?Lb({element:n.current,padding:o}).fn(a):{}:n?Lb({element:n,padding:o}).fn(a):{}}}},lT=(e,t)=>{let a=Z5(e);return{name:a.name,fn:a.fn,options:[e,t]}},uT=(e,t)=>{let a=Q5(e);return{name:a.name,fn:a.fn,options:[e,t]}},cT=(e,t)=>({fn:aT(e).fn,options:[e,t]}),dT=(e,t)=>{let a=J5(e);return{name:a.name,fn:a.fn,options:[e,t]}},fT=(e,t)=>{let a=eT(e);return{name:a.name,fn:a.fn,options:[e,t]}};var pT=(e,t)=>{let a=tT(e);return{name:a.name,fn:a.fn,options:[e,t]}};var mT=(e,t)=>{let a=kH(e);return{name:a.name,fn:a.fn,options:[e,t]}};var Qu=j(fe(),1),LH=Object.defineProperty,Fs=(e,t)=>LH(e,"name",{value:t,configurable:!0});var hT="Popper",[gT,Ju]=xt(hT),[IH,xT]=gT(hT),NH=Fs(e=>{let{__scopePopper:t,children:a}=e,[n,o]=Oa.useState(null),[r,s]=Oa.useState(void 0);return(0,Qu.jsx)(IH,{scope:t,anchor:n,onAnchorChange:o,placementState:r,setPlacementState:s,children:a})},"Popper"),RH="PopperAnchor",TH=Oa.forwardRef(Fs(function(t,a){let{__scopePopper:n,virtualRef:o,...r}=t,s=xT(RH,n),i=Oa.useRef(null),l=s.onAnchorChange,c=Oa.useCallback(b=>{i.current=b,b&&l(b)},[l]),f=Te(a,c),u=Oa.useRef(null);Oa.useEffect(()=>{if(!o)return;let b=u.current;u.current=o.current,b!==u.current&&l(u.current)});let d=s.placementState&&wg(s.placementState),m=d?.[0],g=d?.[1];return o?null:(0,Qu.jsx)(Re.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...r,ref:f})},"PopperAnchor")),vT="PopperContent",[MH,cre]=gT(vT),EH=Oa.forwardRef(Fs(function(t,a){let{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:b,...v}=t,x=xT(vT,n),[y,h]=Oa.useState(null),w=Te(a,h),[S,C]=Oa.useState(null),I=Zi(S),L=I?.width??0,T=I?.height??0,A=o+(s!=="center"?"-"+s:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},H=Array.isArray(f)?f:[f],V=H.length>0,N={padding:D,boundary:H.filter(yT),altBoundary:V},{refs:P,floatingStyles:E,placement:_,isPositioned:z,middlewareData:q}=iT({strategy:"fixed",placement:A,whileElementsMounted:Fs((...M)=>kb(...M,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:x.anchor},middleware:[lT({mainAxis:r+T,alignmentAxis:i}),c&&uT({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?cT():void 0,...N}),c&&dT({...N}),fT({...N,apply:Fs(({elements:M,rects:se,availableWidth:le,availableHeight:B})=>{let{width:G,height:oe}=se.reference,Y=M.floating.style;Y.setProperty("--radix-popper-available-width",`${le}px`),Y.setProperty("--radix-popper-available-height",`${B}px`),Y.setProperty("--radix-popper-anchor-width",`${G}px`),Y.setProperty("--radix-popper-anchor-height",`${oe}px`)},"apply")}),S&&mT({element:S,padding:l}),AH({arrowWidth:L,arrowHeight:T}),m&&pT({strategy:"referenceHidden",...N,boundary:V?N.boundary:void 0})]}),O=x.setPlacementState;Ze(()=>(O(_),()=>{O(void 0)}),[_,O]);let[W,ee]=wg(_),de=oa(b);Ze(()=>{z&&de?.()},[z,de]);let ne=q.arrow?.x,re=q.arrow?.y,ue=q.arrow?.centerOffset!==0,[ce,U]=Oa.useState();return Ze(()=>{y&&U(window.getComputedStyle(y).zIndex)},[y]),(0,Qu.jsx)("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...E,transform:z?E.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:(0,Qu.jsx)(MH,{scope:n,placedSide:W,placedAlign:ee,onArrowChange:C,arrowX:ne,arrowY:re,shouldHideArrow:ue,children:(0,Qu.jsx)(Re.div,{"data-side":W,"data-align":ee,...v,ref:w,style:{...v.style,animation:z?v.style?.animation:"none"}})})})},"PopperContent"));function yT(e){return e!==null}Fs(yT,"isNotNull");var AH=Fs(e=>({name:"transformOrigin",options:e,fn(t){let{placement:a,rects:n,middlewareData:o}=t,s=o.arrow?.centerOffset!==0,i=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,f]=wg(a),u={start:"0%",center:"50%",end:"100%"}[f],d=(o.arrow?.x??0)+i/2,m=(o.arrow?.y??0)+l/2,g="",b="";return c==="bottom"?(g=s?u:`${d}px`,b=`${-l}px`):c==="top"?(g=s?u:`${d}px`,b=`${n.floating.height+l}px`):c==="right"?(g=`${-l}px`,b=s?u:`${m}px`):c==="left"&&(g=`${n.floating.width+l}px`,b=s?u:`${m}px`),{data:{x:g,y:b}}}}),"transformOrigin");function wg(e){let[t,a="center"]=e.split("-");return[t,a]}Fs(wg,"getSideAndAlignFromPlacement");var Sg=NH,Cg=TH,kg=EH;var Lg=j(he(),1),DH=Object.defineProperty,_H=(e,t)=>DH(e,"name",{value:t,configurable:!0});function Rb(e){let t=Lg.useRef({value:e,previous:e});return Lg.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}_H(Rb,"usePrevious");var PH=j(he(),1);var OH=j(fe(),1);var wT=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});var Ee=j(fe(),1),BH=Object.defineProperty,rt=(e,t)=>BH(e,"name",{value:t,configurable:!0}),FH=[" ","Enter","ArrowUp","ArrowDown"],HH=[" ","Enter"],ec="Select",[Ng,Eb,qH]=Yi(ec),[rl,Pre]=xt(ec,[qH,Ju]),Ab=Ju(),[UH,Hs]=rl(ec),[VH,GH]=rl(ec);function kT(e){let{__scopeSelect:t,children:a,open:n,defaultOpen:o,onOpenChange:r,value:s,defaultValue:i,onValueChange:l,dir:c,name:f,autoComplete:u,disabled:d,required:m,form:g,internal_do_not_use_render:b}=e,v=Ab(t),[x,y]=xe.useState(null),[h,w]=xe.useState(null),[S,C]=xe.useState(!1),I=Tr(c),[L,T]=Ma({prop:n,defaultProp:o??!1,onChange:r,caller:ec}),[A,D]=Ma({prop:s,defaultProp:i,onChange:l,caller:ec}),H=xe.useRef(null),V=xe.useRef(A);xe.useEffect(()=>{let ee=g?x?.ownerDocument.getElementById(g):x?.form;if(ee instanceof HTMLFormElement){let de=rt(()=>D(V.current),"reset");return ee.addEventListener("reset",de),()=>ee.removeEventListener("reset",de)}},[g,x,D]);let N=x?!!g||!!x.closest("form"):!0,[P,E]=xe.useState(new Set),_=Ga(),z=Array.from(P).map(ee=>ee.props.value).join(";"),q=xe.useCallback(ee=>{E(de=>new Set(de).add(ee))},[]),O=xe.useCallback(ee=>{E(de=>{let ne=new Set(de);return ne.delete(ee),ne})},[]),W={required:m,trigger:x,onTriggerChange:y,valueNode:h,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:_,value:A,onValueChange:D,open:L,onOpenChange:T,dir:I,triggerPointerDownPosRef:H,disabled:d,name:f,autoComplete:u,form:g,nativeOptions:P,nativeSelectKey:z,isFormControl:N};return(0,Ee.jsx)(Sg,{...v,children:(0,Ee.jsx)(UH,{scope:t,...W,children:(0,Ee.jsx)(Ng.Provider,{scope:t,children:(0,Ee.jsx)(VH,{scope:t,onNativeOptionAdd:q,onNativeOptionRemove:O,children:zT(b)?b(W):a})})})})}rt(kT,"SelectProvider");var LT=rt(e=>{let{__scopeSelect:t,children:a,...n}=e;return(0,Ee.jsx)(kT,{__scopeSelect:t,...n,internal_do_not_use_render:({isFormControl:o})=>(0,Ee.jsxs)(Ee.Fragment,{children:[a,o?(0,Ee.jsx)(sq,{__scopeSelect:t}):null]})})},"Select"),$H="SelectTrigger",IT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,disabled:o=!1,...r}=t,s=Ab(n),i=Hs($H,n),l=i.disabled||o,c=Te(a,i.onTriggerChange),f=Eb(n),u=xe.useRef("touch"),[d,m,g]=Db(v=>{let x=f().filter(w=>!w.disabled),y=x.find(w=>w.value===i.value),h=_b(x,v,y);h!==void 0&&i.onValueChange(h.value)}),b=rt(v=>{l||(i.onOpenChange(!0),g()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})},"handleOpen");return(0,Ee.jsx)(Cg,{asChild:!0,...s,children:(0,Ee.jsx)(Re.button,{type:"button",role:"combobox","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Vf(i.value)?"":void 0,...r,ref:c,onClick:ke(r.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&b(v)}),onPointerDown:ke(r.onPointerDown,v=>{u.current=v.pointerType;let x=v.target;x.hasPointerCapture(v.pointerId)&&x.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(b(v),v.preventDefault())}),onKeyDown:ke(r.onKeyDown,v=>{let x=d.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&m(v.key),!(x&&v.key===" ")&&FH.includes(v.key)&&(b(),v.preventDefault())})})})},"SelectTrigger")),jH="SelectValue",NT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,className:o,style:r,children:s,placeholder:i="",...l}=t,c=Hs(jH,n),{onValueNodeHasChildrenChange:f}=c,u=s!==void 0,d=Te(a,c.onValueNodeChange);Ze(()=>{f(u)},[f,u]);let m=Vf(c.value);return(0,Ee.jsx)(Re.span,{...l,asChild:m?!1:l.asChild,ref:d,style:{pointerEvents:"none"},children:(0,Ee.jsx)(xe.Fragment,{children:m?i:s},m?"placeholder":"value")})},"SelectValue")),RT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,children:o,...r}=t;return(0,Ee.jsx)(Re.span,{"aria-hidden":!0,...r,ref:a,children:o||"▼"})},"SelectIcon")),WH="SelectPortal",[XH,YH]=rl(WH,{forceMount:void 0}),TT=rt(e=>{let{__scopeSelect:t,forceMount:a,...n}=e;return(0,Ee.jsx)(XH,{scope:e.__scopeSelect,forceMount:a,children:(0,Ee.jsx)(Au,{asChild:!0,...n})})},"SelectPortal"),ol="SelectContent",MT=xe.forwardRef(rt(function(t,a){let n=YH(ol,t.__scopeSelect),{forceMount:o=n.forceMount,...r}=t,s=Hs(ol,t.__scopeSelect),[i,l]=xe.useState();return Ze(()=>{l(new DocumentFragment)},[]),(0,Ee.jsx)(An,{present:o||s.open,children:({present:c})=>c?(0,Ee.jsx)(QH,{...r,ref:a}):(0,Ee.jsx)(KH,{...r,fragment:i})})},"SelectContent")),KH=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,children:o,fragment:r}=t;return r?Mb.createPortal((0,Ee.jsx)(ET,{scope:n,children:(0,Ee.jsx)(Ng.Slot,{scope:n,children:(0,Ee.jsx)("div",{ref:a,children:o})})}),r):null},"SelectContentFragment")),Lo=10,[ET,Rg]=rl(ol),ZH=Ea("SelectContent.RemoveScroll"),QH=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n}=t,{position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:f,alignOffset:u,arrowPadding:d,collisionBoundary:m,collisionPadding:g,sticky:b,hideWhenDetached:v,avoidCollisions:x,...y}=t,h=Hs(ol,n),[w,S]=xe.useState(null),[C,I]=xe.useState(null),L=Te(a,S),[T,A]=xe.useState(null),[D,H]=xe.useState(null),V=Eb(n),[N,P]=xe.useState(!1),E=xe.useRef(!1);xe.useEffect(()=>{if(w)return Fu(w)},[w]),ws();let _=xe.useCallback(U=>{let[M,...se]=V().map(G=>G.ref.current),[le]=se.slice(-1),B=document.activeElement;for(let G of U)if(G===B||(G?.scrollIntoView({block:"nearest"}),G===M&&C&&(C.scrollTop=0),G===le&&C&&(C.scrollTop=C.scrollHeight),G?.focus(),document.activeElement!==B))return},[V,C]),z=xe.useCallback(()=>_([T,w]),[_,T,w]);xe.useEffect(()=>{N&&z()},[N,z]);let{onOpenChange:q,triggerPointerDownPosRef:O}=h;xe.useEffect(()=>{if(w){let U={x:0,y:0},M=rt(le=>{U={x:Math.abs(Math.round(le.pageX)-(O.current?.x??0)),y:Math.abs(Math.round(le.pageY)-(O.current?.y??0))}},"handlePointerMove"),se=rt(le=>{U.x<=10&&U.y<=10?le.preventDefault():le.composedPath().includes(w)||q(!1),document.removeEventListener("pointermove",M),O.current=null},"handlePointerUp");return O.current!==null&&(document.addEventListener("pointermove",M),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",M),document.removeEventListener("pointerup",se,{capture:!0})}}},[w,q,O]),xe.useEffect(()=>{let U=rt(()=>q(!1),"close");return window.addEventListener("blur",U),window.addEventListener("resize",U),()=>{window.removeEventListener("blur",U),window.removeEventListener("resize",U)}},[q]);let[W,ee]=Db(U=>{let M=V().filter(B=>!B.disabled),se=M.find(B=>B.ref.current===document.activeElement),le=_b(M,U,se);le&&setTimeout(()=>le.ref.current?.focus())}),de=xe.useCallback((U,M,se)=>{let le=!E.current&&!se;(h.value!==void 0&&h.value===M||le)&&(A(U),le&&(E.current=!0))},[h.value]),ne=xe.useCallback(()=>w?.focus(),[w]),re=xe.useCallback((U,M,se)=>{let le=!E.current&&!se;(h.value!==void 0&&h.value===M||le)&&H(U)},[h.value]),ue=o==="popper"?ST:JH,ce=ue===ST?{side:l,sideOffset:c,align:f,alignOffset:u,arrowPadding:d,collisionBoundary:m,collisionPadding:g,sticky:b,hideWhenDetached:v,avoidCollisions:x}:{};return(0,Ee.jsx)(ET,{scope:n,content:w,viewport:C,onViewportChange:I,itemRefCallback:de,selectedItem:T,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:z,selectedItemText:D,position:o,isPositioned:N,searchRef:W,children:(0,Ee.jsx)(Ai,{as:ZH,allowPinchZoom:!0,children:(0,Ee.jsx)(Eu,{asChild:!0,trapped:h.open,onMountAutoFocus:U=>{U.preventDefault()},onUnmountAutoFocus:ke(r,U=>{h.trigger?.focus({preventScroll:!0}),U.preventDefault()}),children:(0,Ee.jsx)(Mu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:U=>U.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:(0,Ee.jsx)(ue,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:U=>U.preventDefault(),...y,...ce,onPlaced:()=>P(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ke(y.onKeyDown,U=>{let M=U.ctrlKey||U.altKey||U.metaKey;if(U.key==="Tab"&&U.preventDefault(),!M&&U.key.length===1&&ee(U.key),["ArrowUp","ArrowDown","Home","End"].includes(U.key)){let le=V().filter(B=>!B.disabled).map(B=>B.ref.current);if(["ArrowUp","End"].includes(U.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(U.key)){let B=U.target,G=le.indexOf(B);le=le.slice(G+1)}setTimeout(()=>_(le)),U.preventDefault()}})})})})})})},"SelectContentImpl")),JH=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,onPlaced:o,...r}=t,s=Hs(ol,n),i=Rg(ol,n),[l,c]=xe.useState(null),[f,u]=xe.useState(null),d=Te(a,u),m=Eb(n),g=xe.useRef(!1),b=xe.useRef(!0),{viewport:v,selectedItem:x,selectedItemText:y,focusSelectedItem:h}=i,w=xe.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&f&&v&&x&&y){let L=s.trigger.getBoundingClientRect(),T=f.getBoundingClientRect(),A=s.valueNode.getBoundingClientRect(),D=y.getBoundingClientRect();if(s.dir!=="rtl"){let B=D.left-T.left,G=A.left-B,oe=L.left-G,Y=L.width+oe,Le=Math.max(Y,T.width),ze=window.innerWidth-Lo,bt=ug(G,[Lo,Math.max(Lo,ze-Le)]);l.style.minWidth=Y+"px",l.style.left=bt+"px"}else{let B=T.right-D.right,G=window.innerWidth-A.right-B,oe=window.innerWidth-L.right-G,Y=L.width+oe,Le=Math.max(Y,T.width),ze=window.innerWidth-Lo,bt=ug(G,[Lo,Math.max(Lo,ze-Le)]);l.style.minWidth=Y+"px",l.style.right=bt+"px"}let H=m(),V=window.innerHeight-Lo*2,N=v.scrollHeight,P=window.getComputedStyle(f),E=parseInt(P.borderTopWidth,10),_=parseInt(P.paddingTop,10),z=parseInt(P.borderBottomWidth,10),q=parseInt(P.paddingBottom,10),O=E+_+N+q+z,W=Math.min(x.offsetHeight*5,O),ee=window.getComputedStyle(v),de=parseInt(ee.paddingTop,10),ne=parseInt(ee.paddingBottom,10),re=L.top+L.height/2-Lo,ue=V-re,ce=x.offsetHeight/2,U=x.offsetTop+ce,M=E+_+U,se=O-M;if(M<=re){let B=H.length>0&&x===H[H.length-1].ref.current;l.style.bottom="0px";let G=f.clientHeight-v.offsetTop-v.offsetHeight,oe=Math.max(ue,ce+(B?ne:0)+G+z),Y=M+oe;l.style.height=Y+"px"}else{let B=H.length>0&&x===H[0].ref.current;l.style.top="0px";let oe=Math.max(re,E+v.offsetTop+(B?de:0)+ce)+se;l.style.height=oe+"px",v.scrollTop=M-re+v.offsetTop}l.style.margin=`${Lo}px 0`,l.style.minHeight=W+"px",l.style.maxHeight=V+"px",o?.(),requestAnimationFrame(()=>g.current=!0)}},[m,s.trigger,s.valueNode,l,f,v,x,y,s.dir,o]);Ze(()=>w(),[w]);let[S,C]=xe.useState();Ze(()=>{f&&C(window.getComputedStyle(f).zIndex)},[f]);let I=xe.useCallback(L=>{L&&b.current===!0&&(w(),h?.(),b.current=!1)},[w,h]);return(0,Ee.jsx)(eq,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:I,children:(0,Ee.jsx)("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:(0,Ee.jsx)(Re.div,{...r,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})},"SelectItemAlignedPosition")),ST=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,align:o="start",collisionPadding:r=Lo,...s}=t,i=Ab(n);return(0,Ee.jsx)(kg,{...i,...s,ref:a,align:o,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[eq,tq]=rl(ol,{}),CT="SelectViewport",AT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,nonce:o,...r}=t,s=Rg(CT,n),i=tq(CT,n),l=Te(a,s.onViewportChange),c=xe.useRef(0);return(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),(0,Ee.jsx)(Ng.Slot,{scope:n,children:(0,Ee.jsx)(Re.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:ke(r.onScroll,f=>{let u=f.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:m}=i;if(m?.current&&d){let g=Math.abs(c.current-u.scrollTop);if(g>0){let b=window.innerHeight-Lo*2,v=parseFloat(d.style.minHeight),x=parseFloat(d.style.height),y=Math.max(v,x);if(y<b){let h=y+g,w=Math.min(b,h),S=h-w;d.style.height=w+"px",d.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,d.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})},"SelectViewport")),aq="SelectGroup",[Ore,zre]=rl(aq);var Tb="SelectItem",[nq,DT]=rl(Tb),_T=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,value:o,disabled:r=!1,textValue:s,...i}=t,l=Hs(Tb,n),c=Rg(Tb,n),f=l.value===o,[u,d]=xe.useState(s??""),[m,g]=xe.useState(!1),b=oa(w=>c.itemRefCallback?.(w,o,r)),v=Te(a,b),x=Ga(),y=xe.useRef("touch"),h=rt(()=>{r||(l.onValueChange(o),l.onOpenChange(!1))},"handleSelect");return(0,Ee.jsx)(nq,{scope:n,value:o,disabled:r,textId:x,isSelected:f,onItemTextChange:xe.useCallback(w=>{d(S=>S||(w?.textContent??"").trim())},[]),children:(0,Ee.jsx)(Ng.ItemSlot,{scope:n,value:o,disabled:r,textValue:u,children:(0,Ee.jsx)(Re.div,{role:"option","aria-labelledby":x,"data-highlighted":m?"":void 0,"aria-selected":f&&m,"data-state":f?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...i,ref:v,onFocus:ke(i.onFocus,()=>g(!0)),onBlur:ke(i.onBlur,()=>g(!1)),onClick:ke(i.onClick,()=>{y.current!=="mouse"&&h()}),onPointerUp:ke(i.onPointerUp,()=>{y.current==="mouse"&&h()}),onPointerDown:ke(i.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:ke(i.onPointerMove,w=>{y.current=w.pointerType,r?c.onItemLeave?.():y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ke(i.onPointerLeave,w=>{w.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ke(i.onKeyDown,w=>{r||w.target!==w.currentTarget||c.searchRef?.current!==""&&w.key===" "||(HH.includes(w.key)&&h(),w.key===" "&&w.preventDefault())})})})})},"SelectItem")),Ig="SelectItemText",PT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,className:o,style:r,...s}=t,i=Hs(Ig,n),l=Rg(Ig,n),c=DT(Ig,n),f=GH(Ig,n),[u,d]=xe.useState(null),m=oa(h=>l.itemTextRefCallback?.(h,c.value,c.disabled)),g=Te(a,d,c.onItemTextChange,m),b=u?.textContent,v=xe.useMemo(()=>(0,Ee.jsx)("option",{value:c.value,disabled:c.disabled,children:b},c.value),[c.disabled,c.value,b]),{onNativeOptionAdd:x,onNativeOptionRemove:y}=f;return Ze(()=>(x(v),()=>y(v)),[x,y,v]),(0,Ee.jsxs)(Ee.Fragment,{children:[(0,Ee.jsx)(Re.span,{id:c.textId,...s,ref:g}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren&&!Vf(i.value)?Mb.createPortal(s.children,i.valueNode):null]})},"SelectItemText")),oq="SelectItemIndicator",OT=xe.forwardRef(rt(function(t,a){let{__scopeSelect:n,...o}=t;return DT(oq,n).isSelected?(0,Ee.jsx)(Re.span,{"aria-hidden":!0,...o,ref:a}):null},"SelectItemIndicator"));var rq="SelectBubbleInput",sq=xe.forwardRef(rt(function({__scopeSelect:t,...a},n){let o=Hs(rq,t),{value:r,onValueChange:s,required:i,disabled:l,name:c,autoComplete:f,form:u}=o,{nativeOptions:d,nativeSelectKey:m}=o,g=xe.useRef(null),b=Te(n,g),v=r??"",x=Rb(v),y=Array.from(d).some(h=>(h.props.value??"")==="");return xe.useEffect(()=>{let h=g.current;if(!h)return;let w=window.HTMLSelectElement.prototype,C=Object.getOwnPropertyDescriptor(w,"value").set;if(x!==v&&C){let I=new Event("change",{bubbles:!0});C.call(h,v),h.dispatchEvent(I)}},[x,v]),(0,Ee.jsxs)(Re.select,{"aria-hidden":!0,required:i,tabIndex:-1,name:c,autoComplete:f,disabled:l,form:u,onChange:h=>s(h.target.value),...a,style:{...wT,...a.style},ref:b,defaultValue:v,children:[Vf(r)&&!y?(0,Ee.jsx)("option",{value:""}):null,Array.from(d)]},m)},"SelectBubbleInput"));function zT(e){return typeof e=="function"}rt(zT,"isFunction");function Vf(e){return e===""||e===void 0}rt(Vf,"shouldShowPlaceholder");function Db(e){let t=oa(e),a=xe.useRef(""),n=xe.useRef(0),o=xe.useCallback(s=>{let i=a.current+s;t(i),rt((function l(c){a.current=c,window.clearTimeout(n.current),c!==""&&(n.current=window.setTimeout(()=>l(""),1e3))}),"updateSearch")(i)},[t]),r=xe.useCallback(()=>{a.current="",window.clearTimeout(n.current)},[]);return xe.useEffect(()=>()=>window.clearTimeout(n.current),[]),[a,o,r]}rt(Db,"useTypeaheadSearch");function _b(e,t,a){let o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,r=a?e.indexOf(a):-1,s=BT(e,Math.max(r,0));o.length===1&&(s=s.filter(c=>c!==a));let l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==a?l:void 0}rt(_b,"findNextItem");function BT(e,t){return e.map((a,n)=>e[(t+n)%e.length])}rt(BT,"wrapArray");var Pn=j(fe(),1),Gf=LT,$f=NT;function jf({className:e,children:t,...a}){return(0,Pn.jsxs)(IT,{"data-slot":"select-trigger",className:te("flex h-8 w-full items-center justify-between gap-2 rounded-md border border-input bg-card px-2.5 text-[13px] outline-none focus-visible:ring-2 focus-visible:ring-ring phone:h-11 phone:text-base [&>span]:truncate",e),...a,children:[t,(0,Pn.jsx)(RT,{asChild:!0,children:(0,Pn.jsx)(Xo,{className:"size-4 opacity-60"})})]})}function Wf({className:e,children:t,position:a="popper",...n}){return(0,Pn.jsx)(TT,{children:(0,Pn.jsx)(MT,{"data-slot":"select-content",position:a,sideOffset:4,className:te("relative z-[120] max-h-[min(22rem,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-lg",e),...n,children:(0,Pn.jsx)(AT,{className:"p-1",children:t})})})}function tc({className:e,children:t,...a}){return(0,Pn.jsxs)(_T,{"data-slot":"select-item",className:te("relative flex w-full cursor-default select-none items-center rounded-[5px] py-1.5 pr-8 pl-2 text-[13px] outline-none data-[highlighted]:bg-accent data-[disabled]:opacity-50 phone:min-h-11",e),...a,children:[(0,Pn.jsx)(PT,{children:t}),(0,Pn.jsx)("span",{className:"absolute right-2 flex size-4 items-center justify-center",children:(0,Pn.jsx)(OT,{children:(0,Pn.jsx)(ja,{className:"size-4"})})})]})}var Vt=j(he(),1);var no=j(fe(),1),lq=Object.defineProperty,qs=(e,t)=>lq(e,"name",{value:t,configurable:!0}),Pb="Switch",[uq,Wre]=xt(Pb),[cq,Ob]=uq(Pb);function FT(e){let{__scopeSwitch:t,checked:a,children:n,defaultChecked:o,disabled:r,form:s,name:i,onCheckedChange:l,required:c,value:f="on",internal_do_not_use_render:u}=e,[d,m]=Ma({prop:a,defaultProp:o??!1,onChange:l,caller:Pb}),[g,b]=Vt.useState(null),[v,x]=Vt.useState(null),y=Vt.useRef(!1),[h,w]=Vt.useReducer(I=>I+1,0),S=g?!!s||!!g.closest("form"):!0,C={checked:d,setChecked:m,disabled:r,control:g,setControl:b,name:i,form:s,value:f,hasConsumerStoppedPropagationRef:y,userInteractionCount:h,onUserInteraction:w,required:c,defaultChecked:o,isFormControl:S,bubbleInput:v,setBubbleInput:x};return(0,no.jsx)(cq,{scope:t,...C,children:UT(u)?u(C):n})}qs(FT,"SwitchProvider");var dq="SwitchTrigger",fq=Vt.forwardRef(qs(function({__scopeSwitch:t,onClick:a,...n},o){let{control:r,form:s,value:i,disabled:l,checked:c,required:f,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:b,bubbleInput:v}=Ob(dq,t),x=Te(o,u),y=Vt.useRef(c);return Vt.useEffect(()=>{let h=s?r?.ownerDocument.getElementById(s):r?.form;if(h instanceof HTMLFormElement){let w=qs(()=>d(y.current),"reset");return h.addEventListener("reset",w),()=>h.removeEventListener("reset",w)}},[r,s,d]),(0,no.jsx)(Re.button,{type:"button",role:"switch","aria-checked":c,"aria-required":f,"data-state":zb(c),"data-disabled":l?"":void 0,disabled:l,value:i,...n,ref:x,onClick:ke(a,h=>{g(),d(w=>!w),v&&b&&(m.current=h.isPropagationStopped(),m.current||h.stopPropagation())})})},"SwitchTrigger")),HT=Vt.forwardRef(qs(function(t,a){let{__scopeSwitch:n,name:o,checked:r,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:f,form:u,...d}=t;return(0,no.jsx)(FT,{__scopeSwitch:n,checked:r,defaultChecked:s,disabled:l,required:i,onCheckedChange:f,name:o,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>(0,no.jsxs)(no.Fragment,{children:[(0,no.jsx)(fq,{...d,ref:a,__scopeSwitch:n}),m&&(0,no.jsx)(hq,{__scopeSwitch:n})]})})},"Switch")),pq="SwitchThumb",qT=Vt.forwardRef(qs(function(t,a){let{__scopeSwitch:n,...o}=t,r=Ob(pq,n);return(0,no.jsx)(Re.span,{"data-state":zb(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:a})},"SwitchThumb")),mq="SwitchBubbleInput",hq=Vt.forwardRef(qs(function({__scopeSwitch:t,onClick:a,...n},o){let{control:r,hasConsumerStoppedPropagationRef:s,userInteractionCount:i,checked:l,defaultChecked:c,required:f,disabled:u,name:d,value:m,form:g,bubbleInput:b,setBubbleInput:v}=Ob(mq,t),x=Te(o,v),y=Zi(r),h=Vt.useRef(!1),w=Vt.useRef(l),S=Vt.useRef(i);Vt.useEffect(()=>{let I=b;if(!I)return;let L=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(L,"checked").set,D=i!==S.current;S.current=i;let H=w.current!==l;w.current=l;let V=!(D&&s.current);if(H&&A){h.current=!D;let N=new Event("click",{bubbles:V});A.call(I,l),I.dispatchEvent(N),h.current=!1}},[b,l,s,i]);let C=Vt.useRef(l);return(0,no.jsx)(Re.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??C.current,required:f,disabled:u,name:d,value:m,form:g,...n,tabIndex:-1,ref:x,onClick:ke(a,I=>{h.current&&I.stopPropagation()}),style:{...n.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function UT(e){return typeof e=="function"}qs(UT,"isFunction");function zb(e){return e?"checked":"unchecked"}qs(zb,"getState");var Bb=j(fe(),1);function Fb({className:e,...t}){return(0,Bb.jsx)(HT,{"data-slot":"switch",className:te("relative inline-flex h-6 w-11 shrink-0 items-center rounded-full phone:after:absolute phone:after:-inset-x-0.5 phone:after:-inset-y-[12px] border-2 border-transparent bg-input transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=checked]:bg-primary",e),...t,children:(0,Bb.jsx)(qT,{className:"pointer-events-none block size-5 rounded-full bg-card shadow transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0"})})}var VT=j(he(),1);var GT=j(fe(),1),xq=Object.defineProperty,vq=(e,t)=>xq(e,"name",{value:t,configurable:!0}),yq=VT.forwardRef(vq(function(t,a){return(0,GT.jsx)(Re.label,{...t,ref:a,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(t.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}})},"Label")),$T=yq;var XT=j(he(),1);var YT=j(fe(),1),wq=Object.defineProperty,WT=(e,t)=>wq(e,"name",{value:t,configurable:!0}),jT="horizontal",Sq=["horizontal","vertical"],Cq=XT.forwardRef(WT(function(t,a){let{decorative:n,orientation:o=jT,...r}=t,s=KT(o)?o:jT,l=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return(0,YT.jsx)(Re.div,{"data-orientation":s,...l,...r,ref:a})},"Separator"));function KT(e){return Sq.includes(e)}WT(KT,"isValidOrientation");var ZT=Cq;var Xf=j(fe(),1);function Ct({className:e,...t}){return(0,Xf.jsx)($T,{"data-slot":"label",className:te("flex items-center gap-2 text-sm font-medium leading-none",e),...t})}function ve({className:e,type:t,...a}){return(0,Xf.jsx)("input",{type:t,"data-slot":"input",className:te("flex h-8 w-full min-w-0 rounded-md border border-input bg-card px-2.5 text-[13px] outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring phone:h-11 phone:text-base",e),...a})}function zt({className:e,...t}){return(0,Xf.jsx)("textarea",{"data-slot":"textarea",className:te("flex min-h-20 w-full rounded-md border border-input bg-card px-2.5 py-2 text-[13px] outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring phone:text-base",e),...t})}function ac({className:e,orientation:t="horizontal",...a}){return(0,Xf.jsx)(ZT,{"data-slot":"separator",orientation:t,className:te("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...a})}var ka=j(he(),1);var sl=j(fe(),1),Lq=Object.defineProperty,Yf=(e,t)=>Lq(e,"name",{value:t,configurable:!0}),Hb="Collapsible",[Iq,lse]=xt(Hb),[Nq,qb]=Iq(Hb),Rq=ka.forwardRef(Yf(function(t,a){let{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:i,...l}=t,[c,f]=Ma({prop:o,defaultProp:r??!1,onChange:i,caller:Hb});return(0,sl.jsx)(Nq,{scope:n,disabled:s,contentId:Ga(),open:c,onOpenToggle:ka.useCallback(()=>f(u=>!u),[f]),children:(0,sl.jsx)(Re.div,{"data-state":Tg(c),"data-disabled":s?"":void 0,...l,ref:a})})},"Collapsible")),Tq="CollapsibleTrigger",Mq=ka.forwardRef(Yf(function(t,a){let{__scopeCollapsible:n,...o}=t,r=qb(Tq,n);return(0,sl.jsx)(Re.button,{type:"button","aria-controls":r.open?r.contentId:void 0,"aria-expanded":r.open||!1,"data-state":Tg(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:a,onClick:ke(t.onClick,r.onOpenToggle)})},"CollapsibleTrigger")),QT="CollapsibleContent",Eq=ka.forwardRef(Yf(function(t,a){let{forceMount:n,...o}=t,r=qb(QT,t.__scopeCollapsible);return(0,sl.jsx)(An,{present:n||r.open,children:({present:s})=>(0,sl.jsx)(Aq,{...o,ref:a,present:s})})},"CollapsibleContent")),Aq=ka.forwardRef(Yf(function(t,a){let{__scopeCollapsible:n,present:o,children:r,...s}=t,i=qb(QT,n),[l,c]=ka.useState(o),f=ka.useRef(null),u=Te(a,f),d=ka.useRef(0),m=d.current,g=ka.useRef(0),b=g.current,v=i.open||l,x=ka.useRef(v),y=ka.useRef(void 0);return ka.useEffect(()=>{let h=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(h)},[]),Ze(()=>{let h=f.current;if(h){y.current=y.current||{transitionDuration:h.style.transitionDuration,animationName:h.style.animationName},h.style.transitionDuration="0s",h.style.animationName="none";let w=h.getBoundingClientRect();d.current=w.height,g.current=w.width,x.current||(h.style.transitionDuration=y.current.transitionDuration,h.style.animationName=y.current.animationName),c(o)}},[i.open,o]),(0,sl.jsx)(Re.div,{"data-state":Tg(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!v,...s,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...t.style},children:v&&r})},"CollapsibleContentImpl"));function Tg(e){return e?"open":"closed"}Yf(Tg,"getState");var JT=Rq,eM=Mq,tM=Eq;var nc=JT,oc=eM,rc=tM;var pe=j(he(),1),rM=j($r(),1);function _q(e){if(!e||typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css",t.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}var Pq=e=>{switch(e){case"success":return Bq;case"info":return Hq;case"warning":return Fq;case"error":return qq;default:return null}},Oq=Array(12).fill(0),zq=({visible:e,className:t})=>pe.default.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},pe.default.createElement("div",{className:"sonner-spinner"},Oq.map((a,n)=>pe.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Bq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Fq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Hq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),qq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20","aria-hidden":"true"},pe.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Uq=pe.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},pe.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Vq=()=>{let[e,t]=pe.default.useState(document.hidden);return pe.default.useEffect(()=>{let a=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",a),()=>document.removeEventListener("visibilitychange",a)},[]),e},Gq=1,$q=100,aM=e=>{var t;return typeof e?.id=="number"||(e==null||(t=e.id)==null?void 0:t.length)>0?e.id:Gq++},Ub=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),this.getActiveToasts().forEach(a=>t(a)),()=>{let a=this.subscribers.indexOf(t);this.subscribers.splice(a,1)}),this.publish=t=>{this.subscribers.forEach(a=>a(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t],this.trimHistory()},this.trimHistory=()=>{let t=this.toasts.length-$q;t<=0||(this.toasts=this.toasts.filter(a=>t>0&&this.dismissedToasts.has(a.id)?(this.dismissedToasts.delete(a.id),t--,!1):!0))},this.create=t=>{let{message:a,...n}=t,o=aM(t),r=this.pendingDismissals.get(o);r!==void 0&&(cancelAnimationFrame(r),this.pendingDismissals.delete(o),this.dismissedToasts.delete(o));let s=this.dismissedToasts.has(o),i=t.dismissible===void 0?!0:t.dismissible;return s&&(this.dismissedToasts.delete(o),this.toasts=this.toasts.filter(c=>c.id!==o)),(s?void 0:this.toasts.find(c=>c.id===o))?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...t,id:o,title:a}),{...c,...t,id:o,dismissible:i,title:a}):c):this.addToast({title:a,...n,dismissible:i,id:o}),o},this.dismiss=t=>{if(t==null)return this.getActiveToasts().forEach(n=>{this.dismissedToasts.add(n.id),this.subscribers.forEach(o=>o({id:n.id,dismiss:!0}))}),t;this.dismissedToasts.add(t);let a=this.pendingDismissals.get(t);return a!==void 0&&cancelAnimationFrame(a),this.pendingDismissals.set(t,requestAnimationFrame(()=>{this.pendingDismissals.delete(t),this.subscribers.forEach(n=>n({id:t,dismiss:!0}))})),t},this.message=(t,a)=>this.create({...a,message:t,type:void 0}),this.error=(t,a)=>this.create({...a,message:t,type:"error"}),this.success=(t,a)=>this.create({...a,type:"success",message:t}),this.info=(t,a)=>this.create({...a,type:"info",message:t}),this.warning=(t,a)=>this.create({...a,type:"warning",message:t}),this.loading=(t,a)=>this.create({...a,type:"loading",message:t}),this.promise=(t,a)=>{if(!a)return;let n;a.loading!==void 0&&(n=this.create({...a,promise:t,type:"loading",message:a.loading,description:typeof a.description!="function"?a.description:void 0}));let o=Promise.resolve(t instanceof Function?t():t),r=n!==void 0,s,i=o.then(async c=>{if(s=["resolve",c],pe.default.isValidElement(c))r=!1,this.create({id:n,type:"default",message:c});else if(Wq(c)&&!c.ok){r=!1;let u=typeof a.error=="function"?await a.error(`HTTP error! status: ${c.status}`):a.error,d=typeof a.description=="function"?await a.description(`HTTP error! status: ${c.status}`):a.description,g=typeof u=="object"&&!pe.default.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:d,...g})}else if(c instanceof Error){r=!1;let u=typeof a.error=="function"?await a.error(c):a.error,d=typeof a.description=="function"?await a.description(c):a.description,g=typeof u=="object"&&!pe.default.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:d,...g})}else if(a.success!==void 0){r=!1;let u=typeof a.success=="function"?await a.success(c):a.success,d=typeof a.description=="function"?await a.description(c):a.description,g=typeof u=="object"&&!pe.default.isValidElement(u)?u:{message:u};this.create({id:n,type:"success",description:d,...g})}}).catch(async c=>{if(s=["reject",c],a.error!==void 0){r=!1;let f=typeof a.error=="function"?await a.error(c):a.error,u=typeof a.description=="function"?await a.description(c):a.description,m=typeof f=="object"&&!pe.default.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:u,...m})}}).finally(()=>{r&&(this.dismiss(n),n=void 0),a.finally==null||a.finally.call(a)}),l=()=>new Promise((c,f)=>i.then(()=>s[0]==="reject"?f(s[1]):c(s[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,a)=>{let n=aM(a);return this.create({...a,jsx:t(n),id:n,type:void 0}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set,this.pendingDismissals=new Map}},gn=new Ub,jq=(e,t)=>gn.message(e,t),Wq=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Xq=jq,Yq=()=>gn.toasts,Kq=()=>gn.getActiveToasts(),xn=Object.assign(Xq,{success:gn.success,info:gn.info,warning:gn.warning,error:gn.error,custom:gn.custom,message:gn.message,promise:gn.promise,dismiss:gn.dismiss,loading:gn.loading},{getHistory:Yq,getToasts:Kq});_q("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{-webkit-user-select:none;user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Mg(e){return e.label!==void 0}var Zq=3,Qq="24px",Jq="16px",nM=4e3,eU=356,tU=14,aU=45,nU=200;function ar(...e){return e.filter(Boolean).join(" ")}function oU(e){let[t,a]=e.split("-"),n=[];return t&&n.push(t),a&&n.push(a),n}var rU=e=>{var t,a,n,o,r,s,i,l,c;let{invert:f,toast:u,unstyled:d,interacting:m,setHeights:g,visibleToasts:b,heights:v,index:x,toasts:y,expanded:h,removeToast:w,defaultRichColors:S,closeButton:C,style:I,cancelButtonStyle:L,actionButtonStyle:T,className:A="",descriptionClassName:D="",duration:H,position:V,gap:N,expandByDefault:P,classNames:E,icons:_,closeButtonAriaLabel:z="Close toast"}=e,[q,O]=pe.default.useState(null),[W,ee]=pe.default.useState(null),[de,ne]=pe.default.useState(!1),[re,ue]=pe.default.useState(!1),[ce,U]=pe.default.useState(!1),[M,se]=pe.default.useState(!1),[le,B]=pe.default.useState(!1),[G,oe]=pe.default.useState(0),[Y,Le]=pe.default.useState(0),ze=pe.default.useRef(u.duration||H||nM),bt=pe.default.useRef(null),st=pe.default.useRef(null),Gt=x===0,Ge=x+1<=b,at=u.type,Ba=at??"default",Tt=u.dismissible!==!1,bn=u.className||"",lo=u.descriptionClassName||"",en=pe.default.useMemo(()=>v.findIndex(Ae=>Ae.toastId===u.id)||0,[v,u.id]),lr=pe.default.useMemo(()=>{var Ae;return(Ae=u.closeButton)!=null?Ae:C},[u.closeButton,C]),Rl=pe.default.useMemo(()=>u.duration||H||nM,[u.duration,H]),ai=pe.default.useRef(0),qr=pe.default.useRef(0),Ap=pe.default.useRef(0),Ur=pe.default.useRef(null),[Kx,Zx]=V.split("-"),Dp=pe.default.useMemo(()=>v.reduce((Ae,Bt,Jt)=>Jt>=en?Ae:Ae+Bt.height,0),[v,en]),_p=Vq(),zn=pe.default.useMemo(()=>{var Ae;return(Ae=e.swipeDirections)!=null?Ae:oU(V)},[e.swipeDirections,V]),Qx=u.invert||f,_c=at==="loading";qr.current=pe.default.useMemo(()=>en*N+Dp,[en,Dp]),pe.default.useEffect(()=>{ze.current=Rl},[Rl]),pe.default.useEffect(()=>{ne(!0)},[]),pe.default.useEffect(()=>{let Ae=st.current;if(Ae){let Bt=Ae.getBoundingClientRect().height;return Le(Bt),g(Jt=>[{toastId:u.id,height:Bt,position:u.position},...Jt]),()=>g(Jt=>Jt.filter(Ia=>Ia.toastId!==u.id))}},[g,u.id]),pe.default.useLayoutEffect(()=>{if(!de)return;let Ae=st.current,Bt=Ae.style.height;Ae.style.height="auto";let Jt=Ae.getBoundingClientRect().height;Ae.style.height=Bt,Le(Jt),g(Ia=>Ia.find($t=>$t.toastId===u.id)?Ia.map($t=>$t.toastId===u.id?{...$t,height:Jt}:$t):[{toastId:u.id,height:Jt,position:u.position},...Ia])},[de,u.title,u.description,g,u.id,u.jsx,u.action,u.cancel]);let Mo=pe.default.useCallback(()=>{ue(!0),oe(qr.current),g(Ae=>Ae.filter(Bt=>Bt.toastId!==u.id)),setTimeout(()=>{w(u)},nU)},[u,w,g,qr]);pe.default.useEffect(()=>{if(u.promise&&at==="loading"||u.duration===1/0||u.type==="loading")return;let Ae;return h||m||_p?(()=>{if(Ap.current<ai.current){let Ia=new Date().getTime()-ai.current;ze.current=ze.current-Ia}Ap.current=new Date().getTime()})():ze.current!==1/0&&(ai.current=new Date().getTime(),Ae=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),Mo()},ze.current)),()=>clearTimeout(Ae)},[h,m,u,at,_p,Mo]),pe.default.useEffect(()=>{u.delete&&(Mo(),u.onDismiss==null||u.onDismiss.call(u,u))},[Mo,u.delete]);function Pp(){var Ae;if(_?.loading){var Bt;return pe.default.createElement("div",{className:ar(E?.loader,u==null||(Bt=u.classNames)==null?void 0:Bt.loader,"sonner-loader"),"data-visible":at==="loading"},_.loading)}return pe.default.createElement(zq,{className:ar(E?.loader,u==null||(Ae=u.classNames)==null?void 0:Ae.loader),visible:at==="loading"})}let Jx=u.icon||_?.[at]||Pq(at);var Op,zp;return pe.default.createElement("li",{tabIndex:0,ref:st,className:ar(A,bn,E?.toast,u==null||(t=u.classNames)==null?void 0:t.toast,E?.[Ba],u==null||(a=u.classNames)==null?void 0:a[Ba]),"data-sonner-toast":"","data-rich-colors":(Op=u.richColors)!=null?Op:S,"data-styled":!(u.jsx||u.unstyled||d),"data-mounted":de,"data-promise":!!u.promise,"data-swiped":le,"data-removed":re,"data-visible":Ge,"data-y-position":Kx,"data-x-position":Zx,"data-index":x,"data-front":Gt,"data-swiping":ce,"data-dismissible":Tt,"data-type":at,"data-invert":Qx,"data-swipe-out":M,"data-swipe-direction":W,"data-expanded":!!(h||P&&de),"data-testid":u.testId,style:{"--index":x,"--toasts-before":x,"--z-index":y.length-x,"--offset":`${re?G:qr.current}px`,"--initial-height":P?"auto":`${Y}px`,...I,...u.style},onDragEnd:()=>{U(!1),O(null),Ur.current=null},onPointerDown:Ae=>{Ae.button!==2&&(_c||!Tt||(bt.current=new Date,oe(qr.current),Ae.target.setPointerCapture(Ae.pointerId),Ae.target.tagName!=="BUTTON"&&(U(!0),Ur.current={x:Ae.clientX,y:Ae.clientY})))},onPointerUp:()=>{var Ae,Bt,Jt;if(M||!Tt)return;Ur.current=null;let Ia=Number(((Ae=st.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ni=Number(((Bt=st.current)==null?void 0:Bt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),$t=new Date().getTime()-((Jt=bt.current)==null?void 0:Jt.getTime()),tn=q==="x"?Ia:ni,Bn=Math.abs(tn)/$t;if((q==="x"?zn.includes(Ia>0?"right":"left"):zn.includes(ni>0?"bottom":"top"))&&(Math.abs(tn)>=aU||Bn>.11)){oe(qr.current),u.onDismiss==null||u.onDismiss.call(u,u),ee(q==="x"?Ia>0?"right":"left":ni>0?"down":"up"),Mo(),se(!0);return}else{var Fn,Oc;(Fn=st.current)==null||Fn.style.setProperty("--swipe-amount-x","0px"),(Oc=st.current)==null||Oc.style.setProperty("--swipe-amount-y","0px")}B(!1),U(!1),O(null)},onPointerMove:Ae=>{var Bt,Jt,Ia;if(!Ur.current||!Tt||((Bt=window.getSelection())==null?void 0:Bt.toString().length)>0)return;let $t=Ae.clientY-Ur.current.y,tn=Ae.clientX-Ur.current.x;!q&&(Math.abs(tn)>1||Math.abs($t)>1)&&O(Math.abs(tn)>Math.abs($t)?"x":"y");let Bn={x:0,y:0},Pc=Fn=>1/(1.5+Math.abs(Fn)/20);if(q==="y"){if(zn.includes("top")||zn.includes("bottom"))if(zn.includes("top")&&$t<0||zn.includes("bottom")&&$t>0)Bn.y=$t;else{let Fn=$t*Pc($t);Bn.y=Math.abs(Fn)<Math.abs($t)?Fn:$t}}else if(q==="x"&&(zn.includes("left")||zn.includes("right")))if(zn.includes("left")&&tn<0||zn.includes("right")&&tn>0)Bn.x=tn;else{let Fn=tn*Pc(tn);Bn.x=Math.abs(Fn)<Math.abs(tn)?Fn:tn}(Math.abs(Bn.x)>0||Math.abs(Bn.y)>0)&&B(!0),(Jt=st.current)==null||Jt.style.setProperty("--swipe-amount-x",`${Bn.x}px`),(Ia=st.current)==null||Ia.style.setProperty("--swipe-amount-y",`${Bn.y}px`)}},lr&&!u.jsx&&at!=="loading"?pe.default.createElement("button",{"aria-label":z,"data-disabled":_c,"data-close-button":!0,onClick:_c||!Tt?()=>{}:()=>{Mo(),u.onDismiss==null||u.onDismiss.call(u,u)},className:ar(E?.closeButton,u==null||(n=u.classNames)==null?void 0:n.closeButton)},(zp=_?.close)!=null?zp:Uq):null,(at||u.icon||u.promise)&&u.icon!==null&&(_?.[at]!==null||u.icon)?pe.default.createElement("div",{"data-icon":"",className:ar(E?.icon,u==null||(o=u.classNames)==null?void 0:o.icon)},at==="loading"?u.icon||Pp():u.promise?Pp():null,at!=="loading"?Jx:null):null,pe.default.createElement("div",{"data-content":"",className:ar(E?.content,u==null||(r=u.classNames)==null?void 0:r.content)},pe.default.createElement("div",{"data-title":"",className:ar(E?.title,u==null||(s=u.classNames)==null?void 0:s.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?pe.default.createElement("div",{"data-description":"",className:ar(D,lo,E?.description,u==null||(i=u.classNames)==null?void 0:i.description)},typeof u.description=="function"?u.description():u.description):null),pe.default.isValidElement(u.cancel)?u.cancel:u.cancel&&Mg(u.cancel)?pe.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||L,onClick:Ae=>{Mg(u.cancel)&&Tt&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,Ae),Mo())},className:ar(E?.cancelButton,u==null||(l=u.classNames)==null?void 0:l.cancelButton)},u.cancel.label):null,pe.default.isValidElement(u.action)?u.action:u.action&&Mg(u.action)?pe.default.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||T,onClick:Ae=>{Mg(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,Ae),!Ae.defaultPrevented&&Mo())},className:ar(E?.actionButton,u==null||(c=u.classNames)==null?void 0:c.actionButton)},u.action.label):null)};function oM(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function sU(e,t){let a={};return[e,t].forEach((n,o)=>{let r=o===1,s=r?"--mobile-offset":"--offset",i=r?Jq:Qq;function l(c){["top","right","bottom","left"].forEach(f=>{a[`${s}-${f}`]=typeof c=="number"?`${c}px`:c})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(c=>{n[c]===void 0?a[`${s}-${c}`]=i:a[`${s}-${c}`]=typeof n[c]=="number"?`${n[c]}px`:n[c]}):l(i)}),a}var sM=pe.default.forwardRef(function(t,a){let{id:n,invert:o,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:l,className:c,offset:f,mobileOffset:u,theme:d="light",richColors:m,duration:g,style:b,visibleToasts:v=Zq,toastOptions:x,dir:y=oM(),gap:h=tU,icons:w,customAriaLabel:S,containerAriaLabel:C="Notifications"}=t,[I,L]=pe.default.useState([]),T=pe.default.useMemo(()=>n?I.filter(ne=>ne.toasterId===n):I.filter(ne=>!ne.toasterId),[I,n]),A=pe.default.useMemo(()=>Array.from(new Set([r].concat(T.filter(ne=>ne.position).map(ne=>ne.position)))),[T,r]),[D,H]=pe.default.useState([]),[V,N]=pe.default.useState(!1),[P,E]=pe.default.useState(!1),[_,z]=pe.default.useState(d!=="system"?d:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=pe.default.useRef(null),O=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),W=pe.default.useRef(null),ee=pe.default.useRef(!1),de=pe.default.useCallback(ne=>{L(re=>{var ue;return(ue=re.find(ce=>ce.id===ne.id))!=null&&ue.delete||gn.dismiss(ne.id),re.filter(({id:ce})=>ce!==ne.id)})},[]);return pe.default.useEffect(()=>gn.subscribe(ne=>{if(ne.dismiss){requestAnimationFrame(()=>{L(re=>re.map(ue=>ue.id===ne.id?{...ue,delete:!0}:ue))});return}setTimeout(()=>{rM.default.flushSync(()=>{L(re=>{let ue=re.findIndex(ce=>ce.id===ne.id);return ue!==-1?[...re.slice(0,ue),{...re[ue],...ne},...re.slice(ue+1)]:[ne,...re]})})})}),[]),pe.default.useEffect(()=>{if(d!=="system"){z(d);return}if(d==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window>"u")return;let ne=window.matchMedia("(prefers-color-scheme: dark)");try{ne.addEventListener("change",({matches:re})=>{z(re?"dark":"light")})}catch{ne.addListener(({matches:ue})=>{try{z(ue?"dark":"light")}catch(ce){console.error(ce)}})}},[d]),pe.default.useEffect(()=>{I.length<=1&&N(!1)},[I]),pe.default.useEffect(()=>{let ne=re=>{var ue;if(s.length>0&&s.every(M=>re[M]||re.code===M)){var U;N(!0),(U=q.current)==null||U.focus()}re.code==="Escape"&&(document.activeElement===q.current||(ue=q.current)!=null&&ue.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[s]),pe.default.useEffect(()=>{if(q.current)return()=>{W.current&&(W.current.focus({preventScroll:!0}),W.current=null,ee.current=!1)}},[q.current]),pe.default.createElement("section",{ref:a,"aria-label":S??`${C} ${O}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0,"data-react-aria-top-layer":!0},A.map((ne,re)=>{var ue;let[ce,U]=ne.split("-");return T.length?pe.default.createElement("ol",{key:ne,dir:y==="auto"?oM():y,tabIndex:-1,ref:q,className:c,"data-sonner-toaster":!0,"data-sonner-theme":_,"data-y-position":ce,"data-x-position":U,style:{"--front-toast-height":`${((ue=D[0])==null?void 0:ue.height)||0}px`,"--width":`${eU}px`,"--gap":`${h}px`,...b,...sU(f,u)},onBlur:M=>{ee.current&&!M.currentTarget.contains(M.relatedTarget)&&(ee.current=!1,W.current&&(W.current.focus({preventScroll:!0}),W.current=null))},onFocus:M=>{M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false"||ee.current||(ee.current=!0,W.current=M.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{P||N(!1)},onDragEnd:()=>N(!1),onPointerDown:M=>{M.target instanceof HTMLElement&&M.target.dataset.dismissible==="false"||E(!0)},onPointerUp:()=>E(!1)},T.filter(M=>!M.position&&re===0||M.position===ne).map((M,se)=>{var le,B;return pe.default.createElement(rU,{key:M.id,icons:w,index:se,toast:M,defaultRichColors:m,duration:(le=x?.duration)!=null?le:g,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:o,visibleToasts:v,closeButton:(B=x?.closeButton)!=null?B:l,interacting:P,position:ne,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:de,toasts:T.filter(G=>G.position==M.position),heights:D.filter(G=>G.position==M.position),setHeights:H,expandByDefault:i,gap:h,expanded:V,swipeDirections:t.swipeDirections})})):null}))});var lM=j(fe(),1);function iM(){return(0,lM.jsx)(sM,{position:"bottom-center",toastOptions:{classNames:{toast:"!bg-card !text-foreground !border !border-border !shadow-lg",description:"!text-muted-foreground"}}})}var Io=j(he(),1);var Pe=j(he(),1);var ut=j(fe(),1),iU=Object.defineProperty,ct=(e,t)=>iU(e,"name",{value:t,configurable:!0}),Vb=["Enter"," "],lU=["ArrowDown","PageUp","Home"],cM=["ArrowUp","PageDown","End"],uU=[...lU,...cM],Mse={ltr:[...Vb,"ArrowRight"],rtl:[...Vb,"ArrowLeft"]};var Ag="Menu",[Gb,cU,dU]=Yi(Ag),[il,jb]=xt(Ag,[dU,Ju,Xu]),Wb=Ju(),dM=Xu(),[fU,Kf]=il(Ag),[pU,Xb]=il(Ag),mU=ct(e=>{let{__scopeMenu:t,open:a=!1,children:n,dir:o,onOpenChange:r,modal:s=!0}=e,i=Wb(t),[l,c]=Pe.useState(null),f=Pe.useRef(!1),u=oa(r),d=Tr(o);return Pe.useEffect(()=>{let m=ct(()=>{f.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=ct(()=>f.current=!1,"handlePointer");return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),Pe.useEffect(()=>{if(!a)return;let m=ct(()=>u(!1),"handleBlur");return window.addEventListener("blur",m),()=>window.removeEventListener("blur",m)},[a,u]),(0,ut.jsx)(Sg,{...i,children:(0,ut.jsx)(fU,{scope:t,open:a,onOpenChange:u,content:l,onContentChange:c,children:(0,ut.jsx)(pU,{scope:t,onClose:Pe.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:f,dir:d,modal:s,children:n})})})},"Menu"),hU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,...o}=t,r=Wb(n);return(0,ut.jsx)(Cg,{...r,...o,ref:a})},"MenuAnchor")),fM="MenuPortal",[gU,xU]=il(fM,{forceMount:void 0}),vU=ct(e=>{let{__scopeMenu:t,forceMount:a,children:n,container:o}=e,r=Kf(fM,t);return(0,ut.jsx)(gU,{scope:t,forceMount:a,children:(0,ut.jsx)(An,{present:a||r.open,children:(0,ut.jsx)(Au,{asChild:!0,container:o,children:n})})})},"MenuPortal"),Us="MenuContent",[yU,pM]=il(Us),bU=Pe.forwardRef(ct(function(t,a){let n=xU(Us,t.__scopeMenu),{forceMount:o=n.forceMount,...r}=t,s=Kf(Us,t.__scopeMenu),i=Xb(Us,t.__scopeMenu);return(0,ut.jsx)(Gb.Provider,{scope:t.__scopeMenu,children:(0,ut.jsx)(An,{present:o||s.open,children:(0,ut.jsx)(Gb.Slot,{scope:t.__scopeMenu,children:i.modal?(0,ut.jsx)(wU,{...r,ref:a}):(0,ut.jsx)(SU,{...r,ref:a})})})})},"MenuContent")),wU=Pe.forwardRef(ct(function(t,a){let n=Kf(Us,t.__scopeMenu),o=Pe.useRef(null),r=Te(a,o);return Pe.useEffect(()=>{let s=o.current;if(s)return Fu(s)},[]),(0,ut.jsx)(mM,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ke(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentModal")),SU=Pe.forwardRef(ct(function(t,a){let n=Kf(Us,t.__scopeMenu);return(0,ut.jsx)(mM,{...t,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},"MenuRootContentNonModal")),CU=Ea("MenuContent.ScrollLock"),mM=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...v}=t,x=Kf(Us,n),y=Xb(Us,n),h=Wb(n),w=dM(n),S=cU(n),[C,I]=Pe.useState(null),L=Pe.useRef(null),T=Te(a,L,x.onContentChange),A=Pe.useRef(0),D=Pe.useRef(""),H=Pe.useRef(0),V=Pe.useRef(null),N=Pe.useRef("right"),P=Pe.useRef(0),E=b?Ai:Pe.Fragment,_=b?{as:CU,allowPinchZoom:!0}:void 0,z=ct(O=>{let W=D.current+O,ee=S().filter(U=>!U.disabled),de=document.activeElement,ne=ee.find(U=>U.ref.current===de)?.textValue,re=ee.map(U=>U.textValue),ue=yM(re,W,ne),ce=ee.find(U=>U.textValue===ue)?.ref.current;ct((function U(M){D.current=M,window.clearTimeout(A.current),M!==""&&(A.current=window.setTimeout(()=>U(""),1e3))}),"updateSearch")(W),ce&&setTimeout(()=>ce.focus())},"handleTypeaheadSearch");Pe.useEffect(()=>()=>window.clearTimeout(A.current),[]),ws();let q=Pe.useCallback(O=>N.current===V.current?.side&&wM(O,V.current?.area),[]);return(0,ut.jsx)(yU,{scope:n,searchRef:D,onItemEnter:Pe.useCallback(O=>{q(O)&&O.preventDefault()},[q]),onItemLeave:Pe.useCallback(O=>{q(O)||(L.current?.focus(),I(null))},[q]),onTriggerLeave:Pe.useCallback(O=>{q(O)&&O.preventDefault()},[q]),pointerGraceTimerRef:H,onPointerGraceIntentChange:Pe.useCallback(O=>{V.current=O},[]),children:(0,ut.jsx)(E,{..._,children:(0,ut.jsx)(Eu,{asChild:!0,trapped:r,onMountAutoFocus:ke(s,O=>{O.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:(0,ut.jsx)(Mu,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:m,onDismiss:g,children:(0,ut.jsx)(og,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:o,currentTabStopId:C,onCurrentTabStopIdChange:I,onEntryFocus:ke(c,O=>{y.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,ut.jsx)(kg,{role:"menu","aria-orientation":"vertical","data-state":hM(x.open),"data-radix-menu-content":"",dir:y.dir,...h,...v,ref:T,style:{outline:"none",...v.style},onKeyDown:ke(v.onKeyDown,O=>{let ee=O.target.closest("[data-radix-menu-content]")===O.currentTarget,de=O.ctrlKey||O.altKey||O.metaKey,ne=O.key.length===1;ee&&(O.key==="Tab"&&O.preventDefault(),!de&&ne&&z(O.key));let re=L.current;if(O.target!==re||!uU.includes(O.key))return;O.preventDefault();let ce=S().filter(U=>!U.disabled).map(U=>U.ref.current);cM.includes(O.key)&&ce.reverse(),xM(ce)}),onBlur:ke(t.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(A.current),D.current="")}),onPointerMove:ke(t.onPointerMove,Eg(O=>{let W=O.target,ee=P.current!==O.clientX;if(O.currentTarget.contains(W)&&ee){let de=O.clientX>P.current?"right":"left";N.current=de,P.current=O.clientX}}))})})})})})})},"MenuContentImpl"));var kU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,...o}=t;return(0,ut.jsx)(Re.div,{...o,ref:a})},"MenuLabel")),$b="MenuItem",uM="menu.itemSelect",LU=Pe.forwardRef(ct(function(t,a){let{disabled:n=!1,onSelect:o,...r}=t,s=Pe.useRef(null),i=Xb($b,t.__scopeMenu),l=pM($b,t.__scopeMenu),c=Te(a,s),f=Pe.useRef(!1),u=ct(()=>{let d=s.current;if(!n&&d){let m=new CustomEvent(uM,{bubbles:!0,cancelable:!0});d.addEventListener(uM,g=>o?.(g),{once:!0}),Hd(d,m),m.defaultPrevented?f.current=!1:i.onClose()}},"handleSelect");return(0,ut.jsx)(IU,{...r,ref:c,disabled:n,onClick:ke(t.onClick,u),onPointerDown:d=>{t.onPointerDown?.(d),f.current=!0},onPointerUp:ke(t.onPointerUp,d=>{f.current||d.currentTarget?.click()}),onKeyDown:ke(t.onKeyDown,d=>{n||d.target!==d.currentTarget||l.searchRef.current!==""&&d.key===" "||Vb.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})},"MenuItem")),IU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=t,i=pM($b,n),l=dM(n),c=Pe.useRef(null),f=Te(a,c),[u,d]=Pe.useState(!1),[m,g]=Pe.useState("");return Pe.useEffect(()=>{let b=c.current;b&&g((b.textContent??"").trim())},[s.children]),(0,ut.jsx)(Gb.ItemSlot,{scope:n,disabled:o,textValue:r??m,children:(0,ut.jsx)(rg,{asChild:!0,...l,focusable:!o,children:(0,ut.jsx)(Re.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:ke(t.onPointerMove,Eg(b=>{o?i.onItemLeave(b):(i.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ke(t.onPointerLeave,Eg(b=>i.onItemLeave(b))),onFocus:ke(t.onFocus,()=>d(!0)),onBlur:ke(t.onBlur,()=>d(!1))})})})},"MenuItemImpl"));var NU="MenuRadioGroup",[Ese,Ase]=il(NU,{value:void 0,onValueChange:ct(()=>{},"onValueChange")});var RU="MenuItemIndicator",[Dse,_se]=il(RU,{checked:!1});var TU=Pe.forwardRef(ct(function(t,a){let{__scopeMenu:n,...o}=t;return(0,ut.jsx)(Re.div,{role:"separator","aria-orientation":"horizontal",...o,ref:a})},"MenuSeparator"));var MU="MenuSub",[Pse,Ose]=il(MU);function hM(e){return e?"open":"closed"}ct(hM,"getOpenState");function gM(e){return e==="indeterminate"}ct(gM,"isIndeterminate");function EU(e){return gM(e)?"indeterminate":e?"checked":"unchecked"}ct(EU,"getCheckedState");function xM(e){let t=document.activeElement;for(let a of e)if(a===t||(a.focus(),document.activeElement!==t))return}ct(xM,"focusFirst");function vM(e,t){return e.map((a,n)=>e[(t+n)%e.length])}ct(vM,"wrapArray");function yM(e,t,a){let o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,r=a?e.indexOf(a):-1,s=vM(e,Math.max(r,0));o.length===1&&(s=s.filter(c=>c!==a));let l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==a?l:void 0}ct(yM,"getNextMatch");function bM(e,t){let{x:a,y:n}=e,o=!1;for(let r=0,s=t.length-1;r<t.length;s=r++){let i=t[r],l=t[s],c=i.x,f=i.y,u=l.x,d=l.y;f>n!=d>n&&a<(u-c)*(n-f)/(d-f)+c&&(o=!o)}return o}ct(bM,"isPointInPolygon");function wM(e,t){if(!t)return!1;let a={x:e.clientX,y:e.clientY};return bM(a,t)}ct(wM,"isPointerInGraceArea");function Eg(e){return t=>t.pointerType==="mouse"?e(t):void 0}ct(Eg,"whenMouse");var SM=mU,CM=hU,kM=vU,LM=bU;var IM=kU,NM=LU;var RM=TU;var nr=j(fe(),1),DU=Object.defineProperty,ll=(e,t)=>DU(e,"name",{value:t,configurable:!0}),Yb="DropdownMenu",[_U,Jse]=xt(Yb,[jb]),ul=jb(),[PU,TM]=_U(Yb),OU=ll(e=>{let{__scopeDropdownMenu:t,children:a,dir:n,open:o,defaultOpen:r,onOpenChange:s,modal:i=!0}=e,l=ul(t),c=Io.useRef(null),[f,u]=Ma({prop:o,defaultProp:r??!1,onChange:s,caller:Yb});return(0,nr.jsx)(PU,{scope:t,triggerId:Ga(),triggerRef:c,contentId:Ga(),open:f,onOpenChange:u,onOpenToggle:Io.useCallback(()=>u(d=>!d),[u]),modal:i,children:(0,nr.jsx)(SM,{...l,open:f,onOpenChange:u,dir:n,modal:i,children:a})})},"DropdownMenu"),zU="DropdownMenuTrigger",BU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,disabled:o=!1,...r}=t,s=TM(zU,n),i=ul(n),l=Te(a,s.triggerRef);return(0,nr.jsx)(CM,{asChild:!0,...i,children:(0,nr.jsx)(Re.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:l,onPointerDown:ke(t.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:ke(t.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),FU=ll(e=>{let{__scopeDropdownMenu:t,...a}=e,n=ul(t);return(0,nr.jsx)(kM,{...n,...a})},"DropdownMenuPortal"),HU="DropdownMenuContent",qU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=TM(HU,n),s=ul(n),i=Io.useRef(!1);return(0,nr.jsx)(LM,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:a,onCloseAutoFocus:ke(t.onCloseAutoFocus,l=>{i.current||r.triggerRef.current?.focus(),i.current=!1,l.preventDefault()}),onInteractOutside:ke(t.onInteractOutside,l=>{let c=l.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0,u=c.button===2||f;(!r.modal||u)&&(i.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent"));var UU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=ul(n);return(0,nr.jsx)(IM,{...r,...o,ref:a})},"DropdownMenuLabel")),VU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=ul(n);return(0,nr.jsx)(NM,{...r,...o,ref:a})},"DropdownMenuItem"));var GU=Io.forwardRef(ll(function(t,a){let{__scopeDropdownMenu:n,...o}=t,r=ul(n);return(0,nr.jsx)(RM,{...r,...o,ref:a})},"DropdownMenuSeparator"));var MM=OU,EM=BU,AM=FU,DM=qU;var _M=UU,PM=VU;var OM=GU;var sc=j(fe(),1),ic=MM,lc=EM;function uc({className:e,sideOffset:t=4,...a}){return(0,sc.jsx)(AM,{children:(0,sc.jsx)(DM,{"data-slot":"dropdown-menu-content",sideOffset:t,className:te("z-[120] min-w-44 overflow-hidden rounded-[10px] border-0 bg-popover p-1 text-popover-foreground shadow-[var(--so-shadow-overlay)]",e),...a})})}function cc({className:e,...t}){return(0,sc.jsx)(PM,{"data-slot":"dropdown-menu-item",className:te("relative flex cursor-default select-none items-center gap-2 rounded-[6px] px-2 py-1.5 text-[13px] outline-none data-[highlighted]:bg-accent phone:min-h-11 [&_svg]:size-4",e),...t})}function Kb({className:e,...t}){return(0,sc.jsx)(_M,{className:te("px-2 py-1.5 text-xs font-semibold text-muted-foreground",e),...t})}var zM=({className:e,...t})=>(0,sc.jsx)(OM,{className:te("-mx-1 my-1 h-px bg-border",e),...t});var Qe=j(fe(),1),BM=e=>e.charAt(0).toUpperCase()+e.slice(1);async function jU(e,t,a,n){let o=new URLSearchParams({csrf:a});t==="confirm"&&n&&o.set("confirm","yes");try{let r=await fetch(`/chat/proposal/${e.id}/${t}`,{method:"POST",body:o,credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(2e4)});if(!r.headers.get("content-type")?.includes("application/json"))return{ok:!1,said:"That didn't go through. Reload the conversation and try again."};let s=await r.json(),i=typeof s=="object"&&s!==null?s:{};return{ok:i.ok===!0,said:typeof i.said=="string"?BM(i.said):"Done."}}catch{return{ok:!1,said:"That didn't go through. Check your connection and try again."}}}function WU({card:e,csrf:t,onChanged:a}){let[n,o]=(0,Zf.useState)(null),[r,s]=(0,Zf.useState)(!1),i=(0,Zf.useId)(),l=async d=>{o(d);let m=await jU(e,d,t,r);d==="confirm"?(m.ok?xn.success:xn.error)(m.said):m.ok||xn.error(m.said),o(null),a()},c=e.primary,f=c?.kind==="confirm"&&c.irreversible&&!r,u=e.state==="confirmed"||e.state==="refused"||e.state==="dismissed"||e.state==="expired";return(0,Qe.jsxs)("section",{"data-view":"chat-card","data-action-card":e.id,"data-card-kind":e.kind,"data-card-state":e.state,className:te("mt-3 overflow-hidden rounded-lg border border-border bg-card text-card-foreground",e.state==="pending"&&"border-primary/40",u&&"opacity-90"),children:[(0,Qe.jsxs)("header",{className:"flex items-center gap-2 border-b border-border px-4 py-2.5 text-[13px] font-semibold text-muted-foreground",children:[(0,Qe.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.state==="confirmed"&&(0,Qe.jsxs)("span",{className:"inline-flex items-center gap-1 text-success",children:[(0,Qe.jsx)(ja,{className:"size-3.5","aria-hidden":"true"}),"Done"]}),e.state==="refused"&&(0,Qe.jsxs)("span",{className:"inline-flex items-center gap-1 text-destructive",children:[(0,Qe.jsx)(At,{className:"size-3.5","aria-hidden":"true"}),"Not done"]})]}),e.body!==""&&(0,Qe.jsx)("div",{className:"px-4 py-3",children:(0,Qe.jsx)(Kt,{html:e.body,immutable:!0,className:"so-card-body"})}),(0,Qe.jsxs)("footer",{className:"flex flex-col gap-2 px-4 pb-3.5 pt-1",children:[e.said!==null&&(0,Qe.jsx)("p",{className:te("text-[13px]",e.state==="refused"?"text-destructive":"text-success"),children:BM(e.said)}),e.links.length>0&&(0,Qe.jsx)("div",{className:"flex flex-wrap gap-2",children:e.links.map(d=>(0,Qe.jsx)(Z,{asChild:!0,variant:"outline",size:"sm",children:(0,Qe.jsx)("a",{href:d.href,children:d.label})},d.href))}),e.note!==null&&(0,Qe.jsx)("p",{className:"text-[13px] text-muted-foreground",children:e.note}),c?.kind==="confirm"&&c.irreversible&&(0,Qe.jsxs)("label",{htmlFor:i,className:"flex items-center gap-2 text-[13px]",children:[(0,Qe.jsx)("input",{id:i,type:"checkbox",checked:r,onChange:d=>s(d.target.checked),className:"size-4 accent-[var(--so-accent)]"}),"I understand this cannot be undone"]}),(c!==null||e.dismissable)&&(0,Qe.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c?.kind==="link"&&(0,Qe.jsx)(Z,{asChild:!0,size:"sm",children:(0,Qe.jsx)("a",{href:c.href,children:c.label})}),c?.kind==="confirm"&&c.native&&(0,Qe.jsxs)($e,{action:`/chat/proposal/${e.id}/confirm`,children:[(0,Qe.jsx)("input",{type:"hidden",name:"return",value:window.location.pathname+window.location.search}),c.irreversible&&r&&(0,Qe.jsx)("input",{type:"hidden",name:"confirm",value:"yes"}),(0,Qe.jsx)(Z,{type:"submit",size:"sm",disabled:f,children:c.label})]}),c?.kind==="confirm"&&!c.native&&(0,Qe.jsx)(Z,{size:"sm",disabled:n!==null||f,onClick:()=>{l("confirm")},"data-card-confirm":!0,children:n==="confirm"?"Working…":c.label}),e.dismissable&&(0,Qe.jsx)(Z,{variant:"ghost",size:"sm",disabled:n!==null,onClick:()=>{l("dismiss")},"data-card-dismiss":!0,children:n==="dismiss"?"Dismissing…":"Dismiss"})]})]})]})}function Qf({cards:e,csrf:t,onChanged:a,readOnly:n=!1}){return(0,Qe.jsx)("div",{className:"so-action-cards",children:e.map(o=>(0,Qe.jsx)(WU,{card:n?{...o,primary:null,dismissable:!1}:o,csrf:t,onChanged:a},`${o.id}:${o.state}`))})}var Zb={lead:[{command:"new",hint:"File a new task",text:"File a task: "},{command:"flow",hint:"Make a flow for how work moves",text:"Make a flow for "},{command:"status",hint:"What needs you right now",text:"What needs my attention right now?"},{command:"next",hint:"What to work on next",text:"What should we work on next?"}],task:[{command:"status",hint:"Where this task stands",text:"Where does this task stand?"},{command:"next",hint:"Take the next step",text:"Move this forward"},{command:"revise",hint:"Request changes",text:"Request changes: "},{command:"diff",hint:"Walk through the changes",text:"Walk me through the changes file by file."},{command:"log",hint:"What the checks said",text:"What does the check log say?"},{command:"steer",hint:"Guide the next attempt",text:"For the next attempt: "},{command:"stop",hint:"Stop the running attempt",text:"Stop this task."},{command:"resume",hint:"Resume a stopped attempt",text:"Resume this task."},{command:"complete",hint:"Mark the result complete",text:"Mark this result complete."}],result:[{command:"summary",hint:"What changed",text:"Summarize what changed."},{command:"diff",hint:"Walk through the changes",text:"Walk me through the changes file by file."},{command:"log",hint:"What the checks said",text:"What does the check log say?"},{command:"risks",hint:"Anything to worry about",text:"Are there any risks in this change?"},{command:"revise",hint:"Request changes",text:"Request changes: "},{command:"complete",hint:"Mark the result complete",text:"Mark this result complete."}],tasks:[{command:"new",hint:"File a new task here",text:"File a task: "},{command:"flow",hint:"Make a flow for this project",text:"Make a flow for "},{command:"status",hint:"What needs you here",text:"What needs my attention here?"},{command:"next",hint:"What to build next",text:"What should we build next?"}]};var X=j(fe(),1),Dg=()=>({text:"",requestId:crypto.randomUUID(),uncertain:!1});function XU(e){try{let t=JSON.parse(sessionStorage.getItem(e)??"null");if(t&&typeof t=="object"&&typeof t.text=="string"&&typeof t.requestId=="string")return t}catch{}return Dg()}function FM(e){return{queued:"Queued",running:"Working",failed:"Could not finish",cancelled:"Stopped",uncertain:"Delivery unconfirmed",answered:null}[e.status]}function YU(e,t){return e.split(/(\/(?:t\/[^\s<>"')]+|r\/\d+(?:\?[^\s<>"')]+)?|chat\?task=[^\s<>"')]+))/g).map((a,n)=>{if(!/^\/(?:t\/|r\/|chat\?task=)/.test(a))return a;let o=a.replace(/[.,;!]+$/,""),r=t&&o.startsWith("/chat?")?o+"&conversation="+encodeURIComponent(t):o;return(0,X.jsxs)("span",{children:[(0,X.jsx)("a",{href:r,children:r.startsWith("/r/")||r.includes("result=")?"Open result":"Open task"}),a.slice(o.length)]},n)})}function Qb({projects:e}){return(0,X.jsxs)("fieldset",{className:"so-team-projects",children:[(0,X.jsx)("legend",{children:"Projects"}),e.length===0?(0,X.jsx)("p",{children:"Add a project before creating a lead."}):e.map(t=>(0,X.jsxs)("label",{children:[(0,X.jsx)("input",{type:"checkbox",name:"projects",value:t,defaultChecked:e.length===1}),(0,X.jsx)("span",{title:t,children:t.split("/").pop()||t})]},t))]})}function KU({proposals:e,csrf:t,onChanged:a,readOnly:n}){return e.length?(0,X.jsx)("div",{className:"so-team-proposals",children:e.map(o=>o.card?(0,X.jsx)(Qf,{cards:[o.card],csrf:t,onChanged:a,readOnly:n},o.id):(0,X.jsxs)("article",{children:[(0,X.jsx)("strong",{children:o.title}),(0,X.jsx)(F1,{children:o.state==="pending"?"Proposed":o.state}),(0,X.jsx)("a",{href:o.href,children:o.state==="pending"?"Review action":"Open outcome"})]},o.id))}):null}function HM({initial:e,user:t,csrf:a,onSnapshot:n}){let[o,r]=(0,Rt.useState)(e),s=o.selected,i=`standing-orders:team-draft:${t}:${s?.id??"new"}`,[l,c]=(0,Rt.useState)(()=>XU(i)),[f,u]=(0,Rt.useState)(""),[d,m]=(0,Rt.useState)(!1),[g,b]=(0,Rt.useState)(!1),[v,x]=(0,Rt.useState)(!1),[y,h]=(0,Rt.useState)(null),[w,S]=(0,Rt.useState)(!1),[C,I]=(0,Rt.useState)(!1),L=(0,Rt.useRef)({snapshot:o,draft:l});L.current={snapshot:o,draft:l};let T=(0,Rt.useRef)(!1),A=(0,Rt.useRef)(null),D=o.leads.find(M=>M.id===s?.leadId),H=typeof window>"u"?null:new URL(window.location.href).searchParams.get("lead"),V=D?.id??o.leads.find(M=>M.id===H)?.id??o.leads[0]?.id??"",[N,P]=(0,Rt.useState)(V),E=o.leads.find(M=>M.id===N);(0,Rt.useEffect)(()=>{o.leads.some(M=>M.id===N)||P(V)},[o.leads,N,V]);let _=(0,Rt.useCallback)(M=>{c(M),I(!1);try{sessionStorage.setItem(i,JSON.stringify(M)),S(!1)}catch{S(!0)}},[i]),z=(0,Rt.useCallback)(M=>{r(M),n?.(M);let se=L.current.draft;se.text&&M.messages.some(le=>le.author===t&&le.requestId===se.requestId)&&_(Dg())},[_,t,n]),q=(0,Rt.useCallback)(async()=>{let M=await fetch("/api/team"+(s?"?conversation="+encodeURIComponent(s.id):""),{credentials:"same-origin",cache:"no-store"}),se=await M.json();if(M.status===401||M.status===403){x(!0),u(se.message);return}if(!se.ok||!se.snapshot)throw new Error(se.message||"Updates are unavailable.");z(se.snapshot),m(!1)},[s?.id,z]);jo(v?null:qu("team",null,{conversation:s?.id}),M=>{M==="change"||M==="reload"?q().catch(()=>m(!0)):M==="gone"?(x(!0),u("Your access changed. Reopen Chat or sign in again.")):M==="lost"&&m(!0)}),(0,Rt.useEffect)(()=>{A.current?.scrollIntoView({block:"nearest"})},[o.messages.length]);let O=o.messages.at(-1)?.id;(0,Rt.useEffect)(()=>{!s||!O||v||document.hidden||fetch("/api/team",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":a},body:JSON.stringify({operation:"read",args:{conversationId:s.id,messageId:O}})}).catch(()=>{})},[s?.id,O,v,a]);async function W(M,se){if(T.current||v)return null;T.current=!0,b(!0),u("");try{let B=await(await fetch("/api/team",{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json","x-csrf-token":a},body:JSON.stringify({operation:M,args:se})})).json();return B.snapshot&&z(B.snapshot),B.ok?B:(u(B.message),B.code==="delivery-unconfirmed"&&M==="send"&&_({...L.current.draft,uncertain:!0}),null)}catch{return M==="send"&&_({...L.current.draft,uncertain:!0}),u("The response was not confirmed. Check saved messages before sending again."),null}finally{T.current=!1,b(!1)}}async function ee(M){if(M.preventDefault(),!s||!l.text.trim()||l.uncertain)return;await W("send",{conversationId:s.id,text:l.text,requestId:l.requestId})&&_(Dg())}async function de(M,se){M.preventDefault();let le=new FormData(M.currentTarget),B=le.getAll("projects");if(!B.length){u("Choose at least one project.");return}let G=await W(se,se==="create-lead"?{name:le.get("name"),instructions:le.get("instructions")??"",projects:B}:{leadId:N,title:le.get("title"),visibility:le.get("visibility"),projects:B}),oe=G?.result&&typeof G.result=="object"?G.result:{};G?.ok&&se==="create-lead"&&typeof oe.leadId=="string"?window.location.assign("/chat?lead="+encodeURIComponent(oe.leadId)):G?.snapshot?.selected?window.location.assign("/chat?conversation="+encodeURIComponent(G.snapshot.selected.id)):G?.ok&&await q()}let ne=(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{de(M,"create-conversation")},children:[o.leads.length>1&&(0,X.jsxs)("label",{children:["Lead",(0,X.jsx)("select",{name:"leadId",value:N,onChange:M=>P(M.target.value),children:o.leads.map(M=>(0,X.jsx)("option",{value:M.id,children:M.name},M.id))})]}),(0,X.jsxs)("label",{children:["Conversation title",(0,X.jsx)(Di,{name:"title",required:!0,maxLength:160,placeholder:"What are we working on?"})]}),(0,X.jsxs)("label",{children:["Audience",(0,X.jsxs)("select",{name:"visibility",defaultValue:"team",children:[(0,X.jsx)("option",{value:"team",children:"Team — invited people"}),(0,X.jsx)("option",{value:"private",children:"Private — only you"})]})]}),(0,X.jsx)(Qb,{projects:E?.projects??[]},N),(0,X.jsx)(_e,{type:"submit",disabled:g||!E,children:"Create conversation"})]}),re="canCreateLead"in o&&o.canCreateLead===!0,ue=new Map(o.messages.filter(M=>M.role==="assistant"&&M.turnId!==null).map(M=>[M.turnId,M.id])),ce=new Map;for(let M of o.proposals??[]){if(M.state==="drafting")continue;let se=ue.get(M.turnId)??null,le=ce.get(se)??[];le.push(M),ce.set(se,le)}let U=M=>(0,X.jsx)(KU,{proposals:ce.get(M)??[],csrf:a,readOnly:v,onChanged:()=>{q().catch(()=>m(!0))}});return(0,X.jsxs)("section",{className:"so-team-chat","aria-label":"Team conversation",children:[(0,X.jsxs)("div",{className:"so-team-toolbar",children:[o.leads.length>1&&(0,X.jsxs)("label",{className:"so-team-lead-select",children:[(0,X.jsx)("span",{className:"so-sr-only",children:"Lead"}),(0,X.jsx)("select",{"aria-label":"Lead",value:V,onChange:M=>window.location.assign("/chat?lead="+encodeURIComponent(M.target.value)),children:o.leads.map(M=>(0,X.jsx)("option",{value:M.id,children:M.name},M.id))})]}),s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"so-team-title",children:[(0,X.jsx)("h2",{children:s.title}),o.leads.length===1&&(0,X.jsx)("span",{children:D?.name??"Lead"})]}),(0,X.jsxs)(eo,{summary:s.visibility==="team"?"Team":"Private",className:"so-team-audience",children:[(0,X.jsx)("h3",{children:"People"}),(0,X.jsx)("ul",{children:o.participants.filter(M=>M.active).map(M=>(0,X.jsxs)("li",{children:[(0,X.jsx)("span",{children:M.account}),(0,X.jsx)("span",{children:M.role}),o.canManage&&M.account!==t&&(0,X.jsx)(_e,{variant:"ghost",onClick:()=>{W("member",{conversationId:s.id,account:M.account,role:M.role,active:!1,expectedRevision:s.revision})},disabled:g,children:"Remove"})]},M.account))}),o.canManage&&s.visibility==="team"&&(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{M.preventDefault();let se=new FormData(M.currentTarget);W("member",{conversationId:s.id,account:se.get("account"),role:se.get("role"),active:!0,expectedRevision:s.revision,joinLead:!0,expectedLeadRevision:D?.revision})},children:[(0,X.jsxs)("label",{children:["Person",(0,X.jsx)("select",{name:"account",required:!0,children:o.accounts.filter(M=>!o.participants.some(se=>se.account===M&&se.active)).map(M=>(0,X.jsx)("option",{children:M},M))})]}),(0,X.jsxs)("label",{children:["Access",(0,X.jsxs)("select",{name:"role",defaultValue:"contributor",children:[(0,X.jsx)("option",{value:"viewer",children:"Viewer"}),(0,X.jsx)("option",{value:"contributor",children:"Contributor"}),(0,X.jsx)("option",{value:"manager",children:"Manager"})]})]}),(0,X.jsxs)("p",{className:"so-team-small",children:["Adds access to this conversation and ",D?.name??"the lead"," for these projects: ",D?.projects.map(M=>M.split("/").pop()).join(", "),". Existing private conversations stay private."]}),(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Add person"})]}),(0,X.jsxs)("p",{className:"so-team-small",children:["Projects: ",s.projects.map(M=>M.split("/").pop()).join(", ")]})]})]}):(0,X.jsx)("h2",{children:o.leads.length?"Start a conversation":"Your team lead"})]}),(0,X.jsxs)("div",{className:"so-team-content",children:[(f||v)&&(0,X.jsxs)(fn,{tone:"error",children:[f||"Your access changed.",v&&(0,X.jsxs)(X.Fragment,{children:[" ",(0,X.jsx)("a",{href:"/chat",children:"Reopen Chat"})]})]}),d&&!v&&(0,X.jsxs)(fn,{children:["Live updates disconnected. ",(0,X.jsx)(_e,{variant:"ghost",onClick:()=>{q().catch(()=>u("Updates are still unavailable. Your draft is saved."))},children:"Check messages"})]}),!s&&o.leads.length>0&&(0,X.jsxs)(X.Fragment,{children:[o.conversations.length>0&&(0,X.jsx)("nav",{className:"so-team-room-list","aria-label":"Conversations",children:o.conversations.map(M=>(0,X.jsxs)("a",{href:"/chat?conversation="+encodeURIComponent(M.id),children:[(0,X.jsx)("strong",{children:M.title}),(0,X.jsx)("span",{children:M.visibility==="team"?"Team":"Private"})]},M.id))}),ne]}),!s&&o.leads.length===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("p",{children:re?"Create a lead, then invite people into a conversation.":"Ask a team administrator to invite you to a conversation."}),re&&(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{de(M,"create-lead")},children:[(0,X.jsxs)("label",{children:["Lead name",(0,X.jsx)(Di,{name:"name",defaultValue:"Team lead",required:!0,maxLength:100})]}),(0,X.jsx)(Qb,{projects:o.projects}),(0,X.jsx)(eo,{summary:"Working instructions",children:(0,X.jsx)(Ss,{name:"instructions",rows:4,placeholder:"What should this lead focus on?"})}),(0,X.jsx)(_e,{type:"submit",disabled:g||!o.projects.length,children:"Create lead"})]})]}),s&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)("div",{className:"so-team-messages","aria-live":"polite","aria-relevant":"additions text",children:[o.messages.length===0&&(0,X.jsxs)("div",{className:"so-team-empty",children:[(0,X.jsx)("h3",{children:"What would you like to work on?"}),(0,X.jsx)("p",{children:s.visibility==="team"?"People you invite can join this conversation.":"Only you can read this conversation."})]}),o.messages.map(M=>(0,X.jsxs)("article",{className:"so-team-message so-team-message--"+M.role,"data-team-message":M.id,children:[(0,X.jsxs)("div",{className:"so-team-message-meta",children:[(0,X.jsx)("strong",{children:M.author}),FM(M)&&(0,X.jsx)(F1,{tone:["failed","uncertain"].includes(M.status)?"danger":"neutral",children:FM(M)})]}),y===M.id?(0,X.jsxs)("form",{className:"so-team-form",onSubmit:se=>{se.preventDefault();let le=new FormData(se.currentTarget);W("edit",{conversationId:s.id,messageId:M.id,expectedRevision:M.revision,text:le.get("text")}).then(B=>{B&&h(null)})},children:[(0,X.jsx)(_i,{htmlFor:"team-edit-"+M.id,children:"Edit queued message"}),(0,X.jsx)(Ss,{id:"team-edit-"+M.id,name:"text",defaultValue:M.text,required:!0,maxLength:2e3,rows:3}),(0,X.jsxs)("div",{children:[(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Save edit"}),(0,X.jsx)(_e,{variant:"ghost",onClick:()=>h(null),children:"Cancel"})]})]}):(0,X.jsx)("p",{className:"so-team-message-text",children:YU(M.text,s.id)}),M.error&&(0,X.jsx)(fn,{tone:"error",children:M.error}),M.status==="queued"&&M.author===t&&!v&&(0,X.jsxs)("div",{className:"so-team-message-actions",children:[(0,X.jsx)(_e,{variant:"ghost",onClick:()=>h(M.id),disabled:g,children:"Edit"}),(0,X.jsx)(_e,{variant:"ghost",onClick:()=>{W("withdraw",{conversationId:s.id,messageId:M.id,expectedRevision:M.revision})},disabled:g,children:"Withdraw"})]}),U(M.id)]},M.id))]}),o.truncated&&(0,X.jsx)("p",{className:"so-team-small",children:"Showing the most recent messages."})]}),U(null),(0,X.jsx)("div",{ref:A}),(0,X.jsxs)(eo,{summary:"Conversations",className:"so-team-settings",children:[s&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("nav",{className:"so-team-room-list","aria-label":"Other conversations",children:o.conversations.filter(M=>M.id!==s.id).map(M=>(0,X.jsx)("a",{href:"/chat?conversation="+encodeURIComponent(M.id),children:M.title},M.id))}),(0,X.jsx)("h3",{children:"New conversation"}),ne]}),(0,X.jsx)("a",{href:"/chat?private=1",children:"Previous private chat"}),o.canManage&&D&&(0,X.jsx)(eo,{summary:"Lead settings",children:(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{M.preventDefault();let se=new FormData(M.currentTarget);W("update-lead",{leadId:D.id,expectedRevision:D.revision,name:se.get("name"),instructions:se.get("instructions"),status:se.get("status")})},children:[(0,X.jsxs)("label",{children:["Lead name",(0,X.jsx)(Di,{name:"name",defaultValue:D.name,required:!0,maxLength:100})]}),(0,X.jsxs)("label",{children:["Working instructions",(0,X.jsx)(Ss,{name:"instructions",defaultValue:D.instructions,rows:4})]}),(0,X.jsxs)("label",{children:["Status",(0,X.jsxs)("select",{name:"status",defaultValue:D.status,children:[(0,X.jsx)("option",{value:"active",children:"Active"}),(0,X.jsx)("option",{value:"paused",children:"Paused"})]})]}),(0,X.jsxs)("p",{className:"so-team-small",children:["Projects: ",D.projects.map(M=>M.split("/").pop()).join(", ")]}),(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Save lead"})]})}),re&&o.leads.length>0&&(0,X.jsx)(eo,{summary:"Add a lead",children:(0,X.jsxs)("form",{className:"so-team-form",onSubmit:M=>{de(M,"create-lead")},children:[(0,X.jsxs)("label",{children:["Lead name",(0,X.jsx)(Di,{name:"name",required:!0,maxLength:100})]}),(0,X.jsx)(Qb,{projects:o.projects}),(0,X.jsxs)("label",{children:["Working instructions",(0,X.jsx)(Ss,{name:"instructions",rows:3})]}),(0,X.jsx)(_e,{type:"submit",disabled:g,children:"Create lead"})]})})]})]}),s&&(0,X.jsxs)("div",{className:"so-team-composer",children:[(0,X.jsx)(ZU,{snapshot:o,execute:W,busy:g}),o.canSend&&!v?(0,X.jsxs)("form",{onSubmit:M=>{ee(M)},children:[(0,X.jsxs)(_i,{htmlFor:"team-message",className:"so-sr-only",children:["Message ",D?.name??"the lead"]}),(0,X.jsx)(Ss,{id:"team-message",rows:3,value:l.text,placeholder:"Message "+(D?.name??"your lead"),onChange:M=>_({text:M.target.value,requestId:l.uncertain?crypto.randomUUID():l.requestId,uncertain:!1}),disabled:g||l.uncertain,maxLength:2e3}),(0,X.jsxs)("div",{className:"so-team-compose-actions",children:[o.messages.some(M=>M.status==="running")&&(0,X.jsx)(_e,{variant:"secondary",onClick:()=>{W("stop",{conversationId:s.id,messageId:o.messages.find(M=>M.status==="running")?.id})},disabled:g,children:"Stop"}),l.uncertain?(0,X.jsx)(_e,{onClick:()=>{q().then(()=>{L.current.draft.uncertain&&(I(!0),u("This message is not in saved history. You can send the saved message with its original request identity."))}).catch(()=>u("Saved messages could not be checked. Your draft is preserved."))},children:"Check messages"}):(0,X.jsx)(_e,{type:"submit",disabled:g||!l.text.trim()||!o.chatAuthorization?.enabled,children:g?"Saving…":"Send"}),l.uncertain&&C&&(0,X.jsx)(_e,{disabled:g,onClick:()=>{W("send",{conversationId:s.id,text:l.text,requestId:l.requestId}).then(M=>{M&&_(Dg())})},children:"Send saved message"})]})]}):!v&&(0,X.jsx)("p",{className:"so-team-small",children:"You can read this conversation. Ask a manager for permission to send messages."}),w&&(0,X.jsx)(fn,{children:"Keep this tab open until your message is sent; draft storage is unavailable."})]})]})}function ZU({snapshot:e,execute:t,busy:a}){let n=e.chatAuthorization;return!e.selected||!n||!e.canSend?null:n.waitingReason?(0,X.jsx)(fn,{children:n.waitingReason}):n.enabled?null:(0,X.jsxs)("div",{className:"so-team-consent",children:[(0,X.jsxs)("p",{children:["Enable ",n.provider," · ",n.model," for your messages in this conversation, using the installation’s configured provider account."]}),(0,X.jsxs)("p",{children:[n.dailyTurns," turns per day",n.weeklyCeilingUsd===null?". Your provider subscription limits apply.":`, $${n.weeklyCeilingUsd} per week and $${n.conversationCeilingUsd} for this conversation.`," Execution approvals still apply."]}),(0,X.jsx)(_e,{disabled:a,onClick:()=>{t("authorize",{conversationId:e.selected.id,termsDigest:n.termsDigest,ceilingUsd:n.conversationCeilingUsd})},children:"Enable chat"})]})}var cl=j(he(),1);var Ya=j(fe(),1),Jb=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function QU(e){return!Jb(e)||!Array.isArray(e.steps)?null:{steps:e.steps.flatMap((a,n)=>!Jb(a)||!Array.isArray(a.tools)||typeof a.text!="string"?[]:[{tools:a.tools.flatMap((r,s)=>{if(typeof r!="string")return[];let i=Array.isArray(a.toolCalls)?a.toolCalls[s]:null;if(Jb(i)&&typeof i.id=="string"&&i.label===r){if(i.state==="succeeded"||i.state==="running")return[{id:i.id,label:r,state:i.state}];if(i.state==="failed"&&typeof i.reason=="string"&&i.reason.trim()!=="")return[{id:i.id,label:r,state:"failed",reason:i.reason}]}return[{id:`unknown:${n}:${s}`,label:r,state:"unknown"}]}),text:a.text}]),done:e.done===!0}}function ew(e,t,a){let[n,o]=(0,cl.useState)(null),r=(0,cl.useRef)(a);r.current=a;let s=(0,cl.useRef)(t);return s.current=t,(0,cl.useEffect)(()=>{o(null)},[e?.sessionId,e?.taskId,e?.project,t]),jo(e===null?null:qu("chat",null,e.taskId?{task:e.taskId}:{project:e.project??null}),(i,l)=>{if(!s.current)return;if(i==="lost"){o(f=>f===null?null:{...f,disconnected:!0});return}if(i!=="turn")return;let c=QU(l);c!==null&&(o(c),c.done&&r.current())}),t?n:null}function tw({live:e,leadName:t}){let a=e?.steps??[],n=!e?.done&&!e?.disconnected,o=a.flatMap(i=>i.tools),r=[...a].reverse().find(i=>i.text.trim()!=="")?.text??"",s=n&&a.length>0&&a.at(-1).text.trim()!=="";return(0,Ya.jsxs)(Hh,{from:"assistant",className:"so-live-reply","data-live-reply":!0,children:[(0,Ya.jsx)("div",{className:"so-message-label",children:t}),(0,Ya.jsxs)(jd,{children:[o.length>0&&(0,Ya.jsx)("ul",{className:"so-live-steps","aria-label":"Tool steps",children:o.map(i=>{let l=i.state==="running"&&!n?"unknown":i.state,c=l==="succeeded"?"Done":l==="failed"?"Failed":l==="running"?"Running":"Outcome not reported";return(0,Ya.jsx)("li",{"data-state":l,"data-done":l==="succeeded"?"true":"false",children:(0,Ya.jsxs)("div",{children:[(0,Ya.jsx)("span",{children:i.label}),(0,Ya.jsxs)("span",{className:"so-tool-status",children:[" · ",c]}),i.state==="failed"&&(0,Ya.jsx)("p",{className:"so-tool-reason",children:i.reason})]})},i.id)})}),r!==""&&(0,Ya.jsxs)("p",{className:"so-live-text",children:[r,s&&(0,Ya.jsx)("span",{className:"so-live-caret","aria-hidden":"true"})]}),n&&(s||!o.some(i=>i.state==="running"))&&(0,Ya.jsxs)("div",{className:"so-working",role:"status",children:[(0,Ya.jsx)("span",{className:"so-live-dot"}),s?"Writing…":"Thinking…"]})]})]})}var qM={task:{label:"Open task",target:"task"},approval:{label:"Review & start",target:"task"},planning:{label:"Approve plan",target:"task"},recovery:{label:"Review recovery options",target:"task"},cancel:{label:"Cancel task",target:"task"},result:{label:"Open result",target:"task"},acceptance:{label:"Inspect result",target:"task"},publish:{label:"Review publication",target:"task"},projects:{label:"Manage projects",href:"/projects"},flows:{label:"Open flows",href:"/flows"},recipes:{label:"Browse workflows",href:"/recipes"},workers:{label:"Manage workers",href:"/fleet"},slack:{label:"Manage Slack",href:"/settings/slack"},discord:{label:"Manage Discord",href:"/settings/discord"},lead:{label:"Name your lead",href:"/settings/lead"},integrations:{label:"Set up integrations",href:"/settings/integrations"},settings:{label:"Open settings",href:"/settings"},permissions:{label:"Review permissions",href:"/settings"},providers:{label:"Connect an agent",href:"/settings#providers"},skills:{label:"Manage skills",href:"/settings/skills"},tools:{label:"Manage tools",href:"/settings/tools"},knowledge:{label:"Edit project knowledge",href:"/settings/knowledge"},learning:{label:"Review learning history",href:"/settings/learning"},mode:{label:"Review automatic approvals",href:"/mode"},policy:{label:"Review organisation policy",href:"/settings/policy"}};function _g(e,t,a="summary"){return`/chat?task=${encodeURIComponent(e)}&result=${t}${a==="summary"?"":`&tab=${a}`}`}function UM(e,t,a,n){let o=qM[e];if(e==="skills"||e==="tools")return qM[e].href+(typeof n=="string"&&n?"?repo="+encodeURIComponent(n):"");if("href"in o)return o.href;if(e==="acceptance")return`/review?result=${encodeURIComponent(t)}&run=${Number.isSafeInteger(a)&&Number(a)>0?a:0}&tab=checks`;if(e==="result"&&Number.isSafeInteger(a)&&Number(a)>0)return _g(t,Number(a));let r="/chat?task="+encodeURIComponent(t);return e==="cancel"||e==="recovery"||e==="publish"?"/t/"+encodeURIComponent(t):r+(e==="approval"||e==="planning"?"#task-chat-action":"")}function JU(e){let t=e.primaryAction;if(t===null)return null;let{taskId:a,runId:n,decisionId:o}=t.target;if(o!==null)return`/d/${o}`;if(t.code==="inspect-decisions")return"/";if(t.code==="sign-in")return"/settings#providers";if(t.code==="confirm-stopped")return`/t/${encodeURIComponent(e.rootId)}#confirm-stopped`;if(t.code==="open-result"&&n!==null)return _g(a,n);if(t.code==="open-pr"&&/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/\d+$/.test(e.publicationUrl??""))return e.publicationUrl;if(n!==null&&(t.code==="open-pr"||t.code==="retry-review"))return`/review?result=${encodeURIComponent(a)}&run=${n}`;if(n!==null&&(t.code==="inspect-run"||t.code==="reconcile-run"))return`/r/${n}`;let r=t.code==="approve-scope"?"#approve":t.code==="inspect-stop"||t.code==="resume-run"?"#task-control":t.code==="unhold"?"#task-actions":t.code==="write-scope"||t.code==="select-agent"?"#scope":t.code==="inspect-hold"?"#holds":t.code==="start-worker"||t.code==="repair-dependency"?"#run-status":"";return`/t/${encodeURIComponent(e.rootId)}?version=${encodeURIComponent(a)}`+r}function VM(e,t){let a=o=>t&&o.startsWith("/chat?")?o+"&conversation="+encodeURIComponent(t):o,n=e.items.map(o=>{let r=o.status,s=m=>m.trim().replace(/\s+/g," ").replace(/[.!?]+$/,"").toLowerCase(),i=["Waiting","Failed","Needs you"].includes(r.label)&&s(r.detail)!==""&&s(r.detail)!==s(r.label)?r.detail:void 0,l=o.resultRunId===null||o.resultTaskId===null||o.resultOutcome!=="built"&&o.resultOutcome!=="no-change"?null:_g(o.resultTaskId,o.resultRunId),c=UM("task",o.rootId),f=o.primaryAction,u=JU(o);return{item:{id:o.rootId,title:o.title,project:o.repo,state:o.assignmentState,label:r.label,tone:r.tone,href:a(c),resultHref:l===null?null:a(l),action:f===null||u===null?null:{label:f.label,href:a(u)},updatedAt:o.updatedAt,...i===void 0?{}:{detail:i},...o.lead===void 0?{}:{lead:o.lead}},rank:r.rank}});return n.sort((o,r)=>o.rank-r.rank),{crew:n.map(o=>o.item),crewTruncated:e.nextCursor!==null}}var ep=j(he(),1);var Ce=j(fe(),1);function Jf({command:e}){let[t,a]=(0,ep.useState)(!1);return(0,Ce.jsxs)("span",{className:"so-first-run-command",children:[(0,Ce.jsx)("code",{children:e}),(0,Ce.jsx)(_e,{variant:"ghost",size:"sm",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{a(!0),window.setTimeout(()=>a(!1),1500)},()=>{})},"aria-label":`Copy ${e}`,children:t?"Copied":"Copy"})]})}function GM(e,t){return e.trim()===""?t:e.includes(t)?e:`${e.trimEnd()}
|
|
51
51
|
${t}`}function eV(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.lead==="on"||t.agent===!0}function tV(e){(0,ep.useEffect)(()=>{if(!e)return;let t=!1,a=0,n=async()=>{try{let o=await fetch(e,{headers:{accept:"application/json"},cache:"no-store"});if(o.ok&&eV(await o.json())){window.location.reload();return}}catch{}t||(a=window.setTimeout(()=>{n()},5e3))};return a=window.setTimeout(()=>{n()},3e3),()=>{t=!0,window.clearTimeout(a)}},[e])}function aw({firstRun:e}){tV(e.recheck);let t=e.recheck!=null;return(0,Ce.jsxs)("section",{className:"so-first-run","aria-labelledby":"first-run-title","data-first-run":!0,children:[(0,Ce.jsx)("h2",{id:"first-run-title",children:"Get to your first result"}),(0,Ce.jsx)("ol",{className:"so-first-run-steps",children:e.steps.map(a=>(0,Ce.jsxs)("li",{"data-step":a.key,"data-done":a.done,children:[(0,Ce.jsx)("span",{className:"so-first-run-mark","aria-hidden":"true",children:a.done?"✓":""}),(0,Ce.jsxs)("span",{className:"so-first-run-title",children:[a.title,(0,Ce.jsx)("span",{className:"so-sr-only",children:a.done?": done":a.checking?": checking":": not yet"})]}),a.checking&&(0,Ce.jsx)("span",{className:"so-first-run-checking","aria-hidden":"true",children:"Checking…"}),a.action!==null&&(a.key==="agent"&&e.sandbox!==null?null:a.action.kind==="link"?(0,Ce.jsx)(_e,{asChild:!0,variant:"secondary",size:"sm",children:(0,Ce.jsx)("a",{href:a.action.href,children:a.action.label})}):(0,Ce.jsx)(Jf,{command:a.action.command})),a.key==="agent"&&!a.done&&e.sandbox!==null&&a.action?.kind==="command"&&(0,Ce.jsxs)("div",{className:"so-first-run-choices","data-first-run-choices":!0,children:[(0,Ce.jsxs)("div",{"data-sign-in-command":!0,children:[(0,Ce.jsx)("p",{className:"so-first-run-choice-title",children:"Sign in an agent"}),(0,Ce.jsx)("p",{className:"so-first-run-choice-hint",children:"Run this on this computer. Chat turns on by itself once you’re signed in."}),(0,Ce.jsx)(Jf,{command:a.action.command})]}),(0,Ce.jsxs)("div",{children:[(0,Ce.jsx)("p",{className:"so-first-run-choice-title",children:"Or try the sandbox"}),(0,Ce.jsx)("p",{className:"so-first-run-choice-hint",children:"Sample tasks, no spend."}),(0,Ce.jsx)(Jf,{command:e.sandbox})]})]})]},a.key))}),t&&(0,Ce.jsxs)("p",{className:"so-first-run-recheck",role:"status","data-first-run-recheck":!0,children:[(0,Ce.jsx)("span",{className:"so-live-dot","aria-hidden":"true"}),"Checking for a signed-in agent"]})]})}function $M({firstRun:e,onDraft:t}){return(0,Ce.jsxs)("div",{className:"so-first-request","data-first-request":!0,children:[e.intro&&(0,Ce.jsx)("p",{className:"so-first-request-intro","data-how-it-works":!0,children:e.intro}),e.suggestions.length>0&&(0,Ce.jsx)("div",{className:"so-suggestions so-first-request-suggestions","aria-label":"First tasks to try","data-first-tasks":!0,children:e.suggestions.map(a=>(0,Ce.jsx)("button",{type:"button",className:"so-suggestion","data-source":a.source,onClick:()=>t(a.draft),children:a.label},a.draft))}),e.lead&&(0,Ce.jsxs)("p",{className:"so-first-request-lead","data-lead-line":!0,children:[e.lead.words," · ",(0,Ce.jsx)("a",{href:e.lead.href,children:"Change"})]})]})}function jM({phone:e,csrf:t,dismissable:a=!0}){let[n,o]=(0,ep.useState)(!1);if(n)return null;let[r,...s]=e.chatApps;return(0,Ce.jsxs)("section",{className:"so-phone-card","aria-labelledby":"phone-card-title","data-phone-card":!0,children:[(0,Ce.jsx)("h2",{id:"phone-card-title",children:"Use it from your phone"}),(0,Ce.jsxs)("div",{className:"so-phone-options",children:[(0,Ce.jsxs)("div",{children:[(0,Ce.jsx)("p",{className:"so-first-run-choice-title",children:"A chat app"}),(0,Ce.jsxs)("p",{className:"so-first-run-choice-hint",children:["Get results and approve plans in ",r?.label??"Telegram",": add the bot, then pair your phone."]}),r&&(0,Ce.jsx)(_e,{asChild:!0,variant:"secondary",size:"sm",children:(0,Ce.jsxs)("a",{href:r.href,children:["Pair ",r.label]})}),s.length>0&&(0,Ce.jsxs)("p",{className:"so-phone-others",children:["Or ",s.map((i,l)=>(0,Ce.jsxs)("span",{children:[l>0&&(l===s.length-1?" or ":", "),(0,Ce.jsx)("a",{href:i.href,children:i.label})]},i.href))]})]}),(0,Ce.jsxs)("div",{"data-phone-tailnet":!0,children:[(0,Ce.jsx)("p",{className:"so-first-run-choice-title",children:"This console over Tailscale"}),e.tailnet===null?(0,Ce.jsxs)("p",{className:"so-first-run-choice-hint",children:["Install ",(0,Ce.jsx)("a",{href:"https://tailscale.com/download",children:"Tailscale"})," on this computer and your phone, then reload this page for the address."]}):e.tailnet.restart===null?(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsx)("p",{className:"so-first-run-choice-hint",children:"On your phone, open this and sign in:"}),(0,Ce.jsx)(Jf,{command:e.tailnet.address})]}):(0,Ce.jsxs)(Ce.Fragment,{children:[(0,Ce.jsxs)("p",{className:"so-first-run-choice-hint",children:["Start Toolroll with this, then on your phone open ",(0,Ce.jsx)("code",{children:e.tailnet.address})," and sign in:"]}),(0,Ce.jsx)(Jf,{command:e.tailnet.restart})]})]})]}),a&&(0,Ce.jsx)($e,{action:e.dismissHref,onSubmit:i=>{i.preventDefault(),o(!0),fetch(e.dismissHref,{method:"POST",body:new URLSearchParams({csrf:t,quiet:"1"})}).catch(()=>{})},children:(0,Ce.jsx)(_e,{variant:"ghost",size:"sm",type:"submit",children:"Not now"})})]})}function WM({steps:e}){let t=e.find(a=>a.state==="current"||a.state==="stuck");return(0,Ce.jsx)("ol",{className:"first-task-journey","aria-label":`Where this task is: ${t?.label??"Ready"}`,"data-first-task-journey":!0,children:e.map(a=>(0,Ce.jsxs)("li",{"data-step":a.key,"data-state":a.state,"aria-current":a.state==="current"||a.state==="stuck"?"step":void 0,children:[(0,Ce.jsx)("span",{className:"first-task-journey-mark","aria-hidden":"true"}),(0,Ce.jsx)("span",{children:a.label})]},a.key))})}var sE=j(he(),1);var XM=()=>!0,YM=e=>e.build==null?"the last build":`build #${e.build}`,KM=e=>e.build==null?"The last build":`Build #${e.build}`,tp={approval:{sentence:()=>"Review the plan and approve it to start.",action:{code:"approve-scope",label:"Approve plan"}},card:{sentence:()=>"This card is waiting for your approval.",action:{code:"approve-card",label:"Approve card"}},answer:{sentence:()=>"Answer the question so the work can continue.",action:{code:"answer-decision",label:"Answer the question"},useReason:XM},questions:{sentence:()=>"Too many questions are open. Answer one so this task can start.",action:{code:"inspect-decisions",label:"Answer questions"}},"sign-in":{sentence:e=>`${e.provider??"Your agent"} needs you to sign in again. The task starts on its own after.`,action:{code:"sign-in",label:"Sign in again"},useReason:e=>/sign in|API key/i.test(e)},"confirm-stopped":{sentence:e=>`Toolroll can't confirm ${YM(e)} stopped. Nothing from it is running.`,action:{code:"confirm-stopped",label:"Confirm it stopped"}},"check-stopped":{sentence:e=>`Toolroll can't check whether ${YM(e)} stopped. Make sure nothing from it is running, then confirm.`,action:{code:"confirm-stopped",label:"Confirm it stopped"}},hold:{sentence:()=>"A hold is keeping this task from starting. Review it to release it.",action:{code:"inspect-hold",label:"Review hold"}},"choose-project":{sentence:()=>"Choose a project so a builder can start.",action:{code:"place-task",label:"Choose a project"}},"define-task":{sentence:()=>"Say what the task should do so it can be planned.",action:{code:"write-scope",label:"Define the task"}},"fix-request":{sentence:()=>"The request can't be planned as written. Edit it so the planner can start.",action:{code:"write-scope",label:"Edit the request"}},"choose-agent":{sentence:()=>"Choose an agent to build this.",action:{code:"select-agent",label:"Choose an agent"}},"fix-dependency":{sentence:()=>"A task this one waits on didn't finish. Fix or remove it so this one can start.",action:{code:"repair-dependency",label:"Fix the required task"},useReason:e=>/didn't finish|did not finish|before it finished/i.test(e),withReason:e=>`${e.replace(/[.\s]*$/,".")} Fix or remove it so this one can start.`},"add-requirement":{sentence:()=>"This project is missing something the task needs. Add it so a builder can start.",action:{code:"repair-capability",label:"Add the requirement"}},"connect-builder":{sentence:()=>"No builder works on this project yet. Connect one so the task can start.",action:{code:"start-worker",label:"Connect a builder"}},"start-builder":{sentence:()=>"The builder for this project is offline. Start it and the task begins on its own.",action:{code:"start-worker",label:"Start the builder"}},vanished:{sentence:e=>`${KM(e)} stopped without finishing. Check it, then retry.`,action:{code:"reconcile-run",label:"Check the build"}},"review-result":{sentence:()=>"Check the result, then accept it or ask for changes.",action:{code:"open-result",label:"Open result"}},rebuild:{sentence:e=>`${KM(e)} was made to an earlier plan. Build it again to the current plan.`,action:{code:"retry-task",label:"Build again"}},"earlier-version":{sentence:()=>"An earlier version of this task still needs you. Finish it first.",action:{code:"inspect-task",label:"Open earlier version"}},other:{sentence:()=>"Open the task to see what it needs from you.",action:{code:"inspect-task",label:"Open the task"},useReason:XM}};var aV=["witness","unproven","quiescence","quiescent","digest","scope digest"],Die=new RegExp(`\\b(?:${aV.join("|")})\\b`,"i");var ZM=500;var Uie={ok:Gi`<path d="M20 6 9 17l-5-5"/>`,running:Gi`<circle cx="12" cy="12" r="4"/>`,none:Gi`<circle cx="12" cy="12" r="3"/>`,note:Gi`<path d="M12 8v5"/><path d="M12 16.5h.01"/><path d="M10.3 3.9 2.4 18a2 2 0 0 0 1.7 3h15.8a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/>`,failed:Gi`<path d="M18 6 6 18M6 6l12 12"/>`};var QM="More";var He=j(fe(),1),JM={neutral:"bg-muted-foreground",live:"bg-info",attention:"bg-attention",ready:"bg-transparent ring-2 ring-inset ring-success",success:"bg-success",danger:"bg-destructive"},nV={ok:(0,He.jsx)(ja,{className:"size-3.5 text-success","aria-hidden":"true"}),running:(0,He.jsx)(Bi,{className:"size-3.5 text-info","aria-hidden":"true"}),none:(0,He.jsx)(Fi,{className:"size-3 text-muted-foreground","aria-hidden":"true"}),note:(0,He.jsx)(mn,{className:"size-3.5 text-warning","aria-hidden":"true"}),failed:(0,He.jsx)(At,{className:"size-3.5 text-destructive","aria-hidden":"true"})};function Pg({status:e,as:t="h2"}){return(0,He.jsxs)(t,{className:"flex items-center gap-2.5 text-lg font-semibold leading-snug","data-headline":e.headline,children:[(0,He.jsx)("span",{"aria-hidden":"true",className:te("size-2.5 shrink-0 rounded-full",JM[e.tone])}),e.headline]})}var nw="phone:-my-3 phone:inline-block phone:py-3";function oV({detail:e,runChecks:t,csrf:a}){let n=t!==null&&a!==""&&e.action?.href===t.action,o=e.href===null?e.text:(0,He.jsx)("a",{href:e.href,className:te("underline decoration-border underline-offset-4 hover:decoration-muted-foreground",nw),children:e.text});return(0,He.jsxs)("li",{"data-status-detail":e.key,"data-mark":e.mark,className:"grid grid-cols-[14px_7.5rem_minmax(0,1fr)] items-center gap-x-2.5 py-1.5 text-[13px] phone:min-h-11 phone:grid-cols-[14px_6.25rem_minmax(0,1fr)] phone:py-1",children:[(0,He.jsx)("span",{className:"flex items-center justify-center",children:nV[e.mark]}),(0,He.jsx)("span",{className:"text-muted-foreground",children:e.label}),(0,He.jsxs)("span",{className:"flex min-w-0 flex-wrap items-baseline gap-x-2.5",children:[(0,He.jsx)("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:o}),e.action!==null&&(n?(0,He.jsxs)($e,{action:t.action,"data-run-checks":!0,className:"inline",children:[(0,He.jsx)("input",{type:"hidden",name:"level",value:t.level}),(0,He.jsx)("input",{type:"hidden",name:"return",value:t.returnTo}),(0,He.jsx)("button",{type:"submit","data-detail-action":!0,className:te("cursor-pointer whitespace-nowrap font-medium underline-offset-4 hover:underline",nw),children:e.action.label})]}):e.action.href===null?(0,He.jsx)("span",{className:"font-medium",children:e.action.label}):(0,He.jsx)("a",{href:e.action.href,"data-detail-action":!0,className:te("whitespace-nowrap font-medium underline-offset-4 hover:underline",nw,e.mark==="note"&&"text-warning"),children:e.action.label}))]})]})}function Og({status:e,runChecks:t=null,csrf:a=""}){return e.details.length===0?null:(0,He.jsx)("ul",{"aria-label":"Status",className:"flex flex-col border-t border-border pt-2 phone:pt-1.5",children:e.details.map(n=>(0,He.jsx)(oV,{detail:n,runChecks:t,csrf:a},n.key))})}function ow(e,t=[]){return[...new Set([...e.details.flatMap(a=>a.why===null?[]:[`${a.label}: ${a.why}`]),...e.why,...t])]}function eE({status:e,extra:t=[]}){let a=ow(e,t);return a.length===0?null:(0,He.jsxs)("details",{className:"group text-[13px]","data-status-why":!0,children:[(0,He.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 py-1 font-medium text-muted-foreground hover:text-foreground phone:min-h-11 [&::-webkit-details-marker]:hidden",children:[(0,He.jsx)(sa,{className:"size-4 transition-transform group-open:rotate-90","aria-hidden":"true"}),QM]}),(0,He.jsx)("div",{className:"flex flex-col gap-1 pb-1 pl-5.5 pt-1 text-muted-foreground",children:a.map(n=>(0,He.jsx)("p",{className:"[overflow-wrap:anywhere]",children:n},n))})]})}function rV(e){return e==="attention"?"attention":e==="problem"?"danger":e==="live"?"live":e==="ready"?"ready":e==="done"?"success":"neutral"}function dl({label:e,tone:t,className:a,...n}){let o=rV(t);return(0,He.jsxs)("span",{...n,"data-headline":e,className:te("inline-flex w-fit shrink-0 items-center gap-1.5 whitespace-nowrap rounded-[5px] px-1.5 py-px text-[11.5px] font-medium leading-[18px]",o==="attention"?"bg-attention-soft text-attention":"bg-neutral-soft text-neutral-ink",a),children:[(0,He.jsx)("span",{"aria-hidden":"true",className:te("size-1.5 shrink-0 rounded-full",o==="ready"?"bg-transparent ring-[1.5px] ring-inset ring-success":JM[o])}),e]})}function zg({form:e,csrf:t,label:a="Confirm it stopped"}){return(0,He.jsxs)($e,{action:e.action,id:"confirm-stopped","data-confirm-stopped":e.run,className:"flex flex-wrap items-center gap-2 phone:w-full",children:[(0,He.jsx)("input",{type:"hidden",name:"run",value:String(e.run)}),e.returnTo!==void 0&&(0,He.jsx)("input",{type:"hidden",name:"return",value:e.returnTo}),e.checked===!0&&(0,He.jsxs)("label",{className:"flex min-h-11 items-center gap-2 text-sm phone:w-full",children:[(0,He.jsx)("input",{type:"checkbox",name:"checked",value:"yes",required:!0,className:"size-4"}),"Nothing from build #",e.run," is running"]}),(0,He.jsx)(ve,{type:"password",name:"token",autoComplete:"current-password",required:!0,"aria-label":"Your password",placeholder:"Your password",className:"h-9 w-44 phone:h-11 phone:w-full"}),(0,He.jsx)(Z,{type:"submit",variant:"attention",className:"phone:w-full",children:a})]})}function Bg({action:e,csrf:t,label:a="Build again",className:n}){return(0,He.jsx)($e,{action:e,"data-rebuild":!0,className:"phone:w-full",children:(0,He.jsx)(Z,{type:"submit",variant:"attention",className:te("phone:w-full",n),"data-primary-action":!0,children:a})})}var Vs=j(he(),1);function tE(e){let t=Math.max(0,Math.floor(e/1e3));if(t<10)return"just now";if(t<60)return`${t} s ago`;let a=Math.floor(t/60);return a<60?`${a} min ago`:`${Math.floor(a/60)} h ago`}function aE(e,t){let a=Date.parse(e.at),n=Number.isNaN(a)?0:Math.max(0,t-a);return e.worker==="offline"?{text:`Worker offline · last word ${tE(n)}`,quiet:!0}:n>=3e5?{text:`No word for ${Math.floor(n/6e4)} min`,quiet:!0}:{text:`${e.what} · ${tE(n)}`,quiet:!1}}var Fg=j(fe(),1),Hg="so:workspace-nudge";function sV(e=5e3){let[t,a]=(0,Vs.useState)(()=>Date.now());return(0,Vs.useEffect)(()=>{let n=window.setInterval(()=>a(Date.now()),e);return()=>window.clearInterval(n)},[e]),t}function dc({activity:e,className:t}){let a=aE(e,sV());return(0,Fg.jsx)("span",{className:te("block min-w-0 truncate text-[13px]",a.quiet?"font-medium text-warning":"text-muted-foreground",t),"data-activity":a.quiet?"quiet":"fresh",title:a.text,children:(0,Fg.jsx)("time",{dateTime:e.at,children:a.text})})}function nE({people:e}){if(e.length===0)return null;let t=e.length===1?`${e[0]} is also here`:e.length===2?`${e[0]} and ${e[1]} are also here`:`${e[0]} and ${e.length-1} others are also here`;return(0,Fg.jsx)("span",{className:"min-w-0 truncate","data-also-viewing":e.length,role:"status",title:e.join(", "),children:t})}function oE(e){let[t,a]=(0,Vs.useState)([]),n=(0,Vs.useRef)(e?.at??null);n.current=e?.at??null;let o=e?.room??null;return(0,Vs.useEffect)(()=>{o===null&&a([])},[o]),jo(o,(r,s)=>{let i=()=>window.dispatchEvent(new CustomEvent(Hg));if(r==="change"){let l=s.at;(typeof l!="string"||l!==n.current)&&i()}else if(r==="reload")i();else if(r==="here"){let l=s.people;Array.isArray(l)&&a(l.filter(c=>typeof c=="string"))}else(r==="gone"||r==="lost")&&a([])}),t}var $=j(fe(),1);function iV(){(0,sE.useEffect)(()=>{let e=()=>{let t=decodeURIComponent(window.location.hash.slice(1)),a=t===""?null:document.getElementById(t);if(a!==null){a.closest("[data-task-details]")!==null&&window.dispatchEvent(new CustomEvent("so:show-details"));for(let n=a;n!==null;n=n.parentElement)n instanceof HTMLDetailsElement&&(n.open=!0);a.scrollIntoView({block:"start"})}};return e(),window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)},[])}function Gs({html:e,className:t}){return(0,$.jsx)(Kt,{html:e,immutable:!0,...t===void 0?{}:{className:t}})}function sw({action:e,csrf:t,note:a,variant:n="default"}){return(0,$.jsxs)($e,{action:e,"data-retry":!0,className:"flex w-full flex-col gap-1.5",children:[(0,$.jsx)("label",{htmlFor:"retry-note",className:"text-[13px] font-medium",children:"What to change next time"}),(0,$.jsxs)("div",{className:"flex flex-wrap items-end gap-2 phone:flex-col phone:items-stretch",children:[(0,$.jsx)(zt,{id:"retry-note",name:"note",maxLength:ZM,rows:1,defaultValue:a??"",placeholder:"Note for the next attempt (optional)","data-retry-note":!0,className:"min-h-9 min-w-0 flex-1 basis-72 resize-none [field-sizing:content] max-h-40 phone:min-h-11 phone:basis-auto"}),(0,$.jsx)(Z,{type:"submit",variant:n,className:"phone:w-full","data-primary-action":!0,title:"Keeps the branch and workspace",children:"Retry"})]})]})}function lV({failure:e}){return e.evidence===null&&e.link===null?null:(0,$.jsxs)("p",{className:"mt-1 text-[13px] text-muted-foreground phone:leading-[1.35]","data-failure-evidence":!0,children:[e.evidence!==null&&(0,$.jsx)("span",{className:"[overflow-wrap:anywhere]",children:e.evidence}),e.link!==null&&(0,$.jsxs)($.Fragment,{children:[e.evidence!==null&&" ",(0,$.jsx)("a",{href:e.link.href,"data-failure-log":!0,className:"whitespace-nowrap font-medium text-foreground/80 underline decoration-border underline-offset-4 hover:decoration-muted-foreground phone:-my-3 phone:inline-block phone:py-3",children:e.link.label})]})]})}function uV({stop:e,csrf:t}){return(0,$.jsxs)($e,{action:e.action,className:"task-stop-form phone:w-full","data-task-control":"stop","data-control-run":e.run,children:[(0,$.jsx)("input",{type:"hidden",name:"run",value:e.run}),(0,$.jsx)("input",{type:"hidden",name:"return",value:"task"}),(0,$.jsx)(Z,{type:"submit",variant:"destructive",className:"phone:w-full","data-stop-build":!0,children:"Stop"})]})}function cV({view:e,card:t,csrf:a}){let n=t.status.headline==="Failed",o=e.confirmStopped??null,r=e.rebuild??null,s=e.retry??null,i=e.failure??null,l=e.progress?.stuck??null,c=n&&s!=null&&a!=="";return(0,$.jsxs)(Sa,{"data-task-status":!0,"data-work-status":t.token,"data-headline":t.status.headline,"aria-label":"Task status",className:te(n&&"border-destructive/50"),children:[(0,$.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-3 phone:gap-y-2.5",children:[(0,$.jsxs)("div",{className:"min-w-0 flex-1 basis-64",children:[(0,$.jsx)(Pg,{status:t.status}),(0,$.jsxs)("p",{className:te("mt-1.5 text-sm phone:mt-1 phone:leading-[1.35]",n||l!==null?"text-foreground":"text-muted-foreground",l!==null&&"flex gap-2"),...n?{"data-failure-reason":""}:{},...e.progress!=null?{"data-build-progress":""}:{},...l!==null?{"data-build-stuck":l.step}:{},children:[l!==null&&(0,$.jsx)(mn,{className:"mt-0.5 size-3.5 shrink-0 text-warning","aria-hidden":"true"}),(0,$.jsx)("span",{className:"[overflow-wrap:anywhere]",children:t.status.sentence})]}),e.activity!=null&&(0,$.jsx)(dc,{activity:e.activity,className:"mt-1"}),e.record!=null&&(0,$.jsx)("p",{className:"mt-1 text-[13px]",children:(0,$.jsx)("a",{href:e.record.href,"data-build-record":!0,className:"text-muted-foreground underline decoration-border underline-offset-4 hover:text-foreground hover:decoration-muted-foreground phone:inline-flex phone:min-h-11 phone:items-center",children:e.record.label})}),n&&i!=null&&(0,$.jsx)(lV,{failure:i}),n&&i!=null&&!c&&(0,$.jsxs)("p",{className:"mt-1 text-[13px] text-muted-foreground","data-failure-suggestion":!0,children:["What to change: ",i.suggestion]})]}),o!=null&&a!==""?(0,$.jsx)(zg,{form:o,csrf:a,label:t.action?.label??"Confirm it stopped"}):r!=null&&a!==""?(0,$.jsx)(Bg,{action:r.action,csrf:a,label:t.action?.label??"Build again"}):c?null:l?.action!=null||e.stop!=null?(0,$.jsxs)("div",{className:"flex flex-wrap items-center gap-2 phone:w-full phone:flex-col phone:items-stretch",children:[l?.action!=null?(0,$.jsx)(Z,{asChild:!0,variant:"outline",className:"phone:w-full",children:(0,$.jsx)("a",{href:l.action.href,"data-stuck-action":!0,children:l.action.label})}):t.action!==null&&(0,$.jsx)(Z,{asChild:!0,variant:"outline",className:"phone:w-full",children:(0,$.jsxs)("a",{href:t.action.href,"data-primary-action":!0,children:[t.action.label,(0,$.jsx)(ks,{})]})}),e.stop!=null&&a!==""&&(0,$.jsx)(uV,{stop:e.stop,csrf:a})]}):t.action!==null&&(0,$.jsx)(Z,{asChild:!0,variant:t.status.headline==="Needs you"?"attention":"default",className:"phone:w-full",children:(0,$.jsxs)("a",{href:t.action.href,"data-primary-action":!0,...t.action.openResult?{"data-open-result":""}:{},children:[t.action.label,(0,$.jsx)(ks,{})]})})]}),c&&(0,$.jsx)(sw,{action:s.action,csrf:a,note:s.note??i?.suggestion}),(0,$.jsx)(Og,{status:t.status,runChecks:e.runChecks??null,csrf:a}),(t.notices!==null||t.reasons.length>0||t.diagnostics.length>0||t.status.why.length>0||t.status.details.some(f=>f.why!==null))&&(0,$.jsxs)("div",{className:"flex flex-col gap-1 border-t border-border pt-3 text-[13px] phone:pt-2 phone:leading-[1.35]",children:[(0,$.jsx)(eE,{status:t.status,extra:[...t.reasons,...t.diagnostics.map(f=>`${f.label} · ${f.detail}`)]}),t.notices!==null&&(0,$.jsx)(rw,{summary:t.notices.summary,quiet:!0,children:t.notices.lines.map(f=>(0,$.jsx)("p",{className:"text-muted-foreground",children:f},f))})]}),e.earlier!=null&&(0,$.jsx)("div",{className:"border-t border-border pt-1 text-[13px]","data-earlier-attempts":e.earlier.attempts.length,children:(0,$.jsx)(rw,{summary:e.earlier.summary,quiet:!0,children:(0,$.jsx)("ul",{className:"flex flex-col gap-1.5",children:e.earlier.attempts.map(f=>(0,$.jsxs)("li",{className:"text-muted-foreground",children:[(0,$.jsx)("a",{href:f.href,className:"font-medium text-foreground/80 underline decoration-border underline-offset-4 hover:decoration-muted-foreground phone:inline-flex phone:min-h-11 phone:items-center",children:f.label}),f.text!==null&&(0,$.jsxs)($.Fragment,{children:[" · ",f.text]})]},f.href))})})})]})}function rw({summary:e,quiet:t,children:a}){return(0,$.jsxs)("details",{className:"group",children:[(0,$.jsxs)("summary",{className:te("flex cursor-pointer list-none items-center gap-1.5 py-1.5 font-medium phone:min-h-11 [&::-webkit-details-marker]:hidden",t&&"text-muted-foreground hover:text-foreground"),children:[(0,$.jsx)(sa,{className:"size-4 transition-transform group-open:rotate-90","aria-hidden":"true"}),e]}),(0,$.jsx)("div",{className:"pb-2 pl-5.5 pt-1",children:a})]})}function dV({fact:e}){return(0,$.jsx)($.Fragment,{children:e.parts.map((t,a)=>typeof t=="string"?(0,$.jsx)("span",{children:t},a):"at"in t?(0,$.jsx)("time",{dateTime:t.at,title:fc(t.at),className:"tabular-nums",children:vn(t.at)},a):"seal"in t?(0,$.jsx)("code",{className:"mr-1 rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:t.seal},a):(0,$.jsx)("a",{href:t.href,className:"font-medium underline decoration-border underline-offset-4 hover:decoration-muted-foreground phone:relative phone:z-[1] phone:-my-3 phone:inline-flex phone:min-h-11 phone:items-center",children:t.label},a))})}function fV({section:e}){return(0,$.jsxs)("details",{id:e.id,open:e.open,className:"group scroll-mt-4","data-task-section":e.id,children:[(0,$.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-5 py-3.5 hover:bg-accent/50 phone:min-h-11 phone:px-3.5 phone:py-2 [&::-webkit-details-marker]:hidden",children:[(0,$.jsx)(sa,{className:"size-4 text-muted-foreground transition-transform group-open:rotate-90","aria-hidden":"true"}),(0,$.jsx)("h2",{className:"text-[15px] font-semibold",children:e.title}),e.count!==null&&e.count>0&&(0,$.jsx)(wa,{children:e.count})]}),(0,$.jsx)("div",{className:"px-5 pb-5 pt-1 phone:px-3.5 phone:pb-3.5 phone:pt-0",children:(0,$.jsx)(Gs,{html:e.html,className:"so-task-fold"})})]})}function rE({sections:e,label:t}){return e.length===0?null:(0,$.jsx)(Sa,{"aria-label":t,className:"gap-0 divide-y divide-border overflow-hidden p-0 phone:p-0",children:e.map(a=>(0,$.jsx)(fV,{section:a},a.id))})}function vn(e,t=new Date){return Number.isNaN(new Date(e).getTime())?"":Wu(e,t,$i())}var fc=e=>Wh(e,$i());function pV({item:e}){let t=e.kind==="result"&&/failed|refused|never finished/i.test(e.title),a=e.kind==="filed"?(0,$.jsx)(Is,{className:"size-3.5 text-muted-foreground"}):e.kind==="plan"?(0,$.jsx)(to,{className:"size-3.5 text-muted-foreground"}):e.kind==="progress"?(0,$.jsx)(Bi,{className:"size-3.5 text-info"}):e.kind==="question"?(0,$.jsx)(Rs,{className:"size-3.5 text-muted-foreground"}):e.kind==="result"?t?(0,$.jsx)(At,{className:"size-3.5 text-destructive"}):(0,$.jsx)(ja,{className:"size-3.5 text-success"}):(0,$.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground"});return(0,$.jsx)("span",{"aria-hidden":"true",className:"relative z-[1] flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-card",children:a})}function mV({item:e}){return(0,$.jsxs)("li",{"data-thread-entry":e.key,"data-thread-kind":e.kind,className:"so-thread-entry relative flex gap-3",children:[(0,$.jsx)(pV,{item:e}),(0,$.jsxs)("div",{className:"min-w-0 flex-1 pb-5 phone:pb-4",children:[(0,$.jsxs)("p",{className:"flex min-h-6 flex-wrap items-baseline gap-x-2 text-[13px] leading-6",children:[(0,$.jsx)("span",{className:"font-medium text-foreground",children:e.title}),e.author!==""&&(0,$.jsx)("span",{className:"text-muted-foreground",children:e.author}),(0,$.jsx)("time",{dateTime:e.at,title:fc(e.at),className:"ml-auto text-xs tabular-nums text-muted-foreground",children:vn(e.at)})]}),e.text!==null&&e.text.trim()!==""&&(0,$.jsx)("p",{className:te("mt-1 whitespace-pre-line text-sm leading-relaxed [overflow-wrap:anywhere]",e.who==="person"&&"w-fit max-w-full rounded-xl bg-[var(--so-user-bubble)] px-3 py-2"),children:e.text}),e.link!==null&&(0,$.jsx)("a",{href:e.link.href,className:"mt-1 inline-flex text-[13px] font-medium underline decoration-border underline-offset-4 hover:decoration-muted-foreground phone:min-h-11 phone:items-center",children:e.link.label}),e.html!==""&&(0,$.jsx)("div",{className:"mt-2",children:(0,$.jsx)(Gs,{html:e.html,className:"so-thread-card"})}),e.more!==null&&(0,$.jsx)("div",{className:"mt-1 text-[13px]",children:(0,$.jsx)(rw,{summary:e.more.summary,quiet:!0,children:(0,$.jsx)(Gs,{html:e.more.html,className:"so-thread-card"})})})]})]})}function hV({items:e,chat:t,chatHref:a}){let n=[...e.map(o=>({key:`item-${o.key}`,at:o.at,node:(0,$.jsx)(mV,{item:o},`item-${o.key}`)})),...t?.entries??[]].sort((o,r)=>o.at===r.at?0:o.at<r.at?-1:1);return(0,$.jsxs)("section",{"aria-label":"Thread","data-task-thread":!0,...t===null?{}:{"data-workspace-chat":""},className:"flex flex-col",children:[(0,$.jsx)("ol",{className:"so-thread relative flex flex-col",children:n.map(o=>o.node)}),t!==null?t.footer:a!==null&&(0,$.jsxs)("p",{className:"border-t border-border pt-3 text-[13px] text-muted-foreground",children:[(0,$.jsx)("a",{href:a,className:"font-medium text-foreground underline decoration-border underline-offset-4 phone:inline-flex phone:min-h-11 phone:items-center",children:"Message the agent"})," from Chat."]})]})}function gV({facts:e}){return(0,$.jsx)("dl",{className:"grid grid-cols-[8.25rem_minmax(0,1fr)] gap-x-3 gap-y-2.5 text-[13px] phone:gap-y-2",children:e.map(t=>(0,$.jsxs)("div",{className:"contents","data-detail-fact":t.label,children:[(0,$.jsx)("dt",{className:"text-muted-foreground",children:t.label}),(0,$.jsx)("dd",{className:"min-w-0 leading-snug [overflow-wrap:anywhere]",children:(0,$.jsx)(dV,{fact:t})})]},t.label))})}function qg({view:e}){let t=(e.details??[]).filter(o=>o.facts.length>0),a=e.status,n=a!==null&&(a.attempts.length>1||a.lead!==null)?a:null;return(0,$.jsxs)("div",{className:"flex flex-col gap-5 px-5 py-4 phone:gap-4 phone:px-4","data-task-details":!0,children:[t.map(o=>(0,$.jsxs)("section",{"aria-labelledby":`details-${o.title}`,className:"flex flex-col gap-2.5","data-detail-group":o.title,children:[(0,$.jsx)("h2",{id:`details-${o.title}`,className:"text-[12px] font-medium text-muted-foreground",children:o.title}),(0,$.jsx)(gV,{facts:o.facts})]},o.title)),n!==null&&(0,$.jsxs)("section",{"aria-labelledby":"details-attempts",className:"flex flex-col gap-2 border-t border-border pt-4 text-[13px]",children:[(0,$.jsxs)("h2",{id:"details-attempts",className:"flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground",children:["Attempts ",(0,$.jsx)(wa,{children:n.attempts.length})]}),(0,$.jsx)("ol",{className:"flex flex-col gap-2",children:n.attempts.map(o=>(0,$.jsxs)("li",{"data-attempt-task":o.taskId,children:[(0,$.jsx)("a",{href:o.href,className:"font-medium hover:underline hover:underline-offset-4 phone:inline-flex phone:min-h-11 phone:items-center",children:o.label}),o.runId!==null&&(0,$.jsxs)($.Fragment,{children:[" · ",(0,$.jsxs)("a",{href:`/r/${o.runId}`,className:"text-muted-foreground hover:underline",children:["Run #",o.runId]})]}),o.detail!==null&&(0,$.jsx)("p",{className:"text-muted-foreground",children:o.detail})]},o.taskId))}),n.lead!==null&&(0,$.jsxs)("p",{className:"text-muted-foreground",children:["Lead: ",n.lead.label,n.lead.active?"":" · access ended"]})]}),(0,$.jsx)(rE,{sections:e.sections,label:"Task details"}),(e.manage.length>0||e.cancel!==null||e.everyTime)&&(0,$.jsxs)("section",{"aria-labelledby":"task-manage",className:"flex flex-col gap-3 phone:gap-2",children:[(0,$.jsx)("h2",{id:"task-manage",className:"text-[12px] font-medium text-muted-foreground",children:"Manage"}),(0,$.jsx)(rE,{sections:e.manage,label:"Manage"}),e.everyTime&&(0,$.jsxs)("a",{href:e.everyTime.href,"data-every-time":!0,className:"flex min-h-12 items-center gap-2 rounded-lg border border-border bg-card px-4 text-[14px] font-semibold transition-colors hover:bg-accent",children:[(0,$.jsx)(Lf,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),"Do this every time…",(0,$.jsx)("span",{className:"ml-auto truncate pl-3 text-[12px] font-normal text-muted-foreground",children:e.everyTime.starter})]}),e.cancel!==null&&(0,$.jsxs)("details",{open:e.cancel.open,className:"group rounded-lg border border-destructive/30 bg-card","data-task-section":"cancel",children:[(0,$.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-[14px] font-semibold text-destructive phone:min-h-11 phone:px-3.5 phone:py-2 [&::-webkit-details-marker]:hidden",children:[(0,$.jsx)(sa,{className:"size-4 transition-transform group-open:rotate-90","aria-hidden":"true"}),"Cancel task"]}),(0,$.jsx)("div",{className:"px-4 pb-4 pt-1 phone:px-3.5 phone:pb-3.5 phone:pt-0",children:(0,$.jsx)(Gs,{html:e.cancel.html,className:"so-task-cancel"})})]})]})]})}function iE({view:e,chat:t=null,details:a=!0,csrf:n=""}){iV();let o=oE(e.live);return(0,$.jsxs)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-4 phone:gap-3",children:[(0,$.jsxs)("header",{className:"flex flex-col gap-3 pb-1 phone:gap-2 phone:pb-0",children:[(0,$.jsxs)("div",{className:"flex flex-wrap items-start gap-x-4 gap-y-3 phone:gap-y-2",children:[(0,$.jsxs)("div",{className:"min-w-0 flex-1 basis-72",children:[(0,$.jsx)("h1",{className:"text-[26px] font-semibold leading-tight tracking-tight phone:text-[22px]",children:e.title}),(0,$.jsxs)("p",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted-foreground phone:mt-0.5",children:[e.project!==null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("span",{className:"font-medium text-foreground/80",children:e.project}),(0,$.jsx)("span",{"aria-hidden":"true",children:"·"})]}),(0,$.jsx)("span",{className:"min-w-0 truncate font-mono text-xs",children:e.id}),e.scout&&(0,$.jsx)(wa,{tone:"info",children:"Scout"}),o.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,$.jsx)(nE,{people:o})]})]})]}),e.tabs.length>0&&(0,$.jsx)("nav",{"aria-label":"Task view",children:(0,$.jsx)("ul",{className:"inline-flex h-10 items-center gap-1 rounded-lg bg-muted p-1 phone:h-[52px]",children:e.tabs.map(r=>(0,$.jsx)("li",{className:"h-full",children:(0,$.jsx)("a",{href:r.href,"aria-current":r.active?"page":void 0,className:te("inline-flex h-full items-center rounded-md px-3.5 text-sm font-semibold text-muted-foreground transition-colors hover:text-foreground",r.active&&"bg-card text-foreground shadow-sm"),children:r.label})},r.href))})})]}),e.version!==null&&(0,$.jsxs)("p",{className:"rounded-md bg-info-soft px-3 py-2 text-[13px] text-info",children:[e.version.label," · ",(0,$.jsx)("a",{href:e.version.current.href,className:"font-semibold underline underline-offset-4",children:e.version.current.label})]})]}),e.journey!=null&&(0,$.jsx)(WM,{steps:e.journey}),e.status!==null?(0,$.jsx)(cV,{view:e,card:e.status,csrf:n}):(0,$.jsx)(Gs,{html:e.statusHtml}),e.approval!==""&&(0,$.jsx)(Gs,{html:e.approval,className:"so-task-approval"}),e.lead.map(r=>(0,$.jsx)(Gs,{html:r.html,className:`so-task-lead so-task-lead--${r.key}`},r.key)),e.questions!==""&&(0,$.jsx)(Sa,{children:(0,$.jsx)(Gs,{html:e.questions,className:"so-task-questions"})}),(0,$.jsx)("div",{className:"mt-2 phone:mt-1",children:(0,$.jsx)(hV,{items:e.thread??[],chat:t,chatHref:e.tabs.length>0?null:e.chatHref??null})}),a&&(0,$.jsx)("div",{className:"border-t border-border pt-2",children:(0,$.jsx)(qg,{view:e})})]})}var be=j(fe(),1);function iw({csrf:e,path:t,destination:a,children:n,className:o}){return(0,be.jsxs)($e,{action:"/projects/open",className:te("inline-flex",o),children:[(0,be.jsx)("input",{type:"hidden",name:"path",value:t}),(0,be.jsx)("input",{type:"hidden",name:"return",value:a}),n]})}function xV(e){let t=vn(e);return t===""?"":/^\d/.test(t)?"Opened today":t.startsWith("Yesterday")?"Opened yesterday":`Opened ${t}`}function vV({row:e,csrf:t,returnTo:a,choosing:n}){return(0,be.jsxs)("li",{className:te("flex items-center gap-x-4 px-2 py-3 phone:grid phone:grid-cols-[minmax(0,1fr)_auto] phone:gap-x-2 phone:py-1.5",e.open&&"bg-accent/40"),"data-project":e.path,children:[(0,be.jsx)(Vu,{className:"size-4 shrink-0 text-muted-foreground phone:hidden","aria-hidden":"true"}),(0,be.jsxs)("div",{className:"min-w-0 flex-1 phone:contents",children:[(0,be.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 phone:contents",children:[e.open?(0,be.jsx)("a",{href:a,className:"font-semibold hover:underline hover:underline-offset-4 phone:col-start-1 phone:row-start-1 phone:-my-3 phone:justify-self-start phone:py-3 phone:leading-5",children:e.name}):(0,be.jsx)(iw,{csrf:t,path:e.path,destination:a,className:"phone:col-start-1 phone:row-start-1 phone:justify-self-start",children:(0,be.jsx)("button",{type:"submit",className:"text-left font-semibold hover:underline hover:underline-offset-4 phone:-my-3 phone:py-3 phone:leading-5",children:e.name})}),(0,be.jsx)("span",{className:"contents phone:col-span-full phone:row-start-2 phone:flex phone:flex-wrap phone:items-center phone:gap-x-2 phone:pointer-events-none phone:gap-y-[26px] phone:pt-3.5 phone:empty:hidden",children:e.peek?.map(o=>e.open?(0,be.jsx)("a",{href:o.href,className:"inline-flex phone:pointer-events-auto phone:-my-3 phone:py-3",children:(0,be.jsx)("span",{className:Qh({tone:o.tone}),children:o.label})},o.label):(0,be.jsx)(iw,{csrf:t,path:e.path,destination:o.href,children:(0,be.jsx)("button",{type:"submit",className:"inline-flex phone:pointer-events-auto phone:-my-3 phone:py-3",children:(0,be.jsx)("span",{className:Qh({tone:o.tone}),children:o.label})})},o.label))})]}),(0,be.jsxs)("p",{className:"mt-0.5 truncate text-[13px] text-muted-foreground phone:pointer-events-none phone:col-span-full phone:row-start-3 phone:mt-1.5 phone:leading-[1.35]",title:e.path,children:[(0,be.jsx)("span",{className:"font-mono text-xs",children:e.shortPath}),e.openedAt!==null&&(0,be.jsxs)(be.Fragment,{children:[" · ",xV(e.openedAt)]}),e.peek===null&&(0,be.jsx)(be.Fragment,{children:" · Not scanned"})]})]}),(0,be.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 phone:col-start-2 phone:row-start-1",children:[(0,be.jsx)(Z,{asChild:!0,variant:"ghost",size:"sm",className:"phone:w-11 phone:px-0",children:(0,be.jsxs)("a",{href:e.knowledgeHref,"aria-label":`${e.name} knowledge`,children:[(0,be.jsx)(Oi,{}),(0,be.jsx)("span",{className:"phone:sr-only",children:"Knowledge"})]})}),e.checks&&(0,be.jsx)(Z,{asChild:!0,variant:"ghost",size:"sm",className:"phone:w-11 phone:px-0",children:(0,be.jsxs)("a",{href:e.checks.href,"aria-label":`${e.name} checks: ${e.checks.level}`,children:[(0,be.jsx)(to,{}),(0,be.jsxs)("span",{className:"phone:sr-only",children:["Checks · ",e.checks.level]})]})}),e.pullRequests&&(0,be.jsx)(Z,{asChild:!0,variant:"ghost",size:"sm",className:"phone:w-11 phone:px-0",children:(0,be.jsxs)("a",{href:e.pullRequests.href,"aria-label":`${e.name} pull requests: ${e.pullRequests.on?"on":"off"}`,children:[(0,be.jsx)(Ns,{}),(0,be.jsxs)("span",{className:"phone:sr-only",children:["Pull requests",e.pullRequests.on?"":" · Off"]})]})}),e.open?(0,be.jsx)(wa,{tone:"success",children:"Open now"}):(0,be.jsx)(iw,{csrf:t,path:e.path,destination:a,children:(0,be.jsx)(Z,{type:"submit",variant:"outline",size:"sm",children:n?"Choose":"Open"})})]})]})}function lE({label:e,rows:t,...a}){return t.length===0?null:(0,be.jsxs)("section",{"aria-label":e,className:"flex flex-col gap-2",children:[(0,be.jsx)("h2",{className:"text-sm font-semibold text-muted-foreground",children:e}),(0,be.jsx)("div",{className:"border-y border-border",children:(0,be.jsx)("ul",{className:"divide-y divide-border",children:t.map(n=>(0,be.jsx)(vV,{row:n,...a},n.path))})})]})}function uE({view:e,csrf:t}){let a={csrf:t,returnTo:e.returnTo,choosing:e.choosing},n=e.recent.length===0&&e.available.length===0;return(0,be.jsxs)("div",{className:"flex w-full flex-col gap-5 phone:gap-3",children:[(0,be.jsxs)("header",{className:"flex flex-wrap items-center gap-3",children:[(0,be.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,be.jsx)("h1",{className:"text-[26px] font-semibold leading-tight tracking-tight phone:text-[22px]",children:e.choosing?"New task":"Projects"}),e.choosing&&(0,be.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Choose the project it belongs to."})]}),!n&&(0,be.jsx)(Z,{asChild:!0,variant:"outline",size:"sm",children:(0,be.jsxs)("a",{href:"#add-project",children:[(0,be.jsx)(Yt,{}),"Add project"]})})]}),e.problem!==null&&(0,be.jsx)("p",{role:"alert",className:"rounded-md bg-destructive-soft px-3 py-2 text-sm text-destructive",children:e.problem}),(0,be.jsx)(lE,{label:"Recent",rows:e.recent,...a}),(0,be.jsx)(lE,{label:"Available",rows:e.available,...a}),(0,be.jsxs)("section",{id:"add-project",className:"flex scroll-mt-4 flex-col gap-3 border-t border-border pt-5 phone:gap-2 phone:pt-3",children:[(0,be.jsx)("h2",{className:"text-base font-semibold",children:n?"Add your first project":"Add a project"}),(e.add.browse!==null||e.add.github!==null)&&(0,be.jsxs)("div",{className:"flex flex-wrap gap-2",children:[e.add.browse!==null&&(0,be.jsx)(Z,{asChild:!0,variant:"outline",children:(0,be.jsxs)("a",{href:e.add.browse,children:[(0,be.jsx)(Vu,{}),"Choose a folder"]})}),e.add.github!==null&&(0,be.jsx)(Z,{asChild:!0,variant:"outline",children:(0,be.jsxs)("a",{href:e.add.github,children:[(0,be.jsx)(lf,{}),"Add from GitHub"]})})]}),(0,be.jsx)(Kt,{html:e.add.html,immutable:!0,className:"so-project-add"})]})]})}var lw=j(he(),1);var Ug="Accepting needs a reason";function cE(e){let t=e.canRequest?"request-changes":null,a=e.accept===null?null:"accept";if(e.failed!=null){let n=e.runChecks&&!e.checksRunning?"run-checks":e.checksRunning?"checks-running":null,o=e.failed.acceptAnyway===!0?"accept-anyway":null;return e.failed.retry?{primary:"retry",secondary:o??n,line:null}:{primary:n,secondary:o,line:null}}return e.need!==null?{primary:e.need,secondary:t,line:null}:e.next!==null?{primary:e.next,secondary:a??t,line:null}:e.blocked!==null?{primary:t,secondary:a,line:e.blocked}:a!==null&&(e.unanswered??0)>0?{primary:"next-check",secondary:a,line:null}:a!==null&&(e.notRight??0)>0?{primary:t,secondary:a,line:null}:e.checksRunning?{primary:"checks-running",secondary:a??t,line:null}:e.accept===null?{primary:null,secondary:t,line:null}:e.accept.ready?{primary:"accept",secondary:t,line:null}:e.runChecks?{primary:"run-checks",secondary:"accept",line:null}:{primary:"accept",secondary:t,line:null}}function dE(e,t){let a=n=>`“${n[0].replace(/[.!?]+$/,"")}”${n.length>1?` and ${n.length-1} more`:""}`;return t.unanswered.length>0?{label:"Accept without your check",ready:!1,why:`Not checked yet: ${a(t.unanswered)}.`}:t.notRight.length>0?{label:"Accept anyway",ready:!1,why:`You marked ${a(t.notRight)} not right.`}:e}function fE(e,t,a){let n=e.met+t,o=Math.max(0,e.yours-t-a);return{text:`${n} of ${e.total} met${o>0?` · You check ${o}`:""}`,done:n===e.total,short:e.total-n-o>0}}function Vg(e){switch(e){case"attention":return"attention";case"problem":return"danger";case"live":return"info";case"ready":case"done":return"success";default:return"neutral"}}var F=j(fe(),1),uw={attention:"bg-attention",danger:"bg-destructive",info:"bg-info",success:"bg-success",neutral:"bg-muted-foreground",warning:"bg-warning"};function pc({html:e,className:t}){return(0,F.jsx)(Kt,{html:e,immutable:!0,...t===void 0?{}:{className:t}})}var cw=e=>vn(e);function yV({view:e}){return e.results.length===0?null:(0,F.jsxs)(ic,{children:[(0,F.jsx)(lc,{asChild:!0,children:(0,F.jsxs)(Z,{variant:"outline",size:"sm",children:["Results ",(0,F.jsx)("span",{className:"rounded-full bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:e.results.length}),e.attention>0&&(0,F.jsx)("span",{className:"rounded-full bg-attention px-1.5 text-xs tabular-nums text-on-attention",title:`${e.attention} need your attention`,children:e.attention}),(0,F.jsx)(Xo,{})]})}),(0,F.jsxs)(uc,{align:"end",className:"max-h-[70vh] w-80 overflow-y-auto",children:[e.attention>0&&(0,F.jsxs)(Kb,{className:"text-xs text-attention",children:[e.attention," need",e.attention===1?"s":""," your attention"]}),e.results.map(t=>(0,F.jsx)(cc,{asChild:!0,children:(0,F.jsxs)("a",{href:t.href,"aria-current":t.current?"page":void 0,className:te("flex items-start gap-2.5",t.current&&"bg-accent"),children:[(0,F.jsx)("span",{"aria-hidden":"true",className:te("mt-1.5 size-2 shrink-0 rounded-full",t.status===null?"bg-muted-foreground":uw[Vg(t.status.tone)])}),(0,F.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,F.jsx)("span",{className:te("block truncate",t.needsYou?"font-semibold":"font-medium"),children:t.title}),(0,F.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:[t.status?.label,...t.notes,cw(t.at)].filter(Boolean).join(" · ")})]})]})},t.href)),e.capped!==null&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(zM,{}),(0,F.jsxs)(Kb,{className:"text-xs font-normal text-muted-foreground",children:["Showing the newest ",e.capped,"; older results open from their task."]})]})]})]})}function bV({headline:e}){return(0,F.jsxs)("h2",{className:"flex items-center gap-2.5 text-lg font-semibold leading-snug","data-mismatch-headline":!0,children:[(0,F.jsx)("span",{"aria-hidden":"true",className:"size-2.5 shrink-0 rounded-full bg-warning"}),e]})}function wV({selected:e,acts:t,answers:a}){let{panel:n,checks:o}=e,r=g=>{if(g===null)return!1;let b=new URL(g,window.location.origin);return b.pathname==="/review"&&b.searchParams.get("result")===e.taskId&&!b.searchParams.has("tab")&&b.hash===""},s=n?.requirements==null||n.youCheck==null?null:fE(n.requirements,[...a.values()].filter(g=>g==="right").length,[...a.values()].filter(g=>g==="not-right").length),i=n?.status==null?null:{...n.status,details:n.status.details.map(g=>{let b=s!==null&&g.key==="requirements"&&g.text!=="Unverified"?{...g,text:s.text,mark:s.done?"ok":s.short?g.mark==="ok"?"note":g.mark:"none"}:g;return b.action!==null&&r(b.action.href)?{...b,action:null}:b})},l=Vg(e.status.tone),c=t.primary==="rebuild"||t.primary==="confirm-stopped",f=e.noRun??(n!==null&&!c?n.outcome:i?.sentence??n?.outcome??""),u=e.mismatch,d=[...new Set([...i===null&&o?.problem===!0?[o.detail]:[],...e.problem===null?[]:[e.problem],...n?.attention??[]])].filter(g=>u===null||!u.said.includes(g)),m=i?.headline==="Failed";return(0,F.jsxs)(Sa,{"data-result-status":e.status.token,"data-headline":i?.headline??e.status.label,"aria-label":"Result status",children:[(0,F.jsxs)("div",{className:"min-w-0",children:[u?.headline!=null?(0,F.jsx)(bV,{headline:u.headline}):i!==null?(0,F.jsx)(Pg,{status:i}):(0,F.jsxs)("h2",{className:"flex items-center gap-2.5 text-lg font-semibold leading-snug",children:[(0,F.jsx)("span",{"aria-hidden":"true",className:te("size-2.5 shrink-0 rounded-full",uw[l])}),e.status.label]}),f!==""&&(0,F.jsx)("p",{className:te("mt-1.5 max-w-[75ch] text-sm",e.failure!=null?"text-foreground":"text-muted-foreground"),"data-result-sentence":!0,...e.failure!=null?{"data-failure-reason":""}:{},children:f}),e.failure!=null&&(e.failure.evidence!==null||e.failure.link!==null)&&(0,F.jsxs)("p",{className:"mt-1 max-w-[75ch] text-[13px] text-muted-foreground","data-failure-evidence":!0,children:[e.failure.evidence!==null&&(0,F.jsx)("span",{className:"[overflow-wrap:anywhere]",children:e.failure.evidence}),e.failure.link!==null&&(0,F.jsxs)(F.Fragment,{children:[e.failure.evidence!==null&&" ",(0,F.jsx)("a",{href:e.failure.link.href,"data-failure-log":!0,className:mc,children:e.failure.link.label})]})]})]}),u!==null&&u.rows.length>0&&(0,F.jsx)("ul",{"aria-label":"What doesn't match",className:"flex flex-col gap-1.5 border-t border-border pt-3 text-[13px] phone:pt-2","data-mismatches":u.rows.length,children:u.rows.map((g,b)=>(0,F.jsxs)("li",{"data-mismatch":!0,className:"flex gap-2",children:[(0,F.jsx)(mn,{className:"mt-0.5 size-3.5 shrink-0 text-warning","aria-hidden":"true"}),(0,F.jsxs)("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:[g.text,g.path!==null&&g.absent&&(0,F.jsxs)(F.Fragment,{children:[" ",(0,F.jsx)("code",{className:"font-mono text-xs",children:g.path})," ",(0,F.jsx)("span",{className:"text-muted-foreground","data-mismatch-absent":!0,children:"— not in the saved changes"})]}),g.href!==null&&(g.path!==null||g.noteLabel!==null)&&(0,F.jsxs)(F.Fragment,{children:[" · ",(0,F.jsx)("a",{href:g.href,"data-mismatch-lines":!0,className:te("font-medium text-foreground/80 underline decoration-border underline-offset-4 hover:decoration-muted-foreground phone:-my-3 phone:inline-block phone:py-3",g.path!==null&&"font-mono text-xs"),children:g.path!==null?`${g.path}${g.lines===null?"":`, ${g.lines}`}`:g.noteLabel})]})]})]},b))}),i!==null&&(0,F.jsx)(Og,{status:i}),d.length>0&&(0,F.jsx)("ul",{className:"flex flex-col gap-1 text-[13px]","aria-label":"Caveats","data-result-attention":d.length,children:d.map(g=>(0,F.jsxs)("li",{"data-caveat":!0,className:"flex gap-2",children:[(0,F.jsx)(mn,{className:te("mt-0.5 size-3.5 shrink-0",m?"text-destructive":"text-warning"),"aria-hidden":"true"}),(0,F.jsx)("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:g})]},g))})]})}function SV(e){let t=document.getElementById("comment-form"),a=t?.querySelector("textarea[name=note]")??null,n=t?.closest("details")??null;if(n!==null&&!n.open&&(n.open=!0),a===null){window.location.hash="request-changes";return}let o=`Not right: “${e}” — `;a.value.includes(o)||(a.value=a.value.trim()===""?o:`${a.value.trimEnd()}
|
|
52
52
|
|
|
53
53
|
${o}`),a.dispatchEvent(new Event("input",{bubbles:!0})),a.scrollIntoView({block:"center",behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"}),a.focus(),a.setSelectionRange(a.value.length,a.value.length)}function CV({excerpt:e,changesHref:t}){return(0,F.jsxs)("figure",{className:"overflow-hidden rounded-md border border-border","data-check-excerpt":e.path,children:[(0,F.jsxs)("figcaption",{className:"flex flex-wrap items-baseline gap-x-2 border-b border-border bg-muted px-3 py-1.5 text-xs text-muted-foreground",children:[(0,F.jsx)("span",{className:"font-mono text-foreground [overflow-wrap:anywhere]",children:e.path}),!e.cited&&(0,F.jsx)("span",{children:"first changed file"})]}),(0,F.jsx)("ol",{className:"font-mono text-xs leading-relaxed",children:e.lines.map((a,n)=>(0,F.jsxs)("li",{"data-kind":a.kind,className:te("grid grid-cols-[2.5rem_1rem_minmax(0,1fr)] px-1 py-0.5",a.kind==="addition"?"bg-success-soft":a.kind==="deletion"?"bg-destructive-soft":""),children:[(0,F.jsx)("span",{className:"select-none pr-2 text-right text-muted-foreground tabular-nums",children:a.line??""}),(0,F.jsx)("span",{"aria-hidden":"true",className:"select-none text-muted-foreground",children:a.kind==="addition"?"+":a.kind==="deletion"?"−":" "}),(0,F.jsxs)("code",{className:"whitespace-pre-wrap rounded-none bg-transparent p-0 font-mono text-xs text-foreground [overflow-wrap:anywhere]",children:[(0,F.jsx)("span",{className:"sr-only",children:a.kind==="addition"?"Added: ":a.kind==="deletion"?"Removed: ":""}),a.text]})]},n))}),e.more>0&&(0,F.jsxs)("p",{className:"border-t border-border px-3 py-1.5 text-xs text-muted-foreground",children:[e.more," more changed line",e.more===1?"":"s",t===null?"":(0,F.jsxs)(F.Fragment,{children:[" in ",(0,F.jsx)("a",{href:t,"data-result-goto":"changes",className:"underline underline-offset-4",children:"Changes"})]})]})]})}function pE(e){let t=e?.youCheck??null;return t==null?[]:t.items.length>0?t.items:t.lines.map((a,n)=>({id:`line-${n}`,statement:"",words:a,note:null,excerpts:[],shots:[]}))}var Gg=e=>e.statement===""?e.words:e.statement;function kV(e){let t=document.querySelector(`[data-check-item="${CSS.escape(e)}"]`);t!==null&&(t.scrollIntoView({block:"center",behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"}),t.querySelector("[data-looks-right]")?.focus({preventScroll:!0}))}function LV({panel:e,chatHref:t,answers:a,answer:n}){let o=pE(e),r=e.tabs.find(s=>s.key==="changes")?.href??null;return(0,F.jsxs)(Sa,{"aria-labelledby":"you-check-title","data-result-you-check":o.length,className:"gap-0 p-0 phone:gap-0 phone:p-0",children:[(0,F.jsx)("h2",{id:"you-check-title",className:"px-5 pb-1 pt-4 text-[15px] font-semibold phone:px-4",children:o.length===1?"You check this one":`You check these ${o.length}`}),(0,F.jsx)("ul",{className:"divide-y divide-border",children:o.map(s=>{let i=a.get(s.id)??null;return(0,F.jsxs)("li",{"data-check-item":s.id,"data-looks-right":i==="right"?"1":void 0,"data-not-right":i==="not-right"?"1":void 0,className:"flex scroll-mt-4 flex-col gap-3 px-5 py-4 phone:px-4",children:[(0,F.jsx)("p",{className:"max-w-[75ch] text-sm font-medium",children:Gg(s)}),s.note!==null&&(0,F.jsxs)("p",{className:"max-w-[75ch] text-[13px] text-muted-foreground",children:["The agent says: ",s.note]}),s.excerpts.map(l=>(0,F.jsx)(CV,{excerpt:l,changesHref:r},l.path)),s.shots.length>0&&(0,F.jsx)("ul",{className:"flex flex-wrap gap-2","aria-label":"Screenshots",children:s.shots.map(l=>(0,F.jsx)("li",{children:(0,F.jsx)("a",{href:l.href,className:"block overflow-hidden rounded-md border border-border hover:border-muted-foreground",title:l.caption,children:(0,F.jsx)("img",{src:l.src,alt:l.caption,loading:"lazy",className:"h-24 w-auto max-w-[12rem] object-cover phone:h-20"})})},l.src))}),(0,F.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,F.jsxs)(Z,{variant:"outline","aria-pressed":i==="right",className:"min-h-11 aria-pressed:bg-success-soft aria-pressed:text-success phone:flex-1","data-looks-right":!0,onClick:()=>n(s.id,i==="right"?null:"right"),children:[(0,F.jsx)(ja,{}),"Looks right"]}),e.canRequest?(0,F.jsx)(Z,{variant:"ghost","aria-pressed":i==="not-right",className:"min-h-11 aria-pressed:bg-warning-soft aria-pressed:text-foreground phone:flex-1","data-not-right":!0,onClick:()=>{let l=i==="not-right";n(s.id,l?null:"not-right"),l||SV(Gg(s))},children:"Not right"}):(0,F.jsx)(Z,{asChild:!0,variant:"ghost",className:"min-h-11 phone:flex-1",children:(0,F.jsx)("a",{href:t,"data-not-right":!0,children:"Not right"})})]})]},s.id)})})]})}function IV({selected:e,csrf:t,acts:a,decision:n,firstUnanswered:o}){let{next:r}=e,[s,i]=(0,lw.useState)(!1),l=e.complete,c=e.panel?.need??null,f=e.panel?.youCheck??null,u=l===null?c?.accept??(f?.accept==null?null:{...f.accept,note:null}):null,d=[a.primary,a.secondary].filter(C=>C!==null),m=d.includes("accept")?n?.why??null:null,g=d.includes("accept")?l!==null?l.accept?.note??null:u?.note??null:null,b=g!==null||d.includes("accept-anyway"),v=a.line===Ug&&b?null:a.line??m,x=(C,I)=>{let L=I?"attention":"outline",T={"data-act":C,...I?{"data-ink-act":C,"data-primary-action":""}:{}},A="min-h-11 phone:w-full";switch(C){case"retry":return e.failure?.retry==null?null:(0,F.jsx)(sw,{action:e.failure.retry.action,csrf:t,note:e.failure.retry.note,variant:L==="attention"?"attention":"default"},C);case"accept":{if(n===null)return null;let D=l??u;return D===null?null:(0,F.jsxs)($e,{action:D.action,className:te(g===null?"flex flex-wrap items-center gap-2 phone:w-full":"flex w-full max-w-sm flex-col items-start gap-2 phone:max-w-none"),...g===null?{}:{"data-accept-with-reason":""},children:[(0,F.jsx)("input",{type:"hidden",name:"run",value:String(D.run)}),l!==null?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("input",{type:"hidden",name:"receipt",value:l.receipt}),l.accept!=null&&(0,F.jsx)("input",{type:"hidden",name:"accept",value:"1"})]}):u!==null&&(0,F.jsx)("input",{type:"hidden",name:"return",value:u.returnTo}),g!==null&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("label",{htmlFor:"accept-reason",className:"text-[13px] font-medium","data-accept-needs-reason":!0,children:Ug}),(0,F.jsx)(ve,{id:"accept-reason",type:"text",name:"note",maxLength:500,required:!0,placeholder:g,className:"h-11 w-full"})]}),(0,F.jsxs)(Z,{type:"submit",variant:L,className:A,...T,"data-accept-result":!0,children:[(0,F.jsx)(ja,{className:"phone:hidden"}),n.label]})]},C)}case"accept-anyway":{let D=e.failure?.acceptAnyway??null;return D==null?null:(0,F.jsxs)($e,{action:D.action,className:"flex w-full max-w-sm flex-col items-start gap-2 phone:max-w-none","data-accept-with-reason":!0,"data-accept-anyway":!0,children:[(0,F.jsx)("input",{type:"hidden",name:"run",value:String(D.run)}),(0,F.jsx)("input",{type:"hidden",name:"return",value:D.returnTo}),(0,F.jsx)("label",{htmlFor:"accept-reason",className:"text-[13px] font-medium","data-accept-needs-reason":!0,children:Ug}),(0,F.jsx)(ve,{id:"accept-reason",type:"text",name:"note",maxLength:500,required:!0,placeholder:"Why is this safe to accept?",className:"h-11 w-full"}),(0,F.jsxs)(Z,{type:"submit",variant:"outline",className:A,...T,"data-accept-result":!0,children:[(0,F.jsx)(ja,{className:"phone:hidden"}),"Accept anyway"]})]},C)}case"next-check":return o===null?null:(0,F.jsx)(Z,{type:"button",variant:L,className:A,...T,onClick:()=>kV(o),children:"Go to your check"},C);case"checks-running":return(0,F.jsx)(Z,{type:"button",variant:L,disabled:!0,"aria-disabled":"true",className:A,...T,children:"Checks running"},C);case"run-checks":return e.runChecks===null?null:(0,F.jsxs)($e,{action:e.runChecks.action,className:"phone:w-full",children:[(0,F.jsx)("input",{type:"hidden",name:"level",value:e.runChecks.level}),(0,F.jsx)("input",{type:"hidden",name:"return",value:e.runChecks.returnTo}),(0,F.jsx)(Z,{type:"submit",variant:L,className:A,...T,children:"Run checks"})]},C);case"request-changes":return(0,F.jsx)(Z,{asChild:!0,variant:L,className:A,children:(0,F.jsx)("a",{href:"#request-changes",...T,children:"Request changes"})},C);case"rebuild":return c?.rebuild==null?null:(0,F.jsx)(Bg,{action:c.rebuild.action,csrf:t,label:c.label,className:"min-h-11"},C);case"confirm-stopped":return c?.confirm==null?null:(0,F.jsx)(zg,{form:c.confirm,csrf:t,label:c.label},C);case"revise":case"draft-repair":return r===null?null:(0,F.jsx)(pc,{html:r.control,className:"so-result-next phone:w-full"},C)}};if(d.length===0&&r===null&&e.failure==null)return null;let y=n!==null&&d.includes("accept")?n.effect:null,h=a.primary!==null?a.secondary:null,w=h!==null||v!==null||r!==null||y!==null,S=s?"":"phone:hidden";return(0,F.jsxs)(Sa,{"data-result-decision":a.primary??"none","aria-label":"Decision","data-dock":s?"open":"compact",className:te("gap-2 phone:gap-2",d.length>0&&"phone:sticky phone:bottom-[-20px] phone:z-10 phone:-mx-4 phone:rounded-none phone:border-x-0 phone:px-4 phone:py-3 phone:pb-[max(12px,env(safe-area-inset-bottom))] phone:shadow-[0_-4px_16px_rgb(0_0_0/.08)]"),children:[v!==null&&(0,F.jsxs)("p",{className:te("flex max-w-[75ch] gap-2 text-[13px]",S),"data-decision-why":!0,...a.line===null?{}:{"data-cant-accept":""},children:[(0,F.jsx)(mn,{className:"mt-0.5 size-3.5 shrink-0 text-warning","aria-hidden":"true"}),v]}),e.failure!=null&&e.failure.retry===null&&(0,F.jsxs)("p",{className:"max-w-[75ch] text-[13px]","data-failure-suggestion":!0,children:[(0,F.jsx)("span",{className:"font-semibold",children:"What to change."})," ",(0,F.jsx)("span",{className:"text-muted-foreground",children:e.failure.suggestion})]}),r!==null&&(0,F.jsxs)("p",{className:te("max-w-[75ch] text-[13px]",S),"data-next-action":r.kind,children:[(0,F.jsxs)("span",{className:"font-semibold",children:[r.title,"."]})," ",(0,F.jsx)("span",{className:"text-muted-foreground",children:r.detail})]}),d.length>0&&(0,F.jsxs)("div",{className:te("flex flex-wrap items-center gap-2 phone:flex-nowrap phone:items-stretch",g!==null&&"flex-col items-start gap-3 phone:flex-row phone:items-stretch phone:gap-2",s&&"phone:flex-wrap"),"data-result-acts":!0,children:[(0,F.jsx)("div",{className:"contents phone:flex phone:min-w-0 phone:flex-1 phone:flex-col",children:a.primary!==null?x(a.primary,!0):a.secondary!==null&&x(a.secondary,!1)}),h!==null&&(0,F.jsx)("div",{className:te("contents phone:order-last phone:basis-full phone:flex-col",s?"phone:flex":"phone:hidden"),children:x(h,!1)}),w&&(0,F.jsxs)(Z,{type:"button",variant:"outline",className:"hidden min-h-11 shrink-0 phone:inline-flex","aria-expanded":s,"aria-label":s?"Fewer options":"More options","data-dock-more":!0,onClick:()=>i(C=>!C),children:[s?"Less":"More",(0,F.jsx)(Xo,{className:te("transition-transform motion-reduce:transition-none",s&&"rotate-180")})]})]}),y!==null&&(0,F.jsx)("p",{className:te("max-w-[75ch] text-[13px] text-muted-foreground",S),"data-decision-effect":!0,children:y})]})}function NV({panel:e,children:t}){return(0,F.jsxs)("div",{id:"result",...e.attributes,className:"flex scroll-mt-4 flex-col gap-4",children:[e.history!==""&&(0,F.jsx)(pc,{html:e.history}),(0,F.jsxs)(Sa,{className:"gap-0 overflow-hidden p-0 phone:p-0",children:[(0,F.jsx)("nav",{role:"tablist","aria-label":"Result views",className:"flex gap-1 overflow-x-auto border-b border-border px-3 phone:px-2",children:e.tabs.map(a=>(0,F.jsxs)("a",{role:"tab",href:a.href,"data-result-tab":a.key,"aria-selected":a.active?"true":"false",...a.active?{}:{tabIndex:-1},className:"-mb-px inline-flex items-center gap-1.5 whitespace-nowrap border-b-2 border-transparent px-3 py-3 text-sm font-semibold text-muted-foreground transition-colors hover:text-foreground aria-selected:border-primary aria-selected:text-foreground phone:min-h-11",children:[a.label,a.count!==""&&(0,F.jsx)("span",{className:"rounded-full bg-muted px-1.5 text-xs font-medium tabular-nums",children:a.count})]},a.key))}),e.views.map(a=>(0,F.jsx)("div",{role:"tabpanel","data-result-view":a.key,hidden:!e.tabs.some(n=>n.key===a.key&&n.active),className:"px-5 py-4 phone:px-4",children:(0,F.jsx)(pc,{html:a.html,className:"so-result-view"})},a.key))]}),t,e.request!==null&&(0,F.jsx)(Sa,{id:"request-changes",className:te("result-request scroll-mt-4 gap-3",e.requestQuiet&&"hidden has-[details[open]]:flex"),children:(0,F.jsx)(pc,{html:e.request,className:"so-result-request"})})]})}function RV({selected:e}){let t=e.panel?.learning??"",a=e.panel,n=a?.status==null?[]:ow(a.status),o=e.record,r=[{id:"intent",title:"Approved scope",hint:e.intent===null?null:(0,F.jsxs)(F.Fragment,{children:[e.intent.approval,e.intent.approvedAt!=null&&(0,F.jsxs)(F.Fragment,{children:[" · ",(0,F.jsx)("time",{dateTime:e.intent.approvedAt,title:fc(e.intent.approvedAt),children:vn(e.intent.approvedAt)})]})]}),body:e.intent===null?(0,F.jsx)("p",{className:"text-sm text-muted-foreground",children:"No scope was filed for this task, so there is no approved goal or boundary to review."}):(0,F.jsx)(pc,{html:e.intent.html,className:"so-result-intent"})},...e.notes.length===0?[]:[{id:"notes",title:"Notes",hint:null,count:e.notes.length,body:(0,F.jsx)("ul",{className:"flex flex-col gap-2 text-sm",children:e.notes.map((s,i)=>(0,F.jsxs)("li",{children:[(0,F.jsxs)("span",{className:"text-muted-foreground",children:[s.author," · ",cw(s.at)]})," ",s.note]},i))})}],...n.length===0?[]:[{id:"why",title:"Recorded reasons",hint:null,count:n.length,body:(0,F.jsx)("div",{className:"flex flex-col gap-1 text-[13px] text-muted-foreground","data-status-why":!0,children:n.map(s=>(0,F.jsx)("p",{className:"[overflow-wrap:anywhere]",children:s},s))})}],...a===null||a.limits.length===0?[]:[{id:"limits",title:"What was shortened",hint:null,count:a.limits.length,body:(0,F.jsx)("ul",{className:"flex flex-col gap-1 text-[13px] text-muted-foreground",children:a.limits.map(s=>(0,F.jsx)("li",{children:s},s))})}],...a?.reviewHistory==null?[]:[{id:"review-history",title:"Review history",hint:null,body:(0,F.jsx)("p",{className:"text-[13px] text-muted-foreground",children:a.reviewHistory})}],...o===null?[]:[{id:"run-record",title:"Run record",hint:`Build #${o.build}`,body:(0,F.jsxs)("div",{className:"flex flex-col gap-3 text-[13px]",children:[(0,F.jsx)("dl",{className:"grid grid-cols-[6.5rem_minmax(0,1fr)] gap-x-3 gap-y-1.5",children:o.facts.map(s=>(0,F.jsxs)("div",{className:"contents",children:[(0,F.jsx)("dt",{className:"text-muted-foreground",children:s.label}),(0,F.jsx)("dd",{className:"min-w-0 [overflow-wrap:anywhere]",children:s.value})]},s.label))}),(0,F.jsxs)("p",{className:"flex flex-wrap gap-x-4 gap-y-1",children:[e.checks?.logHref!=null&&(0,F.jsx)("a",{href:e.checks.logHref,className:mc,children:"Check output"}),(0,F.jsx)("a",{href:o.href,className:mc,children:"Full run record"})]})]})}]];return(0,F.jsxs)(Sa,{"aria-label":"Result record",className:"gap-0 divide-y divide-border overflow-hidden p-0 phone:p-0",children:[t!==""&&(0,F.jsx)("div",{"data-cockpit-section":"learning",children:(0,F.jsx)(pc,{html:t,className:"so-result-learning"})}),r.map(s=>(0,F.jsxs)("details",{id:s.id,className:"group scroll-mt-4","data-cockpit-section":s.id,children:[(0,F.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-5 py-3.5 hover:bg-accent/50 phone:min-h-12 phone:px-4 [&::-webkit-details-marker]:hidden",children:[(0,F.jsx)(sa,{className:"size-4 shrink-0 text-muted-foreground transition-transform group-open:rotate-90","aria-hidden":"true"}),(0,F.jsx)("h2",{className:"text-[15px] font-semibold",children:s.title}),s.count!==void 0&&(0,F.jsx)(wa,{children:s.count}),s.hint!=null&&(0,F.jsx)("span",{className:"min-w-0 truncate text-[13px] text-muted-foreground",children:s.hint})]}),(0,F.jsx)("div",{className:"px-5 pb-5 pt-1 phone:px-4",children:s.body})]},s.id))]})}var mc="font-medium text-foreground/80 underline decoration-border underline-offset-4 hover:decoration-muted-foreground phone:inline-flex phone:min-h-11 phone:items-center";function TV(e){let t=document.getElementById("run-record");t instanceof HTMLDetailsElement&&(e.preventDefault(),t.open=!0,t.scrollIntoView({block:"start",behavior:window.matchMedia("(prefers-reduced-motion: reduce)").matches?"instant":"smooth"}),history.replaceState(history.state,"","#run-record"))}function MV({selected:e,csrf:t}){let[a,n]=(0,lw.useState)(new Map),o=(m,g)=>n(b=>{let v=new Map(b);return g===null?v.delete(m):v.set(m,g),v}),r=pE(e.panel),s=r.filter(m=>!a.has(m.id)),i=r.filter(m=>a.get(m.id)==="not-right"),l={unanswered:s.map(Gg),notRight:i.map(Gg)},c=e.decision===null?null:{...e.decision,...dE(e.decision.base??e.decision,l)},f=e.actFacts===void 0?e.acts:cE({...e.actFacts,...e.actFacts.accept===null?{}:{accept:{ready:c?.ready??!1}},unanswered:s.length,notRight:i.length}),u=e.panel?.youCheck!=null?(0,F.jsx)(LV,{panel:e.panel,chatHref:e.chatHref,answers:a,answer:o}):null,d=(0,F.jsx)(IV,{selected:e,csrf:t,acts:f,decision:c,firstUnanswered:s[0]?.id??null});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(wV,{selected:e,acts:f,answers:a}),e.panel!==null?(0,F.jsx)(NV,{panel:e.panel,children:(0,F.jsxs)("div",{className:"flex flex-col gap-4",children:[u,d]})}):(0,F.jsxs)("div",{className:"flex flex-col gap-4",children:[u,d]}),(0,F.jsx)(RV,{selected:e})]})}function mE({view:e,csrf:t}){let a=e.selected;return(0,F.jsxs)("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-4",children:[(0,F.jsxs)("header",{className:"flex flex-col gap-3 pb-1",children:[(0,F.jsxs)("div",{className:"flex flex-wrap items-start gap-x-4 gap-y-3",children:[(0,F.jsxs)("div",{className:"min-w-0 flex-1 basis-72",children:[(0,F.jsx)("h1",{className:"text-[26px] font-semibold leading-tight tracking-tight phone:text-[22px]",children:a?.title??"Results"}),a!==null&&(0,F.jsxs)("p",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted-foreground phone:gap-y-0","data-result-meta":!0,children:[a.project!==null&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)("span",{className:"font-medium text-foreground/80",children:a.project}),(0,F.jsx)("span",{"aria-hidden":"true",children:"·"})]}),a.record!==null&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)("a",{href:"#run-record",onClick:TV,className:mc,children:["Build #",a.record.build]}),(0,F.jsx)("span",{"aria-hidden":"true",children:"·"})]}),(0,F.jsx)("a",{href:a.taskHref,className:mc,children:"Open task"}),(0,F.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,F.jsx)("a",{href:a.chatHref,className:mc,children:"Discuss"})]})]}),a!==null&&(0,F.jsx)(yV,{view:e})]}),e.missing!==null&&(0,F.jsxs)("p",{role:"status",className:"rounded-md bg-muted px-3 py-2 text-[13px] text-foreground",children:[e.missing,a!==null?" Showing the newest result instead.":""]}),e.beyond&&(0,F.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"This result is older than the list in Results."})]}),a===null?e.results.length===0?(0,F.jsxs)(Sa,{className:"items-start py-10",children:[(0,F.jsx)("p",{className:"text-base text-muted-foreground",children:"Nothing to review yet."}),(0,F.jsx)(Z,{asChild:!0,variant:"outline",children:(0,F.jsx)("a",{href:"/work",children:"Open tasks"})})]}):(0,F.jsx)(Sa,{"aria-label":"Results",className:"gap-0 overflow-hidden p-0 phone:p-0",children:(0,F.jsx)("ul",{className:"divide-y divide-border",children:e.results.map(n=>(0,F.jsxs)("li",{className:"flex items-start gap-3 px-5 py-3 phone:px-4",children:[(0,F.jsx)("span",{"aria-hidden":"true",className:te("mt-2 size-2 shrink-0 rounded-full",n.status===null?"bg-muted-foreground":uw[Vg(n.status.tone)])}),(0,F.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,F.jsx)("a",{href:n.href,className:te("block truncate hover:underline hover:underline-offset-4",n.needsYou?"font-semibold":"font-medium"),children:n.title}),(0,F.jsx)("p",{className:"truncate text-[13px] text-muted-foreground",children:[n.status?.label,...n.notes,cw(n.at)].filter(Boolean).join(" · ")})]})]},n.href))})}):(0,F.jsx)(MV,{selected:a,csrf:t},`${a.taskId}:${a.build??""}`)]})}var za=j(he(),1);var EV="#171717",dw="#ffffff",AV="#efefef",$g="#161616",fw="#0a0a0a",Rle=[[null,"Ink",EV],[null,"Violet","#6e56cf"],[null,"Chart magenta","#c0267e"],[2025,"Mocha Mousse","#a47864"],[2024,"Peach Fuzz","#ffbe98"],[2023,"Viva Magenta","#bb2649"],[2022,"Very Peri","#6667ab"],[2021,"Illuminating","#f5df4d"],[2020,"Classic Blue","#0f4c81"],[2019,"Living Coral","#ff6f61"],[2018,"Ultra Violet","#5f4b8b"],[2017,"Greenery","#88b04b"],[2016,"Rose Quartz","#f7caca"],[2016,"Serenity","#93a9d1"],[2015,"Marsala","#964f4c"],[2014,"Radiant Orchid","#ad5e99"],[2013,"Emerald","#009473"],[2012,"Tangerine Tango","#dd4124"],[2011,"Honeysuckle","#d94f70"],[2010,"Turquoise","#45b5aa"],[2009,"Mimosa","#f0c05a"],[2008,"Blue Iris","#5a5b9f"],[2007,"Chili Pepper","#9b1b30"],[2005,"Blue Turquoise","#53b0ae"],[2004,"Tigerlily","#e2583e"],[2003,"Aqua Sky","#7bc4c4"],[2002,"True Red","#bf1932"],[2001,"Fuchsia Rose","#c74375"],[2e3,"Cerulean","#9bb7d4"]].map(([e,t,a])=>({id:t.toLowerCase().replace(/[^a-z0-9]+/g,"-"),name:t,year:e,hex:a})),Wg=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)/255),pw=e=>`#${e.map(t=>Math.round(Math.min(1,Math.max(0,t))*255).toString(16).padStart(2,"0")).join("")}`,xE=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,DV=e=>e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055;function ap(e){let[t,a,n]=Wg(e).map(xE),o=Math.cbrt(.4122214708*t+.5363325363*a+.0514459929*n),r=Math.cbrt(.2119034982*t+.6806995451*a+.1073969566*n),s=Math.cbrt(.0883024619*t+.2817188376*a+.6299787005*n),i=.2104542553*o+.793617785*r-.0040720468*s,l=1.9779984951*o-2.428592205*r+.4505937099*s,c=.0259040371*o+.7827717662*r-.808675766*s;return[i,Math.hypot(l,c),(Math.atan2(c,l)*180/Math.PI+360)%360]}function hE(e,t,a){let n=t*Math.cos(a*Math.PI/180),o=t*Math.sin(a*Math.PI/180),r=(e+.3963377774*n+.2158037573*o)**3,s=(e-.1055613458*n-.0638541728*o)**3,i=(e-.0894841775*n-1.291485548*o)**3,l=[4.0767416621*r-3.3077115913*s+.2309699292*i,-1.2684380046*r+2.6097574011*s-.3413193965*i,-.0041960863*r-.7034186147*s+1.707614701*i];return l.every(c=>c>=-1e-4&&c<=1.0001)?l.map(DV):null}function jg(e,t,a){for(let n=t;n>=0;n-=.002){let o=hE(e,n,a);if(o!==null)return pw(o)}return pw(hE(e,0,a)??[e,e,e])}var gE=e=>{let[t,a,n]=Wg(e).map(xE);return .2126*t+.7152*a+.0722*n};function hc(e,t){let[a,n]=[gE(e),gE(t)].sort((o,r)=>r-o);return(a+.05)/(n+.05)}var gc=(e,t,a)=>{let[n,o]=[Wg(e),Wg(t)];return pw(n.map((r,s)=>r*a+o[s]*(1-a)))};function vE(e){let t=e.trim().replace(/^#/,"").toLowerCase();return/^[0-9a-f]{6}$/.test(t)?`#${t}`:/^[0-9a-f]{3}$/.test(t)?`#${[...t].map(a=>a+a).join("")}`:null}function mw(e){let[t,a,n]=ap(e),o=e,r=f=>hc(f,gc(f,dw,.12))>=4.5&&hc(f,AV)>=3;for(let f=t;!r(o)&&f>.02;f-=.005)o=jg(f,a,n);let s=e,i=f=>hc(f,$g)>=6&&hc(f,gc(f,$g,.13))>=4.5;for(let f=t;!i(s)&&f<.99;f+=.005)s=jg(f,a,n);let[l]=ap(o),[c]=ap(s);return{light:{signal:o,hover:jg(Math.max(.02,l-.06),a,n),on:hc(o,"#ffffff")>=4.5?"#ffffff":fw,soft:gc(o,dw,.12),selection:gc(o,dw,.24)},dark:{signal:s,hover:jg(Math.min(.99,c+.06),a,n),on:hc(s,fw)>=4.5?fw:"#ffffff",soft:gc(s,$g,.13),selection:gc(s,$g,.32)}}}var _V=[["#c4320a","red","failures","a failed one"],["#ab6400","amber","warnings","a warning"],["#218358","green","passed checks","a passed one"],["#0d74ce","blue","running work","a running one"]];function yE(e){let[,t,a]=ap(mw(e).light.signal);if(t<.04)return"Close to grey, so what needs you won't stand out.";let n=_V.find(([o])=>{let r=Math.abs(ap(o)[2]-a);return Math.min(r,360-r)<25});return n===void 0?null:`Close to the ${n[1]} used for ${n[2]}, so a task waiting on you can look like ${n[3]}.`}function bE(e){let t=["17:00","18:00","19:00","20:00","21:00","22:00"],a=e===null||t.includes(e)?t:[...t,e].sort();return[["off","Off"],...a.map(n=>[n,`At ${n}`])]}var wE={betterstack:{title:"Better Stack",source:"Simple Icons",path:"M1.5,10.828l-.716,6.212c-.074,.638 .17,1.271 .651,1.696l1.775,1.565c.608,.536 1.551,.014 1.421-.786l-1.423-8.726c-.161-.988-1.593-.954-1.707,.04zM13.078,18.982l-4.232-12.194c-.47-1.354-2.441-1.296-2.826,.084l-1.288,4.607c-.146,.523-.202,.826 0,1.33h.489l1.777,5.679c.275,.685 .844,1.217 1.554,1.454l2.65,.883c1.162,.387 2.271-.703 1.875-1.843zM23.025,18.016l-7.478-14.022c-.652-1.223-2.412-1.191-3.02,.055l-1.839,3.701c-.222,.456-.119,.618 .066,.883c.148,.212 .492,.229 .632,.011c.138-.214 .457-.194 .567,.035l4.808,10c.362,.814 1.121,1.382 2.004,1.499l2.544,.325c1.369,.18 2.367-1.267 1.716-2.487z"},canva:{title:"Canva",source:"svgl",path:"M12,22c5.523,0 10-4.477 10-10c0-5.523-4.477-10-10-10c-5.523,0-10,4.477-10,10c0,5.523 4.477,10 10,10zM16.551,14.378c0,1.011-1.809,4.124-4.939,4.124c-2.948,0-4.859-2.211-4.859-5.557c0-4.323 2.995-7.447 6.365-7.447c2.039,0 3.255,1.026 3.255,2.423c0,1.44-1.041,2.46-1.929,2.46c-.221,0-.332-.108-.332-.287c0-.399 .643-.998 .643-2.129c0-.953-.582-1.552-1.535-1.552c-2.039,0-4.361,2.409-4.361,6.576c0,2.46 1.221,4.24 3.194,4.24c1.706,0 3.18-1.225 4.033-2.955c.076-.152 .148-.222 .231-.222c.119,0 .234,.103 .234,.326z"},chrome:{title:"Google Chrome",source:"Simple Icons",path:"M12,2c-3.158,0-5.974,1.464-7.807,3.751l3.294,5.707c.274-2.284 2.212-4.003 4.513-4.003h8.909c-1.709-3.348-5.15-5.455-8.909-5.454zM3.609,6.558c-1.053,1.619-1.612,3.51-1.609,5.442c0,5.01 3.683,9.159 8.491,9.887l3.294-5.706c-2.115,.904-4.572,.085-5.721-1.908zM14.728,8.363c1.842,1.378 2.361,3.917 1.208,5.908l.002,.001h-.002l-4.453,7.714c.172,.008 .344,.013 .518,.013c5.523,0 10-4.477 10-10c0-1.283-.242-2.509-.682-3.637zM12,15.637c-2.008,0-3.637-1.628-3.637-3.637c0-2.008 1.628-3.637 3.637-3.637c2.008,0 3.637,1.628 3.637,3.637c0,2.008-1.628,3.637-3.637,3.637z"},claude:{title:"Claude",source:"Simple Icons",path:"M5.926,15.298l3.933-2.207l.066-.192l-.066-.106h-.192l-.658-.041l-2.247-.061l-1.949-.081l-1.888-.101l-.476-.101l-.445-.587l.046-.294l.4-.268l.572,.051l1.265,.086l1.898,.132l1.377,.081l2.04,.213h.324l.046-.132l-.111-.081l-.086-.081l-1.964-1.331l-2.126-1.407l-1.113-.81l-.602-.41l-.304-.385l-.132-.84l.547-.602l.734,.051l.187,.051l.744,.572l1.589,1.23l2.075,1.529l.304,.253l.121-.086l.015-.061l-.137-.228l-1.129-2.04l-1.205-2.075l-.536-.86l-.142-.516c-.051-.213-.086-.39-.086-.607l.623-.845l.344-.111l.83,.111l.349,.304l.516,1.179l.835,1.858l1.296,2.526l.38,.749l.202,.693l.076,.213h.132v-.121l.106-1.422l.197-1.746l.192-2.247l.066-.633l.314-.759l.623-.41l.486,.233l.4,.572l-.056,.37l-.238,1.544l-.466,2.419l-.304,1.62h.177l.202-.202l.82-1.088l1.377-1.721l.607-.683l.709-.754l.456-.359h.86l.633,.941l-.283,.972l-.886,1.124l-.734,.952l-1.053,1.417l-.658,1.134l.061,.091l.157-.015l2.379-.506l1.286-.233l1.534-.263l.693,.324l.076,.329l-.273,.673l-1.64,.405l-1.923,.385l-2.865,.678l-.035,.025l.041,.051l1.291,.121l.552,.03h1.351l2.516,.187l.658,.435l.395,.532l-.066,.405l-1.012,.516l-1.367-.324l-3.189-.759l-1.093-.273h-.152v.091l.911,.891l1.67,1.508l2.09,1.944l.106,.481l-.268,.38l-.283-.041l-1.837-1.382l-.709-.623l-1.604-1.351h-.106v.142l.369,.542l1.954,2.936l.101,.901l-.142,.294l-.506,.177l-.557-.101l-1.144-1.604l-1.179-1.807l-.952-1.62l-.116,.066l-.562,6.048l-.263,.309l-.607,.233l-.506-.385l-.268-.623l.268-1.23l.324-1.604l.263-1.275l.238-1.584l.142-.526l-.01-.035l-.116,.015l-1.194,1.64l-1.817,2.455l-1.437,1.539l-.344,.137l-.597-.309l.056-.552l.334-.491l1.989-2.531l1.2-1.569l.774-.906l-.005-.132h-.046l-5.284,3.432l-.941,.121l-.405-.38l.051-.622l.192-.202l1.589-1.093z"},cloudflare:{title:"Cloudflare",source:"Simple Icons",path:"M16.509,16.845c.148-.507 .091-.971-.155-1.315c-.225-.316-.604-.499-1.061-.52l-8.659-.112c-.054,.001-.104-.026-.133-.071c-.028-.042-.035-.099-.021-.155c.028-.084 .112-.148 .204-.156l8.736-.112c1.035-.049 2.16-.887 2.554-1.914l.499-1.301c.022-.056 .029-.113 .015-.168c-.562-2.546-2.835-4.445-5.55-4.445c-2.504,0-4.628,1.618-5.388,3.861c-.493-.366-1.119-.562-1.794-.499c-1.203,.119-2.166,1.083-2.286,2.286c-.028,.31-.007,.613 .064,.894c-1.963,.056-3.531,1.66-3.531,3.637c0,.175 .014,.352 .035,.527c.014,.083 .084,.148 .169,.148h15.981c.091,0 .176-.064 .203-.155l.12-.427zM19.266,11.281c-.077,0-.161,0-.238,.011c-.057,0-.105,.042-.127,.098l-.338,1.174c-.147,.507-.092,.971 .154,1.316c.226,.316 .606,.498 1.063,.52l1.844,.113c.056,0 .106,.026 .133,.07c.028,.043 .035,.107 .021,.156c-.028,.084-.113,.149-.204,.155l-1.921,.112c-1.041,.049-2.158,.887-2.553,1.914l-.141,.359c-.028,.071 .022,.142 .099,.142h6.598c.077,0 .147-.049 .169-.126c.112-.408 .176-.837 .176-1.28c0-2.602-2.125-4.727-4.734-4.727"},confluence:{title:"Confluence",source:"Simple Icons",path:"M2.611,17.278c-.209,.322-.447,.738-.644,1.05c-.18,.302-.084,.692 .215,.877l4.188,2.576c.147,.091 .324,.119 .492,.077c.168-.041 .312-.148 .4-.297c.168-.28 .383-.644 .618-1.03c1.659-2.739 3.328-2.407 6.334-.967l4.182,1.972c.157,.075 .338,.083 .502,.022c.163-.061 .295-.185 .365-.345l1.994-4.51c.14-.322-.003-.697-.322-.844c-1.399-.658-2.795-1.321-4.188-1.992c-5.666-2.739-10.464-2.558-14.137,3.408zM21.39,6.722c.21-.342 .448-.738 .645-1.054c.176-.301 .08-.688-.216-.872l-4.188-2.577c-.147-.091-.324-.119-.492-.077c-.168,.041-.312,.148-.4,.297c-.164,.283-.38,.644-.619,1.033c-1.659,2.738-3.328,2.404-6.334,.967l-4.166-1.975c-.157-.075-.338-.083-.501-.022c-.163,.061-.295,.185-.365,.344l-1.994,4.51c-.14,.322 .003,.697 .322,.844c.877,.413 2.619,1.238 4.188,1.992c5.65,2.738 10.454,2.555 14.12-3.408z"},discord:{title:"Discord",source:"Simple Icons",path:"M19.939,4.717c-1.485-.682-3.053-1.168-4.663-1.446c-.03-.006-.06,.009-.075,.035c-.201,.358-.424,.825-.581,1.193c-1.761-.264-3.513-.264-5.237,0c-.156-.375-.387-.834-.59-1.193c-.015-.026-.045-.04-.075-.035c-1.61,.278-3.178,.764-4.663,1.446c-.013,.005-.023,.015-.031,.026c-2.97,4.437-3.783,8.765-3.384,13.039c.002,.021 .013,.04 .03,.054c1.959,1.439 3.857,2.313 5.72,2.892c.03,.009 .062-.002 .08-.026c.441-.602 .833-1.236 1.17-1.903c.009-.018 .01-.04 .003-.059c-.008-.019-.023-.034-.042-.042c-.623-.236-1.216-.524-1.787-.852c-.021-.012-.035-.035-.036-.059c-.001-.024 .009-.048 .029-.063c.12-.09 .24-.184 .355-.278c.021-.017 .049-.021 .074-.01c3.749,1.712 7.808,1.712 11.513,0c.025-.012 .054-.008 .075,.009c.115,.095 .235,.189 .356,.279c.02,.015 .031,.038 .029,.063c-.001,.024-.015,.047-.036,.059c-.571,.333-1.169,.618-1.788,.851c-.019,.007-.035,.023-.042,.042c-.007,.019-.006,.041 .003,.06c.344,.666 .737,1.301 1.169,1.903c.018,.025 .051,.036 .08,.027c1.872-.579 3.77-1.453 5.729-2.892c.017-.012 .028-.032 .03-.053c.478-4.941-.8-9.234-3.387-13.039c-.006-.012-.017-.022-.03-.027zM8.201,15.18c-1.129,0-2.059-1.036-2.059-2.309c0-1.273 .912-2.309 2.059-2.309c1.156,0 2.077,1.045 2.059,2.309c0,1.273-.912,2.309-2.059,2.309zM15.813,15.18c-1.129,0-2.059-1.036-2.059-2.309c0-1.273 .912-2.309 2.059-2.309c1.156,0 2.077,1.045 2.059,2.309c0,1.273-.903,2.309-2.059,2.309z"},figma:{title:"Figma",source:"Simple Icons",path:"M15.85,8.983h-4.585v-8.976h4.585c2.475,0 4.488,2.013 4.488,4.488c0,2.475-2.013,4.489-4.488,4.489zM12.735,7.512h3.115c1.664,0 3.017-1.354 3.017-3.017c0-1.663-1.354-3.017-3.017-3.017h-3.115zM12.735,8.983h-4.584c-2.475,0-4.488-2.013-4.488-4.488c0-2.475 2.013-4.489 4.488-4.489h4.585v8.976zM8.151,1.477c-1.664,0-3.017,1.354-3.017,3.017c0,1.663 1.353,3.018 3.017,3.018h3.115v-6.036zM12.735,16.488h-4.584c-2.475,0-4.488-2.013-4.488-4.488c0-2.475 2.013-4.488 4.488-4.488h4.585v8.975zM8.151,8.983c-1.664,0-3.017,1.354-3.017,3.017c0,1.663 1.354,3.017 3.017,3.017h3.115v-6.035zM8.175,23.993c-2.488,0-4.513-2.013-4.513-4.488c0-2.475 2.013-4.488 4.488-4.488h4.585v4.439c0,2.502-2.046,4.537-4.56,4.537zM8.151,16.488c-1.666,.002-3.015,1.352-3.017,3.017c0,1.664 1.364,3.017 3.042,3.017c1.704,0 3.091-1.375 3.091-3.066v-2.968zM15.85,16.488h-.098c-2.475,0-4.488-2.013-4.488-4.488c0-2.475 2.013-4.488 4.488-4.488h.098c2.475,0 4.488,2.013 4.488,4.488c0,2.475-2.013,4.488-4.488,4.488zM15.753,8.983c-1.664,0-3.017,1.354-3.017,3.017c0,1.663 1.354,3.017 3.017,3.017h.098c1.664,0 3.017-1.354 3.017-3.017c0-1.663-1.354-3.017-3.017-3.017z"},github:{title:"GitHub",source:"Simple Icons",path:"M12,2.125c-5.595,0-10.126,4.534-10.126,10.126c0,4.475 2.901,8.27 6.924,9.607c.506,.095 .692-.218 .692-.487c0-.24-.008-.878-.013-1.721c-2.817,.611-3.411-1.359-3.411-1.359c-.461-1.169-1.127-1.481-1.127-1.481c-.917-.628 .071-.615 .071-.615c1.017,.071 1.551,1.043 1.551,1.043c.903,1.548 2.37,1.101 2.949,.842c.091-.655 .352-1.101 .641-1.354c-2.249-.253-4.612-1.124-4.612-5.004c0-1.105 .392-2.008 1.042-2.717c-.114-.256-.456-1.285 .089-2.68c0,0 .848-.272 2.785,1.038c.81-.225 1.671-.337 2.532-.342c.861,.005 1.721,.116 2.532,.342c1.924-1.31 2.772-1.038 2.772-1.038c.544,1.395 .203,2.424 .101,2.68c.646,.709 1.038,1.612 1.038,2.717c0,3.89-2.367,4.747-4.62,4.996c.354,.304 .684,.925 .684,1.873c0,1.355-.013,2.444-.013,2.773c0,.266 .177,.582 .696,.481c4.051-1.328 6.95-5.126 6.95-9.594c0-5.592-4.534-10.126-10.126-10.126"},gmail:{title:"Gmail",source:"Simple Icons",path:"M23.545,5.705v13.382c0,.87-.704,1.574-1.574,1.574h-3.674v-8.921l-6.297,4.724l-6.297-4.724v8.922h-3.674c-.418,0-.818-.166-1.113-.461c-.295-.295-.461-.696-.461-1.114v-13.382c0-1.946 2.221-3.058 3.778-1.89l1.47,1.104l6.297,4.722l6.297-4.724l1.47-1.102c1.556-1.167 3.778-.057 3.778,1.89z"},intercom:{title:"Intercom",source:"Simple Icons",path:"M19.5,2h-15c-1.381,0-2.5,1.119-2.5,2.5v15c0,1.382 1.119,2.5 2.5,2.5h15c1.382,0 2.5-1.118 2.5-2.5v-15c0-1.381-1.118-2.5-2.5-2.5zM14.666,5.666c0-.367 .3-.667 .668-.667c.367,0 .667,.3 .667,.667v8.907c0,.368-.3,.668-.667,.668c-.369,0-.668-.299-.668-.667zM11.333,5.328c0-.367 .298-.666 .667-.666c.369,0 .667,.299 .667,.666v9.668c0,.367-.297,.667-.667,.667c-.369,0-.667-.3-.667-.667zM8,5.666c0-.367 .299-.667 .666-.667c.369,0 .668,.3 .668,.667v8.907c0,.368-.3,.668-.668,.668c-.367,0-.666-.299-.666-.667zM4.666,7c0-.368 .3-.667 .668-.667c.367,0 .666,.298 .666,.667v5.996c0,.368-.299,.667-.666,.667c-.369,0-.668-.3-.668-.667zM19.1,17.168c-.102,.088-2.572,2.161-7.1,2.161c-4.527,0-6.997-2.072-7.101-2.161c-.279-.24-.312-.66-.072-.94c.238-.278 .658-.312 .938-.075c.039,.034 2.244,1.843 6.234,1.843c4.04,0 6.213-1.822 6.233-1.839c.278-.241 .699-.208 .94,.072c.241,.28 .208,.7-.072,.94zM19.334,12.996c0,.368-.3,.667-.667,.667c-.367,0-.667-.3-.667-.667v-5.996c0-.368 .301-.667 .668-.667c.368,0 .668,.298 .668,.667z"},jira:{title:"Jira",source:"Simple Icons",path:"M11.643,11.594h-9.642c.001,1.155 .461,2.262 1.279,3.077c.818,.815 1.927,1.272 3.081,1.269h1.775v1.714c0,2.399 1.945,4.345 4.344,4.346v-9.568c0-.463-.375-.837-.837-.837zM16.412,6.798h-9.632c0,2.4 1.946,4.345 4.346,4.345h1.774v1.715c.002,2.399 1.947,4.344 4.346,4.345v-9.571c0-.461-.373-.834-.834-.834zM21.177,2h-9.632c0,2.4 1.946,4.346 4.346,4.346h1.774v1.714c.002,2.394 1.94,4.336 4.334,4.343v-9.565c.002-.457-.365-.831-.822-.837z"},linear:{title:"Linear",source:"Simple Icons",path:"M4.405,5.483c1.899-2.213 4.67-3.486 7.587-3.483c5.528,0 10.008,4.48 10.008,10.008c0,3.033-1.35,5.753-3.483,7.588l-14.111-14.112zM3.514,6.688l13.797,13.797c-.437,.275-.896,.517-1.375,.722l-13.143-13.142c.206-.479 .448-.938 .722-1.375zM2.268,9.636l12.096,12.096c-.592,.143-1.202,.235-1.829,.268l-10.535-10.535c.033-.617 .123-1.229 .268-1.829zM2.127,13.688l8.186,8.187c-4.189-.716-7.471-3.997-8.187-8.187z"},notion:{title:"Notion",source:"Simple Icons",path:"M5.584,5.37c.635,.516 .873,.476 2.066,.397l11.244-.675c.238,0 .04-.238-.039-.277l-1.868-1.35c-.357-.277-.835-.596-1.748-.516l-10.887,.795c-.396,.039-.476,.238-.318,.397zM6.258,7.991v11.83c0,.636 .317,.874 1.033,.834l12.357-.715c.716-.039 .796-.476 .796-.993v-11.751c0-.516-.198-.794-.636-.755l-12.913,.755c-.476,.04-.636,.278-.636,.794zM18.457,8.624c.079,.357 0,.715-.357,.756l-.596,.119v8.733c-.517,.278-.994,.437-1.391,.437c-.636,0-.796-.199-1.272-.794l-3.894-6.114v5.915l1.232,.279c0,0 0,.715-.994,.715l-2.741,.158c-.079-.158 0-.556 .278-.635l.715-.198v-7.822l-.991-.08c-.08-.357 .119-.873 .675-.913l2.941-.198l4.053,6.193v-5.479l-1.034-.118c-.079-.437 .238-.755 .636-.794zM3.437,2.67l11.325-.834c1.39-.119 1.748-.04 2.622,.596l3.615,2.541c.596,.436 .795,.556 .795,1.032v13.935c0,.873-.317,1.39-1.429,1.469l-13.152,.795c-.834,.04-1.232-.079-1.669-.636l-2.662-3.454c-.476-.636-.675-1.111-.675-1.668v-12.387c0-.714 .318-1.31 1.231-1.389z"},openai:{title:"OpenAI",source:"svgl",evenodd:!0,path:"M9.367,2.175c1.818-.487 3.67,.075 4.913,1.315c1.697-.453 3.582-.014 4.912,1.317c1.331,1.331 1.77,3.216 1.317,4.913v0c1.241,1.243 1.803,3.095 1.316,4.913c-.487,1.818-1.9,3.141-3.596,3.597c-.456,1.696-1.779,3.109-3.597,3.596c-1.818,.487-3.67-.075-4.913-1.315c-1.697,.453-3.582,.014-4.913-1.317c-1.331-1.331-1.77-3.216-1.317-4.913c-1.24-1.243-1.803-3.095-1.315-4.913c.487-1.818 1.9-3.141 3.596-3.597c.456-1.696 1.779-3.109 3.597-3.596zM15.436,17.077c0,.206-.11,.397-.288,.5l-4.236,2.445c.937,.723 2.189,1.017 3.421,.687c1.737-.466 2.89-2.025 2.914-3.739v-4.36c0-.132-.071-.255-.185-.32l-1.626-.939zM9.321,17.515c-.178,.103-.398,.103-.577,0l-4.235-2.445c-.158,1.174 .214,2.405 1.116,3.307h0c1.272,1.272 3.199,1.49 4.695,.654l3.776-2.18c.114-.066 .185-.189 .185-.321v-1.877zM15.152,7.76c-.114-.066-.256-.065-.37,0l-1.626,.939l4.959,2.863c.179,.103 .289,.294 .289,.5v4.891c1.095-.45 1.975-1.388 2.305-2.62c.465-1.737-.309-3.515-1.781-4.393zM5.596,7.047c-1.095,.45-1.975,1.388-2.306,2.62c-.465,1.737 .309,3.515 1.781,4.393l3.776,2.18c.114,.066 .256,.065 .37,0l1.626-.939l-4.959-2.863c-.179-.103-.288-.294-.288-.5zM9.72,10.684v2.633l2.28,1.316l2.28-1.316v-2.633l-2.28-1.317zM13.088,3.978c-.937-.723-2.189-1.017-3.421-.687c-1.737,.466-2.89,2.025-2.914,3.739v4.36c0,.132 .071,.255 .185,.32l1.626,.939v-5.726c0-.206 .11-.397 .289-.5zM18.376,5.625c-1.272-1.272-3.199-1.49-4.695-.654l-3.776,2.18c-.114,.066-.185,.189-.185,.321v1.877l4.959-2.863c.178-.103 .398-.103 .577,0l4.235,2.445c.158-1.174-.214-2.405-1.116-3.306z"},paypal:{title:"PayPal",source:"Simple Icons",path:"M15.265,5.352h-6.031l-2.077,13.208h-4.366l2.752-17.418h7.234c3.397,0 5.768,2.076 5.857,4.988c-.586-.432-1.905-.778-3.368-.778M21.21,10.37c0,3.085-2.723,6.201-6.296,6.201h-2.256l-1.024,6.287h-4.393l1.669-10.44h3.25c3.807,0 6.647-3.288 6.472-6.288c1.589,.815 2.585,2.454 2.577,4.24M9.877,6.16h5.798c.821,0 1.757,.201 2.138,.49c-.176,2.48-2.402,4.961-5.828,4.961h-2.958z"},playwright:{title:"Playwright",source:"svgl",path:"M8.063,13.122c-.862,.245-1.428,.674-1.801,1.103c.357-.312 .835-.599 1.48-.782c.66-.187 1.223-.186 1.688-.096v-.364c-.397-.036-.852-.007-1.367,.139zM6.223,10.065l-3.203,.844c0,0 .058,.082 .166,.192l2.716-.716c0,0-.038,.496-.373,.94c.632-.478 .693-1.26 .693-1.26zM8.904,17.593c-4.508,1.214-6.892-4.01-7.614-6.721c-.334-1.252-.479-2.199-.518-2.811c-.004-.064-.002-.117 .002-.166c-.234,.014-.346,.136-.323,.487c.039,.611 .184,1.559 .518,2.811c.722,2.711 3.107,7.935 7.614,6.721c.981-.264 1.718-.746 2.272-1.36c-.51,.461-1.148,.823-1.951,1.04zM9.751,6.868v.321h1.768c-.036-.114-.073-.216-.109-.321zM11.914,9.51c.795,.226 1.216,.783 1.438,1.277l.887,.252c0,0-.121-1.727-1.683-2.17c-1.461-.415-2.36,.812-2.469,.971c.425-.303 1.046-.551 1.828-.329zM18.972,10.795c-1.462-.417-2.361,.812-2.469,.969c.425-.302 1.046-.55 1.827-.327c.794,.226 1.214,.783 1.437,1.277l.888,.253c0,0-.123-1.727-1.683-2.171zM18.091,15.347l-7.375-2.062c0,0 .08,.405 .386,.929l6.21,1.736c.511-.296 .779-.603 .779-.603zM12.978,19.785c-5.84-1.566-5.134-9.006-4.189-12.532c.389-1.453 .789-2.533 1.121-3.257c-.198-.041-.362,.064-.524,.393c-.352,.714-.803,1.877-1.238,3.506c-.945,3.526-1.651,10.966 4.189,12.532c2.752,.737 4.897-.383 6.495-2.143c-1.517,1.374-3.454,2.145-5.854,1.502zM9.751,15.849v-1.501l-4.172,1.183c0,0 .308-1.791 2.484-2.408c.66-.187 1.223-.186 1.688-.096v-6.159h2.089c-.227-.703-.447-1.244-.632-1.62c-.306-.622-.619-.21-1.33,.385c-.501,.419-1.767,1.312-3.673,1.825c-1.906,.514-3.446,.378-4.089,.266c-.911-.157-1.388-.357-1.343,.336c.039,.611 .184,1.559 .518,2.811c.722,2.711 3.107,7.935 7.614,6.721c1.177-.317 2.009-.944 2.585-1.744h-1.738zM3.019,10.909l3.203-.844c0,0-.093,1.232-1.294,1.549c-1.201,.316-1.909-.705-1.909-.705zM21.807,6.939c-.833,.146-2.83,.328-5.299-.334c-2.469-.661-4.108-1.818-4.757-2.362c-.92-.771-1.325-1.306-1.723-.496c-.352,.715-.803,1.878-1.238,3.506c-.945,3.526-1.651,10.966 4.189,12.532c5.838,1.564 8.946-5.233 9.891-8.759c.436-1.628 .627-2.86 .68-3.655c.06-.9-.558-.639-1.741-.432zM10.075,9.856c0,0 .92-1.431 2.481-.988c1.562,.444 1.683,2.17 1.683,2.17zM13.885,16.279c-2.745-.804-3.169-2.993-3.169-2.993l7.375,2.062c0,0-1.489,1.726-4.206,.931zM16.492,11.78c0,0 .919-1.43 2.479-.985c1.56,.444 1.683,2.171 1.683,2.171zM8.293,14.761l-2.714,.769c0,0 .295-1.679 2.294-2.345l-1.537-5.767l-.133,.04c-1.906,.514-3.446,.378-4.089,.266c-.911-.157-1.388-.357-1.343,.336c.039,.611 .184,1.559 .518,2.811c.722,2.711 3.107,7.935 7.614,6.721l.133-.042zM3.019,10.909l3.203-.844c0,0-.093,1.232-1.294,1.549c-1.201,.316-1.909-.705-1.909-.705zM14.009,16.309l-.124-.03c-2.745-.804-3.169-2.993-3.169-2.993l3.803,1.063l2.013-7.737l-.024-.006c-2.469-.661-4.108-1.818-4.757-2.362c-.92-.771-1.325-1.306-1.723-.496c-.352,.715-.802,1.878-1.238,3.506c-.945,3.526-1.651,10.966 4.189,12.532l.12,.027zM10.075,9.856c0,0 .92-1.431 2.481-.988c1.562,.444 1.683,2.17 1.683,2.17zM8.432,14.722l-.728,.207c.172,.969 .475,1.9 .951,2.721c.083-.018 .165-.034 .249-.057c.221-.06 .426-.133 .623-.214c-.531-.789-.883-1.697-1.095-2.657zM8.147,7.895c-.374,1.396-.709,3.405-.616,5.42c.165-.072 .339-.138 .532-.193l.135-.03c-.164-2.153 .191-4.346 .591-5.839c.101-.378 .203-.729 .304-1.056c-.163,.104-.339,.21-.539,.32c-.135,.417-.271,.872-.407,1.378z"},posthog:{title:"PostHog",source:"Simple Icons",path:"M9.854,14.5l-4.854-4.853l-4.146-4.147c-.143-.143-.358-.186-.545-.109c-.187,.078-.309,.26-.309,.463v2.586c0,.132 .053,.259 .146,.353l4.854,4.854l.147,.146l4.707,4.707l.146,.147v-.049c.065,.03 .134,.049 .207,.049h2.586c.202,0 .385-.122 .462-.309c.077-.187 .034-.402-.109-.545zM9.854,9.5l-4-4c-.106-.109-.258-.163-.409-.144c-.143,.017-.272,.093-.356,.21c-.059,.084-.09,.185-.089,.288v2.586c0,.133 .053,.259 .147,.353l9,9c.143,.143 .358,.185 .545,.108c.187-.077 .308-.26 .308-.462v-2.585c0-.133-.052-.26-.146-.354zM10.854,5.5c-.143-.143-.358-.186-.545-.109c-.187,.078-.309,.26-.309,.463v2.586c0,.133 .053,.259 .147,.353l4,4c.143,.143 .358,.185 .545,.108c.187-.077 .308-.26 .308-.462v-2.585c0-.133-.052-.26-.146-.354zM23.501,17.015c-.845-.11-1.63-.497-2.232-1.1l-4.708-4.707c-.143-.143-.358-.186-.545-.109c-.187,.078-.309,.26-.309,.463v6.585c0,.276 .224,.5 .5,.5h7.293c.276,0 .5-.224 .5-.5v-.6c0-.276-.225-.497-.499-.532zM18.107,17.047c-.442,0-.8-.358-.8-.8c0-.442 .358-.8 .8-.8c.442,0 .8,.358 .8,.8c0,.442-.358,.8-.8,.8zM.854,15.5c-.143-.143-.358-.186-.545-.109c-.187,.078-.309,.26-.309,.463v2.293c0,.276 .224,.5 .5,.5h2.293c.222,0 .39-.135 .462-.309c.079-.187 .036-.403-.109-.545l-2.292-2.292zM5,14.647l-4.146-4.147c-.143-.143-.358-.186-.545-.109c-.187,.077-.309,.26-.309,.462v2.586c0,.132 .053,.259 .146,.353l4.708,4.708l.146,.147h2.793c.202,0 .385-.122 .462-.309c.077-.187 .034-.402-.109-.545z"},sentry:{title:"Sentry",source:"Simple Icons",path:"M13.696,3.574c-.775-1.285-2.637-1.285-3.411,0l-2.806,4.806c4.362,2.178 7.243,6.505 7.57,11.369h-1.971c-.326-4.169-2.834-7.855-6.593-9.688l-2.597,4.491c2.11,.947 3.594,2.902 3.936,5.19h-4.525c-.109-.008-.207-.07-.261-.165c-.053-.096-.055-.212-.004-.309l1.254-2.132c-.425-.354-.91-.629-1.432-.81l-1.242,2.132c-.261,.448-.332,.981-.196,1.481c.135,.5 .466,.925 .917,1.18c.294,.166 .626,.254 .964,.256h6.197c.234-2.888-1.06-5.689-3.412-7.382l.985-1.706c2.969,2.039 4.639,5.495 4.393,9.088h5.249c.249-5.444-2.417-10.609-6.998-13.56l1.991-3.412c.092-.155 .292-.206 .447-.115c.226,.124 8.653,14.828 8.811,14.998c.057,.101 .055,.226-.005,.325c-.06,.1-.169,.159-.285,.157h-2.03c.026,.543 .026,1.085 0,1.625h2.038c.702,.004 1.352-.368 1.704-.975c.352-.607 .353-1.355 .002-1.963z"},shadcn:{title:"shadcn/ui",source:"Simple Icons",path:"M20.516,11.82l-8.696,8.696c-.339,.339-.339,.89 0,1.23c.339,.339 .89,.339 1.23,0l8.696-8.696c.339-.34 .339-.891 0-1.23c-.34-.339-.891-.339-1.23,0zM18.777,2.254l-16.522,16.522c-.339,.339-.339,.89 0,1.23c.34,.339 .891,.339 1.23,0l16.522-16.522c.339-.339 .339-.89 0-1.23c-.34-.339-.891-.339-1.23,0z"},slack:{title:"Slack",source:"svgl",path:"M9.336,1.99c-1.104,.001-1.998,.897-1.998,2.002c-.001,1.104 .894,2.001 1.998,2.002h1.998v-2.001c.001-1.104-.894-2.001-1.999-2.002c.001,0 .001,0 0,0M9.336,7.329h-5.327c-1.104,.001-1.999,.897-1.998,2.002c-.002,1.104 .893,2.001 1.998,2.002h5.328c1.104-.001 1.999-.897 1.998-2.002c.001-1.105-.894-2.002-1.998-2.002zM21.99,9.33c.001-1.104-.894-2.001-1.998-2.002c-1.104,.001-1.999,.897-1.998,2.002v2.002h1.998c1.104-.001 1.999-.897 1.998-2.002zM16.662,9.33v-5.339c.001-1.104-.893-2-1.998-2.002c-1.104,.001-1.999,.897-1.998,2.002v5.339c-.002,1.104 .893,2.001 1.998,2.002c1.104-.001 1.999-.897 1.998-2.002zM14.664,22.01c1.104-.001 1.999-.897 1.998-2.002c.001-1.104-.894-2.001-1.998-2.002h-1.998v2.002c-.001,1.104 .894,2 1.998,2.002zM14.664,16.671h5.328c1.104-.001 1.999-.897 1.998-2.002c.002-1.104-.893-2.001-1.998-2.002h-5.328c-1.104,.001-1.999,.897-1.998,2.002c-.001,1.105 .893,2.002 1.998,2.002zM2.01,14.669c-.001,1.104 .894,2.001 1.998,2.002c1.104-.001 1.999-.897 1.998-2.002v-2.002h-1.998c-1.104,.001-1.999,.897-1.998,2.002zM7.338,14.669v5.339c-.002,1.104 .893,2.001 1.998,2.002c1.104-.001 1.999-.897 1.998-2.002v-5.338c.002-1.104-.893-2.001-1.998-2.002c-1.105,0-1.999,.896-1.998,2.001c0,0 0,.001 0,0"},square:{title:"Square",source:"Simple Icons",path:"M5.342,2c-1.846,0-3.342,1.496-3.342,3.342v13.317c0,1.842 1.5,3.333 3.342,3.342h13.317c1.842,0 3.342-1.5 3.342-3.342v-13.325c-.005-1.842-1.499-3.333-3.342-3.333h-13.325zM6.692,5.633h10.617c.583,0 1.05,.475 1.05,1.058v10.617c0,.583-.467,1.058-1.05,1.058h-10.617c-.583,0-1.05-.475-1.05-1.058v-10.617c0-.581 .469-1.054 1.05-1.058zM9.883,9.258c-.336,0-.608,.272-.608,.608v4.242c0,.333 .267,.6 .6,.6h4.25c.333,0 .604-.267 .608-.6v-4.242c0-.336-.272-.608-.608-.608h-4.25z"},stripe:{title:"Stripe",source:"Simple Icons",path:"M13.948,9.189c-2.142-.795-3.31-1.406-3.31-2.376c0-.82 .674-1.287 1.875-1.287c2.196,0 4.453,.846 6.007,1.609l.878-5.419c-1.232-.59-3.752-1.551-7.235-1.551c-2.464,0-4.513,.645-5.978,1.846c-1.523,1.258-2.315,3.077-2.315,5.273c0,3.984 2.433,5.681 6.387,7.12c2.55,.907 3.398,1.552 3.398,2.548c0,.967-.828,1.524-2.322,1.524c-1.849,0-4.897-.908-6.894-2.08l-.888,5.479c1.717,.966 4.883,1.962 8.167,1.962c2.605,0 4.777-.615 6.241-1.788c1.641-1.287 2.49-3.192 2.49-5.653c0-4.071-2.489-5.771-6.504-7.205z"},supabase:{title:"Supabase",source:"Simple Icons",path:"M11.916,2.745c-.013-.832-1.064-1.19-1.582-.538l-7.818,9.835c-.923,1.162-.096,2.874 1.389,2.874h8.086l.095,6.339c.012,.831 1.063,1.189 1.581,.537l7.818-9.836c.923-1.161 .095-2.872-1.389-2.872h-8.139z"},teams:{title:"Microsoft Teams",source:"svgl",path:"M12,10.378h6.489c1.792,0 3.244,1.453 3.244,3.244v5.407c0,1.792-1.453,3.244-3.244,3.244c-1.792,0-3.244-1.453-3.244-3.244v-5.407c0-1.792-1.453-3.244-3.244-3.244zM4.43,12.541c0-1.792 1.453-3.244 3.244-3.244h4.326c1.792,0 3.244,1.453 3.244,3.244v6.489c0,1.792 1.453,3.244 3.244,3.244h-8.652c-2.986,0-5.407-2.421-5.407-5.407zM17.948,9.296c1.493,0 2.704-1.21 2.704-2.704c0-1.493-1.21-2.704-2.704-2.704c-1.493,0-2.704,1.21-2.704,2.704c0,1.493 1.21,2.704 2.704,2.704zM9.837,8.215c1.792,0 3.244-1.453 3.244-3.244c0-1.792-1.453-3.244-3.244-3.244c-1.792,0-3.244,1.453-3.244,3.244c0,1.792 1.453,3.244 3.244,3.244zM4.024,20.652c-.971,0-1.757-.787-1.757-1.757v-5.137c0-.971 .787-1.757 1.757-1.757h5.137c.971,0 1.757,.787 1.757,1.757v5.137c0,.971-.787,1.757-1.757,1.757zM8.474,14.761v-.906h-3.764v.906h1.323v4.037h1.117v-4.037h1.324zM8.474,14.761v-.906h-3.764v.906h1.323v4.037h1.117v-4.037h1.324z"},telegram:{title:"Telegram",source:"Simple Icons",path:"M11.953,2c-5.505,.026-9.953,4.495-9.953,10c0,5.523 4.477,10 10,10c5.523,0 10-4.477 10-10c0-5.523-4.477-10-10-10c-.016,0-.031,0-.047,0zM16.088,8.02c.083-.002 .268,.019 .388,.117c.08,.069 .131,.166 .143,.271c.013,.078 .03,.255 .017,.393c-.15,1.582-.802,5.418-1.133,7.189c-.14,.75-.416,1.001-.683,1.025c-.58,.054-1.021-.383-1.583-.752c-.88-.577-1.377-.937-2.232-1.5c-.987-.65-.347-1.008 .215-1.592c.148-.153 2.706-2.481 2.756-2.692c.006-.027 .012-.125-.047-.177c-.058-.052-.145-.034-.207-.02c-.088,.02-1.494,.95-4.217,2.788c-.4,.275-.761,.408-1.085,.4c-.357-.007-1.043-.201-1.554-.367c-.627-.204-1.124-.312-1.081-.657c.023-.18 .271-.364 .744-.552c2.915-1.27 4.858-2.107 5.832-2.512c2.777-1.155 3.354-1.356 3.73-1.362z"},vercel:{title:"Vercel",source:"Simple Icons",path:"M12,2.694l10.746,18.612h-21.492z"},webflow:{title:"Webflow",source:"Simple Icons",path:"M24,4.515l-7.658,14.97h-7.193l3.205-6.204h-.144c-2.644,3.432-6.589,5.692-12.21,6.204v-6.118c0,0 3.596-.213 5.71-2.435h-5.71v-6.417h6.417v5.278l.144-.001l2.622-5.277h4.854v5.244h.144l2.72-5.244z"},wix:{title:"Wix",source:"Simple Icons",path:"M0,7.355l2.113,9.292h.801c.726,0 1.354-.508 1.506-1.218l1.351-6.34c.016-.079 .086-.137 .167-.137c.08,0 .15,.058 .167,.137l1.352,6.34c.152,.71 .78,1.218 1.506,1.218h.805l2.113-9.292h-.565c-.62,0-1.159,.43-1.296,1.035l-1.26,5.545l-1.106-5.176c-.102-.473-.395-.883-.81-1.134c-.414-.251-.914-.319-1.38-.19c-.639,.176-1.113,.716-1.251,1.365l-1.094,5.127l-1.26-5.537c-.138-.605-.675-1.035-1.296-1.035zM13.992,7.355c-.525,0-.95,.425-.951,.95v8.342h.635c.525-.001 .95-.425 .951-.95v-8.343h-.635zM15.77,7.355l3.158,4.66l-3.14,4.632h1.325c.368,0 .712-.181 .918-.486l1.756-2.59c.022-.032 .059-.051 .099-.051c.039,0 .076,.019 .099,.051l1.754,2.59c.206,.305 .55,.486 .918,.486h1.326l-3.14-4.632l3.158-4.66h-1.326c-.368,0-.712,.181-.918,.486l-1.772,2.617c-.022,.032-.059,.051-.098,.051c-.039,0-.076-.019-.098-.051l-1.773-2.617c-.206-.304-.55-.486-.918-.486z"},zapier:{title:"Zapier",source:"Simple Icons",path:"M14.5,12.003c0,.744-.137,1.455-.384,2.113c-.656,.248-1.369,.384-2.112,.384h-.007c-.744,0-1.454-.137-2.112-.384c-.247-.657-.384-1.369-.384-2.112v-.007c0-.744 .137-1.454 .384-2.112c.658-.247 1.368-.384 2.112-.384h.008c.744,0 1.457,.137 2.113,.385c.248,.657 .384,1.368 .384,2.113zM21.863,10.333h-5.837l4.123-4.127c-.325-.457-.683-.883-1.079-1.277c-.394-.395-.821-.756-1.275-1.08l-4.128,4.124v-5.836c-.541-.087-1.094-.137-1.662-.137h-.008c-.567,0-1.122,.051-1.662,.138v5.838l-4.125-4.124c-.457,.322-.883,.684-1.278,1.078c-.395,.395-.757,.823-1.08,1.278l4.124,4.127h-5.836c0,0-.137,1.097-.137,1.663v.008c0,.567 .051,1.123 .138,1.663h5.838l-4.124,4.127c.648,.913 1.444,1.709 2.356,2.358l4.127-4.125v5.837c.54,.088 1.094,.138 1.659,.138h.014c.566,0 1.12-.05 1.659-.137v-5.837l4.127,4.125c.457-.312 .883-.677 1.274-1.075h.004c.394-.387 .755-.813 1.08-1.276l-4.125-4.124h5.837c.088-.537 .138-1.087 .138-1.65v-.026c0-.565-.05-1.119-.137-1.658"}};var hw=j(fe(),1);function SE({id:e}){let t=wE[e];return(0,hw.jsx)("svg",{viewBox:"0 0 24 24",focusable:"false","aria-hidden":"true",children:(0,hw.jsx)("path",{fill:"currentColor",fillRule:t.evenodd?"evenodd":void 0,d:t.path})})}var k=j(fe(),1),PV={"/settings/lead":(0,k.jsx)(zi,{}),"/settings/flows":(0,k.jsx)(Ui,{}),"/settings/integrations":(0,k.jsx)(Cf,{}),"/settings/models":(0,k.jsx)(af,{}),"/settings/skills":(0,k.jsx)(Ko,{}),"/settings/tools":(0,k.jsx)(Vi,{}),"/settings/knowledge":(0,k.jsx)(Oi,{}),"/settings/learning":(0,k.jsx)(Wo,{}),"/settings/sign-in":(0,k.jsx)(xf,{}),"/settings/sessions":(0,k.jsx)(pf,{}),"/settings/project":(0,k.jsx)(sf,{}),"/settings/policy":(0,k.jsx)(of,{}),"/settings/approval":(0,k.jsx)(Rf,{}),"/settings/monitoring":(0,k.jsx)(Yd,{}),"/settings/retention":(0,k.jsx)(ef,{}),"/settings/storage":(0,k.jsx)(df,{}),"/settings/updates":(0,k.jsx)(kf,{}),"/settings/backups":(0,k.jsx)(nf,{}),"/settings/data":(0,k.jsx)(Hi,{})},CE=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-");function xc({action:e,csrf:t,children:a,className:n}){let o=(0,za.useRef)(null);return(0,k.jsx)($e,{ref:o,action:e,className:n,children:a(()=>setTimeout(()=>o.current?.requestSubmit(),0))})}function Dr({title:e,description:t,children:a,id:n}){return(0,k.jsxs)(Sa,{id:n,"aria-labelledby":n?`${n}-title`:void 0,children:[(0,k.jsx)($R,{children:(0,k.jsxs)("div",{className:"grid gap-1",children:[(0,k.jsx)(jR,{id:n?`${n}-title`:void 0,children:e}),t&&(0,k.jsx)(WR,{children:t})]})}),a]})}function Ar({tone:e}){return(0,k.jsx)("span",{"aria-hidden":"true",className:te("size-2 shrink-0 rounded-full",e==="ok"&&"bg-success",e==="warn"&&"bg-warning",e==="neutral"&&"bg-muted-foreground",e==="off"&&"border-[1.5px] border-muted-foreground")})}function OV({view:e,csrf:t}){return(0,k.jsxs)($e,{action:"/settings/appearance",className:"flex flex-wrap items-center gap-3",children:[(0,k.jsx)("div",{role:"group","aria-label":"Theme",className:"inline-flex rounded-lg bg-muted p-0.5",children:[["system","Match device",(0,k.jsx)(bf,{},"m")],["light","Light",(0,k.jsx)(Mf,{},"s")],["dark","Dark",(0,k.jsx)(wf,{},"d")]].map(([n,o,r])=>(0,k.jsxs)("button",{type:"submit",name:"theme",value:n,"aria-pressed":e.theme===n,className:te("inline-flex h-7 items-center gap-2 rounded-md px-2.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground phone:h-11 [&_svg]:size-3.5",e.theme===n&&"bg-card text-foreground shadow-[var(--so-pill-shadow)]"),children:[r,o]},n))}),(0,k.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"Saved in this browser."})]})}var Xg=e=>Math.min(1,Math.max(0,e));function kE({h:e,s:t,v:a}){let n=o=>{let r=(o+e/60)%6;return a-a*t*Math.max(0,Math.min(r,4-r,1))};return`#${[n(5),n(3),n(1)].map(o=>Math.round(o*255).toString(16).padStart(2,"0")).join("")}`}function LE(e){let[t,a,n]=[1,3,5].map(i=>parseInt(e.slice(i,i+2),16)/255),o=Math.max(t,a,n),r=o-Math.min(t,a,n);return{h:(r===0?0:o===t?((a-n)/r+6)%6:o===a?(n-t)/r+2:(t-a)/r+4)*60,s:o===0?0:r/o,v:o}}function zV(e){let t=document.documentElement,a=t.dataset.theme==="dark"||t.dataset.theme!=="light"&&matchMedia("(prefers-color-scheme: dark)").matches,n=mw(e)[a?"dark":"light"];for(let[o,r]of[["signal",n.signal],["signal-hover",n.hover],["on-signal",n.on],["signal-soft",n.soft],["selection",n.selection]])t.style.setProperty(`--so-${o}`,r)}function BV({hsv:e,onChange:t}){let a=n=>{let o=n.currentTarget.getBoundingClientRect();t({h:e.h,s:Xg((n.clientX-o.left)/o.width),v:1-Xg((n.clientY-o.top)/o.height)})};return(0,k.jsx)("div",{role:"slider",tabIndex:0,"aria-label":"Saturation and brightness","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e.s*100),"aria-valuetext":`saturation ${Math.round(e.s*100)}%, brightness ${Math.round(e.v*100)}%`,className:"relative h-28 w-44 shrink-0 cursor-crosshair touch-none rounded-lg shadow-[inset_0_0_0_1px_rgb(0_0_0/.08)] phone:h-36 phone:w-full",style:{background:`linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(${e.h} 100% 50%))`},onPointerDown:n=>{n.currentTarget.setPointerCapture(n.pointerId),a(n)},onPointerMove:n=>{n.buttons!==0&&a(n)},onKeyDown:n=>{let o=n.shiftKey?.1:.02,r={ArrowLeft:[-o,0],ArrowRight:[o,0],ArrowUp:[0,o],ArrowDown:[0,-o]}[n.key];r!==void 0&&(n.preventDefault(),t({h:e.h,s:Xg(e.s+r[0]),v:Xg(e.v+r[1])}))},children:(0,k.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgb(0_0_0/.35)]",style:{left:`${e.s*100}%`,top:`${(1-e.v)*100}%`}})})}function FV({view:e,csrf:t}){let[a,n]=(0,za.useState)(e.accent),[o,r]=(0,za.useState)(()=>LE(e.accent)),[s,i]=(0,za.useState)(e.accent),[l,c]=(0,za.useState)(null),f=(0,za.useRef)(void 0),u=(b,v)=>{n(b),i(b),r(v??LE(b)),zV(b),c(null),window.clearTimeout(f.current),f.current=window.setTimeout(async()=>{let x=await fetch("/settings/appearance",{method:"POST",body:new URLSearchParams({csrf:t,accent:b,quiet:"1"})}).catch(()=>null);c(x?.ok?"Saved":"Not saved. Try again.")},400)};(0,za.useEffect)(()=>()=>window.clearTimeout(f.current),[]);let d=()=>{let b=vE(s);b===null?i(a):b!==a&&u(b)},m=e.accentPresets.find(b=>b.hex===a),g=yE(a);return(0,k.jsxs)("div",{className:"flex flex-col gap-3","data-accent-picker":!0,children:[(0,k.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,k.jsx)(BV,{hsv:o,onChange:b=>u(kE(b),b)}),(0,k.jsxs)("div",{className:"flex min-w-0 flex-1 basis-52 flex-col gap-2.5",children:[(0,k.jsx)("input",{type:"range",min:0,max:359,value:Math.round(o.h),"aria-label":"Hue",onChange:b=>{let v={...o,h:Number(b.target.value),s:o.s||.75,v:o.v||.75};u(kE(v),v)},className:"h-3 w-full cursor-pointer appearance-none rounded-full phone:h-11 phone:bg-[length:100%_12px] phone:bg-center phone:bg-no-repeat bg-[linear-gradient(to_right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring [&::-moz-range-thumb]:size-4 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-white [&::-moz-range-thumb]:bg-transparent [&::-webkit-slider-thumb]:size-4 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:shadow-[0_0_0_1px_rgb(0_0_0/.35)]"}),(0,k.jsxs)("div",{className:"flex items-center gap-2",children:[(0,k.jsx)("span",{"aria-hidden":"true",className:"size-8 shrink-0 rounded-md shadow-[inset_0_0_0_1px_rgb(0_0_0/.12)]",style:{background:a}}),(0,k.jsx)(ve,{value:s,"aria-label":"Hex colour",spellCheck:!1,autoComplete:"off",className:"w-28 font-mono",onChange:b=>i(b.target.value),onBlur:d,onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),d())}}),(0,k.jsx)(Z,{variant:"ghost",size:"sm",disabled:a===e.accentPresets[0].hex,onClick:()=>u(e.accentPresets[0].hex),children:"Reset"})]}),(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-2","aria-hidden":"true",children:[(0,k.jsx)("span",{className:"inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-attention px-1.5 font-mono text-[11px] leading-none text-on-attention",children:"3"}),(0,k.jsx)(wa,{tone:"attention",children:"Needs your decision"}),(0,k.jsx)("span",{className:"inline-flex h-7 items-center rounded-md bg-attention px-2.5 text-[12.5px] font-medium text-on-attention",children:"Approve"})]}),(0,k.jsxs)("p",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite","data-accent-status":!0,children:[m!==void 0?(0,k.jsxs)(k.Fragment,{children:[m.name,m.year!==null&&(0,k.jsxs)("span",{className:"font-mono",children:[" ",m.year]})]}):"Custom",l!==null&&` · ${l}`]})]})]}),g!==null&&(0,k.jsx)("p",{className:"text-[12.5px] text-warning",children:g}),(0,k.jsx)("div",{role:"group","aria-label":"Presets",className:"flex flex-wrap gap-1.5",children:e.accentPresets.map(b=>(0,k.jsx)("button",{type:"button","data-preset":b.id,"aria-pressed":b.hex===a,"aria-label":`${b.name}${b.year===null?", the default":`, ${b.year}`}`,title:`${b.name}${b.year===null?"":` · ${b.year}`}`,onClick:()=>u(b.hex),style:{background:b.hex},className:te("size-6 rounded-full shadow-[inset_0_0_0_1px_rgb(0_0_0/.12)] ring-offset-2 ring-offset-card transition-shadow phone:size-11",b.hex===a?"ring-2 ring-foreground":"hover:ring-2 hover:ring-input")},b.id))}),(0,k.jsx)("p",{className:"text-[12.5px] text-muted-foreground",children:"Presets are Pantone's colours of the year. Colours are deepened or lightened as needed so text stays readable. Saved in this browser."})]})}function IE({title:e,description:t,action:a,field:n,value:o,canManage:r,changed:s,options:i,csrf:l}){let c=(0,za.useId)(),f=i.find(u=>u.value===o);return(0,k.jsxs)(Dr,{title:e,description:t,children:[r?(0,k.jsx)(xc,{action:a,csrf:l,children:u=>(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(lg,{name:n,defaultValue:o,onValueChange:u,className:"grid gap-2 desk:grid-cols-2","aria-label":e,children:i.map(d=>(0,k.jsx)(Of,{id:`${c}-${d.value}`,value:d.value,title:d.title,description:d.description},d.value))}),(0,k.jsx)("noscript",{children:(0,k.jsx)(Z,{type:"submit",className:"mt-3",children:"Save"})})]})}):(0,k.jsxs)("p",{className:"text-sm",children:[(0,k.jsx)("strong",{children:f?.title??o})," ",(0,k.jsx)("span",{className:"text-muted-foreground",children:"· an approver can change this"})]}),s&&(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:s})]})}function HV({email:e,csrf:t}){let a=e.google.connected,n=a!==null?`${a}, through Google`:e.set?`From ${e.from} through ${e.host}${e.imapHost===""?"":` · reads ${e.imapHost}`}`:"Not set up";return(0,k.jsx)(Dr,{id:"email",title:"Email",description:"Send email steps send from this account, and Email inbox triggers read it.",children:(0,k.jsxs)(nc,{defaultOpen:!e.set&&a===null,children:[(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,k.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm",children:[(0,k.jsx)(Ar,{tone:e.set||a!==null?"ok":"off"}),n]}),(0,k.jsx)(oc,{asChild:!0,children:(0,k.jsxs)(Z,{variant:"ghost",size:"sm",className:"ml-auto group",children:[e.set||a!==null?"Change":"Set up",(0,k.jsx)(sa,{className:"transition-transform group-data-[state=open]:rotate-90"})]})})]}),(0,k.jsx)(rc,{children:a!==null?(0,k.jsxs)($e,{action:"/settings/google/disconnect",className:"mt-3 grid gap-3 rounded-lg bg-muted p-4","data-google-connected":!0,children:[(0,k.jsxs)("p",{className:"text-[13px]",children:["Signed in with Google as ",(0,k.jsx)("strong",{children:a}),". Mail is sent and read through it."]}),(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,k.jsx)(Z,{type:"submit",variant:"outline",formAction:"/settings/email-test",children:"Send a test email"}),(0,k.jsx)(Z,{type:"submit",variant:"outline",formAction:"/settings/email-read-test",children:"Check the inbox"}),(0,k.jsx)(Z,{type:"submit",variant:"ghost",children:"Disconnect Google"})]})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)($e,{action:"/settings/email",className:"mt-3 grid gap-3 rounded-lg bg-muted p-4","data-email-settings":!0,children:[(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"For Gmail: smtp.gmail.com, port 587, your address, and an app password. To read mail too, add imap.gmail.com."}),(0,k.jsxs)("div",{className:"grid gap-3 desk:grid-cols-[1fr_7rem]",children:[(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"email-host",children:"Mail server"}),(0,k.jsx)(ve,{id:"email-host",name:"host",defaultValue:e.host,placeholder:"smtp.gmail.com",required:!0})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"email-port",children:"Port"}),(0,k.jsx)(ve,{id:"email-port",name:"port",type:"number",min:1,max:65535,defaultValue:String(e.port),required:!0})]})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"email-from",children:"Send from"}),(0,k.jsx)(ve,{id:"email-from",name:"from",type:"email",defaultValue:e.from,placeholder:"you@example.com",required:!0})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"email-user",children:"Username"}),(0,k.jsx)(ve,{id:"email-user",name:"user",autoComplete:"username",defaultValue:e.user,placeholder:"Usually the same address"})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"email-password",children:"Password"}),(0,k.jsx)(ve,{id:"email-password",name:"password",type:"password",autoComplete:"off",placeholder:e.set?"Leave empty to keep the saved one":"An app password"})]}),(0,k.jsxs)("label",{className:"flex items-center gap-2 text-[13px] phone:-ml-3.5 phone:min-h-11 phone:pl-3.5",children:[(0,k.jsx)("input",{type:"checkbox",name:"secure",className:"size-4 accent-[var(--so-accent)]",defaultChecked:e.secure}),"Use SSL from the start (port 465)"]}),(0,k.jsxs)("div",{className:"grid gap-3 desk:grid-cols-[1fr_7rem]",children:[(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"email-imap",children:"Read mail from (optional)"}),(0,k.jsx)(ve,{id:"email-imap",name:"imapHost",defaultValue:e.imapHost,placeholder:"imap.gmail.com"})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"email-imap-port",children:"Port"}),(0,k.jsx)(ve,{id:"email-imap-port",name:"imapPort",type:"number",min:1,max:65535,defaultValue:String(e.imapPort)})]})]}),(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,k.jsx)(Z,{type:"submit",children:"Save email"}),e.set&&(0,k.jsx)(Z,{type:"submit",variant:"outline",formAction:"/settings/email-test",formNoValidate:!0,children:"Send a test email"}),e.set&&e.imapHost!==""&&(0,k.jsx)(Z,{type:"submit",variant:"outline",formAction:"/settings/email-read-test",formNoValidate:!0,children:"Check the inbox"})]})]}),(0,k.jsxs)("details",{className:"mt-3 rounded-lg border px-4 py-3",open:e.google.clientId!==""&&!e.set,"data-google-setup":!0,children:[(0,k.jsx)("summary",{className:"cursor-pointer text-[13px] font-semibold phone:-my-3 phone:min-h-11 phone:py-3 phone:leading-5",children:"Or sign in with a Google account"}),(0,k.jsxs)($e,{action:"/settings/google",className:"mt-3 grid gap-3",children:[(0,k.jsxs)("ol",{className:"list-decimal space-y-1 pl-5 text-[13px] text-muted-foreground",children:[(0,k.jsxs)("li",{children:["In Google Cloud Console, make an OAuth client of type ",(0,k.jsx)("em",{children:"Web application"}),", and set the consent screen to ",(0,k.jsx)("em",{children:"In production"})," (while it's in Testing, Google ends the connection after 7 days)."]}),e.google.redirect===null?(0,k.jsx)("li",{children:"Open these settings on this computer (localhost) or at your https address to see the redirect address to add."}):(0,k.jsxs)("li",{children:["Add this as an authorized redirect address: ",(0,k.jsx)("code",{className:"break-all rounded bg-muted px-1 py-0.5 text-foreground","data-google-redirect":!0,children:e.google.redirect})]}),(0,k.jsx)("li",{children:"Paste the client ID and secret here, then connect. Google warns that it hasn't verified the app: it's your own, so continue."})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"google-id",children:"Client ID"}),(0,k.jsx)(ve,{id:"google-id",name:"clientId",defaultValue:e.google.clientId,placeholder:"….apps.googleusercontent.com",required:!0})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"google-secret",children:"Client secret"}),(0,k.jsx)(ve,{id:"google-secret",name:"clientSecret",type:"password",autoComplete:"off",placeholder:e.google.clientId!==""?"Leave empty to keep the saved one":""})]}),(0,k.jsx)(Z,{type:"submit",className:"justify-self-start",disabled:e.google.redirect===null,children:"Connect Google"})]})]})]})})]})})}function qV({providers:e,csrf:t}){return(0,k.jsx)(Dr,{id:"providers",title:"AI providers",description:"Keys stay on this computer and are never shown again.",children:(0,k.jsx)("ul",{className:"-my-1 divide-y divide-border",children:e.map(a=>(0,k.jsx)("li",{className:"py-2",children:(0,k.jsxs)(nc,{children:[(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,k.jsx)("span",{className:"font-semibold",children:a.name}),(0,k.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground",children:[(0,k.jsx)(Ar,{tone:a.tone}),a.words]}),(0,k.jsx)(oc,{asChild:!0,children:(0,k.jsxs)(Z,{variant:"ghost",size:"sm",className:"ml-auto group",children:["Manage",(0,k.jsx)(sa,{className:"transition-transform group-data-[state=open]:rotate-90"})]})})]}),(0,k.jsx)(rc,{children:(0,k.jsxs)($e,{action:"/settings/provider-key",className:"mt-3 grid gap-3 rounded-lg bg-muted p-4",children:[(0,k.jsx)("input",{type:"hidden",name:"provider",value:a.provider}),a.connection&&(0,k.jsxs)("p",{className:"provider-connection text-sm",children:[(0,k.jsx)("strong",{children:a.connection.words})," ",a.connection.facts," · ",(0,k.jsx)("a",{className:"underline underline-offset-4",href:a.connection.checkHref,children:"Check again"})]}),(0,k.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:[a.usage," · ",(0,k.jsx)("code",{className:"font-mono text-xs",children:a.envName})]}),a.subscriptionCapable&&(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:`${a.provider}-auth`,children:"Sign-in"}),(0,k.jsxs)(Gf,{name:"auth-mode",defaultValue:a.mode,children:[(0,k.jsx)(jf,{id:`${a.provider}-auth`,children:(0,k.jsx)($f,{})}),(0,k.jsxs)(Wf,{children:[(0,k.jsxs)(tc,{value:"subscription",children:[a.name," subscription"]}),(0,k.jsx)(tc,{value:"api-key",children:"API key"})]})]})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:`${a.provider}-key`,children:"API key"}),(0,k.jsx)(ve,{id:`${a.provider}-key`,type:"password",name:"value",autoComplete:"off",placeholder:a.set?"Paste to replace the stored key":"Paste a key"})]}),(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,k.jsxs)(Z,{type:"submit",children:["Save ",a.name]}),a.set&&(0,k.jsxs)(nc,{children:[(0,k.jsx)(oc,{asChild:!0,children:(0,k.jsx)(Z,{variant:"ghost",size:"sm",className:"text-destructive",children:"Remove the stored key"})}),(0,k.jsxs)(rc,{className:"mt-2 grid gap-2",children:[(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"Runs that use this API key stop until you add one again."}),(0,k.jsx)(Z,{type:"submit",variant:"destructive",size:"sm",formAction:"/settings/provider-key-clear",children:"Remove key"})]})]})]})]})})]})},a.provider))})})}function UV({workers:e}){return(0,k.jsxs)(Dr,{id:"workers",title:"Workers",description:"How many tasks each worker runs at once, and what it is running now.",children:[e.length===0?(0,k.jsxs)("p",{className:"text-sm text-muted-foreground",children:["No worker is connected. Run ",(0,k.jsx)("code",{className:"font-mono text-xs",children:"toolroll up"})," on the computer with your projects."]}):(0,k.jsx)("ul",{className:"-my-1 divide-y divide-border",children:e.map(t=>(0,k.jsxs)("li",{className:"grid gap-1.5 py-2.5","data-worker":t.name,children:[(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,k.jsx)("span",{className:"min-w-0 break-all font-semibold",children:t.name}),(0,k.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground",children:[(0,k.jsx)(Ar,{tone:t.tone}),t.state]}),(0,k.jsxs)("span",{className:"ml-auto text-sm tabular-nums","data-worker-load":!0,children:[t.busy," of ",t.capacity," running"]})]}),t.running.length===0?(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"Nothing running."}):(0,k.jsx)("ul",{className:"grid gap-1",children:t.running.map(a=>(0,k.jsxs)("li",{className:"flex min-w-0 items-baseline gap-2 text-sm",children:[(0,k.jsx)("a",{className:"min-w-0 truncate underline-offset-4 hover:underline phone:min-h-11 phone:leading-[44px]",href:a.href,children:a.title}),a.project&&(0,k.jsx)("span",{className:"shrink-0 text-[13px] text-muted-foreground",children:a.project})]},a.taskId))})]},t.name))}),e.length>0&&(0,k.jsxs)("p",{className:"mt-3 text-[13px] text-muted-foreground",children:["To change how many a worker runs at once: ",(0,k.jsx)("code",{className:"font-mono text-xs",children:"toolroll runner capacity <name> <n>"})]})]})}function VV({updates:e,csrf:t,firstResult:a}){let n=e.latest,o=n!==null&&n.newer?n:null,[r,s]=(0,za.useState)(!1),i=()=>{navigator.clipboard?.writeText(e.updateCommand).then(()=>{s(!0),window.setTimeout(()=>s(!1),1500)},()=>{})};return(0,k.jsxs)(Dr,{id:"updates",title:"Updates",children:[(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1","data-updates-state":o?"newer":e.check.on?n===null?"unchecked":"current":"off",children:[(0,k.jsxs)("span",{className:"text-sm",children:["This version ",(0,k.jsx)("span",{className:"font-mono text-[12.5px]",children:e.current})]}),(0,k.jsx)("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground",children:o?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ar,{tone:"neutral"}),(0,k.jsxs)("span",{children:[(0,k.jsx)("span",{className:"font-mono text-[12.5px] text-foreground",children:o.version})," is available"]})]}):e.check.on?n===null?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ar,{tone:"off"}),"Not checked yet"]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ar,{tone:"ok"}),"Up to date"]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ar,{tone:"off"}),"Checks are off"]})}),o?.security&&(0,k.jsx)(wa,{tone:"warning",children:"Security fixes"})]}),a!==null&&(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground","data-first-result":!0,children:a}),o&&(0,k.jsxs)("div",{className:"grid gap-2 rounded-lg bg-muted p-3 phone:p-3","data-update-command":!0,children:[(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,k.jsx)("code",{className:"min-w-0 flex-1 break-words font-mono text-[12.5px]",children:e.updateCommand}),(0,k.jsx)(Z,{variant:"outline",size:"sm",onClick:i,children:r?"Copied":"Copy"})]}),(0,k.jsx)("p",{className:"text-[12.5px] text-muted-foreground",children:"Run it on this computer, then restart Toolroll."})]}),o&&(0,k.jsxs)(nc,{children:[(0,k.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,k.jsx)(oc,{asChild:!0,children:(0,k.jsxs)(Z,{variant:"ghost",size:"sm",className:"group -ml-2.5",disabled:o.notes==="",children:["What's new in ",o.version,(0,k.jsx)(sa,{className:"transition-transform group-data-[state=open]:rotate-90"})]})}),(0,k.jsx)("a",{className:"text-[13px] underline underline-offset-4",href:o.url,target:"_blank",rel:"noreferrer",children:"Release page"})]}),(0,k.jsx)(rc,{children:(0,k.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border p-3 font-sans text-[13px] leading-relaxed","data-update-notes":!0,children:o.notes})})]}),(0,k.jsx)(ac,{}),(0,k.jsx)(xc,{action:"/settings/updates/checks",csrf:t,className:"flex items-center justify-between gap-4",children:l=>(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)("div",{className:"grid gap-0.5",children:[(0,k.jsx)(Ct,{htmlFor:"update-check",children:"Check for a newer version once a day"}),(0,k.jsx)("span",{className:"text-[12.5px] text-muted-foreground",children:e.check.byEnv?"Off by TOOLROLL_NO_UPDATE_CHECK.":"One anonymous request to npm and GitHub. Nothing about you is sent."})]}),(0,k.jsx)(Fb,{id:"update-check",name:"check",value:"on",defaultChecked:e.check.on,disabled:!e.check.canManage||e.check.byEnv,onCheckedChange:l})]})}),e.workers.length>0&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(ac,{}),(0,k.jsx)("ul",{className:"-my-1 divide-y divide-border","aria-label":"Worker versions",children:e.workers.map(l=>(0,k.jsxs)("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 py-2","data-worker-version":l.name,children:[(0,k.jsx)("span",{className:"min-w-0 break-all text-sm font-medium",children:l.name}),(0,k.jsx)("span",{className:te("ml-auto text-muted-foreground",l.version===null?"text-[12.5px]":"font-mono text-[12.5px]"),children:l.version??"Version not reported"}),l.older&&(0,k.jsx)(wa,{tone:"warning",children:"Older"})]},l.name))})]})]})}var GV=[["off","Off"],["first","First one"],["all","Up to 4"]];function $V({view:e,csrf:t}){let a=(0,za.useId)();return!e.chat&&e.services===null&&e.push===null&&e.digest===null?null:(0,k.jsxs)(Dr,{id:"notifications",title:"Notifications",children:[e.chat&&(0,k.jsx)(xc,{action:"/settings/notifications",csrf:t,className:"grid gap-4 phone:gap-3",children:n=>(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(lg,{name:"mode",defaultValue:e.chat.mode,onValueChange:n,className:"grid gap-2 desk:grid-cols-2","aria-label":"Chat messages",children:[(0,k.jsx)(Of,{id:`${a}-quiet`,value:"quiet",title:"Only when I'm needed",description:"One message per task, updated as it moves."}),(0,k.jsx)(Of,{id:`${a}-all`,value:"all",title:"Every step",description:"A new message for each update."})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:`${a}-evening`,children:"Evening digest"}),(0,k.jsxs)(Gf,{name:"digest",defaultValue:e.chat.digestAt??"off",onValueChange:n,children:[(0,k.jsx)(jf,{id:`${a}-evening`,className:"desk:max-w-72",children:(0,k.jsx)($f,{})}),(0,k.jsx)(Wf,{children:bE(e.chat.digestAt).map(([o,r])=>(0,k.jsx)(tc,{value:o,children:r},o))})]}),(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"One message: what finished, what waits, what failed."})]}),(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{htmlFor:`${a}-screenshots`,children:"Screenshots with results"}),(0,k.jsxs)(Gf,{name:"screenshots",defaultValue:e.chat.screenshots??"off",onValueChange:n,children:[(0,k.jsx)(jf,{id:`${a}-screenshots`,className:"desk:max-w-72",children:(0,k.jsx)($f,{})}),(0,k.jsx)(Wf,{children:GV.map(([o,r])=>(0,k.jsx)(tc,{value:o,children:r},o))})]})]}),(0,k.jsx)("noscript",{children:(0,k.jsx)(Z,{type:"submit",children:"Save"})})]})}),e.chat?.projects&&e.chat.projects.length>0&&(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)("span",{className:"font-semibold",children:"Projects"}),(0,k.jsx)("ul",{className:"-my-1 divide-y divide-border","aria-label":"Project pings",children:e.chat.projects.map((n,o)=>(0,k.jsx)("li",{"data-project-pings":n.name,children:(0,k.jsx)(xc,{action:"/settings/notifications/mute",csrf:t,className:"flex items-center justify-between gap-4 py-2",children:r=>(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("input",{type:"hidden",name:"repo",value:n.repo}),(0,k.jsx)(Ct,{htmlFor:`${a}-mute-${o}`,className:"min-w-0 break-all",children:n.name}),(0,k.jsx)(Fb,{id:`${a}-mute-${o}`,name:"pings",value:"on",defaultChecked:!n.muted,onCheckedChange:r,"aria-label":`Pings for ${n.name}`}),(0,k.jsx)("noscript",{children:(0,k.jsx)(Z,{type:"submit",size:"sm",variant:"outline",children:"Save"})})]})})},n.repo))}),(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"Off: no pings. It still shows in Tasks and the evening digest."})]}),e.chat&&e.services&&(0,k.jsx)(ac,{}),e.services&&(e.services.configured.length===1&&!e.services.implicit?(0,k.jsxs)("div",{className:"flex items-center gap-3",children:[(0,k.jsx)("span",{className:"font-semibold capitalize",children:e.services.configured[0]}),(0,k.jsxs)("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground",children:[(0,k.jsx)(Ar,{tone:"ok"}),"Receiving alerts"]})]}):(0,k.jsx)(xc,{action:"/settings/messaging",csrf:t,children:n=>(0,k.jsxs)("div",{className:"grid gap-2",children:[(0,k.jsx)(Ct,{children:"Alert service"}),e.services.implicit&&(0,k.jsx)("p",{className:"text-[13px] text-warning",children:"Several are connected and none was chosen. Pick one."}),(0,k.jsx)(lg,{name:"primary",...e.services.channel===null?{}:{defaultValue:e.services.channel},onValueChange:n,className:"grid gap-2 desk:grid-cols-2",children:e.services.configured.map(o=>(0,k.jsx)(Of,{id:`${a}-${o}`,value:o,title:o.charAt(0).toUpperCase()+o.slice(1),description:o==="telegram"?"Answer buttons and replies":"Messages with links"},o))})]})})),e.push&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(ac,{}),(0,k.jsxs)("div",{className:"grid gap-3",children:[(0,k.jsxs)("div",{className:"grid gap-1",children:[(0,k.jsx)("span",{className:"font-semibold",children:"This device"}),(0,k.jsx)("span",{className:"text-[13px] text-muted-foreground",children:e.push.available?"A notification when something needs you. On iPhone, add this app to your Home Screen first.":"Alerts need a secure (https) address for this app."})]}),e.push.available&&(0,k.jsxs)($e,{action:"/push/subscribe",id:"push-form",className:"flex flex-wrap items-end gap-3",children:[(0,k.jsx)("input",{type:"hidden",name:"endpoint",value:""}),(0,k.jsx)("input",{type:"hidden",name:"p256dh",value:""}),(0,k.jsx)("input",{type:"hidden",name:"auth",value:""}),(0,k.jsxs)("div",{className:"grid min-w-56 flex-1 gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"push-password",children:"Your password"}),(0,k.jsx)(ve,{id:"push-password",type:"password",name:"token",autoComplete:"current-password"})]}),(0,k.jsx)(Z,{type:"submit",id:"push-enable",variant:"outline",children:"Get alerts on this device"}),(0,k.jsx)("p",{className:"w-full text-[13px] text-muted-foreground",id:"push-state","aria-live":"polite"})]}),e.push.devices.length>0&&(0,k.jsx)("ul",{className:"grid gap-2",children:e.push.devices.map(n=>(0,k.jsxs)("li",{className:"flex flex-wrap items-center gap-3 text-sm",children:[(0,k.jsx)("span",{children:n.words}),n.state!=="ok"&&(0,k.jsx)(wa,{tone:n.state==="failing"?"warning":"neutral",children:n.state}),n.removable&&(0,k.jsxs)($e,{action:"/push/remove",className:"ml-auto",children:[(0,k.jsx)("input",{type:"hidden",name:"id",value:n.id}),(0,k.jsx)(Z,{type:"submit",variant:"ghost",size:"sm",children:"Remove"})]})]},n.id))})]})]}),e.digest&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(ac,{}),(0,k.jsx)(xc,{action:"/settings/telegram-digest",csrf:t,className:"grid gap-2",children:n=>(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ct,{htmlFor:`${a}-digest`,children:"Telegram digest"}),(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"Bundle routine updates. Anything that needs you still arrives at once."}),(0,k.jsxs)(Gf,{name:"every",defaultValue:e.digest.every,onValueChange:n,children:[(0,k.jsx)(jf,{id:`${a}-digest`,className:"desk:max-w-72",children:(0,k.jsx)($f,{})}),(0,k.jsx)(Wf,{children:[["off","Off: send each update"],["30","Every 30 minutes"],["60","Every hour"],["240","Every 4 hours"],["720","Every 12 hours"],["1440","Once a day"]].map(([o,r])=>(0,k.jsx)(tc,{value:o,children:r},o))})]}),e.digest.held&&(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground",children:e.digest.held})]})})]})]})}function jV({view:e,csrf:t}){return(0,k.jsxs)(nc,{className:"rounded-lg border border-border bg-card",children:[(0,k.jsx)(oc,{asChild:!0,children:(0,k.jsxs)("button",{className:"group flex w-full items-center justify-between gap-3 px-5 py-4 text-left phone:px-4",children:[(0,k.jsxs)("span",{className:"font-semibold",children:["Telegram bot token ",(0,k.jsx)("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:e.telegram.state})]}),(0,k.jsx)(sa,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-90"})]})}),(0,k.jsxs)(rc,{className:"grid gap-3 border-t border-border px-5 py-4 phone:px-4",children:[(0,k.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:["Current: ",e.telegram.current]}),e.telegram.delivery!=null&&(0,k.jsx)("p",{className:"text-[13px] text-muted-foreground","data-telegram-delivery":!0,children:e.telegram.delivery}),(0,k.jsxs)($e,{action:"/settings/telegram-token",className:"flex flex-wrap items-end gap-3",children:[(0,k.jsxs)("div",{className:"grid min-w-56 flex-1 gap-2",children:[(0,k.jsx)(Ct,{htmlFor:"telegram-token-field",children:"Token from @BotFather"}),(0,k.jsx)(ve,{id:"telegram-token-field",type:"password",name:"token",autoComplete:"off"})]}),(0,k.jsx)(Z,{type:"submit",variant:"outline",children:"Save token"})]}),(0,k.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:["Stored privately on this computer. Then pair your phone under ",(0,k.jsx)("a",{className:"underline underline-offset-4",href:"/settings/telegram",children:"Telegram"}),"."]})]})]})}function NE({view:e,csrf:t}){let[a]=(0,za.useState)(e.said);return(0,za.useEffect)(()=>{a&&xn(a.charAt(0).toUpperCase()+a.slice(1))},[a]),(0,k.jsxs)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-5 phone:gap-3",children:[(0,k.jsx)("h1",{className:"sr-only",children:"Settings"}),e.legacyWebhookWarning&&(0,k.jsxs)("p",{"data-legacy-webhooks":!0,className:"text-sm text-foreground",children:["Legacy webhooks are deprecated. Connect ",(0,k.jsx)("a",{className:"inline-flex min-h-11 items-center underline underline-offset-4 focus-visible:outline focus-visible:outline-2",href:"/settings/slack",children:"Slack"})," or ",(0,k.jsx)("a",{className:"inline-flex min-h-11 items-center underline underline-offset-4 focus-visible:outline focus-visible:outline-2",href:"/settings/discord",children:"Discord"})," in Chat settings."]}),(0,k.jsx)("nav",{"aria-label":"Settings sections",className:"grid gap-4 phone:gap-3",children:e.groups.map(n=>(0,k.jsxs)("section",{"aria-labelledby":`settings-${CE(n.title)}`,className:"grid gap-2 phone:gap-1.5",children:[(0,k.jsx)("h2",{id:`settings-${CE(n.title)}`,className:"text-sm font-semibold text-muted-foreground",children:n.title}),(0,k.jsx)("div",{className:"grid grid-cols-2 gap-2 desk:grid-cols-4 phone:gap-1.5",children:n.tiles.map(o=>(0,k.jsxs)("a",{href:o.href,className:"flex min-h-12 items-center gap-2.5 rounded-lg border border-border bg-card px-3 py-2 text-sm font-semibold phone:min-h-11 phone:gap-2 phone:px-2.5 transition-colors hover:bg-accent [&>svg]:size-[18px] [&>svg]:shrink-0 [&>svg]:text-primary",children:[o.brand===void 0?PV[o.href]:(0,k.jsx)(SE,{id:o.brand}),(0,k.jsxs)("span",{className:"grid min-w-0 gap-0.5",children:[o.label,o.status&&(0,k.jsxs)("span",{className:"flex items-center gap-1.5 text-[13px] font-normal text-muted-foreground",children:[(0,k.jsx)(Ar,{tone:o.status.tone}),o.status.words]})]})]},o.href))}),n.title==="Chat apps"&&e.phone&&(0,k.jsx)(jM,{phone:e.phone,csrf:t,dismissable:!1})]},n.title))}),(0,k.jsx)(Dr,{title:"Appearance",children:(0,k.jsx)(OV,{view:e,csrf:t})}),(0,k.jsx)(Dr,{id:"accent",title:"Accent colour",description:"The one colour that marks what needs you.",children:(0,k.jsx)(FV,{view:e,csrf:t})}),e.permission&&(0,k.jsx)(IE,{title:"Unattended permissions",description:"The starting choice for new tasks. Approved tasks keep their setting.",action:"/settings/permission-default",field:"permission-mode",value:e.permission.mode,canManage:e.permission.canManage,changed:e.permission.changed,csrf:t,options:[{value:"auto",title:"Auto",description:"Asks before risky actions."},{value:"bypassPermissions",title:"Full access",description:"Never asks and can change files anywhere on this computer. Trusted repositories only."}]}),e.quality&&(0,k.jsx)(IE,{title:"Quality mode",description:"Publishing and deploying still need their own approval.",action:"/settings/quality-default",field:"quality-mode",value:e.quality.mode,canManage:e.quality.canManage,changed:e.quality.changed,csrf:t,options:[{value:"default",title:"Default",description:"Everyday agents and the repository check."},{value:"strict",title:"Strict / release",description:"Strongest agents. Release approval stays separate."}]}),e.providers&&(0,k.jsx)(qV,{providers:e.providers,csrf:t}),e.workers&&(0,k.jsx)(UV,{workers:e.workers}),e.updates?(0,k.jsx)(VV,{updates:e.updates,csrf:t,firstResult:e.firstResult??null}):e.firstResult&&(0,k.jsx)(Dr,{title:"This installation",children:(0,k.jsx)("p",{className:"text-sm","data-first-result":!0,children:e.firstResult})}),e.email&&t&&(0,k.jsx)(HV,{email:e.email,csrf:t}),(0,k.jsx)($V,{view:e,csrf:t}),t&&(0,k.jsx)(jV,{view:e,csrf:t})]})}var _r=j(he(),1);var ie=j(fe(),1),WV={"/inbox":(0,ie.jsx)(qi,{}),"/code":(0,ie.jsx)(Ls,{}),"/board":(0,ie.jsx)(mf,{}),"/board?view=order":(0,ie.jsx)(hf,{}),"/tasks":(0,ie.jsx)(gf,{}),"/recipes":(0,ie.jsx)(Ko,{}),"/workbench":(0,ie.jsx)(Qd,{})},XV={neutral:"bg-foreground",warning:"bg-warning",danger:"bg-destructive"},TE={neutral:"",warning:"text-warning",danger:"text-destructive"};function YV({tile:e}){let t=(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsxs)("p",{className:"flex min-w-0 items-baseline gap-1.5 text-[12px] leading-4",children:[(0,ie.jsx)("span",{className:"truncate font-medium text-foreground",children:e.name}),(0,ie.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.window})]}),(0,ie.jsxs)("p",{className:te("mt-2.5 flex items-baseline tabular-nums phone:mt-1.5",e.unit==="%"?"gap-px":"gap-1"),children:[(0,ie.jsx)("span",{className:te("text-[22px] font-semibold leading-none tracking-[-0.02em]",e.tone==="danger"&&"text-destructive"),children:e.value}),(0,ie.jsx)("span",{className:"text-[12px] text-muted-foreground",children:e.unit})]}),(0,ie.jsxs)("div",{className:"relative mt-3 h-1.5 phone:mt-2 overflow-hidden rounded-full bg-muted",role:"meter","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(Math.min(100,e.percent)),"aria-label":`${e.name} ${e.window}`,children:[(0,ie.jsx)("div",{className:te("h-full rounded-full motion-safe:transition-[width] motion-safe:duration-500 motion-safe:ease-out",XV[e.tone]),style:{width:`${Math.min(100,Math.max(0,e.percent))}%`}}),e.marks.map(n=>(0,ie.jsx)("span",{"aria-hidden":"true",className:"absolute inset-y-0 w-0.5 bg-card",style:{left:`calc(${n}% - 1px)`}},n))]}),(0,ie.jsx)("p",{className:te("mt-2 truncate text-[12px] leading-4 phone:mt-1.5",e.tone==="neutral"?"text-muted-foreground":TE[e.tone]),children:e.detail})]}),a="block min-w-0 rounded-[10px] border border-border bg-card px-3.5 py-3 phone:w-[152px] phone:px-3 phone:py-2.5 phone:shrink-0 phone:snap-start";return(0,ie.jsx)("li",{"data-limit":e.key,title:e.title??void 0,className:"min-w-0 phone:shrink-0",children:e.href===null?(0,ie.jsx)("div",{className:a,children:t}):(0,ie.jsx)("a",{href:e.href,className:te(a,"transition-colors hover:border-input hover:bg-[var(--so-raised)]"),children:t})})}function RE({limits:e,id:t,className:a}){return(0,ie.jsx)("section",{"aria-label":"Usage",id:t,className:a,children:(0,ie.jsx)("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(176px,1fr))] gap-2 phone:-mx-4 phone:flex phone:snap-x phone:snap-mandatory phone:scroll-px-4 phone:overflow-x-auto phone:px-4 phone:pb-1 phone:[scrollbar-width:none]",children:e.tiles.map(n=>(0,ie.jsx)(YV,{tile:n},n.key))})})}function KV(e){let t=new Set;return e.tiles.map(a=>{let n=t.has(a.name)?a.window:a.name;return t.add(a.name),{key:a.key,text:`${n} ${Math.round(Math.max(0,a.percent))}%`,tone:a.tone}})}function ZV({row:e,grouped:t}){let a="text-[12px] desk:col-start-1 desk:row-start-1 desk:justify-self-start phone:col-start-1 phone:row-start-2 phone:self-center";return e.ask===null?(0,ie.jsx)(dl,{label:e.status.label,tone:e.status.tone==="attention"?"neutral":e.status.tone,className:a}):e.chip===null&&t?(0,ie.jsx)("span",{className:te("sr-only",a),"data-headline":e.status.label,children:e.status.label}):(0,ie.jsx)("span",{"data-ask":e.ask,...e.chip===null?{}:{"data-chip":e.chip},"data-headline":e.status.label,title:e.status.label,className:te("inline-flex w-fit shrink-0 items-center whitespace-nowrap rounded-[5px] bg-primary px-1.5 py-px font-semibold leading-[18px] text-primary-foreground",a),children:e.chip===null?e.status.label:(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsxs)("span",{className:"sr-only",children:[e.status.label,": "]}),e.chip]})})}function gw({row:e,grouped:t=!1}){let a=e.ask!==null;return(0,ie.jsxs)("li",{"data-task":e.id,"data-work-status":e.status.token,"data-group":e.group,className:"grid grid-cols-1 gap-y-2 border-b border-border px-2 py-3 transition-colors hover:bg-[var(--so-raised)] desk:col-span-3 desk:grid-cols-subgrid desk:items-center desk:gap-x-4 phone:grid-cols-[auto_minmax(0,1fr)_auto] phone:gap-x-2 phone:gap-y-0.5 phone:py-1.5",children:[(0,ie.jsxs)("div",{className:"min-w-0 desk:col-start-2 desk:row-start-1 phone:contents",children:[(0,ie.jsx)("a",{href:e.href,className:te("block text-[13.5px] leading-snug hover:underline hover:underline-offset-4 phone:col-[1/3] phone:row-start-1 phone:flex phone:min-h-11 phone:items-center",a?"font-semibold":"font-medium"),children:e.title}),(0,ie.jsxs)("p",{className:"mt-0.5 flex flex-wrap items-center gap-x-1.5 text-[12.5px] text-muted-foreground phone:col-[2/4] phone:row-start-2 phone:mt-0 phone:min-w-0 phone:leading-[1.35]",children:[e.project&&(0,ie.jsx)("span",{className:"text-foreground/80",children:e.project}),e.project&&(0,ie.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,ie.jsx)("span",{className:"tabular-nums",children:e.age})]}),e.detail&&(0,ie.jsx)("p",{className:te("mt-1 text-[12.5px] phone:col-span-full phone:leading-[1.35]",e.status.label==="Failed"?"text-destructive":"text-muted-foreground"),...e.status.label==="Failed"?{"data-problem-line":""}:{},children:e.detail}),e.problem&&(0,ie.jsx)("p",{className:"mt-1 text-[12.5px] text-muted-foreground phone:col-span-full phone:leading-[1.35]",children:e.problem}),e.notes.map(n=>(0,ie.jsx)("p",{className:"mt-1 text-[12.5px] text-muted-foreground phone:col-span-full phone:leading-[1.35]",children:n},n))]}),(0,ie.jsxs)("div",{className:"flex items-center gap-3 phone:contents desk:contents",children:[(0,ie.jsx)(ZV,{row:e,grouped:t}),e.action&&(0,ie.jsx)(Z,{asChild:!0,variant:"outline",size:"sm",className:"desk:col-start-3 desk:row-start-1 desk:justify-self-end phone:col-start-3 phone:row-start-1 phone:self-start",children:(0,ie.jsxs)("a",{href:e.action.href,"data-primary-action":!0,children:[e.action.label,(0,ie.jsx)(ks,{})]})})]})]})}function QV({view:e}){let t="desk:grid desk:grid-cols-[auto_minmax(0,1fr)_auto]";if(e.groups===null)return(0,ie.jsx)("ul",{className:te(t,"border-t border-border"),children:e.rows.map(r=>(0,ie.jsx)(gw,{row:r},r.id))});let a=e.groups.map(r=>({...r,rows:e.rows.filter(s=>s.group===r.key)})).filter(r=>r.rows.length>0),n=new Set(a.map(r=>r.key)),o=e.rows.filter(r=>!n.has(r.group));return(0,ie.jsxs)("div",{className:te(t,"flex flex-col gap-5 phone:gap-3.5 desk:gap-0"),children:[a.map((r,s)=>(0,ie.jsxs)("section",{"data-task-group":r.key,"aria-labelledby":`task-group-${r.key}`,className:"desk:contents",children:[(0,ie.jsxs)("h2",{id:`task-group-${r.key}`,className:te("flex items-baseline gap-2 border-b border-border px-2 pb-1.5 text-[13px] font-semibold leading-5 desk:col-span-3",s>0&&"desk:mt-6"),children:[r.label,(0,ie.jsx)("span",{className:"font-mono text-[12px] font-medium tabular-nums text-muted-foreground",children:r.count})]}),(0,ie.jsx)("ul",{className:"desk:contents",children:r.rows.map(i=>(0,ie.jsx)(gw,{row:i,grouped:!0},i.id))})]},r.key)),o.length>0&&(0,ie.jsx)("ul",{className:"desk:contents",children:o.map(r=>(0,ie.jsx)(gw,{row:r},r.id))})]})}function JV({limits:e,open:t,onToggle:a,controls:n}){let o=KV(e);return(0,ie.jsxs)("button",{type:"button","aria-expanded":t,"aria-controls":n,onClick:a,"data-usage-summary":!0,className:"ml-auto inline-flex min-h-8 min-w-0 items-center gap-1.5 rounded-md px-2 text-[12.5px] text-muted-foreground transition-colors hover:bg-[var(--so-raised)] hover:text-foreground phone:hidden",children:[(0,ie.jsx)("span",{className:"sr-only",children:"Usage: "}),(0,ie.jsx)("span",{className:"truncate tabular-nums",children:o.map((r,s)=>(0,ie.jsxs)("span",{children:[s>0&&(0,ie.jsx)("span",{"aria-hidden":"true",children:" · "}),(0,ie.jsx)("span",{className:TE[r.tone],children:r.text})]},r.key))}),(0,ie.jsx)(sa,{"aria-hidden":"true",className:te("size-3.5 shrink-0 motion-safe:transition-transform",t&&"rotate-90")})]})}function eG({label:e,className:t,children:a}){let n=(0,_r.useRef)(null),[o,r]=(0,_r.useState)({before:!1,after:!1});(0,_r.useEffect)(()=>{let i=n.current;if(i===null)return;let l=()=>r(f=>{let u={before:i.scrollLeft>1,after:i.scrollLeft+i.clientWidth<i.scrollWidth-1};return u.before===f.before&&u.after===f.after?f:u});l(),i.addEventListener("scroll",l,{passive:!0});let c=typeof ResizeObserver>"u"?null:new ResizeObserver(l);return c?.observe(i),()=>{i.removeEventListener("scroll",l),c?.disconnect()}},[]);let s=o.before||o.after?`linear-gradient(to right, ${o.before?"transparent, #000 28px":"#000"}, ${o.after?"#000 calc(100% - 40px), transparent":"#000"})`:void 0;return(0,ie.jsx)("nav",{ref:n,"aria-label":e,className:te("[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",t),"data-scrolls":o.before||o.after?o.after?"more":"end":void 0,style:s===void 0?void 0:{maskImage:s,WebkitMaskImage:s},children:a})}function ME({view:e}){let[t,a]=(0,_r.useState)(!1),n=(0,_r.useId)(),o=e.limits!==null&&e.limits.tiles.length>0?e.limits:null;return(0,ie.jsxs)("div",{className:"flex w-full max-w-[960px] flex-col gap-5 phone:gap-3 phone:px-0.5",children:[(0,ie.jsxs)("div",{className:"flex min-w-0 items-baseline gap-x-3 gap-y-1",children:[(0,ie.jsx)("h1",{className:"text-[22px] font-semibold leading-tight tracking-[-0.02em]",children:"Tasks"}),e.needsYou>0&&(0,ie.jsxs)("p",{className:"whitespace-nowrap text-[13px] text-muted-foreground","data-needs-you-count":!0,children:[(0,ie.jsx)("span",{className:"font-semibold tabular-nums text-foreground",children:e.needsYou})," ",e.needsYou===1?"needs":"need"," you"]}),o&&(0,ie.jsx)(JV,{limits:o,open:t,onToggle:()=>a(r=>!r),controls:n}),(0,ie.jsxs)("div",{className:te("flex shrink-0 items-center gap-2 self-center",!o&&"ml-auto","phone:ml-auto"),children:[(0,ie.jsxs)(ic,{children:[(0,ie.jsx)(lc,{asChild:!0,children:(0,ie.jsxs)(Z,{variant:"outline",size:"sm","aria-label":"Work tools",children:[(0,ie.jsx)("span",{className:"phone:hidden",children:"Work tools"}),(0,ie.jsx)(Xo,{className:"phone:hidden"}),(0,ie.jsx)(Yo,{className:"desk:hidden"})]})}),(0,ie.jsx)(uc,{align:"end",children:e.tools.map(r=>(0,ie.jsx)(cc,{asChild:!0,children:(0,ie.jsxs)("a",{href:r.href,children:[WV[r.href],r.label]})},r.href))})]}),(0,ie.jsx)(Z,{asChild:!0,size:"sm",className:"desk:hidden",children:(0,ie.jsxs)("a",{href:e.newTask.href,children:[(0,ie.jsx)(Yt,{}),e.newTask.label]})})]})]}),o&&t&&(0,ie.jsx)(RE,{limits:o,id:n,className:"phone:hidden"}),(0,ie.jsx)("div",{className:"flex min-w-0 items-center",children:(0,ie.jsx)(eG,{label:"Task views",className:"-mx-1 min-w-0 max-w-full overflow-x-auto px-1 phone:-mr-4 phone:max-w-none phone:pr-4",children:(0,ie.jsx)("ul",{className:"inline-flex h-8 items-center gap-0.5 rounded-lg bg-muted p-0.5 phone:h-12",children:e.tabs.map(r=>(0,ie.jsx)("li",{className:"h-full",children:(0,ie.jsxs)("a",{href:r.href,"aria-current":r.active?"page":void 0,className:te("inline-flex h-full items-center gap-1.5 rounded-md px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground",r.active&&"bg-card text-foreground shadow-[var(--so-pill-shadow)]"),children:[r.label,(0,ie.jsx)("span",{className:te("min-w-[18px] rounded-full px-1.5 text-center font-mono text-[12px] leading-[18px] tabular-nums",r.label==="Needs you"&&r.count>0?"bg-attention text-on-attention":"text-muted-foreground"),children:r.count})]})},r.href))})})}),e.empty!==null?(0,ie.jsxs)(Sa,{className:"items-start py-10",children:[(0,ie.jsx)("p",{className:"text-base text-muted-foreground",children:e.empty.text}),e.empty.action&&(0,ie.jsx)(Z,{asChild:!0,variant:"outline",children:(0,ie.jsx)("a",{href:e.empty.action.href,children:e.empty.action.label})})]}):(0,ie.jsx)(QV,{view:e}),(e.pages.first||e.pages.next)&&(0,ie.jsxs)("nav",{"aria-label":"Task pages",className:"flex gap-2",children:[e.pages.first&&(0,ie.jsx)(Z,{asChild:!0,variant:"outline",size:"sm",children:(0,ie.jsx)("a",{href:e.pages.first,children:"First page"})}),e.pages.next&&(0,ie.jsx)(Z,{asChild:!0,variant:"outline",size:"sm",children:(0,ie.jsx)("a",{href:e.pages.next,rel:"next",children:"Next page"})})]}),o&&(0,ie.jsx)(RE,{limits:o,className:"desk:hidden"})]})}var K=j(fe()),Q=j(he());function Dt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let a=0,n;a<e.length;a++)(n=Dt(e[a]))!==""&&(t+=(t&&" ")+n);else for(let a in e)e[a]&&(t+=(t&&" ")+a);return t}var tG={value:()=>{}};function AE(){for(var e=0,t=arguments.length,a={},n;e<t;++e){if(!(n=arguments[e]+"")||n in a||/[\s.]/.test(n))throw new Error("illegal type: "+n);a[n]=[]}return new Yg(a)}function Yg(e){this._=e}function aG(e,t){return e.trim().split(/^|\s+/).map(function(a){var n="",o=a.indexOf(".");if(o>=0&&(n=a.slice(o+1),a=a.slice(0,o)),a&&!t.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:n}})}Yg.prototype=AE.prototype={constructor:Yg,on:function(e,t){var a=this._,n=aG(e+"",a),o,r=-1,s=n.length;if(arguments.length<2){for(;++r<s;)if((o=(e=n[r]).type)&&(o=nG(a[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<s;)if(o=(e=n[r]).type)a[o]=EE(a[o],e.name,t);else if(t==null)for(o in a)a[o]=EE(a[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var a in t)e[a]=t[a].slice();return new Yg(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var a=new Array(o),n=0,o,r;n<o;++n)a[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],n=0,o=r.length;n<o;++n)r[n].value.apply(t,a)},apply:function(e,t,a){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],o=0,r=n.length;o<r;++o)n[o].value.apply(t,a)}};function nG(e,t){for(var a=0,n=e.length,o;a<n;++a)if((o=e[a]).name===t)return o.value}function EE(e,t,a){for(var n=0,o=e.length;n<o;++n)if(e[n].name===t){e[n]=tG,e=e.slice(0,n).concat(e.slice(n+1));break}return a!=null&&e.push({name:t,value:a}),e}var fl=AE;var Kg="http://www.w3.org/1999/xhtml",xw={svg:"http://www.w3.org/2000/svg",xhtml:Kg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Pr(e){var t=e+="",a=t.indexOf(":");return a>=0&&(t=e.slice(0,a))!=="xmlns"&&(e=e.slice(a+1)),xw.hasOwnProperty(t)?{space:xw[t],local:e}:e}function oG(e){return function(){var t=this.ownerDocument,a=this.namespaceURI;return a===Kg&&t.documentElement.namespaceURI===Kg?t.createElement(e):t.createElementNS(a,e)}}function rG(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Zg(e){var t=Pr(e);return(t.local?rG:oG)(t)}function sG(){}function pl(e){return e==null?sG:function(){return this.querySelector(e)}}function DE(e){typeof e!="function"&&(e=pl(e));for(var t=this._groups,a=t.length,n=new Array(a),o=0;o<a;++o)for(var r=t[o],s=r.length,i=n[o]=new Array(s),l,c,f=0;f<s;++f)(l=r[f])&&(c=e.call(l,l.__data__,f,r))&&("__data__"in l&&(c.__data__=l.__data__),i[f]=c);return new _t(n,this._parents)}function vw(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function iG(){return[]}function np(e){return e==null?iG:function(){return this.querySelectorAll(e)}}function lG(e){return function(){return vw(e.apply(this,arguments))}}function _E(e){typeof e=="function"?e=lG(e):e=np(e);for(var t=this._groups,a=t.length,n=[],o=[],r=0;r<a;++r)for(var s=t[r],i=s.length,l,c=0;c<i;++c)(l=s[c])&&(n.push(e.call(l,l.__data__,c,s)),o.push(l));return new _t(n,o)}function op(e){return function(){return this.matches(e)}}function Qg(e){return function(t){return t.matches(e)}}var uG=Array.prototype.find;function cG(e){return function(){return uG.call(this.children,e)}}function dG(){return this.firstElementChild}function PE(e){return this.select(e==null?dG:cG(typeof e=="function"?e:Qg(e)))}var fG=Array.prototype.filter;function pG(){return Array.from(this.children)}function mG(e){return function(){return fG.call(this.children,e)}}function OE(e){return this.selectAll(e==null?pG:mG(typeof e=="function"?e:Qg(e)))}function zE(e){typeof e!="function"&&(e=op(e));for(var t=this._groups,a=t.length,n=new Array(a),o=0;o<a;++o)for(var r=t[o],s=r.length,i=n[o]=[],l,c=0;c<s;++c)(l=r[c])&&e.call(l,l.__data__,c,r)&&i.push(l);return new _t(n,this._parents)}function Jg(e){return new Array(e.length)}function BE(){return new _t(this._enter||this._groups.map(Jg),this._parents)}function rp(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}rp.prototype={constructor:rp,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function FE(e){return function(){return e}}function hG(e,t,a,n,o,r){for(var s=0,i,l=t.length,c=r.length;s<c;++s)(i=t[s])?(i.__data__=r[s],n[s]=i):a[s]=new rp(e,r[s]);for(;s<l;++s)(i=t[s])&&(o[s]=i)}function gG(e,t,a,n,o,r,s){var i,l,c=new Map,f=t.length,u=r.length,d=new Array(f),m;for(i=0;i<f;++i)(l=t[i])&&(d[i]=m=s.call(l,l.__data__,i,t)+"",c.has(m)?o[i]=l:c.set(m,l));for(i=0;i<u;++i)m=s.call(e,r[i],i,r)+"",(l=c.get(m))?(n[i]=l,l.__data__=r[i],c.delete(m)):a[i]=new rp(e,r[i]);for(i=0;i<f;++i)(l=t[i])&&c.get(d[i])===l&&(o[i]=l)}function xG(e){return e.__data__}function HE(e,t){if(!arguments.length)return Array.from(this,xG);var a=t?gG:hG,n=this._parents,o=this._groups;typeof e!="function"&&(e=FE(e));for(var r=o.length,s=new Array(r),i=new Array(r),l=new Array(r),c=0;c<r;++c){var f=n[c],u=o[c],d=u.length,m=vG(e.call(f,f&&f.__data__,c,n)),g=m.length,b=i[c]=new Array(g),v=s[c]=new Array(g),x=l[c]=new Array(d);a(f,u,b,v,x,m,t);for(var y=0,h=0,w,S;y<g;++y)if(w=b[y]){for(y>=h&&(h=y+1);!(S=v[h])&&++h<g;);w._next=S||null}}return s=new _t(s,n),s._enter=i,s._exit=l,s}function vG(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qE(){return new _t(this._exit||this._groups.map(Jg),this._parents)}function UE(e,t,a){var n=this.enter(),o=this,r=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),a==null?r.remove():a(r),n&&o?n.merge(o).order():o}function VE(e){for(var t=e.selection?e.selection():e,a=this._groups,n=t._groups,o=a.length,r=n.length,s=Math.min(o,r),i=new Array(o),l=0;l<s;++l)for(var c=a[l],f=n[l],u=c.length,d=i[l]=new Array(u),m,g=0;g<u;++g)(m=c[g]||f[g])&&(d[g]=m);for(;l<o;++l)i[l]=a[l];return new _t(i,this._parents)}function GE(){for(var e=this._groups,t=-1,a=e.length;++t<a;)for(var n=e[t],o=n.length-1,r=n[o],s;--o>=0;)(s=n[o])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function $E(e){e||(e=yG);function t(u,d){return u&&d?e(u.__data__,d.__data__):!u-!d}for(var a=this._groups,n=a.length,o=new Array(n),r=0;r<n;++r){for(var s=a[r],i=s.length,l=o[r]=new Array(i),c,f=0;f<i;++f)(c=s[f])&&(l[f]=c);l.sort(t)}return new _t(o,this._parents).order()}function yG(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jE(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function WE(){return Array.from(this)}function XE(){for(var e=this._groups,t=0,a=e.length;t<a;++t)for(var n=e[t],o=0,r=n.length;o<r;++o){var s=n[o];if(s)return s}return null}function YE(){let e=0;for(let t of this)++e;return e}function KE(){return!this.node()}function ZE(e){for(var t=this._groups,a=0,n=t.length;a<n;++a)for(var o=t[a],r=0,s=o.length,i;r<s;++r)(i=o[r])&&e.call(i,i.__data__,r,o);return this}function bG(e){return function(){this.removeAttribute(e)}}function wG(e){return function(){this.removeAttributeNS(e.space,e.local)}}function SG(e,t){return function(){this.setAttribute(e,t)}}function CG(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function kG(e,t){return function(){var a=t.apply(this,arguments);a==null?this.removeAttribute(e):this.setAttribute(e,a)}}function LG(e,t){return function(){var a=t.apply(this,arguments);a==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,a)}}function QE(e,t){var a=Pr(e);if(arguments.length<2){var n=this.node();return a.local?n.getAttributeNS(a.space,a.local):n.getAttribute(a)}return this.each((t==null?a.local?wG:bG:typeof t=="function"?a.local?LG:kG:a.local?CG:SG)(a,t))}function ex(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function IG(e){return function(){this.style.removeProperty(e)}}function NG(e,t,a){return function(){this.style.setProperty(e,t,a)}}function RG(e,t,a){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,a)}}function JE(e,t,a){return arguments.length>1?this.each((t==null?IG:typeof t=="function"?RG:NG)(e,t,a??"")):$s(this.node(),e)}function $s(e,t){return e.style.getPropertyValue(t)||ex(e).getComputedStyle(e,null).getPropertyValue(t)}function TG(e){return function(){delete this[e]}}function MG(e,t){return function(){this[e]=t}}function EG(e,t){return function(){var a=t.apply(this,arguments);a==null?delete this[e]:this[e]=a}}function eA(e,t){return arguments.length>1?this.each((t==null?TG:typeof t=="function"?EG:MG)(e,t)):this.node()[e]}function tA(e){return e.trim().split(/^|\s+/)}function yw(e){return e.classList||new aA(e)}function aA(e){this._node=e,this._names=tA(e.getAttribute("class")||"")}aA.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function nA(e,t){for(var a=yw(e),n=-1,o=t.length;++n<o;)a.add(t[n])}function oA(e,t){for(var a=yw(e),n=-1,o=t.length;++n<o;)a.remove(t[n])}function AG(e){return function(){nA(this,e)}}function DG(e){return function(){oA(this,e)}}function _G(e,t){return function(){(t.apply(this,arguments)?nA:oA)(this,e)}}function rA(e,t){var a=tA(e+"");if(arguments.length<2){for(var n=yw(this.node()),o=-1,r=a.length;++o<r;)if(!n.contains(a[o]))return!1;return!0}return this.each((typeof t=="function"?_G:t?AG:DG)(a,t))}function PG(){this.textContent=""}function OG(e){return function(){this.textContent=e}}function zG(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function sA(e){return arguments.length?this.each(e==null?PG:(typeof e=="function"?zG:OG)(e)):this.node().textContent}function BG(){this.innerHTML=""}function FG(e){return function(){this.innerHTML=e}}function HG(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function iA(e){return arguments.length?this.each(e==null?BG:(typeof e=="function"?HG:FG)(e)):this.node().innerHTML}function qG(){this.nextSibling&&this.parentNode.appendChild(this)}function lA(){return this.each(qG)}function UG(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function uA(){return this.each(UG)}function cA(e){var t=typeof e=="function"?e:Zg(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function VG(){return null}function dA(e,t){var a=typeof e=="function"?e:Zg(e),n=t==null?VG:typeof t=="function"?t:pl(t);return this.select(function(){return this.insertBefore(a.apply(this,arguments),n.apply(this,arguments)||null)})}function GG(){var e=this.parentNode;e&&e.removeChild(this)}function fA(){return this.each(GG)}function $G(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function jG(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pA(e){return this.select(e?jG:$G)}function mA(e){return arguments.length?this.property("__data__",e):this.node().__data__}function WG(e){return function(t){e.call(this,t,this.__data__)}}function XG(e){return e.trim().split(/^|\s+/).map(function(t){var a="",n=t.indexOf(".");return n>=0&&(a=t.slice(n+1),t=t.slice(0,n)),{type:t,name:a}})}function YG(e){return function(){var t=this.__on;if(t){for(var a=0,n=-1,o=t.length,r;a<o;++a)r=t[a],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++n]=r;++n?t.length=n:delete this.__on}}}function KG(e,t,a){return function(){var n=this.__on,o,r=WG(t);if(n){for(var s=0,i=n.length;s<i;++s)if((o=n[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=r,o.options=a),o.value=t;return}}this.addEventListener(e.type,r,a),o={type:e.type,name:e.name,value:t,listener:r,options:a},n?n.push(o):this.__on=[o]}}function hA(e,t,a){var n=XG(e+""),o,r=n.length,s;if(arguments.length<2){var i=this.node().__on;if(i){for(var l=0,c=i.length,f;l<c;++l)for(o=0,f=i[l];o<r;++o)if((s=n[o]).type===f.type&&s.name===f.name)return f.value}return}for(i=t?KG:YG,o=0;o<r;++o)this.each(i(n[o],t,a));return this}function gA(e,t,a){var n=ex(e),o=n.CustomEvent;typeof o=="function"?o=new o(t,a):(o=n.document.createEvent("Event"),a?(o.initEvent(t,a.bubbles,a.cancelable),o.detail=a.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function ZG(e,t){return function(){return gA(this,e,t)}}function QG(e,t){return function(){return gA(this,e,t.apply(this,arguments))}}function xA(e,t){return this.each((typeof t=="function"?QG:ZG)(e,t))}function*vA(){for(var e=this._groups,t=0,a=e.length;t<a;++t)for(var n=e[t],o=0,r=n.length,s;o<r;++o)(s=n[o])&&(yield s)}var bw=[null];function _t(e,t){this._groups=e,this._parents=t}function yA(){return new _t([[document.documentElement]],bw)}function JG(){return this}_t.prototype=yA.prototype={constructor:_t,select:DE,selectAll:_E,selectChild:PE,selectChildren:OE,filter:zE,data:HE,enter:BE,exit:qE,join:UE,merge:VE,selection:JG,order:GE,sort:$E,call:jE,nodes:WE,node:XE,size:YE,empty:KE,each:ZE,attr:QE,style:JE,property:eA,classed:rA,text:sA,html:iA,raise:lA,lower:uA,append:cA,insert:dA,remove:fA,clone:pA,datum:mA,on:hA,dispatch:xA,[Symbol.iterator]:vA};var Or=yA;function ua(e){return typeof e=="string"?new _t([[document.querySelector(e)]],[document.documentElement]):new _t([[e]],bw)}function bA(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ka(e,t){if(e=bA(e),t===void 0&&(t=e.currentTarget),t){var a=t.ownerSVGElement||t;if(a.createSVGPoint){var n=a.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}var wA={passive:!1},ml={capture:!0,passive:!1};function tx(e){e.stopImmediatePropagation()}function js(e){e.preventDefault(),e.stopImmediatePropagation()}function sp(e){var t=e.document.documentElement,a=ua(e).on("dragstart.drag",js,ml);"onselectstart"in t?a.on("selectstart.drag",js,ml):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ip(e,t){var a=e.document.documentElement,n=ua(e).on("dragstart.drag",null);t&&(n.on("click.drag",js,ml),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in a?n.on("selectstart.drag",null):(a.style.MozUserSelect=a.__noselect,delete a.__noselect)}var lp=e=>()=>e;function up(e,{sourceEvent:t,subject:a,target:n,identifier:o,active:r,x:s,y:i,dx:l,dy:c,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:a,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:i,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:f}})}up.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function e$(e){return!e.ctrlKey&&!e.button}function t$(){return this.parentNode}function a$(e,t){return t??{x:e.x,y:e.y}}function n$(){return navigator.maxTouchPoints||"ontouchstart"in this}function ax(){var e=e$,t=t$,a=a$,n=n$,o={},r=fl("start","drag","end"),s=0,i,l,c,f,u=0;function d(w){w.on("mousedown.drag",m).filter(n).on("touchstart.drag",v).on("touchmove.drag",x,wA).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(w,S){if(!(f||!e.call(this,w,S))){var C=h(this,t.call(this,w,S),w,S,"mouse");C&&(ua(w.view).on("mousemove.drag",g,ml).on("mouseup.drag",b,ml),sp(w.view),tx(w),c=!1,i=w.clientX,l=w.clientY,C("start",w))}}function g(w){if(js(w),!c){var S=w.clientX-i,C=w.clientY-l;c=S*S+C*C>u}o.mouse("drag",w)}function b(w){ua(w.view).on("mousemove.drag mouseup.drag",null),ip(w.view,c),js(w),o.mouse("end",w)}function v(w,S){if(e.call(this,w,S)){var C=w.changedTouches,I=t.call(this,w,S),L=C.length,T,A;for(T=0;T<L;++T)(A=h(this,I,w,S,C[T].identifier,C[T]))&&(tx(w),A("start",w,C[T]))}}function x(w){var S=w.changedTouches,C=S.length,I,L;for(I=0;I<C;++I)(L=o[S[I].identifier])&&(js(w),L("drag",w,S[I]))}function y(w){var S=w.changedTouches,C=S.length,I,L;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),I=0;I<C;++I)(L=o[S[I].identifier])&&(tx(w),L("end",w,S[I]))}function h(w,S,C,I,L,T){var A=r.copy(),D=Ka(T||C,S),H,V,N;if((N=a.call(w,new up("beforestart",{sourceEvent:C,target:d,identifier:L,active:s,x:D[0],y:D[1],dx:0,dy:0,dispatch:A}),I))!=null)return H=N.x-D[0]||0,V=N.y-D[1]||0,function P(E,_,z){var q=D,O;switch(E){case"start":o[L]=P,O=s++;break;case"end":delete o[L],--s;case"drag":D=Ka(z||_,S),O=s;break}A.call(E,w,new up(E,{sourceEvent:_,subject:N,target:d,identifier:L,active:O,x:D[0]+H,y:D[1]+V,dx:D[0]-q[0],dy:D[1]-q[1],dispatch:A}),I)}}return d.filter=function(w){return arguments.length?(e=typeof w=="function"?w:lp(!!w),d):e},d.container=function(w){return arguments.length?(t=typeof w=="function"?w:lp(w),d):t},d.subject=function(w){return arguments.length?(a=typeof w=="function"?w:lp(w),d):a},d.touchable=function(w){return arguments.length?(n=typeof w=="function"?w:lp(!!w),d):n},d.on=function(){var w=r.on.apply(r,arguments);return w===r?d:w},d.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,d):Math.sqrt(u)},d}function nx(e,t,a){e.prototype=t.prototype=a,a.constructor=e}function ww(e,t){var a=Object.create(e.prototype);for(var n in t)a[n]=t[n];return a}function fp(){}var cp=.7,sx=1/cp,vc="\\s*([+-]?\\d+)\\s*",dp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",or="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",o$=/^#([0-9a-f]{3,8})$/,r$=new RegExp(`^rgb\\(${vc},${vc},${vc}\\)$`),s$=new RegExp(`^rgb\\(${or},${or},${or}\\)$`),i$=new RegExp(`^rgba\\(${vc},${vc},${vc},${dp}\\)$`),l$=new RegExp(`^rgba\\(${or},${or},${or},${dp}\\)$`),u$=new RegExp(`^hsl\\(${dp},${or},${or}\\)$`),c$=new RegExp(`^hsla\\(${dp},${or},${or},${dp}\\)$`),SA={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};nx(fp,Ro,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:CA,formatHex:CA,formatHex8:d$,formatHsl:f$,formatRgb:kA,toString:kA});function CA(){return this.rgb().formatHex()}function d$(){return this.rgb().formatHex8()}function f$(){return MA(this).formatHsl()}function kA(){return this.rgb().formatRgb()}function Ro(e){var t,a;return e=(e+"").trim().toLowerCase(),(t=o$.exec(e))?(a=t[1].length,t=parseInt(t[1],16),a===6?LA(t):a===3?new yn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):a===8?ox(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):a===4?ox(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=r$.exec(e))?new yn(t[1],t[2],t[3],1):(t=s$.exec(e))?new yn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=i$.exec(e))?ox(t[1],t[2],t[3],t[4]):(t=l$.exec(e))?ox(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=u$.exec(e))?RA(t[1],t[2]/100,t[3]/100,1):(t=c$.exec(e))?RA(t[1],t[2]/100,t[3]/100,t[4]):SA.hasOwnProperty(e)?LA(SA[e]):e==="transparent"?new yn(NaN,NaN,NaN,0):null}function LA(e){return new yn(e>>16&255,e>>8&255,e&255,1)}function ox(e,t,a,n){return n<=0&&(e=t=a=NaN),new yn(e,t,a,n)}function p$(e){return e instanceof fp||(e=Ro(e)),e?(e=e.rgb(),new yn(e.r,e.g,e.b,e.opacity)):new yn}function yc(e,t,a,n){return arguments.length===1?p$(e):new yn(e,t,a,n??1)}function yn(e,t,a,n){this.r=+e,this.g=+t,this.b=+a,this.opacity=+n}nx(yn,yc,ww(fp,{brighter(e){return e=e==null?sx:Math.pow(sx,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?cp:Math.pow(cp,e),new yn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new yn(gl(this.r),gl(this.g),gl(this.b),ix(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:IA,formatHex:IA,formatHex8:m$,formatRgb:NA,toString:NA}));function IA(){return`#${hl(this.r)}${hl(this.g)}${hl(this.b)}`}function m$(){return`#${hl(this.r)}${hl(this.g)}${hl(this.b)}${hl((isNaN(this.opacity)?1:this.opacity)*255)}`}function NA(){let e=ix(this.opacity);return`${e===1?"rgb(":"rgba("}${gl(this.r)}, ${gl(this.g)}, ${gl(this.b)}${e===1?")":`, ${e})`}`}function ix(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function hl(e){return e=gl(e),(e<16?"0":"")+e.toString(16)}function RA(e,t,a,n){return n<=0?e=t=a=NaN:a<=0||a>=1?e=t=NaN:t<=0&&(e=NaN),new No(e,t,a,n)}function MA(e){if(e instanceof No)return new No(e.h,e.s,e.l,e.opacity);if(e instanceof fp||(e=Ro(e)),!e)return new No;if(e instanceof No)return e;e=e.rgb();var t=e.r/255,a=e.g/255,n=e.b/255,o=Math.min(t,a,n),r=Math.max(t,a,n),s=NaN,i=r-o,l=(r+o)/2;return i?(t===r?s=(a-n)/i+(a<n)*6:a===r?s=(n-t)/i+2:s=(t-a)/i+4,i/=l<.5?r+o:2-r-o,s*=60):i=l>0&&l<1?0:s,new No(s,i,l,e.opacity)}function EA(e,t,a,n){return arguments.length===1?MA(e):new No(e,t,a,n??1)}function No(e,t,a,n){this.h=+e,this.s=+t,this.l=+a,this.opacity=+n}nx(No,EA,ww(fp,{brighter(e){return e=e==null?sx:Math.pow(sx,e),new No(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?cp:Math.pow(cp,e),new No(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,a=this.l,n=a+(a<.5?a:1-a)*t,o=2*a-n;return new yn(Sw(e>=240?e-240:e+120,o,n),Sw(e,o,n),Sw(e<120?e+240:e-120,o,n),this.opacity)},clamp(){return new No(TA(this.h),rx(this.s),rx(this.l),ix(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=ix(this.opacity);return`${e===1?"hsl(":"hsla("}${TA(this.h)}, ${rx(this.s)*100}%, ${rx(this.l)*100}%${e===1?")":`, ${e})`}`}}));function TA(e){return e=(e||0)%360,e<0?e+360:e}function rx(e){return Math.max(0,Math.min(1,e||0))}function Sw(e,t,a){return(e<60?t+(a-t)*e/60:e<180?a:e<240?t+(a-t)*(240-e)/60:t)*255}function Cw(e,t,a,n,o){var r=e*e,s=r*e;return((1-3*e+3*r-s)*t+(4-6*r+3*s)*a+(1+3*e+3*r-3*s)*n+s*o)/6}function AA(e){var t=e.length-1;return function(a){var n=a<=0?a=0:a>=1?(a=1,t-1):Math.floor(a*t),o=e[n],r=e[n+1],s=n>0?e[n-1]:2*o-r,i=n<t-1?e[n+2]:2*r-o;return Cw((a-n/t)*t,s,o,r,i)}}function DA(e){var t=e.length;return function(a){var n=Math.floor(((a%=1)<0?++a:a)*t),o=e[(n+t-1)%t],r=e[n%t],s=e[(n+1)%t],i=e[(n+2)%t];return Cw((a-n/t)*t,o,r,s,i)}}var pp=e=>()=>e;function h$(e,t){return function(a){return e+a*t}}function g$(e,t,a){return e=Math.pow(e,a),t=Math.pow(t,a)-e,a=1/a,function(n){return Math.pow(e+n*t,a)}}function _A(e){return(e=+e)==1?lx:function(t,a){return a-t?g$(t,a,e):pp(isNaN(t)?a:t)}}function lx(e,t){var a=t-e;return a?h$(e,a):pp(isNaN(e)?t:e)}var xl=(function e(t){var a=_A(t);function n(o,r){var s=a((o=yc(o)).r,(r=yc(r)).r),i=a(o.g,r.g),l=a(o.b,r.b),c=lx(o.opacity,r.opacity);return function(f){return o.r=s(f),o.g=i(f),o.b=l(f),o.opacity=c(f),o+""}}return n.gamma=e,n})(1);function PA(e){return function(t){var a=t.length,n=new Array(a),o=new Array(a),r=new Array(a),s,i;for(s=0;s<a;++s)i=yc(t[s]),n[s]=i.r||0,o[s]=i.g||0,r[s]=i.b||0;return n=e(n),o=e(o),r=e(r),i.opacity=1,function(l){return i.r=n(l),i.g=o(l),i.b=r(l),i+""}}}var x$=PA(AA),v$=PA(DA);function OA(e,t){t||(t=[]);var a=e?Math.min(t.length,e.length):0,n=t.slice(),o;return function(r){for(o=0;o<a;++o)n[o]=e[o]*(1-r)+t[o]*r;return n}}function zA(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function BA(e,t){var a=t?t.length:0,n=e?Math.min(a,e.length):0,o=new Array(n),r=new Array(a),s;for(s=0;s<n;++s)o[s]=zr(e[s],t[s]);for(;s<a;++s)r[s]=t[s];return function(i){for(s=0;s<n;++s)r[s]=o[s](i);return r}}function FA(e,t){var a=new Date;return e=+e,t=+t,function(n){return a.setTime(e*(1-n)+t*n),a}}function Za(e,t){return e=+e,t=+t,function(a){return e*(1-a)+t*a}}function HA(e,t){var a={},n={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?a[o]=zr(e[o],t[o]):n[o]=t[o];return function(r){for(o in a)n[o]=a[o](r);return n}}var Lw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kw=new RegExp(Lw.source,"g");function y$(e){return function(){return e}}function b$(e){return function(t){return e(t)+""}}function mp(e,t){var a=Lw.lastIndex=kw.lastIndex=0,n,o,r,s=-1,i=[],l=[];for(e=e+"",t=t+"";(n=Lw.exec(e))&&(o=kw.exec(t));)(r=o.index)>a&&(r=t.slice(a,r),i[s]?i[s]+=r:i[++s]=r),(n=n[0])===(o=o[0])?i[s]?i[s]+=o:i[++s]=o:(i[++s]=null,l.push({i:s,x:Za(n,o)})),a=kw.lastIndex;return a<t.length&&(r=t.slice(a),i[s]?i[s]+=r:i[++s]=r),i.length<2?l[0]?b$(l[0].x):y$(t):(t=l.length,function(c){for(var f=0,u;f<t;++f)i[(u=l[f]).i]=u.x(c);return i.join("")})}function zr(e,t){var a=typeof t,n;return t==null||a==="boolean"?pp(t):(a==="number"?Za:a==="string"?(n=Ro(t))?(t=n,xl):mp:t instanceof Ro?xl:t instanceof Date?FA:zA(t)?OA:Array.isArray(t)?BA:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?HA:Za)(e,t)}var qA=180/Math.PI,ux={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Iw(e,t,a,n,o,r){var s,i,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*a+t*n)&&(a-=e*l,n-=t*l),(i=Math.sqrt(a*a+n*n))&&(a/=i,n/=i,l/=i),e*n<t*a&&(e=-e,t=-t,l=-l,s=-s),{translateX:o,translateY:r,rotate:Math.atan2(t,e)*qA,skewX:Math.atan(l)*qA,scaleX:s,scaleY:i}}var cx;function UA(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ux:Iw(t.a,t.b,t.c,t.d,t.e,t.f)}function VA(e){return e==null?ux:(cx||(cx=document.createElementNS("http://www.w3.org/2000/svg","g")),cx.setAttribute("transform",e),(e=cx.transform.baseVal.consolidate())?(e=e.matrix,Iw(e.a,e.b,e.c,e.d,e.e,e.f)):ux)}function GA(e,t,a,n){function o(c){return c.length?c.pop()+" ":""}function r(c,f,u,d,m,g){if(c!==u||f!==d){var b=m.push("translate(",null,t,null,a);g.push({i:b-4,x:Za(c,u)},{i:b-2,x:Za(f,d)})}else(u||d)&&m.push("translate("+u+t+d+a)}function s(c,f,u,d){c!==f?(c-f>180?f+=360:f-c>180&&(c+=360),d.push({i:u.push(o(u)+"rotate(",null,n)-2,x:Za(c,f)})):f&&u.push(o(u)+"rotate("+f+n)}function i(c,f,u,d){c!==f?d.push({i:u.push(o(u)+"skewX(",null,n)-2,x:Za(c,f)}):f&&u.push(o(u)+"skewX("+f+n)}function l(c,f,u,d,m,g){if(c!==u||f!==d){var b=m.push(o(m)+"scale(",null,",",null,")");g.push({i:b-4,x:Za(c,u)},{i:b-2,x:Za(f,d)})}else(u!==1||d!==1)&&m.push(o(m)+"scale("+u+","+d+")")}return function(c,f){var u=[],d=[];return c=e(c),f=e(f),r(c.translateX,c.translateY,f.translateX,f.translateY,u,d),s(c.rotate,f.rotate,u,d),i(c.skewX,f.skewX,u,d),l(c.scaleX,c.scaleY,f.scaleX,f.scaleY,u,d),c=f=null,function(m){for(var g=-1,b=d.length,v;++g<b;)u[(v=d[g]).i]=v.x(m);return u.join("")}}}var Nw=GA(UA,"px, ","px)","deg)"),Rw=GA(VA,", ",")",")");var w$=1e-12;function $A(e){return((e=Math.exp(e))+1/e)/2}function S$(e){return((e=Math.exp(e))-1/e)/2}function C$(e){return((e=Math.exp(2*e))-1)/(e+1)}var vl=(function e(t,a,n){function o(r,s){var i=r[0],l=r[1],c=r[2],f=s[0],u=s[1],d=s[2],m=f-i,g=u-l,b=m*m+g*g,v,x;if(b<w$)x=Math.log(d/c)/t,v=function(I){return[i+I*m,l+I*g,c*Math.exp(t*I*x)]};else{var y=Math.sqrt(b),h=(d*d-c*c+n*b)/(2*c*a*y),w=(d*d-c*c-n*b)/(2*d*a*y),S=Math.log(Math.sqrt(h*h+1)-h),C=Math.log(Math.sqrt(w*w+1)-w);x=(C-S)/t,v=function(I){var L=I*x,T=$A(S),A=c/(a*y)*(T*C$(t*L+S)-S$(S));return[i+A*m,l+A*g,c*T/$A(t*L+S)]}}return v.duration=x*1e3*t/Math.SQRT2,v}return o.rho=function(r){var s=Math.max(.001,+r),i=s*s,l=i*i;return e(s,i,l)},o})(Math.SQRT2,2,4);var bc=0,gp=0,hp=0,WA=1e3,dx,xp,fx=0,yl=0,px=0,vp=typeof performance=="object"&&performance.now?performance:Date,XA=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bp(){return yl||(XA(k$),yl=vp.now()+px)}function k$(){yl=0}function yp(){this._call=this._time=this._next=null}yp.prototype=mx.prototype={constructor:yp,restart:function(e,t,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?bp():+a)+(t==null?0:+t),!this._next&&xp!==this&&(xp?xp._next=this:dx=this,xp=this),this._call=e,this._time=a,Tw()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tw())}};function mx(e,t,a){var n=new yp;return n.restart(e,t,a),n}function YA(){bp(),++bc;for(var e=dx,t;e;)(t=yl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--bc}function jA(){yl=(fx=vp.now())+px,bc=gp=0;try{YA()}finally{bc=0,I$(),yl=0}}function L$(){var e=vp.now(),t=e-fx;t>WA&&(px-=t,fx=e)}function I$(){for(var e,t=dx,a,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(a=t._next,t._next=null,t=e?e._next=a:dx=a);xp=e,Tw(n)}function Tw(e){if(!bc){gp&&(gp=clearTimeout(gp));var t=e-yl;t>24?(e<1/0&&(gp=setTimeout(jA,e-vp.now()-px)),hp&&(hp=clearInterval(hp))):(hp||(fx=vp.now(),hp=setInterval(L$,WA)),bc=1,XA(jA))}}function hx(e,t,a){var n=new yp;return t=t==null?0:+t,n.restart(o=>{n.stop(),e(o+t)},t,a),n}var N$=fl("start","end","cancel","interrupt"),R$=[],QA=0,KA=1,xx=2,gx=3,ZA=4,vx=5,wp=6;function Ws(e,t,a,n,o,r){var s=e.__transition;if(!s)e.__transition={};else if(a in s)return;T$(e,a,{name:t,index:n,group:o,on:N$,tween:R$,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:QA})}function Sp(e,t){var a=Qt(e,t);if(a.state>QA)throw new Error("too late; already scheduled");return a}function La(e,t){var a=Qt(e,t);if(a.state>gx)throw new Error("too late; already running");return a}function Qt(e,t){var a=e.__transition;if(!a||!(a=a[t]))throw new Error("transition not found");return a}function T$(e,t,a){var n=e.__transition,o;n[t]=a,a.timer=mx(r,0,a.time);function r(c){a.state=KA,a.timer.restart(s,a.delay,a.time),a.delay<=c&&s(c-a.delay)}function s(c){var f,u,d,m;if(a.state!==KA)return l();for(f in n)if(m=n[f],m.name===a.name){if(m.state===gx)return hx(s);m.state===ZA?(m.state=wp,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete n[f]):+f<t&&(m.state=wp,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete n[f])}if(hx(function(){a.state===gx&&(a.state=ZA,a.timer.restart(i,a.delay,a.time),i(c))}),a.state=xx,a.on.call("start",e,e.__data__,a.index,a.group),a.state===xx){for(a.state=gx,o=new Array(d=a.tween.length),f=0,u=-1;f<d;++f)(m=a.tween[f].value.call(e,e.__data__,a.index,a.group))&&(o[++u]=m);o.length=u+1}}function i(c){for(var f=c<a.duration?a.ease.call(null,c/a.duration):(a.timer.restart(l),a.state=vx,1),u=-1,d=o.length;++u<d;)o[u].call(e,f);a.state===vx&&(a.on.call("end",e,e.__data__,a.index,a.group),l())}function l(){a.state=wp,a.timer.stop(),delete n[t];for(var c in n)return;delete e.__transition}}function bl(e,t){var a=e.__transition,n,o,r=!0,s;if(a){t=t==null?null:t+"";for(s in a){if((n=a[s]).name!==t){r=!1;continue}o=n.state>xx&&n.state<vx,n.state=wp,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete a[s]}r&&delete e.__transition}}function JA(e){return this.each(function(){bl(this,e)})}function M$(e,t){var a,n;return function(){var o=La(this,e),r=o.tween;if(r!==a){n=a=r;for(var s=0,i=n.length;s<i;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}o.tween=n}}function E$(e,t,a){var n,o;if(typeof a!="function")throw new Error;return function(){var r=La(this,e),s=r.tween;if(s!==n){o=(n=s).slice();for(var i={name:t,value:a},l=0,c=o.length;l<c;++l)if(o[l].name===t){o[l]=i;break}l===c&&o.push(i)}r.tween=o}}function e6(e,t){var a=this._id;if(e+="",arguments.length<2){for(var n=Qt(this.node(),a).tween,o=0,r=n.length,s;o<r;++o)if((s=n[o]).name===e)return s.value;return null}return this.each((t==null?M$:E$)(a,e,t))}function wc(e,t,a){var n=e._id;return e.each(function(){var o=La(this,n);(o.value||(o.value={}))[t]=a.apply(this,arguments)}),function(o){return Qt(o,n).value[t]}}function yx(e,t){var a;return(typeof t=="number"?Za:t instanceof Ro?xl:(a=Ro(t))?(t=a,xl):mp)(e,t)}function A$(e){return function(){this.removeAttribute(e)}}function D$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _$(e,t,a){var n,o=a+"",r;return function(){var s=this.getAttribute(e);return s===o?null:s===n?r:r=t(n=s,a)}}function P$(e,t,a){var n,o=a+"",r;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===n?r:r=t(n=s,a)}}function O$(e,t,a){var n,o,r;return function(){var s,i=a(this),l;return i==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=i+"",s===l?null:s===n&&l===o?r:(o=l,r=t(n=s,i)))}}function z$(e,t,a){var n,o,r;return function(){var s,i=a(this),l;return i==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=i+"",s===l?null:s===n&&l===o?r:(o=l,r=t(n=s,i)))}}function t6(e,t){var a=Pr(e),n=a==="transform"?Rw:yx;return this.attrTween(e,typeof t=="function"?(a.local?z$:O$)(a,n,wc(this,"attr."+e,t)):t==null?(a.local?D$:A$)(a):(a.local?P$:_$)(a,n,t))}function B$(e,t){return function(a){this.setAttribute(e,t.call(this,a))}}function F$(e,t){return function(a){this.setAttributeNS(e.space,e.local,t.call(this,a))}}function H$(e,t){var a,n;function o(){var r=t.apply(this,arguments);return r!==n&&(a=(n=r)&&F$(e,r)),a}return o._value=t,o}function q$(e,t){var a,n;function o(){var r=t.apply(this,arguments);return r!==n&&(a=(n=r)&&B$(e,r)),a}return o._value=t,o}function a6(e,t){var a="attr."+e;if(arguments.length<2)return(a=this.tween(a))&&a._value;if(t==null)return this.tween(a,null);if(typeof t!="function")throw new Error;var n=Pr(e);return this.tween(a,(n.local?H$:q$)(n,t))}function U$(e,t){return function(){Sp(this,e).delay=+t.apply(this,arguments)}}function V$(e,t){return t=+t,function(){Sp(this,e).delay=t}}function n6(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?U$:V$)(t,e)):Qt(this.node(),t).delay}function G$(e,t){return function(){La(this,e).duration=+t.apply(this,arguments)}}function $$(e,t){return t=+t,function(){La(this,e).duration=t}}function o6(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?G$:$$)(t,e)):Qt(this.node(),t).duration}function j$(e,t){if(typeof t!="function")throw new Error;return function(){La(this,e).ease=t}}function r6(e){var t=this._id;return arguments.length?this.each(j$(t,e)):Qt(this.node(),t).ease}function W$(e,t){return function(){var a=t.apply(this,arguments);if(typeof a!="function")throw new Error;La(this,e).ease=a}}function s6(e){if(typeof e!="function")throw new Error;return this.each(W$(this._id,e))}function i6(e){typeof e!="function"&&(e=op(e));for(var t=this._groups,a=t.length,n=new Array(a),o=0;o<a;++o)for(var r=t[o],s=r.length,i=n[o]=[],l,c=0;c<s;++c)(l=r[c])&&e.call(l,l.__data__,c,r)&&i.push(l);return new Qa(n,this._parents,this._name,this._id)}function l6(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,a=e._groups,n=t.length,o=a.length,r=Math.min(n,o),s=new Array(n),i=0;i<r;++i)for(var l=t[i],c=a[i],f=l.length,u=s[i]=new Array(f),d,m=0;m<f;++m)(d=l[m]||c[m])&&(u[m]=d);for(;i<n;++i)s[i]=t[i];return new Qa(s,this._parents,this._name,this._id)}function X$(e){return(e+"").trim().split(/^|\s+/).every(function(t){var a=t.indexOf(".");return a>=0&&(t=t.slice(0,a)),!t||t==="start"})}function Y$(e,t,a){var n,o,r=X$(t)?Sp:La;return function(){var s=r(this,e),i=s.on;i!==n&&(o=(n=i).copy()).on(t,a),s.on=o}}function u6(e,t){var a=this._id;return arguments.length<2?Qt(this.node(),a).on.on(e):this.each(Y$(a,e,t))}function K$(e){return function(){var t=this.parentNode;for(var a in this.__transition)if(+a!==e)return;t&&t.removeChild(this)}}function c6(){return this.on("end.remove",K$(this._id))}function d6(e){var t=this._name,a=this._id;typeof e!="function"&&(e=pl(e));for(var n=this._groups,o=n.length,r=new Array(o),s=0;s<o;++s)for(var i=n[s],l=i.length,c=r[s]=new Array(l),f,u,d=0;d<l;++d)(f=i[d])&&(u=e.call(f,f.__data__,d,i))&&("__data__"in f&&(u.__data__=f.__data__),c[d]=u,Ws(c[d],t,a,d,c,Qt(f,a)));return new Qa(r,this._parents,t,a)}function f6(e){var t=this._name,a=this._id;typeof e!="function"&&(e=np(e));for(var n=this._groups,o=n.length,r=[],s=[],i=0;i<o;++i)for(var l=n[i],c=l.length,f,u=0;u<c;++u)if(f=l[u]){for(var d=e.call(f,f.__data__,u,l),m,g=Qt(f,a),b=0,v=d.length;b<v;++b)(m=d[b])&&Ws(m,t,a,b,d,g);r.push(d),s.push(f)}return new Qa(r,s,t,a)}var Z$=Or.prototype.constructor;function p6(){return new Z$(this._groups,this._parents)}function Q$(e,t){var a,n,o;return function(){var r=$s(this,e),s=(this.style.removeProperty(e),$s(this,e));return r===s?null:r===a&&s===n?o:o=t(a=r,n=s)}}function m6(e){return function(){this.style.removeProperty(e)}}function J$(e,t,a){var n,o=a+"",r;return function(){var s=$s(this,e);return s===o?null:s===n?r:r=t(n=s,a)}}function ej(e,t,a){var n,o,r;return function(){var s=$s(this,e),i=a(this),l=i+"";return i==null&&(l=i=(this.style.removeProperty(e),$s(this,e))),s===l?null:s===n&&l===o?r:(o=l,r=t(n=s,i))}}function tj(e,t){var a,n,o,r="style."+t,s="end."+r,i;return function(){var l=La(this,e),c=l.on,f=l.value[r]==null?i||(i=m6(t)):void 0;(c!==a||o!==f)&&(n=(a=c).copy()).on(s,o=f),l.on=n}}function h6(e,t,a){var n=(e+="")=="transform"?Nw:yx;return t==null?this.styleTween(e,Q$(e,n)).on("end.style."+e,m6(e)):typeof t=="function"?this.styleTween(e,ej(e,n,wc(this,"style."+e,t))).each(tj(this._id,e)):this.styleTween(e,J$(e,n,t),a).on("end.style."+e,null)}function aj(e,t,a){return function(n){this.style.setProperty(e,t.call(this,n),a)}}function nj(e,t,a){var n,o;function r(){var s=t.apply(this,arguments);return s!==o&&(n=(o=s)&&aj(e,s,a)),n}return r._value=t,r}function g6(e,t,a){var n="style."+(e+="");if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;return this.tween(n,nj(e,t,a??""))}function oj(e){return function(){this.textContent=e}}function rj(e){return function(){var t=e(this);this.textContent=t??""}}function x6(e){return this.tween("text",typeof e=="function"?rj(wc(this,"text",e)):oj(e==null?"":e+""))}function sj(e){return function(t){this.textContent=e.call(this,t)}}function ij(e){var t,a;function n(){var o=e.apply(this,arguments);return o!==a&&(t=(a=o)&&sj(o)),t}return n._value=e,n}function v6(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ij(e))}function y6(){for(var e=this._name,t=this._id,a=bx(),n=this._groups,o=n.length,r=0;r<o;++r)for(var s=n[r],i=s.length,l,c=0;c<i;++c)if(l=s[c]){var f=Qt(l,t);Ws(l,e,a,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Qa(n,this._parents,e,a)}function b6(){var e,t,a=this,n=a._id,o=a.size();return new Promise(function(r,s){var i={value:s},l={value:function(){--o===0&&r()}};a.each(function(){var c=La(this,n),f=c.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(i),t._.interrupt.push(i),t._.end.push(l)),c.on=t}),o===0&&r()})}var lj=0;function Qa(e,t,a,n){this._groups=e,this._parents=t,this._name=a,this._id=n}function w6(e){return Or().transition(e)}function bx(){return++lj}var Br=Or.prototype;Qa.prototype=w6.prototype={constructor:Qa,select:d6,selectAll:f6,selectChild:Br.selectChild,selectChildren:Br.selectChildren,filter:i6,merge:l6,selection:p6,transition:y6,call:Br.call,nodes:Br.nodes,node:Br.node,size:Br.size,empty:Br.empty,each:Br.each,on:u6,attr:t6,attrTween:a6,style:h6,styleTween:g6,text:x6,textTween:v6,remove:c6,tween:e6,delay:n6,duration:o6,ease:r6,easeVarying:s6,end:b6,[Symbol.iterator]:Br[Symbol.iterator]};function wx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var uj={time:null,delay:0,duration:250,ease:wx};function cj(e,t){for(var a;!(a=e.__transition)||!(a=a[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return a}function S6(e){var t,a;e instanceof Qa?(t=e._id,e=e._name):(t=bx(),(a=uj).time=bp(),e=e==null?null:e+"");for(var n=this._groups,o=n.length,r=0;r<o;++r)for(var s=n[r],i=s.length,l,c=0;c<i;++c)(l=s[c])&&Ws(l,e,t,c,s,a||cj(l,t));return new Qa(n,this._parents,e,t)}Or.prototype.interrupt=JA;Or.prototype.transition=S6;var Cp=e=>()=>e;function Mw(e,{sourceEvent:t,target:a,transform:n,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:a,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:o}})}function To(e,t,a){this.k=e,this.x=t,this.y=a}To.prototype={constructor:To,scale:function(e){return e===1?this:new To(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new To(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var wl=new To(1,0,0);kp.prototype=To.prototype;function kp(e){for(;!e.__zoom;)if(!(e=e.parentNode))return wl;return e.__zoom}function Sx(e){e.stopImmediatePropagation()}function Sc(e){e.preventDefault(),e.stopImmediatePropagation()}function dj(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fj(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function C6(){return this.__zoom||wl}function pj(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function mj(){return navigator.maxTouchPoints||"ontouchstart"in this}function hj(e,t,a){var n=e.invertX(t[0][0])-a[0][0],o=e.invertX(t[1][0])-a[1][0],r=e.invertY(t[0][1])-a[0][1],s=e.invertY(t[1][1])-a[1][1];return e.translate(o>n?(n+o)/2:Math.min(0,n)||Math.max(0,o),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}function Cx(){var e=dj,t=fj,a=hj,n=pj,o=mj,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],i=250,l=vl,c=fl("start","zoom","end"),f,u,d,m=500,g=150,b=0,v=10;function x(N){N.property("__zoom",C6).on("wheel.zoom",L,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",A).filter(o).on("touchstart.zoom",D).on("touchmove.zoom",H).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(N,P,E,_){var z=N.selection?N.selection():N;z.property("__zoom",C6),N!==z?S(N,P,E,_):z.interrupt().each(function(){C(this,arguments).event(_).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},x.scaleBy=function(N,P,E,_){x.scaleTo(N,function(){var z=this.__zoom.k,q=typeof P=="function"?P.apply(this,arguments):P;return z*q},E,_)},x.scaleTo=function(N,P,E,_){x.transform(N,function(){var z=t.apply(this,arguments),q=this.__zoom,O=E==null?w(z):typeof E=="function"?E.apply(this,arguments):E,W=q.invert(O),ee=typeof P=="function"?P.apply(this,arguments):P;return a(h(y(q,ee),O,W),z,s)},E,_)},x.translateBy=function(N,P,E,_){x.transform(N,function(){return a(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,_)},x.translateTo=function(N,P,E,_,z){x.transform(N,function(){var q=t.apply(this,arguments),O=this.__zoom,W=_==null?w(q):typeof _=="function"?_.apply(this,arguments):_;return a(wl.translate(W[0],W[1]).scale(O.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof E=="function"?-E.apply(this,arguments):-E),q,s)},_,z)};function y(N,P){return P=Math.max(r[0],Math.min(r[1],P)),P===N.k?N:new To(P,N.x,N.y)}function h(N,P,E){var _=P[0]-E[0]*N.k,z=P[1]-E[1]*N.k;return _===N.x&&z===N.y?N:new To(N.k,_,z)}function w(N){return[(+N[0][0]+ +N[1][0])/2,(+N[0][1]+ +N[1][1])/2]}function S(N,P,E,_){N.on("start.zoom",function(){C(this,arguments).event(_).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(_).end()}).tween("zoom",function(){var z=this,q=arguments,O=C(z,q).event(_),W=t.apply(z,q),ee=E==null?w(W):typeof E=="function"?E.apply(z,q):E,de=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),ne=z.__zoom,re=typeof P=="function"?P.apply(z,q):P,ue=l(ne.invert(ee).concat(de/ne.k),re.invert(ee).concat(de/re.k));return function(ce){if(ce===1)ce=re;else{var U=ue(ce),M=de/U[2];ce=new To(M,ee[0]-U[0]*M,ee[1]-U[1]*M)}O.zoom(null,ce)}})}function C(N,P,E){return!E&&N.__zooming||new I(N,P)}function I(N,P){this.that=N,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(N,P),this.taps=0}I.prototype={event:function(N){return N&&(this.sourceEvent=N),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(N,P){return this.mouse&&N!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&N!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&N!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(N){var P=ua(this.that).datum();c.call(N,this.that,new Mw(N,{sourceEvent:this.sourceEvent,target:x,type:N,transform:this.that.__zoom,dispatch:c}),P)}};function L(N,...P){if(!e.apply(this,arguments))return;var E=C(this,P).event(N),_=this.__zoom,z=Math.max(r[0],Math.min(r[1],_.k*Math.pow(2,n.apply(this,arguments)))),q=Ka(N);if(E.wheel)(E.mouse[0][0]!==q[0]||E.mouse[0][1]!==q[1])&&(E.mouse[1]=_.invert(E.mouse[0]=q)),clearTimeout(E.wheel);else{if(_.k===z)return;E.mouse=[q,_.invert(q)],bl(this),E.start()}Sc(N),E.wheel=setTimeout(O,g),E.zoom("mouse",a(h(y(_,z),E.mouse[0],E.mouse[1]),E.extent,s));function O(){E.wheel=null,E.end()}}function T(N,...P){if(d||!e.apply(this,arguments))return;var E=N.currentTarget,_=C(this,P,!0).event(N),z=ua(N.view).on("mousemove.zoom",ee,!0).on("mouseup.zoom",de,!0),q=Ka(N,E),O=N.clientX,W=N.clientY;sp(N.view),Sx(N),_.mouse=[q,this.__zoom.invert(q)],bl(this),_.start();function ee(ne){if(Sc(ne),!_.moved){var re=ne.clientX-O,ue=ne.clientY-W;_.moved=re*re+ue*ue>b}_.event(ne).zoom("mouse",a(h(_.that.__zoom,_.mouse[0]=Ka(ne,E),_.mouse[1]),_.extent,s))}function de(ne){z.on("mousemove.zoom mouseup.zoom",null),ip(ne.view,_.moved),Sc(ne),_.event(ne).end()}}function A(N,...P){if(e.apply(this,arguments)){var E=this.__zoom,_=Ka(N.changedTouches?N.changedTouches[0]:N,this),z=E.invert(_),q=E.k*(N.shiftKey?.5:2),O=a(h(y(E,q),_,z),t.apply(this,P),s);Sc(N),i>0?ua(this).transition().duration(i).call(S,O,_,N):ua(this).call(x.transform,O,_,N)}}function D(N,...P){if(e.apply(this,arguments)){var E=N.touches,_=E.length,z=C(this,P,N.changedTouches.length===_).event(N),q,O,W,ee;for(Sx(N),O=0;O<_;++O)W=E[O],ee=Ka(W,this),ee=[ee,this.__zoom.invert(ee),W.identifier],z.touch0?!z.touch1&&z.touch0[2]!==ee[2]&&(z.touch1=ee,z.taps=0):(z.touch0=ee,q=!0,z.taps=1+!!f);f&&(f=clearTimeout(f)),q&&(z.taps<2&&(u=ee[0],f=setTimeout(function(){f=null},m)),bl(this),z.start())}}function H(N,...P){if(this.__zooming){var E=C(this,P).event(N),_=N.changedTouches,z=_.length,q,O,W,ee;for(Sc(N),q=0;q<z;++q)O=_[q],W=Ka(O,this),E.touch0&&E.touch0[2]===O.identifier?E.touch0[0]=W:E.touch1&&E.touch1[2]===O.identifier&&(E.touch1[0]=W);if(O=E.that.__zoom,E.touch1){var de=E.touch0[0],ne=E.touch0[1],re=E.touch1[0],ue=E.touch1[1],ce=(ce=re[0]-de[0])*ce+(ce=re[1]-de[1])*ce,U=(U=ue[0]-ne[0])*U+(U=ue[1]-ne[1])*U;O=y(O,Math.sqrt(ce/U)),W=[(de[0]+re[0])/2,(de[1]+re[1])/2],ee=[(ne[0]+ue[0])/2,(ne[1]+ue[1])/2]}else if(E.touch0)W=E.touch0[0],ee=E.touch0[1];else return;E.zoom("touch",a(h(O,W,ee),E.extent,s))}}function V(N,...P){if(this.__zooming){var E=C(this,P).event(N),_=N.changedTouches,z=_.length,q,O;for(Sx(N),d&&clearTimeout(d),d=setTimeout(function(){d=null},m),q=0;q<z;++q)O=_[q],E.touch0&&E.touch0[2]===O.identifier?delete E.touch0:E.touch1&&E.touch1[2]===O.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(O=Ka(O,this),Math.hypot(u[0]-O[0],u[1]-O[1])<v)){var W=ua(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return x.wheelDelta=function(N){return arguments.length?(n=typeof N=="function"?N:Cp(+N),x):n},x.filter=function(N){return arguments.length?(e=typeof N=="function"?N:Cp(!!N),x):e},x.touchable=function(N){return arguments.length?(o=typeof N=="function"?N:Cp(!!N),x):o},x.extent=function(N){return arguments.length?(t=typeof N=="function"?N:Cp([[+N[0][0],+N[0][1]],[+N[1][0],+N[1][1]]]),x):t},x.scaleExtent=function(N){return arguments.length?(r[0]=+N[0],r[1]=+N[1],x):[r[0],r[1]]},x.translateExtent=function(N){return arguments.length?(s[0][0]=+N[0][0],s[1][0]=+N[1][0],s[0][1]=+N[0][1],s[1][1]=+N[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(N){return arguments.length?(a=N,x):a},x.duration=function(N){return arguments.length?(i=+N,x):i},x.interpolate=function(N){return arguments.length?(l=N,x):l},x.on=function(){var N=c.on.apply(c,arguments);return N===c?x:N},x.clickDistance=function(N){return arguments.length?(b=(N=+N)*N,x):Math.sqrt(b)},x.tapDistance=function(N){return arguments.length?(v=+N,x):v},x}var On={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:a,targetHandle:n})=>`Couldn't create edge for ${e} handle id: "${e==="source"?a:n}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Lc=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Pw=["Enter"," ","Escape"],Ow={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:a})=>`Moved selected node ${e}. New position, x: ${t}, y: ${a}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"},Zs;(function(e){e.Strict="strict",e.Loose="loose"})(Zs||(Zs={}));var Fr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Fr||(Fr={}));var Sl;(function(e){e.Partial="partial",e.Full="full"})(Sl||(Sl={}));var zw={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},rr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(rr||(rr={}));var so;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(so||(so={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));var k6={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top},Bw=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,z6=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Fw=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e);var Ip=(e,t=[0,0])=>{let{width:a,height:n}=io(e),o=e.origin??t,r=a*o[0],s=n*o[1];return{x:e.position.x-r,y:e.position.y-s}},Hw=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};let a=!1,n=e.reduce((o,r)=>{let s=typeof r=="string",i=!t.nodeLookup&&!s?r:void 0;return t.nodeLookup&&(i=s?t.nodeLookup.get(r):Fw(r)?r:t.nodeLookup.get(r.id)),i?(a=!0,Tx(o,Ix(i,t.nodeOrigin))):o},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return a?Mx(n):{x:0,y:0,width:0,height:0}},Ic=(e,t={})=>{let a={x:1/0,y:1/0,x2:-1/0,y2:-1/0},n=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(a=Tx(a,Ix(o)),n=!0)}),n?Mx(a):{x:0,y:0,width:0,height:0}},Nx=(e,t,[a,n,o]=[0,0,1],r=!1,s=!1)=>{let i=(t.x-a)/o,l=(t.y-n)/o,c=t.width/o,f=t.height/o,u=[];for(let d of e.values()){let{measured:m,selectable:g=!0,hidden:b=!1}=d;if(s&&!g||b)continue;let v=m.width??d.width??d.initialWidth??0,x=m.height??d.height??d.initialHeight??0,{x:y,y:h}=d.internals.positionAbsolute,w=U6(i,l,c,f,y,h,v,x),S=v*x,C=r&&w>0;(!d.internals.handleBounds||C||w>=S||d.dragging)&&u.push(d)}return u},B6=(e,t)=>{let a=new Set;return e.forEach(n=>{a.add(n.id)}),t.filter(n=>a.has(n.source)||a.has(n.target))};function gj(e,t){let a=new Map,n=t?.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{let r;if(t?.includeHiddenNodes){let{width:s,height:i}=io(o);r=s>0&&i>0}else r=!!(o.measured.width&&o.measured.height&&!o.hidden);r&&(!n||n.has(o.id))&&a.set(o.id,o)}),a}async function F6({nodes:e,width:t,height:a,panZoom:n,minZoom:o,maxZoom:r},s){if(e.size===0)return!0;let i=gj(e,s),l=Ic(i),c=Rp(l,t,a,s?.minZoom??o,s?.maxZoom??r,s?.padding??.1);return await n.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function qw({nodeId:e,nextPosition:t,nodeLookup:a,nodeOrigin:n=[0,0],nodeExtent:o,onError:r}){let s=a.get(e),i=s.parentId?a.get(s.parentId):void 0,{x:l,y:c}=i?i.internals.positionAbsolute:{x:0,y:0},f=s.origin??n,u=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!i)r?.("005",On.error005());else{let{width:m,height:g}=io(i);m&&g&&(u=[[l,c],[l+m,c+g]])}else i&&Ll(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);let d=Ll(u)?Cl(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&r?.("015",On.error015()),{position:{x:d.x-l+(s.measured.width??0)*f[0],y:d.y-c+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function H6({nodesToRemove:e=[],edgesToRemove:t=[],nodes:a,edges:n,onBeforeDelete:o}){let r=new Set(e.map(d=>d.id)),s=[];for(let d of a){if(d.deletable===!1)continue;let m=r.has(d.id),g=!m&&d.parentId&&s.find(b=>b.id===d.parentId);(m||g)&&s.push(d)}let i=new Set(t.map(d=>d.id)),l=n.filter(d=>d.deletable!==!1),f=B6(s,l);for(let d of l)i.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!o)return{edges:f,nodes:s};let u=await o({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}var kc=(e,t=0,a=1)=>Math.min(Math.max(e,t),a),Cl=(e={x:0,y:0},t,a)=>({x:kc(e.x,t[0][0],t[1][0]-(a?.width??0)),y:kc(e.y,t[0][1],t[1][1]-(a?.height??0))});function q6(e,t,a){let{width:n,height:o}=io(a),{x:r,y:s}=a.internals.positionAbsolute;return Cl(e,[[r,s],[r+n,s+o]],t)}var L6=(e,t,a)=>e<t?kc(Math.abs(e-t),1,t)/t:e>a?-kc(Math.abs(e-a),1,t)/t:0,Rx=(e,t,a=15,n=40)=>{let o=L6(e.x,n,t.width-n)*a,r=L6(e.y,n,t.height-n)*a;return[o,r]},Tx=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),_w=({x:e,y:t,width:a,height:n})=>({x:e,y:t,x2:e+a,y2:t+n}),Mx=({x:e,y:t,x2:a,y2:n})=>({x:e,y:t,width:a-e,height:n-t}),Nc=(e,t=[0,0])=>{let{x:a,y:n}=Fw(e)?e.internals.positionAbsolute:Ip(e,t);return{x:a,y:n,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Ix=(e,t=[0,0])=>{let{x:a,y:n}=Fw(e)?e.internals.positionAbsolute:Ip(e,t);return{x:a,y:n,x2:a+(e.measured?.width??e.width??e.initialWidth??0),y2:n+(e.measured?.height??e.height??e.initialHeight??0)}},Uw=(e,t)=>Mx(Tx(_w(e),_w(t))),U6=(e,t,a,n,o,r,s,i)=>{let l=Math.max(0,Math.min(e+a,o+s)-Math.max(e,o)),c=Math.max(0,Math.min(t+n,r+i)-Math.max(t,r));return Math.ceil(l*c)},Np=(e,t)=>U6(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vw=e=>oo(e.width)&&oo(e.height)&&oo(e.x)&&oo(e.y),oo=e=>!isNaN(e)&&isFinite(e),Gw=(e,t)=>(a,n)=>{},Rc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Tc=({x:e,y:t},[a,n,o],r=!1,s=[1,1])=>{let i={x:(e-a)/o,y:(t-n)/o};return r?Rc(i,s):i},kl=({x:e,y:t},[a,n,o])=>({x:e*o+a,y:t*o+n});function Cc(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){let a=parseFloat(e);if(!Number.isNaN(a))return Math.floor(a)}if(typeof e=="string"&&e.endsWith("%")){let a=parseFloat(e);if(!Number.isNaN(a))return Math.floor(t*a*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function xj(e,t,a){if(typeof e=="string"||typeof e=="number"){let n=Cc(e,a),o=Cc(e,t);return{top:n,right:o,bottom:n,left:o,x:o*2,y:n*2}}if(typeof e=="object"){let n=Cc(e.top??e.y??0,a),o=Cc(e.bottom??e.y??0,a),r=Cc(e.left??e.x??0,t),s=Cc(e.right??e.x??0,t);return{top:n,right:s,bottom:o,left:r,x:r+s,y:n+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vj(e,t,a,n,o,r){let{x:s,y:i}=kl(e,[t,a,n]),{x:l,y:c}=kl({x:e.x+e.width,y:e.y+e.height},[t,a,n]),f=o-l,u=r-c;return{left:Math.floor(s),top:Math.floor(i),right:Math.floor(f),bottom:Math.floor(u)}}var Rp=(e,t,a,n,o,r)=>{let s=xj(r,t,a),i=(t-s.x)/e.width,l=(a-s.y)/e.height,c=Math.min(i,l),f=kc(c,n,o),u=e.x+e.width/2,d=e.y+e.height/2,m=t/2-u*f,g=a/2-d*f,b=vj(e,m,g,f,t,a),v={left:Math.min(b.left-s.left,0),top:Math.min(b.top-s.top,0),right:Math.min(b.right-s.right,0),bottom:Math.min(b.bottom-s.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:f}},Mc=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ll(e){return e!=null&&e!=="parent"}function io(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function $w(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function jw(e,t={width:0,height:0},a,n,o){let r={...e},s=n.get(a);if(s){let i=s.origin||o;r.x+=s.internals.positionAbsolute.x-(t.width??0)*i[0],r.y+=s.internals.positionAbsolute.y-(t.height??0)*i[1]}return r}function Ww(e,t){if(e.size!==t.size)return!1;for(let a of e)if(!t.has(a))return!1;return!0}function V6(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}function G6(e){return{...Ow,...e||{}}}function Xw(e){return e===null?null:e?"valid":"invalid"}function Lp(e,{snapGrid:t=[0,0],snapToGrid:a=!1,transform:n,containerBounds:o}){let{x:r,y:s}=ro(e),i=Tc({x:r-(o?.left??0),y:s-(o?.top??0)},n),{x:l,y:c}=a?Rc(i,t):i;return{xSnapped:l,ySnapped:c,...i}}var Ex=e=>({width:e.offsetWidth,height:e.offsetHeight}),Yw=e=>e?.getRootNode?.()||window?.document,yj=["INPUT","SELECT","TEXTAREA"];function Kw(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:yj.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}var Zw=e=>"clientX"in e,ro=(e,t)=>{let a=Zw(e),n=a?e.clientX:e.touches?.[0].clientX,o=a?e.clientY:e.touches?.[0].clientY;return{x:n-(t?.left??0),y:o-(t?.top??0)}},I6=(e,t,a,n,o)=>{let r=t.querySelectorAll(`.${e}`);return!r||!r.length?null:Array.from(r).map(s=>{let i=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(i.left-a.left)/n,y:(i.top-a.top)/n,...Ex(s)}})};function Ax({sourceX:e,sourceY:t,targetX:a,targetY:n,sourceControlX:o,sourceControlY:r,targetControlX:s,targetControlY:i}){let l=e*.125+o*.375+s*.375+a*.125,c=t*.125+r*.375+i*.375+n*.125,f=Math.abs(l-e),u=Math.abs(c-t);return[l,c,f,u]}function kx(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function N6({pos:e,x1:t,y1:a,x2:n,y2:o,c:r}){switch(e){case we.Left:return[t-kx(t-n,r),a];case we.Right:return[t+kx(n-t,r),a];case we.Top:return[t,a-kx(a-o,r)];case we.Bottom:return[t,a+kx(o-a,r)]}}function Dx({sourceX:e,sourceY:t,sourcePosition:a=we.Bottom,targetX:n,targetY:o,targetPosition:r=we.Top,curvature:s=.25}){let[i,l]=N6({pos:a,x1:e,y1:t,x2:n,y2:o,c:s}),[c,f]=N6({pos:r,x1:n,y1:o,x2:e,y2:t,c:s}),[u,d,m,g]=Ax({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:l,targetControlX:c,targetControlY:f});return[`M${e},${t} C${i},${l} ${c},${f} ${n},${o}`,u,d,m,g]}function Qw({sourceX:e,sourceY:t,targetX:a,targetY:n}){let o=Math.abs(a-e)/2,r=a<e?a+o:a-o,s=Math.abs(n-t)/2,i=n<t?n+s:n-s;return[r,i,o,s]}function $6({sourceNode:e,targetNode:t,selected:a=!1,zIndex:n=0,elevateOnSelect:o=!1,zIndexMode:r="basic"}){if(r==="manual")return n;let s=o&&a?n+1e3:n,i=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+i}function j6({sourceNode:e,targetNode:t,width:a,height:n,transform:o}){let r=Tx(Ix(e),Ix(t));r.x===r.x2&&(r.x2+=1),r.y===r.y2&&(r.y2+=1);let s={x:-o[0]/o[2],y:-o[1]/o[2],width:a/o[2],height:n/o[2]};return Np(s,Mx(r))>0}var bj=({source:e,sourceHandle:t,target:a,targetHandle:n})=>`xy-edge__${e}${t||""}-${a}${n||""}`,wj=(e,t)=>t.some(a=>a.source===e.source&&a.target===e.target&&(a.sourceHandle===e.sourceHandle||!a.sourceHandle&&!e.sourceHandle)&&(a.targetHandle===e.targetHandle||!a.targetHandle&&!e.targetHandle)),W6=(e,t,a={})=>{if(!e.source||!e.target)return a.onError?.("006",On.error006()),t;let n=a.getEdgeId||bj,o;return Bw(e)?o={...e}:o={...e,id:n(e)},wj(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function _x({sourceX:e,sourceY:t,targetX:a,targetY:n}){let[o,r,s,i]=Qw({sourceX:e,sourceY:t,targetX:a,targetY:n});return[`M ${e},${t}L ${a},${n}`,o,r,s,i]}var R6={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},Sj=({source:e,sourcePosition:t=we.Bottom,target:a})=>t===we.Left||t===we.Right?e.x<a.x?{x:1,y:0}:{x:-1,y:0}:e.y<a.y?{x:0,y:1}:{x:0,y:-1},T6=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Cj({source:e,sourcePosition:t=we.Bottom,target:a,targetPosition:n=we.Top,center:o,offset:r,stepPosition:s}){let i=R6[t],l=R6[n],c={x:e.x+i.x*r,y:e.y+i.y*r},f={x:a.x+l.x*r,y:a.y+l.y*r},u=Sj({source:c,sourcePosition:t,target:f}),d=u.x!==0?"x":"y",m=u[d],g=[],b,v,x={x:0,y:0},y={x:0,y:0},[,,h,w]=Qw({sourceX:e.x,sourceY:e.y,targetX:a.x,targetY:a.y});if(i[d]*l[d]===-1){d==="x"?(b=o.x??c.x+(f.x-c.x)*s,v=o.y??(c.y+f.y)/2):(b=o.x??(c.x+f.x)/2,v=o.y??c.y+(f.y-c.y)*s);let L=[{x:b,y:c.y},{x:b,y:f.y}],T=[{x:c.x,y:v},{x:f.x,y:v}];i[d]===m?g=d==="x"?L:T:g=d==="x"?T:L}else{let L=[{x:c.x,y:f.y}],T=[{x:f.x,y:c.y}];if(d==="x"?g=i.x===m?T:L:g=i.y===m?L:T,t===n){let N=Math.abs(e[d]-a[d]);if(N<=r){let P=Math.min(r-1,r-N);i[d]===m?x[d]=(c[d]>e[d]?-1:1)*P:y[d]=(f[d]>a[d]?-1:1)*P}}if(t!==n){let N=d==="x"?"y":"x",P=i[d]===l[N],E=c[N]>f[N],_=c[N]<f[N];(i[d]===1&&(!P&&E||P&&_)||i[d]!==1&&(!P&&_||P&&E))&&(g=d==="x"?L:T)}let A={x:c.x+x.x,y:c.y+x.y},D={x:f.x+y.x,y:f.y+y.y},H=Math.max(Math.abs(A.x-g[0].x),Math.abs(D.x-g[0].x)),V=Math.max(Math.abs(A.y-g[0].y),Math.abs(D.y-g[0].y));H>=V?(b=(A.x+D.x)/2,v=g[0].y):(b=g[0].x,v=(A.y+D.y)/2)}let S={x:c.x+x.x,y:c.y+x.y},C={x:f.x+y.x,y:f.y+y.y};return[[e,...S.x!==g[0].x||S.y!==g[0].y?[S]:[],...g,...C.x!==g[g.length-1].x||C.y!==g[g.length-1].y?[C]:[],a],b,v,h,w]}function kj(e,t,a,n){let o=Math.min(T6(e,t)/2,T6(t,a)/2,n),{x:r,y:s}=t;if(e.x===r&&r===a.x||e.y===s&&s===a.y)return`L${r} ${s}`;if(e.y===s){let c=e.x<a.x?-1:1,f=e.y<a.y?1:-1;return`L ${r+o*c},${s}Q ${r},${s} ${r},${s+o*f}`}let i=e.x<a.x?1:-1,l=e.y<a.y?-1:1;return`L ${r},${s+o*l}Q ${r},${s} ${r+o*i},${s}`}function Js({sourceX:e,sourceY:t,sourcePosition:a=we.Bottom,targetX:n,targetY:o,targetPosition:r=we.Top,borderRadius:s=5,centerX:i,centerY:l,offset:c=20,stepPosition:f=.5}){let[u,d,m,g,b]=Cj({source:{x:e,y:t},sourcePosition:a,target:{x:n,y:o},targetPosition:r,center:{x:i,y:l},offset:c,stepPosition:f}),v=`M${u[0].x} ${u[0].y}`;for(let x=1;x<u.length-1;x++)v+=kj(u[x-1],u[x],u[x+1],s);return v+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[v,d,m,g,b]}function M6(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function X6(e){let{sourceNode:t,targetNode:a}=e;if(!M6(t)||!M6(a))return null;let n=t.internals.handleBounds||E6(t.handles),o=a.internals.handleBounds||E6(a.handles),r=A6(n?.source??[],e.sourceHandle),s=A6(e.connectionMode===Zs.Strict?o?.target??[]:(o?.target??[]).concat(o?.source??[]),e.targetHandle);if(!r||!s)return e.onError?.("008",On.error008(r?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let i=r?.position||we.Bottom,l=s?.position||we.Top,c=Qs(t,r,i),f=Qs(a,s,l);return{sourceX:c.x,sourceY:c.y,targetX:f.x,targetY:f.y,sourcePosition:i,targetPosition:l}}function E6(e){if(!e)return null;let t=[],a=[];for(let n of e)n.width=n.width??1,n.height=n.height??1,n.type==="source"?t.push(n):n.type==="target"&&a.push(n);return{source:t,target:a}}function Qs(e,t,a=we.Left,n=!1){let o=(t?.x??0)+e.internals.positionAbsolute.x,r=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:i}=t??io(e);if(n)return{x:o+s/2,y:r+i/2};switch(t?.position??a){case we.Top:return{x:o+s/2,y:r};case we.Right:return{x:o+s,y:r+i/2};case we.Bottom:return{x:o+s/2,y:r+i};case we.Left:return{x:o,y:r+i/2}}}function A6(e,t){return e&&(t?e.find(a=>a.id===t):e[0])||null}function Px(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`:""}function Y6(e,{id:t,defaultColor:a,defaultMarkerStart:n,defaultMarkerEnd:o}){let r=new Set;return e.reduce((s,i)=>([i.markerStart||n,i.markerEnd||o].forEach(l=>{if(l&&typeof l=="object"){let c=Px(l,t);r.has(c)||(s.push({id:c,color:l.color||a,...l}),r.add(c))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))}var K6=1e3,Lj=10,Jw={nodeOrigin:[0,0],nodeExtent:Lc,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Ij={...Jw,checkEquality:!0};function e2(e,t){let a={...e};for(let n in t)t[n]!==void 0&&(a[n]=t[n]);return a}function Z6(e,t,a){let n=e2(Jw,a);for(let o of e.values())if(o.parentId)a2(o,e,t,n);else{let r=Ip(o,n.nodeOrigin),s=Ll(o.extent)?o.extent:n.nodeExtent,i=Cl(r,s,io(o));o.internals.positionAbsolute=i}}function Nj(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let a=[],n=[];for(let o of e.handles){let r={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?a.push(r):o.type==="target"&&n.push(r)}return{source:a,target:n}}function t2(e){return e==="manual"}function Ox(e,t,a,n={}){let o=e2(Ij,n),r={i:0},s=new Map(t),i=o?.elevateNodesOnSelect&&!t2(o.zIndexMode)?K6:0,l=e.length>0,c=!1;t.clear(),a.clear();for(let f of e){let u=s.get(f.id);if(o.checkEquality&&f===u?.internals.userNode)t.set(f.id,u);else{let d=Ip(f,o.nodeOrigin),m=Ll(f.extent)?f.extent:o.nodeExtent,g=Cl(d,m,io(f));u={...o.defaults,...f,measured:{width:f.measured?.width,height:f.measured?.height},internals:{positionAbsolute:g,handleBounds:Nj(f,u),z:Q6(f,i,o.zIndexMode),userNode:f}},t.set(f.id,u)}(u.measured===void 0||u.measured.width===void 0||u.measured.height===void 0)&&!u.hidden&&(l=!1),f.parentId&&a2(u,t,a,n,r),c||=f.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function Rj(e,t){if(!e.parentId)return;let a=t.get(e.parentId);a?a.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function a2(e,t,a,n,o){let{elevateNodesOnSelect:r,nodeOrigin:s,nodeExtent:i,zIndexMode:l}=e2(Jw,n),c=e.parentId,f=t.get(c);if(!f){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Rj(e,a),o&&!f.parentId&&f.internals.rootParentIndex===void 0&&l==="auto"&&(f.internals.rootParentIndex=++o.i,f.internals.z=f.internals.z+o.i*Lj),o&&f.internals.rootParentIndex!==void 0&&(o.i=f.internals.rootParentIndex);let u=r&&!t2(l)?K6:0,{x:d,y:m,z:g}=Tj(e,f,s,i,u,l),{positionAbsolute:b}=e.internals,v=d!==b.x||m!==b.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:d,y:m}:b,z:g}})}function Q6(e,t,a){let n=oo(e.zIndex)?e.zIndex:0;return t2(a)?n:n+(e.selected?t:0)}function Tj(e,t,a,n,o,r){let{x:s,y:i}=t.internals.positionAbsolute,l=io(e),c=Ip(e,a),f=Ll(e.extent)?Cl(c,e.extent,l):c,u=Cl({x:s+f.x,y:i+f.y},n,l);e.extent==="parent"&&(u=q6(u,l,t));let d=Q6(e,o,r),m=t.internals.z??0;return{x:u.x,y:u.y,z:m>=d?m+1:d}}function zx(e,t,a,n=[0,0]){let o=[],r=new Map;for(let s of e){let i=t.get(s.parentId);if(!i)continue;let l=r.get(s.parentId)?.expandedRect??Nc(i),c=Uw(l,s.rect);r.set(s.parentId,{expandedRect:c,parent:i})}return r.size>0&&r.forEach(({expandedRect:s,parent:i},l)=>{let c=i.internals.positionAbsolute,f=io(i),u=i.origin??n,d=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,m=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(f.width,Math.round(s.width)),b=Math.max(f.height,Math.round(s.height)),v=(g-f.width)*u[0],x=(b-f.height)*u[1];(d>0||m>0||v||x)&&(o.push({id:l,type:"position",position:{x:i.position.x-d+v,y:i.position.y-m+x}}),a.get(l)?.forEach(y=>{e.some(h=>h.id===y.id)||o.push({id:y.id,type:"position",position:{x:y.position.x+d,y:y.position.y+m}})})),(f.width<s.width||f.height<s.height||d||m)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?u[0]*d-v:0),height:b+(m?u[1]*m-x:0)}})}),o}function J6(e,t,a,n,o,r,s){let i=n?.querySelector(".xyflow__viewport"),l=!1;if(!i)return{changes:[],updatedInternals:l};let c=[],f=window.getComputedStyle(i),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(let m of e.values()){let g=t.get(m.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}let b=Ex(m.nodeElement),v=g.measured.width!==b.width||g.measured.height!==b.height;if(!!(b.width&&b.height&&(v||!g.internals.handleBounds||m.force))){let y=m.nodeElement.getBoundingClientRect(),h=Ll(g.extent)?g.extent:r,{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){let C=t.get(g.parentId);C&&(w=q6(w,b,C))}else h&&(w=Cl(w,h,b));let S={...g,measured:b,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:I6("source",m.nodeElement,y,u,g.id),target:I6("target",m.nodeElement,y,u,g.id)}}};t.set(g.id,S),g.parentId&&a2(S,t,a,{nodeOrigin:o,zIndexMode:s}),l=!0,v&&(c.push({id:g.id,type:"dimensions",dimensions:b}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Nc(S,o)}))}}if(d.length>0){let m=zx(d,t,a,o);c.push(...m)}return{changes:c,updatedInternals:l}}async function eD({delta:e,panZoom:t,transform:a,translateExtent:n,width:o,height:r}){if(!t||!e.x&&!e.y)return!1;let s=await t.setViewportConstrained({x:a[0]+e.x,y:a[1]+e.y,zoom:a[2]},[[0,0],[o,r]],n);return!!s&&(s.x!==a[0]||s.y!==a[1]||s.k!==a[2])}function D6(e,t,a,n,o,r){let s=o,i=n.get(s)||new Map;n.set(s,i.set(a,t)),s=`${o}-${e}`;let l=n.get(s)||new Map;if(n.set(s,l.set(a,t)),r){s=`${o}-${e}-${r}`;let c=n.get(s)||new Map;n.set(s,c.set(a,t))}}function n2(e,t,a){e.clear(),t.clear();for(let n of a){let{source:o,target:r,sourceHandle:s=null,targetHandle:i=null}=n,l={edgeId:n.id,source:o,target:r,sourceHandle:s,targetHandle:i},c=`${o}-${s}--${r}-${i}`,f=`${r}-${i}--${o}-${s}`;D6("source",l,f,e,o,s),D6("target",l,c,e,r,i),t.set(n.id,n)}}function tD(e,t){if(!e.parentId)return!1;let a=t.get(e.parentId);return a?a.selected?!0:tD(a,t):!1}function _6(e,t,a){let n=e;do{if(n?.matches?.(t))return!0;if(n===a)return!1;n=n?.parentElement}while(n);return!1}function Mj(e,t,a,n){let o=new Map;for(let[r,s]of e)if((s.selected||s.id===n)&&(!s.parentId||!tD(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){let i=e.get(r);i&&o.set(r,{id:r,position:i.position||{x:0,y:0},distance:{x:a.x-i.internals.positionAbsolute.x,y:a.y-i.internals.positionAbsolute.y},extent:i.extent,parentId:i.parentId,origin:i.origin,expandParent:i.expandParent,internals:{positionAbsolute:i.internals.positionAbsolute||{x:0,y:0}},measured:{width:i.measured.width??0,height:i.measured.height??0}})}return o}function Ew({nodeId:e,dragItems:t,nodeLookup:a,dragging:n=!0}){let o=[];for(let[s,i]of t){let l=a.get(s)?.internals.userNode;l&&o.push({...l,position:i.position,dragging:n})}if(!e)return[o[0],o];let r=a.get(e)?.internals.userNode;return[r?{...r,position:t.get(e)?.position||r.position,dragging:n}:o[0],o]}function Ej({dragItems:e,snapGrid:t,x:a,y:n}){let o=e.values().next().value;if(!o)return null;let r={x:a-o.distance.x,y:n-o.distance.y},s=Rc(r,t);return{x:s.x-r.x,y:s.y-r.y}}function aD({onNodeMouseDown:e,getStoreItems:t,onDragStart:a,onDrag:n,onDragStop:o}){let r={x:null,y:null},s=0,i=new Map,l=!1,c={x:0,y:0},f=null,u=!1,d=null,m=!1,g=!1,b=null;function v({noDragClassName:y,handleSelector:h,domNode:w,isSelectable:S,nodeId:C,nodeClickDistance:I=0}){d=ua(w);function L({x:H,y:V}){let{nodeLookup:N,nodeExtent:P,snapGrid:E,snapToGrid:_,nodeOrigin:z,onNodeDrag:q,onSelectionDrag:O,onError:W,updateNodePositions:ee}=t();r={x:H,y:V};let de=!1,ne=i.size>1,re=ne&&P?_w(Ic(i)):null,ue=ne&&_?Ej({dragItems:i,snapGrid:E,x:H,y:V}):null;for(let[ce,U]of i){if(!N.has(ce))continue;let M={x:H-U.distance.x,y:V-U.distance.y};_&&(M=ue?{x:Math.round(M.x+ue.x),y:Math.round(M.y+ue.y)}:Rc(M,E));let se=null;if(ne&&P&&!U.extent&&re){let{positionAbsolute:G}=U.internals,oe=G.x-re.x+P[0][0],Y=G.x+U.measured.width-re.x2+P[1][0],Le=G.y-re.y+P[0][1],ze=G.y+U.measured.height-re.y2+P[1][1];se=[[oe,Le],[Y,ze]]}let{position:le,positionAbsolute:B}=qw({nodeId:ce,nextPosition:M,nodeLookup:N,nodeExtent:se||P,nodeOrigin:z,onError:W});de=de||U.position.x!==le.x||U.position.y!==le.y,U.position=le,U.internals.positionAbsolute=B}if(g=g||de,!!de&&(ee(i,!0),b&&(n||q||!C&&O))){let[ce,U]=Ew({nodeId:C,dragItems:i,nodeLookup:N});n?.(b,i,ce,U),q?.(b,ce,U),C||O?.(b,U)}}async function T(){if(!f)return;let{transform:H,panBy:V,autoPanSpeed:N,autoPanOnNodeDrag:P}=t();if(!P){l=!1,cancelAnimationFrame(s);return}let[E,_]=Rx(c,f,N);(E!==0||_!==0)&&(r.x=(r.x??0)-E/H[2],r.y=(r.y??0)-_/H[2],await V({x:E,y:_})&&L(r)),s=requestAnimationFrame(T)}function A(H){let{nodeLookup:V,multiSelectionActive:N,nodesDraggable:P,transform:E,snapGrid:_,snapToGrid:z,selectNodesOnDrag:q,onNodeDragStart:O,onSelectionDragStart:W,unselectNodesAndEdges:ee}=t();u=!0,(!q||!S)&&!N&&C&&(V.get(C)?.selected||ee()),S&&q&&C&&e?.(C);let de=Lp(H.sourceEvent,{transform:E,snapGrid:_,snapToGrid:z,containerBounds:f});if(r=de,i=Mj(V,P,de,C),i.size>0&&(a||O||!C&&W)){let[ne,re]=Ew({nodeId:C,dragItems:i,nodeLookup:V});a?.(H.sourceEvent,i,ne,re),O?.(H.sourceEvent,ne,re),C||W?.(H.sourceEvent,re)}}let D=ax().clickDistance(I).on("start",H=>{let{domNode:V,nodeDragThreshold:N,transform:P,snapGrid:E,snapToGrid:_}=t();f=V?.getBoundingClientRect()||null,m=!1,g=!1,b=H.sourceEvent,N===0&&A(H),r=Lp(H.sourceEvent,{transform:P,snapGrid:E,snapToGrid:_,containerBounds:f}),c=ro(H.sourceEvent,f)}).on("drag",H=>{let{autoPanOnNodeDrag:V,transform:N,snapGrid:P,snapToGrid:E,nodeDragThreshold:_,nodeLookup:z}=t(),q=Lp(H.sourceEvent,{transform:N,snapGrid:P,snapToGrid:E,containerBounds:f});if(b=H.sourceEvent,(H.sourceEvent.type==="touchmove"&&H.sourceEvent.touches.length>1||C&&!z.has(C))&&(m=!0),!m){if(!l&&V&&u&&(l=!0,T()),!u){let O=ro(H.sourceEvent,f),W=O.x-c.x,ee=O.y-c.y;Math.sqrt(W*W+ee*ee)>_&&A(H)}(r.x!==q.xSnapped||r.y!==q.ySnapped)&&i&&u&&(c=ro(H.sourceEvent,f),L(q))}}).on("end",H=>{if(!u||m){m&&i.size>0&&t().updateNodePositions(i,!1);return}if(l=!1,u=!1,cancelAnimationFrame(s),i.size>0){let{nodeLookup:V,updateNodePositions:N,onNodeDragStop:P,onSelectionDragStop:E}=t();if(g&&(N(i,!1),g=!1),o||P||!C&&E){let[_,z]=Ew({nodeId:C,dragItems:i,nodeLookup:V,dragging:!1});o?.(H.sourceEvent,i,_,z),P?.(H.sourceEvent,_,z),C||E?.(H.sourceEvent,z)}}}).filter(H=>{let V=H.target;return!H.button&&(!y||!_6(V,`.${y}`,w))&&(!h||_6(V,h,w))});d.call(D)}function x(){d?.on(".drag",null)}return{update:v,destroy:x}}function Aj(e,t,a){let n=[],o={x:e.x-a,y:e.y-a,width:a*2,height:a*2};for(let r of t.values())Np(o,Nc(r))>0&&n.push(r);return n}var Dj=250;function _j(e,t,a,n){let o=[],r=1/0,s=Aj(e,a,t+Dj);for(let i of s){let l=[...i.internals.handleBounds?.source??[],...i.internals.handleBounds?.target??[]];for(let c of l){if(n.nodeId===c.nodeId&&n.type===c.type&&n.id===c.id)continue;let{x:f,y:u}=Qs(i,c,c.position,!0),d=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(u-e.y,2));d>t||(d<r?(o=[{...c,x:f,y:u}],r=d):d===r&&o.push({...c,x:f,y:u}))}}if(!o.length)return null;if(o.length>1){let i=n.type==="source"?"target":"source";return o.find(l=>l.type===i)??o[0]}return o[0]}function nD(e,t,a,n,o,r=!1){let s=n.get(e);if(!s)return null;let i=o==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(a?i?.find(c=>c.id===a):i?.[0])??null;return l&&r?{...l,...Qs(s,l,l.position,!0)}:l}function oD(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Pj(e,t){let a=null;return t?a=!0:e&&!t&&(a=!1),a}var rD=()=>!0;function Oj(e,{connectionMode:t,connectionRadius:a,handleId:n,nodeId:o,edgeUpdaterType:r,isTarget:s,domNode:i,nodeLookup:l,lib:c,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:v,isValidConnection:x=rD,onReconnectEnd:y,updateConnection:h,getTransform:w,getFromHandle:S,autoPanSpeed:C,dragThreshold:I=1,handleDomNode:L}){let T=Yw(e.target),A=0,D,{x:H,y:V}=ro(e),N=oD(r,L),P=i?.getBoundingClientRect(),E=!1;if(!P||!N)return;let _=nD(o,N,n,l,t);if(!_)return;let z=ro(e,P),q=!1,O=null,W=!1,ee=null;function de(){if(!f||!P)return;let[le,B]=Rx(z,P,C);d({x:le,y:B}),A=requestAnimationFrame(de)}let ne={..._,nodeId:o,type:N,position:_.position},re=l.get(o),ce={inProgress:!0,isValid:null,from:Qs(re,ne,we.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:z,toHandle:null,toPosition:k6[ne.position],toNode:null,pointer:z};function U(){E=!0,h(ce),g?.(e,{nodeId:o,handleId:n,handleType:N})}I===0&&U();function M(le){if(!E){let{x:ze,y:bt}=ro(le),st=ze-H,Gt=bt-V;if(!(st*st+Gt*Gt>I*I))return;U()}if(!S()||!ne){se(le);return}let B=w();z=ro(le,P),D=_j(Tc(z,B,!1,[1,1]),a,l,ne),q||(de(),q=!0);let G=sD(le,{handle:D,connectionMode:t,fromNodeId:o,fromHandleId:n,fromType:s?"target":"source",isValidConnection:x,doc:T,lib:c,flowId:u,nodeLookup:l});ee=G.handleDomNode,O=G.connection,W=Pj(!!D,G.isValid);let oe=l.get(o),Y=oe?Qs(oe,ne,we.Left,!0):ce.from,Le={...ce,from:Y,isValid:W,to:G.toHandle&&W?kl({x:G.toHandle.x,y:G.toHandle.y},B):z,toHandle:G.toHandle,toPosition:W&&G.toHandle?G.toHandle.position:k6[ne.position],toNode:G.toHandle?l.get(G.toHandle.nodeId):null,pointer:z};h(Le),ce=Le}function se(le){if(!("touches"in le&&le.touches.length>0)){if(E){(D||ee)&&O&&W&&b?.(O);let{inProgress:B,...G}=ce,oe={...G,toPosition:ce.toHandle?ce.toPosition:null};v?.(le,oe),r&&y?.(le,oe)}m(),cancelAnimationFrame(A),q=!1,W=!1,O=null,ee=null,T.removeEventListener("mousemove",M),T.removeEventListener("mouseup",se),T.removeEventListener("touchmove",M),T.removeEventListener("touchend",se)}}T.addEventListener("mousemove",M),T.addEventListener("mouseup",se),T.addEventListener("touchmove",M),T.addEventListener("touchend",se)}function sD(e,{handle:t,connectionMode:a,fromNodeId:n,fromHandleId:o,fromType:r,doc:s,lib:i,flowId:l,isValidConnection:c=rD,nodeLookup:f}){let u=r==="target",d=t?s.querySelector(`.${i}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:m,y:g}=ro(e),b=s.elementFromPoint(m,g),v=b?.classList.contains(`${i}-flow__handle`)?b:d,x={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){let y=oD(void 0,v),h=v.getAttribute("data-nodeid"),w=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),C=v.classList.contains("connectableend");if(!h||!y)return x;let I={source:u?h:n,sourceHandle:u?w:o,target:u?n:h,targetHandle:u?o:w};x.connection=I;let T=S&&C&&(a===Zs.Strict?u&&y==="source"||!u&&y==="target":h!==n||w!==o);x.isValid=T&&c(I),x.toHandle=nD(h,y,w,f,a,!0)}return x}var Bx={onPointerDown:Oj,isValid:sD};function iD({domNode:e,panZoom:t,getTransform:a,getViewScale:n}){let o=ua(e);function r({translateExtent:i,width:l,height:c,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:m=!1}){let g=h=>{if(h.sourceEvent.type!=="wheel"||!t)return;let w=a(),S=h.sourceEvent.ctrlKey&&Mc()?10:1,C=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*f,I=w[2]*Math.pow(2,C*S);t.scaleTo(I)},b=[0,0],v=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(b=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},x=h=>{let w=a();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!t)return;let S=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],C=[S[0]-b[0],S[1]-b[1]];b=S;let I=n()*Math.max(w[2],Math.log(w[2]))*(m?-1:1),L={x:w[0]-C[0]*I,y:w[1]-C[1]*I},T=[[0,0],[l,c]];t.setViewportConstrained({x:L.x,y:L.y,zoom:w[2]},T,i)},y=Cx().on("start",v).on("zoom",u?x:null).on("zoom.wheel",d?g:null);o.call(y,{})}function s(){o.on("zoom",null)}return{update:r,destroy:s,pointer:Ka}}var Fx=e=>({x:e.x,y:e.y,zoom:e.k}),Aw=({x:e,y:t,zoom:a})=>wl.translate(e,t).scale(a),Ks=(e,t)=>e.target.closest(`.${t}`),lD=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),zj=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Dw=(e,t=0,a=zj,n=()=>{})=>{let o=typeof t=="number"&&t>0;return o||n(),o?e.transition().duration(t).ease(a).on("end",n):e},uD=e=>{let t=e.ctrlKey&&Mc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Bj({zoomPanValues:e,noWheelClassName:t,d3Selection:a,d3Zoom:n,panOnScrollMode:o,panOnScrollSpeed:r,zoomOnPinch:s,onPanZoomStart:i,onPanZoom:l,onPanZoomEnd:c}){return f=>{if(Ks(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();let u=a.property("__zoom").k||1;if(f.ctrlKey&&s){let v=Ka(f),x=uD(f),y=u*Math.pow(2,x);n.scaleTo(a,y,v,f);return}let d=f.deltaMode===1?20:1,m=o===Fr.Vertical?0:f.deltaX*d,g=o===Fr.Horizontal?0:f.deltaY*d;!Mc()&&f.shiftKey&&o!==Fr.Vertical&&(m=f.deltaY*d,g=0),n.translateBy(a,-(m/u)*r,-(g/u)*r,{internal:!0});let b=Fx(a.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(f,b):(e.isPanScrolling=!0,i?.(f,b)),e.panScrollTimeout=setTimeout(()=>{c?.(f,b),e.isPanScrolling=!1},150)}}function Fj({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:a}){return function(n,o){let r=n.type==="wheel",s=!t&&r&&!n.ctrlKey,i=Ks(n,e);if(n.ctrlKey&&r&&i&&n.preventDefault(),s||i)return null;n.preventDefault(),a.call(this,n,o)}}function Hj({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:a}){return n=>{if(n.sourceEvent?.internal)return;let o=Fx(n.transform);e.mouseButton=n.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=o,n.sourceEvent?.type==="mousedown"&&t(!0),a&&a?.(n.sourceEvent,o)}}function qj({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:a,onTransformChange:n,onPanZoom:o}){return r=>{e.usedRightMouseButton=!!(a&&lD(t,e.mouseButton??0)),r.sourceEvent?.sync||n([r.transform.x,r.transform.y,r.transform.k]),o&&!r.sourceEvent?.internal&&o?.(r.sourceEvent,Fx(r.transform))}}function Uj({zoomPanValues:e,panOnDrag:t,panOnScroll:a,onDraggingChange:n,onPanZoomEnd:o,onPaneContextMenu:r}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,r&&lD(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&r(s.sourceEvent),e.usedRightMouseButton=!1,n(!1),o)){let i=Fx(s.transform);e.prevViewport=i,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o?.(s.sourceEvent,i)},a?150:0)}}}function Vj({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:a,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:l,noPanClassName:c,lib:f,connectionInProgress:u}){return d=>{let m=t||a,g=n&&d.ctrlKey,b=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Ks(d,`${f}-flow__node`)||Ks(d,`${f}-flow__edge`)||Ks(d,`${f}-flow__selection`)||Ks(d,`${f}-flow__nodesselection`)))return!0;if(!o&&!m&&!r&&!s&&!n||i||u&&!b||Ks(d,l)&&b||Ks(d,c)&&(!b||r&&b&&!t)||!n&&d.ctrlKey&&b)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!m&&!r&&!g&&b||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;let v=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||b||e)&&v}}function cD({domNode:e,minZoom:t,maxZoom:a,translateExtent:n,viewport:o,onPanZoom:r,onPanZoomStart:s,onPanZoomEnd:i,onDraggingChange:l}){let c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=[[0,0],[f.width,f.height]];(typeof ResizeObserver<"u"?new ResizeObserver(V=>{let N=V[0];N&&(u=[[0,0],[N.contentRect.width,N.contentRect.height]])}):null)?.observe(e);let m=Cx().extent(()=>u).scaleExtent([t,a]).translateExtent(n),g=ua(e).call(m);w({x:o.x,y:o.y,zoom:kc(o.zoom,t,a)},[[0,0],[f.width,f.height]],n);let b=g.on("wheel.zoom"),v=g.on("dblclick.zoom");m.wheelDelta(uD);async function x(V,N){return g?new Promise(P=>{m?.interpolate(N?.interpolate==="linear"?zr:vl).transform(Dw(g,N?.duration,N?.ease,()=>P(!0)),V)}):!1}function y({noWheelClassName:V,noPanClassName:N,onPaneContextMenu:P,userSelectionActive:E,panOnScroll:_,panOnDrag:z,panOnScrollMode:q,panOnScrollSpeed:O,preventScrolling:W,zoomOnPinch:ee,zoomOnScroll:de,zoomOnDoubleClick:ne,panActivationKeyPressed:re=!1,zoomActivationKeyPressed:ue,lib:ce,onTransformChange:U,connectionInProgress:M,paneClickDistance:se,selectionOnDrag:le}){E&&!c.isZoomingOrPanning&&h();let B=_&&!ue&&!E;m.clickDistance(le?1/0:!oo(se)||se<0?0:se);let G=B?Bj({zoomPanValues:c,noWheelClassName:V,d3Selection:g,d3Zoom:m,panOnScrollMode:q,panOnScrollSpeed:O,zoomOnPinch:ee,onPanZoomStart:s,onPanZoom:r,onPanZoomEnd:i}):Fj({noWheelClassName:V,preventScrolling:W,d3ZoomHandler:b});g.on("wheel.zoom",G,{passive:!1});let oe=Hj({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});m.on("start",oe);let Y=qj({zoomPanValues:c,panOnDrag:z,onPaneContextMenu:!!P,onPanZoom:r,onTransformChange:U});m.on("zoom",Y);let Le=Uj({zoomPanValues:c,panOnDrag:z,panOnScroll:_,onPaneContextMenu:P,onPanZoomEnd:i,onDraggingChange:l});m.on("end",Le);let ze=Vj({panActivationKeyPressed:re,zoomActivationKeyPressed:ue,panOnDrag:z,zoomOnScroll:de,panOnScroll:_,zoomOnDoubleClick:ne,zoomOnPinch:ee,userSelectionActive:E,noPanClassName:N,noWheelClassName:V,lib:ce,connectionInProgress:M});m.filter(ze),ne?g.on("dblclick.zoom",v):g.on("dblclick.zoom",null)}function h(){m.on("zoom",null)}async function w(V,N,P){let E=Aw(V),_=m?.constrain()(E,N,P);return _&&await x(_),_}async function S(V,N){let P=Aw(V);return await x(P,N),P}function C(V){if(g){let N=Aw(V),P=g.property("__zoom");(P.k!==V.zoom||P.x!==V.x||P.y!==V.y)&&m?.transform(g,N,null,{sync:!0})}}function I(){let V=g?kp(g.node()):{x:0,y:0,k:1};return{x:V.x,y:V.y,zoom:V.k}}async function L(V,N){return g?new Promise(P=>{m?.interpolate(N?.interpolate==="linear"?zr:vl).scaleTo(Dw(g,N?.duration,N?.ease,()=>P(!0)),V)}):!1}async function T(V,N){return g?new Promise(P=>{m?.interpolate(N?.interpolate==="linear"?zr:vl).scaleBy(Dw(g,N?.duration,N?.ease,()=>P(!0)),V)}):!1}function A(V){m?.scaleExtent(V)}function D(V){m?.translateExtent(V)}function H(V){let N=!oo(V)||V<0?0:V;m?.clickDistance(N)}return{update:y,destroy:h,setViewport:S,setViewportConstrained:w,getViewport:I,scaleTo:L,scaleBy:T,setScaleExtent:A,setTranslateExtent:D,syncViewport:C,setClickDistance:H}}var Hr;(function(e){e.Line="line",e.Handle="handle"})(Hr||(Hr={}));var dD=["top-left","top-right","bottom-left","bottom-right"],fD=["top","right","bottom","left"];function Gj({width:e,prevWidth:t,height:a,prevHeight:n,affectsX:o,affectsY:r}){let s=e-t,i=a-n,l=[s>0?1:s<0?-1:0,i>0?1:i<0?-1:0];return s&&o&&(l[0]=l[0]*-1),i&&r&&(l[1]=l[1]*-1),l}function P6(e){let t=e.includes("right")||e.includes("left"),a=e.includes("bottom")||e.includes("top"),n=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:a,affectsX:n,affectsY:o}}function Xs(e,t){return Math.max(0,t-e)}function Ys(e,t){return Math.max(0,e-t)}function Lx(e,t,a){return Math.max(0,t-e,e-a)}function O6(e,t){return e?!t:t}function $j(e,t,a,n,o,r,s,i){let{affectsX:l,affectsY:c}=t,{isHorizontal:f,isVertical:u}=t,d=f&&u,{xSnapped:m,ySnapped:g}=a,{minWidth:b,maxWidth:v,minHeight:x,maxHeight:y}=n,{x:h,y:w,width:S,height:C,aspectRatio:I}=e,L=Math.floor(f?m-e.pointerX:0),T=Math.floor(u?g-e.pointerY:0),A=S+(l?-L:L),D=C+(c?-T:T),H=-r[0]*S,V=-r[1]*C,N=Lx(A,b,v),P=Lx(D,x,y);if(s){let z=0,q=0;l&&L<0?z=Xs(h+L+H,s[0][0]):!l&&L>0&&(z=Ys(h+A+H,s[1][0])),c&&T<0?q=Xs(w+T+V,s[0][1]):!c&&T>0&&(q=Ys(w+D+V,s[1][1])),N=Math.max(N,z),P=Math.max(P,q)}if(i){let z=0,q=0;l&&L>0?z=Ys(h+L,i[0][0]):!l&&L<0&&(z=Xs(h+A,i[1][0])),c&&T>0?q=Ys(w+T,i[0][1]):!c&&T<0&&(q=Xs(w+D,i[1][1])),N=Math.max(N,z),P=Math.max(P,q)}if(o){if(f){let z=Lx(A/I,x,y)*I;if(N=Math.max(N,z),s){let q=0;!l&&!c||l&&!c&&d?q=Ys(w+V+A/I,s[1][1])*I:q=Xs(w+V+(l?L:-L)/I,s[0][1])*I,N=Math.max(N,q)}if(i){let q=0;!l&&!c||l&&!c&&d?q=Xs(w+A/I,i[1][1])*I:q=Ys(w+(l?L:-L)/I,i[0][1])*I,N=Math.max(N,q)}}if(u){let z=Lx(D*I,b,v)/I;if(P=Math.max(P,z),s){let q=0;!l&&!c||c&&!l&&d?q=Ys(h+D*I+H,s[1][0])/I:q=Xs(h+(c?T:-T)*I+H,s[0][0])/I,P=Math.max(P,q)}if(i){let q=0;!l&&!c||c&&!l&&d?q=Xs(h+D*I,i[1][0])/I:q=Ys(h+(c?T:-T)*I,i[0][0])/I,P=Math.max(P,q)}}}T=T+(T<0?P:-P),L=L+(L<0?N:-N),o&&(d?A>D*I?T=(O6(l,c)?-L:L)/I:L=(O6(l,c)?-T:T)*I:f?(T=L/I,c=l):(L=T*I,l=c));let E=l?h+L:h,_=c?w+T:w;return{width:S+(l?-L:L),height:C+(c?-T:T),x:r[0]*L*(l?-1:1)+E,y:r[1]*T*(c?-1:1)+_}}var pD={width:0,height:0,x:0,y:0},jj={...pD,pointerX:0,pointerY:0,aspectRatio:1};function Wj(e,t,a){let n=t.position.x+e.position.x,o=t.position.y+e.position.y,r=e.measured.width??0,s=e.measured.height??0,i=a[0]*r,l=a[1]*s;return[[n-i,o-l],[n+r-i,o+s-l]]}function mD({domNode:e,nodeId:t,getStoreItems:a,onChange:n,onEnd:o}){let r=ua(e),s={controlDirection:P6("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function i({controlPosition:c,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:v}){let x={...pD},y={...jj};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:P6(c)};let h,w=null,S=[],C,I,L,T=ax().on("start",A=>{let{nodeLookup:D,transform:H,snapGrid:V,snapToGrid:N,nodeOrigin:P,paneDomNode:E}=a();if(h=D.get(t),!h)return;w=E?.getBoundingClientRect()??null;let{xSnapped:_,ySnapped:z}=Lp(A.sourceEvent,{transform:H,snapGrid:V,snapToGrid:N,containerBounds:w});x={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},y={...x,pointerX:_,pointerY:z,aspectRatio:x.width/x.height},C=void 0,I=Ll(h.extent)?h.extent:void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(C=D.get(h.parentId)),C&&h.extent==="parent"&&(I=[[0,0],[C.measured.width,C.measured.height]]),S=[],L=void 0;for(let[q,O]of D)if(O.parentId===t&&(S.push({id:q,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){let W=Wj(O,h,O.origin??P);L?L=[[Math.min(W[0][0],L[0][0]),Math.min(W[0][1],L[0][1])],[Math.max(W[1][0],L[1][0]),Math.max(W[1][1],L[1][1])]]:L=W}m?.(A,{...x})}).on("drag",A=>{let{transform:D,snapGrid:H,snapToGrid:V,nodeOrigin:N}=a(),P=Lp(A.sourceEvent,{transform:D,snapGrid:H,snapToGrid:V,containerBounds:w}),E=[];if(!h)return;let{x:_,y:z,width:q,height:O}=x,W={},ee=h.origin??N,{width:de,height:ne,x:re,y:ue}=$j(y,s.controlDirection,P,s.boundaries,s.keepAspectRatio,ee,I,L),ce=de!==q,U=ne!==O,M=re!==_&&ce,se=ue!==z&&U;if(!M&&!se&&!ce&&!U)return;let le={prevValues:{...x},startX:y.x,startY:y.y,childNodes:S.map(Y=>({...Y,position:{...Y.position}}))};if((M||se||ee[0]===1||ee[1]===1)&&(W.x=M?re:x.x,W.y=se?ue:x.y,x.x=W.x,x.y=W.y,S.length>0)){let Y=re-_,Le=ue-z;for(let ze of S)ze.position={x:ze.position.x-Y+ee[0]*(de-q),y:ze.position.y-Le+ee[1]*(ne-O)},E.push(ze)}if((ce||U)&&(W.width=ce&&(!s.resizeDirection||s.resizeDirection==="horizontal")?de:x.width,W.height=U&&(!s.resizeDirection||s.resizeDirection==="vertical")?ne:x.height,x.width=W.width,x.height=W.height),C&&h.expandParent){let Y=ee[0]*(W.width??0);W.x&&W.x<Y&&(x.x=Y,y.x=y.x-(W.x-Y));let Le=ee[1]*(W.height??0);W.y&&W.y<Le&&(x.y=Le,y.y=y.y-(W.y-Le))}let B=Gj({width:x.width,prevWidth:q,height:x.height,prevHeight:O,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...x,direction:B};if(v?.(A,G)===!1){x=le.prevValues,y.x=le.startX,y.y=le.startY,S.forEach((Y,Le)=>{Y.position=le.childNodes[Le].position});return}g?.(A,G),n(W,E)}).on("end",A=>{b?.(A,{...x}),o?.({...x})});r.call(T)}function l(){r.on(".drag",null)}return{update:i,destroy:l}}var ID=j(he(),1),ND=j(SD(),1);var CD=e=>{let t,a=new Set,n=(f,u)=>{let d=typeof f=="function"?f(t):f;if(!Object.is(d,t)){let m=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),a.forEach(g=>g(t,m))}},o=()=>t,l={setState:n,getState:o,getInitialState:()=>c,subscribe:f=>(a.add(f),()=>a.delete(f)),destroy:()=>{(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),a.clear()}},c=t=e(n,o,l);return l},kD=e=>e?CD(e):CD;var{useDebugValue:dW}=ID.default,{useSyncExternalStoreWithSelector:fW}=ND.default,pW=e=>e;function r2(e,t=pW,a){let n=fW(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,a);return dW(n),n}var LD=(e,t)=>{let a=kD(e),n=(o,r=t)=>r2(a,o,r);return Object.assign(n,a),n},RD=(e,t)=>e?LD(e,t):LD;function kt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let a=Object.keys(e);if(a.length!==Object.keys(t).length)return!1;for(let n of a)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}var a_=j($r()),Gx=(0,Q.createContext)(null),mW=Gx.Provider,n_=On.error001("react");function je(e,t){let a=(0,Q.useContext)(Gx);if(a===null)throw new Error(n_);return r2(a,e,t)}function yt(){let e=(0,Q.useContext)(Gx);if(e===null)throw new Error(n_);return(0,Q.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var TD={display:"none"},hW={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},o_="react-flow__node-desc",r_="react-flow__edge-desc",gW="react-flow__aria-live",xW=e=>e.ariaLiveMessage,vW=e=>e.ariaLabelConfig;function yW({rfId:e}){let t=je(xW);return(0,K.jsx)("div",{id:`${gW}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:hW,children:t})}function bW({rfId:e,disableKeyboardA11y:t}){let a=je(vW);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("div",{id:`${o_}-${e}`,style:TD,children:t?a["node.a11yDescription.default"]:a["node.a11yDescription.keyboardDisabled"]}),(0,K.jsx)("div",{id:`${r_}-${e}`,style:TD,children:a["edge.a11yDescription.default"]}),!t&&(0,K.jsx)(yW,{rfId:e})]})}var $x=(0,Q.forwardRef)(({position:e="top-left",children:t,className:a,style:n,...o},r)=>{let s=`${e}`.split("-");return(0,K.jsx)("div",{className:Dt(["react-flow__panel",a,...s]),style:n,ref:r,...o,children:t})});$x.displayName="Panel";var MD="https://reactflow.dev?utm_source=attribution";function wW({proOptions:e,position:t="bottom-right"}){return(0,Q.useEffect)(()=>{},[]),e?.hideAttribution?null:(0,K.jsx)($x,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${MD}`,children:(0,K.jsx)("a",{href:MD,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}var SW=e=>{let t=[],a=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,n]of e.edgeLookup)n.selected&&a.push(n);return{selectedNodes:t,selectedEdges:a}},qx=e=>e.id;function CW(e,t){return kt(e.selectedNodes.map(qx),t.selectedNodes.map(qx))&&kt(e.selectedEdges.map(qx),t.selectedEdges.map(qx))}function kW({onSelectionChange:e}){let t=yt(),{selectedNodes:a,selectedEdges:n}=je(SW,CW);return(0,Q.useEffect)(()=>{let o={nodes:a,edges:n};e?.(o),t.getState().onSelectionChangeHandlers.forEach(r=>r(o))},[a,n,e]),null}var LW=e=>!!e.onSelectionChangeHandlers;function IW({onSelectionChange:e}){let t=je(LW);return e||t?(0,K.jsx)(kW,{onSelectionChange:e}):null}var s_=[0,0],NW={x:0,y:0,zoom:1},RW=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],ED=[...RW,"rfId"],TW=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),AD={translateExtent:Lc,nodeOrigin:s_,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function MW(e){let{setNodes:t,setEdges:a,setMinZoom:n,setMaxZoom:o,setTranslateExtent:r,setNodeExtent:s,reset:i,setDefaultNodesAndEdges:l}=je(TW,kt),c=yt();(0,Q.useEffect)(()=>(l(e.defaultNodes,e.defaultEdges),()=>{f.current=AD,i()}),[]);let f=(0,Q.useRef)(AD);return(0,Q.useEffect)(()=>{for(let u of ED){let d=e[u],m=f.current[u];d!==m&&(typeof e[u]>"u"||(u==="nodes"?t(d):u==="edges"?a(d):u==="minZoom"?n(d):u==="maxZoom"?o(d):u==="translateExtent"?r(d):u==="nodeExtent"?s(d):u==="ariaLabelConfig"?c.setState({ariaLabelConfig:G6(d)}):u==="fitView"?c.setState({fitViewQueued:d}):u==="fitViewOptions"?c.setState({fitViewOptions:d}):c.setState({[u]:d})))}f.current=e},ED.map(u=>e[u])),null}function DD(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function EW(e){let[t,a]=(0,Q.useState)(e==="system"?null:e);return(0,Q.useEffect)(()=>{if(e!=="system"){a(e);return}let n=DD(),o=()=>a(n?.matches?"dark":"light");return o(),n?.addEventListener("change",o),()=>{n?.removeEventListener("change",o)}},[e]),t!==null?t:DD()?.matches?"dark":"light"}var _D=typeof document<"u"?document:null;function Tp(e=null,t={target:_D,actInsideInputWithModifier:!0}){let[a,n]=(0,Q.useState)(!1),o=(0,Q.useRef)(!1),r=(0,Q.useRef)(new Set([])),[s,i]=(0,Q.useMemo)(()=>{if(e!==null){let c=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace(/\+/g,`
|
|
@@ -56,16 +56,16 @@ ${o}`),a.dispatchEvent(new Event("input",{bubbles:!0})),a.scrollIntoView({block:
|
|
|
56
56
|
`,`
|
|
57
57
|
+`).split(`
|
|
58
58
|
`)),f=c.reduce((u,d)=>u.concat(...d),[]);return[c,f]}return[[],[]]},[e]);return(0,Q.useEffect)(()=>{let l=t?.target??_D,c=t?.actInsideInputWithModifier??!0;if(e!==null){let f=m=>{if(o.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!o.current||o.current&&!c)&&Kw(m))return!1;let b=OD(m.code,i);if(r.current.add(m[b]),PD(s,r.current,!1)){let v=m.composedPath?.()?.[0]||m.target,x=v?.nodeName==="BUTTON"||v?.nodeName==="A";t.preventDefault!==!1&&(o.current||!x)&&m.preventDefault(),n(!0)}},u=m=>{let g=OD(m.code,i);PD(s,r.current,!0)?(n(!1),r.current.clear()):r.current.delete(m[g]),m.key==="Meta"&&r.current.clear(),o.current=!1},d=()=>{r.current.clear(),n(!1)};return l?.addEventListener("keydown",f),l?.addEventListener("keyup",u),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{l?.removeEventListener("keydown",f),l?.removeEventListener("keyup",u),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,n]),a}function PD(e,t,a){return e.filter(n=>a||n.length===t.size).some(n=>n.every(o=>t.has(o)))}function OD(e,t){return t.includes(e)?"code":"key"}var AW=()=>{let e=yt();return(0,Q.useMemo)(()=>({zoomIn:async t=>{let{panZoom:a}=e.getState();return a?a.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:a}=e.getState();return a?a.scaleBy(1/1.2,t):!1},zoomTo:async(t,a)=>{let{panZoom:n}=e.getState();return n?n.scaleTo(t,a):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,a)=>{let{transform:[n,o,r],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??n,y:t.y??o,zoom:t.zoom??r},a),!0):!1},getViewport:()=>{let[t,a,n]=e.getState().transform;return{x:t,y:a,zoom:n}},setCenter:async(t,a,n)=>e.getState().setCenter(t,a,n),fitBounds:async(t,a)=>{let{width:n,height:o,minZoom:r,maxZoom:s,panZoom:i}=e.getState(),l=Rp(t,n,o,r,s,a?.padding??.1);return i?(await i.setViewport(l,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),!0):!1},screenToFlowPosition:(t,a={})=>{let{transform:n,snapGrid:o,snapToGrid:r,domNode:s}=e.getState();if(!s)return t;let{x:i,y:l}=s.getBoundingClientRect(),c={x:t.x-i,y:t.y-l},f=a.snapGrid??o,u=a.snapToGrid??r;return Tc(c,n,u,f)},flowToScreenPosition:t=>{let{transform:a,domNode:n}=e.getState();if(!n)return t;let{x:o,y:r}=n.getBoundingClientRect(),s=kl(t,a);return{x:s.x+o,y:s.y+r}}}),[])};function i_(e,t){let a=[],n=new Map,o=[];for(let r of e)if(r.type==="add"){o.push(r);continue}else if(r.type==="remove"||r.type==="replace")n.set(r.id,[r]);else{let s=n.get(r.id);s?s.push(r):n.set(r.id,[r])}for(let r of t){let s=n.get(r.id);if(!s){a.push(r);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){a.push({...s[0].item});continue}let i={...r};for(let l of s)DW(l,i);a.push(i)}return o.length&&o.forEach(r=>{r.index!==void 0?a.splice(r.index,0,{...r.item}):a.push({...r.item})}),a}function DW(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function u2(e,t){return i_(e,t)}function _W(e,t){return i_(e,t)}function Il(e,t){return{id:e,type:"select",selected:t}}function Ac(e,t=new Set,a=!1){let n=[];for(let[o,r]of e){let s=t.has(o);!(r.selected===void 0&&!s)&&r.selected!==s&&(a&&(r.selected=s),n.push(Il(r.id,s)))}return n}function zD({items:e=[],lookup:t}){let a=[],n=new Map(e.map(o=>[o.id,o]));for(let[o,r]of e.entries()){let s=t.get(r.id),i=s?.internals?.userNode??s;i!==void 0&&i!==r&&a.push({id:r.id,item:r,type:"replace"}),i===void 0&&a.push({item:r,type:"add",index:o})}for(let[o]of t)n.get(o)===void 0&&a.push({id:o,type:"remove"});return a}function BD(e){return{id:e.id,type:"remove"}}var PW=Gw("React Flow","https://reactflow.dev/");function OW(e,t,a={}){return W6(e,t,{...a,onError:a.onError??PW})}var FD=e=>z6(e),zW=e=>Bw(e);function l_(e){return(0,Q.forwardRef)(e)}var u_=typeof window<"u"?Q.useLayoutEffect:Q.useEffect;function HD(e){let[t,a]=(0,Q.useState)(BigInt(0)),[n]=(0,Q.useState)(()=>BW(()=>a(o=>o+BigInt(1))));return u_(()=>{let o=n.get();o.length&&(e(o),n.reset())},[t]),n}function BW(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:a=>{t.push(a),e()}}}var c_=(0,Q.createContext)(null);function FW({children:e}){let t=yt(),a=(0,Q.useCallback)(i=>{let{nodes:l=[],setNodes:c,hasDefaultNodes:f,onNodesChange:u,nodeLookup:d,fitViewQueued:m,onNodesChangeMiddlewareMap:g}=t.getState(),b=l;for(let x of i)b=typeof x=="function"?x(b):x;let v=zD({items:b,lookup:d});for(let x of g.values())v=x(v);f&&c(b),v.length>0?u?.(v):m&&window.requestAnimationFrame(()=>{let{fitViewQueued:x,nodes:y,setNodes:h}=t.getState();x&&h(y)})},[]),n=HD(a),o=(0,Q.useCallback)(i=>{let{edges:l=[],setEdges:c,hasDefaultEdges:f,onEdgesChange:u,edgeLookup:d}=t.getState(),m=l;for(let g of i)m=typeof g=="function"?g(m):g;f?c(m):u&&u(zD({items:m,lookup:d}))},[]),r=HD(o),s=(0,Q.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,K.jsx)(c_.Provider,{value:s,children:e})}function HW(){let e=(0,Q.useContext)(c_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}var qW=e=>!!e.panZoom;function Mp(){let e=AW(),t=yt(),a=HW(),n=je(qW),o=(0,Q.useMemo)(()=>{let r=u=>t.getState().nodeLookup.get(u),s=u=>{a.nodeQueue.push(u)},i=u=>{a.edgeQueue.push(u)},l=u=>{let{nodeLookup:d,nodeOrigin:m}=t.getState(),g=FD(u)?u:d.get(u.id),b=g.parentId?jw(g.position,g.measured,g.parentId,d,m):g.position,v={...g,position:b,width:g.measured?.width??g.width,height:g.measured?.height??g.height};return Nc(v)},c=(u,d,m={replace:!1})=>{s(g=>g.map(b=>{if(b.id===u){let v=typeof d=="function"?d(b):d;return m.replace&&FD(v)?v:{...b,...v}}return b}))},f=(u,d,m={replace:!1})=>{i(g=>g.map(b=>{if(b.id===u){let v=typeof d=="function"?d(b):d;return m.replace&&zW(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>r(u)?.internals.userNode,getInternalNode:r,getEdges:()=>{let{edges:u=[]}=t.getState();return u.map(d=>({...d}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:s,setEdges:i,addNodes:u=>{let d=Array.isArray(u)?u:[u];a.nodeQueue.push(m=>[...m,...d])},addEdges:u=>{let d=Array.isArray(u)?u:[u];a.edgeQueue.push(m=>[...m,...d])},toObject:()=>{let{nodes:u=[],edges:d=[],transform:m}=t.getState(),[g,b,v]=m;return{nodes:u.map(x=>({...x})),edges:d.map(x=>({...x})),viewport:{x:g,y:b,zoom:v}}},deleteElements:async({nodes:u=[],edges:d=[]})=>{let{nodes:m,edges:g,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:x,triggerEdgeChanges:y,onDelete:h,onBeforeDelete:w}=t.getState(),{nodes:S,edges:C}=await H6({nodesToRemove:u,edgesToRemove:d,nodes:m,edges:g,onBeforeDelete:w}),I=C.length>0,L=S.length>0;if(I){let T=C.map(BD);v?.(C),y(T)}if(L){let T=S.map(BD);b?.(S),x(T)}return(L||I)&&h?.({nodes:S,edges:C}),{deletedNodes:S,deletedEdges:C}},getIntersectingNodes:(u,d=!0,m)=>{let g=Vw(u),b=g?u:l(u),v=m!==void 0;return b?(m||t.getState().nodes).filter(x=>{let y=t.getState().nodeLookup.get(x.id);if(y&&!g&&(x.id===u.id||!y.internals.positionAbsolute))return!1;let h=Nc(v?x:y),w=Np(h,b);return d&&w>0||w>=h.width*h.height||w>=b.width*b.height}):[]},isNodeIntersecting:(u,d,m=!0)=>{let b=Vw(u)?u:l(u);if(!b)return!1;let v=Np(b,d);return m&&v>0||v>=d.width*d.height||v>=b.width*b.height},updateNode:c,updateNodeData:(u,d,m={replace:!1})=>{c(u,g=>{let b=typeof d=="function"?d(g):d;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},updateEdge:f,updateEdgeData:(u,d,m={replace:!1})=>{f(u,g=>{let b=typeof d=="function"?d(g):d;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},getNodesBounds:u=>{let{nodeLookup:d,nodeOrigin:m}=t.getState();return Hw(u,{nodeLookup:d,nodeOrigin:m})},getHandleConnections:({type:u,id:d,nodeId:m})=>Array.from(t.getState().connectionLookup.get(`${m}-${u}${d?`-${d}`:""}`)?.values()??[]),getNodeConnections:({type:u,handleId:d,nodeId:m})=>Array.from(t.getState().connectionLookup.get(`${m}${u?d?`-${u}-${d}`:`-${u}`:""}`)?.values()??[]),fitView:async u=>{let d=t.getState().fitViewResolver??V6();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:d}),a.nodeQueue.push(m=>[...m]),d.promise}}},[]);return(0,Q.useMemo)(()=>({...o,...e,viewportInitialized:n}),[n])}var qD=e=>e.selected,UW=typeof window<"u"?window:void 0;function VW({deleteKeyCode:e,multiSelectionKeyCode:t}){let a=yt(),{deleteElements:n}=Mp(),o=Tp(e,{actInsideInputWithModifier:!1}),r=Tp(t,{target:UW});(0,Q.useEffect)(()=>{if(o){let{edges:s,nodes:i}=a.getState();n({nodes:i.filter(qD),edges:s.filter(qD)}),a.setState({nodesSelectionActive:!1})}},[o]),(0,Q.useEffect)(()=>{a.setState({multiSelectionActive:r})},[r])}function GW(e){let t=yt();(0,Q.useEffect)(()=>{let a=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=Ex(e.current);(n.height===0||n.width===0)&&t.getState().onError?.("004",On.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){a(),window.addEventListener("resize",a);let n=new ResizeObserver(()=>a());return n.observe(e.current),()=>{window.removeEventListener("resize",a),n&&e.current&&n.unobserve(e.current)}}},[])}var jx={position:"absolute",width:"100%",height:"100%",top:0,left:0},$W=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function jW({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:a=!0,panOnScroll:n=!1,panActivationKeyPressed:o,panOnScrollSpeed:r=.5,panOnScrollMode:s=Fr.Free,zoomOnDoubleClick:i=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:f,minZoom:u,maxZoom:d,zoomActivationKeyCode:m,preventScrolling:g=!0,children:b,noWheelClassName:v,noPanClassName:x,onViewportChange:y,isControlledViewport:h,paneClickDistance:w,selectionOnDrag:S}){let C=yt(),I=(0,Q.useRef)(null),{userSelectionActive:L,lib:T,connectionInProgress:A}=je($W,kt),D=Tp(m),H=(0,Q.useRef)();GW(I);let V=(0,Q.useCallback)(N=>{y?.({x:N[0],y:N[1],zoom:N[2]}),h||C.setState({transform:N})},[y,h]);return(0,Q.useEffect)(()=>{if(I.current){H.current=cD({domNode:I.current,minZoom:u,maxZoom:d,translateExtent:f,viewport:c,onDraggingChange:_=>C.setState(z=>z.paneDragging===_?z:{paneDragging:_}),onPanZoomStart:(_,z)=>{let{onViewportChangeStart:q,onMoveStart:O}=C.getState();O?.(_,z),q?.(z)},onPanZoom:(_,z)=>{let{onViewportChange:q,onMove:O}=C.getState();O?.(_,z),q?.(z)},onPanZoomEnd:(_,z)=>{let{onViewportChangeEnd:q,onMoveEnd:O}=C.getState();O?.(_,z),q?.(z)}});let{x:N,y:P,zoom:E}=H.current.getViewport();return C.setState({panZoom:H.current,transform:[N,P,E],domNode:I.current.closest(".react-flow")}),()=>{H.current?.destroy()}}},[]),(0,Q.useEffect)(()=>{H.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:a,panOnScroll:n,panActivationKeyPressed:o,panOnScrollSpeed:r,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:l,zoomActivationKeyPressed:D,preventScrolling:g,noPanClassName:x,userSelectionActive:L,noWheelClassName:v,lib:T,onTransformChange:V,connectionInProgress:A,selectionOnDrag:S,paneClickDistance:w})},[e,t,a,n,o,r,s,i,l,D,g,x,L,v,T,V,A,S,w]),(0,K.jsx)("div",{className:"react-flow__renderer",ref:I,style:jx,children:b})}var WW=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function XW(){let{userSelectionActive:e,userSelectionRect:t}=je(WW,kt);return e&&t?(0,K.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var s2=(e,t)=>a=>{a.target===t.current&&e?.(a)},YW=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function KW({isSelecting:e,selectionKeyPressed:t,selectionMode:a=Sl.Full,panOnDrag:n,autoPanOnSelection:o,paneClickDistance:r,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:f,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:m,onPaneMouseLeave:g,children:b}){let v=(0,Q.useRef)(0),x=yt(),{userSelectionActive:y,elementsSelectable:h,dragging:w,panBy:S,autoPanSpeed:C}=je(YW,kt),I=h&&(e||y),L=(0,Q.useRef)(null),T=(0,Q.useRef)(),A=(0,Q.useRef)(new Set),D=(0,Q.useRef)(new Set),H=(0,Q.useRef)(!1),V=(0,Q.useRef)(!1),N=(0,Q.useRef)({x:0,y:0}),P=(0,Q.useRef)(!1),E=U=>{if(V.current||H.current||x.getState().connection.inProgress){V.current=!1,H.current=!1;return}c?.(U),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},_=U=>{if(Array.isArray(n)&&n?.includes(2)){U.preventDefault();return}f?.(U)},z=u?U=>u(U):void 0,q=U=>{V.current&&(U.stopPropagation(),V.current=!1)},O=U=>{if(U.pointerType==="touch"&&n!==!1&&!t)return;let{domNode:M,transform:se}=x.getState();if(T.current=M?.getBoundingClientRect(),!T.current)return;let le=U.target===L.current;if(!le&&!!U.target.closest(".nokey")||!e||!(s&&le||t)||U.button!==0||!U.isPrimary)return;U.target?.setPointerCapture?.(U.pointerId),V.current=!1;let{x:oe,y:Y}=ro(U.nativeEvent,T.current),Le=Tc({x:oe,y:Y},se);x.setState({userSelectionRect:{width:0,height:0,startX:Le.x,startY:Le.y,x:oe,y:Y}}),le||(U.stopPropagation(),U.preventDefault())};function W(U,M){let{userSelectionRect:se}=x.getState();if(!se)return;let{transform:le,nodeLookup:B,edgeLookup:G,connectionLookup:oe,triggerNodeChanges:Y,triggerEdgeChanges:Le,defaultEdgeOptions:ze}=x.getState(),bt={x:se.startX,y:se.startY},{x:st,y:Gt}=kl(bt,le),Ge={startX:bt.x,startY:bt.y,x:U<st?U:st,y:M<Gt?M:Gt,width:Math.abs(U-st),height:Math.abs(M-Gt)},at=A.current,Ba=D.current;A.current=new Set(Nx(B,Ge,le,a===Sl.Partial,!0).map(bn=>bn.id)),D.current=new Set;let Tt=ze?.selectable??!0;for(let bn of A.current){let lo=oe.get(bn);if(lo)for(let{edgeId:en}of lo.values()){let lr=G.get(en);lr&&(lr.selectable??Tt)&&D.current.add(en)}}if(!Ww(at,A.current)){let bn=Ac(B,A.current,!0);Y(bn)}if(!Ww(Ba,D.current)){let bn=Ac(G,D.current);Le(bn)}x.setState({userSelectionRect:Ge,userSelectionActive:!0,nodesSelectionActive:!1})}function ee(){if(!o||!T.current)return;let[U,M]=Rx(N.current,T.current,C);S({x:U,y:M}).then(se=>{if(!V.current||!se){v.current=requestAnimationFrame(ee);return}let{x:le,y:B}=N.current;W(le,B),v.current=requestAnimationFrame(ee)})}let de=()=>{cancelAnimationFrame(v.current),v.current=0,P.current=!1};(0,Q.useEffect)(()=>()=>de(),[]);let ne=U=>{let{userSelectionRect:M,transform:se,resetSelectedElements:le}=x.getState();if(!T.current||!M)return;let{x:B,y:G}=ro(U.nativeEvent,T.current);N.current={x:B,y:G};let oe=kl({x:M.startX,y:M.startY},se);if(!V.current){let Y=t?0:r;if(Math.hypot(B-oe.x,G-oe.y)<=Y)return;le(),i?.(U)}V.current=!0,P.current||(ee(),P.current=!0),W(B,G)},re=U=>{if(!I){U.target===L.current&&x.getState().connection.inProgress&&(H.current=!0);return}U.button===0&&(U.target?.releasePointerCapture?.(U.pointerId),!y&&U.target===L.current&&x.getState().userSelectionRect&&E?.(U),x.setState({userSelectionActive:!1,userSelectionRect:null}),V.current&&(l?.(U),x.setState({nodesSelectionActive:A.current.size>0})),de())},ue=U=>{U.target?.releasePointerCapture?.(U.pointerId),de()},ce=n===!0||Array.isArray(n)&&n.includes(0);return(0,K.jsxs)("div",{className:Dt(["react-flow__pane",{draggable:ce,dragging:w,selection:e}]),onClick:I?void 0:s2(E,L),onContextMenu:s2(_,L),onWheel:s2(z,L),onPointerEnter:I?void 0:d,onPointerMove:I?ne:m,onPointerUp:re,onPointerCancel:I?ue:void 0,onPointerDownCapture:I?O:void 0,onClickCapture:I?q:void 0,onPointerLeave:g,ref:L,style:jx,children:[b,(0,K.jsx)(XW,{})]})}function l2({id:e,store:t,unselect:a=!1,nodeRef:n}){let{addSelectedNodes:o,unselectNodesAndEdges:r,multiSelectionActive:s,nodeLookup:i,onError:l}=t.getState(),c=i.get(e);if(!c){l?.("012",On.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(a||c.selected&&s)&&(r({nodes:[c],edges:[]}),requestAnimationFrame(()=>n?.current?.blur())):o([e])}function d_({nodeRef:e,disabled:t=!1,noDragClassName:a,handleSelector:n,nodeId:o,isSelectable:r,nodeClickDistance:s}){let i=yt(),[l,c]=(0,Q.useState)(!1),f=(0,Q.useRef)();return(0,Q.useEffect)(()=>{if(!t)return f.current=aD({getStoreItems:()=>i.getState(),onNodeMouseDown:u=>{l2({id:u,store:i,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}}),()=>{f.current?.destroy(),f.current=void 0}},[t,i,e]),(0,Q.useEffect)(()=>{t||!e.current||!f.current||f.current.update({noDragClassName:a,handleSelector:n,domNode:e.current,isSelectable:r,nodeId:o,nodeClickDistance:s})},[a,n,t,r,e,o,s]),l}var ZW=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function f_(){let e=yt();return(0,Q.useCallback)(a=>{let{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:s,onError:i,updateNodePositions:l,nodeLookup:c,nodeOrigin:f}=e.getState(),u=new Map,d=ZW(s),m=o?r[0]:5,g=o?r[1]:5,b=a.direction.x*m*a.factor,v=a.direction.y*g*a.factor;for(let[,x]of c){if(!d(x))continue;let y={x:x.internals.positionAbsolute.x+b,y:x.internals.positionAbsolute.y+v};o&&(y=Rc(y,r));let{position:h,positionAbsolute:w}=qw({nodeId:x.id,nextPosition:y,nodeLookup:c,nodeExtent:n,nodeOrigin:f,onError:i});x.position=h,x.internals.positionAbsolute=w,u.set(x.id,x)}l(u)},[])}var c2=(0,Q.createContext)(null),QW=c2.Provider;c2.Consumer;var p_=()=>(0,Q.useContext)(c2),JW=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),m_=(0,Q.createContext)(null);function eX({children:e}){let t=je(JW,kt);return(0,K.jsx)(m_.Provider,{value:t,children:e})}function tX(){let e=(0,Q.useContext)(m_);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}var aX={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},nX=(e,t,a)=>n=>{let{connectionClickStartHandle:o,connectionMode:r,connection:s}=n,{fromHandle:i,toHandle:l,isValid:c}=s;if(!i&&!o)return aX;let f=l?.nodeId===e&&l?.id===t&&l?.type===a;return{connectingFrom:i?.nodeId===e&&i?.id===t&&i?.type===a,connectingTo:f,clickConnecting:o?.nodeId===e&&o?.id===t&&o?.type===a,isPossibleEndHandle:r===Zs.Strict?i?.type!==a:e!==i?.nodeId||t!==i?.id,connectionInProcess:!!i,clickConnectionInProcess:!!o,valid:f&&c}};function oX({type:e="source",position:t=we.Top,isValidConnection:a,isConnectable:n=!0,isConnectableStart:o=!0,isConnectableEnd:r=!0,id:s,onConnect:i,children:l,className:c,onMouseDown:f,onTouchStart:u,...d},m){let g=s||null,b=e==="target",v=yt(),x=p_(),{connectOnClick:y,noPanClassName:h,rfId:w}=tX(),{connectingFrom:S,connectingTo:C,clickConnecting:I,isPossibleEndHandle:L,connectionInProcess:T,clickConnectionInProcess:A,valid:D}=je(nX(x,g,e),kt);x||v.getState().onError?.("010",On.error010());let H=P=>{let{defaultEdgeOptions:E,onConnect:_,hasDefaultEdges:z}=v.getState(),q={...E,...P};if(z){let{edges:O,setEdges:W,onError:ee}=v.getState();W(OW(q,O,{onError:ee}))}_?.(q),i?.(q)},V=P=>{if(!x)return;let E=Zw(P.nativeEvent);if(o&&(E&&P.button===0||!E)){let _=v.getState();Bx.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:_.autoPanOnConnect,connectionMode:_.connectionMode,connectionRadius:_.connectionRadius,domNode:_.domNode,nodeLookup:_.nodeLookup,lib:_.lib,isTarget:b,handleId:g,nodeId:x,flowId:_.rfId,panBy:_.panBy,cancelConnection:_.cancelConnection,onConnectStart:_.onConnectStart,onConnectEnd:(...z)=>v.getState().onConnectEnd?.(...z),updateConnection:_.updateConnection,onConnect:H,isValidConnection:a||((...z)=>v.getState().isValidConnection?.(...z)??!0),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:_.autoPanSpeed,dragThreshold:_.connectionDragThreshold})}E?f?.(P):u?.(P)},N=P=>{let{onClickConnectStart:E,onClickConnectEnd:_,connectionClickStartHandle:z,connectionMode:q,isValidConnection:O,lib:W,rfId:ee,nodeLookup:de,connection:ne}=v.getState();if(!x||!z&&!o)return;if(!z){E?.(P.nativeEvent,{nodeId:x,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:x,type:e,id:g}});return}let re=Yw(P.target),ue=a||O,{connection:ce,isValid:U}=Bx.isValid(P.nativeEvent,{handle:{nodeId:x,id:g,type:e},connectionMode:q,fromNodeId:z.nodeId,fromHandleId:z.id||null,fromType:z.type,isValidConnection:ue,flowId:ee,doc:re,lib:W,nodeLookup:de});U&&ce&&H(ce);let M=structuredClone(ne);delete M.inProgress,M.toPosition=M.toHandle?M.toHandle.position:null,_?.(P,M),v.setState({connectionClickStartHandle:null})};return(0,K.jsx)("div",{"data-handleid":g,"data-nodeid":x,"data-handlepos":t,"data-id":`${w}-${x}-${g}-${e}`,className:Dt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",h,c,{source:!b,target:b,connectable:n,connectablestart:o,connectableend:r,clickconnecting:I,connectingfrom:S,connectingto:C,valid:D,connectionindicator:n&&(!T||L)&&(T||A?r:o)}]),onMouseDown:V,onTouchStart:V,onClick:y?N:void 0,ref:m,...d,children:l})}var ir=(0,Q.memo)(l_(oX));function rX({data:e,isConnectable:t,sourcePosition:a=we.Bottom}){return(0,K.jsxs)(K.Fragment,{children:[e?.label,(0,K.jsx)(ir,{type:"source",position:a,isConnectable:t})]})}function sX({data:e,isConnectable:t,targetPosition:a=we.Top,sourcePosition:n=we.Bottom}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ir,{type:"target",position:a,isConnectable:t}),e?.label,(0,K.jsx)(ir,{type:"source",position:n,isConnectable:t})]})}function iX(){return null}function lX({data:e,isConnectable:t,targetPosition:a=we.Top}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ir,{type:"target",position:a,isConnectable:t}),e?.label]})}var Vx={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},UD={input:rX,default:sX,output:lX,group:iX};function uX(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var cX=e=>{let{width:t,height:a,x:n,y:o}=Ic(e.nodeLookup,{filter:r=>!!r.selected});return{width:oo(t)?t:null,height:oo(a)?a:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${n}px,${o}px)`}};function dX({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:a}){let n=yt(),{width:o,height:r,transformString:s,userSelectionActive:i}=je(cX,kt),l=f_(),c=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{a||c.current?.focus({preventScroll:!0})},[a]);let f=!i&&o!==null&&r!==null;if(d_({nodeRef:c,disabled:!f}),!f)return null;let u=e?m=>{let g=n.getState().nodes.filter(b=>b.selected);e(m,g)}:void 0,d=m=>{Object.prototype.hasOwnProperty.call(Vx,m.key)&&(m.preventDefault(),l({direction:Vx[m.key],factor:m.shiftKey?4:1}))};return(0,K.jsx)("div",{className:Dt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:(0,K.jsx)("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:a?void 0:-1,onKeyDown:a?void 0:d,style:{width:o,height:r}})})}var VD=typeof window<"u"?window:void 0,fX=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function h_({children:e,onPaneClick:t,onPaneMouseEnter:a,onPaneMouseMove:n,onPaneMouseLeave:o,onPaneContextMenu:r,onPaneScroll:s,paneClickDistance:i,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:f,selectionMode:u,onSelectionStart:d,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:x,zoomOnScroll:y,zoomOnPinch:h,panOnScroll:w,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:I,panOnDrag:L,autoPanOnSelection:T,defaultViewport:A,translateExtent:D,minZoom:H,maxZoom:V,preventScrolling:N,onSelectionContextMenu:P,noWheelClassName:E,noPanClassName:_,disableKeyboardA11y:z,onViewportChange:q,isControlledViewport:O}){let{nodesSelectionActive:W,userSelectionActive:ee}=je(fX,kt),de=Tp(c,{target:VD}),ne=Tp(b,{target:VD}),re=ne||L,ue=ne||w,ce=f&&re!==!0,U=de||ee||ce;return VW({deleteKeyCode:l,multiSelectionKeyCode:g}),(0,K.jsx)(jW,{onPaneContextMenu:r,elementsSelectable:x,zoomOnScroll:y,zoomOnPinch:h,panOnScroll:ue,panActivationKeyPressed:ne,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:I,panOnDrag:!de&&re,defaultViewport:A,translateExtent:D,minZoom:H,maxZoom:V,zoomActivationKeyCode:v,preventScrolling:N,noWheelClassName:E,noPanClassName:_,onViewportChange:q,isControlledViewport:O,paneClickDistance:i,selectionOnDrag:ce,children:(0,K.jsxs)(KW,{onSelectionStart:d,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:a,onPaneMouseMove:n,onPaneMouseLeave:o,onPaneContextMenu:r,onPaneScroll:s,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!U,selectionMode:u,selectionKeyPressed:de,paneClickDistance:i,selectionOnDrag:ce,children:[e,W&&(0,K.jsx)(dX,{onSelectionContextMenu:P,noPanClassName:_,disableKeyboardA11y:z})]})})}h_.displayName="FlowRenderer";var pX=(0,Q.memo)(h_),mX=e=>t=>e?Nx(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(a=>a.id):Array.from(t.nodeLookup.keys());function hX(e){return je((0,Q.useCallback)(mX(e),[e]),kt)}var gX=e=>e.updateNodeInternals;function xX(){let e=je(gX),[t]=(0,Q.useState)(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(a=>{let n=new Map;a.forEach(o=>{let r=o.target.getAttribute("data-id");n.set(r,{id:r,nodeElement:o.target,force:!0})}),e(n)}));return(0,Q.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function vX({node:e,nodeType:t,hasDimensions:a,resizeObserver:n}){let o=yt(),r=(0,Q.useRef)(null),s=(0,Q.useRef)(null),i=(0,Q.useRef)(e.sourcePosition),l=(0,Q.useRef)(e.targetPosition),c=(0,Q.useRef)(t),f=a&&!!e.internals.handleBounds;return(0,Q.useEffect)(()=>{r.current&&!e.hidden&&(!f||s.current!==r.current)&&(s.current&&n?.unobserve(s.current),n?.observe(r.current),s.current=r.current)},[f,e.hidden]),(0,Q.useEffect)(()=>()=>{s.current&&(n?.unobserve(s.current),s.current=null)},[]),(0,Q.useEffect)(()=>{if(r.current){let u=c.current!==t,d=i.current!==e.sourcePosition,m=l.current!==e.targetPosition;(u||d||m)&&(c.current=t,i.current=e.sourcePosition,l.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:r.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),r}function yX({id:e,onClick:t,onMouseEnter:a,onMouseMove:n,onMouseLeave:o,onContextMenu:r,onDoubleClick:s,nodesDraggable:i,elementsSelectable:l,nodesConnectable:c,nodesFocusable:f,resizeObserver:u,noDragClassName:d,noPanClassName:m,disableKeyboardA11y:g,rfId:b,nodeTypes:v,nodeClickDistance:x,onError:y}){let{node:h,internals:w,isParent:S}=je(U=>{let M=U.nodeLookup.get(e),se=U.parentLookup.has(e);return{node:M,internals:M.internals,isParent:se}},kt),C=h.type||"default",I=v?.[C]||UD[C];I===void 0&&(y?.("003",On.error003(C)),C="default",I=v?.default||UD.default);let L=!!(h.draggable||i&&typeof h.draggable>"u"),T=!!(h.selectable||l&&typeof h.selectable>"u"),A=!!(h.connectable||c&&typeof h.connectable>"u"),D=!!(h.focusable||f&&typeof h.focusable>"u"),H=yt(),V=$w(h),N=vX({node:h,nodeType:C,hasDimensions:V,resizeObserver:u}),P=d_({nodeRef:N,disabled:h.hidden||!L,noDragClassName:d,handleSelector:h.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:x}),E=f_();if(h.hidden)return null;let _=io(h),z=uX(h),q=T||L||t||a||n||o,O=a?U=>a(U,{...w.userNode}):void 0,W=n?U=>n(U,{...w.userNode}):void 0,ee=o?U=>o(U,{...w.userNode}):void 0,de=r?U=>r(U,{...w.userNode}):void 0,ne=s?U=>s(U,{...w.userNode}):void 0,re=U=>{let{selectNodesOnDrag:M,nodeDragThreshold:se}=H.getState();T&&(!M||!L||se>0)&&l2({id:e,store:H,nodeRef:N}),t&&t(U,{...w.userNode})},ue=U=>{if(!(Kw(U.nativeEvent)||g)){if(Pw.includes(U.key)&&T){let M=U.key==="Escape";l2({id:e,store:H,unselect:M,nodeRef:N})}else if(L&&h.selected&&Object.prototype.hasOwnProperty.call(Vx,U.key)){U.preventDefault();let{ariaLabelConfig:M}=H.getState();H.setState({ariaLiveMessage:M["node.a11yDescription.ariaLiveMessage"]({direction:U.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),E({direction:Vx[U.key],factor:U.shiftKey?4:1})}}},ce=()=>{if(g||!N.current?.matches(":focus-visible"))return;let{transform:U,width:M,height:se,autoPanOnNodeFocus:le,setCenter:B}=H.getState();if(!le)return;Nx(new Map([[e,h]]),{x:0,y:0,width:M,height:se},U,!0).length>0||B(h.position.x+_.width/2,h.position.y+_.height/2,{zoom:U[2]})};return(0,K.jsx)("div",{className:Dt(["react-flow__node",`react-flow__node-${C}`,{[m]:L},h.className,{selected:h.selected,selectable:T,parent:S,draggable:L,dragging:P}]),ref:N,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:q?"all":"none",visibility:V?"visible":"hidden",...h.style,...z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:W,onMouseLeave:ee,onContextMenu:de,onClick:re,onDoubleClick:ne,onKeyDown:D?ue:void 0,tabIndex:D?0:void 0,onFocus:D?ce:void 0,role:h.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${o_}-${b}`,"aria-label":h.ariaLabel,...h.domAttributes,children:(0,K.jsx)(QW,{value:e,children:(0,K.jsx)(I,{id:e,data:h.data,type:C,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:h.selected??!1,selectable:T,draggable:L,deletable:h.deletable??!0,isConnectable:A,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:P,dragHandle:h.dragHandle,zIndex:w.z,parentId:h.parentId,..._})})})}var bX=(0,Q.memo)(yX),wX=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function g_(e){let{nodesConnectable:t,nodesFocusable:a,elementsSelectable:n,onError:o}=je(wX,kt),r=hX(e.onlyRenderVisibleElements),s=xX();return(0,K.jsx)("div",{className:"react-flow__nodes",style:jx,children:r.map(i=>(0,K.jsx)(bX,{id:i,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:a,elementsSelectable:n,nodeClickDistance:e.nodeClickDistance,onError:o},i))})}g_.displayName="NodeRenderer";var SX=(0,Q.memo)(g_);function CX(e){return je((0,Q.useCallback)(a=>{if(!e)return a.edges.map(o=>o.id);let n=[];if(a.width&&a.height)for(let o of a.edges){let r=a.nodeLookup.get(o.source),s=a.nodeLookup.get(o.target);r&&s&&j6({sourceNode:r,targetNode:s,width:a.width,height:a.height,transform:a.transform})&&n.push(o.id)}return n},[e]),kt)}var kX=({color:e="none",strokeWidth:t=1})=>{let a={strokeWidth:t,...e&&{stroke:e}};return(0,K.jsx)("polyline",{className:"arrow",style:a,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},LX=({color:e="none",strokeWidth:t=1})=>{let a={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,K.jsx)("polyline",{className:"arrowclosed",style:a,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},GD={[so.Arrow]:kX,[so.ArrowClosed]:LX};function IX(e){let t=yt();return(0,Q.useMemo)(()=>Object.prototype.hasOwnProperty.call(GD,e)?GD[e]:(t.getState().onError?.("009",On.error009(e)),null),[e])}var NX=({id:e,type:t,color:a,width:n=12.5,height:o=12.5,markerUnits:r="strokeWidth",strokeWidth:s,orient:i="auto-start-reverse"})=>{let l=IX(t);return l?(0,K.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:r,orient:i,refX:"0",refY:"0",children:(0,K.jsx)(l,{color:a,strokeWidth:s})}):null},x_=({defaultColor:e,rfId:t})=>{let a=je(r=>r.edges),n=je(r=>r.defaultEdgeOptions),o=(0,Q.useMemo)(()=>Y6(a,{id:t,defaultColor:e,defaultMarkerStart:n?.markerStart,defaultMarkerEnd:n?.markerEnd}),[a,n,t,e]);return o.length?(0,K.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,K.jsx)("defs",{children:o.map(r=>(0,K.jsx)(NX,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})}):null};x_.displayName="MarkerDefinitions";var RX=(0,Q.memo)(x_);function v_({x:e,y:t,label:a,labelStyle:n,labelShowBg:o=!0,labelBgStyle:r,labelBgPadding:s=[2,4],labelBgBorderRadius:i=2,children:l,className:c,...f}){let[u,d]=(0,Q.useState)({x:1,y:0,width:0,height:0}),m=Dt(["react-flow__edge-textwrapper",c]),g=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(g.current){let b=g.current.getBBox();d({x:b.x,y:b.y,width:b.width,height:b.height})}},[a]),a?(0,K.jsxs)("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:m,visibility:u.width?"visible":"hidden",...f,children:[o&&(0,K.jsx)("rect",{width:u.width+2*s[0],x:-s[0],y:-s[1],height:u.height+2*s[1],className:"react-flow__edge-textbg",style:r,rx:i,ry:i}),(0,K.jsx)("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:n,children:a}),l]}):null}v_.displayName="EdgeText";var TX=(0,Q.memo)(v_);function Dc({path:e,labelX:t,labelY:a,label:n,labelStyle:o,labelShowBg:r,labelBgStyle:s,labelBgPadding:i,labelBgBorderRadius:l,interactionWidth:c=20,...f}){return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)("path",{...f,d:e,fill:"none",className:Dt(["react-flow__edge-path",f.className])}),c?(0,K.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}):null,n&&oo(t)&&oo(a)?(0,K.jsx)(TX,{x:t,y:a,label:n,labelStyle:o,labelShowBg:r,labelBgStyle:s,labelBgPadding:i,labelBgBorderRadius:l}):null]})}function $D({pos:e,x1:t,y1:a,x2:n,y2:o}){return e===we.Left||e===we.Right?[.5*(t+n),a]:[t,.5*(a+o)]}function y_({sourceX:e,sourceY:t,sourcePosition:a=we.Bottom,targetX:n,targetY:o,targetPosition:r=we.Top}){let[s,i]=$D({pos:a,x1:e,y1:t,x2:n,y2:o}),[l,c]=$D({pos:r,x1:n,y1:o,x2:e,y2:t}),[f,u,d,m]=Ax({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:s,sourceControlY:i,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${i} ${l},${c} ${n},${o}`,f,u,d,m]}function b_(e){return(0,Q.memo)(({id:t,sourceX:a,sourceY:n,targetX:o,targetY:r,sourcePosition:s,targetPosition:i,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:x})=>{let[y,h,w]=y_({sourceX:a,sourceY:n,sourcePosition:s,targetX:o,targetY:r,targetPosition:i}),S=e.isInternal?void 0:t;return(0,K.jsx)(Dc,{id:S,path:y,labelX:h,labelY:w,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:x})})}var MX=b_({isInternal:!1}),w_=b_({isInternal:!0});MX.displayName="SimpleBezierEdge";w_.displayName="SimpleBezierEdgeInternal";function S_(e){return(0,Q.memo)(({id:t,sourceX:a,sourceY:n,targetX:o,targetY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:u,style:d,sourcePosition:m=we.Bottom,targetPosition:g=we.Top,markerEnd:b,markerStart:v,pathOptions:x,interactionWidth:y})=>{let[h,w,S]=Js({sourceX:a,sourceY:n,sourcePosition:m,targetX:o,targetY:r,targetPosition:g,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),C=e.isInternal?void 0:t;return(0,K.jsx)(Dc,{id:C,path:h,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:u,style:d,markerEnd:b,markerStart:v,interactionWidth:y})})}var C_=S_({isInternal:!1}),k_=S_({isInternal:!0});C_.displayName="SmoothStepEdge";k_.displayName="SmoothStepEdgeInternal";function L_(e){return(0,Q.memo)(({id:t,...a})=>{let n=e.isInternal?void 0:t;return(0,K.jsx)(C_,{...a,id:n,pathOptions:(0,Q.useMemo)(()=>({borderRadius:0,offset:a.pathOptions?.offset}),[a.pathOptions?.offset])})})}var EX=L_({isInternal:!1}),I_=L_({isInternal:!0});EX.displayName="StepEdge";I_.displayName="StepEdgeInternal";function N_(e){return(0,Q.memo)(({id:t,sourceX:a,sourceY:n,targetX:o,targetY:r,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:u,style:d,markerEnd:m,markerStart:g,interactionWidth:b})=>{let[v,x,y]=_x({sourceX:a,sourceY:n,targetX:o,targetY:r}),h=e.isInternal?void 0:t;return(0,K.jsx)(Dc,{id:h,path:v,labelX:x,labelY:y,label:s,labelStyle:i,labelShowBg:l,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:u,style:d,markerEnd:m,markerStart:g,interactionWidth:b})})}var AX=N_({isInternal:!1}),R_=N_({isInternal:!0});AX.displayName="StraightEdge";R_.displayName="StraightEdgeInternal";function T_(e){return(0,Q.memo)(({id:t,sourceX:a,sourceY:n,targetX:o,targetY:r,sourcePosition:s=we.Bottom,targetPosition:i=we.Top,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,pathOptions:x,interactionWidth:y})=>{let[h,w,S]=Dx({sourceX:a,sourceY:n,sourcePosition:s,targetX:o,targetY:r,targetPosition:i,curvature:x?.curvature}),C=e.isInternal?void 0:t;return(0,K.jsx)(Dc,{id:C,path:h,labelX:w,labelY:S,label:l,labelStyle:c,labelShowBg:f,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:y})})}var DX=T_({isInternal:!1}),M_=T_({isInternal:!0});DX.displayName="BezierEdge";M_.displayName="BezierEdgeInternal";var jD={default:M_,straight:R_,step:I_,smoothstep:k_,simplebezier:w_},WD={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},_X=(e,t,a)=>a===we.Left?e-t:a===we.Right?e+t:e,PX=(e,t,a)=>a===we.Top?e-t:a===we.Bottom?e+t:e,XD="react-flow__edgeupdater";function YD({position:e,centerX:t,centerY:a,radius:n=10,onMouseDown:o,onMouseEnter:r,onMouseOut:s,type:i}){return(0,K.jsx)("circle",{onMouseDown:o,onMouseEnter:r,onMouseOut:s,className:Dt([XD,`${XD}-${i}`]),cx:_X(t,n,e),cy:PX(a,n,e),r:n,stroke:"transparent",fill:"transparent"})}function OX({isReconnectable:e,reconnectRadius:t,edge:a,sourceX:n,sourceY:o,targetX:r,targetY:s,sourcePosition:i,targetPosition:l,onReconnect:c,onReconnectStart:f,onReconnectEnd:u,setReconnecting:d,setUpdateHover:m}){let g=yt(),b=(w,S)=>{if(w.button!==0)return;let{autoPanOnConnect:C,domNode:I,connectionMode:L,connectionRadius:T,lib:A,onConnectStart:D,cancelConnection:H,nodeLookup:V,rfId:N,panBy:P,updateConnection:E}=g.getState(),_=S.type==="target",z=(W,ee)=>{d(!1),u?.(W,a,S.type,ee)},q=W=>c?.(a,W),O=(W,ee)=>{d(!0),f?.(w,a,S.type),D?.(W,ee)};Bx.onPointerDown(w.nativeEvent,{autoPanOnConnect:C,connectionMode:L,connectionRadius:T,domNode:I,handleId:S.id,nodeId:S.nodeId,nodeLookup:V,isTarget:_,edgeUpdaterType:S.type,lib:A,flowId:N,cancelConnection:H,panBy:P,isValidConnection:(...W)=>g.getState().isValidConnection?.(...W)??!0,onConnect:q,onConnectStart:O,onConnectEnd:(...W)=>g.getState().onConnectEnd?.(...W),onReconnectEnd:z,updateConnection:E,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},v=w=>b(w,{nodeId:a.target,id:a.targetHandle??null,type:"target"}),x=w=>b(w,{nodeId:a.source,id:a.sourceHandle??null,type:"source"}),y=()=>m(!0),h=()=>m(!1);return(0,K.jsxs)(K.Fragment,{children:[(e===!0||e==="source")&&(0,K.jsx)(YD,{position:i,centerX:n,centerY:o,radius:t,onMouseDown:v,onMouseEnter:y,onMouseOut:h,type:"source"}),(e===!0||e==="target")&&(0,K.jsx)(YD,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:x,onMouseEnter:y,onMouseOut:h,type:"target"})]})}function zX({id:e,edgesFocusable:t,edgesReconnectable:a,elementsSelectable:n,onClick:o,onDoubleClick:r,onContextMenu:s,onMouseEnter:i,onMouseMove:l,onMouseLeave:c,reconnectRadius:f,onReconnect:u,onReconnectStart:d,onReconnectEnd:m,rfId:g,edgeTypes:b,noPanClassName:v,onError:x,disableKeyboardA11y:y}){let h=je(B=>B.edgeLookup.get(e)),w=je(B=>B.defaultEdgeOptions);h=w?{...w,...h}:h;let S=h.type||"default",C=b?.[S]||jD[S];C===void 0&&(x?.("011",On.error011(S)),S="default",C=b?.default||jD.default);let I=!!(h.focusable||t&&typeof h.focusable>"u"),L=typeof u<"u"&&(h.reconnectable||a&&typeof h.reconnectable>"u"),T=!!(h.selectable||n&&typeof h.selectable>"u"),A=(0,Q.useRef)(null),[D,H]=(0,Q.useState)(!1),[V,N]=(0,Q.useState)(!1),P=yt(),{zIndex:E=h.zIndex,sourceX:_,sourceY:z,targetX:q,targetY:O,sourcePosition:W,targetPosition:ee}=je((0,Q.useCallback)(B=>{let G=B.nodeLookup.get(h.source),oe=B.nodeLookup.get(h.target);if(!G||!oe)return WD;let Y=X6({id:e,sourceNode:G,targetNode:oe,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:B.connectionMode,onError:x}),Le=$6({selected:h.selected,zIndex:h.zIndex,sourceNode:G,targetNode:oe,elevateOnSelect:B.elevateEdgesOnSelect,zIndexMode:B.zIndexMode});return{...Y||WD,zIndex:Le}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex,x]),kt),de=(0,Q.useMemo)(()=>h.markerStart?`url('#${Px(h.markerStart,g)}')`:void 0,[h.markerStart,g]),ne=(0,Q.useMemo)(()=>h.markerEnd?`url('#${Px(h.markerEnd,g)}')`:void 0,[h.markerEnd,g]);if(h.hidden||_===null||z===null||q===null||O===null)return null;let re=B=>{let{addSelectedEdges:G,unselectNodesAndEdges:oe,multiSelectionActive:Y}=P.getState();T&&(P.setState({nodesSelectionActive:!1}),h.selected&&Y?(oe({nodes:[],edges:[h]}),A.current?.blur()):G([e])),o&&o(B,h)},ue=r?B=>{r(B,{...h})}:void 0,ce=s?B=>{s(B,{...h})}:void 0,U=i?B=>{i(B,{...h})}:void 0,M=l?B=>{l(B,{...h})}:void 0,se=c?B=>{c(B,{...h})}:void 0,le=B=>{if(!y&&Pw.includes(B.key)&&T){let{unselectNodesAndEdges:G,addSelectedEdges:oe}=P.getState();B.key==="Escape"?(A.current?.blur(),G({edges:[h]})):oe([e])}};return(0,K.jsx)("svg",{style:{zIndex:E},children:(0,K.jsxs)("g",{className:Dt(["react-flow__edge",`react-flow__edge-${S}`,h.className,v,{selected:h.selected,animated:h.animated,inactive:!T&&!o,updating:D,selectable:T}]),onClick:re,onDoubleClick:ue,onContextMenu:ce,onMouseEnter:U,onMouseMove:M,onMouseLeave:se,onKeyDown:I?le:void 0,tabIndex:I?0:void 0,role:h.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":I?`${r_}-${g}`:void 0,ref:A,...h.domAttributes,children:[!V&&(0,K.jsx)(C,{id:e,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:T,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:_,sourceY:z,targetX:q,targetY:O,sourcePosition:W,targetPosition:ee,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:de,markerEnd:ne,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),L&&(0,K.jsx)(OX,{edge:h,isReconnectable:L,reconnectRadius:f,onReconnect:u,onReconnectStart:d,onReconnectEnd:m,sourceX:_,sourceY:z,targetX:q,targetY:O,sourcePosition:W,targetPosition:ee,setUpdateHover:H,setReconnecting:N})]})})}var BX=(0,Q.memo)(zX),FX=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function E_({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:a,edgeTypes:n,noPanClassName:o,onReconnect:r,onEdgeContextMenu:s,onEdgeMouseEnter:i,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:f,reconnectRadius:u,onEdgeDoubleClick:d,onReconnectStart:m,onReconnectEnd:g,disableKeyboardA11y:b}){let{edgesFocusable:v,edgesReconnectable:x,elementsSelectable:y,onError:h}=je(FX,kt),w=CX(t);return(0,K.jsxs)("div",{className:"react-flow__edges",children:[(0,K.jsx)(RX,{defaultColor:e,rfId:a}),w.map(S=>(0,K.jsx)(BX,{id:S,edgesFocusable:v,edgesReconnectable:x,elementsSelectable:y,noPanClassName:o,onReconnect:r,onContextMenu:s,onMouseEnter:i,onMouseMove:l,onMouseLeave:c,onClick:f,reconnectRadius:u,onDoubleClick:d,onReconnectStart:m,onReconnectEnd:g,rfId:a,onError:h,edgeTypes:n,disableKeyboardA11y:b},S))]})}E_.displayName="EdgeRenderer";var HX=(0,Q.memo)(E_),KD=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function qX({children:e}){let t=yt(),a=(0,Q.useRef)(null),[n]=(0,Q.useState)(()=>t.getState().transform);return u_(()=>{let o=null,r=()=>{let s=t.getState().transform;o&&s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]||(o=s,a.current&&(a.current.style.transform=KD(s)))};return r(),t.subscribe(r)},[t]),(0,K.jsx)("div",{ref:a,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:KD(n)},children:e})}function UX(e){let t=Mp(),a=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!a.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),a.current=!0)},[e,t.viewportInitialized])}var VX=e=>e.panZoom?.syncViewport;function GX(e){let t=je(VX),a=yt();return(0,Q.useEffect)(()=>{e&&(t?.(e),a.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function ZD(e){return e.connection.inProgress?{...e.connection,to:Tc(e.connection.to,e.transform)}:{...e.connection}}function $X(e){return e?a=>{let n=ZD(a);return e(n)}:ZD}function jX(e){let t=$X(e);return je(t,kt)}var WX=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function XX({containerStyle:e,style:t,type:a,component:n}){let{nodesConnectable:o,width:r,height:s,isValid:i,inProgress:l}=je(WX,kt);return!(r&&o&&l)?null:(0,K.jsx)("svg",{style:e,width:r,height:s,className:"react-flow__connectionline react-flow__container",children:(0,K.jsx)("g",{className:Dt(["react-flow__connection",Xw(i)]),children:(0,K.jsx)(A_,{style:t,type:a,CustomComponent:n,isValid:i})})})}var A_=({style:e,type:t=rr.Bezier,CustomComponent:a,isValid:n})=>{let{inProgress:o,from:r,fromNode:s,fromHandle:i,fromPosition:l,to:c,toNode:f,toHandle:u,toPosition:d,pointer:m}=jX();if(!o)return;if(a)return(0,K.jsx)(a,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:i,fromX:r.x,fromY:r.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:d,connectionStatus:Xw(n),toNode:f,toHandle:u,pointer:m});let g="",b={sourceX:r.x,sourceY:r.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:d};switch(t){case rr.Bezier:[g]=Dx(b);break;case rr.SimpleBezier:[g]=y_(b);break;case rr.Step:[g]=Js({...b,borderRadius:0});break;case rr.SmoothStep:[g]=Js(b);break;default:[g]=_x(b)}return(0,K.jsx)("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};A_.displayName="ConnectionLine";var YX={};function QD(e=YX){let t=(0,Q.useRef)(e),a=yt();(0,Q.useEffect)(()=>{},[e])}function KX(){let e=yt(),t=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{},[])}function D_({nodeTypes:e,edgeTypes:t,onInit:a,onNodeClick:n,onEdgeClick:o,onNodeDoubleClick:r,onEdgeDoubleClick:s,onNodeMouseEnter:i,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:f,onSelectionContextMenu:u,onSelectionStart:d,onSelectionEnd:m,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:x,selectionKeyCode:y,selectionOnDrag:h,selectionMode:w,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:I,deleteKeyCode:L,onlyRenderVisibleElements:T,elementsSelectable:A,defaultViewport:D,translateExtent:H,minZoom:V,maxZoom:N,preventScrolling:P,defaultMarkerColor:E,zoomOnScroll:_,zoomOnPinch:z,panOnScroll:q,panOnScrollSpeed:O,panOnScrollMode:W,zoomOnDoubleClick:ee,panOnDrag:de,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:ue,onPaneMouseMove:ce,onPaneMouseLeave:U,onPaneScroll:M,onPaneContextMenu:se,paneClickDistance:le,nodeClickDistance:B,onEdgeContextMenu:G,onEdgeMouseEnter:oe,onEdgeMouseMove:Y,onEdgeMouseLeave:Le,reconnectRadius:ze,onReconnect:bt,onReconnectStart:st,onReconnectEnd:Gt,noDragClassName:Ge,noWheelClassName:at,noPanClassName:Ba,disableKeyboardA11y:Tt,nodeExtent:bn,rfId:lo,viewport:en,onViewportChange:lr,nodesDraggable:Rl}){return QD(e),QD(t),KX(),UX(a),GX(en),(0,K.jsx)(pX,{onPaneClick:re,onPaneMouseEnter:ue,onPaneMouseMove:ce,onPaneMouseLeave:U,onPaneContextMenu:se,onPaneScroll:M,paneClickDistance:le,deleteKeyCode:L,selectionKeyCode:y,selectionOnDrag:h,selectionMode:w,onSelectionStart:d,onSelectionEnd:m,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:I,elementsSelectable:A,zoomOnScroll:_,zoomOnPinch:z,zoomOnDoubleClick:ee,panOnScroll:q,panOnScrollSpeed:O,panOnScrollMode:W,panOnDrag:de,autoPanOnSelection:ne,defaultViewport:D,translateExtent:H,minZoom:V,maxZoom:N,onSelectionContextMenu:u,preventScrolling:P,noDragClassName:Ge,noWheelClassName:at,noPanClassName:Ba,disableKeyboardA11y:Tt,onViewportChange:lr,isControlledViewport:!!en,children:(0,K.jsxs)(qX,{children:[(0,K.jsx)(HX,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:bt,onReconnectStart:st,onReconnectEnd:Gt,onlyRenderVisibleElements:T,onEdgeContextMenu:G,onEdgeMouseEnter:oe,onEdgeMouseMove:Y,onEdgeMouseLeave:Le,reconnectRadius:ze,defaultMarkerColor:E,noPanClassName:Ba,disableKeyboardA11y:Tt,rfId:lo}),(0,K.jsx)(XX,{style:b,type:g,component:v,containerStyle:x}),(0,K.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,K.jsx)(SX,{nodeTypes:e,onNodeClick:n,onNodeDoubleClick:r,onNodeMouseEnter:i,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:f,nodeClickDistance:B,onlyRenderVisibleElements:T,noPanClassName:Ba,noDragClassName:Ge,disableKeyboardA11y:Tt,nodeExtent:bn,rfId:lo,nodesDraggable:Rl}),(0,K.jsx)("div",{className:"react-flow__viewport-portal"})]})})}D_.displayName="GraphView";var ZX=(0,Q.memo)(D_),QX=Gw("React Flow","https://reactflow.dev/"),JD=({nodes:e,edges:t,defaultNodes:a,defaultEdges:n,width:o,height:r,fitView:s,fitViewOptions:i,minZoom:l=.5,maxZoom:c=2,nodeOrigin:f,nodeExtent:u,zIndexMode:d="basic"}={})=>{let m=new Map,g=new Map,b=new Map,v=new Map,x=n??t??[],y=a??e??[],h=f??[0,0],w=u??Lc;n2(b,v,x);let{nodesInitialized:S}=Ox(y,m,g,{nodeOrigin:h,nodeExtent:w,zIndexMode:d}),C=[0,0,1];if(s&&o&&r){let I=Ic(m,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:L,y:T,zoom:A}=Rp(I,o,r,l,c,i?.padding??.1);C=[L,T,A]}return{rfId:"1",width:o??0,height:r??0,transform:C,nodes:y,nodesInitialized:S,nodeLookup:m,parentLookup:g,edges:x,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:a!==void 0,hasDefaultEdges:n!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:Lc,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Zs.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:i,fitViewResolver:null,connection:{...zw},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:QX,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Ow,zIndexMode:d,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},JX=({nodes:e,edges:t,defaultNodes:a,defaultEdges:n,width:o,height:r,fitView:s,fitViewOptions:i,minZoom:l,maxZoom:c,nodeOrigin:f,nodeExtent:u,zIndexMode:d})=>RD((m,g)=>{async function b(){let{nodeLookup:v,panZoom:x,fitViewOptions:y,fitViewResolver:h,width:w,height:S,minZoom:C,maxZoom:I}=g();x&&(await F6({nodes:v,width:w,height:S,panZoom:x,minZoom:C,maxZoom:I},y),h?.resolve(!0),m({fitViewResolver:null}))}return{...JD({nodes:e,edges:t,width:o,height:r,fitView:s,fitViewOptions:i,minZoom:l,maxZoom:c,nodeOrigin:f,nodeExtent:u,defaultNodes:a,defaultEdges:n,zIndexMode:d}),setNodes:v=>{let{nodeLookup:x,parentLookup:y,nodeOrigin:h,nodeExtent:w,elevateNodesOnSelect:S,fitViewQueued:C,zIndexMode:I,nodesSelectionActive:L}=g(),{nodesInitialized:T,hasSelectedNodes:A}=Ox(v,x,y,{nodeOrigin:h,nodeExtent:w,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:I}),D=L&&A;C&&T?(b(),m({nodes:v,nodesInitialized:T,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:D})):m({nodes:v,nodesInitialized:T,nodesSelectionActive:D})},setEdges:v=>{let{connectionLookup:x,edgeLookup:y}=g();n2(x,y,v),m({edges:v})},setDefaultNodesAndEdges:(v,x)=>{if(v){let{setNodes:y}=g();y(v),m({hasDefaultNodes:!0})}if(x){let{setEdges:y}=g();y(x),m({hasDefaultEdges:!0})}},updateNodeInternals:v=>{let{triggerNodeChanges:x,nodeLookup:y,parentLookup:h,domNode:w,nodeOrigin:S,nodeExtent:C,debug:I,fitViewQueued:L,zIndexMode:T}=g(),{changes:A,updatedInternals:D}=J6(v,y,h,w,S,C,T);D&&(Z6(y,h,{nodeOrigin:S,nodeExtent:C,zIndexMode:T}),L?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),A?.length>0&&(I&&console.log("React Flow: trigger node changes",A),x?.(A)))},updateNodePositions:(v,x=!1)=>{let y=[],h=[],{nodeLookup:w,triggerNodeChanges:S,connection:C,updateConnection:I,onNodesChangeMiddlewareMap:L}=g();for(let[T,A]of v){let D=w.get(T),H=!!(D?.expandParent&&D?.parentId&&A?.position),V={id:T,type:"position",position:H?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:x};if(D&&C.inProgress&&C.fromNode.id===D.id){let N=Qs(D,C.fromHandle,we.Left,!0);I({...C,from:N})}H&&D.parentId&&y.push({id:T,parentId:D.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),h.push(V)}if(y.length>0){let{parentLookup:T,nodeOrigin:A}=g(),D=zx(y,w,T,A);h.push(...D)}for(let T of L.values())h=T(h);S(h)},triggerNodeChanges:v=>{let{onNodesChange:x,setNodes:y,nodes:h,hasDefaultNodes:w,debug:S}=g();if(v?.length){if(w){let C=u2(v,h);y(C)}S&&console.log("React Flow: trigger node changes",v),x?.(v)}},triggerEdgeChanges:v=>{let{onEdgesChange:x,setEdges:y,edges:h,hasDefaultEdges:w,debug:S}=g();if(v?.length){if(w){let C=_W(v,h);y(C)}S&&console.log("React Flow: trigger edge changes",v),x?.(v)}},addSelectedNodes:v=>{let{multiSelectionActive:x,edgeLookup:y,nodeLookup:h,triggerNodeChanges:w,triggerEdgeChanges:S}=g();if(x){let C=v.map(I=>Il(I,!0));w(C);return}w(Ac(h,new Set([...v]),!0)),S(Ac(y))},addSelectedEdges:v=>{let{multiSelectionActive:x,edgeLookup:y,nodeLookup:h,triggerNodeChanges:w,triggerEdgeChanges:S}=g();if(x){let C=v.map(I=>Il(I,!0));S(C);return}S(Ac(y,new Set([...v]))),w(Ac(h,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:x}={})=>{let{edges:y,nodes:h,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:C}=g(),I=v||h,L=x||y,T=[];for(let D of I){if(!D.selected)continue;let H=w.get(D.id);H&&(H.selected=!1),T.push(Il(D.id,!1))}let A=[];for(let D of L)D.selected&&A.push(Il(D.id,!1));S(T),C(A)},setMinZoom:v=>{let{panZoom:x,maxZoom:y}=g();x?.setScaleExtent([v,y]),m({minZoom:v})},setMaxZoom:v=>{let{panZoom:x,minZoom:y}=g();x?.setScaleExtent([y,v]),m({maxZoom:v})},setTranslateExtent:v=>{g().panZoom?.setTranslateExtent(v),m({translateExtent:v})},resetSelectedElements:()=>{let{edges:v,nodes:x,triggerNodeChanges:y,triggerEdgeChanges:h,elementsSelectable:w}=g();if(!w)return;let S=x.reduce((I,L)=>L.selected?[...I,Il(L.id,!1)]:I,[]),C=v.reduce((I,L)=>L.selected?[...I,Il(L.id,!1)]:I,[]);y(S),h(C)},setNodeExtent:v=>{let{nodes:x,nodeLookup:y,parentLookup:h,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:C,zIndexMode:I}=g();v[0][0]===C[0][0]&&v[0][1]===C[0][1]&&v[1][0]===C[1][0]&&v[1][1]===C[1][1]||(Ox(x,y,h,{nodeOrigin:w,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:I}),m({nodeExtent:v}))},panBy:v=>{let{transform:x,width:y,height:h,panZoom:w,translateExtent:S}=g();return eD({delta:v,panZoom:w,transform:x,translateExtent:S,width:y,height:h})},setCenter:async(v,x,y)=>{let{width:h,height:w,maxZoom:S,panZoom:C}=g();if(!C)return!1;let I=typeof y?.zoom<"u"?y.zoom:S;return await C.setViewport({x:h/2-v*I,y:w/2-x*I,zoom:I},{duration:y?.duration,ease:y?.ease,interpolate:y?.interpolate}),!0},cancelConnection:()=>{m({connection:{...zw}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...JD()})}},Object.is);function d2({initialNodes:e,initialEdges:t,defaultNodes:a,defaultEdges:n,initialWidth:o,initialHeight:r,initialMinZoom:s,initialMaxZoom:i,initialFitViewOptions:l,fitView:c,nodeOrigin:f,nodeExtent:u,zIndexMode:d,children:m}){let[g]=(0,Q.useState)(()=>JX({nodes:e,edges:t,defaultNodes:a,defaultEdges:n,width:o,height:r,fitView:c,minZoom:s,maxZoom:i,fitViewOptions:l,nodeOrigin:f,nodeExtent:u,zIndexMode:d}));return(0,K.jsx)(mW,{value:g,children:(0,K.jsx)(FW,{children:(0,K.jsx)(eX,{children:m})})})}function eY({children:e,nodes:t,edges:a,defaultNodes:n,defaultEdges:o,width:r,height:s,fitView:i,fitViewOptions:l,minZoom:c,maxZoom:f,nodeOrigin:u,nodeExtent:d,zIndexMode:m}){return(0,Q.useContext)(Gx)?(0,K.jsx)(K.Fragment,{children:e}):(0,K.jsx)(d2,{initialNodes:t,initialEdges:a,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:s,fitView:i,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:f,nodeOrigin:u,nodeExtent:d,zIndexMode:m,children:e})}var tY={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function aY({nodes:e,edges:t,defaultNodes:a,defaultEdges:n,className:o,nodeTypes:r,edgeTypes:s,onNodeClick:i,onEdgeClick:l,onInit:c,onMove:f,onMoveStart:u,onMoveEnd:d,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:x,onNodeMouseEnter:y,onNodeMouseMove:h,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:C,onNodeDragStart:I,onNodeDrag:L,onNodeDragStop:T,onNodesDelete:A,onEdgesDelete:D,onDelete:H,onSelectionChange:V,onSelectionDragStart:N,onSelectionDrag:P,onSelectionDragStop:E,onSelectionContextMenu:_,onSelectionStart:z,onSelectionEnd:q,onBeforeDelete:O,connectionMode:W,connectionLineType:ee=rr.Bezier,connectionLineStyle:de,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:ue="Backspace",selectionKeyCode:ce="Shift",selectionOnDrag:U=!1,selectionMode:M=Sl.Full,panActivationKeyCode:se="Space",multiSelectionKeyCode:le=Mc()?"Meta":"Control",zoomActivationKeyCode:B=Mc()?"Meta":"Control",snapToGrid:G,snapGrid:oe,onlyRenderVisibleElements:Y=!1,selectNodesOnDrag:Le,nodesDraggable:ze,autoPanOnNodeFocus:bt,nodesConnectable:st,nodesFocusable:Gt,nodeOrigin:Ge=s_,edgesFocusable:at,edgesReconnectable:Ba,elementsSelectable:Tt=!0,defaultViewport:bn=NW,minZoom:lo=.5,maxZoom:en=2,translateExtent:lr=Lc,preventScrolling:Rl=!0,nodeExtent:ai,defaultMarkerColor:qr="#b1b1b7",zoomOnScroll:Ap=!0,zoomOnPinch:Ur=!0,panOnScroll:Kx=!1,panOnScrollSpeed:Zx=.5,panOnScrollMode:Dp=Fr.Free,zoomOnDoubleClick:_p=!0,panOnDrag:zn=!0,onPaneClick:Qx,onPaneMouseEnter:_c,onPaneMouseMove:Mo,onPaneMouseLeave:Pp,onPaneScroll:Jx,onPaneContextMenu:Op,paneClickDistance:zp=1,nodeClickDistance:Ae=0,children:Bt,onReconnect:Jt,onReconnectStart:Ia,onReconnectEnd:ni,onEdgeContextMenu:$t,onEdgeDoubleClick:tn,onEdgeMouseEnter:Bn,onEdgeMouseMove:Pc,onEdgeMouseLeave:Fn,reconnectRadius:Oc=10,onNodesChange:C8,onEdgesChange:k8,noDragClassName:L8="nodrag",noWheelClassName:I8="nowheel",noPanClassName:w2="nopan",fitView:S2,fitViewOptions:C2,connectOnClick:N8,attributionPosition:R8,proOptions:T8,defaultEdgeOptions:M8,elevateNodesOnSelect:E8=!0,elevateEdgesOnSelect:A8=!1,disableKeyboardA11y:k2=!1,autoPanOnConnect:D8,autoPanOnNodeDrag:_8,autoPanOnSelection:P8=!0,autoPanSpeed:O8,connectionRadius:z8,isValidConnection:B8,onError:F8,style:H8,id:L2,nodeDragThreshold:q8,connectionDragThreshold:U8,viewport:V8,onViewportChange:G8,width:$8,height:j8,colorMode:W8="light",debug:X8,onScroll:I2,ariaLabelConfig:Y8,zIndexMode:N2="basic",...K8},Z8){let e0=L2||"1",Q8=EW(W8),J8=(0,Q.useCallback)(R2=>{R2.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),I2?.(R2)},[I2]);return(0,K.jsx)("div",{"data-testid":"rf__wrapper",...K8,onScroll:J8,style:{...H8,...tY},ref:Z8,className:Dt(["react-flow",o,Q8]),id:L2,role:"application",children:(0,K.jsxs)(eY,{nodes:e,edges:t,width:$8,height:j8,fitView:S2,fitViewOptions:C2,minZoom:lo,maxZoom:en,nodeOrigin:Ge,nodeExtent:ai,zIndexMode:N2,children:[(0,K.jsx)(MW,{nodes:e,edges:t,defaultNodes:a,defaultEdges:n,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:x,nodesDraggable:ze,autoPanOnNodeFocus:bt,nodesConnectable:st,nodesFocusable:Gt,edgesFocusable:at,edgesReconnectable:Ba,elementsSelectable:Tt,elevateNodesOnSelect:E8,elevateEdgesOnSelect:A8,minZoom:lo,maxZoom:en,nodeExtent:ai,onNodesChange:C8,onEdgesChange:k8,snapToGrid:G,snapGrid:oe,connectionMode:W,translateExtent:lr,connectOnClick:N8,defaultEdgeOptions:M8,fitView:S2,fitViewOptions:C2,onNodesDelete:A,onEdgesDelete:D,onDelete:H,onNodeDragStart:I,onNodeDrag:L,onNodeDragStop:T,onSelectionDrag:P,onSelectionDragStart:N,onSelectionDragStop:E,onMove:f,onMoveStart:u,onMoveEnd:d,noPanClassName:w2,nodeOrigin:Ge,rfId:e0,autoPanOnConnect:D8,autoPanOnNodeDrag:_8,autoPanSpeed:O8,onError:F8,connectionRadius:z8,isValidConnection:B8,selectNodesOnDrag:Le,nodeDragThreshold:q8,connectionDragThreshold:U8,onBeforeDelete:O,debug:X8,ariaLabelConfig:Y8,zIndexMode:N2}),(0,K.jsx)(ZX,{onInit:c,onNodeClick:i,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:h,onNodeMouseLeave:w,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:r,edgeTypes:s,connectionLineType:ee,connectionLineStyle:de,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:ce,selectionOnDrag:U,selectionMode:M,deleteKeyCode:ue,multiSelectionKeyCode:le,panActivationKeyCode:se,zoomActivationKeyCode:B,onlyRenderVisibleElements:Y,defaultViewport:bn,translateExtent:lr,minZoom:lo,maxZoom:en,preventScrolling:Rl,zoomOnScroll:Ap,zoomOnPinch:Ur,zoomOnDoubleClick:_p,panOnScroll:Kx,panOnScrollSpeed:Zx,panOnScrollMode:Dp,panOnDrag:zn,autoPanOnSelection:P8,onPaneClick:Qx,onPaneMouseEnter:_c,onPaneMouseMove:Mo,onPaneMouseLeave:Pp,onPaneScroll:Jx,onPaneContextMenu:Op,paneClickDistance:zp,nodeClickDistance:Ae,onSelectionContextMenu:_,onSelectionStart:z,onSelectionEnd:q,onReconnect:Jt,onReconnectStart:Ia,onReconnectEnd:ni,onEdgeContextMenu:$t,onEdgeDoubleClick:tn,onEdgeMouseEnter:Bn,onEdgeMouseMove:Pc,onEdgeMouseLeave:Fn,reconnectRadius:Oc,defaultMarkerColor:qr,noDragClassName:L8,noWheelClassName:I8,noPanClassName:w2,rfId:e0,disableKeyboardA11y:k2,nodeExtent:ai,viewport:V8,onViewportChange:G8,nodesDraggable:ze}),(0,K.jsx)(IW,{onSelectionChange:V}),Bt,(0,K.jsx)(wW,{proOptions:T8,position:R8}),(0,K.jsx)(bW,{rfId:e0,disableKeyboardA11y:k2})]})})}var __=l_(aY),nY=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function P_({children:e}){let t=je(nY);return t?(0,a_.createPortal)(e,t):null}var ohe=On.error014();function oY({dimensions:e,lineWidth:t,variant:a,className:n}){return(0,K.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Dt(["react-flow__background-pattern",a,n])})}function rY({radius:e,className:t}){return(0,K.jsx)("circle",{cx:e,cy:e,r:e,className:Dt(["react-flow__background-pattern","dots",t])})}var sr;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(sr||(sr={}));var sY={[sr.Dots]:1,[sr.Lines]:1,[sr.Cross]:6},iY=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function O_({id:e,variant:t=sr.Dots,gap:a=20,size:n,lineWidth:o=1,offset:r=0,color:s,bgColor:i,style:l,className:c,patternClassName:f}){let u=(0,Q.useRef)(null),{transform:d,patternId:m}=je(iY,kt),g=n||sY[t],b=t===sr.Dots,v=t===sr.Cross,x=Array.isArray(a)?a:[a,a],y=[x[0]*d[2]||1,x[1]*d[2]||1],h=g*d[2],w=Array.isArray(r)?r:[r,r],S=v?[h,h]:y,C=[w[0]*d[2]+S[0]/2,w[1]*d[2]+S[1]/2],I=`${m}${e||""}`;return(0,K.jsxs)("svg",{className:Dt(["react-flow__background",c]),style:{...l,...jx,"--xy-background-color-props":i,"--xy-background-pattern-color-props":s},ref:u,"data-testid":"rf__background",children:[(0,K.jsx)("pattern",{id:I,x:d[0]%y[0],y:d[1]%y[1],width:y[0],height:y[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:b?(0,K.jsx)(rY,{radius:h/2,className:f}):(0,K.jsx)(oY,{dimensions:S,lineWidth:o,variant:t,className:f})}),(0,K.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}O_.displayName="Background";var z_=(0,Q.memo)(O_);function lY(){return(0,K.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,K.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function uY(){return(0,K.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,K.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function cY(){return(0,K.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,K.jsx)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function dY(){return(0,K.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,K.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function fY(){return(0,K.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,K.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Ux({children:e,className:t,...a}){return(0,K.jsx)("button",{type:"button",className:Dt(["react-flow__controls-button",t]),...a,children:e})}var pY=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function B_({style:e,showZoom:t=!0,showFitView:a=!0,showInteractive:n=!0,fitViewOptions:o,onZoomIn:r,onZoomOut:s,onFitView:i,onInteractiveChange:l,className:c,children:f,position:u="bottom-left",orientation:d="vertical","aria-label":m}){let g=yt(),{isInteractive:b,minZoomReached:v,maxZoomReached:x,ariaLabelConfig:y}=je(pY,kt),{zoomIn:h,zoomOut:w,fitView:S}=Mp(),C=()=>{h(),r?.()},I=()=>{w(),s?.()},L=()=>{S(o),i?.()},T=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),l?.(!b)};return(0,K.jsxs)($x,{className:Dt(["react-flow__controls",d==="horizontal"?"horizontal":"vertical",c]),position:u,style:e,"data-testid":"rf__controls","aria-label":m??y["controls.ariaLabel"],children:[t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ux,{onClick:C,className:"react-flow__controls-zoomin",title:y["controls.zoomIn.ariaLabel"],"aria-label":y["controls.zoomIn.ariaLabel"],disabled:x,children:(0,K.jsx)(lY,{})}),(0,K.jsx)(Ux,{onClick:I,className:"react-flow__controls-zoomout",title:y["controls.zoomOut.ariaLabel"],"aria-label":y["controls.zoomOut.ariaLabel"],disabled:v,children:(0,K.jsx)(uY,{})})]}),a&&(0,K.jsx)(Ux,{className:"react-flow__controls-fitview",onClick:L,title:y["controls.fitView.ariaLabel"],"aria-label":y["controls.fitView.ariaLabel"],children:(0,K.jsx)(cY,{})}),n&&(0,K.jsx)(Ux,{className:"react-flow__controls-interactive",onClick:T,title:y["controls.interactive.ariaLabel"],"aria-label":y["controls.interactive.ariaLabel"],children:b?(0,K.jsx)(fY,{}):(0,K.jsx)(dY,{})}),f]})}B_.displayName="Controls";var F_=(0,Q.memo)(B_);function mY({id:e,x:t,y:a,width:n,height:o,style:r,color:s,strokeColor:i,strokeWidth:l,className:c,borderRadius:f,shapeRendering:u,selected:d,onClick:m}){let{background:g,backgroundColor:b}=r||{},v=s||g||b;return(0,K.jsx)("rect",{className:Dt(["react-flow__minimap-node",{selected:d},c]),x:t,y:a,rx:f,ry:f,width:n,height:o,style:{fill:v,stroke:i,strokeWidth:l},shapeRendering:u,onClick:m?x=>m(x,e):void 0})}var hY=(0,Q.memo)(mY),gY=e=>e.nodes.map(t=>t.id),i2=e=>e instanceof Function?e:()=>e;function xY({nodeStrokeColor:e,nodeColor:t,nodeClassName:a="",nodeBorderRadius:n=5,nodeStrokeWidth:o,nodeComponent:r=hY,onClick:s}){let i=je(gY,kt),l=i2(t),c=i2(e),f=i2(a),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return(0,K.jsx)(K.Fragment,{children:i.map(d=>(0,K.jsx)(yY,{id:d,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:f,nodeBorderRadius:n,nodeStrokeWidth:o,NodeComponent:r,onClick:s,shapeRendering:u},d))})}function vY({id:e,nodeColorFunc:t,nodeStrokeColorFunc:a,nodeClassNameFunc:n,nodeBorderRadius:o,nodeStrokeWidth:r,shapeRendering:s,NodeComponent:i,onClick:l}){let{node:c,x:f,y:u,width:d,height:m}=je(g=>{let b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};let v=b.internals.userNode,{x,y}=b.internals.positionAbsolute,{width:h,height:w}=io(v);return{node:v,x,y,width:h,height:w}},kt);return!c||c.hidden||!$w(c)?null:(0,K.jsx)(i,{x:f,y:u,width:d,height:m,style:c.style,selected:!!c.selected,className:n(c),color:t(c),borderRadius:o,strokeColor:a(c),strokeWidth:r,shapeRendering:s,onClick:l,id:c.id})}var yY=(0,Q.memo)(vY),bY=(0,Q.memo)(xY),wY=200,SY=150,CY=e=>!e.hidden,kY=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]},a=!1;for(let n of e.nodeLookup.values())if(!n.hidden){a=!0;break}return{viewBB:t,boundingRect:a?Uw(Ic(e.nodeLookup,{filter:CY}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},e_=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,LY=(e,t)=>e_(e.viewBB,t.viewBB)&&e_(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,IY="react-flow__minimap-desc";function H_({style:e,className:t,nodeStrokeColor:a,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i,bgColor:l,maskColor:c,maskStrokeColor:f,maskStrokeWidth:u,position:d="bottom-right",onClick:m,onNodeClick:g,pannable:b=!1,zoomable:v=!1,ariaLabel:x,inversePan:y,zoomStep:h=1,offsetScale:w=5}){let S=yt(),C=(0,Q.useRef)(null),{boundingRect:I,panZoom:L,viewBB:T,rfId:A,translateExtent:D,flowWidth:H,flowHeight:V,ariaLabelConfig:N}=je(kY,LY),P=e?.width??wY,E=e?.height??SY,_=I.width/P,z=I.height/E,q=Math.max(_,z),O=q*P,W=q*E,ee=w*q,de=I.x-(O-I.width)/2-ee,ne=I.y-(W-I.height)/2-ee,re=O+ee*2,ue=W+ee*2,ce=`${IY}-${A}`,U=(0,Q.useRef)(0),M=(0,Q.useRef)();U.current=q,(0,Q.useEffect)(()=>{let oe=S.getState().panZoom;if(C.current&&oe)return M.current=iD({domNode:C.current,panZoom:oe,getTransform:()=>S.getState().transform,getViewScale:()=>U.current}),()=>{M.current?.destroy()}},[L]),(0,Q.useEffect)(()=>{M.current?.update({translateExtent:D,width:H,height:V,inversePan:y,pannable:b,zoomStep:h,zoomable:v})},[b,v,y,h,D,H,V]);let se=m?oe=>{let[Y,Le]=M.current?.pointer(oe)||[0,0];m(oe,{x:Y,y:Le})}:void 0,le=(0,Q.useCallback)((oe,Y)=>{let Le=S.getState().nodeLookup.get(Y).internals.userNode;g?.(oe,Le)},[g]),B=g?le:void 0,G=x??N["minimap.ariaLabel"];return(0,K.jsx)($x,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*q:void 0,"--xy-minimap-node-background-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-color-props":typeof a=="string"?a:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:Dt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,K.jsxs)("svg",{width:P,height:E,viewBox:`${de} ${ne} ${re} ${ue}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ce,ref:C,onClick:se,children:[G&&(0,K.jsx)("title",{id:ce,children:G}),(0,K.jsx)(bY,{onClick:B,nodeColor:n,nodeStrokeColor:a,nodeBorderRadius:r,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:i}),(0,K.jsx)("path",{className:"react-flow__minimap-mask",d:`M${de-ee},${ne-ee}h${re+ee*2}v${ue+ee*2}h${-re-ee*2}z
|
|
59
|
-
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}H_.displayName="MiniMap";var rhe=(0,Q.memo)(H_),NY=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,RY={[Hr.Line]:"right",[Hr.Handle]:"bottom-right"};function TY({nodeId:e,position:t,variant:a=Hr.Handle,className:n,style:o=void 0,children:r,color:s,minWidth:i=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:d,autoScale:m=!0,shouldResize:g,onResizeStart:b,onResize:v,onResizeEnd:x}){let y=p_(),h=typeof e=="string"?e:y,w=yt(),S=(0,Q.useRef)(null),C=a===Hr.Handle,I=je((0,Q.useCallback)(NY(C&&m),[C,m]),kt),L=(0,Q.useRef)(null),T=t??RY[a];(0,Q.useEffect)(()=>{if(!(!S.current||!h))return L.current||(L.current=mD({domNode:S.current,nodeId:h,getStoreItems:()=>{let{nodeLookup:D,transform:H,snapGrid:V,snapToGrid:N,nodeOrigin:P,domNode:E}=w.getState();return{nodeLookup:D,transform:H,snapGrid:V,snapToGrid:N,nodeOrigin:P,paneDomNode:E}},onChange:(D,H)=>{let{triggerNodeChanges:V,nodeLookup:N,parentLookup:P,nodeOrigin:E}=w.getState(),_=[],z={x:D.x,y:D.y},q=N.get(h);if(q&&q.expandParent&&q.parentId){let O=q.origin??E,W=D.width??q.measured.width??0,ee=D.height??q.measured.height??0,de={id:q.id,parentId:q.parentId,rect:{width:W,height:ee,...jw({x:D.x??q.position.x,y:D.y??q.position.y},{width:W,height:ee},q.parentId,N,O)}},ne=zx([de],N,P,E);_.push(...ne),z.x=D.x?Math.max(O[0]*W,D.x):void 0,z.y=D.y?Math.max(O[1]*ee,D.y):void 0}if(z.x!==void 0&&z.y!==void 0){let O={id:h,type:"position",position:{...z}};_.push(O)}if(D.width!==void 0&&D.height!==void 0){let W={id:h,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};_.push(W)}for(let O of H){let W={...O,type:"position"};_.push(W)}V(_)},onEnd:({width:D,height:H})=>{let V={id:h,type:"dimensions",resizing:!1,dimensions:{width:D,height:H}};w.getState().triggerNodeChanges([V])}})),L.current.update({controlPosition:T,boundaries:{minWidth:i,minHeight:l,maxWidth:c,maxHeight:f},keepAspectRatio:u,resizeDirection:d,onResizeStart:b,onResize:v,onResizeEnd:x,shouldResize:g}),()=>{L.current?.destroy()}},[T,i,l,c,f,u,b,v,x,g]);let A=T.split("-");return(0,K.jsx)("div",{className:Dt(["react-flow__resize-control","nodrag",...A,a,n]),ref:S,style:{...o,scale:I,...s&&{[C?"backgroundColor":"borderColor"]:s}},children:r})}var t_=(0,Q.memo)(TY);function q_({nodeId:e,isVisible:t=!0,handleClassName:a,handleStyle:n,lineClassName:o,lineStyle:r,color:s,minWidth:i=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:u=!1,autoScale:d=!0,shouldResize:m,onResizeStart:g,onResize:b,onResizeEnd:v}){return t?(0,K.jsxs)(K.Fragment,{children:[fD.map(x=>(0,K.jsx)(t_,{className:o,style:r,nodeId:e,position:x,variant:Hr.Line,color:s,minWidth:i,minHeight:l,maxWidth:c,maxHeight:f,onResizeStart:g,keepAspectRatio:u,autoScale:d,shouldResize:m,onResize:b,onResizeEnd:v},x)),dD.map(x=>(0,K.jsx)(t_,{className:a,style:n,nodeId:e,position:x,color:s,minWidth:i,minHeight:l,maxWidth:c,maxHeight:f,onResizeStart:g,keepAspectRatio:u,autoScale:d,shouldResize:m,onResize:b,onResizeEnd:v},x))]}):null}var me=j(he(),1);var p=j(fe(),1);function ei({name:e,size:t="sm"}){let a=[...e].reduce((o,r)=>(o*31+r.charCodeAt(0))%360,7),n=e.split(/[\s._-]+/).filter(Boolean).map(o=>o[0].toUpperCase()).slice(0,2).join("")||e.slice(0,2).toUpperCase();return(0,p.jsx)("span",{title:e,"aria-label":e,className:te("inline-flex shrink-0 items-center justify-center rounded-full font-semibold text-white",t==="sm"?"size-5 text-[9px]":"size-7 text-[11px]"),style:{background:`hsl(${a} 45% 45%)`},children:n})}var Ep={slate:"#64748b",blue:"#3b82f6",violet:"#8b5cf6",amber:"#d97706",green:"#059669",rose:"#e11d48"},G_={inbox:(0,p.jsx)(qi,{className:"size-3.5","aria-hidden":"true"}),task:(0,p.jsx)(cf,{className:"size-3.5","aria-hidden":"true"}),report:(0,p.jsx)(If,{className:"size-3.5","aria-hidden":"true"}),approval:(0,p.jsx)(Ef,{className:"size-3.5","aria-hidden":"true"}),notify:(0,p.jsx)(vf,{className:"size-3.5","aria-hidden":"true"}),done:(0,p.jsx)(rf,{className:"size-3.5","aria-hidden":"true"}),check:(0,p.jsx)(to,{className:"size-3.5","aria-hidden":"true"}),"pull-request":(0,p.jsx)(Ns,{className:"size-3.5","aria-hidden":"true"}),update:(0,p.jsx)(yf,{className:"size-3.5","aria-hidden":"true"}),sort:(0,p.jsx)(ju,{className:"size-3.5","aria-hidden":"true"}),draft:(0,p.jsx)(Ms,{className:"size-3.5","aria-hidden":"true"}),request:(0,p.jsx)(uf,{className:"size-3.5","aria-hidden":"true"}),email:(0,p.jsx)(Gu,{className:"size-3.5","aria-hidden":"true"}),tool:(0,p.jsx)(Vi,{className:"size-3.5","aria-hidden":"true"}),wait:(0,p.jsx)(ff,{className:"size-3.5","aria-hidden":"true"}),teammate:(0,p.jsx)(zi,{className:"size-3.5","aria-hidden":"true"}),send:(0,p.jsx)(Nf,{className:"size-3.5","aria-hidden":"true"}),choose:(0,p.jsx)(Tf,{className:"size-3.5","aria-hidden":"true"})};function f2({sorted:e}){return(0,p.jsxs)("span",{className:te("inline-flex max-w-full items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium",!e.confident&&"text-warning"),title:e.confident?"Sorted by Jev":"Jev wasn't sure","data-sort-chip":!0,children:[(0,p.jsx)(ju,{className:"size-3 shrink-0",style:{color:e.confident?Ep.violet:void 0},"aria-hidden":"true"}),(0,p.jsx)("span",{className:"truncate",children:e.confident?e.chip:`Not sure · ${e.chip}`})]})}var $_={button:(0,p.jsx)($u,{className:"size-3.5","aria-hidden":"true"}),schedule:(0,p.jsx)(Jd,{className:"size-3.5","aria-hidden":"true"}),github:(0,p.jsx)(Ns,{className:"size-3.5","aria-hidden":"true"}),linear:(0,p.jsx)(Es,{className:"size-3.5","aria-hidden":"true"}),flow:(0,p.jsx)(Ui,{className:"size-3.5","aria-hidden":"true"}),webhook:(0,p.jsx)(Af,{className:"size-3.5","aria-hidden":"true"}),email:(0,p.jsx)(Gu,{className:"size-3.5","aria-hidden":"true"}),chat:(0,p.jsx)(Ts,{className:"size-3.5","aria-hidden":"true"})};async function ca(e,t,a){let n=new URLSearchParams({csrf:a,...t});try{let o=await fetch(e,{method:"POST",body:n,credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(2e4)}),r=await o.json();return{ok:r.ok===!0,said:typeof r.said=="string"?r.said:o.ok?"Done.":"That didn't go through.",...r.view===void 0?{}:{view:r.view},...r.reveal===void 0?{}:{reveal:r.reveal}}}catch{return{ok:!1,said:"That didn't go through. Check your connection and try again."}}}function j_(e,t,a){let[n,o]=(0,me.useState)([]),r=(0,me.useRef)(e.live);r.current=e.live;let s=(0,me.useRef)(a.editing);s.current=a.editing;let i=(0,me.useRef)(!1),l=(0,me.useRef)(!1),c=(0,me.useRef)(void 0),f=e.flow.href,u=(0,me.useCallback)(async()=>{if(i.current||s.current){l.current=!0;return}i.current=!0,l.current=!1,window.clearTimeout(c.current);let d=!1;try{let m=await fetch(`${f}?format=json`,{credentials:"same-origin",headers:{accept:"application/json"}});if(m.ok){let g=await m.json();r.current=g.live,t(g),d=!0}}catch{}finally{i.current=!1}l.current?u():d||(c.current=window.setTimeout(()=>{document.visibilityState==="visible"&&u()},5e3))},[f,t]);return(0,me.useEffect)(()=>{!a.editing&&l.current&&u()},[a.editing,u]),(0,me.useEffect)(()=>()=>window.clearTimeout(c.current),[]),jo(qu("flow",e.flow.id,{card:a.card,editing:a.editing}),(d,m)=>{if(d==="change"){let g=m.at;(typeof g!="string"||g!==r.current)&&u()}else if(d==="reload")u();else if(d==="here"){let g=m.people;Array.isArray(g)&&o(g)}else(d==="gone"||d==="lost")&&o([])}),n}function W_({others:e,cards:t}){if(e.length===0)return null;let a=r=>{if(r.editing)return"changing this flow";let s=r.cards.map(i=>t.find(l=>l.id===i)?.title).filter(i=>i!==void 0);return s.length===0?"looking at the flow":`looking at ${s.map(i=>`“${i}”`).join(", ")}`},n=e.map(r=>`${r.name} is ${a(r)}`).join(". "),o=e.find(r=>r.editing);return(0,p.jsxs)("div",{className:"inline-flex min-w-0 items-center gap-1.5","data-also-here":!0,role:"status","aria-label":`Also here: ${n}`,title:n,children:[(0,p.jsx)("span",{className:"flex -space-x-1.5",children:e.slice(0,4).map(r=>(0,p.jsx)("span",{className:"rounded-full ring-2 ring-card",children:(0,p.jsx)(ei,{name:r.name})},r.name))}),(0,p.jsx)("span",{className:"truncate text-[12px] text-muted-foreground",children:o!==void 0?`${o.name} is changing this flow`:e.length===1?`${e[0].name} is here`:`${e.length} others here`})]})}function MY({data:e,selected:t}){let{stage:a,cards:n,editing:o,canMove:r}=e,s=Ep[a.zone.color]??Ep.slate,[i,l]=(0,me.useState)(!1),c=te("!size-2.5 !border-2 !border-card",!o&&"!opacity-0");return(0,p.jsxs)("div",{className:te("flex h-full flex-col overflow-hidden rounded-xl border bg-muted/40 shadow-sm",t&&o?"ring-2 ring-primary":"",i&&"ring-2 ring-primary/60"),onDragOver:f=>{!r||o||(f.preventDefault(),l(!0))},onDragLeave:()=>l(!1),onDrop:f=>{l(!1);let u=Number(f.dataTransfer.getData("text/so-card"));u>0&&e.onDrop(u,a.id)},"data-zone":a.id,children:[o&&(0,p.jsx)(q_,{isVisible:t,minWidth:220,minHeight:160,lineClassName:"!border-primary",handleClassName:"!size-2 !bg-primary",onResizeEnd:(f,u)=>e.onResize(a.id,u)}),(0,p.jsx)(ir,{type:"source",position:we.Right,id:"next",className:te(c,"!bg-primary"),isConnectable:o}),(0,p.jsx)(ir,{type:"source",position:we.Bottom,id:"fail",className:te(c,"!bg-destructive"),style:{left:"75%"},isConnectable:o}),["Left","Right","Top","Bottom"].map(f=>(0,p.jsx)(ir,{type:"target",position:we[f],id:`t-${f}`,className:c,isConnectable:o},`t-${f}`)),["Left","Right","Top","Bottom"].map(f=>(0,p.jsx)(ir,{type:"source",position:we[f],id:`s-${f}`,className:"!opacity-0 !pointer-events-none",isConnectable:!1},`s-${f}`)),(0,p.jsxs)("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,p.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-md text-white",style:{background:s},children:G_[a.kind]}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("div",{className:"truncate text-[13px] font-semibold",children:a.title}),(0,p.jsxs)("div",{className:"truncate text-[11px] text-muted-foreground",children:[e.kindLabel,e.start?" · new cards start here":"",e.teammate!==null?` · ${e.teammate}`:a.toOwner===!0?` · ${e.owner}`:a.approver?` · ${a.approver}`:""]})]}),n.length>0&&(0,p.jsx)("span",{className:"rounded-full bg-muted px-1.5 text-[11px] font-semibold text-muted-foreground",children:n.length})]}),(0,p.jsxs)("ul",{className:"nowheel flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-2",children:[n.map(f=>(0,p.jsx)("li",{children:(0,p.jsxs)("button",{type:"button",draggable:r&&!o,onDragStart:u=>{u.dataTransfer.setData("text/so-card",String(f.id)),u.dataTransfer.effectAllowed="move"},onClick:()=>e.onCard(f.id),className:te("nodrag nopan w-full cursor-pointer rounded-lg border bg-card px-2.5 py-2 text-left shadow-xs transition-colors hover:border-primary/50",e.selectedCard===f.id&&"border-primary ring-1 ring-primary",f.canDecide&&"border-attention/60"),"data-card":f.id,children:[(0,p.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,p.jsx)("div",{className:"line-clamp-2 min-w-0 flex-1 text-[12.5px] font-medium leading-snug",children:f.title}),(e.lookers[f.id]?.length??0)>0&&(0,p.jsx)("span",{className:"flex shrink-0 -space-x-1","data-card-lookers":!0,title:`${e.lookers[f.id].join(" and ")} ${e.lookers[f.id].length===1?"is":"are"} looking at this`,children:e.lookers[f.id].slice(0,2).map(u=>(0,p.jsx)("span",{className:"rounded-full ring-2 ring-primary/70",children:(0,p.jsx)(ei,{name:u})},u))})]}),f.sorted!==null&&(0,p.jsx)("div",{className:"mt-1 flex",children:(0,p.jsx)(f2,{sorted:f.sorted})}),f.waiting!==null&&(0,p.jsx)("div",{className:te("mt-1 text-[11px] leading-snug",f.task!==null&&(a.kind==="task"||a.kind==="report")?"truncate":"line-clamp-2",f.canDecide||f.question?.mine?"font-semibold text-attention":"text-muted-foreground"),children:f.canDecide?tp.card.sentence({}):f.question?.mine?`${f.question.from.split(" · ")[0]} asks you`:f.waiting}),f.deadline!=null&&(0,p.jsx)("div",{className:"mt-0.5 text-[11px] text-muted-foreground","data-card-deadline":!0,children:jh(f.deadline)}),(f.owner!==null||f.comments.length>0)&&(0,p.jsxs)("div",{className:"mt-1.5 flex items-center gap-1.5",children:[f.owner!==null&&(0,p.jsx)(ei,{name:f.owner}),(0,p.jsx)("span",{className:"flex-1"}),f.comments.length>0&&(0,p.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] text-muted-foreground",children:[(0,p.jsx)(Ts,{className:"size-3","aria-hidden":"true"}),f.comments.length]})]})]})},f.id)),n.length===0&&(0,p.jsx)("li",{className:"px-1 py-2 text-[11px] text-muted-foreground",children:o?a.kind==="done"?"":"Drag the dots to connect zones.":e.hidden>0?"":"No cards here."}),e.hidden>0&&(0,p.jsxs)("li",{className:"px-1 py-1 text-[11px] text-muted-foreground",children:[e.hidden," other card",e.hidden===1?"":"s"]})]})]})}var X_=44,Y_=30;function EY({data:e}){return(0,p.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-lg border bg-card shadow-sm","data-trigger-group":!0,children:[(0,p.jsx)(ir,{type:"source",position:we.Right,id:"out",className:"!opacity-0 !pointer-events-none",isConnectable:!1}),(0,p.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",style:{height:Y_},children:[(0,p.jsx)(As,{className:"size-3","aria-hidden":"true"}),"Starts cards"]}),e.triggers.map(t=>{let a=t.failing||t.hook!==null&&!t.hook.ready,n=t.state==="paused"?"Paused":t.failing?"Needs attention":t.hook!==null&&!t.hook.ready?"Needs its secret":t.detail;return(0,p.jsxs)("div",{className:te("flex items-center gap-2 border-t px-2.5",t.state==="paused"&&"opacity-60"),style:{height:X_},"data-trigger":t.id,children:[(0,p.jsx)("span",{className:"inline-flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:$_[t.kind]??(0,p.jsx)(As,{className:"size-3.5","aria-hidden":"true"})}),(0,p.jsxs)("button",{type:"button",className:"nodrag nopan min-w-0 flex-1 cursor-pointer text-left",onClick:()=>e.onOpen(t.id),"aria-label":`Trigger: ${t.words}`,children:[(0,p.jsx)("div",{className:"truncate text-[12px] font-semibold",children:t.name}),(0,p.jsx)("div",{className:te("truncate text-[11px]",a?"text-warning":"text-muted-foreground"),children:n})]}),t.button!==null&&t.state==="active"&&(0,p.jsx)(Z,{size:"sm",className:"nodrag nopan h-7 px-2.5",onClick:()=>e.onPress(t.id),children:"Start"})]},t.id)})]})}var AY={zone:MY,trigger:EY};function DY({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:r,label:s,labelStyle:i,labelBgStyle:l,markerEnd:c,style:f,data:u}){let{path:d,shift:m}=u??{},[g,b,v]=Js({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:r,...d}),x=i;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Dc,{path:g,...c===void 0?{}:{markerEnd:c},...f===void 0?{}:{style:f}}),(0,p.jsx)(P_,{children:(0,p.jsx)("div",{className:"nodrag nopan pointer-events-none absolute rounded-sm px-1 leading-4 whitespace-nowrap",style:{transform:`translate(-50%, -50%) translate(${b+(m?.x??0)}px, ${v+(m?.y??0)}px)`,color:x?.fill,fontSize:x?.fontSize,fontWeight:x?.fontWeight,background:l?.fill},children:s})})]})}var _Y={named:DY};function PY(e,t){let a=(r,s)=>{let i=t.find(u=>u.id===r)?.zone;if(i===void 0||s==null)return null;let l=s.slice(2),c=l==="Left"?i.x:l==="Right"?i.x+i.w:i.x+i.w/2,f=l==="Top"?i.y:l==="Bottom"?i.y+i.h:i.y+i.h/2;return{x:c,y:f,position:we[l]}},n=[],o=r=>n.some(s=>Math.abs(s.x-r.x)<(s.w+r.w)/2+4&&Math.abs(s.y-r.y)<(s.h+r.h)/2+2);return e.map(r=>{if(typeof r.label!="string"||r.type!=="smoothstep")return r;let s=a(r.source,r.sourceHandle),i=a(r.target,r.targetHandle);if(s===null||i===null)return r;let l=r.pathOptions,[,c,f]=Js({sourceX:s.x,sourceY:s.y,sourcePosition:s.position,targetX:i.x,targetY:i.y,targetPosition:i.position,...l}),u=r.label.length*6.4+10,d=18,g=(s.position===we.Left||s.position===we.Right)&&(i.position===we.Left||i.position===we.Right)?{x:0,y:d+6}:{x:u/2+34,y:0},b={x:0,y:0};for(let y of[0,1,-1,2,-2,3,-3])if(b={x:g.x*y,y:g.y*y},!o({x:c+b.x,y:f+b.y,w:u,h:d}))break;n.push({x:c+b.x,y:f+b.y,w:u,h:d});let{pathOptions:v,...x}=r;return{...x,type:"named",data:{...r.data,path:l,shift:b}}})}function OY(e,t){let a=[],n=new Set,o=r=>{for(;r!==null&&!n.has(r);){let s=e.find(i=>i.id===r);if(s===void 0)return;n.add(r),a.push(s);for(let i of s.sort?.answers??[])o(i.to);s.sort!==null&&s.onFail!==null&&o(s.onFail),r=s.next}};o(t);for(let r of e)n.has(r.id)||o(r.id);return[...a.filter(r=>r.kind!=="done"),...a.filter(r=>r.kind==="done")]}function zY(e,t){let a=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,24)||"zone",n=a,o=2;for(;t.has(n);)n=`${a}-${o++}`;return n}var p2=e=>vn(e),BY=(e,t=new Date)=>Number.isNaN(new Date(e).getTime())?"":Wu(e,t,$i(),!0),FY=e=>e%1440===0?`${e/1440} day${e===1440?"":"s"}`:e%60===0?`${e/60} h`:`${e} min`;function K_({link:e}){return e===null?null:(0,p.jsxs)(p.Fragment,{children:[" ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:e.href,"data-status-link":!0,children:e.label})]})}function HY({body:e,mentions:t}){if(t.length===0)return(0,p.jsx)(p.Fragment,{children:e});let a=new RegExp(`(@(?:${t.map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}))(?![A-Za-z0-9_])`,"gi");return(0,p.jsx)(p.Fragment,{children:e.split(a).map((n,o)=>o%2===1?(0,p.jsx)("span",{className:"font-semibold text-primary",children:n},o):n)})}function qY({card:e,view:t,csrf:a,apply:n}){let[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(!1),l=/(?:^|\s)@([A-Za-z0-9_.-]*)$/.exec(o)?.[1],c=l===void 0?[]:t.approvers.filter(f=>f!==t.me&&f.toLowerCase().startsWith(l.toLowerCase())).slice(0,6);return(0,p.jsxs)("div",{className:"flex flex-col gap-2","data-flow-discussion":!0,children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Discussion"}),e.comments.length===0?(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"No comments yet."}):(0,p.jsx)("ol",{className:"flex flex-col gap-3",children:e.comments.map(f=>(0,p.jsxs)("li",{className:"flex gap-2","data-comment":f.id,children:[(0,p.jsx)(ei,{name:f.author,size:"md"}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:[(0,p.jsx)("span",{className:"font-semibold text-foreground",children:f.author})," · ",p2(f.at)]}),(0,p.jsx)("p",{className:"whitespace-pre-wrap break-words text-[13px]",children:(0,p.jsx)(HY,{body:f.body,mentions:f.mentions})})]})]},f.id))}),t.canEdit&&(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:async f=>{f.preventDefault(),i(!0);let u=await ca(`${t.flow.href}/cards/${e.id}/comment`,{body:o},a);i(!1),n(u),u.ok&&r("")},children:[(0,p.jsx)(zt,{value:o,onChange:f=>r(f.target.value),rows:3,maxLength:4e3,placeholder:"Add a comment. Type @ and a name to ping someone.","aria-label":"Comment"}),c.length>0&&(0,p.jsx)("div",{className:"flex flex-wrap gap-1.5","aria-label":"People to mention",children:c.map(f=>(0,p.jsxs)("button",{type:"button",className:"inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2 text-[12px] hover:border-primary/60",onClick:()=>r(u=>u.replace(/@([A-Za-z0-9_.-]*)$/,`@${f} `)),children:[(0,p.jsx)(ei,{name:f}),f]},f))}),(0,p.jsx)(Z,{type:"submit",size:"sm",className:"self-start",disabled:s||o.trim()==="",children:"Comment"})]})]})}function UY({card:e,view:t,csrf:a,apply:n}){let[o,r]=(0,me.useState)(!1),s=async(l,c)=>{r(!0),n(await ca(`${t.flow.href}/cards/${e.id}/${l}`,c,a)),r(!1)},i=e.watchers.filter(l=>l!==e.owner);return(0,p.jsxs)("div",{className:"flex flex-col gap-2","data-flow-card-people":!0,children:[t.canEdit&&e.state==="active"?(0,p.jsxs)("label",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Owner"}),(0,p.jsxs)("select",{className:gt,value:e.owner??"",disabled:o,onChange:l=>{s("assign",{owner:l.target.value})},"aria-label":"Owner",children:[(0,p.jsx)("option",{value:"",children:"No owner"}),t.approvers.map(l=>(0,p.jsx)("option",{value:l,children:l===t.me?`${l} (you)`:l},l))]})]}):e.owner!==null&&(0,p.jsxs)("p",{className:"flex items-center gap-2 text-[13px]",children:[(0,p.jsx)(ei,{name:e.owner})," Owned by ",e.owner]}),(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[t.canEdit&&e.state==="active"&&e.owner===null&&(0,p.jsx)(Z,{size:"sm",variant:"outline",disabled:o,onClick:()=>{s("assign",{owner:t.me})},children:"Take it"}),i.length>0&&(0,p.jsxs)("span",{className:"flex items-center gap-1 text-[12px] text-muted-foreground",children:[i.slice(0,5).map(l=>(0,p.jsx)(ei,{name:l},l)),i.length===1?" follows it":" follow it"]}),t.canEdit&&e.owner!==t.me&&(0,p.jsx)(Z,{size:"sm",variant:"ghost",disabled:o,onClick:()=>{s("watch",{watching:e.watching?"no":"yes"})},"aria-pressed":e.watching,children:e.watching?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Kd,{className:"size-4"}),"Stop following"]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Zd,{className:"size-4"}),"Follow"]})})]})]})}function Z_({links:e}){return(0,p.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:e.map(t=>(0,p.jsx)("a",{className:"text-[13px] font-medium text-primary underline-offset-4 hover:underline",href:t.href,...t.href.startsWith("/")?{}:{target:"_blank",rel:"noreferrer"},children:t.label},t.label))})}function Q_({items:e}){return(0,p.jsx)("ol",{className:"flex flex-col gap-3","data-flow-items":!0,children:e.map(t=>(0,p.jsxs)("li",{className:"flex items-start gap-3","data-flow-item":t.number,children:[(0,p.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 text-[12.5px]",children:[(0,p.jsxs)("p",{className:"font-semibold",children:[t.number,". ",t.title]}),t.lines.map((a,n)=>(0,p.jsx)("p",{className:"break-words text-muted-foreground",children:a},n)),(0,p.jsx)("a",{className:"self-start font-medium text-primary underline-offset-4 hover:underline",href:t.url,target:"_blank",rel:"noreferrer",children:t.source})]}),t.image!==null&&(0,p.jsx)("a",{className:"w-28 shrink-0",href:t.image.src,target:"_blank",rel:"noreferrer",children:(0,p.jsx)("img",{className:"w-full rounded-md border object-cover object-top",style:{aspectRatio:"4 / 3"},src:t.image.src,alt:t.image.caption,loading:"lazy"})})]},t.number))})}function VY({sent:e}){return(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2","data-flow-sent":!0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Sent to ",e.person," · ",p2(e.at)]}),(0,p.jsxs)("div",{className:"mt-2 flex flex-col gap-2",children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:e.title}),(0,p.jsx)("p",{className:"max-h-60 overflow-auto whitespace-pre-wrap break-words text-[12.5px]",children:e.summary}),e.items!==void 0&&(0,p.jsx)(Q_,{items:e.items}),e.links.length>0&&(0,p.jsx)(Z_,{links:e.links})]})]})}function GY({choose:e,base:t,csrf:a,apply:n}){let[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(!1),l=async c=>{i(!0);let f=await ca(`${t}/choose`,c,a);i(!1),n(f),f.ok&&r("")};return(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-attention/50 p-3","data-flow-choose":!0,children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:e.title}),(0,p.jsx)("p",{className:"max-h-60 overflow-auto whitespace-pre-wrap break-words text-[12.5px]",children:e.summary}),e.items!==void 0&&(0,p.jsx)(Q_,{items:e.items}),e.links.length>0&&(0,p.jsx)(Z_,{links:e.links}),e.mine?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:e.options.map(c=>(0,p.jsx)(Z,{size:"sm",variant:c.choice===0?"default":"outline",disabled:s,onClick:()=>{l({choice:String(c.choice),label:c.label,entry:String(e.entry)})},"data-flow-choice":c.choice,children:c.label},c.choice))}),e.reply&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(zt,{value:o,onChange:c=>r(c.target.value),rows:2,maxLength:4e3,placeholder:"Or say what you'd change","aria-label":"What you'd change"}),(0,p.jsx)(Z,{size:"sm",variant:"outline",className:"self-start",disabled:s||o.trim()==="",onClick:()=>{l({note:o,entry:String(e.entry)})},children:"Send reply"})]})]}):(0,p.jsxs)("p",{className:"text-[12.5px] text-muted-foreground",children:["Waiting for ",e.person," to choose."]})]})}function J_({card:e,view:t,csrf:a,apply:n,onClose:o}){let[r,s]=(0,me.useState)(""),[i,l]=(0,me.useState)(e.draft?.text??"");(0,me.useEffect)(()=>{l(e.draft?.text??"")},[e.id,e.draft?.text]);let[c,f]=(0,me.useState)(!1),u=t.stages.find(g=>g.id===e.stage),d=async(g,b)=>{f(!0);let v=await ca(g,b,a);f(!1),n(v),v.ok&&s("")},m=`${t.flow.href}/cards/${e.id}`;return(0,p.jsxs)("div",{className:"flex flex-col gap-4","data-flow-card-panel":e.id,children:[(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("h2",{className:"text-[15px] font-semibold leading-snug",children:e.title}),(0,p.jsxs)("p",{className:"mt-0.5 text-[12px] text-muted-foreground",children:[e.state==="active"?`In ${u?.title??e.stage}`:e.state==="done"?"Done":e.waiting==="Ignored"?"Ignored":"Cancelled"," · added by ",e.createdBy]}),e.sorted!==null&&(0,p.jsx)("div",{className:"mt-1.5 flex",children:(0,p.jsx)(f2,{sorted:e.sorted})})]}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:o,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),e.source!==null&&(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["From ",e.source.url===null?e.source.label:(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:e.source.url,...e.source.url.startsWith("/")?{}:{target:"_blank",rel:"noreferrer"},children:e.source.label})]}),e.description!==null&&(0,p.jsx)("p",{className:"whitespace-pre-wrap text-[13px]",children:e.description}),e.waiting!==null&&e.question==null&&e.choose==null&&e.state==="active"&&(0,p.jsxs)("p",{className:"rounded-md bg-muted px-3 py-2 text-[13px]",children:[e.waiting,e.deadline!=null&&(0,p.jsx)("span",{className:"block text-muted-foreground",children:jh(e.deadline)})]}),e.question!=null&&(0,p.jsx)(XY,{question:e.question,csrf:a,apply:n}),e.choose!=null&&(0,p.jsx)(GY,{choose:e.choose,base:`${t.flow.href}/cards/${e.id}`,csrf:a,apply:n}),e.sent!=null&&(0,p.jsx)(VY,{sent:e.sent}),e.question!=null&&e.deadline!=null&&(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:jh(e.deadline)}),(0,p.jsx)(UY,{card:e,view:t,csrf:a,apply:n}),e.task!==null&&(0,p.jsx)("a",{className:"text-[13px] font-medium text-primary underline-offset-4 hover:underline",href:e.task.href,children:"Open its task"}),e.draft!==null&&!e.canDecide&&(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2",open:!0,"data-flow-draft":!0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Draft from ",e.draft.title]}),(0,p.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-[12.5px]",children:e.draft.text})]}),e.canDecide&&(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-attention/50 p-3",children:[e.handoff!=null&&(0,p.jsxs)("p",{className:"rounded-md bg-muted px-3 py-2 text-[13px]","data-teammate-handoff":!0,children:[(0,p.jsxs)("span",{className:"font-medium",children:[e.handoff.from,":"]})," ",e.handoff.note]}),e.draft!==null&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(Ct,{htmlFor:"flow-draft",className:"text-[13px]",children:["Draft from ",e.draft.title]}),(0,p.jsx)(zt,{id:"flow-draft",value:i,onChange:g=>l(g.target.value),rows:8,maxLength:12e3,"data-flow-draft-edit":!0}),i.trim()!==e.draft.text.trim()&&(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"Approving sends your edited version on."})]}),(0,p.jsxs)(Ct,{htmlFor:"flow-note",className:"text-[13px]",children:[u?.title??"Decision",": approve, or send it back"]}),(0,p.jsx)(zt,{id:"flow-note",value:r,onChange:g=>s(g.target.value),placeholder:"What should change? (needed to send it back)",rows:3}),(0,p.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,p.jsx)(Z,{size:"sm",disabled:c||e.draft!==null&&i.trim()==="",onClick:()=>{d(`${m}/decide`,{decision:"approve",note:r,...e.draft===null?{}:{draft:i}})},children:tp.card.action.label}),u?.onFail!==null&&u?.onFail!==void 0&&(0,p.jsx)(Z,{size:"sm",variant:"outline",disabled:c||r.trim()==="",onClick:()=>{d(`${m}/decide`,{decision:"send-back",note:r})},children:"Send back"})]})]}),t.canEdit&&e.state==="active"&&(0,p.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,p.jsx)(Ct,{htmlFor:"flow-move",className:"text-[13px]",children:"Move to"}),(0,p.jsx)("select",{id:"flow-move",className:"h-9 rounded-md border bg-transparent px-2 text-[13px]",value:e.stage,disabled:c,onChange:g=>{d(`${m}/move`,{stage:g.target.value})},children:t.stages.map(g=>(0,p.jsx)("option",{value:g.id,children:g.title},g.id))})]}),(e.calls??[]).length>0&&(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2","data-teammate-calls":!0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Tool calls (",e.calls.length,")"]}),(0,p.jsx)("ol",{className:"mt-2 flex flex-col gap-2.5",children:e.calls.map(g=>(0,p.jsxs)("li",{className:"flex flex-col gap-0.5 text-[12.5px]","data-teammate-call":g.state,children:[(0,p.jsxs)("span",{className:"break-words",children:[(0,p.jsx)("span",{className:"font-medium",children:g.who})," · ",g.words]}),(0,p.jsxs)("span",{className:"text-muted-foreground",children:[g.outcome,g.why!==""&&g.state!=="refused"?` · ${g.why}`:""]}),g.result!==null&&g.result!==""&&(g.state==="done"||g.state==="failed")&&(0,p.jsx)("span",{className:"mt-0.5 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted px-2 py-1 text-[12px]",children:g.result}),g.undo!=null&&g.teammate!==void 0&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"mt-1 self-start",disabled:c,"data-teammate-undo":g.id,onClick:()=>{d(`/teammates/${g.teammate}/week`,{op:"undo",id:String(g.id)})},children:["Undo with ",g.undo]})]},g.id))})]}),e.outputs.length>0&&(0,p.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"What zones reported"}),e.outputs.map(g=>(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2",children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[13px] font-medium",children:g.title}),(0,p.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-[12.5px] text-muted-foreground",children:g.text})]},g.stage))]}),(0,p.jsx)(qY,{card:e,view:t,csrf:a,apply:n}),(0,p.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"History"}),(0,p.jsx)("ol",{className:"flex flex-col gap-1.5",children:e.history.map((g,b)=>(0,p.jsxs)("li",{className:"text-[12px]",children:[(0,p.jsx)("span",{className:"text-muted-foreground",children:BY(g.at)})," · ",g.text]},b))})]}),t.canEdit&&e.state==="active"&&(0,p.jsx)(Z,{variant:"ghost",size:"sm",className:"self-start text-destructive",disabled:c,onClick:()=>{d(`${m}/cancel`,{})},children:"Cancel card"})]})}function ge({label:e,hint:t,children:a}){return(0,p.jsxs)("label",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:e}),a,t!==void 0&&(0,p.jsx)("span",{className:"text-[12px] text-muted-foreground",children:t})]})}var gt="h-9 w-full rounded-md border bg-transparent px-2 text-[13px]",$Y=[.95,.9,.85,.8,.7,.6];function jY({sort:e,others:t,ready:a,set:n}){let o=(s,i)=>n({...e,answers:e.answers.map((l,c)=>c===s?{...l,...i}:l)}),r=(s,i)=>n({...e,notes:e.notes.map((l,c)=>c===s?{...l,...i}:l)});return(0,p.jsxs)(p.Fragment,{children:[!a&&(0,p.jsxs)("p",{className:"rounded-md border border-border px-3 py-2 text-[12.5px]","data-sort-needs-key":!0,children:["Sorting needs an OpenRouter key. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/settings#providers",children:"Add it in Settings"})]}),(0,p.jsx)(ge,{label:"Question",children:(0,p.jsx)(ve,{value:e.question,maxLength:300,onChange:s=>n({...e,question:s.target.value}),"aria-label":"Question"})}),(0,p.jsxs)("div",{className:"grid gap-2",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Answers"}),e.answers.map((s,i)=>(0,p.jsxs)("div",{className:"grid gap-1.5 rounded-md border p-2","data-sort-answer":i,children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsx)(ve,{value:s.answer,maxLength:40,placeholder:"Answer",onChange:l=>o(i,{answer:l.target.value}),"aria-label":`Answer ${i+1}`}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",disabled:e.answers.length<=2,onClick:()=>n({...e,answers:e.answers.filter((l,c)=>c!==i)}),"aria-label":`Remove ${s.answer||`answer ${i+1}`}`,children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsx)(ve,{value:s.means,maxLength:200,placeholder:"What it means, in a few words",onChange:l=>o(i,{means:l.target.value}),"aria-label":`What ${s.answer||`answer ${i+1}`} means`}),(0,p.jsxs)("select",{className:gt,value:s.to,onChange:l=>o(i,{to:l.target.value}),"aria-label":`Where ${s.answer||`answer ${i+1}`} goes`,children:[s.to===""&&(0,p.jsx)("option",{value:"",children:"Choose where it goes"}),t.map(l=>(0,p.jsxs)("option",{value:l.id,children:["Goes to ",l.title]},l.id))]})]},i)),e.answers.length<12&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>n({...e,answers:[...e.answers,{answer:"",means:"",to:""}]}),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add an answer"]})]}),(0,p.jsx)(ge,{label:"Acts on its own when",hint:"Below this, the card takes the not-sure path.",children:(0,p.jsx)("select",{className:gt,value:String(e.sureAt),onChange:s=>n({...e,sureAt:Number(s.target.value)}),"aria-label":"Acts on its own when",children:[...new Set([...$Y,e.sureAt])].sort((s,i)=>i-s).map(s=>(0,p.jsxs)("option",{value:String(s),children:[Math.round(s*100),"% sure or more"]},s))})}),(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2",open:e.notes.length>0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Also note on the card",e.notes.length>0?` (${e.notes.length})`:""]}),(0,p.jsxs)("div",{className:"mt-2 grid gap-2",children:[e.notes.map((s,i)=>(0,p.jsxs)("div",{className:"grid gap-1.5 rounded-md border p-2","data-sort-note":i,children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsxs)("select",{className:gt,value:s.kind,onChange:l=>r(i,l.target.value==="score"?{kind:"score",levels:s.levels??["Low","Medium","High"]}:{kind:"yes-no",levels:null}),"aria-label":`Note ${i+1}: kind`,children:[(0,p.jsx)("option",{value:"score",children:"A score"}),(0,p.jsx)("option",{value:"yes-no",children:"Yes or no"})]}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:()=>n({...e,notes:e.notes.filter((l,c)=>c!==i)}),"aria-label":`Remove note ${i+1}`,children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsx)(ve,{value:s.question,maxLength:300,placeholder:s.kind==="score"?"How urgent is this?":"Is the customer asking for money back?",onChange:l=>r(i,{question:l.target.value}),"aria-label":`Note ${i+1}: question`}),s.kind==="score"&&(0,p.jsx)(zt,{rows:3,value:(s.levels??[]).join(`
|
|
59
|
+
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}H_.displayName="MiniMap";var rhe=(0,Q.memo)(H_),NY=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,RY={[Hr.Line]:"right",[Hr.Handle]:"bottom-right"};function TY({nodeId:e,position:t,variant:a=Hr.Handle,className:n,style:o=void 0,children:r,color:s,minWidth:i=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:d,autoScale:m=!0,shouldResize:g,onResizeStart:b,onResize:v,onResizeEnd:x}){let y=p_(),h=typeof e=="string"?e:y,w=yt(),S=(0,Q.useRef)(null),C=a===Hr.Handle,I=je((0,Q.useCallback)(NY(C&&m),[C,m]),kt),L=(0,Q.useRef)(null),T=t??RY[a];(0,Q.useEffect)(()=>{if(!(!S.current||!h))return L.current||(L.current=mD({domNode:S.current,nodeId:h,getStoreItems:()=>{let{nodeLookup:D,transform:H,snapGrid:V,snapToGrid:N,nodeOrigin:P,domNode:E}=w.getState();return{nodeLookup:D,transform:H,snapGrid:V,snapToGrid:N,nodeOrigin:P,paneDomNode:E}},onChange:(D,H)=>{let{triggerNodeChanges:V,nodeLookup:N,parentLookup:P,nodeOrigin:E}=w.getState(),_=[],z={x:D.x,y:D.y},q=N.get(h);if(q&&q.expandParent&&q.parentId){let O=q.origin??E,W=D.width??q.measured.width??0,ee=D.height??q.measured.height??0,de={id:q.id,parentId:q.parentId,rect:{width:W,height:ee,...jw({x:D.x??q.position.x,y:D.y??q.position.y},{width:W,height:ee},q.parentId,N,O)}},ne=zx([de],N,P,E);_.push(...ne),z.x=D.x?Math.max(O[0]*W,D.x):void 0,z.y=D.y?Math.max(O[1]*ee,D.y):void 0}if(z.x!==void 0&&z.y!==void 0){let O={id:h,type:"position",position:{...z}};_.push(O)}if(D.width!==void 0&&D.height!==void 0){let W={id:h,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};_.push(W)}for(let O of H){let W={...O,type:"position"};_.push(W)}V(_)},onEnd:({width:D,height:H})=>{let V={id:h,type:"dimensions",resizing:!1,dimensions:{width:D,height:H}};w.getState().triggerNodeChanges([V])}})),L.current.update({controlPosition:T,boundaries:{minWidth:i,minHeight:l,maxWidth:c,maxHeight:f},keepAspectRatio:u,resizeDirection:d,onResizeStart:b,onResize:v,onResizeEnd:x,shouldResize:g}),()=>{L.current?.destroy()}},[T,i,l,c,f,u,b,v,x,g]);let A=T.split("-");return(0,K.jsx)("div",{className:Dt(["react-flow__resize-control","nodrag",...A,a,n]),ref:S,style:{...o,scale:I,...s&&{[C?"backgroundColor":"borderColor"]:s}},children:r})}var t_=(0,Q.memo)(TY);function q_({nodeId:e,isVisible:t=!0,handleClassName:a,handleStyle:n,lineClassName:o,lineStyle:r,color:s,minWidth:i=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:u=!1,autoScale:d=!0,shouldResize:m,onResizeStart:g,onResize:b,onResizeEnd:v}){return t?(0,K.jsxs)(K.Fragment,{children:[fD.map(x=>(0,K.jsx)(t_,{className:o,style:r,nodeId:e,position:x,variant:Hr.Line,color:s,minWidth:i,minHeight:l,maxWidth:c,maxHeight:f,onResizeStart:g,keepAspectRatio:u,autoScale:d,shouldResize:m,onResize:b,onResizeEnd:v},x)),dD.map(x=>(0,K.jsx)(t_,{className:a,style:n,nodeId:e,position:x,color:s,minWidth:i,minHeight:l,maxWidth:c,maxHeight:f,onResizeStart:g,keepAspectRatio:u,autoScale:d,shouldResize:m,onResize:b,onResizeEnd:v},x))]}):null}var me=j(he(),1);var p=j(fe(),1);function ei({name:e,size:t="sm"}){let a=[...e].reduce((o,r)=>(o*31+r.charCodeAt(0))%360,7),n=e.split(/[\s._-]+/).filter(Boolean).map(o=>o[0].toUpperCase()).slice(0,2).join("")||e.slice(0,2).toUpperCase();return(0,p.jsx)("span",{title:e,"aria-label":e,className:te("inline-flex shrink-0 items-center justify-center rounded-full font-semibold text-white",t==="sm"?"size-5 text-[9px]":"size-7 text-[11px]"),style:{background:`hsl(${a} 45% 45%)`},children:n})}var Ep={slate:"#64748b",blue:"#3b82f6",violet:"#8b5cf6",amber:"#d97706",green:"#059669",rose:"#e11d48"},G_={inbox:(0,p.jsx)(qi,{className:"size-3.5","aria-hidden":"true"}),task:(0,p.jsx)(cf,{className:"size-3.5","aria-hidden":"true"}),report:(0,p.jsx)(If,{className:"size-3.5","aria-hidden":"true"}),approval:(0,p.jsx)(Ef,{className:"size-3.5","aria-hidden":"true"}),notify:(0,p.jsx)(vf,{className:"size-3.5","aria-hidden":"true"}),done:(0,p.jsx)(rf,{className:"size-3.5","aria-hidden":"true"}),check:(0,p.jsx)(to,{className:"size-3.5","aria-hidden":"true"}),"pull-request":(0,p.jsx)(Ns,{className:"size-3.5","aria-hidden":"true"}),update:(0,p.jsx)(yf,{className:"size-3.5","aria-hidden":"true"}),sort:(0,p.jsx)(ju,{className:"size-3.5","aria-hidden":"true"}),draft:(0,p.jsx)(Ms,{className:"size-3.5","aria-hidden":"true"}),request:(0,p.jsx)(uf,{className:"size-3.5","aria-hidden":"true"}),email:(0,p.jsx)(Gu,{className:"size-3.5","aria-hidden":"true"}),tool:(0,p.jsx)(Vi,{className:"size-3.5","aria-hidden":"true"}),wait:(0,p.jsx)(ff,{className:"size-3.5","aria-hidden":"true"}),subagent:(0,p.jsx)(zi,{className:"size-3.5","aria-hidden":"true"}),send:(0,p.jsx)(Nf,{className:"size-3.5","aria-hidden":"true"}),choose:(0,p.jsx)(Tf,{className:"size-3.5","aria-hidden":"true"})};function f2({sorted:e}){return(0,p.jsxs)("span",{className:te("inline-flex max-w-full items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-medium",!e.confident&&"text-warning"),title:e.confident?"Sorted by Jev":"Jev wasn't sure","data-sort-chip":!0,children:[(0,p.jsx)(ju,{className:"size-3 shrink-0",style:{color:e.confident?Ep.violet:void 0},"aria-hidden":"true"}),(0,p.jsx)("span",{className:"truncate",children:e.confident?e.chip:`Not sure · ${e.chip}`})]})}var $_={button:(0,p.jsx)($u,{className:"size-3.5","aria-hidden":"true"}),schedule:(0,p.jsx)(Jd,{className:"size-3.5","aria-hidden":"true"}),github:(0,p.jsx)(Ns,{className:"size-3.5","aria-hidden":"true"}),linear:(0,p.jsx)(Es,{className:"size-3.5","aria-hidden":"true"}),flow:(0,p.jsx)(Ui,{className:"size-3.5","aria-hidden":"true"}),webhook:(0,p.jsx)(Af,{className:"size-3.5","aria-hidden":"true"}),email:(0,p.jsx)(Gu,{className:"size-3.5","aria-hidden":"true"}),chat:(0,p.jsx)(Ts,{className:"size-3.5","aria-hidden":"true"})};async function ca(e,t,a){let n=new URLSearchParams({csrf:a,...t});try{let o=await fetch(e,{method:"POST",body:n,credentials:"same-origin",headers:{accept:"application/json"},signal:AbortSignal.timeout(2e4)}),r=await o.json();return{ok:r.ok===!0,said:typeof r.said=="string"?r.said:o.ok?"Done.":"That didn't go through.",...r.view===void 0?{}:{view:r.view},...r.reveal===void 0?{}:{reveal:r.reveal}}}catch{return{ok:!1,said:"That didn't go through. Check your connection and try again."}}}function j_(e,t,a){let[n,o]=(0,me.useState)([]),r=(0,me.useRef)(e.live);r.current=e.live;let s=(0,me.useRef)(a.editing);s.current=a.editing;let i=(0,me.useRef)(!1),l=(0,me.useRef)(!1),c=(0,me.useRef)(void 0),f=e.flow.href,u=(0,me.useCallback)(async()=>{if(i.current||s.current){l.current=!0;return}i.current=!0,l.current=!1,window.clearTimeout(c.current);let d=!1;try{let m=await fetch(`${f}?format=json`,{credentials:"same-origin",headers:{accept:"application/json"}});if(m.ok){let g=await m.json();r.current=g.live,t(g),d=!0}}catch{}finally{i.current=!1}l.current?u():d||(c.current=window.setTimeout(()=>{document.visibilityState==="visible"&&u()},5e3))},[f,t]);return(0,me.useEffect)(()=>{!a.editing&&l.current&&u()},[a.editing,u]),(0,me.useEffect)(()=>()=>window.clearTimeout(c.current),[]),jo(qu("flow",e.flow.id,{card:a.card,editing:a.editing}),(d,m)=>{if(d==="change"){let g=m.at;(typeof g!="string"||g!==r.current)&&u()}else if(d==="reload")u();else if(d==="here"){let g=m.people;Array.isArray(g)&&o(g)}else(d==="gone"||d==="lost")&&o([])}),n}function W_({others:e,cards:t}){if(e.length===0)return null;let a=r=>{if(r.editing)return"changing this flow";let s=r.cards.map(i=>t.find(l=>l.id===i)?.title).filter(i=>i!==void 0);return s.length===0?"looking at the flow":`looking at ${s.map(i=>`“${i}”`).join(", ")}`},n=e.map(r=>`${r.name} is ${a(r)}`).join(". "),o=e.find(r=>r.editing);return(0,p.jsxs)("div",{className:"inline-flex min-w-0 items-center gap-1.5","data-also-here":!0,role:"status","aria-label":`Also here: ${n}`,title:n,children:[(0,p.jsx)("span",{className:"flex -space-x-1.5",children:e.slice(0,4).map(r=>(0,p.jsx)("span",{className:"rounded-full ring-2 ring-card",children:(0,p.jsx)(ei,{name:r.name})},r.name))}),(0,p.jsx)("span",{className:"truncate text-[12px] text-muted-foreground",children:o!==void 0?`${o.name} is changing this flow`:e.length===1?`${e[0].name} is here`:`${e.length} others here`})]})}function MY({data:e,selected:t}){let{stage:a,cards:n,editing:o,canMove:r}=e,s=Ep[a.zone.color]??Ep.slate,[i,l]=(0,me.useState)(!1),c=te("!size-2.5 !border-2 !border-card",!o&&"!opacity-0");return(0,p.jsxs)("div",{className:te("flex h-full flex-col overflow-hidden rounded-xl border bg-muted/40 shadow-sm",t&&o?"ring-2 ring-primary":"",i&&"ring-2 ring-primary/60"),onDragOver:f=>{!r||o||(f.preventDefault(),l(!0))},onDragLeave:()=>l(!1),onDrop:f=>{l(!1);let u=Number(f.dataTransfer.getData("text/so-card"));u>0&&e.onDrop(u,a.id)},"data-zone":a.id,children:[o&&(0,p.jsx)(q_,{isVisible:t,minWidth:220,minHeight:160,lineClassName:"!border-primary",handleClassName:"!size-2 !bg-primary",onResizeEnd:(f,u)=>e.onResize(a.id,u)}),(0,p.jsx)(ir,{type:"source",position:we.Right,id:"next",className:te(c,"!bg-primary"),isConnectable:o}),(0,p.jsx)(ir,{type:"source",position:we.Bottom,id:"fail",className:te(c,"!bg-destructive"),style:{left:"75%"},isConnectable:o}),["Left","Right","Top","Bottom"].map(f=>(0,p.jsx)(ir,{type:"target",position:we[f],id:`t-${f}`,className:c,isConnectable:o},`t-${f}`)),["Left","Right","Top","Bottom"].map(f=>(0,p.jsx)(ir,{type:"source",position:we[f],id:`s-${f}`,className:"!opacity-0 !pointer-events-none",isConnectable:!1},`s-${f}`)),(0,p.jsxs)("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[(0,p.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-md text-white",style:{background:s},children:G_[a.kind]}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("div",{className:"truncate text-[13px] font-semibold",children:a.title}),(0,p.jsxs)("div",{className:"truncate text-[11px] text-muted-foreground",children:[e.kindLabel,e.start?" · new cards start here":"",e.subagent!==null?` · ${e.subagent}`:a.toOwner===!0?` · ${e.owner}`:a.approver?` · ${a.approver}`:""]})]}),n.length>0&&(0,p.jsx)("span",{className:"rounded-full bg-muted px-1.5 text-[11px] font-semibold text-muted-foreground",children:n.length})]}),(0,p.jsxs)("ul",{className:"nowheel flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto p-2",children:[n.map(f=>(0,p.jsx)("li",{children:(0,p.jsxs)("button",{type:"button",draggable:r&&!o,onDragStart:u=>{u.dataTransfer.setData("text/so-card",String(f.id)),u.dataTransfer.effectAllowed="move"},onClick:()=>e.onCard(f.id),className:te("nodrag nopan w-full cursor-pointer rounded-lg border bg-card px-2.5 py-2 text-left shadow-xs transition-colors hover:border-primary/50",e.selectedCard===f.id&&"border-primary ring-1 ring-primary",f.canDecide&&"border-attention/60"),"data-card":f.id,children:[(0,p.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,p.jsx)("div",{className:"line-clamp-2 min-w-0 flex-1 text-[12.5px] font-medium leading-snug",children:f.title}),(e.lookers[f.id]?.length??0)>0&&(0,p.jsx)("span",{className:"flex shrink-0 -space-x-1","data-card-lookers":!0,title:`${e.lookers[f.id].join(" and ")} ${e.lookers[f.id].length===1?"is":"are"} looking at this`,children:e.lookers[f.id].slice(0,2).map(u=>(0,p.jsx)("span",{className:"rounded-full ring-2 ring-primary/70",children:(0,p.jsx)(ei,{name:u})},u))})]}),f.sorted!==null&&(0,p.jsx)("div",{className:"mt-1 flex",children:(0,p.jsx)(f2,{sorted:f.sorted})}),f.waiting!==null&&(0,p.jsx)("div",{className:te("mt-1 text-[11px] leading-snug",f.task!==null&&(a.kind==="task"||a.kind==="report")?"truncate":"line-clamp-2",f.canDecide||f.question?.mine?"font-semibold text-attention":"text-muted-foreground"),children:f.canDecide?tp.card.sentence({}):f.question?.mine?`${f.question.from.split(" · ")[0]} asks you`:f.waiting}),f.deadline!=null&&(0,p.jsx)("div",{className:"mt-0.5 text-[11px] text-muted-foreground","data-card-deadline":!0,children:jh(f.deadline)}),(f.owner!==null||f.comments.length>0)&&(0,p.jsxs)("div",{className:"mt-1.5 flex items-center gap-1.5",children:[f.owner!==null&&(0,p.jsx)(ei,{name:f.owner}),(0,p.jsx)("span",{className:"flex-1"}),f.comments.length>0&&(0,p.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] text-muted-foreground",children:[(0,p.jsx)(Ts,{className:"size-3","aria-hidden":"true"}),f.comments.length]})]})]})},f.id)),n.length===0&&(0,p.jsx)("li",{className:"px-1 py-2 text-[11px] text-muted-foreground",children:o?a.kind==="done"?"":"Drag the dots to connect zones.":e.hidden>0?"":"No cards here."}),e.hidden>0&&(0,p.jsxs)("li",{className:"px-1 py-1 text-[11px] text-muted-foreground",children:[e.hidden," other card",e.hidden===1?"":"s"]})]})]})}var X_=44,Y_=30;function EY({data:e}){return(0,p.jsxs)("div",{className:"flex h-full flex-col overflow-hidden rounded-lg border bg-card shadow-sm","data-trigger-group":!0,children:[(0,p.jsx)(ir,{type:"source",position:we.Right,id:"out",className:"!opacity-0 !pointer-events-none",isConnectable:!1}),(0,p.jsxs)("div",{className:"flex items-center gap-1.5 px-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",style:{height:Y_},children:[(0,p.jsx)(As,{className:"size-3","aria-hidden":"true"}),"Starts cards"]}),e.triggers.map(t=>{let a=t.failing||t.hook!==null&&!t.hook.ready,n=t.state==="paused"?"Paused":t.failing?"Needs attention":t.hook!==null&&!t.hook.ready?"Needs its secret":t.detail;return(0,p.jsxs)("div",{className:te("flex items-center gap-2 border-t px-2.5",t.state==="paused"&&"opacity-60"),style:{height:X_},"data-trigger":t.id,children:[(0,p.jsx)("span",{className:"inline-flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:$_[t.kind]??(0,p.jsx)(As,{className:"size-3.5","aria-hidden":"true"})}),(0,p.jsxs)("button",{type:"button",className:"nodrag nopan min-w-0 flex-1 cursor-pointer text-left",onClick:()=>e.onOpen(t.id),"aria-label":`Trigger: ${t.words}`,children:[(0,p.jsx)("div",{className:"truncate text-[12px] font-semibold",children:t.name}),(0,p.jsx)("div",{className:te("truncate text-[11px]",a?"text-warning":"text-muted-foreground"),children:n})]}),t.button!==null&&t.state==="active"&&(0,p.jsx)(Z,{size:"sm",className:"nodrag nopan h-7 px-2.5",onClick:()=>e.onPress(t.id),children:"Start"})]},t.id)})]})}var AY={zone:MY,trigger:EY};function DY({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:r,label:s,labelStyle:i,labelBgStyle:l,markerEnd:c,style:f,data:u}){let{path:d,shift:m}=u??{},[g,b,v]=Js({sourceX:e,sourceY:t,sourcePosition:a,targetX:n,targetY:o,targetPosition:r,...d}),x=i;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Dc,{path:g,...c===void 0?{}:{markerEnd:c},...f===void 0?{}:{style:f}}),(0,p.jsx)(P_,{children:(0,p.jsx)("div",{className:"nodrag nopan pointer-events-none absolute rounded-sm px-1 leading-4 whitespace-nowrap",style:{transform:`translate(-50%, -50%) translate(${b+(m?.x??0)}px, ${v+(m?.y??0)}px)`,color:x?.fill,fontSize:x?.fontSize,fontWeight:x?.fontWeight,background:l?.fill},children:s})})]})}var _Y={named:DY};function PY(e,t){let a=(r,s)=>{let i=t.find(u=>u.id===r)?.zone;if(i===void 0||s==null)return null;let l=s.slice(2),c=l==="Left"?i.x:l==="Right"?i.x+i.w:i.x+i.w/2,f=l==="Top"?i.y:l==="Bottom"?i.y+i.h:i.y+i.h/2;return{x:c,y:f,position:we[l]}},n=[],o=r=>n.some(s=>Math.abs(s.x-r.x)<(s.w+r.w)/2+4&&Math.abs(s.y-r.y)<(s.h+r.h)/2+2);return e.map(r=>{if(typeof r.label!="string"||r.type!=="smoothstep")return r;let s=a(r.source,r.sourceHandle),i=a(r.target,r.targetHandle);if(s===null||i===null)return r;let l=r.pathOptions,[,c,f]=Js({sourceX:s.x,sourceY:s.y,sourcePosition:s.position,targetX:i.x,targetY:i.y,targetPosition:i.position,...l}),u=r.label.length*6.4+10,d=18,g=(s.position===we.Left||s.position===we.Right)&&(i.position===we.Left||i.position===we.Right)?{x:0,y:d+6}:{x:u/2+34,y:0},b={x:0,y:0};for(let y of[0,1,-1,2,-2,3,-3])if(b={x:g.x*y,y:g.y*y},!o({x:c+b.x,y:f+b.y,w:u,h:d}))break;n.push({x:c+b.x,y:f+b.y,w:u,h:d});let{pathOptions:v,...x}=r;return{...x,type:"named",data:{...r.data,path:l,shift:b}}})}function OY(e,t){let a=[],n=new Set,o=r=>{for(;r!==null&&!n.has(r);){let s=e.find(i=>i.id===r);if(s===void 0)return;n.add(r),a.push(s);for(let i of s.sort?.answers??[])o(i.to);s.sort!==null&&s.onFail!==null&&o(s.onFail),r=s.next}};o(t);for(let r of e)n.has(r.id)||o(r.id);return[...a.filter(r=>r.kind!=="done"),...a.filter(r=>r.kind==="done")]}function zY(e,t){let a=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,24)||"zone",n=a,o=2;for(;t.has(n);)n=`${a}-${o++}`;return n}var p2=e=>vn(e),BY=(e,t=new Date)=>Number.isNaN(new Date(e).getTime())?"":Wu(e,t,$i(),!0),FY=e=>e%1440===0?`${e/1440} day${e===1440?"":"s"}`:e%60===0?`${e/60} h`:`${e} min`;function K_({link:e}){return e===null?null:(0,p.jsxs)(p.Fragment,{children:[" ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:e.href,"data-status-link":!0,children:e.label})]})}function HY({body:e,mentions:t}){if(t.length===0)return(0,p.jsx)(p.Fragment,{children:e});let a=new RegExp(`(@(?:${t.map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|")}))(?![A-Za-z0-9_])`,"gi");return(0,p.jsx)(p.Fragment,{children:e.split(a).map((n,o)=>o%2===1?(0,p.jsx)("span",{className:"font-semibold text-primary",children:n},o):n)})}function qY({card:e,view:t,csrf:a,apply:n}){let[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(!1),l=/(?:^|\s)@([A-Za-z0-9_.-]*)$/.exec(o)?.[1],c=l===void 0?[]:t.approvers.filter(f=>f!==t.me&&f.toLowerCase().startsWith(l.toLowerCase())).slice(0,6);return(0,p.jsxs)("div",{className:"flex flex-col gap-2","data-flow-discussion":!0,children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Discussion"}),e.comments.length===0?(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"No comments yet."}):(0,p.jsx)("ol",{className:"flex flex-col gap-3",children:e.comments.map(f=>(0,p.jsxs)("li",{className:"flex gap-2","data-comment":f.id,children:[(0,p.jsx)(ei,{name:f.author,size:"md"}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:[(0,p.jsx)("span",{className:"font-semibold text-foreground",children:f.author})," · ",p2(f.at)]}),(0,p.jsx)("p",{className:"whitespace-pre-wrap break-words text-[13px]",children:(0,p.jsx)(HY,{body:f.body,mentions:f.mentions})})]})]},f.id))}),t.canEdit&&(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:async f=>{f.preventDefault(),i(!0);let u=await ca(`${t.flow.href}/cards/${e.id}/comment`,{body:o},a);i(!1),n(u),u.ok&&r("")},children:[(0,p.jsx)(zt,{value:o,onChange:f=>r(f.target.value),rows:3,maxLength:4e3,placeholder:"Add a comment. Type @ and a name to ping someone.","aria-label":"Comment"}),c.length>0&&(0,p.jsx)("div",{className:"flex flex-wrap gap-1.5","aria-label":"People to mention",children:c.map(f=>(0,p.jsxs)("button",{type:"button",className:"inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2 text-[12px] hover:border-primary/60",onClick:()=>r(u=>u.replace(/@([A-Za-z0-9_.-]*)$/,`@${f} `)),children:[(0,p.jsx)(ei,{name:f}),f]},f))}),(0,p.jsx)(Z,{type:"submit",size:"sm",className:"self-start",disabled:s||o.trim()==="",children:"Comment"})]})]})}function UY({card:e,view:t,csrf:a,apply:n}){let[o,r]=(0,me.useState)(!1),s=async(l,c)=>{r(!0),n(await ca(`${t.flow.href}/cards/${e.id}/${l}`,c,a)),r(!1)},i=e.watchers.filter(l=>l!==e.owner);return(0,p.jsxs)("div",{className:"flex flex-col gap-2","data-flow-card-people":!0,children:[t.canEdit&&e.state==="active"?(0,p.jsxs)("label",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Owner"}),(0,p.jsxs)("select",{className:gt,value:e.owner??"",disabled:o,onChange:l=>{s("assign",{owner:l.target.value})},"aria-label":"Owner",children:[(0,p.jsx)("option",{value:"",children:"No owner"}),t.approvers.map(l=>(0,p.jsx)("option",{value:l,children:l===t.me?`${l} (you)`:l},l))]})]}):e.owner!==null&&(0,p.jsxs)("p",{className:"flex items-center gap-2 text-[13px]",children:[(0,p.jsx)(ei,{name:e.owner})," Owned by ",e.owner]}),(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[t.canEdit&&e.state==="active"&&e.owner===null&&(0,p.jsx)(Z,{size:"sm",variant:"outline",disabled:o,onClick:()=>{s("assign",{owner:t.me})},children:"Take it"}),i.length>0&&(0,p.jsxs)("span",{className:"flex items-center gap-1 text-[12px] text-muted-foreground",children:[i.slice(0,5).map(l=>(0,p.jsx)(ei,{name:l},l)),i.length===1?" follows it":" follow it"]}),t.canEdit&&e.owner!==t.me&&(0,p.jsx)(Z,{size:"sm",variant:"ghost",disabled:o,onClick:()=>{s("watch",{watching:e.watching?"no":"yes"})},"aria-pressed":e.watching,children:e.watching?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Kd,{className:"size-4"}),"Stop following"]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(Zd,{className:"size-4"}),"Follow"]})})]})]})}function Z_({links:e}){return(0,p.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:e.map(t=>(0,p.jsx)("a",{className:"text-[13px] font-medium text-primary underline-offset-4 hover:underline",href:t.href,...t.href.startsWith("/")?{}:{target:"_blank",rel:"noreferrer"},children:t.label},t.label))})}function Q_({items:e}){return(0,p.jsx)("ol",{className:"flex flex-col gap-3","data-flow-items":!0,children:e.map(t=>(0,p.jsxs)("li",{className:"flex items-start gap-3","data-flow-item":t.number,children:[(0,p.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 text-[12.5px]",children:[(0,p.jsxs)("p",{className:"font-semibold",children:[t.number,". ",t.title]}),t.lines.map((a,n)=>(0,p.jsx)("p",{className:"break-words text-muted-foreground",children:a},n)),(0,p.jsx)("a",{className:"self-start font-medium text-primary underline-offset-4 hover:underline",href:t.url,target:"_blank",rel:"noreferrer",children:t.source})]}),t.image!==null&&(0,p.jsx)("a",{className:"w-28 shrink-0",href:t.image.src,target:"_blank",rel:"noreferrer",children:(0,p.jsx)("img",{className:"w-full rounded-md border object-cover object-top",style:{aspectRatio:"4 / 3"},src:t.image.src,alt:t.image.caption,loading:"lazy"})})]},t.number))})}function VY({sent:e}){return(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2","data-flow-sent":!0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Sent to ",e.person," · ",p2(e.at)]}),(0,p.jsxs)("div",{className:"mt-2 flex flex-col gap-2",children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:e.title}),(0,p.jsx)("p",{className:"max-h-60 overflow-auto whitespace-pre-wrap break-words text-[12.5px]",children:e.summary}),e.items!==void 0&&(0,p.jsx)(Q_,{items:e.items}),e.links.length>0&&(0,p.jsx)(Z_,{links:e.links})]})]})}function GY({choose:e,base:t,csrf:a,apply:n}){let[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(!1),l=async c=>{i(!0);let f=await ca(`${t}/choose`,c,a);i(!1),n(f),f.ok&&r("")};return(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-attention/50 p-3","data-flow-choose":!0,children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:e.title}),(0,p.jsx)("p",{className:"max-h-60 overflow-auto whitespace-pre-wrap break-words text-[12.5px]",children:e.summary}),e.items!==void 0&&(0,p.jsx)(Q_,{items:e.items}),e.links.length>0&&(0,p.jsx)(Z_,{links:e.links}),e.mine?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:e.options.map(c=>(0,p.jsx)(Z,{size:"sm",variant:c.choice===0?"default":"outline",disabled:s,onClick:()=>{l({choice:String(c.choice),label:c.label,entry:String(e.entry)})},"data-flow-choice":c.choice,children:c.label},c.choice))}),e.reply&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(zt,{value:o,onChange:c=>r(c.target.value),rows:2,maxLength:4e3,placeholder:"Or say what you'd change","aria-label":"What you'd change"}),(0,p.jsx)(Z,{size:"sm",variant:"outline",className:"self-start",disabled:s||o.trim()==="",onClick:()=>{l({note:o,entry:String(e.entry)})},children:"Send reply"})]})]}):(0,p.jsxs)("p",{className:"text-[12.5px] text-muted-foreground",children:["Waiting for ",e.person," to choose."]})]})}function J_({card:e,view:t,csrf:a,apply:n,onClose:o}){let[r,s]=(0,me.useState)(""),[i,l]=(0,me.useState)(e.draft?.text??"");(0,me.useEffect)(()=>{l(e.draft?.text??"")},[e.id,e.draft?.text]);let[c,f]=(0,me.useState)(!1),u=t.stages.find(g=>g.id===e.stage),d=async(g,b)=>{f(!0);let v=await ca(g,b,a);f(!1),n(v),v.ok&&s("")},m=`${t.flow.href}/cards/${e.id}`;return(0,p.jsxs)("div",{className:"flex flex-col gap-4","data-flow-card-panel":e.id,children:[(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("h2",{className:"text-[15px] font-semibold leading-snug",children:e.title}),(0,p.jsxs)("p",{className:"mt-0.5 text-[12px] text-muted-foreground",children:[e.state==="active"?`In ${u?.title??e.stage}`:e.state==="done"?"Done":e.waiting==="Ignored"?"Ignored":"Cancelled"," · added by ",e.createdBy]}),e.sorted!==null&&(0,p.jsx)("div",{className:"mt-1.5 flex",children:(0,p.jsx)(f2,{sorted:e.sorted})})]}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:o,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),e.source!==null&&(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["From ",e.source.url===null?e.source.label:(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:e.source.url,...e.source.url.startsWith("/")?{}:{target:"_blank",rel:"noreferrer"},children:e.source.label})]}),e.description!==null&&(0,p.jsx)("p",{className:"whitespace-pre-wrap text-[13px]",children:e.description}),e.waiting!==null&&e.question==null&&e.choose==null&&e.state==="active"&&(0,p.jsxs)("p",{className:"rounded-md bg-muted px-3 py-2 text-[13px]",children:[e.waiting,e.deadline!=null&&(0,p.jsx)("span",{className:"block text-muted-foreground",children:jh(e.deadline)})]}),e.question!=null&&(0,p.jsx)(XY,{question:e.question,csrf:a,apply:n}),e.choose!=null&&(0,p.jsx)(GY,{choose:e.choose,base:`${t.flow.href}/cards/${e.id}`,csrf:a,apply:n}),e.sent!=null&&(0,p.jsx)(VY,{sent:e.sent}),e.question!=null&&e.deadline!=null&&(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:jh(e.deadline)}),(0,p.jsx)(UY,{card:e,view:t,csrf:a,apply:n}),e.task!==null&&(0,p.jsx)("a",{className:"text-[13px] font-medium text-primary underline-offset-4 hover:underline",href:e.task.href,children:"Open its task"}),e.draft!==null&&!e.canDecide&&(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2",open:!0,"data-flow-draft":!0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Draft from ",e.draft.title]}),(0,p.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-[12.5px]",children:e.draft.text})]}),e.canDecide&&(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-attention/50 p-3",children:[e.handoff!=null&&(0,p.jsxs)("p",{className:"rounded-md bg-muted px-3 py-2 text-[13px]","data-subagent-handoff":!0,children:[(0,p.jsxs)("span",{className:"font-medium",children:[e.handoff.from,":"]})," ",e.handoff.note]}),e.draft!==null&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(Ct,{htmlFor:"flow-draft",className:"text-[13px]",children:["Draft from ",e.draft.title]}),(0,p.jsx)(zt,{id:"flow-draft",value:i,onChange:g=>l(g.target.value),rows:8,maxLength:12e3,"data-flow-draft-edit":!0}),i.trim()!==e.draft.text.trim()&&(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"Approving sends your edited version on."})]}),(0,p.jsxs)(Ct,{htmlFor:"flow-note",className:"text-[13px]",children:[u?.title??"Decision",": approve, or send it back"]}),(0,p.jsx)(zt,{id:"flow-note",value:r,onChange:g=>s(g.target.value),placeholder:"What should change? (needed to send it back)",rows:3}),(0,p.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,p.jsx)(Z,{size:"sm",disabled:c||e.draft!==null&&i.trim()==="",onClick:()=>{d(`${m}/decide`,{decision:"approve",note:r,...e.draft===null?{}:{draft:i}})},children:tp.card.action.label}),u?.onFail!==null&&u?.onFail!==void 0&&(0,p.jsx)(Z,{size:"sm",variant:"outline",disabled:c||r.trim()==="",onClick:()=>{d(`${m}/decide`,{decision:"send-back",note:r})},children:"Send back"})]})]}),t.canEdit&&e.state==="active"&&(0,p.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,p.jsx)(Ct,{htmlFor:"flow-move",className:"text-[13px]",children:"Move to"}),(0,p.jsx)("select",{id:"flow-move",className:"h-9 rounded-md border bg-transparent px-2 text-[13px]",value:e.stage,disabled:c,onChange:g=>{d(`${m}/move`,{stage:g.target.value})},children:t.stages.map(g=>(0,p.jsx)("option",{value:g.id,children:g.title},g.id))})]}),(e.calls??[]).length>0&&(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2","data-subagent-calls":!0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Tool calls (",e.calls.length,")"]}),(0,p.jsx)("ol",{className:"mt-2 flex flex-col gap-2.5",children:e.calls.map(g=>(0,p.jsxs)("li",{className:"flex flex-col gap-0.5 text-[12.5px]","data-subagent-call":g.state,children:[(0,p.jsxs)("span",{className:"break-words",children:[(0,p.jsx)("span",{className:"font-medium",children:g.who})," · ",g.words]}),(0,p.jsxs)("span",{className:"text-muted-foreground",children:[g.outcome,g.why!==""&&g.state!=="refused"?` · ${g.why}`:""]}),g.result!==null&&g.result!==""&&(g.state==="done"||g.state==="failed")&&(0,p.jsx)("span",{className:"mt-0.5 max-h-40 overflow-auto whitespace-pre-wrap break-words rounded bg-muted px-2 py-1 text-[12px]",children:g.result}),g.undo!=null&&g.subagent!==void 0&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"mt-1 self-start",disabled:c,"data-subagent-undo":g.id,onClick:()=>{d(`/settings/lead/subagents/${g.subagent}/week`,{op:"undo",id:String(g.id)})},children:["Undo with ",g.undo]})]},g.id))})]}),e.outputs.length>0&&(0,p.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"What zones reported"}),e.outputs.map(g=>(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2",children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[13px] font-medium",children:g.title}),(0,p.jsx)("p",{className:"mt-2 whitespace-pre-wrap text-[12.5px] text-muted-foreground",children:g.text})]},g.stage))]}),(0,p.jsx)(qY,{card:e,view:t,csrf:a,apply:n}),(0,p.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"History"}),(0,p.jsx)("ol",{className:"flex flex-col gap-1.5",children:e.history.map((g,b)=>(0,p.jsxs)("li",{className:"text-[12px]",children:[(0,p.jsx)("span",{className:"text-muted-foreground",children:BY(g.at)})," · ",g.text]},b))})]}),t.canEdit&&e.state==="active"&&(0,p.jsx)(Z,{variant:"ghost",size:"sm",className:"self-start text-destructive",disabled:c,onClick:()=>{d(`${m}/cancel`,{})},children:"Cancel card"})]})}function ge({label:e,hint:t,children:a}){return(0,p.jsxs)("label",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:e}),a,t!==void 0&&(0,p.jsx)("span",{className:"text-[12px] text-muted-foreground",children:t})]})}var gt="h-9 w-full rounded-md border bg-transparent px-2 text-[13px]",$Y=[.95,.9,.85,.8,.7,.6];function jY({sort:e,others:t,ready:a,set:n}){let o=(s,i)=>n({...e,answers:e.answers.map((l,c)=>c===s?{...l,...i}:l)}),r=(s,i)=>n({...e,notes:e.notes.map((l,c)=>c===s?{...l,...i}:l)});return(0,p.jsxs)(p.Fragment,{children:[!a&&(0,p.jsxs)("p",{className:"rounded-md border border-border px-3 py-2 text-[12.5px]","data-sort-needs-key":!0,children:["Sorting needs an OpenRouter key. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/settings#providers",children:"Add it in Settings"})]}),(0,p.jsx)(ge,{label:"Question",children:(0,p.jsx)(ve,{value:e.question,maxLength:300,onChange:s=>n({...e,question:s.target.value}),"aria-label":"Question"})}),(0,p.jsxs)("div",{className:"grid gap-2",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Answers"}),e.answers.map((s,i)=>(0,p.jsxs)("div",{className:"grid gap-1.5 rounded-md border p-2","data-sort-answer":i,children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsx)(ve,{value:s.answer,maxLength:40,placeholder:"Answer",onChange:l=>o(i,{answer:l.target.value}),"aria-label":`Answer ${i+1}`}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",disabled:e.answers.length<=2,onClick:()=>n({...e,answers:e.answers.filter((l,c)=>c!==i)}),"aria-label":`Remove ${s.answer||`answer ${i+1}`}`,children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsx)(ve,{value:s.means,maxLength:200,placeholder:"What it means, in a few words",onChange:l=>o(i,{means:l.target.value}),"aria-label":`What ${s.answer||`answer ${i+1}`} means`}),(0,p.jsxs)("select",{className:gt,value:s.to,onChange:l=>o(i,{to:l.target.value}),"aria-label":`Where ${s.answer||`answer ${i+1}`} goes`,children:[s.to===""&&(0,p.jsx)("option",{value:"",children:"Choose where it goes"}),t.map(l=>(0,p.jsxs)("option",{value:l.id,children:["Goes to ",l.title]},l.id))]})]},i)),e.answers.length<12&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>n({...e,answers:[...e.answers,{answer:"",means:"",to:""}]}),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add an answer"]})]}),(0,p.jsx)(ge,{label:"Acts on its own when",hint:"Below this, the card takes the not-sure path.",children:(0,p.jsx)("select",{className:gt,value:String(e.sureAt),onChange:s=>n({...e,sureAt:Number(s.target.value)}),"aria-label":"Acts on its own when",children:[...new Set([...$Y,e.sureAt])].sort((s,i)=>i-s).map(s=>(0,p.jsxs)("option",{value:String(s),children:[Math.round(s*100),"% sure or more"]},s))})}),(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2",open:e.notes.length>0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Also note on the card",e.notes.length>0?` (${e.notes.length})`:""]}),(0,p.jsxs)("div",{className:"mt-2 grid gap-2",children:[e.notes.map((s,i)=>(0,p.jsxs)("div",{className:"grid gap-1.5 rounded-md border p-2","data-sort-note":i,children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsxs)("select",{className:gt,value:s.kind,onChange:l=>r(i,l.target.value==="score"?{kind:"score",levels:s.levels??["Low","Medium","High"]}:{kind:"yes-no",levels:null}),"aria-label":`Note ${i+1}: kind`,children:[(0,p.jsx)("option",{value:"score",children:"A score"}),(0,p.jsx)("option",{value:"yes-no",children:"Yes or no"})]}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:()=>n({...e,notes:e.notes.filter((l,c)=>c!==i)}),"aria-label":`Remove note ${i+1}`,children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsx)(ve,{value:s.question,maxLength:300,placeholder:s.kind==="score"?"How urgent is this?":"Is the customer asking for money back?",onChange:l=>r(i,{question:l.target.value}),"aria-label":`Note ${i+1}: question`}),s.kind==="score"&&(0,p.jsx)(zt,{rows:3,value:(s.levels??[]).join(`
|
|
60
60
|
`),onChange:l=>r(i,{levels:l.target.value.split(`
|
|
61
|
-
`)}),placeholder:"One level per line, lowest first","aria-label":`Note ${i+1}: levels, lowest first`})]},i)),e.notes.length<3&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>n({...e,notes:[...e.notes,{id:"",kind:"yes-no",question:"",levels:null}]}),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add a note"]})]})]})]})}var m2="Fill-ins: {{card.title}}, {{card.description}}, {{card.email}}, {{stage.<zone id>}}.";function WY({request:e,view:t,csrf:a,apply:n,set:o}){let r=Object.entries(e.headers),s=(i,l,c)=>o({...e,headers:Object.fromEntries(r.map((f,u)=>u===i?[l,c]:f).filter(([f])=>f!==""))});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Address",hint:`The host is written out; fill-ins can go after it. ${m2}`,children:(0,p.jsxs)("div",{className:"flex gap-1.5",children:[(0,p.jsx)("select",{className:te(gt,"w-24 shrink-0"),value:e.method,onChange:i=>o({...e,method:i.target.value}),"aria-label":"Method",children:["GET","POST","PUT","PATCH","DELETE"].map(i=>(0,p.jsx)("option",{value:i,children:i},i))}),(0,p.jsx)(ve,{value:e.url,maxLength:2e3,onChange:i=>o({...e,url:i.target.value}),className:"font-mono text-[12.5px]",placeholder:"https://api.example.com/items","aria-label":"Address"})]})}),(0,p.jsxs)("div",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Headers"}),r.map(([i,l],c)=>(0,p.jsxs)("div",{className:"flex gap-1.5","data-request-header":c,children:[(0,p.jsx)(ve,{value:i,maxLength:64,onChange:f=>s(c,f.target.value,l),className:"w-32 shrink-0 font-mono text-[12px]",placeholder:"Authorization","aria-label":`Header ${c+1} name`}),(0,p.jsx)(ve,{value:l,maxLength:500,onChange:f=>s(c,i,f.target.value),className:"font-mono text-[12px]",placeholder:"Bearer {{secret.API_TOKEN}}","aria-label":`Header ${c+1} value`}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:()=>o({...e,headers:Object.fromEntries(r.filter((f,u)=>u!==c))}),"aria-label":`Remove header ${i||c+1}`,children:(0,p.jsx)(At,{className:"size-4"})})]},c)),r.length<10&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>o({...e,headers:{...e.headers,[`X-Header-${r.length+1}`]:""}}),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add a header"]})]}),e.method!=="GET"&&e.method!=="DELETE"&&(0,p.jsx)(ge,{label:"What it sends",hint:"JSON is sent as JSON, with fill-ins inside its strings; anything else as plain text.",children:(0,p.jsx)(zt,{rows:5,value:e.body??"",maxLength:8e3,onChange:i=>o({...e,body:i.target.value}),className:"font-mono text-[12px]","aria-label":"What it sends"})}),(0,p.jsx)(e8,{view:t,csrf:a,apply:n,words:(0,p.jsxs)(p.Fragment,{children:["Kept on this computer, never shown again. Use one in a header as ","{{secret.NAME}}","."]})})]})}function e8({view:e,csrf:t,apply:a,words:n,chosen:o,choose:r}){let[s,i]=(0,me.useState)({name:"",value:""}),[l,c]=(0,me.useState)(!1),f=o??[];return(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2","data-request-secrets":!0,open:f.length>0?!0:void 0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Secrets",r!==void 0?f.length>0?` (${f.length} used)`:"":e.requestSecrets.length>0?` (${e.requestSecrets.length})`:""]}),(0,p.jsxs)("div",{className:"mt-2 grid gap-2",children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:n}),e.requestSecrets.length>0&&(r===void 0?(0,p.jsx)("p",{className:"flex flex-wrap gap-1.5",children:e.requestSecrets.map(u=>(0,p.jsx)(wa,{tone:"neutral",className:"font-mono",children:u},u))}):(0,p.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1.5",children:e.requestSecrets.map(u=>(0,p.jsxs)("label",{className:"inline-flex items-center gap-1.5 font-mono text-[12px]",children:[(0,p.jsx)("input",{type:"checkbox",className:"size-4 accent-[var(--so-accent)]",checked:f.includes(u),onChange:d=>r(d.target.checked?[...f,u]:f.filter(m=>m!==u))}),u]},u))})),f.filter(u=>!e.requestSecrets.includes(u)).map(u=>(0,p.jsxs)("p",{className:"text-[12px] text-warning",children:[u," isn't saved yet: save it below."]},u)),(0,p.jsxs)("div",{className:"flex gap-1.5",children:[(0,p.jsx)(ve,{value:s.name,onChange:u=>i({...s,name:u.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")}),className:"w-32 shrink-0 font-mono text-[12px]",placeholder:"API_TOKEN","aria-label":"Secret name"}),(0,p.jsx)(ve,{type:"password",autoComplete:"off",value:s.value,onChange:u=>i({...s,value:u.target.value}),placeholder:"Its value (empty removes it)","aria-label":"Secret value"})]}),(0,p.jsx)(Z,{size:"sm",variant:"outline",className:"self-start",disabled:l||s.name==="",onClick:async()=>{c(!0);let u=await ca(`${e.flow.href}/secrets`,s,t);c(!1),a(u),u.ok&&(r!==void 0&&s.value.trim()!==""&&!f.includes(s.name)&&r([...f,s.name]),i({name:"",value:""}))},children:"Save secret"})]})]})}function t8({routes:e,others:t,set:a,hint:n}){return(0,p.jsxs)("div",{className:"grid gap-1.5","data-code-routes":!0,children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Answers (optional)"}),(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:n}),e.map((o,r)=>(0,p.jsxs)("div",{className:"flex gap-1.5",children:[(0,p.jsx)(ve,{value:o.answer,maxLength:40,onChange:s=>a(e.map((i,l)=>l===r?{...i,answer:s.target.value}:i)),className:"w-32 shrink-0",placeholder:"Urgent","aria-label":`Answer ${r+1}`}),(0,p.jsx)("select",{className:gt,value:o.to,onChange:s=>a(e.map((i,l)=>l===r?{...i,to:s.target.value}:i)),"aria-label":`Where ${o.answer||`answer ${r+1}`} leads`,children:t.map(s=>(0,p.jsx)("option",{value:s.id,children:s.title},s.id))}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:()=>a(e.filter((s,i)=>i!==r)),"aria-label":`Remove ${o.answer||`answer ${r+1}`}`,children:(0,p.jsx)(At,{className:"size-4"})})]},r)),e.length<12&&t.length>0&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>a([...e,{answer:"",to:t[0].id}]),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add an answer"]})]})}function XY({question:e,csrf:t,apply:a}){let[n,o]=(0,me.useState)(""),[r,s]=(0,me.useState)(!1),i=async c=>{s(!0);let f=await ca(`/teammates/questions/${e.id}/answer`,c,t);s(!1),a(f),f.ok&&o("")},l=e.call??null;return(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-attention/50 p-3","data-teammate-question":e.id,children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:l===null?`${e.from} asks${e.mine?" you":` ${e.askedOf}`}`:`${e.from} needs ${e.mine?"your":`${e.askedOf}'s`} approval`}),(0,p.jsx)("p",{className:"break-words text-[13px] font-medium",children:e.question}),l!==null&&(0,p.jsxs)("p",{className:"text-[12.5px] text-muted-foreground","data-teammate-call-why":!0,children:[l.why!==""&&(0,p.jsxs)(p.Fragment,{children:[l.why," "]}),"(",l.rule,")"]}),e.mine&&(0,p.jsxs)(p.Fragment,{children:[e.options.length>0&&(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:e.options.map((c,f)=>(0,p.jsx)(Z,{size:"sm",variant:l!==null&&f===0?"default":"outline",disabled:r,onClick:()=>{i({choice:c.id})},children:c.label},c.id))}),(0,p.jsx)(zt,{value:n,onChange:c=>o(c.target.value),rows:2,maxLength:2e3,placeholder:l===null?"Or answer in your words":`Or tell ${e.from.split(" · ")[0]} what to do instead`,"aria-label":"Your answer"}),(0,p.jsx)(Z,{size:"sm",className:"self-start",disabled:r||n.trim()==="",onClick:()=>{i({text:n})},children:"Answer"})]})]})}function YY({stage:e,others:t,view:a,update:n}){let o=a.teammates??[];return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Teammate",hint:o.length===0?void 0:"It follows its soul file's rules, and asks the flow's owner when they say to.",children:o.length===0?(0,p.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:["No teammates in this project yet. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/teammates",children:"Add one"}),"."]}):(0,p.jsx)("select",{className:gt,"aria-label":"Teammate",value:e.teammate??"",onChange:r=>n({teammate:r.target.value}),children:o.map(r=>(0,p.jsxs)("option",{value:r.handle,children:[r.label,r.working?"":" (paused)"]},r.handle))})}),(0,p.jsx)(ge,{label:"What to do here",children:(0,p.jsx)(zt,{rows:4,value:e.instructions??"",maxLength:8e3,onChange:r=>n({instructions:r.target.value}),"aria-label":"What to do here",placeholder:"Read the customer's reply and decide what happens next."})}),(0,p.jsx)(t8,{routes:e.routes??[],others:t,set:r=>n({routes:r}),hint:"It picks one, and writes what the next zones send. With none, it moves the card on to “Then”."}),(0,p.jsxs)("label",{className:"flex items-start gap-2 text-[13px]",children:[(0,p.jsx)("input",{type:"checkbox",className:"mt-0.5 size-4",checked:e.reply===!0,onChange:r=>n({reply:r.target.checked?!0:void 0}),"data-teammate-reply":!0}),(0,p.jsxs)("span",{children:["Answer whoever asked",(0,p.jsx)("span",{className:"block text-[12px] text-muted-foreground",children:"What it writes goes back to the person who added the card, in their chat app."})]})]})]})}function KY({stage:e,others:t,view:a,csrf:n,apply:o,update:r}){let s=e.routes??[],i=a.scripts.find(c=>c.name===e.script),l=c=>r({routes:c});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Script",hint:a.scripts.length===0?"This project has no scripts yet: make one with Scripts in the toolbar, or ask your lead in chat.":i!==void 0?`${a8[i.language]}${i.file===null?"":`, runs ${i.file}`}. It gets the card as JSON on stdin; what it prints is this step's result.`:void 0,children:(0,p.jsxs)("select",{className:gt,"aria-label":"Script",value:e.script??"",onChange:c=>r({script:c.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:"Choose a script"}),a.scripts.map(c=>(0,p.jsxs)("option",{value:c.name,children:[c.name," — ",c.about]},c.name)),e.script!==null&&!a.scripts.some(c=>c.name===e.script)&&(0,p.jsxs)("option",{value:e.script,children:[e.script," (missing)"]})]})}),(0,p.jsx)(ge,{label:"Runs in",hint:(e.runIn??"copy")==="folder"?"Fast. The project's folder is at $FLOW_PROJECT.":"The project's setup runs first. Use this to test or check code.",children:(0,p.jsxs)("select",{className:gt,"aria-label":"Runs in",value:e.runIn??"copy",onChange:c=>r({runIn:c.target.value}),children:[(0,p.jsx)("option",{value:"folder",children:"An empty folder"}),(0,p.jsx)("option",{value:"copy",children:"A copy of the project, at the card's work"})]})}),(0,p.jsx)(t8,{routes:s,others:t,set:l,hint:(0,p.jsxs)(p.Fragment,{children:["If its last line is “goto: ",(0,p.jsx)("em",{children:"answer"}),"”, the card goes where that answer leads."]})}),(0,p.jsx)(e8,{view:a,csrf:n,apply:o,chosen:e.secrets??[],choose:c=>r({secrets:c}),words:"Kept on this computer, never shown again. The script gets each one it's given as a variable of the same name."})]})}var a8={shell:"Shell",python:"Python",node:"Node"},ZY={python:`import json, sys
|
|
61
|
+
`)}),placeholder:"One level per line, lowest first","aria-label":`Note ${i+1}: levels, lowest first`})]},i)),e.notes.length<3&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>n({...e,notes:[...e.notes,{id:"",kind:"yes-no",question:"",levels:null}]}),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add a note"]})]})]})]})}var m2="Fill-ins: {{card.title}}, {{card.description}}, {{card.email}}, {{stage.<zone id>}}.";function WY({request:e,view:t,csrf:a,apply:n,set:o}){let r=Object.entries(e.headers),s=(i,l,c)=>o({...e,headers:Object.fromEntries(r.map((f,u)=>u===i?[l,c]:f).filter(([f])=>f!==""))});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Address",hint:`The host is written out; fill-ins can go after it. ${m2}`,children:(0,p.jsxs)("div",{className:"flex gap-1.5",children:[(0,p.jsx)("select",{className:te(gt,"w-24 shrink-0"),value:e.method,onChange:i=>o({...e,method:i.target.value}),"aria-label":"Method",children:["GET","POST","PUT","PATCH","DELETE"].map(i=>(0,p.jsx)("option",{value:i,children:i},i))}),(0,p.jsx)(ve,{value:e.url,maxLength:2e3,onChange:i=>o({...e,url:i.target.value}),className:"font-mono text-[12.5px]",placeholder:"https://api.example.com/items","aria-label":"Address"})]})}),(0,p.jsxs)("div",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Headers"}),r.map(([i,l],c)=>(0,p.jsxs)("div",{className:"flex gap-1.5","data-request-header":c,children:[(0,p.jsx)(ve,{value:i,maxLength:64,onChange:f=>s(c,f.target.value,l),className:"w-32 shrink-0 font-mono text-[12px]",placeholder:"Authorization","aria-label":`Header ${c+1} name`}),(0,p.jsx)(ve,{value:l,maxLength:500,onChange:f=>s(c,i,f.target.value),className:"font-mono text-[12px]",placeholder:"Bearer {{secret.API_TOKEN}}","aria-label":`Header ${c+1} value`}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:()=>o({...e,headers:Object.fromEntries(r.filter((f,u)=>u!==c))}),"aria-label":`Remove header ${i||c+1}`,children:(0,p.jsx)(At,{className:"size-4"})})]},c)),r.length<10&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>o({...e,headers:{...e.headers,[`X-Header-${r.length+1}`]:""}}),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add a header"]})]}),e.method!=="GET"&&e.method!=="DELETE"&&(0,p.jsx)(ge,{label:"What it sends",hint:"JSON is sent as JSON, with fill-ins inside its strings; anything else as plain text.",children:(0,p.jsx)(zt,{rows:5,value:e.body??"",maxLength:8e3,onChange:i=>o({...e,body:i.target.value}),className:"font-mono text-[12px]","aria-label":"What it sends"})}),(0,p.jsx)(e8,{view:t,csrf:a,apply:n,words:(0,p.jsxs)(p.Fragment,{children:["Kept on this computer, never shown again. Use one in a header as ","{{secret.NAME}}","."]})})]})}function e8({view:e,csrf:t,apply:a,words:n,chosen:o,choose:r}){let[s,i]=(0,me.useState)({name:"",value:""}),[l,c]=(0,me.useState)(!1),f=o??[];return(0,p.jsxs)("details",{className:"rounded-md border px-3 py-2","data-request-secrets":!0,open:f.length>0?!0:void 0,children:[(0,p.jsxs)("summary",{className:"cursor-pointer text-[13px] font-medium",children:["Secrets",r!==void 0?f.length>0?` (${f.length} used)`:"":e.requestSecrets.length>0?` (${e.requestSecrets.length})`:""]}),(0,p.jsxs)("div",{className:"mt-2 grid gap-2",children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:n}),e.requestSecrets.length>0&&(r===void 0?(0,p.jsx)("p",{className:"flex flex-wrap gap-1.5",children:e.requestSecrets.map(u=>(0,p.jsx)(wa,{tone:"neutral",className:"font-mono",children:u},u))}):(0,p.jsx)("div",{className:"flex flex-wrap gap-x-3 gap-y-1.5",children:e.requestSecrets.map(u=>(0,p.jsxs)("label",{className:"inline-flex items-center gap-1.5 font-mono text-[12px]",children:[(0,p.jsx)("input",{type:"checkbox",className:"size-4 accent-[var(--so-accent)]",checked:f.includes(u),onChange:d=>r(d.target.checked?[...f,u]:f.filter(m=>m!==u))}),u]},u))})),f.filter(u=>!e.requestSecrets.includes(u)).map(u=>(0,p.jsxs)("p",{className:"text-[12px] text-warning",children:[u," isn't saved yet: save it below."]},u)),(0,p.jsxs)("div",{className:"flex gap-1.5",children:[(0,p.jsx)(ve,{value:s.name,onChange:u=>i({...s,name:u.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")}),className:"w-32 shrink-0 font-mono text-[12px]",placeholder:"API_TOKEN","aria-label":"Secret name"}),(0,p.jsx)(ve,{type:"password",autoComplete:"off",value:s.value,onChange:u=>i({...s,value:u.target.value}),placeholder:"Its value (empty removes it)","aria-label":"Secret value"})]}),(0,p.jsx)(Z,{size:"sm",variant:"outline",className:"self-start",disabled:l||s.name==="",onClick:async()=>{c(!0);let u=await ca(`${e.flow.href}/secrets`,s,t);c(!1),a(u),u.ok&&(r!==void 0&&s.value.trim()!==""&&!f.includes(s.name)&&r([...f,s.name]),i({name:"",value:""}))},children:"Save secret"})]})]})}function t8({routes:e,others:t,set:a,hint:n}){return(0,p.jsxs)("div",{className:"grid gap-1.5","data-code-routes":!0,children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Answers (optional)"}),(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:n}),e.map((o,r)=>(0,p.jsxs)("div",{className:"flex gap-1.5",children:[(0,p.jsx)(ve,{value:o.answer,maxLength:40,onChange:s=>a(e.map((i,l)=>l===r?{...i,answer:s.target.value}:i)),className:"w-32 shrink-0",placeholder:"Urgent","aria-label":`Answer ${r+1}`}),(0,p.jsx)("select",{className:gt,value:o.to,onChange:s=>a(e.map((i,l)=>l===r?{...i,to:s.target.value}:i)),"aria-label":`Where ${o.answer||`answer ${r+1}`} leads`,children:t.map(s=>(0,p.jsx)("option",{value:s.id,children:s.title},s.id))}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:()=>a(e.filter((s,i)=>i!==r)),"aria-label":`Remove ${o.answer||`answer ${r+1}`}`,children:(0,p.jsx)(At,{className:"size-4"})})]},r)),e.length<12&&t.length>0&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>a([...e,{answer:"",to:t[0].id}]),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add an answer"]})]})}function XY({question:e,csrf:t,apply:a}){let[n,o]=(0,me.useState)(""),[r,s]=(0,me.useState)(!1),i=async c=>{s(!0);let f=await ca(`/settings/lead/subagents/questions/${e.id}/answer`,c,t);s(!1),a(f),f.ok&&o("")},l=e.call??null;return(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-attention/50 p-3","data-subagent-question":e.id,children:[(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:l===null?`${e.from} asks${e.mine?" you":` ${e.askedOf}`}`:`${e.from} needs ${e.mine?"your":`${e.askedOf}'s`} approval`}),(0,p.jsx)("p",{className:"break-words text-[13px] font-medium",children:e.question}),l!==null&&(0,p.jsxs)("p",{className:"text-[12.5px] text-muted-foreground","data-subagent-call-why":!0,children:[l.why!==""&&(0,p.jsxs)(p.Fragment,{children:[l.why," "]}),"(",l.rule,")"]}),e.mine&&(0,p.jsxs)(p.Fragment,{children:[e.options.length>0&&(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:e.options.map((c,f)=>(0,p.jsx)(Z,{size:"sm",variant:l!==null&&f===0?"default":"outline",disabled:r,onClick:()=>{i({choice:c.id})},children:c.label},c.id))}),(0,p.jsx)(zt,{value:n,onChange:c=>o(c.target.value),rows:2,maxLength:2e3,placeholder:l===null?"Or answer in your words":`Or tell ${e.from.split(" · ")[0]} what to do instead`,"aria-label":"Your answer"}),(0,p.jsx)(Z,{size:"sm",className:"self-start",disabled:r||n.trim()==="",onClick:()=>{i({text:n})},children:"Answer"})]})]})}function YY({stage:e,others:t,view:a,update:n}){let o=a.subagents??[];return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Subagent",hint:o.length===0?void 0:"It follows its soul file's rules, and asks the flow's owner when they say to.",children:o.length===0?(0,p.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:["No subagents in this project yet. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/settings/lead/subagents",children:"Add one"}),"."]}):(0,p.jsx)("select",{className:gt,"aria-label":"Subagent",value:e.subagent??"",onChange:r=>n({subagent:r.target.value}),children:o.map(r=>(0,p.jsxs)("option",{value:r.handle,children:[r.label,r.working?"":" (paused)"]},r.handle))})}),(0,p.jsx)(ge,{label:"What to do here",children:(0,p.jsx)(zt,{rows:4,value:e.instructions??"",maxLength:8e3,onChange:r=>n({instructions:r.target.value}),"aria-label":"What to do here",placeholder:"Read the customer's reply and decide what happens next."})}),(0,p.jsx)(t8,{routes:e.routes??[],others:t,set:r=>n({routes:r}),hint:"It picks one, and writes what the next zones send. With none, it moves the card on to “Then”."}),(0,p.jsxs)("label",{className:"flex items-start gap-2 text-[13px]",children:[(0,p.jsx)("input",{type:"checkbox",className:"mt-0.5 size-4",checked:e.reply===!0,onChange:r=>n({reply:r.target.checked?!0:void 0}),"data-subagent-reply":!0}),(0,p.jsxs)("span",{children:["Answer whoever asked",(0,p.jsx)("span",{className:"block text-[12px] text-muted-foreground",children:"What it writes goes back to the person who added the card, in their chat app."})]})]})]})}function KY({stage:e,others:t,view:a,csrf:n,apply:o,update:r}){let s=e.routes??[],i=a.scripts.find(c=>c.name===e.script),l=c=>r({routes:c});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Script",hint:a.scripts.length===0?"This project has no scripts yet: make one with Scripts in the toolbar, or ask your lead in chat.":i!==void 0?`${a8[i.language]}${i.file===null?"":`, runs ${i.file}`}. It gets the card as JSON on stdin; what it prints is this step's result.`:void 0,children:(0,p.jsxs)("select",{className:gt,"aria-label":"Script",value:e.script??"",onChange:c=>r({script:c.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:"Choose a script"}),a.scripts.map(c=>(0,p.jsxs)("option",{value:c.name,children:[c.name," — ",c.about]},c.name)),e.script!==null&&!a.scripts.some(c=>c.name===e.script)&&(0,p.jsxs)("option",{value:e.script,children:[e.script," (missing)"]})]})}),(0,p.jsx)(ge,{label:"Runs in",hint:(e.runIn??"copy")==="folder"?"Fast. The project's folder is at $FLOW_PROJECT.":"The project's setup runs first. Use this to test or check code.",children:(0,p.jsxs)("select",{className:gt,"aria-label":"Runs in",value:e.runIn??"copy",onChange:c=>r({runIn:c.target.value}),children:[(0,p.jsx)("option",{value:"folder",children:"An empty folder"}),(0,p.jsx)("option",{value:"copy",children:"A copy of the project, at the card's work"})]})}),(0,p.jsx)(t8,{routes:s,others:t,set:l,hint:(0,p.jsxs)(p.Fragment,{children:["If its last line is “goto: ",(0,p.jsx)("em",{children:"answer"}),"”, the card goes where that answer leads."]})}),(0,p.jsx)(e8,{view:a,csrf:n,apply:o,chosen:e.secrets??[],choose:c=>r({secrets:c}),words:"Kept on this computer, never shown again. The script gets each one it's given as a variable of the same name."})]})}var a8={shell:"Shell",python:"Python",node:"Node"},ZY={python:`import json, sys
|
|
62
62
|
card = json.load(sys.stdin)["card"]
|
|
63
63
|
print(f"Looked at {card['title']}")`,node:'import { readFileSync } from "node:fs";\nconst { card } = JSON.parse(readFileSync(0, "utf8"));\nconsole.log(`Looked at ${card.title}`);',shell:`npm ci
|
|
64
|
-
npm test`};function QY({email:e,view:t,set:a}){return(0,p.jsxs)(p.Fragment,{children:[!t.emailReady&&(0,p.jsxs)("p",{className:"rounded-md border border-border px-3 py-2 text-[12.5px]","data-email-needs-setup":!0,children:["Email isn't set up yet. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/settings#email",children:"Add your mail server in Settings"})]}),(0,p.jsx)(ge,{label:"To",children:(0,p.jsx)(ve,{value:e.to,maxLength:500,onChange:n=>a({...e,to:n.target.value}),"aria-label":"To"})}),(0,p.jsx)(ge,{label:"Subject",children:(0,p.jsx)(ve,{value:e.subject,maxLength:200,onChange:n=>a({...e,subject:n.target.value}),"aria-label":"Subject"})}),(0,p.jsx)(ge,{label:"Email",hint:m2,children:(0,p.jsx)(zt,{rows:6,value:e.body,maxLength:8e3,onChange:n=>a({...e,body:n.target.value}),"aria-label":"Email"})})]})}function JY({tool:e,view:t,set:a}){let n=t.tools.find(o=>o.name===e.server);return(0,p.jsxs)(p.Fragment,{children:[t.tools.length===0?(0,p.jsxs)("p",{className:"rounded-md border border-border px-3 py-2 text-[12.5px]","data-tool-needs-setup":!0,children:["This project has no tools yet. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/settings/tools",children:"Add one on the Tools page"})]}):(0,p.jsx)(ge,{label:"Tool",...n!==void 0&&!n.ready?{hint:"It needs its secrets set on the Tools page first."}:n!==void 0?{hint:n.about}:{},children:(0,p.jsxs)("select",{className:gt,value:e.server,onChange:o=>a({...e,server:o.target.value,name:t.tools.find(r=>r.name===o.target.value)?.functions[0]??""}),"aria-label":"Tool",children:[n===void 0&&(0,p.jsx)("option",{value:e.server,children:e.server===""?"Choose a tool":`${e.server} (missing)`}),t.tools.map(o=>(0,p.jsx)("option",{value:o.name,children:o.name},o.name))]})}),(0,p.jsx)(ge,{label:"What it does",hint:n!==void 0&&n.functions.length===0?"Test the tool on the Tools page to list what it can do.":void 0,children:n!==void 0&&n.functions.length>0?(0,p.jsxs)("select",{className:gt,value:e.name,onChange:o=>a({...e,name:o.target.value}),"aria-label":"What it does",children:[!n.functions.includes(e.name)&&(0,p.jsx)("option",{value:e.name,children:e.name||"Choose"}),n.functions.map(o=>(0,p.jsx)("option",{value:o,children:o},o))]}):(0,p.jsx)(ve,{value:e.name,maxLength:100,onChange:o=>a({...e,name:o.target.value}),className:"font-mono","aria-label":"What it does"})}),(0,p.jsx)(ge,{label:"Arguments",hint:`JSON, with fill-ins inside its strings. ${m2}`,children:(0,p.jsx)(zt,{rows:5,value:e.args,maxLength:4e3,onChange:o=>a({...e,args:o.target.value}),className:"font-mono text-[12px]","aria-label":"Arguments"})})]})}function eK({stage:e,stages:t,view:a,csrf:n,apply:o,update:r,remove:s,makeStart:i,onClose:l}){let c=t.filter(d=>d.id!==e.id),f=gt,u=a.kinds.find(d=>d.kind===e.kind);return(0,p.jsxs)("div",{className:"flex flex-col gap-3","data-flow-zone-panel":e.id,children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:"Edit zone"}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:l,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsx)(ge,{label:"Name",children:(0,p.jsx)(ve,{value:e.title,maxLength:60,onChange:d=>r({title:d.target.value}),"aria-label":"Zone name"})}),(0,p.jsx)(ge,{label:"What happens here",...u===void 0?{}:{hint:u.about},children:(0,p.jsx)("select",{className:f,"aria-label":"What happens here",value:e.kind,onChange:d=>r({kind:d.target.value,...d.target.value==="done"?{next:null,onFail:null}:{},...d.target.value==="update"?{close:e.close??!0,message:e.message??"Done: {{card.title}}"}:{},...d.target.value==="check"?{script:e.script??a.scripts[0]?.name??null,runIn:e.runIn??"folder"}:{},...d.target.value==="request"?{request:e.request??{method:"POST",url:"https://",headers:{},body:'{"title": "{{card.title}}", "details": "{{card.description}}"}'}}:{},...d.target.value==="email"?{email:e.email??{to:"{{card.email}}",subject:"Re: {{card.title}}",body:t.find(m=>m.kind==="draft")?`{{stage.${t.find(m=>m.kind==="draft").id}}}`:""}}:{},...d.target.value==="tool"?{tool:e.tool??{server:a.tools[0]?.name??"",name:a.tools[0]?.functions[0]??"",args:'{"text": "{{card.title}}"}'}}:{},...d.target.value==="draft"?{instructions:e.instructions??"Write a short, friendly reply to the person who sent this card, in plain words."}:{},...d.target.value==="approval"?{toOwner:e.toOwner??!0}:{},...d.target.value==="wait"?{wait:e.wait??{for:"reply",minutes:4320}}:{},...d.target.value==="teammate"?{teammate:e.teammate??a.teammates?.[0]?.handle,instructions:e.instructions??"Read the card and decide what happens next."}:d.target.value!=="approval"?{teammate:void 0}:{},...d.target.value==="wait"||d.target.value==="done"?{limit:void 0}:d.target.value!=="inbox"&&d.target.value!=="approval"&&d.target.value!=="choose"&&e.limit!==void 0?{limit:{...e.limit,to:null}}:{},...d.target.value==="choose"?{next:null,options:e.options??[{label:"Looks good",to:c.find(m=>m.kind==="done")?.id??c[0]?.id??"end"},{label:"Ignore",to:"end"}]}:{options:void 0},...d.target.value==="task"?{}:{repo:void 0},...d.target.value==="sort"?{next:null,sort:e.sort??{question:"What kind of card is this?",answers:c.slice(0,2).map(m=>({answer:m.title.slice(0,40),means:m.title,to:m.id})),sureAt:.8,notes:[]}}:{}}),children:a.kinds.map(d=>(0,p.jsx)("option",{value:d.kind,children:d.label},d.kind))})}),e.kind==="draft"&&(0,p.jsx)(ge,{label:"What Claude should write",hint:"Claude reads the card and what earlier zones said. Put a “Person decides” zone next to read and edit it first.",children:(0,p.jsx)(zt,{rows:5,value:e.instructions??"",maxLength:8e3,onChange:d=>r({instructions:d.target.value}),"aria-label":"What Claude should write"})}),(e.kind==="task"||e.kind==="report")&&(0,p.jsx)(ge,{label:"What the agent should do",hint:"Fill-ins: {{card.title}}, {{card.description}}, {{note}} (the latest send-back note), {{stage.<zone id>}} (an earlier zone's report; a research zone adds .items and .report).",children:(0,p.jsx)(zt,{rows:7,value:e.instructions??"",onChange:d=>r({instructions:d.target.value}),"aria-label":"What the agent should do"})}),e.kind==="task"&&(a.projects??[]).length>1&&(0,p.jsx)(ge,{label:"Builds in",hint:"Another project files its task there, as the flow's owner, under that project's approvals.",children:(0,p.jsxs)("select",{className:f,"aria-label":"Builds in",value:e.repo??a.projects[0].path,onChange:d=>r({repo:d.target.value===a.projects[0].path?void 0:d.target.value}),children:[a.projects.map((d,m)=>(0,p.jsx)("option",{value:d.path,children:m===0?`${d.name} (this flow's project)`:d.name},d.path)),e.repo!==void 0&&!a.projects.some(d=>d.path===e.repo)&&(0,p.jsxs)("option",{value:e.repo,children:[e.repo," (not yours)"]})]})}),e.kind==="choose"&&(0,p.jsx)(tK,{options:e.options??[],others:c,set:d=>r({options:d})}),e.kind==="task"&&(0,p.jsx)(ge,{label:"Plan first?",children:(0,p.jsxs)("select",{className:f,"aria-label":"Plan first?",value:e.planning??"auto",onChange:d=>r({planning:d.target.value}),children:[(0,p.jsx)("option",{value:"auto",children:"Let Toolroll decide"}),(0,p.jsx)("option",{value:"required",children:"Always plan first"}),(0,p.jsx)("option",{value:"skip",children:"Build directly"})]})}),e.kind==="approval"&&(0,p.jsx)(ge,{label:"Who decides",children:(0,p.jsxs)("select",{className:f,"aria-label":"Who decides",value:e.teammate!==void 0?`__mate__:${e.teammate}`:e.toOwner===!0?"__owner__":e.approver??"",onChange:d=>r(d.target.value.startsWith("__mate__:")?{teammate:d.target.value.slice(9),toOwner:!0,approver:null}:d.target.value==="__owner__"?{teammate:void 0,toOwner:!0,approver:null}:{teammate:void 0,toOwner:!1,approver:d.target.value===""?null:d.target.value}),children:[(a.teammates??[]).map(d=>(0,p.jsxs)("option",{value:`__mate__:${d.handle}`,children:[d.name," (AI teammate), handing hard ones to the flow's owner",d.working?"":" (paused)"]},d.handle)),(0,p.jsxs)("option",{value:"__owner__",children:["The flow's owner (",a.flow.owner,"), in their chat app"]}),(0,p.jsx)("option",{value:"",children:"Anyone who can approve"}),a.approvers.map(d=>(0,p.jsx)("option",{value:d,children:d},d))]})}),e.kind==="notify"&&(0,p.jsx)(ge,{label:"Message",children:(0,p.jsx)(ve,{value:e.message??"",maxLength:1e3,onChange:d=>r({message:d.target.value}),"aria-label":"Message"})}),e.kind==="update"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Comment on the issue",hint:"Fill-ins: {{card.title}}, {{note}}, {{stage.<zone id>}}.",children:(0,p.jsx)(zt,{rows:3,value:e.message??"",maxLength:1e3,onChange:d=>r({message:d.target.value}),"aria-label":"Comment on the issue"})}),(0,p.jsxs)("label",{className:"flex items-center gap-2 text-[13px]",children:[(0,p.jsx)("input",{type:"checkbox",className:"size-4 accent-[var(--so-accent)]",checked:e.close!==!1,onChange:d=>r({close:d.target.checked})}),"Close the issue too (Linear: move it to done)"]})]}),e.kind==="pull-request"&&(0,p.jsx)(ge,{label:"When checks pass",hint:"Merging needs a “Person decides” zone before this one, and a person's approval of the card since it was built.",children:(0,p.jsxs)("select",{className:f,"aria-label":"When checks pass",value:e.merge??"",onChange:d=>r({merge:d.target.value===""?void 0:d.target.value}),children:[(0,p.jsx)("option",{value:"",children:"Move on; a person merges"}),(0,p.jsx)("option",{value:"squash",children:"Merge (squash)"}),(0,p.jsx)("option",{value:"merge",children:"Merge (merge commit)"}),(0,p.jsx)("option",{value:"rebase",children:"Merge (rebase)"})]})}),e.kind==="check"&&(0,p.jsx)(KY,{stage:e,others:c,view:a,csrf:n,apply:o,update:r}),e.kind==="teammate"&&(0,p.jsx)(YY,{stage:e,others:c,view:a,update:r}),e.kind==="request"&&e.request!==void 0&&(0,p.jsx)(WY,{request:e.request,view:a,csrf:n,apply:o,set:d=>r({request:d})}),e.kind==="email"&&e.email!==void 0&&(0,p.jsx)(QY,{email:e.email,view:a,set:d=>r({email:d})}),e.kind==="tool"&&e.tool!==void 0&&(0,p.jsx)(JY,{tool:e.tool,view:a,set:d=>r({tool:d})}),e.kind==="sort"&&e.sort!==null&&(0,p.jsx)(jY,{sort:e.sort,others:c,ready:a.sortReady,set:d=>r({sort:d})}),e.kind==="wait"&&e.wait!==void 0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Wait for",hint:e.wait.for==="reply"?"Only a reply from someone it emailed counts. Needs the inbox in Settings → Email.":void 0,children:(0,p.jsxs)("select",{className:f,"aria-label":"Wait for",value:e.wait.for,onChange:d=>r({wait:d.target.value==="hours"?{for:"hours",minutes:0,from:e.wait.from??"22:00",to:e.wait.to??"06:00"}:{for:d.target.value,minutes:e.wait.minutes>0?e.wait.minutes:1440}}),children:[(0,p.jsx)("option",{value:"reply",children:"A reply to the card's email"}),(0,p.jsx)("option",{value:"time",children:"A set time"}),(0,p.jsx)("option",{value:"hours",children:"Set hours, like overnight"})]})}),e.wait.for==="hours"?(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsx)(ge,{label:"From",children:(0,p.jsx)(ve,{type:"time",value:e.wait.from??"22:00",onChange:d=>r({wait:{...e.wait,from:d.target.value}}),"aria-label":"From"})}),(0,p.jsx)(ge,{label:"Until",children:(0,p.jsx)(ve,{type:"time",value:e.wait.to??"06:00",onChange:d=>r({wait:{...e.wait,to:d.target.value}}),"aria-label":"Until"})})]}):(0,p.jsx)(ge,{label:e.wait.for==="reply"?"For up to":"How long",children:(0,p.jsx)(n8,{minutes:e.wait.minutes,label:e.wait.for==="reply"?"For up to":"How long",set:d=>r({wait:{...e.wait,minutes:d}})})})]}),e.kind!=="done"&&e.kind!=="sort"&&e.kind!=="choose"&&(0,p.jsx)(ge,{label:e.kind==="wait"&&e.wait?.for==="reply"?"When they reply":"Then",children:(0,p.jsxs)("select",{className:f,"aria-label":e.kind==="wait"&&e.wait?.for==="reply"?"When they reply":"Then",value:e.next??"",onChange:d=>r({next:d.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:"Wait here"}),c.map(d=>(0,p.jsx)("option",{value:d.id,children:d.title},d.id))]})}),e.kind==="wait"&&e.wait?.for==="reply"&&(0,p.jsx)(ge,{label:"If no reply",children:(0,p.jsxs)("select",{className:f,"aria-label":"If no reply",value:e.onFail??"",onChange:d=>r({onFail:d.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:"Stay here for a person"}),c.map(d=>(0,p.jsx)("option",{value:d.id,children:d.title},d.id))]})}),(e.kind==="approval"||e.kind==="task"||e.kind==="report"||e.kind==="check"||e.kind==="pull-request"||e.kind==="update"||e.kind==="sort"||e.kind==="request"||e.kind==="email"||e.kind==="tool"||e.kind==="teammate"||e.kind==="choose")&&(0,p.jsx)(ge,{label:U_[e.kind]??"If it fails",...e.kind==="choose"?{hint:"Their reply is the note there ({{note}})."}:{},children:(0,p.jsxs)("select",{className:f,"aria-label":U_[e.kind]??"If it fails",value:e.onFail??"",onChange:d=>r({onFail:d.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:e.kind==="approval"?"Can't be sent back":e.kind==="sort"?"Wait here for a person":e.kind==="choose"?"Where the first option goes":"Wait here"}),c.map(d=>(0,p.jsx)("option",{value:d.id,children:d.title},d.id))]})}),e.kind!=="wait"&&e.kind!=="done"&&(0,p.jsx)(aK,{stage:e,others:c,update:r}),(0,p.jsxs)("div",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Color"}),(0,p.jsx)("div",{className:"flex gap-2",children:a.colors.map(d=>(0,p.jsx)("button",{type:"button","aria-label":d,"aria-pressed":e.zone.color===d,className:te("size-7 rounded-full border-2",e.zone.color===d?"border-foreground":"border-transparent"),style:{background:Ep[d]},onClick:()=>r({zone:{...e.zone,color:d}})},d))})]}),(0,p.jsxs)("div",{className:"flex flex-wrap gap-2 pt-1",children:[a.start!==e.id&&(0,p.jsx)(Z,{variant:"outline",size:"sm",onClick:i,children:"New cards start here"}),(0,p.jsx)(Z,{variant:"ghost",size:"sm",className:"text-destructive",onClick:s,disabled:t.length<=1,children:"Delete zone"})]})]})}var U_={approval:"If sent back",sort:"If it isn't sure",teammate:"If it can't handle it","pull-request":"If checks fail",choose:"If they reply"};function tK({options:e,others:t,set:a}){let n=(o,r)=>a(e.map((s,i)=>i===o?{...s,...r}:s));return(0,p.jsxs)("div",{className:"grid gap-2","data-choose-options":!0,children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Buttons"}),e.map((o,r)=>(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,p.jsx)(ve,{className:"min-w-0 flex-1",value:o.label,maxLength:40,onChange:s=>n(r,{label:s.target.value}),"aria-label":`Button ${r+1}`}),(0,p.jsxs)("select",{className:te(gt,"min-w-0 flex-1"),"aria-label":`Button ${r+1} goes to`,value:o.to,onChange:s=>n(r,{to:s.target.value}),children:[(0,p.jsx)("option",{value:"end",children:"Ignore the card"}),t.map(s=>(0,p.jsx)("option",{value:s.id,children:s.title},s.id))]}),e.length>2&&(0,p.jsx)(Z,{type:"button",variant:"ghost",size:"icon",onClick:()=>a(e.filter((s,i)=>i!==r)),"aria-label":`Remove button ${r+1}`,children:(0,p.jsx)(At,{className:"size-4"})})]},r)),e.length<4&&(0,p.jsxs)(Z,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>a([...e,{label:"",to:t[0]?.id??"end"}]),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add a button"]})]})}function n8({minutes:e,label:t,set:a}){let n=e%1440===0?1440:e%60===0?60:1;return(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(ve,{type:"number",min:1,max:Math.floor(43200/n),value:e/n,className:"w-24","aria-label":`${t} (number)`,onChange:o=>{let r=Math.round(Number(o.target.value));Number.isFinite(r)&&r>=1&&a(Math.min(43200,r*n))}}),(0,p.jsxs)("select",{className:gt,"aria-label":`${t} (unit)`,value:n,onChange:o=>a(Math.min(43200,Math.max(1,e/n*Number(o.target.value)))),children:[(0,p.jsx)("option",{value:1,children:"minutes"}),(0,p.jsx)("option",{value:60,children:"hours"}),(0,p.jsx)("option",{value:1440,children:"days"})]})]})}function aK({stage:e,others:t,update:a}){let n=e.kind==="inbox"||e.kind==="approval"||e.kind==="choose";return(0,p.jsxs)("div",{className:"grid gap-2","data-time-limit":!0,children:[(0,p.jsxs)("label",{className:"flex items-center gap-2 text-[13px] font-medium",children:[(0,p.jsx)("input",{type:"checkbox",className:"size-4 accent-[var(--so-accent)]",checked:e.limit!==void 0,onChange:o=>a({limit:o.target.checked?{minutes:1440,to:null}:void 0})}),"Time limit"]}),e.limit!==void 0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Remind after",hint:e.kind==="approval"?"Whoever decides hears about it once.":e.kind==="choose"?"Whoever chooses hears about it once.":"The card's owner (or the flow's) hears about it once.",children:(0,p.jsx)(n8,{minutes:e.limit.minutes,label:"Remind after",set:o=>a({limit:{...e.limit,minutes:o}})})}),n&&(0,p.jsx)(ge,{label:e.kind==="choose"?"If no reply":"Then",children:(0,p.jsxs)("select",{className:gt,"aria-label":"After the time limit",value:e.limit.to??"",onChange:o=>a({limit:{...e.limit,to:o.target.value||null}}),children:[(0,p.jsx)("option",{value:"",children:"Keep it here"}),t.map(o=>(0,p.jsxs)("option",{value:o.id,children:["Move it to ",o.title]},o.id))]})})]})]})}function o8({view:e,csrf:t,apply:a,onClose:n}){let[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(""),[l,c]=(0,me.useState)(!1),f=e.stages.find(u=>u.id===e.start);return(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:async u=>{u.preventDefault(),c(!0);let d=await ca(`${e.flow.href}/cards`,{title:o,description:s},t);c(!1),a(d),d.ok&&(r(""),i(""))},children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:"New card"}),n!==void 0&&(0,p.jsx)(Z,{type:"button",variant:"ghost",size:"icon",onClick:n,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["It starts in ",f?.title??"the first zone","."]}),(0,p.jsx)(ve,{value:o,onChange:u=>r(u.target.value),placeholder:"What needs doing?",maxLength:200,required:!0,"aria-label":"Title"}),(0,p.jsx)(zt,{value:s,onChange:u=>i(u.target.value),placeholder:"Details (optional)",rows:4,"aria-label":"Details"}),(0,p.jsxs)(Z,{type:"submit",size:"sm",className:"self-start",disabled:l||o.trim()==="",children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add card"]})]})}var r8=e=>{if(e===null)return"";let t=Math.round((Date.now()-Date.parse(e))/6e4);return t<1?"Just now":t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} h ago`:vn(e)};function V_({label:e,value:t}){return(0,p.jsxs)("div",{className:"grid gap-1",children:[(0,p.jsx)("span",{className:"text-[12px] font-medium",children:e}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(ve,{readOnly:!0,value:t,className:"h-8 font-mono text-[12px]",onFocus:n=>n.target.select(),"aria-label":e}),(0,p.jsx)(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{navigator.clipboard?.writeText(t).then(()=>xn.success(`${e} copied.`),()=>xn.error("Select it and copy it by hand."))},"aria-label":`Copy ${e.toLowerCase()}`,children:(0,p.jsx)(tf,{className:"size-3.5"})})]})]})}function nK({kind:e,reveal:t,onDone:a}){return(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-primary/40 bg-primary/5 p-3","data-trigger-reveal":!0,children:[(0,p.jsx)("p",{className:"text-[13px] font-semibold",children:"Copy these now. They aren't shown again."}),t.address===null?(0,p.jsxs)("p",{className:"text-[12px]",children:["Save your public webhook address below first, then choose New address. ",(0,p.jsx)("span",{className:"break-all font-mono",children:t.path})]}):(0,p.jsx)(V_,{label:"Address",value:t.address}),t.secret!==null&&(0,p.jsx)(V_,{label:"Secret",value:t.secret}),(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:e==="github"?"In GitHub: Settings → Webhooks → Add webhook. Paste the address and the secret, choose application/json, and pick the events this trigger watches (Issues, Pull requests or Workflow runs).":e==="linear"?"In Linear: Settings → API → Webhooks → New webhook. Paste the address and choose Issues. Then paste Linear's signing secret on this trigger.":e==="form"?"Share this link. Anyone who has it can add a card without signing in; the work it starts still waits for your approval.":"Post JSON to the address. A title field becomes the card's title; description, its details."}),(0,p.jsx)(Z,{type:"button",size:"sm",variant:"outline",className:"self-start",onClick:a,children:"Done"})]})}var oK={button:["label","questions"],schedule:["schedule","title","description","script","secrets"],github:["repo","watch","label","branch","from","delivery"],linear:["team","state","label","delivery"],flow:["flow","when"],webhook:["title","titleField","bodyField"],email:["folder","sender","subject"],"plane-review":["at","timeZone"]};function rK({view:e,csrf:t,open:a,onResult:n}){let o=e.triggerSetup,[r,s]=(0,me.useState)("button"),[i,l]=(0,me.useState)({}),[c,f]=(0,me.useState)(!1),[u,d]=(0,me.useState)(!1),m=Intl.DateTimeFormat().resolvedOptions().timeZone,g={schedule:{schedule:`daily 09:00 ${m}`},github:{repo:o.githubRepo??"",watch:"issues",from:"team",delivery:"poll",branch:"main"},linear:{delivery:"poll"},flow:{flow:String(o.otherFlows[0]?.id??"")},webhook:{title:"Webhook"},email:{folder:"INBOX"},"plane-review":{at:"07:30",timeZone:m}},b=h=>i[h]??g[r]?.[h]??"",v=h=>w=>l(S=>({...S,[h]:w.target.value})),x=o.otherFlows.find(h=>String(h.id)===b("flow")),y=async h=>{h.preventDefault();let w={kind:r,zone:b("zone")||null};for(let C of oK[r]??[])w[C]=C==="questions"?b(C).split(`
|
|
64
|
+
npm test`};function QY({email:e,view:t,set:a}){return(0,p.jsxs)(p.Fragment,{children:[!t.emailReady&&(0,p.jsxs)("p",{className:"rounded-md border border-border px-3 py-2 text-[12.5px]","data-email-needs-setup":!0,children:["Email isn't set up yet. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/settings#email",children:"Add your mail server in Settings"})]}),(0,p.jsx)(ge,{label:"To",children:(0,p.jsx)(ve,{value:e.to,maxLength:500,onChange:n=>a({...e,to:n.target.value}),"aria-label":"To"})}),(0,p.jsx)(ge,{label:"Subject",children:(0,p.jsx)(ve,{value:e.subject,maxLength:200,onChange:n=>a({...e,subject:n.target.value}),"aria-label":"Subject"})}),(0,p.jsx)(ge,{label:"Email",hint:m2,children:(0,p.jsx)(zt,{rows:6,value:e.body,maxLength:8e3,onChange:n=>a({...e,body:n.target.value}),"aria-label":"Email"})})]})}function JY({tool:e,view:t,set:a}){let n=t.tools.find(o=>o.name===e.server);return(0,p.jsxs)(p.Fragment,{children:[t.tools.length===0?(0,p.jsxs)("p",{className:"rounded-md border border-border px-3 py-2 text-[12.5px]","data-tool-needs-setup":!0,children:["This project has no tools yet. ",(0,p.jsx)("a",{className:"font-medium text-primary underline-offset-4 hover:underline",href:"/settings/tools",children:"Add one on the Tools page"})]}):(0,p.jsx)(ge,{label:"Tool",...n!==void 0&&!n.ready?{hint:"It needs its secrets set on the Tools page first."}:n!==void 0?{hint:n.about}:{},children:(0,p.jsxs)("select",{className:gt,value:e.server,onChange:o=>a({...e,server:o.target.value,name:t.tools.find(r=>r.name===o.target.value)?.functions[0]??""}),"aria-label":"Tool",children:[n===void 0&&(0,p.jsx)("option",{value:e.server,children:e.server===""?"Choose a tool":`${e.server} (missing)`}),t.tools.map(o=>(0,p.jsx)("option",{value:o.name,children:o.name},o.name))]})}),(0,p.jsx)(ge,{label:"What it does",hint:n!==void 0&&n.functions.length===0?"Test the tool on the Tools page to list what it can do.":void 0,children:n!==void 0&&n.functions.length>0?(0,p.jsxs)("select",{className:gt,value:e.name,onChange:o=>a({...e,name:o.target.value}),"aria-label":"What it does",children:[!n.functions.includes(e.name)&&(0,p.jsx)("option",{value:e.name,children:e.name||"Choose"}),n.functions.map(o=>(0,p.jsx)("option",{value:o,children:o},o))]}):(0,p.jsx)(ve,{value:e.name,maxLength:100,onChange:o=>a({...e,name:o.target.value}),className:"font-mono","aria-label":"What it does"})}),(0,p.jsx)(ge,{label:"Arguments",hint:`JSON, with fill-ins inside its strings. ${m2}`,children:(0,p.jsx)(zt,{rows:5,value:e.args,maxLength:4e3,onChange:o=>a({...e,args:o.target.value}),className:"font-mono text-[12px]","aria-label":"Arguments"})})]})}function eK({stage:e,stages:t,view:a,csrf:n,apply:o,update:r,remove:s,makeStart:i,onClose:l}){let c=t.filter(d=>d.id!==e.id),f=gt,u=a.kinds.find(d=>d.kind===e.kind);return(0,p.jsxs)("div",{className:"flex flex-col gap-3","data-flow-zone-panel":e.id,children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:"Edit zone"}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:l,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsx)(ge,{label:"Name",children:(0,p.jsx)(ve,{value:e.title,maxLength:60,onChange:d=>r({title:d.target.value}),"aria-label":"Zone name"})}),(0,p.jsx)(ge,{label:"What happens here",...u===void 0?{}:{hint:u.about},children:(0,p.jsx)("select",{className:f,"aria-label":"What happens here",value:e.kind,onChange:d=>r({kind:d.target.value,...d.target.value==="done"?{next:null,onFail:null}:{},...d.target.value==="update"?{close:e.close??!0,message:e.message??"Done: {{card.title}}"}:{},...d.target.value==="check"?{script:e.script??a.scripts[0]?.name??null,runIn:e.runIn??"folder"}:{},...d.target.value==="request"?{request:e.request??{method:"POST",url:"https://",headers:{},body:'{"title": "{{card.title}}", "details": "{{card.description}}"}'}}:{},...d.target.value==="email"?{email:e.email??{to:"{{card.email}}",subject:"Re: {{card.title}}",body:t.find(m=>m.kind==="draft")?`{{stage.${t.find(m=>m.kind==="draft").id}}}`:""}}:{},...d.target.value==="tool"?{tool:e.tool??{server:a.tools[0]?.name??"",name:a.tools[0]?.functions[0]??"",args:'{"text": "{{card.title}}"}'}}:{},...d.target.value==="draft"?{instructions:e.instructions??"Write a short, friendly reply to the person who sent this card, in plain words."}:{},...d.target.value==="approval"?{toOwner:e.toOwner??!0}:{},...d.target.value==="wait"?{wait:e.wait??{for:"reply",minutes:4320}}:{},...d.target.value==="subagent"?{subagent:e.subagent??a.subagents?.[0]?.handle,instructions:e.instructions??"Read the card and decide what happens next."}:d.target.value!=="approval"?{subagent:void 0}:{},...d.target.value==="wait"||d.target.value==="done"?{limit:void 0}:d.target.value!=="inbox"&&d.target.value!=="approval"&&d.target.value!=="choose"&&e.limit!==void 0?{limit:{...e.limit,to:null}}:{},...d.target.value==="choose"?{next:null,options:e.options??[{label:"Looks good",to:c.find(m=>m.kind==="done")?.id??c[0]?.id??"end"},{label:"Ignore",to:"end"}]}:{options:void 0},...d.target.value==="task"?{}:{repo:void 0},...d.target.value==="sort"?{next:null,sort:e.sort??{question:"What kind of card is this?",answers:c.slice(0,2).map(m=>({answer:m.title.slice(0,40),means:m.title,to:m.id})),sureAt:.8,notes:[]}}:{}}),children:a.kinds.map(d=>(0,p.jsx)("option",{value:d.kind,children:d.label},d.kind))})}),e.kind==="draft"&&(0,p.jsx)(ge,{label:"What Claude should write",hint:"Claude reads the card and what earlier zones said. Put a “Person decides” zone next to read and edit it first.",children:(0,p.jsx)(zt,{rows:5,value:e.instructions??"",maxLength:8e3,onChange:d=>r({instructions:d.target.value}),"aria-label":"What Claude should write"})}),(e.kind==="task"||e.kind==="report")&&(0,p.jsx)(ge,{label:"What the agent should do",hint:"Fill-ins: {{card.title}}, {{card.description}}, {{note}} (the latest send-back note), {{stage.<zone id>}} (an earlier zone's report; a research zone adds .items and .report).",children:(0,p.jsx)(zt,{rows:7,value:e.instructions??"",onChange:d=>r({instructions:d.target.value}),"aria-label":"What the agent should do"})}),e.kind==="task"&&(a.projects??[]).length>1&&(0,p.jsx)(ge,{label:"Builds in",hint:"Another project files its task there, as the flow's owner, under that project's approvals.",children:(0,p.jsxs)("select",{className:f,"aria-label":"Builds in",value:e.repo??a.projects[0].path,onChange:d=>r({repo:d.target.value===a.projects[0].path?void 0:d.target.value}),children:[a.projects.map((d,m)=>(0,p.jsx)("option",{value:d.path,children:m===0?`${d.name} (this flow's project)`:d.name},d.path)),e.repo!==void 0&&!a.projects.some(d=>d.path===e.repo)&&(0,p.jsxs)("option",{value:e.repo,children:[e.repo," (not yours)"]})]})}),e.kind==="choose"&&(0,p.jsx)(tK,{options:e.options??[],others:c,set:d=>r({options:d})}),e.kind==="task"&&(0,p.jsx)(ge,{label:"Plan first?",children:(0,p.jsxs)("select",{className:f,"aria-label":"Plan first?",value:e.planning??"auto",onChange:d=>r({planning:d.target.value}),children:[(0,p.jsx)("option",{value:"auto",children:"Let Toolroll decide"}),(0,p.jsx)("option",{value:"required",children:"Always plan first"}),(0,p.jsx)("option",{value:"skip",children:"Build directly"})]})}),e.kind==="approval"&&(0,p.jsx)(ge,{label:"Who decides",children:(0,p.jsxs)("select",{className:f,"aria-label":"Who decides",value:e.subagent!==void 0?`__mate__:${e.subagent}`:e.toOwner===!0?"__owner__":e.approver??"",onChange:d=>r(d.target.value.startsWith("__mate__:")?{subagent:d.target.value.slice(9),toOwner:!0,approver:null}:d.target.value==="__owner__"?{subagent:void 0,toOwner:!0,approver:null}:{subagent:void 0,toOwner:!1,approver:d.target.value===""?null:d.target.value}),children:[(a.subagents??[]).map(d=>(0,p.jsxs)("option",{value:`__mate__:${d.handle}`,children:[d.name," (subagent), handing hard ones to the flow's owner",d.working?"":" (paused)"]},d.handle)),(0,p.jsxs)("option",{value:"__owner__",children:["The flow's owner (",a.flow.owner,"), in their chat app"]}),(0,p.jsx)("option",{value:"",children:"Anyone who can approve"}),a.approvers.map(d=>(0,p.jsx)("option",{value:d,children:d},d))]})}),e.kind==="notify"&&(0,p.jsx)(ge,{label:"Message",children:(0,p.jsx)(ve,{value:e.message??"",maxLength:1e3,onChange:d=>r({message:d.target.value}),"aria-label":"Message"})}),e.kind==="update"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Comment on the issue",hint:"Fill-ins: {{card.title}}, {{note}}, {{stage.<zone id>}}.",children:(0,p.jsx)(zt,{rows:3,value:e.message??"",maxLength:1e3,onChange:d=>r({message:d.target.value}),"aria-label":"Comment on the issue"})}),(0,p.jsxs)("label",{className:"flex items-center gap-2 text-[13px]",children:[(0,p.jsx)("input",{type:"checkbox",className:"size-4 accent-[var(--so-accent)]",checked:e.close!==!1,onChange:d=>r({close:d.target.checked})}),"Close the issue too (Linear: move it to done)"]})]}),e.kind==="pull-request"&&(0,p.jsx)(ge,{label:"When checks pass",hint:"Merging needs a “Person decides” zone before this one, and a person's approval of the card since it was built.",children:(0,p.jsxs)("select",{className:f,"aria-label":"When checks pass",value:e.merge??"",onChange:d=>r({merge:d.target.value===""?void 0:d.target.value}),children:[(0,p.jsx)("option",{value:"",children:"Move on; a person merges"}),(0,p.jsx)("option",{value:"squash",children:"Merge (squash)"}),(0,p.jsx)("option",{value:"merge",children:"Merge (merge commit)"}),(0,p.jsx)("option",{value:"rebase",children:"Merge (rebase)"})]})}),e.kind==="check"&&(0,p.jsx)(KY,{stage:e,others:c,view:a,csrf:n,apply:o,update:r}),e.kind==="subagent"&&(0,p.jsx)(YY,{stage:e,others:c,view:a,update:r}),e.kind==="request"&&e.request!==void 0&&(0,p.jsx)(WY,{request:e.request,view:a,csrf:n,apply:o,set:d=>r({request:d})}),e.kind==="email"&&e.email!==void 0&&(0,p.jsx)(QY,{email:e.email,view:a,set:d=>r({email:d})}),e.kind==="tool"&&e.tool!==void 0&&(0,p.jsx)(JY,{tool:e.tool,view:a,set:d=>r({tool:d})}),e.kind==="sort"&&e.sort!==null&&(0,p.jsx)(jY,{sort:e.sort,others:c,ready:a.sortReady,set:d=>r({sort:d})}),e.kind==="wait"&&e.wait!==void 0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Wait for",hint:e.wait.for==="reply"?"Only a reply from someone it emailed counts. Needs the inbox in Settings → Email.":void 0,children:(0,p.jsxs)("select",{className:f,"aria-label":"Wait for",value:e.wait.for,onChange:d=>r({wait:d.target.value==="hours"?{for:"hours",minutes:0,from:e.wait.from??"22:00",to:e.wait.to??"06:00"}:{for:d.target.value,minutes:e.wait.minutes>0?e.wait.minutes:1440}}),children:[(0,p.jsx)("option",{value:"reply",children:"A reply to the card's email"}),(0,p.jsx)("option",{value:"time",children:"A set time"}),(0,p.jsx)("option",{value:"hours",children:"Set hours, like overnight"})]})}),e.wait.for==="hours"?(0,p.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,p.jsx)(ge,{label:"From",children:(0,p.jsx)(ve,{type:"time",value:e.wait.from??"22:00",onChange:d=>r({wait:{...e.wait,from:d.target.value}}),"aria-label":"From"})}),(0,p.jsx)(ge,{label:"Until",children:(0,p.jsx)(ve,{type:"time",value:e.wait.to??"06:00",onChange:d=>r({wait:{...e.wait,to:d.target.value}}),"aria-label":"Until"})})]}):(0,p.jsx)(ge,{label:e.wait.for==="reply"?"For up to":"How long",children:(0,p.jsx)(n8,{minutes:e.wait.minutes,label:e.wait.for==="reply"?"For up to":"How long",set:d=>r({wait:{...e.wait,minutes:d}})})})]}),e.kind!=="done"&&e.kind!=="sort"&&e.kind!=="choose"&&(0,p.jsx)(ge,{label:e.kind==="wait"&&e.wait?.for==="reply"?"When they reply":"Then",children:(0,p.jsxs)("select",{className:f,"aria-label":e.kind==="wait"&&e.wait?.for==="reply"?"When they reply":"Then",value:e.next??"",onChange:d=>r({next:d.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:"Wait here"}),c.map(d=>(0,p.jsx)("option",{value:d.id,children:d.title},d.id))]})}),e.kind==="wait"&&e.wait?.for==="reply"&&(0,p.jsx)(ge,{label:"If no reply",children:(0,p.jsxs)("select",{className:f,"aria-label":"If no reply",value:e.onFail??"",onChange:d=>r({onFail:d.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:"Stay here for a person"}),c.map(d=>(0,p.jsx)("option",{value:d.id,children:d.title},d.id))]})}),(e.kind==="approval"||e.kind==="task"||e.kind==="report"||e.kind==="check"||e.kind==="pull-request"||e.kind==="update"||e.kind==="sort"||e.kind==="request"||e.kind==="email"||e.kind==="tool"||e.kind==="subagent"||e.kind==="choose")&&(0,p.jsx)(ge,{label:U_[e.kind]??"If it fails",...e.kind==="choose"?{hint:"Their reply is the note there ({{note}})."}:{},children:(0,p.jsxs)("select",{className:f,"aria-label":U_[e.kind]??"If it fails",value:e.onFail??"",onChange:d=>r({onFail:d.target.value||null}),children:[(0,p.jsx)("option",{value:"",children:e.kind==="approval"?"Can't be sent back":e.kind==="sort"?"Wait here for a person":e.kind==="choose"?"Where the first option goes":"Wait here"}),c.map(d=>(0,p.jsx)("option",{value:d.id,children:d.title},d.id))]})}),e.kind!=="wait"&&e.kind!=="done"&&(0,p.jsx)(aK,{stage:e,others:c,update:r}),(0,p.jsxs)("div",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Color"}),(0,p.jsx)("div",{className:"flex gap-2",children:a.colors.map(d=>(0,p.jsx)("button",{type:"button","aria-label":d,"aria-pressed":e.zone.color===d,className:te("size-7 rounded-full border-2",e.zone.color===d?"border-foreground":"border-transparent"),style:{background:Ep[d]},onClick:()=>r({zone:{...e.zone,color:d}})},d))})]}),(0,p.jsxs)("div",{className:"flex flex-wrap gap-2 pt-1",children:[a.start!==e.id&&(0,p.jsx)(Z,{variant:"outline",size:"sm",onClick:i,children:"New cards start here"}),(0,p.jsx)(Z,{variant:"ghost",size:"sm",className:"text-destructive",onClick:s,disabled:t.length<=1,children:"Delete zone"})]})]})}var U_={approval:"If sent back",sort:"If it isn't sure",subagent:"If it can't handle it","pull-request":"If checks fail",choose:"If they reply"};function tK({options:e,others:t,set:a}){let n=(o,r)=>a(e.map((s,i)=>i===o?{...s,...r}:s));return(0,p.jsxs)("div",{className:"grid gap-2","data-choose-options":!0,children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Buttons"}),e.map((o,r)=>(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,p.jsx)(ve,{className:"min-w-0 flex-1",value:o.label,maxLength:40,onChange:s=>n(r,{label:s.target.value}),"aria-label":`Button ${r+1}`}),(0,p.jsxs)("select",{className:te(gt,"min-w-0 flex-1"),"aria-label":`Button ${r+1} goes to`,value:o.to,onChange:s=>n(r,{to:s.target.value}),children:[(0,p.jsx)("option",{value:"end",children:"Ignore the card"}),t.map(s=>(0,p.jsx)("option",{value:s.id,children:s.title},s.id))]}),e.length>2&&(0,p.jsx)(Z,{type:"button",variant:"ghost",size:"icon",onClick:()=>a(e.filter((s,i)=>i!==r)),"aria-label":`Remove button ${r+1}`,children:(0,p.jsx)(At,{className:"size-4"})})]},r)),e.length<4&&(0,p.jsxs)(Z,{type:"button",variant:"outline",size:"sm",className:"self-start",onClick:()=>a([...e,{label:"",to:t[0]?.id??"end"}]),children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add a button"]})]})}function n8({minutes:e,label:t,set:a}){let n=e%1440===0?1440:e%60===0?60:1;return(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(ve,{type:"number",min:1,max:Math.floor(43200/n),value:e/n,className:"w-24","aria-label":`${t} (number)`,onChange:o=>{let r=Math.round(Number(o.target.value));Number.isFinite(r)&&r>=1&&a(Math.min(43200,r*n))}}),(0,p.jsxs)("select",{className:gt,"aria-label":`${t} (unit)`,value:n,onChange:o=>a(Math.min(43200,Math.max(1,e/n*Number(o.target.value)))),children:[(0,p.jsx)("option",{value:1,children:"minutes"}),(0,p.jsx)("option",{value:60,children:"hours"}),(0,p.jsx)("option",{value:1440,children:"days"})]})]})}function aK({stage:e,others:t,update:a}){let n=e.kind==="inbox"||e.kind==="approval"||e.kind==="choose";return(0,p.jsxs)("div",{className:"grid gap-2","data-time-limit":!0,children:[(0,p.jsxs)("label",{className:"flex items-center gap-2 text-[13px] font-medium",children:[(0,p.jsx)("input",{type:"checkbox",className:"size-4 accent-[var(--so-accent)]",checked:e.limit!==void 0,onChange:o=>a({limit:o.target.checked?{minutes:1440,to:null}:void 0})}),"Time limit"]}),e.limit!==void 0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Remind after",hint:e.kind==="approval"?"Whoever decides hears about it once.":e.kind==="choose"?"Whoever chooses hears about it once.":"The card's owner (or the flow's) hears about it once.",children:(0,p.jsx)(n8,{minutes:e.limit.minutes,label:"Remind after",set:o=>a({limit:{...e.limit,minutes:o}})})}),n&&(0,p.jsx)(ge,{label:e.kind==="choose"?"If no reply":"Then",children:(0,p.jsxs)("select",{className:gt,"aria-label":"After the time limit",value:e.limit.to??"",onChange:o=>a({limit:{...e.limit,to:o.target.value||null}}),children:[(0,p.jsx)("option",{value:"",children:"Keep it here"}),t.map(o=>(0,p.jsxs)("option",{value:o.id,children:["Move it to ",o.title]},o.id))]})})]})]})}function o8({view:e,csrf:t,apply:a,onClose:n}){let[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(""),[l,c]=(0,me.useState)(!1),f=e.stages.find(u=>u.id===e.start);return(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:async u=>{u.preventDefault(),c(!0);let d=await ca(`${e.flow.href}/cards`,{title:o,description:s},t);c(!1),a(d),d.ok&&(r(""),i(""))},children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:"New card"}),n!==void 0&&(0,p.jsx)(Z,{type:"button",variant:"ghost",size:"icon",onClick:n,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["It starts in ",f?.title??"the first zone","."]}),(0,p.jsx)(ve,{value:o,onChange:u=>r(u.target.value),placeholder:"What needs doing?",maxLength:200,required:!0,"aria-label":"Title"}),(0,p.jsx)(zt,{value:s,onChange:u=>i(u.target.value),placeholder:"Details (optional)",rows:4,"aria-label":"Details"}),(0,p.jsxs)(Z,{type:"submit",size:"sm",className:"self-start",disabled:l||o.trim()==="",children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add card"]})]})}var r8=e=>{if(e===null)return"";let t=Math.round((Date.now()-Date.parse(e))/6e4);return t<1?"Just now":t<60?`${t} min ago`:t<1440?`${Math.round(t/60)} h ago`:vn(e)};function V_({label:e,value:t}){return(0,p.jsxs)("div",{className:"grid gap-1",children:[(0,p.jsx)("span",{className:"text-[12px] font-medium",children:e}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(ve,{readOnly:!0,value:t,className:"h-8 font-mono text-[12px]",onFocus:n=>n.target.select(),"aria-label":e}),(0,p.jsx)(Z,{type:"button",size:"sm",variant:"outline",onClick:()=>{navigator.clipboard?.writeText(t).then(()=>xn.success(`${e} copied.`),()=>xn.error("Select it and copy it by hand."))},"aria-label":`Copy ${e.toLowerCase()}`,children:(0,p.jsx)(tf,{className:"size-3.5"})})]})]})}function nK({kind:e,reveal:t,onDone:a}){return(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-primary/40 bg-primary/5 p-3","data-trigger-reveal":!0,children:[(0,p.jsx)("p",{className:"text-[13px] font-semibold",children:"Copy these now. They aren't shown again."}),t.address===null?(0,p.jsxs)("p",{className:"text-[12px]",children:["Save your public webhook address below first, then choose New address. ",(0,p.jsx)("span",{className:"break-all font-mono",children:t.path})]}):(0,p.jsx)(V_,{label:"Address",value:t.address}),t.secret!==null&&(0,p.jsx)(V_,{label:"Secret",value:t.secret}),(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:e==="github"?"In GitHub: Settings → Webhooks → Add webhook. Paste the address and the secret, choose application/json, and pick the events this trigger watches (Issues, Pull requests or Workflow runs).":e==="linear"?"In Linear: Settings → API → Webhooks → New webhook. Paste the address and choose Issues. Then paste Linear's signing secret on this trigger.":e==="form"?"Share this link. Anyone who has it can add a card without signing in; the work it starts still waits for your approval.":"Post JSON to the address. A title field becomes the card's title; description, its details."}),(0,p.jsx)(Z,{type:"button",size:"sm",variant:"outline",className:"self-start",onClick:a,children:"Done"})]})}var oK={button:["label","questions"],schedule:["schedule","title","description","script","secrets"],github:["repo","watch","label","branch","from","delivery"],linear:["team","state","label","delivery"],flow:["flow","when"],webhook:["title","titleField","bodyField"],email:["folder","sender","subject"],"plane-review":["at","timeZone"]};function rK({view:e,csrf:t,open:a,onResult:n}){let o=e.triggerSetup,[r,s]=(0,me.useState)("button"),[i,l]=(0,me.useState)({}),[c,f]=(0,me.useState)(!1),[u,d]=(0,me.useState)(!1),m=Intl.DateTimeFormat().resolvedOptions().timeZone,g={schedule:{schedule:`daily 09:00 ${m}`},github:{repo:o.githubRepo??"",watch:"issues",from:"team",delivery:"poll",branch:"main"},linear:{delivery:"poll"},flow:{flow:String(o.otherFlows[0]?.id??"")},webhook:{title:"Webhook"},email:{folder:"INBOX"},"plane-review":{at:"07:30",timeZone:m}},b=h=>i[h]??g[r]?.[h]??"",v=h=>w=>l(S=>({...S,[h]:w.target.value})),x=o.otherFlows.find(h=>String(h.id)===b("flow")),y=async h=>{h.preventDefault();let w={kind:r,zone:b("zone")||null};for(let C of oK[r]??[])w[C]=C==="questions"?b(C).split(`
|
|
65
65
|
`):C==="flow"?Number(b(C)):b(C)||null;d(!0);let S=await ca(`${e.flow.href}/triggers`,{trigger:JSON.stringify(w)},t);d(!1),n(S,r),S.ok&&l({})};return(0,p.jsxs)("details",{className:"rounded-lg border px-3 py-2",open:a,children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[13px] font-semibold",children:"Add a trigger"}),(0,p.jsxs)("form",{className:"flex flex-col gap-3 pt-3",onSubmit:h=>{y(h)},"data-add-trigger":!0,children:[(0,p.jsx)(ge,{label:"What starts cards",children:(0,p.jsx)("select",{className:gt,value:r,onChange:h=>{s(h.target.value),l({})},children:o.kinds.map(h=>(0,p.jsx)("option",{value:h.kind,children:h.label},h.kind))})}),r==="button"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Button name",children:(0,p.jsx)(ve,{value:b("label"),onChange:v("label"),placeholder:"Report a bug",maxLength:40,required:!0})}),(0,p.jsx)(ge,{label:"Questions it asks",hint:"One per line. The first answer becomes the card's title.",children:(0,p.jsx)(zt,{rows:3,value:b("questions"),onChange:v("questions"),placeholder:`What happened?
|
|
66
66
|
Steps to reproduce
|
|
67
67
|
How bad is it?`})})]}),r==="schedule"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"When",hint:"For example: daily 09:00 Europe/London, monday 09:00, every 4 hours.",children:(0,p.jsx)(ve,{value:b("schedule"),onChange:v("schedule"),required:!0})}),(0,p.jsx)(ge,{label:"Makes",children:(0,p.jsxs)("select",{className:gt,value:b("script")===""&&!c?"card":"script","aria-label":"Makes",onChange:h=>{f(h.target.value==="script"),l(w=>({...w,script:h.target.value==="script"?e.scripts[0]?.name??"":""}))},children:[(0,p.jsx)("option",{value:"card",children:"One card each time"}),(0,p.jsx)("option",{value:"script",children:"A card for each item a script prints"})]})}),b("script")!==""||c?e.scripts.length===0?(0,p.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"This project has no scripts yet: make one with Scripts in the toolbar."}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Script",hint:'It prints one item per line (a title, or JSON like {"title": "…", "key": 42}). The same item never makes two cards.',children:(0,p.jsx)("select",{className:gt,value:b("script"),onChange:v("script"),"aria-label":"Script",children:e.scripts.map(h=>(0,p.jsxs)("option",{value:h.name,children:[h.name," — ",h.about]},h.name))})}),(0,p.jsx)(ge,{label:"Secrets it gets (optional)",hint:"Names of saved secrets, like CRM_KEY. Save them on a script zone's Secrets.",children:(0,p.jsx)(ve,{value:b("secrets"),onChange:v("secrets"),className:"font-mono",placeholder:"CRM_KEY",maxLength:400})})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Card title",hint:"Each card's date is added to it.",children:(0,p.jsx)(ve,{value:b("title"),onChange:v("title"),placeholder:"Dependency check",maxLength:200,required:!0})}),(0,p.jsx)(ge,{label:"Details (optional)",children:(0,p.jsx)(zt,{rows:3,value:b("description"),onChange:v("description")})})]})]}),r==="github"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Repository",children:(0,p.jsx)(ve,{value:b("repo"),onChange:v("repo"),placeholder:"owner/name",required:!0})}),(0,p.jsx)(ge,{label:"Watch",children:(0,p.jsxs)("select",{className:gt,value:b("watch"),onChange:v("watch"),children:[(0,p.jsx)("option",{value:"issues",children:"New issues"}),(0,p.jsx)("option",{value:"pulls",children:"New pull requests"}),(0,p.jsx)("option",{value:"checks",children:"Failed checks"})]})}),b("watch")!=="checks"&&(0,p.jsx)(ge,{label:"Label (optional)",hint:b("watch")==="issues"?"With a label, an issue joins the moment it gets the label.":"Only pull requests with this label.",children:(0,p.jsx)(ve,{value:b("label"),onChange:v("label"),placeholder:"bug",maxLength:50})}),b("watch")==="checks"&&(0,p.jsx)(ge,{label:"Branch",children:(0,p.jsx)(ve,{value:b("branch"),onChange:v("branch"),maxLength:100})}),b("watch")!=="checks"&&(0,p.jsx)(ge,{label:"From",hint:b("from")==="anyone"?"Anyone who can open one there can write what the agent reads. The work still waits for your approval.":void 0,children:(0,p.jsxs)("select",{className:gt,value:b("from"),onChange:v("from"),children:[(0,p.jsx)("option",{value:"team",children:"People with write access"}),(0,p.jsx)("option",{value:"anyone",children:"Anyone"})]})})]}),r==="linear"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Team key",hint:"Like ENG. Name a team, a label, or both.",children:(0,p.jsx)(ve,{value:b("team"),onChange:v("team"),placeholder:"ENG",maxLength:12})}),(0,p.jsx)(ge,{label:"When it moves to (optional)",children:(0,p.jsx)(ve,{value:b("state"),onChange:v("state"),placeholder:"Todo",maxLength:40})}),(0,p.jsx)(ge,{label:"Label (optional)",children:(0,p.jsx)(ve,{value:b("label"),onChange:v("label"),placeholder:"bug",maxLength:50})})]}),(r==="github"||r==="linear")&&(0,p.jsx)(ge,{label:"How it arrives",hint:b("delivery")==="webhook"?o.hooksBase===null?"Needs your public webhook address: set it under Settings below.":"You'll get an address to paste into "+(r==="github"?"GitHub.":"Linear."):r==="linear"&&!o.linearKey?"Save your Linear key under Settings below first.":void 0,children:(0,p.jsxs)("select",{className:gt,value:b("delivery"),onChange:v("delivery"),children:[(0,p.jsx)("option",{value:"poll",children:"Checked every 2 minutes"}),(0,p.jsx)("option",{value:"webhook",children:"Sent to a webhook address"})]})}),r==="flow"&&(o.otherFlows.length===0?(0,p.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"There are no other flows to follow yet."}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Flow",children:(0,p.jsx)("select",{className:gt,value:b("flow"),onChange:h=>l(w=>({...w,flow:h.target.value,when:""})),children:o.otherFlows.map(h=>(0,p.jsx)("option",{value:h.id,children:h.name},h.id))})}),(0,p.jsx)(ge,{label:"When a card reaches",children:(0,p.jsxs)("select",{className:gt,value:b("when"),onChange:v("when"),children:[(0,p.jsx)("option",{value:"",children:"The end"}),x?.zones.map(h=>(0,p.jsx)("option",{value:h.id,children:h.title},h.id))]})})]})),r==="chat"&&(0,p.jsxs)("div",{className:"flex flex-col gap-2 rounded-md bg-muted px-2.5 py-2 text-[12.5px]","data-chat-connect":!0,children:[(0,p.jsx)("p",{children:"Connect a Slack, Discord or Teams channel, or a Telegram group, from the channel itself. Where Toolroll is, send:"}),(0,p.jsx)("p",{children:(0,p.jsxs)("code",{className:"rounded bg-background px-1.5 py-0.5 font-semibold",children:["flow ",e.flow.id]})}),(0,p.jsxs)("p",{className:"text-muted-foreground",children:["Each new message there becomes a card here, and replies in its thread join the card's discussion. “flow off” stops it. In Teams, mention Toolroll in each message. In Telegram, send /flow ",e.flow.id,", and turn the bot's privacy mode off in BotFather so it sees every message."]})]}),r==="email"&&(0,p.jsxs)(p.Fragment,{children:[o.mailbox===null?(0,p.jsxs)("p",{className:"rounded-md bg-muted px-2.5 py-2 text-[12.5px]","data-mailbox-missing":!0,children:["Reading mail isn't set up yet. Add your mail server's IMAP address, or sign in with Google, in ",(0,p.jsx)("a",{className:"underline",href:"/settings#email",children:"Settings → Email"}),"."]}):(0,p.jsxs)("p",{className:"text-[12.5px] text-muted-foreground",children:["New mail in ",o.mailbox," becomes cards, from now on. The mailbox is only read: nothing is marked or moved."]}),(0,p.jsx)(ge,{label:"Folder",children:(0,p.jsx)(ve,{value:b("folder"),onChange:v("folder"),placeholder:"INBOX",maxLength:100})}),(0,p.jsx)(ge,{label:"Only from (optional)",hint:"Addresses or domains, like priya@example.com, example.com.",children:(0,p.jsx)(ve,{value:b("sender"),onChange:v("sender"),maxLength:300})}),(0,p.jsx)(ge,{label:"Subject has (optional)",children:(0,p.jsx)(ve,{value:b("subject"),onChange:v("subject"),placeholder:"Order",maxLength:100})})]}),r==="plane-review"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"text-[12.5px] text-muted-foreground",children:"Every morning, reads the last 24 hours and makes one card per problem worth fixing. A problem that comes back joins its card. A clean day adds nothing."}),(0,p.jsx)(ge,{label:"Time",hint:`Every day, in ${b("timeZone")||"your time zone"}.`,children:(0,p.jsx)(ve,{type:"time",value:b("at"),onChange:v("at"),required:!0})})]}),r==="webhook"&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ge,{label:"Title field",hint:"Where to find the card's title in the posted JSON, like title or data.issue.title.",children:(0,p.jsx)(ve,{value:b("titleField"),onChange:v("titleField"),placeholder:"title",maxLength:80})}),(0,p.jsx)(ge,{label:"Details field",children:(0,p.jsx)(ve,{value:b("bodyField"),onChange:v("bodyField"),placeholder:"description",maxLength:80})}),(0,p.jsx)(ge,{label:"Title when there is none",children:(0,p.jsx)(ve,{value:b("title"),onChange:v("title"),maxLength:120})})]}),r!=="chat"&&(0,p.jsx)(ge,{label:"Cards start in",children:(0,p.jsxs)("select",{className:gt,value:b("zone"),onChange:v("zone"),children:[(0,p.jsx)("option",{value:"",children:e.stages.find(h=>h.id===e.start)?.title??"The first zone"}),e.stages.filter(h=>h.id!==e.start).map(h=>(0,p.jsx)("option",{value:h.id,children:h.title},h.id))]})}),r!=="chat"&&(0,p.jsxs)(Z,{type:"submit",size:"sm",className:"self-start",disabled:u||r==="flow"&&o.otherFlows.length===0,children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add trigger"]})]})]})}function sK({view:e,csrf:t,apply:a}){let n=e.triggerSetup,[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(""),[l,c]=(0,me.useState)(n.hooksBase??""),[f,u]=(0,me.useState)(!1),d=async(m,g)=>{u(!0);let b=await ca(m,g,t);u(!1),a(b),b.ok&&(r(""),i(""))};return(0,p.jsxs)("details",{className:"rounded-lg border px-3 py-2",children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[13px] font-semibold",children:"Settings"}),(0,p.jsxs)("div",{className:"flex flex-col gap-4 pt-3",children:[n.linearKey?(0,p.jsxs)("div",{className:"grid gap-1.5",children:[(0,p.jsx)("span",{className:"text-[13px] font-medium",children:"Linear key"}),(0,p.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"Saved on this computer."}),(0,p.jsx)(Z,{type:"button",size:"sm",variant:"ghost",className:"self-start text-destructive",disabled:f,onClick:()=>{d(`${e.flow.href}/linear-key`,{remove:"yes"})},children:"Remove key"})]}):(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:m=>{m.preventDefault(),d(`${e.flow.href}/linear-key`,{key:o,password:s})},children:[(0,p.jsx)(ge,{label:"Linear key",hint:"From Linear → Settings → Security & access → Personal API keys. Kept on this computer only.",children:(0,p.jsx)(ve,{type:"password",autoComplete:"off",value:o,onChange:m=>r(m.target.value),placeholder:"lin_api_…"})}),(0,p.jsx)(s8,{view:e,password:s,setPassword:i}),(0,p.jsx)(Z,{type:"submit",size:"sm",className:"self-start",disabled:f||o.trim()===""||!i8(e,s),children:"Save key"})]}),(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:m=>{m.preventDefault(),d(`${e.flow.href}/hooks-address`,{address:l})},children:[(0,p.jsx)(ge,{label:"Public webhook address",hint:"The https site your reverse proxy (Caddy, for example) serves. Have it pass only paths starting /hooks/ to this console.",children:(0,p.jsx)(ve,{value:l,onChange:m=>c(m.target.value),placeholder:"https://hooks.example.com"})}),(0,p.jsx)(Z,{type:"submit",size:"sm",variant:"outline",className:"self-start",disabled:f,children:"Save address"})]})]})]})}function s8({view:e,password:t,setPassword:a}){return e.stepUp===void 0?(0,p.jsx)(ge,{label:"Your Toolroll password",children:(0,p.jsx)(ve,{type:"password",autoComplete:"current-password",value:t,onChange:n=>a(n.target.value)})}):e.stepUp.fresh?(0,p.jsxs)("p",{className:"text-[13px] text-success","data-sso-step-up":"confirmed",children:["✓ Confirmed with ",e.stepUp.label]}):(0,p.jsxs)("a",{className:"text-[13px] underline","data-sso-step-up":"confirm",href:e.stepUp.confirmHref,children:["Confirm with ",e.stepUp.label]})}var i8=(e,t)=>e.stepUp===void 0?t!=="":e.stepUp.fresh;function iK({trigger:e,view:t,csrf:a,apply:n}){let[o,r]=(0,me.useState)(""),[s,i]=(0,me.useState)(""),[l,c]=(0,me.useState)(!1);return(0,p.jsxs)("form",{className:"mt-2 flex flex-col gap-2 rounded-md border border-attention/50 p-2",onSubmit:async f=>{f.preventDefault(),c(!0);let u=await ca(`${t.flow.href}/triggers/${e.id}/secret`,{secret:o,password:s},a);c(!1),n(u),u.ok&&(r(""),i(""))},children:[(0,p.jsx)(ge,{label:"Linear's signing secret",hint:"Linear shows it when you create the webhook.",children:(0,p.jsx)(ve,{type:"password",autoComplete:"off",value:o,onChange:f=>r(f.target.value)})}),(0,p.jsx)(s8,{view:t,password:s,setPassword:i}),(0,p.jsx)(Z,{type:"submit",size:"sm",className:"self-start",disabled:l||o.trim()===""||!i8(t,s),children:"Save secret"})]})}function lK({view:e,csrf:t,apply:a,focus:n,onPress:o,onClose:r}){let[s,i]=(0,me.useState)(null),[l,c]=(0,me.useState)(!1),f=`${e.flow.href}/triggers`,u=async(m,g)=>{c(!0);let b=await ca(m,{},t);c(!1),a(b),b.reveal!==void 0&&i({kind:g,reveal:b.reveal})},d=e.triggers.filter(m=>m.state!=="removed");return(0,me.useEffect)(()=>{n!==null&&document.querySelector(`[data-trigger-row="${n}"]`)?.scrollIntoView({block:"nearest"})},[n]),(0,p.jsxs)("div",{className:"flex flex-col gap-4","data-flow-triggers":!0,children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:"Triggers"}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:r,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:["Triggers add cards to this flow on their own.",d.some(m=>m.order!==void 0)?"":" The work they start still waits for your usual approvals."]}),s!==null&&(0,p.jsx)(nK,{kind:s.kind,reveal:s.reveal,onDone:()=>i(null)}),d.length>0&&(0,p.jsx)("ul",{className:"flex flex-col gap-3",children:d.map(m=>(0,p.jsxs)("li",{className:te("rounded-lg border p-3",n===m.id&&"ring-2 ring-primary/50"),"data-trigger-row":m.id,children:[(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsx)("span",{className:"mt-0.5 inline-flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:$_[m.kind]??(0,p.jsx)(As,{className:"size-3.5","aria-hidden":"true"})}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsx)("p",{className:"text-[13px] font-medium leading-snug",children:m.words}),(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["Starts in ",m.zone,m.state==="paused"?" · Paused":"",m.shared?" · Shared as a form":""]}),m.status!==null&&(0,p.jsxs)("p",{className:te("text-[12px]",m.failing?"text-warning":"text-muted-foreground"),children:[r8(m.statusAt),": ",m.status,(0,p.jsx)(K_,{link:m.statusLink})]})]})]}),m.order!==void 0&&(0,p.jsx)("p",{className:"mt-2 text-[12px] break-words","data-trigger-approval":!0,children:m.order.at(-1)}),m.order!==void 0&&(0,p.jsxs)("details",{className:"mt-2 rounded-md border px-3 py-2","data-trigger-order":!0,children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[13px] font-medium",children:"What each run files"}),(0,p.jsx)("ul",{className:"mt-1 flex flex-col gap-1 text-[12px] text-muted-foreground",children:m.order.slice(0,-1).map((g,b)=>(0,p.jsx)("li",{className:"break-words",children:g},b))})]}),m.hook?.needsSecret===!0&&!m.hook.ready&&(0,p.jsx)(iK,{trigger:m,view:e,csrf:t,apply:a}),(0,p.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[m.button!==null&&m.state==="active"&&(0,p.jsx)(Z,{size:"sm",onClick:()=>o(m.id),children:"Start"}),m.button!==null&&(0,p.jsx)(Z,{size:"sm",variant:"outline",disabled:l,onClick:()=>{u(`${f}/${m.id}/share`,"form")},children:m.shared?"New form link":"Share as a form"}),m.shared&&(0,p.jsx)(Z,{size:"sm",variant:"ghost",disabled:l,onClick:()=>{u(`${f}/${m.id}/unshare`,"form")},children:"Stop sharing"}),m.checkable&&m.state==="active"&&(0,p.jsx)(Z,{size:"sm",variant:"outline",disabled:l,onClick:()=>{u(`${f}/${m.id}/check`,m.kind)},children:m.kind==="schedule"?"Run now":"Check now"}),m.hook!==null&&(0,p.jsx)(Z,{size:"sm",variant:"outline",disabled:l,onClick:()=>{u(`${f}/${m.id}/renew`,m.kind)},children:"New address"}),(0,p.jsx)(Z,{size:"sm",variant:"ghost",disabled:l,onClick:()=>{u(`${f}/${m.id}/${m.state==="paused"?"resume":"pause"}`,m.kind)},children:m.state==="paused"?"Turn on":"Pause"}),(0,p.jsx)(Z,{size:"sm",variant:"ghost",className:"text-destructive",disabled:l,onClick:()=>{u(`${f}/${m.id}/remove`,m.kind)},children:"Remove"})]})]},m.id))}),(0,p.jsx)(rK,{view:e,csrf:t,open:d.length===0,onResult:(m,g)=>{a(m),m.reveal!==void 0&&i({kind:g,reveal:m.reveal})}}),(0,p.jsx)(sK,{view:e,csrf:t,apply:a})]})}function l8({trigger:e,view:t,csrf:a,apply:n,onClose:o}){let r=e.button?.questions??[],[s,i]=(0,me.useState)(r.map(()=>"")),[l,c]=(0,me.useState)(!1),f=u=>d=>i(m=>m.map((g,b)=>b===u?d.target.value:g));return(0,p.jsxs)("form",{className:"flex flex-col gap-3","data-flow-press":e.id,onSubmit:async u=>{u.preventDefault(),c(!0);let d=await ca(`${t.flow.href}/triggers/${e.id}/press`,{answers:JSON.stringify(s)},a);c(!1),n(d),d.ok&&o()},children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:e.button?.label}),(0,p.jsx)(Z,{type:"button",variant:"ghost",size:"icon",onClick:o,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["The card starts in ",e.zone,"."]}),r.map((u,d)=>(0,p.jsx)(ge,{label:u,children:d===0?(0,p.jsx)(ve,{value:s[d]??"",onChange:f(d),maxLength:200,required:!0,autoFocus:!0}):(0,p.jsx)(zt,{rows:3,value:s[d]??"",onChange:f(d)})},d)),(0,p.jsxs)(Z,{type:"submit",size:"sm",className:"self-start",disabled:l||(s[0]??"").trim()==="",children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add card"]})]})}function uK({view:e,csrf:t,apply:a,onClose:n}){let o={name:"",about:"",body:"",timeoutMinutes:"15",language:"python",file:""},[r,s]=(0,me.useState)(e.scripts.length===0?o:null),[i,l]=(0,me.useState)(!1),c=async()=>{if(r===null)return;l(!0);let m=await ca(`${e.flow.href}/scripts`,r,t);l(!1),a(m),m.ok&&(s(null),d(!1))},f=m=>g=>s(b=>b===null?b:{...b,[m]:g.target.value}),[u,d]=(0,me.useState)(!1);return(0,p.jsxs)("div",{className:"flex flex-col gap-4","data-flow-scripts":!0,children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:"Scripts"}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:n,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),(0,p.jsxs)("p",{className:"text-[13px] text-muted-foreground",children:["Reusable steps with no AI, in shell, Python or Node. A “Run a script” zone runs one with the card, and a schedule can run one to make cards. Any flow in ",e.flow.project," can use them."]}),e.scripts.length>0&&(0,p.jsx)("ul",{className:"flex flex-col gap-2",children:e.scripts.map(m=>(0,p.jsxs)("li",{className:"rounded-lg border p-3","data-script":m.name,children:[(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsx)("span",{className:"mt-0.5 inline-flex size-6 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:(0,p.jsx)(to,{className:"size-3.5","aria-hidden":"true"})}),(0,p.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,p.jsxs)("p",{className:"flex flex-wrap items-center gap-1.5 font-mono text-[13px] font-semibold",children:[m.name,m.held&&(0,p.jsx)(wa,{tone:"attention",children:"Needs approval"})]}),(0,p.jsx)("p",{className:"text-[12.5px]",children:m.about}),(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:[a8[m.language],m.file===null?"":` · runs ${m.file}`," · version ",m.version," · ",m.savedBy," · up to ",m.timeoutMinutes," min",m.usedHere.length>0?` · runs in ${m.usedHere.join(", ")}`:" · not used in this flow"]})]})]}),m.file===null&&(0,p.jsxs)("details",{className:"mt-2",children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[12px] text-muted-foreground",children:"Show the script"}),(0,p.jsx)("pre",{className:"mt-2 max-h-56 overflow-auto rounded-md bg-muted p-2 font-mono text-[12px]",children:m.body})]}),m.held&&(0,p.jsx)("p",{className:"mt-2 text-[12.5px]","data-script-held":!0,children:"It came with an imported flow, so it doesn't run until you approve it. Read it first."}),e.canEdit&&(0,p.jsxs)("div",{className:"mt-2 flex gap-1.5",children:[m.held&&(0,p.jsx)(Z,{size:"sm",disabled:i,onClick:async()=>{l(!0),a(await ca(`${e.flow.href}/scripts`,{approve:"yes",name:m.name},t)),l(!1)},"data-approve-script":!0,children:"Approve"}),(0,p.jsx)(Z,{size:"sm",variant:"outline",onClick:()=>{d(m.file!==null),s({name:m.name,about:m.about,body:m.body,timeoutMinutes:String(m.timeoutMinutes),language:m.language,file:m.file??""})},children:"Edit"}),(0,p.jsx)(Z,{size:"sm",variant:"ghost",className:"text-destructive",disabled:i,onClick:async()=>{l(!0),a(await ca(`${e.flow.href}/scripts`,{remove:"yes",name:m.name},t)),l(!1)},children:"Remove"})]})]},m.name))}),e.canEdit&&(r===null?(0,p.jsxs)(Z,{size:"sm",variant:"outline",className:"self-start",onClick:()=>{d(!1),s(o)},children:[(0,p.jsx)(Yt,{className:"size-4"}),"New script"]}):(0,p.jsxs)("form",{className:"flex flex-col gap-3 rounded-lg border p-3",onSubmit:m=>{m.preventDefault(),c()},"data-script-form":!0,children:[(0,p.jsx)(ge,{label:"Name",hint:"Lowercase and dashes, like run-tests. Saving under an existing name makes a new version.",children:(0,p.jsx)(ve,{value:r.name,onChange:f("name"),maxLength:40,className:"font-mono",required:!0})}),(0,p.jsx)(ge,{label:"What it checks or does",children:(0,p.jsx)(ve,{value:r.about,onChange:f("about"),maxLength:160,placeholder:"Looks the company up in our CRM",required:!0})}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(ge,{label:"Language",children:(0,p.jsxs)("select",{className:gt,value:r.language,onChange:f("language"),"aria-label":"Language",children:[(0,p.jsx)("option",{value:"python",children:"Python"}),(0,p.jsx)("option",{value:"node",children:"Node"}),(0,p.jsx)("option",{value:"shell",children:"Shell"})]})}),(0,p.jsx)(ge,{label:"Runs",children:(0,p.jsxs)("select",{className:gt,value:r.file===""&&!u?"here":"file",onChange:m=>{d(m.target.value==="file"),s(g=>g===null?g:{...g,file:m.target.value==="file"?g.file:""})},"aria-label":"Runs",children:[(0,p.jsx)("option",{value:"here",children:"What's written here"}),(0,p.jsx)("option",{value:"file",children:"A file in the project"})]})})]}),u||r.file!==""?(0,p.jsx)(ge,{label:"File",hint:"A path from the top of the project. It gets the card as JSON on stdin (and in $FLOW_INPUT); what it prints is the step's result.",children:(0,p.jsx)(ve,{value:r.file,onChange:f("file"),maxLength:200,className:"font-mono",placeholder:"scripts/enrich.py",required:!0})}):(0,p.jsx)(ge,{label:"Script",hint:"It gets the card as JSON on stdin (and in $FLOW_INPUT). What it prints is the step's result; a last line “goto: <answer>” picks the next zone. Exit 0 passes.",children:(0,p.jsx)(zt,{value:r.body,onChange:f("body"),rows:8,className:"font-mono text-[12.5px]",placeholder:ZY[r.language]??"",required:!0})}),(0,p.jsx)(ge,{label:"Stop it after (minutes)",children:(0,p.jsx)(ve,{type:"number",min:1,max:60,value:r.timeoutMinutes,onChange:f("timeoutMinutes"),className:"w-28"})}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsx)(Z,{type:"submit",size:"sm",disabled:i,children:"Save script"}),(0,p.jsx)(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>s(null),children:"Cancel"})]})]}))]})}var cK=e=>e===null?"—":e<1?"under a minute":e<90?`${Math.round(e)} min`:e<2880?`${Math.round(e/60)} h`:`${Math.round(e/1440)} days`;function dK({view:e,onClose:t}){let[a,n]=(0,me.useState)(30),[o,r]=(0,me.useState)(null),[s,i]=(0,me.useState)(null),[l,c]=(0,me.useState)(null);(0,me.useEffect)(()=>{let u=!0;return r(null),i(null),fetch(`${e.flow.href}/insights?days=${a}`,{credentials:"same-origin",headers:{accept:"application/json"}}).then(async d=>{if(u){if(!d.ok)throw new Error("load");r(await d.json())}}).catch(()=>{u&&i("The insights couldn't load. Try again.")}),()=>{u=!1}},[a,e.flow.href,e.flow.revision]);let f=async(u,d)=>{let m=`${u}:${d}`;if(l?.key===m){c(null);return}try{let b=await(await fetch(`${e.flow.href}/runs/${u}/${d}`,{credentials:"same-origin",headers:{accept:"application/json"}})).json();c({key:m,text:b.log===void 0||b.log===""?"This run left no output.":b.log})}catch{c({key:m,text:"The log couldn't load."})}};return(0,p.jsxs)("div",{className:"flex flex-col gap-4","data-flow-insights":!0,children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)("h2",{className:"flex-1 text-[15px] font-semibold",children:"Insights"}),(0,p.jsxs)("select",{className:"h-8 rounded-md border bg-transparent px-2 text-[12px]",value:a,onChange:u=>n(Number(u.target.value)),"aria-label":"Period",children:[(0,p.jsx)("option",{value:7,children:"Last 7 days"}),(0,p.jsx)("option",{value:30,children:"Last 30 days"}),(0,p.jsx)("option",{value:90,children:"Last 90 days"})]}),(0,p.jsx)(Z,{variant:"ghost",size:"icon",onClick:t,"aria-label":"Close",children:(0,p.jsx)(At,{className:"size-4"})})]}),s!==null&&(0,p.jsx)("p",{className:"text-[13px] text-destructive",children:s}),o===null&&s===null&&(0,p.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"Loading…"}),o!==null&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("p",{className:"text-[13px]",children:[o.cards.started," card",o.cards.started===1?"":"s"," started, ",o.cards.finished," finished, ",o.cards.active," in progress."]}),(0,p.jsxs)("section",{className:"flex flex-col gap-2",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Where it breaks"}),o.breaks.length===0?(0,p.jsx)("p",{className:"text-[12.5px] text-muted-foreground",children:"Nothing failed or was sent back in this period."}):(0,p.jsx)("ul",{className:"flex flex-col gap-2",children:o.breaks.map(u=>{let d=o.zones.find(m=>m.zone===u.zone);return(0,p.jsxs)("li",{className:"rounded-lg border border-border p-2.5 text-[13px]",children:[(0,p.jsxs)("p",{children:[(0,p.jsx)("span",{className:"font-semibold",children:u.title}),": ",u.problems," of ",u.of," card",u.of===1?"":"s"," failed or were sent back"]}),d?.lastProblem&&(0,p.jsxs)("p",{className:"mt-0.5 text-[12px] text-muted-foreground",children:["Latest: ",d.lastProblem.cardTitle,d.lastProblem.note===null?"":` — ${d.lastProblem.note.split(`
|
|
68
|
-
`)[0]}`]})]},u.zone)})})]}),(0,p.jsxs)("section",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Zones"}),(0,p.jsxs)("table",{className:"w-full text-left text-[12px]",children:[(0,p.jsx)("thead",{className:"text-muted-foreground",children:(0,p.jsxs)("tr",{children:[(0,p.jsx)("th",{className:"py-1 font-medium",children:"Zone"}),(0,p.jsx)("th",{className:"font-medium",children:"In"}),(0,p.jsx)("th",{className:"font-medium",children:"On"}),(0,p.jsx)("th",{className:"font-medium",children:"Failed"}),(0,p.jsx)("th",{className:"font-medium",children:"Back"}),(0,p.jsx)("th",{className:"font-medium",children:"Typical stay"})]})}),(0,p.jsx)("tbody",{children:o.zones.map(u=>(0,p.jsxs)("tr",{className:"border-t",children:[(0,p.jsxs)("td",{className:"py-1.5 pr-2 font-medium",children:[u.title,u.here>0?(0,p.jsxs)("span",{className:"text-muted-foreground",children:[" · ",u.here," here"]}):null]}),(0,p.jsx)("td",{children:u.entered}),(0,p.jsx)("td",{children:u.movedOn}),(0,p.jsx)("td",{className:u.failed>0?"font-semibold text-destructive":"",children:u.failed}),(0,p.jsx)("td",{className:u.sentBack>0?"font-semibold text-foreground":"",children:u.sentBack}),(0,p.jsx)("td",{children:cK(u.typicalMinutes)})]},u.zone))})]})]}),o.scripts.length>0&&(0,p.jsxs)("section",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Scripts"}),(0,p.jsx)("ul",{className:"flex flex-col gap-1 text-[12.5px]",children:o.scripts.map(u=>(0,p.jsxs)("li",{children:[(0,p.jsx)("span",{className:"font-mono font-semibold",children:u.script}),": ",u.passed," of ",u.runs," passed",u.typicalSeconds===null?"":`, usually ${u.typicalSeconds<90?`${u.typicalSeconds} s`:`${Math.round(u.typicalSeconds/60)} min`}`]},u.script))})]}),o.sorts.length>0&&(0,p.jsxs)("section",{className:"flex flex-col gap-2","data-insights-sorts":!0,children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Sorting"}),o.sorts.map(u=>(0,p.jsxs)("div",{className:"rounded-lg border p-2.5 text-[12.5px]","data-insights-sort":u.zone,children:[(0,p.jsxs)("p",{children:[(0,p.jsx)("span",{className:"font-semibold",children:u.title}),": ",u.sorted," sorted · ",u.alone," on its own · ",u.notSure," for a person",u.corrected>0&&(0,p.jsxs)(p.Fragment,{children:[" · ",(0,p.jsxs)("span",{className:"font-semibold text-attention",children:[u.corrected," moved elsewhere by people"]})]})]}),u.bands.some(d=>d.of>0)&&(0,p.jsxs)("p",{className:"mt-1 text-muted-foreground",children:["Right when ",u.bands.filter(d=>d.of>0).map(d=>`${d.from}–${d.to}% sure: ${d.right} of ${d.of}`).join(" · ")]}),u.suggestion!==null&&(0,p.jsx)("p",{className:"mt-1",children:u.suggestion}),u.costUsd>0&&(0,p.jsxs)("p",{className:"mt-1 text-muted-foreground",children:["Cost: ",u.costUsd<.01?"under 1¢":`$${u.costUsd.toFixed(2)}`]})]},u.zone))]}),(o.recurring??[]).length>0&&(0,p.jsxs)("section",{className:"flex flex-col gap-1.5","data-insights-recurring":!0,children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"What keeps coming back"}),(0,p.jsx)("ul",{className:"flex flex-col gap-1 text-[12.5px]",children:o.recurring.map(u=>(0,p.jsxs)("li",{className:"flex items-baseline gap-2",children:[(0,p.jsx)("span",{className:"min-w-0 flex-1 truncate",children:u.card===null?u.title:(0,p.jsx)("a",{className:"underline-offset-2 hover:underline",href:`${e.flow.href}?card=${u.card}`,children:u.title})}),(0,p.jsxs)("span",{className:te("shrink-0 tabular-nums",u.days>1?"font-semibold text-foreground":"text-muted-foreground"),children:[u.days," day",u.days===1?"":"s"]})]},u.problem))})]}),(0,p.jsxs)("section",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Recent runs"}),o.runs.length===0?(0,p.jsx)("p",{className:"text-[12.5px] text-muted-foreground",children:"No scripts, sorts or updates have run in this period."}):(0,p.jsx)("ul",{className:"flex flex-col gap-1.5",children:o.runs.map(u=>{let d=`${u.card}:${u.entry}`;return(0,p.jsxs)("li",{className:"rounded-md border px-2.5 py-2 text-[12.5px]","data-run":d,children:[(0,p.jsxs)("button",{type:"button",className:"flex w-full items-start gap-2 text-left",onClick:()=>{f(u.card,u.entry)},"aria-expanded":l?.key===d,children:[(0,p.jsx)("span",{className:te("mt-1 size-2 shrink-0 rounded-full",u.state==="passed"?"bg-success":u.state==="failed"?"bg-destructive":"bg-info"),"aria-hidden":"true"}),(0,p.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,p.jsx)("span",{className:"font-medium",children:u.script??u.zoneTitle})," · ",u.cardTitle,(0,p.jsxs)("span",{className:"block text-[12px] text-muted-foreground",children:[u.kind==="sort"&&u.state==="passed"&&u.result!==null?u.result.split(". ")[0].replace(/\.$/,""):u.state==="passed"?"Passed":u.state==="failed"?"Failed":u.state==="waiting"?"Trying again":"Running",u.durationMs===null?"":u.kind==="sort"?` · ${u.durationMs<1e3?`${u.durationMs} ms`:`${(u.durationMs/1e3).toFixed(1)} s`}`:` in ${Math.max(1,Math.round(u.durationMs/1e3))} s`," · ",p2(u.at)]})]})]}),l?.key===d&&(0,p.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-2 font-mono text-[11.5px]","data-run-log":!0,children:l.text})]},d)})})]})]})]})}function fK({view:e,csrf:t}){let[a,n]=(0,me.useState)(e),[o,r]=(0,me.useState)(!1),[s,i]=(0,me.useState)(null),[l,c]=(0,me.useState)(e.selectedCard!==null?{card:e.selectedCard}:e.startTrigger!==null&&e.triggers.some(B=>B.id===e.startTrigger&&B.button!==null)?{press:e.startTrigger}:null),[f,u]=(0,me.useState)(!1),[d,m]=(0,me.useState)(!1),[g,b]=(0,me.useState)(()=>{try{return window.localStorage.getItem("so-flows-mine")==="1"}catch{return!1}});(0,me.useEffect)(()=>{try{window.localStorage.setItem("so-flows-mine",g?"1":"0")}catch{}},[g]);let v=Mp(),x=s?.stages??a.stages,y=s?.start??a.start,h=s!==null&&JSON.stringify({name:s.name,start:s.start,stages:s.stages,owner:s.owner})!==JSON.stringify({name:a.flow.name,start:a.start,stages:a.stages,owner:a.flow.owner}),w=(0,me.useCallback)(B=>{(B.ok?xn.success:xn.error)(B.said),B.view!==void 0&&n(B.view)},[]),S=j_(a,n,{card:l!==null&&"card"in l?l.card:null,editing:o}),C=(0,me.useMemo)(()=>{let B={};for(let G of S)if(!G.editing)for(let oe of G.cards)(B[oe]??=[]).push(G.name);return B},[S]),I=(0,me.useCallback)(async(B,G)=>{let oe=a.cards.find(Y=>Y.id===B);oe===void 0||oe.stage===G||w(await ca(`${a.flow.href}/cards/${B}/move`,{stage:G},t))},[a,t,w]),L=(0,me.useMemo)(()=>x.map(B=>({id:B.id,type:"zone",position:{x:B.zone.x,y:B.zone.y},width:B.zone.w,height:B.zone.h,style:{width:B.zone.w,height:B.zone.h},draggable:o,selectable:o,data:{stage:B,kindLabel:a.kinds.find(G=>G.kind===B.kind)?.label??B.kind,owner:s?.owner??a.flow.owner,teammate:B.teammate===void 0?null:a.teammates?.find(G=>G.handle===B.teammate)?.name??B.teammate,cards:a.cards.filter(G=>G.stage===B.id&&G.state==="active"&&(!g||G.mine)),hidden:g?a.cards.filter(G=>G.stage===B.id&&G.state==="active"&&!G.mine).length:0,lookers:C,editing:o,canMove:a.canEdit,start:B.id===y,selectedCard:l!==null&&"card"in l?l.card:null,onCard:G=>{m(!1),c({card:G})},onDrop:(G,oe)=>{I(G,oe)},onResize:(G,oe)=>i(Y=>Y===null?Y:{...Y,stages:Y.stages.map(Le=>Le.id===G?{...Le,zone:{...Le.zone,x:Math.round(oe.x),y:Math.round(oe.y),w:Math.round(oe.width),h:Math.round(oe.height)}}:Le)})}})),[x,a,o,l,y,I,g,C]),T=(0,me.useMemo)(()=>a.triggers.filter(B=>B.state!=="removed"),[a.triggers]),A=(0,me.useMemo)(()=>{let B=new Map;for(let G of T){let oe=x.some(Y=>Y.id===G.zoneId)?G.zoneId:y;B.set(oe,[...B.get(oe)??[],G])}return[...B].flatMap(([G,oe])=>{let Y=x.find(ze=>ze.id===G);if(Y===void 0)return[];let Le=Y_+oe.length*X_;return[{id:`trigger-${G}`,type:"trigger",position:{x:Y.zone.x-272,y:Y.zone.y+Math.max(0,(Y.zone.h-Le)/2)},width:236,height:Le,style:{width:236,height:Le},draggable:!1,selectable:!1,data:{triggers:oe,onOpen:ze=>c({triggers:ze}),onPress:ze=>c({press:ze})}}]})},[T,x,y]),D=T.map(B=>`${B.id}:${B.zoneId}`).join(","),H=(0,me.useRef)(D);(0,me.useEffect)(()=>{if(H.current===D)return;H.current=D;let B=requestAnimationFrame(()=>{v.fitView({padding:.12,minZoom:.55,maxZoom:1,duration:250})});return()=>cancelAnimationFrame(B)},[D,v]);let V=(0,me.useMemo)(()=>[...L,...A],[L,A]),[N,P]=(0,me.useState)(V);(0,me.useEffect)(()=>{P(B=>V.map(G=>{let oe=B.find(Y=>Y.id===G.id);return oe===void 0?G:{...oe,...G,...oe.measured===void 0?{}:{measured:oe.measured},selected:o&&oe.selected===!0}}))},[V,o]);let E=(0,me.useMemo)(()=>{let B=Y=>({x:Y.zone.x+Y.zone.w/2,y:Y.zone.y+Y.zone.h/2}),G=(Y,Le,ze)=>{let bt=B(Y),st=B(Le),Gt=st.x-bt.x,Ge=st.y-bt.y,at=Math.abs(Gt)>=Math.abs(Ge);if(ze){let Ba=Le.zone.x>=Y.zone.x+Y.zone.w||Y.zone.x>=Le.zone.x+Le.zone.w,Tt=Le.zone.y>=Y.zone.y+Y.zone.h||Y.zone.y>=Le.zone.y+Le.zone.h;return Ba&&Tt?Gt>=0?{source:"s-Right",target:"t-Left"}:{source:"s-Left",target:"t-Right"}:at?{source:"s-Bottom",target:"t-Bottom"}:{source:"s-Left",target:"t-Left"}}return at?Gt>=0?{source:"s-Right",target:"t-Left"}:{source:"s-Left",target:"t-Right"}:Ge>=0?{source:"s-Bottom",target:"t-Top"}:{source:"s-Top",target:"t-Bottom"}},oe=A.map(Y=>({id:`${Y.id}->zone`,source:Y.id,sourceHandle:"out",target:Y.id.slice(8),targetHandle:"t-Left",type:"smoothstep",animated:Y.data.triggers.some(Le=>Le.state==="active"),deletable:!1,markerEnd:{type:so.ArrowClosed},style:{strokeWidth:1.5}}));return PY([...oe,...x.flatMap(Y=>{let Le=Y.next===null?void 0:x.find(Ge=>Ge.id===Y.next),ze=Y.onFail===null?void 0:x.find(Ge=>Ge.id===Y.onFail),bt=Y.limit?.to==null?void 0:x.find(Ge=>Ge.id===Y.limit.to),st=Y.kind==="sort"&&Y.sort!==null?Y.sort.answers:Y.kind==="check"||Y.kind==="teammate"?Y.routes??[]:Y.kind==="choose"?(Y.options??[]).filter(Ge=>Ge.to!=="end").map(Ge=>({answer:Ge.label,to:Ge.to})):[],Gt=st.length>0?[...new Set(st.map(Ge=>Ge.to))].flatMap(Ge=>{let at=x.find(Tt=>Tt.id===Ge);if(at===void 0)return[];let Ba=at.zone.x>Y.zone.x+Y.zone.w?{source:"s-Right",target:"t-Left"}:G(Y,at,!1);return[{id:`${Y.id}->answer-${Ge}`,source:Y.id,target:Ge,sourceHandle:Ba.source,targetHandle:Ba.target,type:"smoothstep",label:st.filter(Tt=>Tt.to===Ge).map(Tt=>Tt.answer).join(", "),labelStyle:{fontSize:11,fontWeight:600,fill:"var(--color-foreground)"},labelBgStyle:{fill:"var(--color-card)"},markerEnd:{type:so.ArrowClosed},style:{strokeWidth:2},deletable:!1}]}):[];return[...Gt,...Le===void 0?[]:[{id:`${Y.id}->next`,source:Y.id,target:Le.id,sourceHandle:G(Y,Le,!1).source,targetHandle:G(Y,Le,!1).target,type:"smoothstep",markerEnd:{type:so.ArrowClosed},style:{strokeWidth:2},deletable:o,...Y.kind==="wait"&&Y.wait?.for==="reply"?{label:"replied",labelStyle:{fontSize:11,fontWeight:600,fill:"var(--color-foreground)"},labelBgStyle:{fill:"var(--color-card)"}}:{}}],...ze===void 0||!o&&Gt.some(Ge=>Ge.target===ze.id)?[]:[{id:`${Y.id}->fail`,source:Y.id,target:ze.id,sourceHandle:G(Y,ze,!0).source,targetHandle:G(Y,ze,!0).target,type:"smoothstep",pathOptions:{offset:28,borderRadius:10},label:Y.kind==="approval"?"sent back":Y.kind==="sort"?"not sure":Y.kind==="wait"?"no reply":Y.kind==="choose"?"reply":"fails",labelStyle:{fontSize:11,fill:(Y.kind==="wait","var(--color-muted-foreground)")},labelBgStyle:{fill:"var(--color-card)"},markerEnd:{type:so.ArrowClosed,color:(Y.kind==="wait","var(--color-muted-foreground)")},style:{strokeWidth:1.5,strokeDasharray:"6 4",stroke:(Y.kind==="wait","var(--color-muted-foreground)")},deletable:o}],...bt===void 0||Y.limit===void 0?[]:[{id:`${Y.id}->limit`,source:Y.id,target:bt.id,sourceHandle:G(Y,bt,!0).source,targetHandle:G(Y,bt,!0).target,type:"smoothstep",pathOptions:{offset:36,borderRadius:10},label:`after ${FY(Y.limit.minutes)}`,labelStyle:{fontSize:11,fill:"var(--color-muted-foreground)"},labelBgStyle:{fill:"var(--color-card)"},markerEnd:{type:so.ArrowClosed,color:"var(--color-muted-foreground)"},style:{strokeWidth:1.5,strokeDasharray:"2 4",stroke:"var(--color-muted-foreground)"},deletable:o}]]})],x)},[x,o,A,y]),_=(B,G)=>i(oe=>oe===null?oe:{...oe,stages:oe.stages.map(Y=>Y.id===B?{...Y,...G}:Y)}),z=B=>{if(P(G=>u2(B,G)),!!o)for(let G of B)G.type==="select"&&G.selected&&!G.id.startsWith("trigger-")&&c({zone:G.id})},q=(B,G)=>{!o||G.type!=="zone"||i(oe=>oe===null?oe:{...oe,stages:oe.stages.map(Y=>Y.id===G.id?{...Y,zone:{...Y.zone,x:Math.round(G.position.x),y:Math.round(G.position.y)}}:Y)})},O=B=>{if(!o||B.source===B.target)return;let G=x.find(oe=>oe.id===B.source);if(G?.kind==="sort"&&G.sort!==null&&B.sourceHandle!=="fail"){let oe=x.find(Y=>Y.id===B.target);oe!==void 0&&G.sort.answers.length<12&&_(G.id,{sort:{...G.sort,answers:[...G.sort.answers,{answer:oe.title.slice(0,40),means:oe.title,to:oe.id}]}}),c({zone:G.id});return}if(G?.kind==="choose"&&B.sourceHandle!=="fail"){let oe=x.find(Y=>Y.id===B.target);oe!==void 0&&(G.options??[]).length<4&&_(G.id,{options:[...G.options??[],{label:oe.title.slice(0,40),to:oe.id}]}),c({zone:G.id});return}_(B.source,B.sourceHandle==="fail"?{onFail:B.target}:{next:B.target})},W=()=>{i({name:a.flow.name,start:a.start,stages:a.stages,owner:a.flow.owner}),r(!0),c(null)},ee=()=>{i(null),r(!1),c(null)},de=async()=>{if(s===null)return;u(!0);let B=await ca(`${a.flow.href}/save`,{name:s.name,owner:s.owner,revision:String(a.flow.revision),definition:JSON.stringify({version:1,start:s.start,stages:s.stages})},t);u(!1),w(B),B.ok&&(i(null),r(!1),c(null))},ne=()=>{if(s===null)return;let B=new Set(s.stages.map(Y=>Y.id)),G=v.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),oe={id:zY("New zone",B),title:"New zone",kind:"inbox",zone:{x:Math.round(G.x-140),y:Math.round(G.y-120),w:280,h:300,color:"slate"},instructions:null,planning:null,approver:null,message:null,close:null,script:null,sort:null,next:null,onFail:null};i({...s,stages:[...s.stages,oe]}),c({zone:oe.id})},re=l!==null&&"card"in l?a.cards.find(B=>B.id===l.card)??null:null,ue=l!==null&&"press"in l?a.triggers.find(B=>B.id===l.press&&B.button!==null)??null:null,ce=l!==null&&"triggers"in l&&!o,U=l!==null&&"scripts"in l,M=l!==null&&"insights"in l&&!o,se=l!==null&&"zone"in l?x.find(B=>B.id===l.zone)??null:null,le=a.cards.filter(B=>B.canDecide).length;return(0,p.jsxs)("div",{className:"flex h-[calc(100dvh-7.5rem)] min-h-[560px] flex-col overflow-hidden rounded-xl border bg-card","data-flow":a.flow.id,children:[(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-2.5",children:[o&&s!==null?(0,p.jsx)(ve,{value:s.name,onChange:B=>i({...s,name:B.target.value}),maxLength:80,className:"h-8 max-w-64 font-semibold","aria-label":"Flow name"}):(0,p.jsx)("h1",{className:"text-[15px] font-semibold",children:a.flow.name}),(0,p.jsx)("span",{className:"text-[12px] text-muted-foreground",children:a.flow.project}),(0,p.jsx)(W_,{others:S,cards:a.cards}),o&&s!==null&&(0,p.jsxs)("label",{className:"inline-flex items-center gap-1.5 text-[12px] text-muted-foreground",children:["Owner",(0,p.jsx)("select",{className:"h-8 rounded-md border bg-transparent px-2 text-[12px] text-foreground",value:s.owner,onChange:B=>i({...s,owner:B.target.value}),"aria-label":"Flow owner",children:[...new Set([s.owner,...a.approvers])].map(B=>(0,p.jsx)("option",{value:B,children:B===a.me?`${B} (you)`:B},B))})]}),le>0&&!o&&(0,p.jsxs)(wa,{tone:"attention",children:[le," waiting for you"]}),!o&&(0,p.jsx)("div",{className:"ml-1 inline-flex rounded-md border p-0.5",role:"group","aria-label":"Which cards",children:[["All cards",!1],["Mine",!0]].map(([B,G])=>(0,p.jsx)("button",{type:"button","aria-pressed":g===G,onClick:()=>b(G),className:te("rounded px-2 py-1 text-[12px] font-medium",g===G?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:B},B))}),(0,p.jsx)("span",{className:"flex-1"}),o?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>c({scripts:!0}),children:[(0,p.jsx)(to,{className:"size-4"}),"Scripts"]}),(0,p.jsxs)(Z,{size:"sm",variant:"outline",onClick:ne,children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add zone"]}),(0,p.jsx)(Z,{size:"sm",variant:"ghost",onClick:ee,children:"Discard"}),(0,p.jsx)(Z,{size:"sm",onClick:()=>{de()},disabled:!h||f,children:f?"Saving…":"Save flow"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>{m(!1),c({insights:!0})},"data-open-insights":!0,children:[(0,p.jsx)(Wo,{className:"size-4"}),"Insights"]}),(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>{m(!1),c({scripts:!0})},"data-open-scripts":!0,children:[(0,p.jsx)(to,{className:"size-4"}),"Scripts"]}),a.canEdit&&(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>{m(!1),c({triggers:null})},"data-open-triggers":!0,children:[(0,p.jsx)(As,{className:"size-4"}),"Triggers",T.length>0?` · ${T.length}`:""]}),a.canEdit&&(0,p.jsx)(Z,{size:"sm",variant:"ghost",asChild:!0,children:(0,p.jsxs)("a",{href:a.chatHref,children:[(0,p.jsx)(Ts,{className:"size-4"}),"Change in chat"]})}),a.canEdit&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",onClick:W,children:[(0,p.jsx)(Sf,{className:"size-4"}),"Edit flow"]}),a.canEdit&&(0,p.jsxs)(Z,{size:"sm",onClick:()=>{c(null),m(!0)},children:[(0,p.jsx)(Yt,{className:"size-4"}),"New card"]}),(0,p.jsxs)(ic,{children:[(0,p.jsx)(lc,{asChild:!0,children:(0,p.jsx)(Z,{size:"sm",variant:"ghost","aria-label":"More","data-flow-menu":!0,children:(0,p.jsx)(Yo,{className:"size-4"})})}),(0,p.jsx)(uc,{align:"end",children:(0,p.jsx)(cc,{asChild:!0,children:(0,p.jsxs)("a",{href:`${a.flow.href}/export`,download:!0,"data-export-flow":!0,children:[(0,p.jsx)(Hi,{className:"size-4"}),"Export as a file"]})})})]})]})]}),(0,p.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,p.jsxs)("div",{className:"relative min-w-0 flex-1","data-flow-canvas":!0,children:[(0,p.jsxs)(__,{nodes:N,edges:E,nodeTypes:AY,edgeTypes:_Y,onNodesChange:z,onNodeDragStop:q,onConnect:O,onEdgesDelete:B=>{for(let G of B)_(G.source,G.id.endsWith("->fail")?{onFail:null}:G.id.endsWith("->limit")?{limit:{...s?.stages.find(oe=>oe.id===G.source)?.limit??{minutes:1440},to:null}}:{next:null})},onPaneClick:()=>{o&&c(null)},onNodeClick:()=>{},nodesDraggable:o,nodesConnectable:o,elementsSelectable:o,fitView:!0,fitViewOptions:{padding:.12,minZoom:.55,maxZoom:1},minZoom:.3,maxZoom:1.5,proOptions:{hideAttribution:!0},deleteKeyCode:o?["Backspace","Delete"]:null,children:[(0,p.jsx)(z_,{variant:sr.Dots,gap:20,size:1}),(0,p.jsx)(F_,{showInteractive:!1})]}),o&&(0,p.jsx)("p",{className:"pointer-events-none absolute bottom-3 left-14 max-w-md rounded-lg bg-foreground/85 px-3 py-1.5 text-[12px] text-background",children:"Drag zones to arrange them. Drag from a zone's right dot to say where work goes next, from its bottom dot for where it goes if sent back."})]}),se!==null&&o||re!==null||d&&!o||ce||ue!==null||U||M?(0,p.jsx)("aside",{className:"absolute inset-y-0 right-0 z-10 w-[360px] max-w-full overflow-y-auto border-l bg-card p-4 shadow-xl","data-flow-drawer":!0,children:se!==null&&o?(0,p.jsx)(eK,{stage:se,stages:x,view:a,csrf:t,apply:w,update:B=>_(se.id,B),remove:()=>{i(B=>B===null?B:{...B,start:B.start===se.id?B.stages.find(G=>G.id!==se.id).id:B.start,stages:B.stages.filter(G=>G.id!==se.id).map(G=>({...G,next:G.next===se.id?null:G.next,onFail:G.onFail===se.id?null:G.onFail}))}),c(null)},makeStart:()=>i(B=>B===null?B:{...B,start:se.id}),onClose:()=>c(null)}):U?(0,p.jsx)(uK,{view:a,csrf:t,apply:w,onClose:()=>c(null)}):M?(0,p.jsx)(dK,{view:a,onClose:()=>c(null)}):ue!==null?(0,p.jsx)(l8,{trigger:ue,view:a,csrf:t,apply:w,onClose:()=>c(null)},ue.id):ce?(0,p.jsx)(lK,{view:a,csrf:t,apply:w,focus:l!==null&&"triggers"in l?l.triggers:null,onPress:B=>c({press:B}),onClose:()=>c(null)}):re!==null?(0,p.jsx)(J_,{card:re,view:a,csrf:t,apply:w,onClose:()=>c(null)}):(0,p.jsx)(o8,{view:a,csrf:t,apply:B=>{w(B),B.ok&&m(!1)},onClose:()=>m(!1)})}):null]})]})}function pK({view:e,csrf:t}){let[a,n]=(0,me.useState)(e),[o,r]=(0,me.useState)(e.selectedCard),[s,i]=(0,me.useState)(e.startTrigger),l=v=>{(v.ok?xn.success:xn.error)(v.said),v.view!==void 0&&n(v.view)},c=j_(a,n,{card:o,editing:!1}),f=o===null?null:a.cards.find(v=>v.id===o)??null,u=s===null?null:a.triggers.find(v=>v.id===s&&v.button!==null&&v.state==="active")??null,d=a.triggers.filter(v=>v.state!=="removed"),[m,g]=(0,me.useState)(!1),b=async v=>{g(!0),l(await ca(`${a.flow.href}/triggers/${v.id}/${v.state==="paused"?"resume":"pause"}`,{},t)),g(!1)};return u!==null?(0,p.jsx)("div",{className:"p-4",children:(0,p.jsx)(l8,{trigger:u,view:a,csrf:t,apply:l,onClose:()=>i(null)})}):f!==null?(0,p.jsx)("div",{className:"p-4",children:(0,p.jsx)(J_,{card:f,view:a,csrf:t,apply:l,onClose:()=>r(null)})}):(0,p.jsxs)("div",{className:"flex flex-col gap-3 p-4","data-flow":a.flow.id,children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h1",{className:"text-[17px] font-semibold",children:a.flow.name}),(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:[a.flow.project,a.canEdit?(0,p.jsxs)(p.Fragment,{children:[" · ",(0,p.jsx)("a",{className:"underline",href:a.chatHref,children:"change it in chat"}),", or edit it on a larger screen"]}):null," · ",(0,p.jsx)("a",{className:"underline",href:`${a.flow.href}/export`,download:!0,"data-export-flow":!0,children:"Export"})]}),c.length>0&&(0,p.jsx)("div",{className:"mt-1.5",children:(0,p.jsx)(W_,{others:c,cards:a.cards})})]}),a.canEdit&&d.some(v=>v.button!==null&&v.state==="active")&&(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:d.filter(v=>v.button!==null&&v.state==="active").map(v=>(0,p.jsxs)(Z,{size:"sm",onClick:()=>i(v.id),children:[(0,p.jsx)($u,{className:"size-4"}),v.button.label]},v.id))}),a.canEdit&&(0,p.jsxs)("details",{className:"rounded-lg border p-3",children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[14px] font-semibold",children:"New card"}),(0,p.jsx)("div",{className:"pt-3",children:(0,p.jsx)(o8,{view:a,csrf:t,apply:l})})]}),OY(a.stages,a.start).map(v=>{let x=a.cards.filter(y=>y.stage===v.id&&y.state==="active");return(0,p.jsxs)("section",{className:"rounded-lg border bg-muted/40",children:[(0,p.jsxs)("header",{className:"flex items-center gap-2 px-3 py-2",children:[(0,p.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-md text-white",style:{background:Ep[v.zone.color]??"#64748b"},children:G_[v.kind]}),(0,p.jsx)("span",{className:"flex-1 text-[14px] font-semibold",children:v.title}),x.length>0&&(0,p.jsx)("span",{className:"text-[12px] text-muted-foreground",children:x.length})]}),x.length>0&&(0,p.jsx)("ul",{className:"flex flex-col gap-2 px-3 pb-3",children:x.map(y=>(0,p.jsx)("li",{children:(0,p.jsxs)("button",{type:"button",onClick:()=>r(y.id),className:te("min-h-11 w-full rounded-lg border bg-card px-3 py-2 text-left",y.canDecide&&"border-attention/60"),children:[(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsx)("div",{className:"min-w-0 flex-1 text-[14px] font-medium",children:y.title}),y.owner!==null&&(0,p.jsx)(ei,{name:y.owner})]}),y.sorted!==null&&(0,p.jsx)("div",{className:"mt-1 flex",children:(0,p.jsx)(f2,{sorted:y.sorted})}),y.waiting!==null&&(0,p.jsx)("div",{className:te("text-[12px]",y.task!==null&&(v.kind==="task"||v.kind==="report")&&"truncate",y.canDecide?"font-semibold text-attention":"text-muted-foreground"),children:y.canDecide?tp.card.sentence({}):y.waiting}),y.comments.length>0&&(0,p.jsxs)("div",{className:"mt-0.5 inline-flex items-center gap-1 text-[12px] text-muted-foreground",children:[(0,p.jsx)(Ts,{className:"size-3","aria-hidden":"true"}),y.comments.length]})]})},y.id))})]},v.id)}),d.length>0&&(0,p.jsxs)("section",{className:"rounded-lg border p-3","data-flow-triggers":!0,children:[(0,p.jsx)("h2",{className:"text-[14px] font-semibold",children:"Triggers"}),(0,p.jsx)("ul",{className:"mt-2 flex flex-col gap-2",children:d.map(v=>(0,p.jsxs)("li",{className:"text-[13px]","data-trigger-row":v.id,children:[(0,p.jsx)("span",{className:"font-medium",children:v.name})," · ",v.detail,(0,p.jsx)("div",{className:te("text-[12px]",v.failing?"text-warning":"text-muted-foreground"),children:v.state==="paused"?"Paused":v.status===null?`Starts in ${v.zone}`:(0,p.jsxs)(p.Fragment,{children:[r8(v.statusAt),": ",v.status,(0,p.jsx)(K_,{link:v.statusLink})]})}),v.order!==void 0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"mt-1 text-[12px] break-words","data-trigger-approval":!0,children:v.order.at(-1)}),(0,p.jsxs)("details",{className:"mt-1.5 rounded-md border px-3 py-2","data-trigger-order":!0,children:[(0,p.jsx)("summary",{className:"flex min-h-11 cursor-pointer items-center text-[13px] font-medium",children:"What each run files"}),(0,p.jsx)("ul",{className:"flex flex-col gap-1 pb-1 text-[12px] text-muted-foreground",children:v.order.slice(0,-1).map((x,y)=>(0,p.jsx)("li",{className:"break-words",children:x},y))})]}),a.canEdit&&(0,p.jsx)(Z,{size:"sm",variant:"outline",className:"mt-1.5 min-h-11",disabled:m,onClick:()=>{b(v)},children:v.state==="paused"?"Turn on":"Pause"})]})]},v.id))})]})]})}function u8({view:e,csrf:t}){let a=(0,me.useRef)(typeof window<"u"&&window.matchMedia("(max-width: 767px)").matches),[n,o]=(0,me.useState)(a.current);return(0,me.useEffect)(()=>{let r=window.matchMedia("(max-width: 767px)"),s=()=>o(r.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),n?(0,p.jsx)(pK,{view:e,csrf:t}):(0,p.jsx)(d2,{children:(0,p.jsx)(fK,{view:e,csrf:t})})}var ti=j(fe(),1);function c8({view:e,csrf:t,taskChat:a=null,taskDetails:n=!0}){return(0,ti.jsx)("div",{"data-view":e.kind,className:"w-full",children:e.kind==="tasks"?(0,ti.jsx)(ME,{view:e}):e.kind==="settings"?(0,ti.jsx)(NE,{view:e,csrf:t}):e.kind==="task"?(0,ti.jsx)(iE,{view:e,chat:a,details:n,csrf:t}):e.kind==="projects"?(0,ti.jsx)(uE,{view:e,csrf:t}):e.kind==="result"?(0,ti.jsx)(mE,{view:e,csrf:t}):e.kind==="flow"?(0,ti.jsx)(u8,{view:e,csrf:t}):null})}var Nl=j(he(),1);var Ne=j(fe(),1),Wx=[{id:"needs-you",label:"Needs you",empty:"Nothing needs you right now."},{id:"ready",label:"Ready",empty:"No results are waiting for review."},{id:"running",label:"Running",empty:"Nothing is running."},{id:"all",label:"All",empty:"No tasks this week."}];function mK(e,t=Date.now()){let a=Math.max(0,Math.round((t-Date.parse(e))/6e4));return a<60?`${a} min`:`${Math.floor(a/60)} h${a%60===0?"":` ${a%60} min`}`}function hK(e,t=Date.now()){let a=Math.max(0,Math.floor((t-Date.parse(e))/6e4));if(!Number.isFinite(a)||a<1)return"just now";if(a<60)return`${a} min ago`;let n=Math.floor(a/60);return n<24?`${n} h ago`:Math.floor(n/24)===1?"yesterday":`${Math.floor(n/24)} days ago`}var h2="so-catch-up-seen",Yx=e=>`${e.id}@${e.at}`,gK=()=>{try{return window.localStorage.getItem(h2)!==null}catch{return!0}};function xK(e){try{let t=window.localStorage.getItem(h2);if(t===null)return new Set(e.map(Yx));let a=JSON.parse(t);return new Set(Array.isArray(a)?a.filter(n=>typeof n=="string"):[])}catch{return new Set(e.map(Yx))}}function Xx(e,t){return t==="all"||e.tab===t}function d8({home:e,compact:t=!1}){let a=(0,Nl.useMemo)(()=>Object.fromEntries(Wx.map(l=>[l.id,e.catchUp.filter(c=>Xx(c,l.id)).length])),[e.catchUp]),[n,o]=(0,Nl.useState)(()=>a["needs-you"]>0?"needs-you":a.ready>0?"ready":a.running>0?"running":"all"),[r,s]=(0,Nl.useState)(()=>xK(e.catchUp));(0,Nl.useEffect)(()=>{let l=e.catchUp.filter(f=>Xx(f,n)).map(Yx);if(l.every(f=>r.has(f))&&gK())return;let c=new Set([...r,...l]);s(c);try{window.localStorage.setItem(h2,JSON.stringify([...c].slice(-400)))}catch{}},[n,e.catchUp]);let i=e.catchUp.filter(l=>Xx(l,n));return(0,Ne.jsxs)("div",{className:"so-home flex flex-col gap-6 phone:gap-4","data-home":!0,children:[(0,Ne.jsxs)("section",{"aria-labelledby":"home-now","data-home-now":!0,children:[(0,Ne.jsx)("h2",{id:"home-now",className:"mb-2.5 text-[14px] font-semibold tracking-[-0.01em]",children:"Now"}),e.lead!=null&&(0,Ne.jsxs)("p",{"data-home-lead":!0,className:"mb-2.5 flex min-w-0 items-baseline gap-1.5 text-[13px] leading-snug",children:[(0,Ne.jsxs)("span",{className:"shrink-0 font-medium",children:[e.lead.name??"Lead",":"]}),e.lead.href===null?(0,Ne.jsx)("span",{className:"min-w-0 truncate",children:e.lead.doing}):(0,Ne.jsx)("a",{href:e.lead.href,className:"min-w-0 truncate hover:underline hover:underline-offset-4",children:e.lead.doing}),(0,Ne.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:["· ",(0,Ne.jsx)("time",{dateTime:e.lead.at,className:"tabular-nums",children:hK(e.lead.at)})]})]}),e.agents.length===0?(0,Ne.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"No agent is working right now."}):(0,Ne.jsx)("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-2 phone:-mx-4 phone:flex phone:snap-x phone:snap-mandatory phone:scroll-px-4 phone:overflow-x-auto phone:px-4 phone:pb-1 phone:[scrollbar-width:none]",children:e.agents.map(l=>(0,Ne.jsx)("li",{"data-home-agent":l.taskId,className:"min-w-0 phone:w-[236px] phone:shrink-0 phone:snap-start",children:(0,Ne.jsxs)("a",{href:l.href,className:"flex h-full min-w-0 flex-col gap-1.5 rounded-[10px] border border-border bg-card px-3.5 py-3 transition-colors hover:border-input hover:bg-[var(--so-raised)] phone:px-3 phone:py-2.5",children:[(0,Ne.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-medium text-info",children:[(0,Ne.jsx)("span",{"aria-hidden":"true",className:"so-home-live size-1.5 shrink-0 rounded-full bg-info"}),l.phase]}),(0,Ne.jsx)("span",{className:"line-clamp-2 text-[13.5px] font-medium leading-snug text-foreground",children:l.title}),l.activity!==void 0&&(0,Ne.jsx)(dc,{activity:l.activity,className:"text-[12px]"}),(0,Ne.jsxs)("span",{className:"mt-auto truncate text-[12px] text-muted-foreground",children:[l.agent," · ",(0,Ne.jsx)("span",{className:"tabular-nums",children:mK(l.since)})]})]})},l.runId))})]}),(0,Ne.jsxs)("section",{"aria-label":"At a glance","data-home-counts":!0,children:[(0,Ne.jsx)("ul",{className:"grid grid-cols-4 divide-x divide-border border-y border-border",children:e.counts.map(l=>(0,Ne.jsx)("li",{className:"min-w-0","data-home-count":l.key,children:(0,Ne.jsxs)("a",{href:l.href,className:"flex h-full flex-col gap-1 px-3 py-3 transition-colors hover:bg-[var(--so-raised)] first:pl-0 phone:px-2 phone:py-2.5",children:[(0,Ne.jsx)("span",{className:te("font-mono text-[22px] font-semibold leading-none tabular-nums tracking-[-0.02em] phone:text-[20px]",l.key==="waiting"&&l.value>0&&"text-attention"),children:l.value}),(0,Ne.jsx)("span",{className:"text-[12px] leading-tight text-muted-foreground",children:l.label})]})},l.key))}),e.planUse.length>0&&(0,Ne.jsx)("p",{className:"mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[12px] text-muted-foreground","data-home-plan":!0,"aria-label":"Plan use",children:e.planUse.map(l=>(0,Ne.jsxs)("span",{className:"inline-flex items-center gap-1.5",title:l.detail,children:[(0,Ne.jsxs)("span",{children:[l.name," · ",l.window]}),(0,Ne.jsx)("span",{"aria-hidden":"true",className:"relative inline-block h-1 w-12 overflow-hidden rounded-full bg-muted",children:(0,Ne.jsx)("span",{className:te("absolute inset-y-0 left-0 rounded-full",l.tone==="neutral"?"bg-foreground":l.tone==="warning"?"bg-warning":"bg-destructive"),style:{width:`${Math.min(100,Math.max(0,l.percent))}%`}})}),(0,Ne.jsxs)("span",{className:te("tabular-nums",l.tone==="warning"&&"text-warning",l.tone==="danger"&&"text-destructive"),children:[Math.round(l.percent),"%"]})]},`${l.name}-${l.window}`))})]}),(0,Ne.jsxs)("section",{"aria-labelledby":"home-catch-up","data-home-catch-up":!0,children:[(0,Ne.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,Ne.jsx)("h2",{id:"home-catch-up",className:"text-[14px] font-semibold tracking-[-0.01em]",children:"Catch up"}),(0,Ne.jsx)("div",{role:"tablist","aria-label":"Catch up",className:te("ml-auto inline-flex h-8 items-center gap-0.5 rounded-xl bg-muted p-0.5 phone:ml-0 phone:h-11 phone:w-full",t&&"ml-0 w-full"),children:Wx.map(l=>{let c=e.catchUp.some(f=>Xx(f,l.id)&&!r.has(Yx(f)));return(0,Ne.jsxs)("button",{type:"button",role:"tab","aria-selected":n===l.id,"data-catch-up-tab":l.id,onClick:()=>o(l.id),className:te("relative inline-flex h-full items-center gap-1.5 rounded-lg px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground phone:flex-1 phone:justify-center phone:px-1.5",t&&"flex-1 justify-center px-1.5",n===l.id&&"bg-card text-foreground shadow-[var(--so-pill-shadow)]"),children:[l.label,(0,Ne.jsx)("span",{className:te("min-w-[18px] rounded-full px-1.5 text-center font-mono text-[11px] leading-[18px] tabular-nums",l.id==="needs-you"&&a["needs-you"]>0?"bg-attention text-on-attention":"text-muted-foreground",t&&a[l.id]===0&&"hidden"),children:a[l.id]}),c&&n!==l.id&&(0,Ne.jsx)("span",{"data-unread":!0,"aria-label":"New",className:"absolute right-1 top-1 size-1.5 rounded-full bg-attention desk:hidden"})]},l.id)})})]}),i.length===0?(0,Ne.jsx)("p",{className:"border-t border-border py-4 text-[13px] text-muted-foreground",role:"status",children:Wx.find(l=>l.id===n).empty}):(0,Ne.jsx)("ul",{role:"tabpanel","aria-label":Wx.find(l=>l.id===n).label,className:"divide-y divide-border border-y border-border",children:i.slice(0,12).map(l=>(0,Ne.jsxs)("li",{"data-catch-up-item":l.id,className:"flex flex-col gap-1 py-2.5 phone:py-2",children:[(0,Ne.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,Ne.jsx)("a",{href:l.href,className:"min-w-0 text-[13.5px] font-medium leading-snug hover:underline hover:underline-offset-4 phone:flex phone:min-h-11 phone:items-center",children:l.title}),(0,Ne.jsx)(dl,{label:l.label,tone:l.tone,className:"mt-px"})]}),l.detail!==""&&(0,Ne.jsx)("p",{className:"text-[12.5px] leading-snug text-muted-foreground [overflow-wrap:anywhere]",children:l.detail}),l.action!=null&&(0,Ne.jsx)("a",{href:l.action.href,"data-catch-up-action":!0,className:"mt-0.5 inline-flex h-8 w-fit items-center rounded-md bg-attention px-3 text-[12.5px] font-semibold text-on-attention hover:bg-[var(--so-signal-hover)] phone:h-11 phone:w-full phone:justify-center",children:l.action.label}),(0,Ne.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:[l.project!==null&&(0,Ne.jsxs)(Ne.Fragment,{children:[l.project," · "]}),(0,Ne.jsx)("time",{dateTime:l.at,className:"tabular-nums",children:vn(l.at)})]})]},l.id))}),(0,Ne.jsx)("a",{href:e.allHref,className:"mt-2 inline-flex text-[12.5px] text-muted-foreground underline decoration-border underline-offset-4 hover:text-foreground phone:min-h-11 phone:items-center",children:"All tasks"})]})]})}function f8(e){return e.security?`Toolroll ${e.version} is available, with security fixes`:`Toolroll ${e.version} is available`}var R=j(fe(),1);function Ja({name:e}){return(0,R.jsx)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:{menu:(0,R.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"}),chat:(0,R.jsx)("path",{d:"M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 3V6a2 2 0 0 1 2-2Z"}),tasks:(0,R.jsx)(R.Fragment,{children:(0,R.jsx)("path",{d:"m3 6 2 2 4-4m-6 9 2 2 4-4m-6 9 2 2 4-4M13 6h8M13 13h8M13 20h8"})}),flows:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}),(0,R.jsx)("path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}),(0,R.jsx)("rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"})]}),projects:(0,R.jsx)("path",{d:"M3 7V5a2 2 0 0 1 2-2h5l3 4h6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),knowledge:(0,R.jsx)("path",{d:"M12 5c-3-2-7-2-10-1v15c3-1 7-1 10 1 3-2 7-2 10-1V4c-3-1-7-1-10 1Zm0 0v15"}),settings:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"}),(0,R.jsx)("path",{d:"M8 3v6M16 9v6M10 15v6"})]}),arrow:(0,R.jsx)("path",{d:"m10 6-6 6 6 6M4 12h16"}),close:(0,R.jsx)("path",{d:"m6 6 12 12M6 18 18 6"}),send:(0,R.jsx)("path",{d:"m12 19 0-14m-6 6 6-6 6 6"}),tools:(0,R.jsx)(R.Fragment,{children:(0,R.jsx)("path",{d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})}),plus:(0,R.jsx)("path",{d:"M12 5v14M5 12h14"})}[e]})}function g2(){try{return window.sessionStorage}catch{return{getItem:()=>null,removeItem:()=>{},setItem:()=>{throw new Error("Storage unavailable")}}}}function x2(e){let t=e.conversation;return t?{user:e.user,session:t.sessionId,task:t.taskId??(t.project?`project:${t.project}`:null)}:null}function v2(){return!document.hidden&&navigator.onLine!==!1}var vK=new Set(["/work","/board","/queue","/workbench","/code"]);function yK(e){let[t,a]=(0,Ie.useState)(e),n=x2(e),[o,r]=(0,Ie.useState)(()=>{let N=e.conversation&&n?A4(g2(),n,e.conversation.requestId,e.conversation.maxChars):Vh(""),P=e.conversation?new URLSearchParams(window.location.search).get("draft"):null;return P&&N.text===""&&N.pending===null?{...N,text:P.slice(0,e.conversation.maxChars)}:N});(0,Ie.useEffect)(()=>{let N=new URL(window.location.href);N.searchParams.has("draft")&&(N.searchParams.delete("draft"),window.history.replaceState(window.history.state,"",N.pathname+N.search+N.hash))},[]);let[s,i]=(0,Ie.useState)(""),[l,c]=(0,Ie.useState)(!0),[f,u]=(0,Ie.useState)(!1),[d,m]=(0,Ie.useState)(!1),[g,b]=(0,Ie.useState)(()=>navigator.onLine===!1),v=(0,Ie.useRef)({workspace:t,draft:o,stale:d,sending:f,notice:s});v.current={workspace:t,draft:o,stale:d,sending:f,notice:s};let x=(0,Ie.useRef)(!1),y=(0,Ie.useRef)(!1),h=(0,Ie.useRef)(null),w=(0,Ie.useRef)(null),S=(0,Ie.useCallback)(()=>{w.current!==null&&clearTimeout(w.current),w.current=null},[]),C=(0,Ie.useRef)(!0),I=(0,Ie.useRef)(!1),L=(0,Ie.useCallback)(N=>{v.current.draft=N,r(N);let P=x2(e);P&&c(D4(g2(),P,N))},[e]),T=e.view?.kind==="task"&&e.view.live!=null&&!e.sensitive,A=!!(e.conversation||e.refreshSeconds),D=(0,Ie.useCallback)(async(N=!0,P=!1)=>{if(S(),!C.current||v.current.stale||!(A||T)||!v2())return;if(x.current){y.current=!0;return}y.current=!1,x.current=!0;let E=v.current.draft.pending?.request??null;try{let _=await H4(v.current.workspace,E,fetch,{etag:h.current,force:N});if(!C.current)return;if(h.current=E?null:_.etag,_.kind==="unchanged"){!v.current.draft.pending&&v.current.notice&&i("");return}let z=_.workspace;if(!F4(e,z)){v.current.stale=!0,m(!0),i("This conversation changed or ended. Reconnect to continue with your draft.");return}let q=z4(v.current.draft,E,z.receipt);q!==v.current.draft&&L(q),v.current.workspace=z,a(z),i(q.pending?"Delivery is not confirmed. Check again before sending another message.":"")}catch(_){if(!C.current)return;_ instanceof Nr&&(v.current.stale=!0,m(!0)),i(_ instanceof Error?_.message:"Updates are unavailable. Your work is still saved."),!P&&!v.current.stale&&v2()&&(w.current=setTimeout(()=>{w.current=null,D(!0,!0)},2e3))}finally{x.current=!1,y.current&&C.current&&!v.current.stale&&v2()&&(y.current=!1,D(!0))}},[e,A,T,L,S]);jo(A&&!d?"workspace":null,N=>{N==="change"||N==="reload"?D(!1):N==="lost"&&D(!0)}),(0,Ie.useEffect)(()=>{if(!T)return;let N=()=>{D(!0)};return window.addEventListener(Hg,N),()=>{window.removeEventListener(Hg,N)}},[D,T]),(0,Ie.useEffect)(()=>{if(C.current=!0,!A&&!T)return()=>{C.current=!1};let N=()=>{document.hidden?S():D(!0)},P=()=>{b(!1),D()},E=()=>{S(),b(!0)};return document.addEventListener("visibilitychange",N),window.addEventListener("online",P),window.addEventListener("offline",E),()=>{C.current=!1,S(),document.removeEventListener("visibilitychange",N),window.removeEventListener("online",P),window.removeEventListener("offline",E)}},[D,A,T,S]),(0,Ie.useEffect)(()=>{d&&S()},[d,S]);let H=async(N,P=null)=>{N.preventDefault();let E=v.current;if(I.current||E.stale||navigator.onLine===!1||E.draft.pending||E.workspace.conversation?.pendingTurnId!==null||!E.draft.text.trim())return;let _=O4(E.draft);if(_.pending){I.current=!0,u(!0),L(_),i("");try{let z=await q4(E.workspace,_.pending,fetch,P);if(!C.current)return;z.refused?(L(B4(v.current.draft,_.pending.request)),i(z.message??"Message not sent. Your draft is saved.")):(i("Checking delivery…"),D())}catch(z){if(!C.current)return;z instanceof Nr&&(v.current.stale=!0,m(!0)),i(z instanceof Nr?z.message:"Delivery is not confirmed. Check again before sending another message."),D()}finally{I.current=!1,C.current&&u(!1)}}},V=()=>{let N=x2(e);N&&_4(g2(),N,v.current.draft.text),window.location.reload()};return(0,Ie.useEffect)(()=>{let N=E=>{let _=E.target;if(!(_ instanceof HTMLFormElement)||_.dataset.workspaceComposer!==void 0||_.getAttribute("action")!=="/chat")return;let z=v.current;if(!z.workspace.conversation)return;if(z.stale||I.current||z.draft.pending||navigator.onLine===!1||z.workspace.conversation.pendingTurnId!==null){E.preventDefault(),i("Wait for the current message before sending another.");return}if(_.getAttribute("aria-busy")==="true"){E.preventDefault();return}let q=(O,W)=>{if(_.querySelector(`[name="${O}"]`))return;let ee=document.createElement("input");ee.type="hidden",ee.name=O,ee.value=W,_.append(ee)};q("request",z.workspace.conversation.requestId),q("request-session",String(z.workspace.conversation.sessionId)),z.workspace.conversation.taskId&&q("task",z.workspace.conversation.taskId),z.workspace.conversation.resultRunId!==null&&q("result",String(z.workspace.conversation.resultRunId)),!E.defaultPrevented&&(I.current=!0,_.setAttribute("aria-busy","true"))},P=()=>{I.current=!1,document.querySelectorAll('form[action="/chat"][aria-busy="true"]:not([data-workspace-composer])').forEach(E=>E.removeAttribute("aria-busy")),D()};return document.addEventListener("submit",N),window.addEventListener("pageshow",P),()=>{document.removeEventListener("submit",N),window.removeEventListener("pageshow",P)}},[D]),{workspace:t,draft:o,notice:s,storageAvailable:l,sending:f,stale:d,offline:g,send:H,check:D,reconnect:V,edit:N=>L(P4(v.current.draft,N))}}function bK({at:e}){let t=xR(e);return t===""?null:(0,R.jsx)("time",{className:"so-work-age",dateTime:e,title:fc(e),children:t})}function p8({workspace:e,items:t}){return(0,R.jsx)("ul",{className:"so-work-list",children:t.map(a=>(0,R.jsxs)("li",{"data-workspace-task":a.id,"data-work-status":a.state,children:[(0,R.jsxs)("div",{className:"so-work-row",children:[(0,R.jsxs)("a",{className:"so-work-link",href:a.resultHref??a.href,"aria-current":e.focus?.id===a.id?"page":void 0,children:[(0,R.jsxs)("div",{className:"so-work-heading",children:[(0,R.jsx)("span",{className:"so-work-title",children:a.title}),(0,R.jsx)(dl,{label:a.label,tone:a.tone,className:"so-work-badge"}),(0,R.jsx)(bK,{at:a.updatedAt})]}),a.activity!==void 0&&(0,R.jsx)(dc,{activity:a.activity,className:"so-work-activity text-[12px]"})]}),a.detail&&(0,R.jsx)("details",{className:"so-work-reason",children:(0,R.jsxs)("summary",{title:a.detail,children:[(0,R.jsx)("span",{children:a.detail}),(0,R.jsx)("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,R.jsx)("path",{d:"m4 6 4 4 4-4"})})]})},a.detail),a.lead&&!a.detail?.includes(a.lead)&&(0,R.jsx)("span",{className:"so-work-project","data-crew-lead":!0,children:a.lead}),a.project&&(0,R.jsx)("span",{className:"so-work-project",children:e.projects.find(n=>n.path===a.project)?.name??a.project.split(/[\\/]/).filter(Boolean).pop()})]}),a.action&&a.action.href!==(a.resultHref??a.href)&&(0,R.jsx)("a",{className:"so-work-action",href:a.action.href,children:a.action.label})]},a.id))})}function wK({workspace:e,home:t}){let[a,n]=(0,Ie.useState)("home"),o=(0,Ie.useId)();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("div",{className:"so-work-tabs",children:(0,R.jsxs)("div",{role:"tablist","aria-label":"Work",className:"so-ask-tabs",children:[(0,R.jsx)("button",{type:"button",role:"tab",id:`${o}-home`,"aria-controls":`${o}-home-panel`,"aria-selected":a==="home",onClick:()=>n("home"),children:"Home"}),(0,R.jsx)("button",{type:"button",role:"tab",id:`${o}-crew`,"aria-controls":`${o}-crew-panel`,"aria-selected":a==="crew",onClick:()=>n("crew"),children:"Crew"})]})}),(0,R.jsx)("div",{role:"tabpanel",id:`${o}-home-panel`,"aria-labelledby":`${o}-home`,className:"so-work-home","data-view":"home",hidden:a!=="home",children:(0,R.jsx)(d8,{home:t,compact:!0})}),(0,R.jsx)("div",{role:"tabpanel",id:`${o}-crew-panel`,"aria-labelledby":`${o}-crew`,hidden:a!=="crew",children:(0,R.jsx)(b2,{workspace:e})})]})}function b2({workspace:e}){let t=o=>o.tone==="done"||o.state==="cancelled",a=e.crew.filter(o=>!t(o)),n=e.crew.filter(t);return(0,R.jsxs)("section",{className:"so-crew","aria-labelledby":"crew-title","data-workspace-crew":!0,children:[(0,R.jsxs)("div",{className:"so-section-heading",children:[(0,R.jsx)("h2",{id:"crew-title",children:"Crew"}),(0,R.jsx)("a",{href:"/work",children:"All tasks"})]}),e.crew.length===0?(0,R.jsxs)("div",{className:"so-crew-empty",children:[(0,R.jsx)("p",{children:"No tasks yet."}),(0,R.jsx)("p",{children:"Work you start with the lead appears here."})]}):(0,R.jsxs)(R.Fragment,{children:[a.length>0?(0,R.jsx)(p8,{workspace:e,items:a}):(0,R.jsx)("p",{className:"so-crew-quiet",children:"Nothing is running or waiting on you."}),n.length>0&&(0,R.jsx)(eo,{summary:`Finished (${n.length}${e.crewTruncated?"+":""})`,className:"so-crew-finished",children:(0,R.jsx)(p8,{workspace:e,items:n.slice(0,8)})})]}),e.crewTruncated&&(0,R.jsx)("a",{className:"so-all-work",href:"/work",children:"View more tasks"})]})}function w8({workspace:e}){let t=(0,Ie.useId)(),a=e.projects.find(n=>new URL(e.path,window.location.origin).searchParams.get("project")===n.path||new URL(e.path,window.location.origin).searchParams.get("repo")===n.path||e.crew.find(o=>o.id===e.focus?.id)?.project===n.path);return(0,R.jsxs)("div",{className:"so-navigation-content",children:[(0,R.jsxs)("a",{href:"/chat",className:"so-wordmark",children:[(0,R.jsxs)("span",{className:"so-brand-mark","aria-hidden":"true",children:[(0,R.jsx)("i",{}),(0,R.jsx)("i",{}),(0,R.jsx)("i",{})]}),"Toolroll"]}),(0,R.jsxs)("a",{href:"/tasks/new",className:"so-new-task",children:[(0,R.jsx)(Ja,{name:"plus"}),"New task"]}),e.projects.length>0&&(0,R.jsxs)("div",{className:"so-project-switch",children:[(0,R.jsx)(_i,{htmlFor:t,children:"Project"}),(0,R.jsxs)("select",{id:t,value:a?.href??"/work",onChange:n=>{window.location.assign(n.target.value)},children:[(0,R.jsx)("option",{value:"/work",children:"All projects"}),e.projects.map(n=>(0,R.jsx)("option",{value:n.href,children:n.name},n.path))]})]}),(0,R.jsx)("nav",{"aria-label":"Workspace",className:"so-primary-navigation",children:e.navigation.filter(n=>n.href!=="/menu").map(n=>{let o=n.label.toLowerCase();return(0,R.jsxs)("a",{href:n.href,"aria-current":n.active?"page":void 0,children:[(0,R.jsx)(Ja,{name:["chat","tasks","flows","projects","knowledge","settings"].includes(o)?o:"tools"}),(0,R.jsx)("span",{children:n.label}),n.count!==void 0&&n.count>0&&(0,R.jsx)("span",{className:"so-nav-count","aria-label":n.countLabel??`${n.count} ${n.count===1?"needs":"need"} you`,title:n.countLabel,children:n.count})]},n.href)})}),a&&(0,R.jsxs)("div",{className:"so-project-links",children:[(0,R.jsx)("a",{className:"so-project-knowledge",href:`/chat?project=${encodeURIComponent(a.path)}`,children:"Project chat"}),(0,R.jsx)("a",{className:"so-project-knowledge",href:a.knowledgeHref,children:"Project knowledge"})]}),(e.chats?.length??0)>0&&(0,R.jsxs)("nav",{"aria-label":"Recent chats",className:"so-recent-chats",children:[(0,R.jsx)("p",{className:"so-recent-chats-label",children:"Recent chats"}),e.chats.map(n=>(0,R.jsxs)("a",{href:n.href,"aria-current":n.active?"page":void 0,title:n.title,children:[(0,R.jsx)("span",{className:"so-recent-chat-kind","aria-hidden":"true",children:n.kind==="task"?"Task":"Project"}),(0,R.jsx)("span",{className:"so-recent-chat-title",children:n.title})]},n.href))]}),(0,R.jsxs)("div",{className:"so-navigation-bottom",children:[(0,R.jsxs)("a",{href:"/menu","aria-current":e.navigation.find(n=>n.href==="/menu")?.active?"page":void 0,children:[(0,R.jsx)(Ja,{name:"tools"}),"Workspace tools"]}),(0,R.jsxs)("div",{className:"so-account",children:[(0,R.jsx)("span",{title:e.user,children:e.user}),(0,R.jsx)($e,{action:"/logout",children:(0,R.jsx)(_e,{variant:"ghost",size:"sm",type:"submit",children:"Sign out"})})]})]})]})}function SK(e,t=""){let a=[...e.navigation.map(o=>({label:o.label,detail:"Page",href:o.href})),...e.projects.map(o=>({label:o.name,detail:"Project",href:o.href})),...e.crew.map(o=>({label:o.title,detail:o.label,href:o.resultHref??o.href}))],n=new Set;return a.filter(o=>{let r=`${o.label}
|
|
68
|
+
`)[0]}`]})]},u.zone)})})]}),(0,p.jsxs)("section",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Zones"}),(0,p.jsxs)("table",{className:"w-full text-left text-[12px]",children:[(0,p.jsx)("thead",{className:"text-muted-foreground",children:(0,p.jsxs)("tr",{children:[(0,p.jsx)("th",{className:"py-1 font-medium",children:"Zone"}),(0,p.jsx)("th",{className:"font-medium",children:"In"}),(0,p.jsx)("th",{className:"font-medium",children:"On"}),(0,p.jsx)("th",{className:"font-medium",children:"Failed"}),(0,p.jsx)("th",{className:"font-medium",children:"Back"}),(0,p.jsx)("th",{className:"font-medium",children:"Typical stay"})]})}),(0,p.jsx)("tbody",{children:o.zones.map(u=>(0,p.jsxs)("tr",{className:"border-t",children:[(0,p.jsxs)("td",{className:"py-1.5 pr-2 font-medium",children:[u.title,u.here>0?(0,p.jsxs)("span",{className:"text-muted-foreground",children:[" · ",u.here," here"]}):null]}),(0,p.jsx)("td",{children:u.entered}),(0,p.jsx)("td",{children:u.movedOn}),(0,p.jsx)("td",{className:u.failed>0?"font-semibold text-destructive":"",children:u.failed}),(0,p.jsx)("td",{className:u.sentBack>0?"font-semibold text-foreground":"",children:u.sentBack}),(0,p.jsx)("td",{children:cK(u.typicalMinutes)})]},u.zone))})]})]}),o.scripts.length>0&&(0,p.jsxs)("section",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Scripts"}),(0,p.jsx)("ul",{className:"flex flex-col gap-1 text-[12.5px]",children:o.scripts.map(u=>(0,p.jsxs)("li",{children:[(0,p.jsx)("span",{className:"font-mono font-semibold",children:u.script}),": ",u.passed," of ",u.runs," passed",u.typicalSeconds===null?"":`, usually ${u.typicalSeconds<90?`${u.typicalSeconds} s`:`${Math.round(u.typicalSeconds/60)} min`}`]},u.script))})]}),o.sorts.length>0&&(0,p.jsxs)("section",{className:"flex flex-col gap-2","data-insights-sorts":!0,children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Sorting"}),o.sorts.map(u=>(0,p.jsxs)("div",{className:"rounded-lg border p-2.5 text-[12.5px]","data-insights-sort":u.zone,children:[(0,p.jsxs)("p",{children:[(0,p.jsx)("span",{className:"font-semibold",children:u.title}),": ",u.sorted," sorted · ",u.alone," on its own · ",u.notSure," for a person",u.corrected>0&&(0,p.jsxs)(p.Fragment,{children:[" · ",(0,p.jsxs)("span",{className:"font-semibold text-attention",children:[u.corrected," moved elsewhere by people"]})]})]}),u.bands.some(d=>d.of>0)&&(0,p.jsxs)("p",{className:"mt-1 text-muted-foreground",children:["Right when ",u.bands.filter(d=>d.of>0).map(d=>`${d.from}–${d.to}% sure: ${d.right} of ${d.of}`).join(" · ")]}),u.suggestion!==null&&(0,p.jsx)("p",{className:"mt-1",children:u.suggestion}),u.costUsd>0&&(0,p.jsxs)("p",{className:"mt-1 text-muted-foreground",children:["Cost: ",u.costUsd<.01?"under 1¢":`$${u.costUsd.toFixed(2)}`]})]},u.zone))]}),(o.recurring??[]).length>0&&(0,p.jsxs)("section",{className:"flex flex-col gap-1.5","data-insights-recurring":!0,children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"What keeps coming back"}),(0,p.jsx)("ul",{className:"flex flex-col gap-1 text-[12.5px]",children:o.recurring.map(u=>(0,p.jsxs)("li",{className:"flex items-baseline gap-2",children:[(0,p.jsx)("span",{className:"min-w-0 flex-1 truncate",children:u.card===null?u.title:(0,p.jsx)("a",{className:"underline-offset-2 hover:underline",href:`${e.flow.href}?card=${u.card}`,children:u.title})}),(0,p.jsxs)("span",{className:te("shrink-0 tabular-nums",u.days>1?"font-semibold text-foreground":"text-muted-foreground"),children:[u.days," day",u.days===1?"":"s"]})]},u.problem))})]}),(0,p.jsxs)("section",{className:"flex flex-col gap-1.5",children:[(0,p.jsx)("h3",{className:"text-[13px] font-semibold",children:"Recent runs"}),o.runs.length===0?(0,p.jsx)("p",{className:"text-[12.5px] text-muted-foreground",children:"No scripts, sorts or updates have run in this period."}):(0,p.jsx)("ul",{className:"flex flex-col gap-1.5",children:o.runs.map(u=>{let d=`${u.card}:${u.entry}`;return(0,p.jsxs)("li",{className:"rounded-md border px-2.5 py-2 text-[12.5px]","data-run":d,children:[(0,p.jsxs)("button",{type:"button",className:"flex w-full items-start gap-2 text-left",onClick:()=>{f(u.card,u.entry)},"aria-expanded":l?.key===d,children:[(0,p.jsx)("span",{className:te("mt-1 size-2 shrink-0 rounded-full",u.state==="passed"?"bg-success":u.state==="failed"?"bg-destructive":"bg-info"),"aria-hidden":"true"}),(0,p.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,p.jsx)("span",{className:"font-medium",children:u.script??u.zoneTitle})," · ",u.cardTitle,(0,p.jsxs)("span",{className:"block text-[12px] text-muted-foreground",children:[u.kind==="sort"&&u.state==="passed"&&u.result!==null?u.result.split(". ")[0].replace(/\.$/,""):u.state==="passed"?"Passed":u.state==="failed"?"Failed":u.state==="waiting"?"Trying again":"Running",u.durationMs===null?"":u.kind==="sort"?` · ${u.durationMs<1e3?`${u.durationMs} ms`:`${(u.durationMs/1e3).toFixed(1)} s`}`:` in ${Math.max(1,Math.round(u.durationMs/1e3))} s`," · ",p2(u.at)]})]})]}),l?.key===d&&(0,p.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto whitespace-pre-wrap rounded-md bg-muted p-2 font-mono text-[11.5px]","data-run-log":!0,children:l.text})]},d)})})]})]})]})}function fK({view:e,csrf:t}){let[a,n]=(0,me.useState)(e),[o,r]=(0,me.useState)(!1),[s,i]=(0,me.useState)(null),[l,c]=(0,me.useState)(e.selectedCard!==null?{card:e.selectedCard}:e.startTrigger!==null&&e.triggers.some(B=>B.id===e.startTrigger&&B.button!==null)?{press:e.startTrigger}:null),[f,u]=(0,me.useState)(!1),[d,m]=(0,me.useState)(!1),[g,b]=(0,me.useState)(()=>{try{return window.localStorage.getItem("so-flows-mine")==="1"}catch{return!1}});(0,me.useEffect)(()=>{try{window.localStorage.setItem("so-flows-mine",g?"1":"0")}catch{}},[g]);let v=Mp(),x=s?.stages??a.stages,y=s?.start??a.start,h=s!==null&&JSON.stringify({name:s.name,start:s.start,stages:s.stages,owner:s.owner})!==JSON.stringify({name:a.flow.name,start:a.start,stages:a.stages,owner:a.flow.owner}),w=(0,me.useCallback)(B=>{(B.ok?xn.success:xn.error)(B.said),B.view!==void 0&&n(B.view)},[]),S=j_(a,n,{card:l!==null&&"card"in l?l.card:null,editing:o}),C=(0,me.useMemo)(()=>{let B={};for(let G of S)if(!G.editing)for(let oe of G.cards)(B[oe]??=[]).push(G.name);return B},[S]),I=(0,me.useCallback)(async(B,G)=>{let oe=a.cards.find(Y=>Y.id===B);oe===void 0||oe.stage===G||w(await ca(`${a.flow.href}/cards/${B}/move`,{stage:G},t))},[a,t,w]),L=(0,me.useMemo)(()=>x.map(B=>({id:B.id,type:"zone",position:{x:B.zone.x,y:B.zone.y},width:B.zone.w,height:B.zone.h,style:{width:B.zone.w,height:B.zone.h},draggable:o,selectable:o,data:{stage:B,kindLabel:a.kinds.find(G=>G.kind===B.kind)?.label??B.kind,owner:s?.owner??a.flow.owner,subagent:B.subagent===void 0?null:a.subagents?.find(G=>G.handle===B.subagent)?.name??B.subagent,cards:a.cards.filter(G=>G.stage===B.id&&G.state==="active"&&(!g||G.mine)),hidden:g?a.cards.filter(G=>G.stage===B.id&&G.state==="active"&&!G.mine).length:0,lookers:C,editing:o,canMove:a.canEdit,start:B.id===y,selectedCard:l!==null&&"card"in l?l.card:null,onCard:G=>{m(!1),c({card:G})},onDrop:(G,oe)=>{I(G,oe)},onResize:(G,oe)=>i(Y=>Y===null?Y:{...Y,stages:Y.stages.map(Le=>Le.id===G?{...Le,zone:{...Le.zone,x:Math.round(oe.x),y:Math.round(oe.y),w:Math.round(oe.width),h:Math.round(oe.height)}}:Le)})}})),[x,a,o,l,y,I,g,C]),T=(0,me.useMemo)(()=>a.triggers.filter(B=>B.state!=="removed"),[a.triggers]),A=(0,me.useMemo)(()=>{let B=new Map;for(let G of T){let oe=x.some(Y=>Y.id===G.zoneId)?G.zoneId:y;B.set(oe,[...B.get(oe)??[],G])}return[...B].flatMap(([G,oe])=>{let Y=x.find(ze=>ze.id===G);if(Y===void 0)return[];let Le=Y_+oe.length*X_;return[{id:`trigger-${G}`,type:"trigger",position:{x:Y.zone.x-272,y:Y.zone.y+Math.max(0,(Y.zone.h-Le)/2)},width:236,height:Le,style:{width:236,height:Le},draggable:!1,selectable:!1,data:{triggers:oe,onOpen:ze=>c({triggers:ze}),onPress:ze=>c({press:ze})}}]})},[T,x,y]),D=T.map(B=>`${B.id}:${B.zoneId}`).join(","),H=(0,me.useRef)(D);(0,me.useEffect)(()=>{if(H.current===D)return;H.current=D;let B=requestAnimationFrame(()=>{v.fitView({padding:.12,minZoom:.55,maxZoom:1,duration:250})});return()=>cancelAnimationFrame(B)},[D,v]);let V=(0,me.useMemo)(()=>[...L,...A],[L,A]),[N,P]=(0,me.useState)(V);(0,me.useEffect)(()=>{P(B=>V.map(G=>{let oe=B.find(Y=>Y.id===G.id);return oe===void 0?G:{...oe,...G,...oe.measured===void 0?{}:{measured:oe.measured},selected:o&&oe.selected===!0}}))},[V,o]);let E=(0,me.useMemo)(()=>{let B=Y=>({x:Y.zone.x+Y.zone.w/2,y:Y.zone.y+Y.zone.h/2}),G=(Y,Le,ze)=>{let bt=B(Y),st=B(Le),Gt=st.x-bt.x,Ge=st.y-bt.y,at=Math.abs(Gt)>=Math.abs(Ge);if(ze){let Ba=Le.zone.x>=Y.zone.x+Y.zone.w||Y.zone.x>=Le.zone.x+Le.zone.w,Tt=Le.zone.y>=Y.zone.y+Y.zone.h||Y.zone.y>=Le.zone.y+Le.zone.h;return Ba&&Tt?Gt>=0?{source:"s-Right",target:"t-Left"}:{source:"s-Left",target:"t-Right"}:at?{source:"s-Bottom",target:"t-Bottom"}:{source:"s-Left",target:"t-Left"}}return at?Gt>=0?{source:"s-Right",target:"t-Left"}:{source:"s-Left",target:"t-Right"}:Ge>=0?{source:"s-Bottom",target:"t-Top"}:{source:"s-Top",target:"t-Bottom"}},oe=A.map(Y=>({id:`${Y.id}->zone`,source:Y.id,sourceHandle:"out",target:Y.id.slice(8),targetHandle:"t-Left",type:"smoothstep",animated:Y.data.triggers.some(Le=>Le.state==="active"),deletable:!1,markerEnd:{type:so.ArrowClosed},style:{strokeWidth:1.5}}));return PY([...oe,...x.flatMap(Y=>{let Le=Y.next===null?void 0:x.find(Ge=>Ge.id===Y.next),ze=Y.onFail===null?void 0:x.find(Ge=>Ge.id===Y.onFail),bt=Y.limit?.to==null?void 0:x.find(Ge=>Ge.id===Y.limit.to),st=Y.kind==="sort"&&Y.sort!==null?Y.sort.answers:Y.kind==="check"||Y.kind==="subagent"?Y.routes??[]:Y.kind==="choose"?(Y.options??[]).filter(Ge=>Ge.to!=="end").map(Ge=>({answer:Ge.label,to:Ge.to})):[],Gt=st.length>0?[...new Set(st.map(Ge=>Ge.to))].flatMap(Ge=>{let at=x.find(Tt=>Tt.id===Ge);if(at===void 0)return[];let Ba=at.zone.x>Y.zone.x+Y.zone.w?{source:"s-Right",target:"t-Left"}:G(Y,at,!1);return[{id:`${Y.id}->answer-${Ge}`,source:Y.id,target:Ge,sourceHandle:Ba.source,targetHandle:Ba.target,type:"smoothstep",label:st.filter(Tt=>Tt.to===Ge).map(Tt=>Tt.answer).join(", "),labelStyle:{fontSize:11,fontWeight:600,fill:"var(--color-foreground)"},labelBgStyle:{fill:"var(--color-card)"},markerEnd:{type:so.ArrowClosed},style:{strokeWidth:2},deletable:!1}]}):[];return[...Gt,...Le===void 0?[]:[{id:`${Y.id}->next`,source:Y.id,target:Le.id,sourceHandle:G(Y,Le,!1).source,targetHandle:G(Y,Le,!1).target,type:"smoothstep",markerEnd:{type:so.ArrowClosed},style:{strokeWidth:2},deletable:o,...Y.kind==="wait"&&Y.wait?.for==="reply"?{label:"replied",labelStyle:{fontSize:11,fontWeight:600,fill:"var(--color-foreground)"},labelBgStyle:{fill:"var(--color-card)"}}:{}}],...ze===void 0||!o&&Gt.some(Ge=>Ge.target===ze.id)?[]:[{id:`${Y.id}->fail`,source:Y.id,target:ze.id,sourceHandle:G(Y,ze,!0).source,targetHandle:G(Y,ze,!0).target,type:"smoothstep",pathOptions:{offset:28,borderRadius:10},label:Y.kind==="approval"?"sent back":Y.kind==="sort"?"not sure":Y.kind==="wait"?"no reply":Y.kind==="choose"?"reply":"fails",labelStyle:{fontSize:11,fill:(Y.kind==="wait","var(--color-muted-foreground)")},labelBgStyle:{fill:"var(--color-card)"},markerEnd:{type:so.ArrowClosed,color:(Y.kind==="wait","var(--color-muted-foreground)")},style:{strokeWidth:1.5,strokeDasharray:"6 4",stroke:(Y.kind==="wait","var(--color-muted-foreground)")},deletable:o}],...bt===void 0||Y.limit===void 0?[]:[{id:`${Y.id}->limit`,source:Y.id,target:bt.id,sourceHandle:G(Y,bt,!0).source,targetHandle:G(Y,bt,!0).target,type:"smoothstep",pathOptions:{offset:36,borderRadius:10},label:`after ${FY(Y.limit.minutes)}`,labelStyle:{fontSize:11,fill:"var(--color-muted-foreground)"},labelBgStyle:{fill:"var(--color-card)"},markerEnd:{type:so.ArrowClosed,color:"var(--color-muted-foreground)"},style:{strokeWidth:1.5,strokeDasharray:"2 4",stroke:"var(--color-muted-foreground)"},deletable:o}]]})],x)},[x,o,A,y]),_=(B,G)=>i(oe=>oe===null?oe:{...oe,stages:oe.stages.map(Y=>Y.id===B?{...Y,...G}:Y)}),z=B=>{if(P(G=>u2(B,G)),!!o)for(let G of B)G.type==="select"&&G.selected&&!G.id.startsWith("trigger-")&&c({zone:G.id})},q=(B,G)=>{!o||G.type!=="zone"||i(oe=>oe===null?oe:{...oe,stages:oe.stages.map(Y=>Y.id===G.id?{...Y,zone:{...Y.zone,x:Math.round(G.position.x),y:Math.round(G.position.y)}}:Y)})},O=B=>{if(!o||B.source===B.target)return;let G=x.find(oe=>oe.id===B.source);if(G?.kind==="sort"&&G.sort!==null&&B.sourceHandle!=="fail"){let oe=x.find(Y=>Y.id===B.target);oe!==void 0&&G.sort.answers.length<12&&_(G.id,{sort:{...G.sort,answers:[...G.sort.answers,{answer:oe.title.slice(0,40),means:oe.title,to:oe.id}]}}),c({zone:G.id});return}if(G?.kind==="choose"&&B.sourceHandle!=="fail"){let oe=x.find(Y=>Y.id===B.target);oe!==void 0&&(G.options??[]).length<4&&_(G.id,{options:[...G.options??[],{label:oe.title.slice(0,40),to:oe.id}]}),c({zone:G.id});return}_(B.source,B.sourceHandle==="fail"?{onFail:B.target}:{next:B.target})},W=()=>{i({name:a.flow.name,start:a.start,stages:a.stages,owner:a.flow.owner}),r(!0),c(null)},ee=()=>{i(null),r(!1),c(null)},de=async()=>{if(s===null)return;u(!0);let B=await ca(`${a.flow.href}/save`,{name:s.name,owner:s.owner,revision:String(a.flow.revision),definition:JSON.stringify({version:1,start:s.start,stages:s.stages})},t);u(!1),w(B),B.ok&&(i(null),r(!1),c(null))},ne=()=>{if(s===null)return;let B=new Set(s.stages.map(Y=>Y.id)),G=v.screenToFlowPosition({x:window.innerWidth/2,y:window.innerHeight/2}),oe={id:zY("New zone",B),title:"New zone",kind:"inbox",zone:{x:Math.round(G.x-140),y:Math.round(G.y-120),w:280,h:300,color:"slate"},instructions:null,planning:null,approver:null,message:null,close:null,script:null,sort:null,next:null,onFail:null};i({...s,stages:[...s.stages,oe]}),c({zone:oe.id})},re=l!==null&&"card"in l?a.cards.find(B=>B.id===l.card)??null:null,ue=l!==null&&"press"in l?a.triggers.find(B=>B.id===l.press&&B.button!==null)??null:null,ce=l!==null&&"triggers"in l&&!o,U=l!==null&&"scripts"in l,M=l!==null&&"insights"in l&&!o,se=l!==null&&"zone"in l?x.find(B=>B.id===l.zone)??null:null,le=a.cards.filter(B=>B.canDecide).length;return(0,p.jsxs)("div",{className:"flex h-[calc(100dvh-7.5rem)] min-h-[560px] flex-col overflow-hidden rounded-xl border bg-card","data-flow":a.flow.id,children:[(0,p.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-2.5",children:[o&&s!==null?(0,p.jsx)(ve,{value:s.name,onChange:B=>i({...s,name:B.target.value}),maxLength:80,className:"h-8 max-w-64 font-semibold","aria-label":"Flow name"}):(0,p.jsx)("h1",{className:"text-[15px] font-semibold",children:a.flow.name}),(0,p.jsx)("span",{className:"text-[12px] text-muted-foreground",children:a.flow.project}),(0,p.jsx)(W_,{others:S,cards:a.cards}),o&&s!==null&&(0,p.jsxs)("label",{className:"inline-flex items-center gap-1.5 text-[12px] text-muted-foreground",children:["Owner",(0,p.jsx)("select",{className:"h-8 rounded-md border bg-transparent px-2 text-[12px] text-foreground",value:s.owner,onChange:B=>i({...s,owner:B.target.value}),"aria-label":"Flow owner",children:[...new Set([s.owner,...a.approvers])].map(B=>(0,p.jsx)("option",{value:B,children:B===a.me?`${B} (you)`:B},B))})]}),le>0&&!o&&(0,p.jsxs)(wa,{tone:"attention",children:[le," waiting for you"]}),!o&&(0,p.jsx)("div",{className:"ml-1 inline-flex rounded-md border p-0.5",role:"group","aria-label":"Which cards",children:[["All cards",!1],["Mine",!0]].map(([B,G])=>(0,p.jsx)("button",{type:"button","aria-pressed":g===G,onClick:()=>b(G),className:te("rounded px-2 py-1 text-[12px] font-medium",g===G?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:B},B))}),(0,p.jsx)("span",{className:"flex-1"}),o?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>c({scripts:!0}),children:[(0,p.jsx)(to,{className:"size-4"}),"Scripts"]}),(0,p.jsxs)(Z,{size:"sm",variant:"outline",onClick:ne,children:[(0,p.jsx)(Yt,{className:"size-4"}),"Add zone"]}),(0,p.jsx)(Z,{size:"sm",variant:"ghost",onClick:ee,children:"Discard"}),(0,p.jsx)(Z,{size:"sm",onClick:()=>{de()},disabled:!h||f,children:f?"Saving…":"Save flow"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>{m(!1),c({insights:!0})},"data-open-insights":!0,children:[(0,p.jsx)(Wo,{className:"size-4"}),"Insights"]}),(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>{m(!1),c({scripts:!0})},"data-open-scripts":!0,children:[(0,p.jsx)(to,{className:"size-4"}),"Scripts"]}),a.canEdit&&(0,p.jsxs)(Z,{size:"sm",variant:"ghost",onClick:()=>{m(!1),c({triggers:null})},"data-open-triggers":!0,children:[(0,p.jsx)(As,{className:"size-4"}),"Triggers",T.length>0?` · ${T.length}`:""]}),a.canEdit&&(0,p.jsx)(Z,{size:"sm",variant:"ghost",asChild:!0,children:(0,p.jsxs)("a",{href:a.chatHref,children:[(0,p.jsx)(Ts,{className:"size-4"}),"Change in chat"]})}),a.canEdit&&(0,p.jsxs)(Z,{size:"sm",variant:"outline",onClick:W,children:[(0,p.jsx)(Sf,{className:"size-4"}),"Edit flow"]}),a.canEdit&&(0,p.jsxs)(Z,{size:"sm",onClick:()=>{c(null),m(!0)},children:[(0,p.jsx)(Yt,{className:"size-4"}),"New card"]}),(0,p.jsxs)(ic,{children:[(0,p.jsx)(lc,{asChild:!0,children:(0,p.jsx)(Z,{size:"sm",variant:"ghost","aria-label":"More","data-flow-menu":!0,children:(0,p.jsx)(Yo,{className:"size-4"})})}),(0,p.jsx)(uc,{align:"end",children:(0,p.jsx)(cc,{asChild:!0,children:(0,p.jsxs)("a",{href:`${a.flow.href}/export`,download:!0,"data-export-flow":!0,children:[(0,p.jsx)(Hi,{className:"size-4"}),"Export as a file"]})})})]})]})]}),(0,p.jsxs)("div",{className:"relative flex min-h-0 flex-1",children:[(0,p.jsxs)("div",{className:"relative min-w-0 flex-1","data-flow-canvas":!0,children:[(0,p.jsxs)(__,{nodes:N,edges:E,nodeTypes:AY,edgeTypes:_Y,onNodesChange:z,onNodeDragStop:q,onConnect:O,onEdgesDelete:B=>{for(let G of B)_(G.source,G.id.endsWith("->fail")?{onFail:null}:G.id.endsWith("->limit")?{limit:{...s?.stages.find(oe=>oe.id===G.source)?.limit??{minutes:1440},to:null}}:{next:null})},onPaneClick:()=>{o&&c(null)},onNodeClick:()=>{},nodesDraggable:o,nodesConnectable:o,elementsSelectable:o,fitView:!0,fitViewOptions:{padding:.12,minZoom:.55,maxZoom:1},minZoom:.3,maxZoom:1.5,proOptions:{hideAttribution:!0},deleteKeyCode:o?["Backspace","Delete"]:null,children:[(0,p.jsx)(z_,{variant:sr.Dots,gap:20,size:1}),(0,p.jsx)(F_,{showInteractive:!1})]}),o&&(0,p.jsx)("p",{className:"pointer-events-none absolute bottom-3 left-14 max-w-md rounded-lg bg-foreground/85 px-3 py-1.5 text-[12px] text-background",children:"Drag zones to arrange them. Drag from a zone's right dot to say where work goes next, from its bottom dot for where it goes if sent back."})]}),se!==null&&o||re!==null||d&&!o||ce||ue!==null||U||M?(0,p.jsx)("aside",{className:"absolute inset-y-0 right-0 z-10 w-[360px] max-w-full overflow-y-auto border-l bg-card p-4 shadow-xl","data-flow-drawer":!0,children:se!==null&&o?(0,p.jsx)(eK,{stage:se,stages:x,view:a,csrf:t,apply:w,update:B=>_(se.id,B),remove:()=>{i(B=>B===null?B:{...B,start:B.start===se.id?B.stages.find(G=>G.id!==se.id).id:B.start,stages:B.stages.filter(G=>G.id!==se.id).map(G=>({...G,next:G.next===se.id?null:G.next,onFail:G.onFail===se.id?null:G.onFail}))}),c(null)},makeStart:()=>i(B=>B===null?B:{...B,start:se.id}),onClose:()=>c(null)}):U?(0,p.jsx)(uK,{view:a,csrf:t,apply:w,onClose:()=>c(null)}):M?(0,p.jsx)(dK,{view:a,onClose:()=>c(null)}):ue!==null?(0,p.jsx)(l8,{trigger:ue,view:a,csrf:t,apply:w,onClose:()=>c(null)},ue.id):ce?(0,p.jsx)(lK,{view:a,csrf:t,apply:w,focus:l!==null&&"triggers"in l?l.triggers:null,onPress:B=>c({press:B}),onClose:()=>c(null)}):re!==null?(0,p.jsx)(J_,{card:re,view:a,csrf:t,apply:w,onClose:()=>c(null)}):(0,p.jsx)(o8,{view:a,csrf:t,apply:B=>{w(B),B.ok&&m(!1)},onClose:()=>m(!1)})}):null]})]})}function pK({view:e,csrf:t}){let[a,n]=(0,me.useState)(e),[o,r]=(0,me.useState)(e.selectedCard),[s,i]=(0,me.useState)(e.startTrigger),l=v=>{(v.ok?xn.success:xn.error)(v.said),v.view!==void 0&&n(v.view)},c=j_(a,n,{card:o,editing:!1}),f=o===null?null:a.cards.find(v=>v.id===o)??null,u=s===null?null:a.triggers.find(v=>v.id===s&&v.button!==null&&v.state==="active")??null,d=a.triggers.filter(v=>v.state!=="removed"),[m,g]=(0,me.useState)(!1),b=async v=>{g(!0),l(await ca(`${a.flow.href}/triggers/${v.id}/${v.state==="paused"?"resume":"pause"}`,{},t)),g(!1)};return u!==null?(0,p.jsx)("div",{className:"p-4",children:(0,p.jsx)(l8,{trigger:u,view:a,csrf:t,apply:l,onClose:()=>i(null)})}):f!==null?(0,p.jsx)("div",{className:"p-4",children:(0,p.jsx)(J_,{card:f,view:a,csrf:t,apply:l,onClose:()=>r(null)})}):(0,p.jsxs)("div",{className:"flex flex-col gap-3 p-4","data-flow":a.flow.id,children:[(0,p.jsxs)("div",{children:[(0,p.jsx)("h1",{className:"text-[17px] font-semibold",children:a.flow.name}),(0,p.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:[a.flow.project,a.canEdit?(0,p.jsxs)(p.Fragment,{children:[" · ",(0,p.jsx)("a",{className:"underline",href:a.chatHref,children:"change it in chat"}),", or edit it on a larger screen"]}):null," · ",(0,p.jsx)("a",{className:"underline",href:`${a.flow.href}/export`,download:!0,"data-export-flow":!0,children:"Export"})]}),c.length>0&&(0,p.jsx)("div",{className:"mt-1.5",children:(0,p.jsx)(W_,{others:c,cards:a.cards})})]}),a.canEdit&&d.some(v=>v.button!==null&&v.state==="active")&&(0,p.jsx)("div",{className:"flex flex-wrap gap-2",children:d.filter(v=>v.button!==null&&v.state==="active").map(v=>(0,p.jsxs)(Z,{size:"sm",onClick:()=>i(v.id),children:[(0,p.jsx)($u,{className:"size-4"}),v.button.label]},v.id))}),a.canEdit&&(0,p.jsxs)("details",{className:"rounded-lg border p-3",children:[(0,p.jsx)("summary",{className:"cursor-pointer text-[14px] font-semibold",children:"New card"}),(0,p.jsx)("div",{className:"pt-3",children:(0,p.jsx)(o8,{view:a,csrf:t,apply:l})})]}),OY(a.stages,a.start).map(v=>{let x=a.cards.filter(y=>y.stage===v.id&&y.state==="active");return(0,p.jsxs)("section",{className:"rounded-lg border bg-muted/40",children:[(0,p.jsxs)("header",{className:"flex items-center gap-2 px-3 py-2",children:[(0,p.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-md text-white",style:{background:Ep[v.zone.color]??"#64748b"},children:G_[v.kind]}),(0,p.jsx)("span",{className:"flex-1 text-[14px] font-semibold",children:v.title}),x.length>0&&(0,p.jsx)("span",{className:"text-[12px] text-muted-foreground",children:x.length})]}),x.length>0&&(0,p.jsx)("ul",{className:"flex flex-col gap-2 px-3 pb-3",children:x.map(y=>(0,p.jsx)("li",{children:(0,p.jsxs)("button",{type:"button",onClick:()=>r(y.id),className:te("min-h-11 w-full rounded-lg border bg-card px-3 py-2 text-left",y.canDecide&&"border-attention/60"),children:[(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsx)("div",{className:"min-w-0 flex-1 text-[14px] font-medium",children:y.title}),y.owner!==null&&(0,p.jsx)(ei,{name:y.owner})]}),y.sorted!==null&&(0,p.jsx)("div",{className:"mt-1 flex",children:(0,p.jsx)(f2,{sorted:y.sorted})}),y.waiting!==null&&(0,p.jsx)("div",{className:te("text-[12px]",y.task!==null&&(v.kind==="task"||v.kind==="report")&&"truncate",y.canDecide?"font-semibold text-attention":"text-muted-foreground"),children:y.canDecide?tp.card.sentence({}):y.waiting}),y.comments.length>0&&(0,p.jsxs)("div",{className:"mt-0.5 inline-flex items-center gap-1 text-[12px] text-muted-foreground",children:[(0,p.jsx)(Ts,{className:"size-3","aria-hidden":"true"}),y.comments.length]})]})},y.id))})]},v.id)}),d.length>0&&(0,p.jsxs)("section",{className:"rounded-lg border p-3","data-flow-triggers":!0,children:[(0,p.jsx)("h2",{className:"text-[14px] font-semibold",children:"Triggers"}),(0,p.jsx)("ul",{className:"mt-2 flex flex-col gap-2",children:d.map(v=>(0,p.jsxs)("li",{className:"text-[13px]","data-trigger-row":v.id,children:[(0,p.jsx)("span",{className:"font-medium",children:v.name})," · ",v.detail,(0,p.jsx)("div",{className:te("text-[12px]",v.failing?"text-warning":"text-muted-foreground"),children:v.state==="paused"?"Paused":v.status===null?`Starts in ${v.zone}`:(0,p.jsxs)(p.Fragment,{children:[r8(v.statusAt),": ",v.status,(0,p.jsx)(K_,{link:v.statusLink})]})}),v.order!==void 0&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"mt-1 text-[12px] break-words","data-trigger-approval":!0,children:v.order.at(-1)}),(0,p.jsxs)("details",{className:"mt-1.5 rounded-md border px-3 py-2","data-trigger-order":!0,children:[(0,p.jsx)("summary",{className:"flex min-h-11 cursor-pointer items-center text-[13px] font-medium",children:"What each run files"}),(0,p.jsx)("ul",{className:"flex flex-col gap-1 pb-1 text-[12px] text-muted-foreground",children:v.order.slice(0,-1).map((x,y)=>(0,p.jsx)("li",{className:"break-words",children:x},y))})]}),a.canEdit&&(0,p.jsx)(Z,{size:"sm",variant:"outline",className:"mt-1.5 min-h-11",disabled:m,onClick:()=>{b(v)},children:v.state==="paused"?"Turn on":"Pause"})]})]},v.id))})]})]})}function u8({view:e,csrf:t}){let a=(0,me.useRef)(typeof window<"u"&&window.matchMedia("(max-width: 767px)").matches),[n,o]=(0,me.useState)(a.current);return(0,me.useEffect)(()=>{let r=window.matchMedia("(max-width: 767px)"),s=()=>o(r.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),n?(0,p.jsx)(pK,{view:e,csrf:t}):(0,p.jsx)(d2,{children:(0,p.jsx)(fK,{view:e,csrf:t})})}var ti=j(fe(),1);function c8({view:e,csrf:t,taskChat:a=null,taskDetails:n=!0}){return(0,ti.jsx)("div",{"data-view":e.kind,className:"w-full",children:e.kind==="tasks"?(0,ti.jsx)(ME,{view:e}):e.kind==="settings"?(0,ti.jsx)(NE,{view:e,csrf:t}):e.kind==="task"?(0,ti.jsx)(iE,{view:e,chat:a,details:n,csrf:t}):e.kind==="projects"?(0,ti.jsx)(uE,{view:e,csrf:t}):e.kind==="result"?(0,ti.jsx)(mE,{view:e,csrf:t}):e.kind==="flow"?(0,ti.jsx)(u8,{view:e,csrf:t}):null})}var Nl=j(he(),1);var Ne=j(fe(),1),Wx=[{id:"needs-you",label:"Needs you",empty:"Nothing needs you right now."},{id:"ready",label:"Ready",empty:"No results are waiting for review."},{id:"running",label:"Running",empty:"Nothing is running."},{id:"all",label:"All",empty:"No tasks this week."}];function mK(e,t=Date.now()){let a=Math.max(0,Math.round((t-Date.parse(e))/6e4));return a<60?`${a} min`:`${Math.floor(a/60)} h${a%60===0?"":` ${a%60} min`}`}function hK(e,t=Date.now()){let a=Math.max(0,Math.floor((t-Date.parse(e))/6e4));if(!Number.isFinite(a)||a<1)return"just now";if(a<60)return`${a} min ago`;let n=Math.floor(a/60);return n<24?`${n} h ago`:Math.floor(n/24)===1?"yesterday":`${Math.floor(n/24)} days ago`}var h2="so-catch-up-seen",Yx=e=>`${e.id}@${e.at}`,gK=()=>{try{return window.localStorage.getItem(h2)!==null}catch{return!0}};function xK(e){try{let t=window.localStorage.getItem(h2);if(t===null)return new Set(e.map(Yx));let a=JSON.parse(t);return new Set(Array.isArray(a)?a.filter(n=>typeof n=="string"):[])}catch{return new Set(e.map(Yx))}}function Xx(e,t){return t==="all"||e.tab===t}function d8({home:e,compact:t=!1}){let a=(0,Nl.useMemo)(()=>Object.fromEntries(Wx.map(l=>[l.id,e.catchUp.filter(c=>Xx(c,l.id)).length])),[e.catchUp]),[n,o]=(0,Nl.useState)(()=>a["needs-you"]>0?"needs-you":a.ready>0?"ready":a.running>0?"running":"all"),[r,s]=(0,Nl.useState)(()=>xK(e.catchUp));(0,Nl.useEffect)(()=>{let l=e.catchUp.filter(f=>Xx(f,n)).map(Yx);if(l.every(f=>r.has(f))&&gK())return;let c=new Set([...r,...l]);s(c);try{window.localStorage.setItem(h2,JSON.stringify([...c].slice(-400)))}catch{}},[n,e.catchUp]);let i=e.catchUp.filter(l=>Xx(l,n));return(0,Ne.jsxs)("div",{className:"so-home flex flex-col gap-6 phone:gap-4","data-home":!0,children:[(0,Ne.jsxs)("section",{"aria-labelledby":"home-now","data-home-now":!0,children:[(0,Ne.jsx)("h2",{id:"home-now",className:"mb-2.5 text-[14px] font-semibold tracking-[-0.01em]",children:"Now"}),e.lead!=null&&(0,Ne.jsxs)("p",{"data-home-lead":!0,className:"mb-2.5 flex min-w-0 items-baseline gap-1.5 text-[13px] leading-snug",children:[(0,Ne.jsxs)("span",{className:"shrink-0 font-medium",children:[e.lead.name??"Lead",":"]}),e.lead.href===null?(0,Ne.jsx)("span",{className:"min-w-0 truncate",children:e.lead.doing}):(0,Ne.jsx)("a",{href:e.lead.href,className:"min-w-0 truncate hover:underline hover:underline-offset-4",children:e.lead.doing}),(0,Ne.jsxs)("span",{className:"shrink-0 text-muted-foreground",children:["· ",(0,Ne.jsx)("time",{dateTime:e.lead.at,className:"tabular-nums",children:hK(e.lead.at)})]})]}),e.agents.length===0?(0,Ne.jsx)("p",{className:"text-[13px] text-muted-foreground",children:"No agent is working right now."}):(0,Ne.jsx)("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-2 phone:-mx-4 phone:flex phone:snap-x phone:snap-mandatory phone:scroll-px-4 phone:overflow-x-auto phone:px-4 phone:pb-1 phone:[scrollbar-width:none]",children:e.agents.map(l=>(0,Ne.jsx)("li",{"data-home-agent":l.taskId,className:"min-w-0 phone:w-[236px] phone:shrink-0 phone:snap-start",children:(0,Ne.jsxs)("a",{href:l.href,className:"flex h-full min-w-0 flex-col gap-1.5 rounded-[10px] border border-border bg-card px-3.5 py-3 transition-colors hover:border-input hover:bg-[var(--so-raised)] phone:px-3 phone:py-2.5",children:[(0,Ne.jsxs)("span",{className:"flex items-center gap-1.5 text-[12px] font-medium text-info",children:[(0,Ne.jsx)("span",{"aria-hidden":"true",className:"so-home-live size-1.5 shrink-0 rounded-full bg-info"}),l.phase]}),(0,Ne.jsx)("span",{className:"line-clamp-2 text-[13.5px] font-medium leading-snug text-foreground",children:l.title}),l.activity!==void 0&&(0,Ne.jsx)(dc,{activity:l.activity,className:"text-[12px]"}),(0,Ne.jsxs)("span",{className:"mt-auto truncate text-[12px] text-muted-foreground",children:[l.agent," · ",(0,Ne.jsx)("span",{className:"tabular-nums",children:mK(l.since)})]})]})},l.runId))})]}),(0,Ne.jsxs)("section",{"aria-label":"At a glance","data-home-counts":!0,children:[(0,Ne.jsx)("ul",{className:"grid grid-cols-4 divide-x divide-border border-y border-border",children:e.counts.map(l=>(0,Ne.jsx)("li",{className:"min-w-0","data-home-count":l.key,children:(0,Ne.jsxs)("a",{href:l.href,className:"flex h-full flex-col gap-1 px-3 py-3 transition-colors hover:bg-[var(--so-raised)] first:pl-0 phone:px-2 phone:py-2.5",children:[(0,Ne.jsx)("span",{className:te("font-mono text-[22px] font-semibold leading-none tabular-nums tracking-[-0.02em] phone:text-[20px]",l.key==="waiting"&&l.value>0&&"text-attention"),children:l.value}),(0,Ne.jsx)("span",{className:"text-[12px] leading-tight text-muted-foreground",children:l.label})]})},l.key))}),e.planUse.length>0&&(0,Ne.jsx)("p",{className:"mt-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5 text-[12px] text-muted-foreground","data-home-plan":!0,"aria-label":"Plan use",children:e.planUse.map(l=>(0,Ne.jsxs)("span",{className:"inline-flex items-center gap-1.5",title:l.detail,children:[(0,Ne.jsxs)("span",{children:[l.name," · ",l.window]}),(0,Ne.jsx)("span",{"aria-hidden":"true",className:"relative inline-block h-1 w-12 overflow-hidden rounded-full bg-muted",children:(0,Ne.jsx)("span",{className:te("absolute inset-y-0 left-0 rounded-full",l.tone==="neutral"?"bg-foreground":l.tone==="warning"?"bg-warning":"bg-destructive"),style:{width:`${Math.min(100,Math.max(0,l.percent))}%`}})}),(0,Ne.jsxs)("span",{className:te("tabular-nums",l.tone==="warning"&&"text-warning",l.tone==="danger"&&"text-destructive"),children:[Math.round(l.percent),"%"]})]},`${l.name}-${l.window}`))})]}),(0,Ne.jsxs)("section",{"aria-labelledby":"home-catch-up","data-home-catch-up":!0,children:[(0,Ne.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,Ne.jsx)("h2",{id:"home-catch-up",className:"text-[14px] font-semibold tracking-[-0.01em]",children:"Catch up"}),(0,Ne.jsx)("div",{role:"tablist","aria-label":"Catch up",className:te("ml-auto inline-flex h-8 items-center gap-0.5 rounded-xl bg-muted p-0.5 phone:ml-0 phone:h-11 phone:w-full",t&&"ml-0 w-full"),children:Wx.map(l=>{let c=e.catchUp.some(f=>Xx(f,l.id)&&!r.has(Yx(f)));return(0,Ne.jsxs)("button",{type:"button",role:"tab","aria-selected":n===l.id,"data-catch-up-tab":l.id,onClick:()=>o(l.id),className:te("relative inline-flex h-full items-center gap-1.5 rounded-lg px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground phone:flex-1 phone:justify-center phone:px-1.5",t&&"flex-1 justify-center px-1.5",n===l.id&&"bg-card text-foreground shadow-[var(--so-pill-shadow)]"),children:[l.label,(0,Ne.jsx)("span",{className:te("min-w-[18px] rounded-full px-1.5 text-center font-mono text-[11px] leading-[18px] tabular-nums",l.id==="needs-you"&&a["needs-you"]>0?"bg-attention text-on-attention":"text-muted-foreground",t&&a[l.id]===0&&"hidden"),children:a[l.id]}),c&&n!==l.id&&(0,Ne.jsx)("span",{"data-unread":!0,"aria-label":"New",className:"absolute right-1 top-1 size-1.5 rounded-full bg-attention desk:hidden"})]},l.id)})})]}),i.length===0?(0,Ne.jsx)("p",{className:"border-t border-border py-4 text-[13px] text-muted-foreground",role:"status",children:Wx.find(l=>l.id===n).empty}):(0,Ne.jsx)("ul",{role:"tabpanel","aria-label":Wx.find(l=>l.id===n).label,className:"divide-y divide-border border-y border-border",children:i.slice(0,12).map(l=>(0,Ne.jsxs)("li",{"data-catch-up-item":l.id,className:"flex flex-col gap-1 py-2.5 phone:py-2",children:[(0,Ne.jsxs)("div",{className:"flex min-w-0 items-start justify-between gap-3",children:[(0,Ne.jsx)("a",{href:l.href,className:"min-w-0 text-[13.5px] font-medium leading-snug hover:underline hover:underline-offset-4 phone:flex phone:min-h-11 phone:items-center",children:l.title}),(0,Ne.jsx)(dl,{label:l.label,tone:l.tone,className:"mt-px"})]}),l.detail!==""&&(0,Ne.jsx)("p",{className:"text-[12.5px] leading-snug text-muted-foreground [overflow-wrap:anywhere]",children:l.detail}),l.action!=null&&(0,Ne.jsx)("a",{href:l.action.href,"data-catch-up-action":!0,className:"mt-0.5 inline-flex h-8 w-fit items-center rounded-md bg-attention px-3 text-[12.5px] font-semibold text-on-attention hover:bg-[var(--so-signal-hover)] phone:h-11 phone:w-full phone:justify-center",children:l.action.label}),(0,Ne.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:[l.project!==null&&(0,Ne.jsxs)(Ne.Fragment,{children:[l.project," · "]}),(0,Ne.jsx)("time",{dateTime:l.at,className:"tabular-nums",children:vn(l.at)})]})]},l.id))}),(0,Ne.jsx)("a",{href:e.allHref,className:"mt-2 inline-flex text-[12.5px] text-muted-foreground underline decoration-border underline-offset-4 hover:text-foreground phone:min-h-11 phone:items-center",children:"All tasks"})]})]})}function f8(e){return e.security?`Toolroll ${e.version} is available, with security fixes`:`Toolroll ${e.version} is available`}var R=j(fe(),1);function Ja({name:e}){return(0,R.jsx)("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:{menu:(0,R.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"}),chat:(0,R.jsx)("path",{d:"M5 4h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H9l-6 3V6a2 2 0 0 1 2-2Z"}),tasks:(0,R.jsx)(R.Fragment,{children:(0,R.jsx)("path",{d:"m3 6 2 2 4-4m-6 9 2 2 4-4m-6 9 2 2 4-4M13 6h8M13 13h8M13 20h8"})}),flows:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("rect",{width:"8",height:"8",x:"3",y:"3",rx:"2"}),(0,R.jsx)("path",{d:"M7 11v4a2 2 0 0 0 2 2h4"}),(0,R.jsx)("rect",{width:"8",height:"8",x:"13",y:"13",rx:"2"})]}),projects:(0,R.jsx)("path",{d:"M3 7V5a2 2 0 0 1 2-2h5l3 4h6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z"}),knowledge:(0,R.jsx)("path",{d:"M12 5c-3-2-7-2-10-1v15c3-1 7-1 10 1 3-2 7-2 10-1V4c-3-1-7-1-10 1Zm0 0v15"}),settings:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("path",{d:"M4 6h16M4 12h16M4 18h16"}),(0,R.jsx)("path",{d:"M8 3v6M16 9v6M10 15v6"})]}),arrow:(0,R.jsx)("path",{d:"m10 6-6 6 6 6M4 12h16"}),close:(0,R.jsx)("path",{d:"m6 6 12 12M6 18 18 6"}),send:(0,R.jsx)("path",{d:"m12 19 0-14m-6 6 6-6 6 6"}),tools:(0,R.jsx)(R.Fragment,{children:(0,R.jsx)("path",{d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})}),plus:(0,R.jsx)("path",{d:"M12 5v14M5 12h14"})}[e]})}function g2(){try{return window.sessionStorage}catch{return{getItem:()=>null,removeItem:()=>{},setItem:()=>{throw new Error("Storage unavailable")}}}}function x2(e){let t=e.conversation;return t?{user:e.user,session:t.sessionId,task:t.taskId??(t.project?`project:${t.project}`:null)}:null}function v2(){return!document.hidden&&navigator.onLine!==!1}var vK=new Set(["/work","/board","/queue","/workbench","/code"]);function yK(e){let[t,a]=(0,Ie.useState)(e),n=x2(e),[o,r]=(0,Ie.useState)(()=>{let N=e.conversation&&n?A4(g2(),n,e.conversation.requestId,e.conversation.maxChars):Vh(""),P=e.conversation?new URLSearchParams(window.location.search).get("draft"):null;return P&&N.text===""&&N.pending===null?{...N,text:P.slice(0,e.conversation.maxChars)}:N});(0,Ie.useEffect)(()=>{let N=new URL(window.location.href);N.searchParams.has("draft")&&(N.searchParams.delete("draft"),window.history.replaceState(window.history.state,"",N.pathname+N.search+N.hash))},[]);let[s,i]=(0,Ie.useState)(""),[l,c]=(0,Ie.useState)(!0),[f,u]=(0,Ie.useState)(!1),[d,m]=(0,Ie.useState)(!1),[g,b]=(0,Ie.useState)(()=>navigator.onLine===!1),v=(0,Ie.useRef)({workspace:t,draft:o,stale:d,sending:f,notice:s});v.current={workspace:t,draft:o,stale:d,sending:f,notice:s};let x=(0,Ie.useRef)(!1),y=(0,Ie.useRef)(!1),h=(0,Ie.useRef)(null),w=(0,Ie.useRef)(null),S=(0,Ie.useCallback)(()=>{w.current!==null&&clearTimeout(w.current),w.current=null},[]),C=(0,Ie.useRef)(!0),I=(0,Ie.useRef)(!1),L=(0,Ie.useCallback)(N=>{v.current.draft=N,r(N);let P=x2(e);P&&c(D4(g2(),P,N))},[e]),T=e.view?.kind==="task"&&e.view.live!=null&&!e.sensitive,A=!!(e.conversation||e.refreshSeconds),D=(0,Ie.useCallback)(async(N=!0,P=!1)=>{if(S(),!C.current||v.current.stale||!(A||T)||!v2())return;if(x.current){y.current=!0;return}y.current=!1,x.current=!0;let E=v.current.draft.pending?.request??null;try{let _=await H4(v.current.workspace,E,fetch,{etag:h.current,force:N});if(!C.current)return;if(h.current=E?null:_.etag,_.kind==="unchanged"){!v.current.draft.pending&&v.current.notice&&i("");return}let z=_.workspace;if(!F4(e,z)){v.current.stale=!0,m(!0),i("This conversation changed or ended. Reconnect to continue with your draft.");return}let q=z4(v.current.draft,E,z.receipt);q!==v.current.draft&&L(q),v.current.workspace=z,a(z),i(q.pending?"Delivery is not confirmed. Check again before sending another message.":"")}catch(_){if(!C.current)return;_ instanceof Nr&&(v.current.stale=!0,m(!0)),i(_ instanceof Error?_.message:"Updates are unavailable. Your work is still saved."),!P&&!v.current.stale&&v2()&&(w.current=setTimeout(()=>{w.current=null,D(!0,!0)},2e3))}finally{x.current=!1,y.current&&C.current&&!v.current.stale&&v2()&&(y.current=!1,D(!0))}},[e,A,T,L,S]);jo(A&&!d?"workspace":null,N=>{N==="change"||N==="reload"?D(!1):N==="lost"&&D(!0)}),(0,Ie.useEffect)(()=>{if(!T)return;let N=()=>{D(!0)};return window.addEventListener(Hg,N),()=>{window.removeEventListener(Hg,N)}},[D,T]),(0,Ie.useEffect)(()=>{if(C.current=!0,!A&&!T)return()=>{C.current=!1};let N=()=>{document.hidden?S():D(!0)},P=()=>{b(!1),D()},E=()=>{S(),b(!0)};return document.addEventListener("visibilitychange",N),window.addEventListener("online",P),window.addEventListener("offline",E),()=>{C.current=!1,S(),document.removeEventListener("visibilitychange",N),window.removeEventListener("online",P),window.removeEventListener("offline",E)}},[D,A,T,S]),(0,Ie.useEffect)(()=>{d&&S()},[d,S]);let H=async(N,P=null)=>{N.preventDefault();let E=v.current;if(I.current||E.stale||navigator.onLine===!1||E.draft.pending||E.workspace.conversation?.pendingTurnId!==null||!E.draft.text.trim())return;let _=O4(E.draft);if(_.pending){I.current=!0,u(!0),L(_),i("");try{let z=await q4(E.workspace,_.pending,fetch,P);if(!C.current)return;z.refused?(L(B4(v.current.draft,_.pending.request)),i(z.message??"Message not sent. Your draft is saved.")):(i("Checking delivery…"),D())}catch(z){if(!C.current)return;z instanceof Nr&&(v.current.stale=!0,m(!0)),i(z instanceof Nr?z.message:"Delivery is not confirmed. Check again before sending another message."),D()}finally{I.current=!1,C.current&&u(!1)}}},V=()=>{let N=x2(e);N&&_4(g2(),N,v.current.draft.text),window.location.reload()};return(0,Ie.useEffect)(()=>{let N=E=>{let _=E.target;if(!(_ instanceof HTMLFormElement)||_.dataset.workspaceComposer!==void 0||_.getAttribute("action")!=="/chat")return;let z=v.current;if(!z.workspace.conversation)return;if(z.stale||I.current||z.draft.pending||navigator.onLine===!1||z.workspace.conversation.pendingTurnId!==null){E.preventDefault(),i("Wait for the current message before sending another.");return}if(_.getAttribute("aria-busy")==="true"){E.preventDefault();return}let q=(O,W)=>{if(_.querySelector(`[name="${O}"]`))return;let ee=document.createElement("input");ee.type="hidden",ee.name=O,ee.value=W,_.append(ee)};q("request",z.workspace.conversation.requestId),q("request-session",String(z.workspace.conversation.sessionId)),z.workspace.conversation.taskId&&q("task",z.workspace.conversation.taskId),z.workspace.conversation.resultRunId!==null&&q("result",String(z.workspace.conversation.resultRunId)),!E.defaultPrevented&&(I.current=!0,_.setAttribute("aria-busy","true"))},P=()=>{I.current=!1,document.querySelectorAll('form[action="/chat"][aria-busy="true"]:not([data-workspace-composer])').forEach(E=>E.removeAttribute("aria-busy")),D()};return document.addEventListener("submit",N),window.addEventListener("pageshow",P),()=>{document.removeEventListener("submit",N),window.removeEventListener("pageshow",P)}},[D]),{workspace:t,draft:o,notice:s,storageAvailable:l,sending:f,stale:d,offline:g,send:H,check:D,reconnect:V,edit:N=>L(P4(v.current.draft,N))}}function bK({at:e}){let t=xR(e);return t===""?null:(0,R.jsx)("time",{className:"so-work-age",dateTime:e,title:fc(e),children:t})}function p8({workspace:e,items:t}){return(0,R.jsx)("ul",{className:"so-work-list",children:t.map(a=>(0,R.jsxs)("li",{"data-workspace-task":a.id,"data-work-status":a.state,children:[(0,R.jsxs)("div",{className:"so-work-row",children:[(0,R.jsxs)("a",{className:"so-work-link",href:a.resultHref??a.href,"aria-current":e.focus?.id===a.id?"page":void 0,children:[(0,R.jsxs)("div",{className:"so-work-heading",children:[(0,R.jsx)("span",{className:"so-work-title",children:a.title}),(0,R.jsx)(dl,{label:a.label,tone:a.tone,className:"so-work-badge"}),(0,R.jsx)(bK,{at:a.updatedAt})]}),a.activity!==void 0&&(0,R.jsx)(dc,{activity:a.activity,className:"so-work-activity text-[12px]"})]}),a.detail&&(0,R.jsx)("details",{className:"so-work-reason",children:(0,R.jsxs)("summary",{title:a.detail,children:[(0,R.jsx)("span",{children:a.detail}),(0,R.jsx)("svg",{"aria-hidden":"true",viewBox:"0 0 16 16",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,R.jsx)("path",{d:"m4 6 4 4 4-4"})})]})},a.detail),a.lead&&!a.detail?.includes(a.lead)&&(0,R.jsx)("span",{className:"so-work-project","data-crew-lead":!0,children:a.lead}),a.project&&(0,R.jsx)("span",{className:"so-work-project",children:e.projects.find(n=>n.path===a.project)?.name??a.project.split(/[\\/]/).filter(Boolean).pop()})]}),a.action&&a.action.href!==(a.resultHref??a.href)&&(0,R.jsx)("a",{className:"so-work-action",href:a.action.href,children:a.action.label})]},a.id))})}function wK({workspace:e,home:t}){let[a,n]=(0,Ie.useState)("home"),o=(0,Ie.useId)();return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("div",{className:"so-work-tabs",children:(0,R.jsxs)("div",{role:"tablist","aria-label":"Work",className:"so-ask-tabs",children:[(0,R.jsx)("button",{type:"button",role:"tab",id:`${o}-home`,"aria-controls":`${o}-home-panel`,"aria-selected":a==="home",onClick:()=>n("home"),children:"Home"}),(0,R.jsx)("button",{type:"button",role:"tab",id:`${o}-crew`,"aria-controls":`${o}-crew-panel`,"aria-selected":a==="crew",onClick:()=>n("crew"),children:"Crew"})]})}),(0,R.jsx)("div",{role:"tabpanel",id:`${o}-home-panel`,"aria-labelledby":`${o}-home`,className:"so-work-home","data-view":"home",hidden:a!=="home",children:(0,R.jsx)(d8,{home:t,compact:!0})}),(0,R.jsx)("div",{role:"tabpanel",id:`${o}-crew-panel`,"aria-labelledby":`${o}-crew`,hidden:a!=="crew",children:(0,R.jsx)(b2,{workspace:e})})]})}function b2({workspace:e}){let t=o=>o.tone==="done"||o.state==="cancelled",a=e.crew.filter(o=>!t(o)),n=e.crew.filter(t);return(0,R.jsxs)("section",{className:"so-crew","aria-labelledby":"crew-title","data-workspace-crew":!0,children:[(0,R.jsxs)("div",{className:"so-section-heading",children:[(0,R.jsx)("h2",{id:"crew-title",children:"Crew"}),(0,R.jsx)("a",{href:"/work",children:"All tasks"})]}),e.crew.length===0?(0,R.jsxs)("div",{className:"so-crew-empty",children:[(0,R.jsx)("p",{children:"No tasks yet."}),(0,R.jsx)("p",{children:"Work you start with the lead appears here."})]}):(0,R.jsxs)(R.Fragment,{children:[a.length>0?(0,R.jsx)(p8,{workspace:e,items:a}):(0,R.jsx)("p",{className:"so-crew-quiet",children:"Nothing is running or waiting on you."}),n.length>0&&(0,R.jsx)(eo,{summary:`Finished (${n.length}${e.crewTruncated?"+":""})`,className:"so-crew-finished",children:(0,R.jsx)(p8,{workspace:e,items:n.slice(0,8)})})]}),e.crewTruncated&&(0,R.jsx)("a",{className:"so-all-work",href:"/work",children:"View more tasks"})]})}function w8({workspace:e}){let t=(0,Ie.useId)(),a=e.projects.find(n=>new URL(e.path,window.location.origin).searchParams.get("project")===n.path||new URL(e.path,window.location.origin).searchParams.get("repo")===n.path||e.crew.find(o=>o.id===e.focus?.id)?.project===n.path);return(0,R.jsxs)("div",{className:"so-navigation-content",children:[(0,R.jsxs)("a",{href:"/chat",className:"so-wordmark",children:[(0,R.jsxs)("span",{className:"so-brand-mark","aria-hidden":"true",children:[(0,R.jsx)("i",{}),(0,R.jsx)("i",{}),(0,R.jsx)("i",{})]}),"Toolroll"]}),(0,R.jsxs)("a",{href:"/tasks/new",className:"so-new-task",children:[(0,R.jsx)(Ja,{name:"plus"}),"New task"]}),e.projects.length>0&&(0,R.jsxs)("div",{className:"so-project-switch",children:[(0,R.jsx)(_i,{htmlFor:t,children:"Project"}),(0,R.jsxs)("select",{id:t,value:a?.href??"/work",onChange:n=>{window.location.assign(n.target.value)},children:[(0,R.jsx)("option",{value:"/work",children:"All projects"}),e.projects.map(n=>(0,R.jsx)("option",{value:n.href,children:n.name},n.path))]})]}),(0,R.jsx)("nav",{"aria-label":"Workspace",className:"so-primary-navigation",children:e.navigation.filter(n=>n.href!=="/menu").map(n=>{let o=n.label.toLowerCase();return(0,R.jsxs)("a",{href:n.href,"aria-current":n.active?"page":void 0,children:[(0,R.jsx)(Ja,{name:["chat","tasks","flows","projects","knowledge","settings"].includes(o)?o:"tools"}),(0,R.jsx)("span",{children:n.label}),n.count!==void 0&&n.count>0&&(0,R.jsx)("span",{className:"so-nav-count","aria-label":n.countLabel??`${n.count} ${n.count===1?"needs":"need"} you`,title:n.countLabel,children:n.count})]},n.href)})}),a&&(0,R.jsxs)("div",{className:"so-project-links",children:[(0,R.jsx)("a",{className:"so-project-knowledge",href:`/chat?project=${encodeURIComponent(a.path)}`,children:"Project chat"}),(0,R.jsx)("a",{className:"so-project-knowledge",href:a.knowledgeHref,children:"Project knowledge"})]}),(e.chats?.length??0)>0&&(0,R.jsxs)("nav",{"aria-label":"Recent chats",className:"so-recent-chats",children:[(0,R.jsx)("p",{className:"so-recent-chats-label",children:"Recent chats"}),e.chats.map(n=>(0,R.jsxs)("a",{href:n.href,"aria-current":n.active?"page":void 0,title:n.title,children:[(0,R.jsx)("span",{className:"so-recent-chat-kind","aria-hidden":"true",children:n.kind==="task"?"Task":"Project"}),(0,R.jsx)("span",{className:"so-recent-chat-title",children:n.title})]},n.href))]}),(0,R.jsxs)("div",{className:"so-navigation-bottom",children:[(0,R.jsxs)("a",{href:"/menu","aria-current":e.navigation.find(n=>n.href==="/menu")?.active?"page":void 0,children:[(0,R.jsx)(Ja,{name:"tools"}),"Workspace tools"]}),(0,R.jsxs)("div",{className:"so-account",children:[(0,R.jsx)("span",{title:e.user,children:e.user}),(0,R.jsx)($e,{action:"/logout",children:(0,R.jsx)(_e,{variant:"ghost",size:"sm",type:"submit",children:"Sign out"})})]})]})]})}function SK(e,t=""){let a=[...e.navigation.map(o=>({label:o.label,detail:"Page",href:o.href})),...e.projects.map(o=>({label:o.name,detail:"Project",href:o.href})),...e.crew.map(o=>({label:o.title,detail:o.label,href:o.resultHref??o.href}))],n=new Set;return a.filter(o=>{let r=`${o.label}
|
|
69
69
|
${o.href}`;return n.has(r)?!1:(n.add(r),`${o.label} ${o.detail}`.toLowerCase().includes(t.trim().toLowerCase()))})}function CK({workspace:e}){let[t,a]=(0,Ie.useState)(!1),[n,o]=(0,Ie.useState)(""),r=(0,Ie.useId)(),s=(0,Ie.useRef)(null),i=(0,Ie.useRef)(null),l=f=>{a(f),o("")};if((0,Ie.useEffect)(()=>{if(e.sensitive)return;let f=u=>{!(u.metaKey||u.ctrlKey)||u.altKey||u.key.toLowerCase()!=="k"||u.target instanceof Element&&u.target.closest('input, textarea, select, [contenteditable="true"], [role="textbox"]')||(u.preventDefault(),a(d=>!d),o(""))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[e.sensitive]),e.sensitive)return null;let c=SK(e,n);return(0,R.jsxs)(H1,{open:t,onOpenChange:l,children:[(0,R.jsx)(q1,{asChild:!0,children:(0,R.jsxs)(_e,{variant:"ghost",size:"sm",className:"so-command-trigger",children:["Search",(0,R.jsx)("span",{className:"so-command-hint","aria-hidden":"true",children:"⌘ / Ctrl K"})]})}),(0,R.jsxs)(V1,{className:"so-command-dialog","data-workspace-command":!0,onOpenAutoFocus:f=>{f.preventDefault(),s.current?.focus()},children:[(0,R.jsxs)("div",{className:"so-command-heading",children:[(0,R.jsx)(G1,{children:"Go to"}),(0,R.jsx)(U1,{asChild:!0,children:(0,R.jsx)(_e,{variant:"ghost",size:"icon","aria-label":"Close search",children:(0,R.jsx)(Ja,{name:"close"})})})]}),(0,R.jsx)($1,{className:"so-sr-only",children:"Search pages, projects, and tasks. Use Tab or the arrow keys to choose a link."}),(0,R.jsx)(_i,{htmlFor:r,className:"so-sr-only",children:"Search workspace"}),(0,R.jsx)(Di,{ref:s,id:r,type:"search",placeholder:"Search workspace…",value:n,onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="ArrowDown"&&(f.preventDefault(),i.current?.querySelector("a")?.focus())}}),(0,R.jsx)("ul",{ref:i,className:"so-command-results",onKeyDown:f=>{if(f.key!=="ArrowDown"&&f.key!=="ArrowUp")return;let u=Array.from(i.current?.querySelectorAll("a")??[]),d=u.indexOf(document.activeElement);d<0||(f.preventDefault(),u[(d+(f.key==="ArrowDown"?1:-1)+u.length)%u.length]?.focus())},children:c.map(f=>(0,R.jsx)("li",{children:(0,R.jsxs)("a",{href:f.href,children:[(0,R.jsx)("span",{children:f.label}),(0,R.jsx)("small",{children:f.detail})]})},f.href))}),c.length===0&&(0,R.jsx)("p",{className:"so-command-empty",role:"status",children:"No matches."})]})]})}function kK({workspace:e}){return(0,R.jsxs)(H1,{children:[(0,R.jsx)(q1,{asChild:!0,children:(0,R.jsx)(_e,{variant:"ghost",size:"icon",className:"so-mobile-menu","aria-label":"Open navigation",children:(0,R.jsx)(Ja,{name:"menu"})})}),(0,R.jsxs)(V1,{className:"so-navigation-dialog",children:[(0,R.jsx)(G1,{className:"so-sr-only",children:"Workspace navigation"}),(0,R.jsx)($1,{className:"so-sr-only",children:"Choose a project or a workspace page."}),(0,R.jsx)(U1,{asChild:!0,children:(0,R.jsx)(_e,{variant:"ghost",size:"icon",className:"so-navigation-close","aria-label":"Close navigation",children:(0,R.jsx)(Ja,{name:"close"})})}),(0,R.jsx)(w8,{workspace:e})]})]})}var LK=[["support-desk","Support desk"],["bug-triage","Bug triage"],["sales-follow-up","Sales follow-up"],["ops-requests","Ops requests"]],m8={task:{title:"Ask about this task",hint:"Questions, changes and next steps. Actions come back as cards you confirm.",placeholder:"Ask about this task…",suggestions:["Where does this task stand?","Move this forward","Request changes: "]},result:{title:"Ask about this result",hint:"Ask what changed or why, or request a revision. Actions come back as cards you confirm.",placeholder:"Ask about this result…",suggestions:["Summarize what changed","What does the check log say?","Request changes: "]},tasks:{title:"Ask about this project",hint:"Plan work, file tasks and check progress. Actions come back as cards you confirm.",placeholder:"Ask about this project…",suggestions:["What needs my attention here?","What should we build next?","File a task: "]}},IK="New conversation — the projects I can reach changed";function h8({message:e,workspace:t,onChanged:a}){return(0,R.jsxs)(Hh,{from:e.role==="operator"?"user":"assistant","data-message-id":e.id,children:[(0,R.jsx)("div",{className:"so-message-label",children:e.role==="operator"?"You":t.leadName??"Lead"}),(0,R.jsxs)(jd,{children:[(0,R.jsx)(Kt,{html:e.html}),e.activity&&(0,R.jsx)(eo,{summary:"Activity",children:(0,R.jsx)("p",{className:"so-activity-copy",children:e.activity})}),e.cards!==void 0&&e.cards.length>0?(0,R.jsx)(Qf,{cards:e.cards,csrf:t.csrf,onChanged:a}):e.cardsHtml&&(0,R.jsx)(Kt,{html:e.cardsHtml,className:"so-message-cards"})]})]})}function g8({controller:e,docked:t=null}){let{workspace:a,draft:n,notice:o,storageAvailable:r,sending:s,stale:i,offline:l}=e,c=a.conversation,f=t===null?null:m8[t]??m8.task,u=(0,Ie.useRef)(null),d=c.pendingTurnId!==null,m=Zb[t??(c.taskId?"task":c.project?"tasks":"lead")]??Zb.lead,g=/^\/(\w*)$/.exec(n.text)?.[1]?.toLowerCase(),[b,v]=(0,Ie.useState)(0),[x,y]=(0,Ie.useState)(!1),h=g===void 0||x?[]:m.filter(A=>A.command.startsWith(g)),w=(0,Ie.useId)(),S=A=>{e.edit(A.text),v(0),requestAnimationFrame(()=>{let D=u.current;D&&(D.focus(),D.setSelectionRange(D.value.length,D.value.length))})},C=ew(c,d||n.pending!==null&&!s,()=>{e.check()}),I=s||i||l||d||n.pending!==null||!n.text.trim();(0,Ie.useLayoutEffect)(()=>{let A=u.current;if(A){let D=matchMedia("(max-width: 760px)").matches;A.style.height=D?"0px":"auto",A.style.height=`${Math.min(180,Math.max(D?44:48,A.scrollHeight))}px`}},[n.text]);let L=l?"Offline. Your draft stays in this tab.":s?"Sending…":o;(0,Ie.useEffect)(()=>{f||window.location.hash!==""||!matchMedia("(pointer: fine) and (min-width: 761px)").matches||document.activeElement!==null&&document.activeElement!==document.body||u.current?.focus({preventScroll:!0})},[]);let T=f?[]:c.previous?.messages??[];return(0,R.jsxs)("div",{className:"so-lead-chat","data-workspace-chat":!0,children:[(0,R.jsxs)(S4,{className:"so-conversation",children:[(0,R.jsxs)(C4,{className:"so-conversation-content",children:[!f&&a.firstRun&&(0,R.jsx)(aw,{firstRun:a.firstRun}),!f&&!a.home&&a.catchUpHtml&&(0,R.jsx)(Kt,{html:a.catchUpHtml,className:"so-catch-up"}),T.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("section",{className:"so-previous-thread","aria-label":"Earlier conversation","data-previous-thread":!0,children:T.map(A=>(0,R.jsx)(h8,{message:A,workspace:a,onChanged:()=>{e.check()}},A.id))}),(0,R.jsx)("p",{className:"so-thread-divider",role:"separator","data-thread-divider":!0,children:(0,R.jsx)("span",{children:IK})})]}),c.messages.length===0&&T.length===0&&(!f&&a.firstRun?null:f?(0,R.jsxs)("div",{className:"so-docked-empty",children:[(0,R.jsx)("p",{className:"so-docked-empty-title",children:f.title}),(0,R.jsx)("p",{className:"so-docked-empty-hint",children:f.hint}),(0,R.jsx)("div",{className:"so-suggestions",children:f.suggestions.map(A=>(0,R.jsx)("button",{type:"button",className:"so-suggestion",onClick:()=>{e.edit(A),u.current?.focus()},children:A.trim().replace(/:$/,"…")},A))})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(L4,{title:"What would you like to work on?"}),(0,R.jsxs)("nav",{className:"so-kit-links","aria-label":"Starter kits","data-kit-links":!0,children:[(0,R.jsx)("span",{children:"Or start from a kit:"}),LK.map(([A,D])=>(0,R.jsx)("a",{className:"so-suggestion",href:`/kits/${A}`,children:D},A))]})]})),(0,R.jsx)("div",{id:"chat-thread","data-chat-region":"thread",children:c.messages.map(A=>(0,R.jsx)(h8,{message:A,workspace:a,onChanged:()=>{e.check()}},A.id))}),(d||C!==null)&&(0,R.jsx)(tw,{live:C,leadName:a.leadName??"Lead"})]}),(0,R.jsx)(k4,{})]}),(0,R.jsxs)("div",{className:"so-composer-area",children:[!f&&a.firstRun&&c.messages.length===0&&!d&&(0,R.jsx)($M,{firstRun:a.firstRun,onDraft:A=>{e.edit(GM(n.text,A)),u.current?.focus()}}),L&&(0,R.jsxs)("div",{className:"so-connection",role:i?"alert":"status",children:[(0,R.jsx)("span",{children:L}),i?(0,R.jsx)(_e,{variant:"secondary",size:"sm",onClick:e.reconnect,children:"Reconnect"}):!s&&!l&&(0,R.jsx)(_e,{variant:"ghost",size:"sm",onClick:()=>{e.check()},children:"Check again"})]}),(0,R.jsxs)($e,{onSubmit:e.send,action:"/chat","data-workspace-composer":!0,"aria-busy":s,children:[(0,R.jsx)(_i,{htmlFor:"lead-message",className:"so-sr-only",children:"Message your lead"}),h.length>0&&(0,R.jsx)("ul",{id:w,role:"listbox","aria-label":"Commands",className:"so-slash-menu",children:h.map((A,D)=>(0,R.jsxs)("li",{role:"option","aria-selected":D===Math.min(b,h.length-1),onMouseDown:H=>{H.preventDefault(),S(A)},children:[(0,R.jsxs)("span",{className:"so-slash-name",children:["/",A.command]}),(0,R.jsx)("span",{className:"so-slash-hint",children:A.hint})]},A.command))}),(0,R.jsx)(Ss,{ref:u,id:"lead-message",name:"message",rows:2,maxLength:c.maxChars,placeholder:f?.placeholder??"Message your lead…",value:n.text,role:h.length>0?"combobox":void 0,"aria-expanded":h.length>0?!0:void 0,"aria-controls":h.length>0?w:void 0,onChange:A=>{y(!1),e.edit(A.target.value)},onKeyDown:A=>{if(h.length>0){let D=Math.min(b,h.length-1);if(A.key==="ArrowDown"||A.key==="ArrowUp"){A.preventDefault(),v((D+(A.key==="ArrowDown"?1:h.length-1))%h.length);return}if(A.key==="Enter"&&!A.shiftKey||A.key==="Tab"){A.preventDefault(),S(h[D]);return}if(A.key==="Escape"){A.preventDefault(),y(!0);return}}A.key==="Enter"&&!A.shiftKey&&!A.nativeEvent.isComposing&&(A.preventDefault(),I||A.currentTarget.form?.requestSubmit())},"aria-describedby":"composer-hint"}),(0,R.jsxs)("div",{className:"so-composer-actions",children:[(0,R.jsx)("span",{id:"composer-hint",children:r?n.text.length>c.maxChars-200?`${n.text.length} / ${c.maxChars}`:"/ for commands · Shift + Enter for a new line":"Draft stays on this page only."}),(0,R.jsxs)(_e,{type:"submit",disabled:I,"aria-label":"Send message",children:[(0,R.jsx)(Ja,{name:"send"}),(0,R.jsx)("span",{children:"Send"})]})]})]}),!f&&a.controlsHtml&&(0,R.jsx)(eo,{summary:"Conversation settings",className:"so-conversation-settings",children:(0,R.jsx)(Kt,{html:a.controlsHtml,immutable:!0})})]})]})}var x8=[{id:"build",label:"Build",hint:"Changes come back for you to confirm"},{id:"plan",label:"Plan only",hint:"A plan only; nothing is filed"},{id:"answer",label:"Just answer",hint:"An answer only"}];function NK(e){let{workspace:t,draft:a,notice:n,storageAvailable:o,sending:r,stale:s,offline:i}=e,l=t.conversation,c=(0,Ie.useRef)(null),f=(0,Ie.useId)(),[u,d]=(0,Ie.useState)("build"),m=l!==null&&!!l.taskId&&!t.team&&t.view?.kind==="task",g=l!==null&&l.pendingTurnId!==null,b=ew(l,m&&(g||a.pending!==null&&!r),()=>{e.check()});if((0,Ie.useLayoutEffect)(()=>{let h=c.current;if(h){let w=matchMedia("(max-width: 760px)").matches;h.style.height=w?"0px":"auto",h.style.height=`${Math.min(180,Math.max(w?44:48,h.scrollHeight))}px`}},[a.text]),!m||l===null)return null;let v=r||s||i||g||a.pending!==null||!a.text.trim(),x=i?"Offline. Your draft stays in this tab.":r?"Sending…":n,y=x8.find(h=>h.id===u).hint;return{entries:l.messages.map(h=>({key:`message-${h.id}`,at:h.createdAt,node:(0,R.jsxs)("li",{"data-message-id":h.id,"data-thread-kind":"message",className:"so-thread-entry relative flex gap-3",children:[(0,R.jsx)("span",{"aria-hidden":"true",className:"relative z-[1] flex size-6 shrink-0 items-center justify-center rounded-full border border-border bg-card text-[10.5px] font-semibold text-muted-foreground",children:h.role==="operator"?"Y":(t.leadName??"Lead").slice(0,1).toUpperCase()}),(0,R.jsxs)("div",{className:"min-w-0 flex-1 pb-5 phone:pb-4",children:[(0,R.jsxs)("p",{className:"flex min-h-6 flex-wrap items-baseline gap-x-2 text-[13px] leading-6",children:[(0,R.jsx)("span",{className:"font-medium",children:h.role==="operator"?"You":t.leadName??"Lead"}),(0,R.jsx)("time",{dateTime:h.createdAt,className:"ml-auto text-xs tabular-nums text-muted-foreground",children:vn(h.createdAt)})]}),(0,R.jsxs)(jd,{className:h.role==="operator"?"so-thread-mine":"so-thread-theirs",children:[(0,R.jsx)(Kt,{html:h.html}),h.activity&&(0,R.jsx)(eo,{summary:"Activity",children:(0,R.jsx)("p",{className:"so-activity-copy",children:h.activity})}),h.cards!==void 0&&h.cards.length>0?(0,R.jsx)(Qf,{cards:h.cards,csrf:t.csrf,onChanged:()=>{e.check()}}):h.cardsHtml&&(0,R.jsx)(Kt,{html:h.cardsHtml,className:"so-message-cards"})]})]})]},`message-${h.id}`)})),footer:(0,R.jsxs)("div",{className:"so-task-composer flex flex-col gap-2",children:[(g||b!==null)&&(0,R.jsx)(tw,{live:b,leadName:t.leadName??"Lead"}),x&&(0,R.jsxs)("div",{className:"so-connection",role:s?"alert":"status",children:[(0,R.jsx)("span",{children:x}),s?(0,R.jsx)(Z,{variant:"outline",size:"sm",onClick:e.reconnect,children:"Reconnect"}):!r&&!i&&(0,R.jsx)(Z,{variant:"ghost",size:"sm",onClick:()=>{e.check()},children:"Check again"})]}),(0,R.jsxs)($e,{onSubmit:h=>{e.send(h,u)},action:"/chat","data-workspace-composer":!0,"data-task-composer":!0,"aria-busy":r,className:"rounded-xl border border-input bg-card px-3 pb-2 pt-2.5 shadow-[0_1px_2px_rgb(0_0_0/.04)] transition-[border-color,box-shadow] duration-100 focus-within:border-attention focus-within:shadow-[0_0_0_3px_var(--so-signal-soft)] phone:px-2.5",children:[(0,R.jsx)("label",{htmlFor:"task-message",className:"sr-only",children:"Message the agent"}),(0,R.jsx)("textarea",{ref:c,id:"task-message",name:"message",rows:2,maxLength:l.maxChars,placeholder:"Message the agent: ask, or ask for a change",value:a.text,className:"block max-h-[180px] min-h-12 w-full resize-none px-0.5 pb-2 text-sm leading-relaxed outline-none placeholder:text-muted-foreground phone:min-h-11 phone:text-base",onChange:h=>e.edit(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.shiftKey&&!h.nativeEvent.isComposing&&(h.preventDefault(),v||h.currentTarget.form?.requestSubmit())},"aria-describedby":"task-composer-hint"}),(0,R.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2",children:[(0,R.jsx)("div",{role:"radiogroup","aria-label":"Mode",className:"so-mode-switch",children:x8.map(h=>(0,R.jsxs)("label",{className:"so-mode","data-mode":h.id,children:[(0,R.jsx)("input",{type:"radio",name:f,value:h.id,checked:u===h.id,onChange:()=>d(h.id)}),(0,R.jsx)("span",{children:h.label})]},h.id))}),(0,R.jsx)("span",{id:"task-composer-hint",className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:o?a.text.length>l.maxChars-200?`${a.text.length} / ${l.maxChars}`:y:"Draft stays on this page only."}),(0,R.jsxs)(Z,{type:"submit",size:"sm",disabled:v,"aria-label":"Send message",className:te("ml-auto"),children:[(0,R.jsx)(Ja,{name:"send"}),(0,R.jsx)("span",{children:"Send"})]})]})]})]})}}function v8({demo:e}){return e===void 0?null:(0,R.jsxs)(fn,{className:"so-demo-notice","data-demo-notice":!0,title:e.text,children:[(0,R.jsx)("span",{className:"so-demo-notice-full",children:e.text}),(0,R.jsx)("span",{className:"so-demo-notice-short",children:e.short})]})}function RK(){(0,Ie.useEffect)(()=>{let e=()=>{(window.scrollX!==0||window.scrollY!==0)&&window.scrollTo(0,0)},t=()=>{let n=decodeURIComponent(window.location.hash.slice(1)),o=n===""||n==="workspace-main"?null:document.getElementById(n);for(let r=o?.parentElement??null;r!==null;r=r.parentElement)r instanceof HTMLDetailsElement&&(r.open=!0);o?.scrollIntoView({block:"start"}),e()},a=requestAnimationFrame(t);return window.addEventListener("scroll",e,{passive:!0}),window.addEventListener("hashchange",t),()=>{cancelAnimationFrame(a),window.removeEventListener("scroll",e),window.removeEventListener("hashchange",t)}},[])}function TK({initial:e}){let t=yK(e),[a,n]=(0,Ie.useState)(e.team),o=a?.tasks?{...t.workspace,...VM(a.tasks,a.selected?.id)}:t.workspace,[r,s]=(0,Ie.useState)(o.result||o.focus?"work":"chat"),i=o.focus!==null||o.result!==null,l=o.crew.find(H=>H.id===o.focus?.id),c=o.navigation.some(H=>H.label==="Chat"&&H.active),f=o.navigation.find(H=>H.active)?.label??o.title.charAt(0).toUpperCase()+o.title.slice(1),u=!o.team&&o.view?.kind==="task"?o.view:null,d=!o.team&&o.conversation!==null&&o.view!=null&&u===null,[m,g]=(0,Ie.useState)("chat"),b=!o.team&&(!o.conversation||d||u!==null),v=NK(t);(0,Ie.useEffect)(()=>{if(u===null)return;let H=()=>s("work");window.addEventListener("so:show-details",H);let V=decodeURIComponent(window.location.hash.slice(1));return V!==""&&document.getElementById(V)?.closest("[data-task-details]")&&H(),()=>window.removeEventListener("so:show-details",H)},[u===null]);let x=new URL(o.path,window.location.origin).pathname,y=b&&!d&&!i&&(vK.has(x)||x.startsWith("/code/")||o.view?.kind==="flow"),[h,w]=(0,Ie.useState)(null),S=o.update!==void 0&&o.update.version!==h?o.update:null,C=o.demo,I=!o.team&&!(o.conversation&&!d&&u===null),L=c&&!i&&!d&&u===null&&!o.team?o.home??null:null,[T,A]=(0,Ie.useState)(!1),D=c&&o.conversation!==null&&!d&&u===null&&!T?o.phone??null:null;return(0,Ie.useEffect)(rb,[]),RK(),(0,R.jsxs)(Z1.Provider,{value:o.csrf,children:[(0,R.jsx)(iM,{}),(0,R.jsxs)("div",{className:`so-workspace${y?" so-workspace--single":""}${d||u!==null?" so-workspace--docked":""}${u!==null?" so-workspace--details":""}`,"data-workspace-shell":!0,"data-workspace-phone-view":r,"data-workspace-has-result":o.result!==null,children:[(0,R.jsx)("a",{href:"#workspace-main",className:"so-skip-link",children:"Skip to content"}),(0,R.jsx)("aside",{className:"so-sidebar",children:(0,R.jsx)(w8,{workspace:o})}),(0,R.jsxs)("div",{className:`so-main-column${c?" so-main-column--chat":""}`,children:[(0,R.jsxs)("header",{className:"so-workspace-header",children:[(0,R.jsx)(kK,{workspace:o}),b?(0,R.jsx)("p",{className:"so-header-title",children:f}):(0,R.jsx)("h1",{children:c?o.leadName??"Lead":f}),o.focus&&c&&(0,R.jsx)("span",{className:"so-focus-label",title:o.focus.title,children:o.focus.title}),(0,R.jsx)(CK,{workspace:o}),c&&(0,R.jsx)(_e,{variant:"secondary",size:"sm",className:"so-phone-work-button",onClick:()=>s("work"),children:i?"Open work":L!==null?"Work":"Crew"}),d&&(0,R.jsxs)(_e,{variant:"secondary",size:"sm",className:"so-phone-work-button",onClick:()=>{g("chat"),s("work")},children:[(0,R.jsx)(Ja,{name:"chat"}),"Ask"]}),u!==null&&(0,R.jsx)(_e,{variant:"secondary",size:"sm",className:"so-phone-work-button","data-open-details":!0,onClick:()=>s("work"),children:"Task details"})]}),(o.notices.length>0||(o.signIn?.length??0)>0||S!==null||D!==null||C!==void 0&&!I)&&(0,R.jsxs)("div",{className:"so-workspace-notices",children:[!I&&(0,R.jsx)(v8,{demo:C}),o.signIn?.map(H=>(0,R.jsxs)(fn,{className:"so-sign-in","data-sign-in":H.provider,children:[(0,R.jsx)("p",{className:"so-sign-in-title",children:H.title}),(0,R.jsxs)("p",{className:"so-sign-in-detail",children:["Run ",(0,R.jsx)("code",{children:H.command})," on this computer, then resume.",H.detail===""?"":` ${H.detail}`]}),(0,R.jsx)($e,{action:H.resumeHref,children:(0,R.jsx)(_e,{size:"sm",type:"submit",children:H.resumeLabel})})]},H.provider)),o.notices.map((H,V)=>(0,R.jsx)(fn,{children:H},V)),S!==null&&(0,R.jsxs)(fn,{className:"so-update","data-update":S.version,children:[(0,R.jsxs)("p",{children:[(0,R.jsx)("span",{children:f8(S)})," · ",(0,R.jsx)("a",{href:S.href,children:"What's new"})]}),(0,R.jsxs)($e,{action:S.dismissHref,onSubmit:H=>{H.preventDefault(),w(S.version),fetch(S.dismissHref,{method:"POST",body:new URLSearchParams({csrf:o.csrf,version:S.version,quiet:"1"})}).catch(()=>{})},children:[(0,R.jsx)("input",{type:"hidden",name:"version",value:S.version}),(0,R.jsx)(_e,{variant:"ghost",size:"icon",type:"submit","aria-label":`Dismiss the notice about ${S.version}`,children:(0,R.jsx)(Ja,{name:"close"})})]})]}),D!==null&&(0,R.jsxs)(fn,{className:"so-update so-phone-notice","data-phone-notice":!0,children:[(0,R.jsxs)("p",{children:[(0,R.jsx)("span",{children:"Use it from your phone too"})," · ",(0,R.jsx)("a",{href:"/settings#settings-chat-apps",children:"Set up"})]}),(0,R.jsx)($e,{action:D.dismissHref,onSubmit:H=>{H.preventDefault(),A(!0),fetch(D.dismissHref,{method:"POST",body:new URLSearchParams({csrf:o.csrf,quiet:"1"})}).catch(()=>{})},children:(0,R.jsx)(_e,{variant:"ghost",size:"icon",type:"submit","aria-label":"Dismiss the phone notice",children:(0,R.jsx)(Ja,{name:"close"})})})]})]}),(0,R.jsx)("main",{id:"workspace-main",className:"so-main-content",tabIndex:-1,children:o.team?(0,R.jsx)(HM,{initial:o.team,user:o.user,csrf:o.csrf,onSnapshot:n}):o.conversation&&!d&&u===null?(0,R.jsx)(g8,{controller:t}):(0,R.jsxs)("div",{className:"so-page-content","data-workspace-page":!0,children:[(0,R.jsx)(v8,{demo:C}),c&&o.firstRun&&(0,R.jsx)(aw,{firstRun:o.firstRun}),o.view?(0,R.jsx)(c8,{view:o.view,csrf:o.csrf,taskChat:v,taskDetails:!1}):(0,R.jsx)(Kt,{html:e.pageHtml??"",immutable:!0})]})})]}),d&&(0,R.jsxs)("aside",{className:"so-supporting-panel so-ask-panel","data-workspace-detail":!0,"aria-label":"Ask",children:[(0,R.jsxs)("div",{className:"so-ask-header",children:[(0,R.jsxs)(_e,{variant:"ghost",size:"sm",className:"so-phone-back",onClick:()=>s("chat"),children:[(0,R.jsx)(Ja,{name:"arrow"}),"Back"]}),(0,R.jsxs)("div",{role:"tablist","aria-label":"Panel",className:"so-ask-tabs",children:[(0,R.jsx)("button",{type:"button",role:"tab","aria-selected":m==="chat",onClick:()=>g("chat"),children:"Chat"}),(0,R.jsx)("button",{type:"button",role:"tab","aria-selected":m==="crew",onClick:()=>g("crew"),children:"Crew"})]})]}),(0,R.jsx)("div",{className:"so-ask-body",hidden:m!=="chat",children:(0,R.jsx)(g8,{controller:t,docked:o.view?.kind??"task"})}),m==="crew"&&(0,R.jsx)(b2,{workspace:o})]}),u!==null&&(0,R.jsxs)("aside",{className:"so-supporting-panel so-details-panel","data-workspace-detail":!0,"aria-label":"Task details",children:[(0,R.jsxs)("div",{className:"so-details-header",children:[(0,R.jsxs)(_e,{variant:"ghost",size:"sm",className:"so-phone-back",onClick:()=>s("chat"),children:[(0,R.jsx)(Ja,{name:"arrow"}),"Back"]}),(0,R.jsx)("h2",{children:"Task details"})]}),(0,R.jsx)("div",{"data-view":"task-details",className:"w-full",children:(0,R.jsx)(qg,{view:u})})]}),!y&&!d&&u===null&&(0,R.jsxs)("aside",{className:`so-supporting-panel${i?" so-supporting-panel--detail":""}`,"data-workspace-detail":!0,children:[(0,R.jsxs)("div",{className:"so-work-panel-header",children:[(0,R.jsxs)(_e,{variant:"ghost",size:"sm",className:"so-phone-back",onClick:()=>s("chat"),children:[(0,R.jsx)(Ja,{name:"arrow"}),c?"Back to chat":"Back"]}),i&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("h2",{children:o.result?"Result":"Task"}),o.result&&l&&(0,R.jsx)(dl,{label:l.label,tone:l.tone,className:"so-current-task-state","data-workspace-current-task-state":""}),(0,R.jsx)("a",{href:a?.selected?"/chat?conversation="+encodeURIComponent(a.selected.id):"/chat",className:"so-close-work","aria-label":"Close work and return to the main chat",children:(0,R.jsx)(Ja,{name:"close"})})]})]}),i?(0,R.jsxs)("div",{className:"so-work-detail-content",children:[o.focus&&(o.result?(0,R.jsx)(eo,{summary:"Task details",className:"so-result-task-details",children:(0,R.jsx)(Kt,{html:o.focus.html,className:"so-task-context"},o.focus.id)}):(0,R.jsx)(Kt,{html:o.focus.html,className:"so-task-context"},o.focus.id)),o.result&&(0,R.jsx)(I4,{"data-workspace-result":o.result.runId,children:(0,R.jsx)(N4,{children:(0,R.jsx)(Kt,{html:o.result.html,immutable:!0},o.result.runId)})})]}):L!==null?(0,R.jsx)(wK,{workspace:o,home:L}):(0,R.jsx)(b2,{workspace:o})]})]})]})}var S8=e=>{let t=e.viewTransition;for(let a of[t?.finished,t?.ready,t?.updateCallbackDone])a?.catch(()=>{})};window.addEventListener("pageswap",S8);window.addEventListener("pagereveal",S8);var y2=document.getElementById("standing-orders-workspace"),y8=document.getElementById("standing-orders-workspace-data");if(y2&&y8)try{let e=JSON.parse(y8.textContent??"null");if(!eb(e))throw new Error("Workspace data is incomplete");(0,b8.createRoot)(y2).render((0,R.jsx)(TK,{initial:e}))}catch{y2.setAttribute("data-workspace-unavailable","true")}export{CK as CommandMenu,p8 as CrewRows,Kt as GuardedHtml,IK as REPLACED_THREAD_DIVIDER,TK as WorkspaceApp,yR as regionIsEditing,yK as useWorkspace,SK as workspaceCommands};
|
|
70
70
|
/*! Bundled license information:
|
|
71
71
|
|