@xfey/tutti 0.1.51 → 0.1.52
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/migrations/README.md +2 -2
- package/package.json +1 -1
- package/prompts/prompt-flow-experiment-plan.md +14 -13
- package/prompts/prompt-flow-map.md +20 -19
- package/web/assets/{homepage-motion-scene-CV9ceFzS.js → homepage-motion-scene-ENUzAyyp.js} +1 -1
- package/web/assets/{index-DNnf10zz.css → index-CWWkCr48.css} +1 -1
- package/web/assets/{index-CxVBmEoi.js → index-DK8LBgHp.js} +3 -3
- package/web/index.html +2 -2
|
@@ -47,8 +47,8 @@ Error generating stack: `+e.message+`
|
|
|
47
47
|
`},Zl=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Ql=function(){N.useEffect(function(){return document.body.setAttribute(Yl,(Zl()+1).toString()),function(){var e=Zl()-1;e<=0?document.body.removeAttribute(Yl):document.body.setAttribute(Yl,e.toString())}},[])},$l=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Ql();var a=N.useMemo(function(){return ql(i)},[i]);return N.createElement(Jl,{styles:Xl(a,!t,i,n?``:`!important`)})},eu=!1;if(typeof window<`u`)try{var tu=Object.defineProperty({},`passive`,{get:function(){return eu=!0,!0}});window.addEventListener(`test`,tu,tu),window.removeEventListener(`test`,tu,tu)}catch{eu=!1}var nu=eu?{passive:!1}:!1,ru=function(e){return e.tagName===`TEXTAREA`},iu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ru(e)&&n[t]===`visible`)},au=function(e){return iu(e,`overflowY`)},ou=function(e){return iu(e,`overflowX`)},su=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),uu(e,r)){var i=du(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},cu=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},lu=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},uu=function(e,t){return e===`v`?au(t):ou(t)},du=function(e,t){return e===`v`?cu(t):lu(t)},fu=function(e,t){return e===`h`&&t===`rtl`?-1:1},pu=function(e,t,n,r,i){var a=fu(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=du(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&uu(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},mu=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hu=function(e){return[e.deltaX,e.deltaY]},gu=function(e){return e&&`current`in e?e.current:e},_u=function(e,t){return e[0]===t[0]&&e[1]===t[1]},vu=function(e){return`
|
|
48
48
|
.block-interactivity-${e} {pointer-events: none;}
|
|
49
49
|
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
-
`},yu=0,bu=[];function xu(e){var t=N.useRef([]),n=N.useRef([0,0]),r=N.useRef(),i=N.useState(yu++)[0],a=N.useState(Wl)[0],o=N.useRef(e);N.useEffect(function(){o.current=e},[e]),N.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=yl([e.lockRef.current],(e.shards||[]).map(gu),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=N.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=mu(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=su(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=su(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return pu(h,t,e,h===`h`?s:c,!0)},[]),c=N.useCallback(function(e){var n=e;if(!(!bu.length||bu[bu.length-1]!==a)){var r=`deltaY`in n?hu(n):mu(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&_u(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(gu).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=N.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Su(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=N.useCallback(function(e){n.current=mu(e),r.current=void 0},[]),d=N.useCallback(function(t){l(t.type,hu(t),t.target,s(t,e.lockRef.current))},[]),f=N.useCallback(function(t){l(t.type,mu(t),t.target,s(t,e.lockRef.current))},[]);N.useEffect(function(){return bu.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,nu),document.addEventListener(`touchmove`,c,nu),document.addEventListener(`touchstart`,u,nu),function(){bu=bu.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,nu),document.removeEventListener(`touchmove`,c,nu),document.removeEventListener(`touchstart`,u,nu)}},[]);var p=e.removeScrollBar,m=e.inert;return N.createElement(N.Fragment,null,m?N.createElement(a,{styles:vu(i)}):null,p?N.createElement($l,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Su(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Cu=Nl(Pl,xu),wu=N.forwardRef(function(e,t){return N.createElement(Il,_l({},e,{ref:t,sideCar:Cu}))});wu.classNames=Il.classNames;var Tu=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Eu=new WeakMap,Du=new WeakMap,Ou={},ku=0,Au=function(e){return e&&(e.host||Au(e.parentNode))},ju=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Au(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Mu=function(e,t,n,r){var i=ju(t,Array.isArray(e)?e:[e]);Ou[n]||(Ou[n]=new WeakMap);var a=Ou[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Eu.get(e)||0)+1,l=(a.get(e)||0)+1;Eu.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Du.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ku++,function(){o.forEach(function(e){var t=Eu.get(e)-1,i=a.get(e)-1;Eu.set(e,t),a.set(e,i),t||(Du.has(e)||e.removeAttribute(r),Du.delete(e)),i||e.removeAttribute(n)}),ku--,ku||(Eu=new WeakMap,Eu=new WeakMap,Du=new WeakMap,Ou={})}},Nu=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Tu(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Mu(r,i,n,`aria-hidden`)):function(){return null}},Pu=Object.defineProperty,Fu=(e,t)=>Pu(e,`name`,{value:t,configurable:!0}),Iu=`Dialog`,[Lu,Ru]=qs(Iu),[zu,Bu]=Lu(Iu),Vu=Fu(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=N.useRef(null),c=N.useRef(null),[l,u]=lc({prop:r,defaultProp:i??!1,onChange:a,caller:Iu}),[d,f]=N.useState(0),[p,m]=N.useState(0);return(0,P.jsx)(zu,{scope:t,triggerRef:s,contentRef:c,contentId:ec(),titleId:ec(),descriptionId:ec(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:N.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Hu=`DialogPortal`,[Uu,Wu]=Lu(Hu,{forceMount:void 0}),Gu=Fu(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Bu(Hu,t);return(0,P.jsx)(Uu,{scope:t,forceMount:n,children:N.Children.map(r,e=>(0,P.jsx)(il,{present:n||a.open,children:(0,P.jsx)(el,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ku=`DialogOverlay`,qu=N.forwardRef(Fu(function(e,t){let n=Wu(Ku,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Bu(Ku,e.__scopeDialog);return a.modal?(0,P.jsx)(il,{present:r||a.open,children:(0,P.jsx)(Yu,{...i,ref:t})}):null},`DialogOverlay`)),Ju=as(`DialogOverlay.RemoveScroll`),Yu=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(Ku,n),a=ns(t,Ac());return(0,P.jsx)(wu,{as:Ju,allowPinchZoom:!0,shards:[i.contentRef],children:(0,P.jsx)(_c.div,{"data-state":sd(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Xu=`DialogContent`,Zu=N.forwardRef(Fu(function(e,t){let n=Wu(Xu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Bu(Xu,e.__scopeDialog);return(0,P.jsx)(il,{present:r||a.open,children:a.modal?(0,P.jsx)(Qu,{...i,ref:t}):(0,P.jsx)($u,{...i,ref:t})})},`DialogContent`)),Qu=N.forwardRef(Fu(function(e,t){let n=Bu(Xu,e.__scopeDialog),r=N.useRef(null),i=ns(t,n.contentRef,r);return N.useEffect(()=>{let e=r.current;if(e)return Nu(e)},[]),(0,P.jsx)(ed,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:zs(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:zs(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:zs(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),$u=N.forwardRef(Fu(function(e,t){let n=Bu(Xu,e.__scopeDialog),r=N.useRef(!1),i=N.useRef(!1);return(0,P.jsx)(ed,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),ed=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Bu(Xu,n);return hl(),(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(Vc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,P.jsx)(kc,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":sd(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),td=`DialogTitle`,nd=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(td,n),{setTitleCount:a}=i;return Ys(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(_c.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),rd=`DialogDescription`,id=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(rd,n),{setDescriptionCount:a}=i;return Ys(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(_c.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ad=`DialogClose`,od=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(ad,n);return(0,P.jsx)(_c.button,{type:`button`,...r,ref:t,onClick:zs(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function sd(e){return e?`open`:`closed`}Fu(sd,`getState`);function cd({brand:e,visual:t,auth:n,mobileAuth:r,className:i,...a}){return(0,P.jsxs)(`section`,{className:R(`homepage-entry`,i),...a,children:[(0,P.jsxs)(`div`,{className:`homepage-entry-desktop`,children:[(0,P.jsxs)(`section`,{className:`homepage-entry-visual-column`,"aria-label":`Tutti product preview`,children:[(0,P.jsx)(`div`,{className:`homepage-entry-brand`,children:e}),(0,P.jsx)(`div`,{className:`homepage-entry-visual`,children:t})]}),(0,P.jsx)(`aside`,{className:`homepage-entry-auth-rail`,"aria-label":`Sign in to Tutti`,children:(0,P.jsx)(`div`,{className:`homepage-entry-auth-content`,children:n})})]}),(0,P.jsxs)(`section`,{className:`homepage-entry-mobile`,"aria-label":`Sign in to Tutti`,children:[(0,P.jsx)(`div`,{className:`product-appbar`,children:e}),(0,P.jsx)(`div`,{className:`auth-shell`,children:r})]})]})}function ld({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,className:o,...s}){return(0,P.jsxs)(`form`,{className:R(`product-entry-auth-form`,o),...s,children:[(0,P.jsxs)(`header`,{className:`product-entry-auth-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]}),(0,P.jsx)(`div`,{className:`product-entry-auth-body`,children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-secondary`,children:a}),i===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-feedback`,children:i}),(0,P.jsx)(`footer`,{className:`product-entry-auth-footer`,children:r})]})}var ud=40.1,dd=ud+.6,fd={openingFadeEnd:1.05,chatEnd:7.45,scratchpadPanEnd:8.8,scratchpadEnd:17.8,runCursorStart:17.95,runCursorArrive:18.65,runClickStart:18.67,runEnd:18.9,executionPrepareEnd:20.35,executionImplementEnd:24.55,executionValidateEnd:26.35,executionComplete:28.15,executionEnd:28.95,fullWorkspace:30.95,artifactLive:30.55,artifactClick:32.65,artifactScroll:36.1,artifactScrollEnd:39.55,finalHoldEnd:ud,fadeEnd:dd},pd={centerX:.325,centerY:.25,scale:1.62},md={centerX:.325,centerY:.47,scale:1.64},hd={centerX:.855,centerY:.23,scale:1.72},gd={centerX:.855,centerY:.35,scale:1.72},_d={centerX:.855,centerY:.79,scale:1.72},vd={centerX:.5,centerY:.5,scale:1},yd=[{start:1.35,end:5.95,from:pd,to:md,linearPosition:!0},{start:7.45,end:8.8,from:md,to:hd},{start:8.8,end:14.3,from:hd,to:gd,linearPosition:!0},{start:14.6,end:17.8,from:gd,to:_d},{start:fd.executionEnd,end:fd.fullWorkspace,from:_d,to:vd}];function bd(e,t=0,n=1){return Math.min(n,Math.max(t,e))}function xd(e){return 1-(1-bd(e))**3}function Sd(e){let t=bd(e);return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function Cd(e){let t=bd(e);return t<.5?16*t**5:1-(-2*t+2)**5/2}function wd(e,t,n,r=xd){let i=Math.max(.001,n-t);return r(bd((e-t)/i))}function Td(e,t,n){return e+(t-e)*n}function Ed(e,t){let n=bd((t-e.start)/Math.max(.001,e.end-e.start)),r=e.linearPosition?n:Cd(n);return{centerX:Td(e.from.centerX,e.to.centerX,r),centerY:Td(e.from.centerY,e.to.centerY,r),scale:Td(e.from.scale,e.to.scale,e.linearPosition?n:Sd(n))}}function Dd(e){if(e<yd[0].start)return pd;for(let t of yd)if(e<=t.end)return e<t.start?t.from:Ed(t,e);return vd}function Od(e){return e>=fd.executionComplete?{id:`complete`,label:`Task completed`}:e>=fd.executionValidateEnd?{id:`update`,label:`Synchronizing project`}:e>=fd.executionImplementEnd?{id:`validate`,label:`Validating result`}:e>=fd.executionPrepareEnd?{id:`implement`,label:`Implementing with Codex`}:{id:`prepare`,label:`Preparing workspace`}}function kd(e){return wd(e,fd.artifactScroll,fd.artifactScrollEnd,Sd)}function H(e){return 1-wd(e,ud,dd,Sd)}var Ad=1500,jd=1e3,Md=2.5,Nd=`(min-width: 980px) and (prefers-reduced-motion: no-preference)`,Pd=(0,N.lazy)(async()=>({default:(await ya(()=>import(`./homepage-motion-scene-CV9ceFzS.js`),[])).HomepageMotionScene}));function Fd(e){let[t,n]=(0,N.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches);return(0,N.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function Id(){return Fd(Nd)}function Ld(e,t){let[n,r]=(0,N.useState)({elapsed:0,cycle:0}),i=(0,N.useRef)(null),a=dd+t;return(0,N.useEffect)(()=>{if(!e){i.current=null;return}let t=0,n=e=>{let o=i.current??e;i.current=e;let s=Math.min(.1,(e-o)/1e3);r(e=>{let t=e.elapsed+s;return t<a?{...e,elapsed:t}:{elapsed:t%a,cycle:e.cycle+1}}),t=window.requestAnimationFrame(n)};return t=window.requestAnimationFrame(n),()=>window.cancelAnimationFrame(t)},[a,e]),{cycle:n.cycle,time:Math.min(n.elapsed,dd)}}function Rd(e,t){let[n,r]=(0,N.useState)(0),i=(0,N.useRef)(t),a=(0,N.useRef)(!1);return i.current=t,(0,N.useEffect)(()=>{if(r(0),a.current=!1,!e)return;let t=0,n=null,o=e=>{n??=e;let s=Math.min((e-n)/1e3,dd);if(r(s),s>=dd){a.current||(a.current=!0,i.current());return}t=window.requestAnimationFrame(o)};return t=window.requestAnimationFrame(o),()=>window.cancelAnimationFrame(t)},[e]),n}function zd(e){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(0);return(0,N.useLayoutEffect)(()=>{if(!e)return;let n=t.current;if(n===null)return;let i=()=>{let e=n.getBoundingClientRect(),t=Math.min(e.width/Ad,e.height/jd);r(Number.isFinite(t)?t:0)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e]),{frameRef:t,masterScale:n}}function Bd({assets:e,enabled:t,sceneKey:n,time:r,className:i,...a}){let{frameRef:o,masterScale:s}=zd(t);return t?(0,P.jsx)(`div`,{ref:o,className:R(`homepage-motion-frame`,i),...a,children:(0,P.jsx)(`div`,{className:`homepage-motion-master`,style:{"--homepage-motion-scale":s},children:(0,P.jsx)(N.Suspense,{fallback:null,children:(0,P.jsx)(Pd,{time:r,assets:e},n)})})}):null}function Vd({assets:e,idleSeconds:t=Md,className:n,...r}){let i=Id(),a=Ld(i,Math.max(0,t));return(0,P.jsx)(Bd,{...r,assets:e,enabled:i,sceneKey:a.cycle,time:a.time,className:n})}function Hd({assets:e,onComplete:t,className:n,...r}){let i=Id(),a=Rd(i,(0,N.useCallback)(()=>t(),[t]));return(0,P.jsx)(Bd,{...r,assets:e,enabled:i,time:a,className:n})}function Ud({onOpen:e,onDismiss:t,className:n,...r}){return(0,P.jsxs)(`aside`,{className:R(`product-tour-pill`,n),"aria-label":`Product tour`,...r,children:[(0,P.jsxs)(Cs,{type:`button`,className:`product-tour-pill-open`,onClick:e,children:[(0,P.jsx)(`span`,{className:`product-tour-pill-icon`,"aria-hidden":`true`,children:(0,P.jsx)(pi,{})}),(0,P.jsxs)(`span`,{className:`product-tour-pill-copy`,children:[(0,P.jsx)(`strong`,{children:`New to Tutti?`}),(0,P.jsx)(`span`,{children:`Take a tour`})]})]}),(0,P.jsx)(xs,{type:`button`,className:`product-tour-pill-dismiss`,label:`Dismiss product tour`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`}),onClick:t})]})}function Wd({assets:e,open:t,onOpenChange:n}){let r=Id();return(0,N.useEffect)(()=>{t&&!r&&n(!1)},[r,n,t]),r?(0,P.jsx)(Vu,{open:t,onOpenChange:n,children:(0,P.jsxs)(Gu,{children:[(0,P.jsx)(qu,{className:`product-tour-dialog-overlay`}),(0,P.jsxs)(Zu,{className:`product-tour-dialog-content`,onInteractOutside:e=>e.preventDefault(),onPointerDownOutside:e=>e.preventDefault(),children:[(0,P.jsx)(nd,{className:`product-tour-dialog-title`,children:`Welcome to Tutti`}),(0,P.jsx)(od,{asChild:!0,children:(0,P.jsx)(xs,{type:`button`,className:`product-tour-dialog-close`,label:`Close product tour`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`})})}),t?(0,P.jsx)(Hd,{className:`product-tour-dialog-motion`,assets:e,onComplete:()=>n(!1)}):null]})]})}):null}function Gd({asChild:e=!1,className:t,...n}){return(0,P.jsx)(e?os:`section`,{className:R(`product-card`,t),...n})}function Kd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-header`,t),...n,children:e})}function qd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-body`,t),...n,children:e})}function Jd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-feedback`,t),...n,children:e})}function Yd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-footer`,t),...n,children:e})}function Xd({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,size:o=`standard`,className:s,...c}){return(0,P.jsx)(Gd,{className:R(`entry-card auth-card`,o===`wide`?`is-wide`:void 0,s),asChild:!0,children:(0,P.jsxs)(`form`,{...c,children:[(0,P.jsx)(`section`,{className:`auth-card-intro`,children:(0,P.jsxs)(Kd,{className:`auth-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]})}),(0,P.jsx)(`section`,{className:`auth-card-action`,children:(0,P.jsxs)(`div`,{className:`auth-card-action-content`,children:[(0,P.jsx)(qd,{children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`auth-card-secondary`,children:a}),i===void 0?null:(0,P.jsx)(Jd,{children:i}),(0,P.jsx)(Yd,{children:r})]})})]})})}function Zd({projectName:e,hostLabel:t,hostOnline:n=!1,members:r,invitedBy:i,className:a,...o}){return(0,P.jsxs)(`section`,{className:R(`invite-summary`,a),"aria-label":`Project invitation`,...o,children:[(0,P.jsxs)(`div`,{className:`invite-project`,children:[(0,P.jsx)(`h2`,{children:e}),(0,P.jsxs)(`p`,{className:R(`project-line`,n?`is-online`:`is-offline`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r===void 0?null:(0,P.jsx)(`div`,{className:`invite-members`,children:r}),i===void 0?null:(0,P.jsxs)(`div`,{className:`invite-meta`,children:[(0,P.jsx)(`span`,{children:`Invited by`}),(0,P.jsx)(`strong`,{children:i})]})]})}function Qd({label:e,value:t,action:n,className:r,...i}){return(0,P.jsxs)(`div`,{className:R(`account-row`,r),...i,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`strong`,{children:t})]}),n]})}function $d({title:e,accountName:t,accountAction:n,children:r,className:i,...a}){return(0,P.jsxs)(Gd,{className:R(`project-center-card`,i),...a,children:[(0,P.jsxs)(`header`,{className:`project-center-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),t===void 0&&n===void 0?null:(0,P.jsxs)(`div`,{className:`project-center-account`,"aria-label":t===void 0?`Page actions`:`Signed in user`,children:[t===void 0?null:(0,P.jsx)(`span`,{className:`project-center-account-name`,children:t}),n]})]}),r]})}function ef({children:e,className:t,...n}){return(0,P.jsx)(`section`,{className:R(`project-entry-grid`,t),"aria-label":`Project entry options`,...n,children:e})}function tf({icon:e,title:t,description:n}){return(0,P.jsxs)(`header`,{className:`project-entry-card-header`,children:[(0,P.jsx)(`span`,{className:`project-entry-card-icon`,"aria-hidden":`true`,children:e}),(0,P.jsxs)(`div`,{className:`project-entry-card-copy`,children:[(0,P.jsx)(`h2`,{children:t}),(0,P.jsx)(`p`,{children:n})]})]})}function nf({title:e,description:t,inputLabel:n,placeholder:r,value:i,error:a,actionLabel:o=`Continue`,onValueChange:s,className:c,...l}){return(0,P.jsxs)(`form`,{className:R(`project-entry-card project-join-card`,c),...l,children:[(0,P.jsx)(tf,{icon:(0,P.jsx)(ki,{}),title:e,description:t}),(0,P.jsxs)(`div`,{className:`project-entry-card-content project-join-card-content`,children:[(0,P.jsxs)(`div`,{className:`project-join-card-form-row`,children:[(0,P.jsx)(ks,{type:`text`,"aria-label":n,value:i,onChange:e=>s(e.target.value),...r===void 0?{}:{placeholder:r}}),(0,P.jsx)(`div`,{className:`project-join-card-actions`,children:(0,P.jsxs)(Ss,{type:`submit`,disabled:i.trim()===``,children:[o,(0,P.jsx)(ai,{"aria-hidden":`true`})]})})]}),a==null?null:(0,P.jsx)(Ps,{children:a})]})]})}function rf({title:e,description:t,commandLines:n,terminalLabel:r=`Install and start in your terminal`,copyLabel:i=`Copy`,onCopyCommands:a,className:o,...s}){return(0,P.jsxs)(`section`,{className:R(`project-entry-card project-launch-card`,o),...s,children:[(0,P.jsx)(tf,{icon:(0,P.jsx)(ea,{}),title:e,description:t}),(0,P.jsx)(`div`,{className:`project-entry-card-content project-launch-card-content`,children:(0,P.jsxs)(`div`,{className:`project-launch-terminal`,children:[(0,P.jsxs)(`div`,{className:`project-launch-terminal-bar`,children:[(0,P.jsx)(`span`,{children:r}),a===void 0?null:(0,P.jsxs)(Cs,{className:`project-launch-copy-button`,type:`button`,"aria-label":`Copy launch commands`,onClick:()=>a(n.join(`
|
|
51
|
-
`)),children:[(0,P.jsx)(vi,{"aria-hidden":`true`}),i]})]}),(0,P.jsx)(`pre`,{className:`project-launch-command-block`,"aria-label":`Launch commands`,children:(0,P.jsx)(`code`,{children:n.map(e=>(0,P.jsxs)(`span`,{className:`project-launch-command-line`,children:[(0,P.jsx)(`span`,{className:`project-launch-command-prompt`,"aria-hidden":`true`,children:`>`}),(0,P.jsx)(`span`,{children:e})]},e))})})]})})]})}function af({children:e,className:t,...n}){return(0,P.jsx)(`ul`,{className:R(`project-list`,t),"aria-label":`Recent projects`,...n,children:e})}function of({title:e,children:t,listLabel:n,summaryClassName:r,className:i,...a}){return(0,P.jsxs)(`details`,{className:R(`project-list-disclosure`,i),...a,children:[(0,P.jsxs)(`summary`,{className:R(`project-list-disclosure-summary`,r),children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsx)(ui,{"aria-hidden":`true`})]}),(0,P.jsx)(af,{...n===void 0?{}:{"aria-label":n},children:t})]})}function sf({title:e,statusLabel:t,online:n=!1,details:r,className:i,disabled:a,...o}){return(0,P.jsx)(`li`,{className:`project-list-item`,children:(0,P.jsxs)(`button`,{className:R(`project-list-row`,n?`is-online`:`is-offline`,i),type:`button`,disabled:a,...o,children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`small`,{children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r.map(e=>(0,P.jsxs)(`span`,{className:`project-list-detail`,children:[(0,P.jsx)(`small`,{children:e.label}),(0,P.jsx)(`strong`,{children:e.value})]},e.label)),(0,P.jsx)(ai,{"aria-hidden":`true`})]})})}function cf({children:e,className:t,...n}){return(0,P.jsx)(`li`,{className:R(`project-list-item project-list-state-row`,t),...n,children:e})}function lf({open:e,onOpenChange:t,title:n,description:r,children:i,closeDisabled:a=!1,explicitCloseOnly:o=!1,className:s}){return(0,P.jsxs)(Vu,{open:e,onOpenChange:e=>{(e||!a)&&t(e)},children:[(0,P.jsx)(qu,{className:`product-entry-dialog-overlay`}),(0,P.jsx)(Zu,{asChild:!0,onEscapeKeyDown:e=>{(a||o)&&e.preventDefault()},onInteractOutside:e=>{(a||o)&&e.preventDefault()},onPointerDownOutside:e=>{(a||o)&&e.preventDefault()},children:(0,P.jsxs)(Gd,{className:R(`product-entry-dialog-card`,s),children:[(0,P.jsxs)(`header`,{className:`product-entry-dialog-header`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(nd,{children:n}),r===void 0?null:(0,P.jsx)(id,{children:r})]}),(0,P.jsx)(od,{asChild:!0,children:(0,P.jsx)(xs,{type:`button`,label:`Close`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`}),disabled:a})})]}),i]})})]})}function uf({open:e,onOpenChange:t,steps:n,currentStep:r,children:i,action:a,backAction:o,feedback:s,closeDisabled:c=!1,explicitCloseOnly:l=!1,className:u,...d}){return(0,P.jsxs)(lf,{open:e,onOpenChange:t,title:`New project`,description:`Step ${r+1} of ${n.length}`,closeDisabled:c,explicitCloseOnly:l,className:`local-console-create-card`,children:[(0,P.jsx)(`ol`,{className:`local-console-create-steps`,"aria-label":`New project steps`,children:n.map((e,t)=>(0,P.jsxs)(`li`,{className:R(t===r?`is-current`:void 0,t<r?`is-complete`:void 0),"aria-current":t===r?`step`:void 0,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:t+1}),(0,P.jsx)(`small`,{children:e})]},e))}),(0,P.jsxs)(`form`,{className:R(`local-console-create-form`,u),...d,children:[(0,P.jsx)(`div`,{className:`local-console-create-body`,children:i}),s===void 0?null:(0,P.jsx)(`div`,{className:`local-console-create-feedback`,children:s}),(0,P.jsxs)(`footer`,{className:`local-console-create-actions`,children:[(0,P.jsx)(`div`,{children:o}),(0,P.jsx)(`div`,{children:a})]})]})]})}function df({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-form-grid`,t),...n,children:e})}function ff({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-inline-actions`,t),...n,children:e})}function pf({title:e,description:t,children:n,className:r,...i}){return(0,P.jsxs)(`section`,{className:R(`local-console-field-group`,r),...i,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`strong`,{children:e}),t===void 0?null:(0,P.jsx)(`small`,{children:t})]}),(0,P.jsx)(`div`,{className:`local-console-field-group-body`,children:n})]})}function mf({title:e,children:t,className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`local-console-project-section`,n),...r,children:[(0,P.jsx)(`header`,{className:`local-console-project-section-header`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsx)(af,{children:t})]})}function hf({children:e,className:t,...n}){return(0,P.jsx)(of,{title:`Unavailable`,className:R(`local-console-unavailable-projects`,t),summaryClassName:`local-console-project-section-header`,...n,children:e})}function gf({title:e,statusLabel:t,online:n=!1,path:r,createdLabel:i,providerLabel:a,providerStatus:o,highlighted:s=!1,actions:c,className:l,...u}){return(0,P.jsx)(`li`,{className:R(`project-list-item`,`local-console-project-item`,l),...u,children:(0,P.jsxs)(`div`,{className:R(`local-console-project-row`,n?`is-online`:`is-offline`,s?`is-highlighted`:void 0),children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`span`,{className:`local-console-project-title`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsxs)(`span`,{className:`local-console-project-signals`,children:[(0,P.jsxs)(`small`,{className:`local-console-runtime-status`,children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]}),(0,P.jsxs)(`small`,{className:R(`local-console-provider-status`,`is-${o}`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),a]})]})]}),(0,P.jsxs)(`span`,{className:`local-console-project-metadata`,children:[(0,P.jsx)(`strong`,{className:`local-console-project-date`,children:i}),(0,P.jsx)(`small`,{className:`local-console-project-path`,title:typeof r==`string`?r:void 0,children:r})]}),(0,P.jsx)(`span`,{className:`local-console-project-actions`,children:c})]})})}function _f(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var vf=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yf=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bf={};function xf(e,t){return((t||bf).jsx?yf:vf).test(e)}var Sf=/[ \t\n\f\r]/g;function Cf(e){return typeof e==`object`?e.type===`text`?wf(e.value):!1:wf(e)}function wf(e){return e.replace(Sf,``)===``}var Tf=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Tf.prototype.normal={},Tf.prototype.property={},Tf.prototype.space=void 0;function Ef(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Tf(n,r,t)}function Df(e){return e.toLowerCase()}var Of=class{constructor(e,t){this.attribute=t,this.property=e}};Of.prototype.attribute=``,Of.prototype.booleanish=!1,Of.prototype.boolean=!1,Of.prototype.commaOrSpaceSeparated=!1,Of.prototype.commaSeparated=!1,Of.prototype.defined=!1,Of.prototype.mustUseProperty=!1,Of.prototype.number=!1,Of.prototype.overloadedBoolean=!1,Of.prototype.property=``,Of.prototype.spaceSeparated=!1,Of.prototype.space=void 0;var kf=s({boolean:()=>U,booleanish:()=>jf,commaOrSpaceSeparated:()=>Ff,commaSeparated:()=>Pf,number:()=>W,overloadedBoolean:()=>Mf,spaceSeparated:()=>Nf}),Af=0,U=If(),jf=If(),Mf=If(),W=If(),Nf=If(),Pf=If(),Ff=If();function If(){return 2**++Af}var Lf=Object.keys(kf),Rf=class extends Of{constructor(e,t,n,r){let i=-1;if(super(e,t),zf(this,`space`,r),typeof n==`number`)for(;++i<Lf.length;){let e=Lf[i];zf(this,Lf[i],(n&kf[e])===kf[e])}}};Rf.prototype.defined=!0;function zf(e,t,n){n&&(e[t]=n)}function Bf(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Rf(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Df(r)]=r,n[Df(a.attribute)]=r}return new Tf(t,n,e.space)}var Vf=Bf({properties:{ariaActiveDescendant:null,ariaAtomic:jf,ariaAutoComplete:null,ariaBusy:jf,ariaChecked:jf,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:Nf,ariaCurrent:null,ariaDescribedBy:Nf,ariaDetails:null,ariaDisabled:jf,ariaDropEffect:Nf,ariaErrorMessage:null,ariaExpanded:jf,ariaFlowTo:Nf,ariaGrabbed:jf,ariaHasPopup:null,ariaHidden:jf,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nf,ariaLevel:W,ariaLive:null,ariaModal:jf,ariaMultiLine:jf,ariaMultiSelectable:jf,ariaOrientation:null,ariaOwns:Nf,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:jf,ariaReadOnly:jf,ariaRelevant:null,ariaRequired:jf,ariaRoleDescription:Nf,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:jf,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Hf(e,t){return t in e?e[t]:t}function Uf(e,t){return Hf(e,t.toLowerCase())}var Wf=Bf({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Pf,acceptCharset:Nf,accessKey:Nf,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:Nf,autoFocus:U,autoPlay:U,blocking:Nf,capture:null,charSet:null,checked:U,cite:null,className:Nf,cols:W,colSpan:null,content:null,contentEditable:jf,controls:U,controlsList:Nf,coords:W|Pf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Mf,draggable:jf,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:Nf,height:W,hidden:Mf,high:W,href:null,hrefLang:null,htmlFor:Nf,httpEquiv:Nf,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:Nf,itemRef:Nf,itemScope:U,itemType:Nf,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:U,optimum:W,pattern:null,ping:Nf,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:Nf,required:U,reversed:U,rows:W,rowSpan:W,sandbox:Nf,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:jf,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:jf,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Nf,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:jf,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:Uf}),Gf=Bf({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Ff,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:Nf,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pf,g2:Pf,glyphName:Pf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:Ff,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Nf,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ff,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ff,rev:Ff,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ff,requiredFeatures:Ff,requiredFonts:Ff,requiredFormats:Ff,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:Ff,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ff,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ff,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Hf}),Kf=Bf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),qf=Bf({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Uf}),Jf=Bf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Yf={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Xf=/[A-Z]/g,Zf=/-[a-z]/g,Qf=/^data[-\w.:]+$/i;function $f(e,t){let n=Df(t),r=t,i=Of;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Qf.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Zf,tp);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Zf.test(e)){let n=e.replace(Xf,ep);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Rf}return new i(r,t)}function ep(e){return`-`+e.toLowerCase()}function tp(e){return e.charAt(1).toUpperCase()}var np=Ef([Vf,Wf,Kf,qf,Jf],`html`),rp=Ef([Vf,Gf,Kf,qf,Jf],`svg`);function ip(e){return e.join(` `).trim()}var ap=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
50
|
+
`},yu=0,bu=[];function xu(e){var t=N.useRef([]),n=N.useRef([0,0]),r=N.useRef(),i=N.useState(yu++)[0],a=N.useState(Wl)[0],o=N.useRef(e);N.useEffect(function(){o.current=e},[e]),N.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=yl([e.lockRef.current],(e.shards||[]).map(gu),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=N.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=mu(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=su(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=su(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return pu(h,t,e,h===`h`?s:c,!0)},[]),c=N.useCallback(function(e){var n=e;if(!(!bu.length||bu[bu.length-1]!==a)){var r=`deltaY`in n?hu(n):mu(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&_u(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(gu).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=N.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Su(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=N.useCallback(function(e){n.current=mu(e),r.current=void 0},[]),d=N.useCallback(function(t){l(t.type,hu(t),t.target,s(t,e.lockRef.current))},[]),f=N.useCallback(function(t){l(t.type,mu(t),t.target,s(t,e.lockRef.current))},[]);N.useEffect(function(){return bu.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,nu),document.addEventListener(`touchmove`,c,nu),document.addEventListener(`touchstart`,u,nu),function(){bu=bu.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,nu),document.removeEventListener(`touchmove`,c,nu),document.removeEventListener(`touchstart`,u,nu)}},[]);var p=e.removeScrollBar,m=e.inert;return N.createElement(N.Fragment,null,m?N.createElement(a,{styles:vu(i)}):null,p?N.createElement($l,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Su(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Cu=Nl(Pl,xu),wu=N.forwardRef(function(e,t){return N.createElement(Il,_l({},e,{ref:t,sideCar:Cu}))});wu.classNames=Il.classNames;var Tu=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Eu=new WeakMap,Du=new WeakMap,Ou={},ku=0,Au=function(e){return e&&(e.host||Au(e.parentNode))},ju=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Au(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Mu=function(e,t,n,r){var i=ju(t,Array.isArray(e)?e:[e]);Ou[n]||(Ou[n]=new WeakMap);var a=Ou[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Eu.get(e)||0)+1,l=(a.get(e)||0)+1;Eu.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Du.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),ku++,function(){o.forEach(function(e){var t=Eu.get(e)-1,i=a.get(e)-1;Eu.set(e,t),a.set(e,i),t||(Du.has(e)||e.removeAttribute(r),Du.delete(e)),i||e.removeAttribute(n)}),ku--,ku||(Eu=new WeakMap,Eu=new WeakMap,Du=new WeakMap,Ou={})}},Nu=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Tu(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Mu(r,i,n,`aria-hidden`)):function(){return null}},Pu=Object.defineProperty,Fu=(e,t)=>Pu(e,`name`,{value:t,configurable:!0}),Iu=`Dialog`,[Lu,Ru]=qs(Iu),[zu,Bu]=Lu(Iu),Vu=Fu(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=N.useRef(null),c=N.useRef(null),[l,u]=lc({prop:r,defaultProp:i??!1,onChange:a,caller:Iu}),[d,f]=N.useState(0),[p,m]=N.useState(0);return(0,P.jsx)(zu,{scope:t,triggerRef:s,contentRef:c,contentId:ec(),titleId:ec(),descriptionId:ec(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:N.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Hu=`DialogPortal`,[Uu,Wu]=Lu(Hu,{forceMount:void 0}),Gu=Fu(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Bu(Hu,t);return(0,P.jsx)(Uu,{scope:t,forceMount:n,children:N.Children.map(r,e=>(0,P.jsx)(il,{present:n||a.open,children:(0,P.jsx)(el,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),Ku=`DialogOverlay`,qu=N.forwardRef(Fu(function(e,t){let n=Wu(Ku,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Bu(Ku,e.__scopeDialog);return a.modal?(0,P.jsx)(il,{present:r||a.open,children:(0,P.jsx)(Yu,{...i,ref:t})}):null},`DialogOverlay`)),Ju=as(`DialogOverlay.RemoveScroll`),Yu=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(Ku,n),a=ns(t,Ac());return(0,P.jsx)(wu,{as:Ju,allowPinchZoom:!0,shards:[i.contentRef],children:(0,P.jsx)(_c.div,{"data-state":sd(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Xu=`DialogContent`,Zu=N.forwardRef(Fu(function(e,t){let n=Wu(Xu,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Bu(Xu,e.__scopeDialog);return(0,P.jsx)(il,{present:r||a.open,children:a.modal?(0,P.jsx)(Qu,{...i,ref:t}):(0,P.jsx)($u,{...i,ref:t})})},`DialogContent`)),Qu=N.forwardRef(Fu(function(e,t){let n=Bu(Xu,e.__scopeDialog),r=N.useRef(null),i=ns(t,n.contentRef,r);return N.useEffect(()=>{let e=r.current;if(e)return Nu(e)},[]),(0,P.jsx)(ed,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:zs(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:zs(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:zs(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),$u=N.forwardRef(Fu(function(e,t){let n=Bu(Xu,e.__scopeDialog),r=N.useRef(!1),i=N.useRef(!1);return(0,P.jsx)(ed,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),ed=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Bu(Xu,n);return hl(),(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(Vc,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,P.jsx)(kc,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":sd(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),td=`DialogTitle`,nd=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(td,n),{setTitleCount:a}=i;return Ys(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(_c.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),rd=`DialogDescription`,id=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(rd,n),{setDescriptionCount:a}=i;return Ys(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,P.jsx)(_c.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),ad=`DialogClose`,od=N.forwardRef(Fu(function(e,t){let{__scopeDialog:n,...r}=e,i=Bu(ad,n);return(0,P.jsx)(_c.button,{type:`button`,...r,ref:t,onClick:zs(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function sd(e){return e?`open`:`closed`}Fu(sd,`getState`);function cd({brand:e,visual:t,auth:n,mobileAuth:r,className:i,...a}){return(0,P.jsxs)(`section`,{className:R(`homepage-entry`,i),...a,children:[(0,P.jsxs)(`div`,{className:`homepage-entry-desktop`,children:[(0,P.jsxs)(`section`,{className:`homepage-entry-visual-column`,"aria-label":`Tutti product preview`,children:[(0,P.jsx)(`div`,{className:`homepage-entry-brand`,children:e}),(0,P.jsx)(`div`,{className:`homepage-entry-visual`,children:t})]}),(0,P.jsx)(`aside`,{className:`homepage-entry-auth-rail`,"aria-label":`Sign in to Tutti`,children:(0,P.jsx)(`div`,{className:`homepage-entry-auth-content`,children:n})})]}),(0,P.jsxs)(`section`,{className:`homepage-entry-mobile`,"aria-label":`Sign in to Tutti`,children:[(0,P.jsx)(`div`,{className:`product-appbar`,children:e}),(0,P.jsx)(`div`,{className:`auth-shell`,children:r})]})]})}function ld({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,className:o,...s}){return(0,P.jsxs)(`form`,{className:R(`product-entry-auth-form`,o),...s,children:[(0,P.jsxs)(`header`,{className:`product-entry-auth-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]}),(0,P.jsx)(`div`,{className:`product-entry-auth-body`,children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-secondary`,children:a}),i===void 0?null:(0,P.jsx)(`div`,{className:`product-entry-auth-feedback`,children:i}),(0,P.jsx)(`footer`,{className:`product-entry-auth-footer`,children:r})]})}var ud=40.1,dd=ud+.6,fd={openingFadeEnd:1.05,chatEnd:7.45,scratchpadPanEnd:8.8,scratchpadEnd:17.8,runCursorStart:17.95,runCursorArrive:18.65,runClickStart:18.67,runEnd:18.9,executionPrepareEnd:20.35,executionImplementEnd:24.55,executionValidateEnd:26.35,executionComplete:28.15,executionEnd:28.95,fullWorkspace:30.95,artifactLive:30.55,artifactClick:32.65,artifactScroll:36.1,artifactScrollEnd:39.55,finalHoldEnd:ud,fadeEnd:dd},pd={centerX:.325,centerY:.25,scale:1.62},md={centerX:.325,centerY:.47,scale:1.64},hd={centerX:.855,centerY:.23,scale:1.72},gd={centerX:.855,centerY:.35,scale:1.72},_d={centerX:.855,centerY:.79,scale:1.72},vd={centerX:.5,centerY:.5,scale:1},yd=[{start:1.35,end:5.95,from:pd,to:md,linearPosition:!0},{start:7.45,end:8.8,from:md,to:hd},{start:8.8,end:14.3,from:hd,to:gd,linearPosition:!0},{start:14.6,end:17.8,from:gd,to:_d},{start:fd.executionEnd,end:fd.fullWorkspace,from:_d,to:vd}];function bd(e,t=0,n=1){return Math.min(n,Math.max(t,e))}function xd(e){return 1-(1-bd(e))**3}function Sd(e){let t=bd(e);return t<.5?4*t*t*t:1-(-2*t+2)**3/2}function Cd(e){let t=bd(e);return t<.5?16*t**5:1-(-2*t+2)**5/2}function wd(e,t,n,r=xd){let i=Math.max(.001,n-t);return r(bd((e-t)/i))}function Td(e,t,n){return e+(t-e)*n}function Ed(e,t){let n=bd((t-e.start)/Math.max(.001,e.end-e.start)),r=e.linearPosition?n:Cd(n);return{centerX:Td(e.from.centerX,e.to.centerX,r),centerY:Td(e.from.centerY,e.to.centerY,r),scale:Td(e.from.scale,e.to.scale,e.linearPosition?n:Sd(n))}}function Dd(e){if(e<yd[0].start)return pd;for(let t of yd)if(e<=t.end)return e<t.start?t.from:Ed(t,e);return vd}function Od(e){return e>=fd.executionComplete?{id:`complete`,label:`Task completed`}:e>=fd.executionValidateEnd?{id:`update`,label:`Synchronizing project`}:e>=fd.executionImplementEnd?{id:`validate`,label:`Validating result`}:e>=fd.executionPrepareEnd?{id:`implement`,label:`Implementing with Codex`}:{id:`prepare`,label:`Preparing workspace`}}function kd(e){return wd(e,fd.artifactScroll,fd.artifactScrollEnd,Sd)}function H(e){return 1-wd(e,ud,dd,Sd)}var Ad=1500,jd=1e3,Md=2.5,Nd=`(min-width: 980px) and (prefers-reduced-motion: no-preference)`,Pd=(0,N.lazy)(async()=>({default:(await ya(()=>import(`./homepage-motion-scene-ENUzAyyp.js`),[])).HomepageMotionScene}));function Fd(e){let[t,n]=(0,N.useState)(()=>typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(e).matches);return(0,N.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function Id(){return Fd(Nd)}function Ld(e,t){let[n,r]=(0,N.useState)({elapsed:0,cycle:0}),i=(0,N.useRef)(null),a=dd+t;return(0,N.useEffect)(()=>{if(!e){i.current=null;return}let t=0,n=e=>{let o=i.current??e;i.current=e;let s=Math.min(.1,(e-o)/1e3);r(e=>{let t=e.elapsed+s;return t<a?{...e,elapsed:t}:{elapsed:t%a,cycle:e.cycle+1}}),t=window.requestAnimationFrame(n)};return t=window.requestAnimationFrame(n),()=>window.cancelAnimationFrame(t)},[a,e]),{cycle:n.cycle,time:Math.min(n.elapsed,dd)}}function Rd(e,t){let[n,r]=(0,N.useState)(0),i=(0,N.useRef)(t),a=(0,N.useRef)(!1);return i.current=t,(0,N.useEffect)(()=>{if(r(0),a.current=!1,!e)return;let t=0,n=null,o=e=>{n??=e;let s=Math.min((e-n)/1e3,dd);if(r(s),s>=dd){a.current||(a.current=!0,i.current());return}t=window.requestAnimationFrame(o)};return t=window.requestAnimationFrame(o),()=>window.cancelAnimationFrame(t)},[e]),n}function zd(e){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(0);return(0,N.useLayoutEffect)(()=>{if(!e)return;let n=t.current;if(n===null)return;let i=()=>{let e=n.getBoundingClientRect(),t=Math.min(e.width/Ad,e.height/jd);r(Number.isFinite(t)?t:0)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);return a.observe(n),()=>a.disconnect()},[e]),{frameRef:t,masterScale:n}}function Bd({assets:e,enabled:t,sceneKey:n,time:r,className:i,...a}){let{frameRef:o,masterScale:s}=zd(t);return t?(0,P.jsx)(`div`,{ref:o,className:R(`homepage-motion-frame`,i),...a,children:(0,P.jsx)(`div`,{className:`homepage-motion-master`,style:{"--homepage-motion-scale":s},children:(0,P.jsx)(N.Suspense,{fallback:null,children:(0,P.jsx)(Pd,{time:r,assets:e},n)})})}):null}function Vd({assets:e,idleSeconds:t=Md,className:n,...r}){let i=Id(),a=Ld(i,Math.max(0,t));return(0,P.jsx)(Bd,{...r,assets:e,enabled:i,sceneKey:a.cycle,time:a.time,className:n})}function Hd({assets:e,onComplete:t,className:n,...r}){let i=Id(),a=Rd(i,(0,N.useCallback)(()=>t(),[t]));return(0,P.jsx)(Bd,{...r,assets:e,enabled:i,time:a,className:n})}function Ud({onOpen:e,onDismiss:t,className:n,...r}){return(0,P.jsxs)(`aside`,{className:R(`product-tour-pill`,n),"aria-label":`Product tour`,...r,children:[(0,P.jsxs)(Cs,{type:`button`,className:`product-tour-pill-open`,onClick:e,children:[(0,P.jsx)(`span`,{className:`product-tour-pill-icon`,"aria-hidden":`true`,children:(0,P.jsx)(pi,{})}),(0,P.jsxs)(`span`,{className:`product-tour-pill-copy`,children:[(0,P.jsx)(`strong`,{children:`New to Tutti?`}),(0,P.jsx)(`span`,{children:`Take a tour`})]})]}),(0,P.jsx)(xs,{type:`button`,className:`product-tour-pill-dismiss`,label:`Dismiss product tour`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`}),onClick:t})]})}function Wd({assets:e,open:t,onOpenChange:n}){let r=Id();return(0,N.useEffect)(()=>{t&&!r&&n(!1)},[r,n,t]),r?(0,P.jsx)(Vu,{open:t,onOpenChange:n,children:(0,P.jsxs)(Gu,{children:[(0,P.jsx)(qu,{className:`product-tour-dialog-overlay`}),(0,P.jsxs)(Zu,{className:`product-tour-dialog-content`,onInteractOutside:e=>e.preventDefault(),onPointerDownOutside:e=>e.preventDefault(),children:[(0,P.jsx)(nd,{className:`product-tour-dialog-title`,children:`Welcome to Tutti`}),(0,P.jsx)(od,{asChild:!0,children:(0,P.jsx)(xs,{type:`button`,className:`product-tour-dialog-close`,label:`Close product tour`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`})})}),t?(0,P.jsx)(Hd,{className:`product-tour-dialog-motion`,assets:e,onComplete:()=>n(!1)}):null]})]})}):null}function Gd({asChild:e=!1,className:t,...n}){return(0,P.jsx)(e?os:`section`,{className:R(`product-card`,t),...n})}function Kd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-header`,t),...n,children:e})}function qd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-body`,t),...n,children:e})}function Jd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-feedback`,t),...n,children:e})}function Yd({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`product-card-footer`,t),...n,children:e})}function Xd({title:e,description:t,children:n,action:r,feedback:i,secondaryAction:a,size:o=`standard`,className:s,...c}){return(0,P.jsx)(Gd,{className:R(`entry-card auth-card`,o===`wide`?`is-wide`:void 0,s),asChild:!0,children:(0,P.jsxs)(`form`,{...c,children:[(0,P.jsx)(`section`,{className:`auth-card-intro`,children:(0,P.jsxs)(Kd,{className:`auth-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),(0,P.jsx)(`p`,{children:t})]})}),(0,P.jsx)(`section`,{className:`auth-card-action`,children:(0,P.jsxs)(`div`,{className:`auth-card-action-content`,children:[(0,P.jsx)(qd,{children:n}),a===void 0?null:(0,P.jsx)(`div`,{className:`auth-card-secondary`,children:a}),i===void 0?null:(0,P.jsx)(Jd,{children:i}),(0,P.jsx)(Yd,{children:r})]})})]})})}function Zd({projectName:e,hostLabel:t,hostOnline:n=!1,members:r,invitedBy:i,className:a,...o}){return(0,P.jsxs)(`section`,{className:R(`invite-summary`,a),"aria-label":`Project invitation`,...o,children:[(0,P.jsxs)(`div`,{className:`invite-project`,children:[(0,P.jsx)(`h2`,{children:e}),(0,P.jsxs)(`p`,{className:R(`project-line`,n?`is-online`:`is-offline`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r===void 0?null:(0,P.jsx)(`div`,{className:`invite-members`,children:r}),i===void 0?null:(0,P.jsxs)(`div`,{className:`invite-meta`,children:[(0,P.jsx)(`span`,{children:`Invited by`}),(0,P.jsx)(`strong`,{children:i})]})]})}function Qd({label:e,value:t,action:n,className:r,...i}){return(0,P.jsxs)(`div`,{className:R(`account-row`,r),...i,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsx)(`strong`,{children:t})]}),n]})}function $d({title:e,accountName:t,accountAction:n,children:r,className:i,...a}){return(0,P.jsxs)(Gd,{className:R(`project-center-card`,i),...a,children:[(0,P.jsxs)(`header`,{className:`project-center-card-header`,children:[(0,P.jsx)(`h1`,{children:e}),t===void 0&&n===void 0?null:(0,P.jsxs)(`div`,{className:`project-center-account`,"aria-label":t===void 0?`Page actions`:`Signed in user`,children:[t===void 0?null:(0,P.jsx)(`span`,{className:`project-center-account-name`,children:t}),n]})]}),r]})}function ef({children:e,className:t,...n}){return(0,P.jsx)(`section`,{className:R(`project-entry-grid`,t),"aria-label":`Project entry options`,...n,children:e})}function tf({icon:e,title:t,description:n}){return(0,P.jsxs)(`header`,{className:`project-entry-card-header`,children:[(0,P.jsx)(`span`,{className:`project-entry-card-icon`,"aria-hidden":`true`,children:e}),(0,P.jsxs)(`div`,{className:`project-entry-card-copy`,children:[(0,P.jsx)(`h2`,{children:t}),(0,P.jsx)(`p`,{children:n})]})]})}function nf({title:e,description:t,inputLabel:n,placeholder:r,value:i,error:a,actionLabel:o=`Continue`,onValueChange:s,className:c,...l}){return(0,P.jsxs)(`form`,{className:R(`project-entry-card project-join-card`,c),...l,children:[(0,P.jsx)(tf,{icon:(0,P.jsx)(ki,{}),title:e,description:t}),(0,P.jsxs)(`div`,{className:`project-entry-card-content project-join-card-content`,children:[(0,P.jsxs)(`div`,{className:`project-join-card-form-row`,children:[(0,P.jsx)(ks,{type:`text`,"aria-label":n,value:i,onChange:e=>s(e.target.value),...r===void 0?{}:{placeholder:r}}),(0,P.jsx)(`div`,{className:`project-join-card-actions`,children:(0,P.jsxs)(Ss,{type:`submit`,disabled:i.trim()===``,children:[o,(0,P.jsx)(ai,{"aria-hidden":`true`})]})})]}),a==null?null:(0,P.jsx)(Ps,{children:a})]})]})}function rf({title:e,description:t,commandLines:n,terminalLabel:r=`Install and start in your terminal`,copyLabel:i=`Copy`,onCopyCommands:a,className:o,...s}){return(0,P.jsxs)(`section`,{className:R(`project-entry-card project-launch-card`,o),...s,children:[(0,P.jsx)(tf,{icon:(0,P.jsx)(ea,{}),title:e,description:t}),(0,P.jsx)(`div`,{className:`project-entry-card-content project-launch-card-content`,children:(0,P.jsxs)(`div`,{className:`project-launch-terminal`,children:[(0,P.jsxs)(`div`,{className:`project-launch-terminal-bar`,children:[(0,P.jsx)(`span`,{children:r}),a===void 0?null:(0,P.jsxs)(Cs,{className:`project-launch-copy-button`,type:`button`,"aria-label":`Copy launch commands`,onClick:()=>a(n.join(`
|
|
51
|
+
`)),children:[(0,P.jsx)(vi,{"aria-hidden":`true`}),i]})]}),(0,P.jsx)(`pre`,{className:`project-launch-command-block`,"aria-label":`Launch commands`,children:(0,P.jsx)(`code`,{children:n.map(e=>(0,P.jsxs)(`span`,{className:`project-launch-command-line`,children:[(0,P.jsx)(`span`,{className:`project-launch-command-prompt`,"aria-hidden":`true`,children:`>`}),(0,P.jsx)(`span`,{children:e})]},e))})})]})})]})}function af({children:e,className:t,...n}){return(0,P.jsx)(`ul`,{className:R(`project-list`,t),"aria-label":`Recent projects`,...n,children:e})}function of({title:e,children:t,listLabel:n,summaryClassName:r,className:i,...a}){return(0,P.jsxs)(`details`,{className:R(`project-list-disclosure`,i),...a,children:[(0,P.jsxs)(`summary`,{className:R(`project-list-disclosure-summary`,r),children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsx)(ui,{"aria-hidden":`true`})]}),(0,P.jsx)(af,{...n===void 0?{}:{"aria-label":n},children:t})]})}function sf({title:e,statusLabel:t,online:n=!1,details:r,className:i,disabled:a,...o}){return(0,P.jsx)(`li`,{className:`project-list-item`,children:(0,P.jsxs)(`button`,{className:R(`project-list-row`,n?`is-online`:`is-offline`,i),type:`button`,disabled:a,...o,children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`small`,{children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]})]}),r.map(e=>(0,P.jsxs)(`span`,{className:`project-list-detail`,children:[(0,P.jsx)(`small`,{children:e.label}),(0,P.jsx)(`strong`,{children:e.value})]},e.label)),(0,P.jsx)(ai,{"aria-hidden":`true`})]})})}function cf({children:e,className:t,...n}){return(0,P.jsx)(`li`,{className:R(`project-list-item project-list-state-row`,t),...n,children:e})}function lf({open:e,onOpenChange:t,title:n,description:r,children:i,closeDisabled:a=!1,explicitCloseOnly:o=!1,className:s}){return(0,P.jsxs)(Vu,{open:e,onOpenChange:e=>{(e||!a)&&t(e)},children:[(0,P.jsx)(qu,{className:`product-entry-dialog-overlay`}),(0,P.jsx)(Zu,{asChild:!0,onEscapeKeyDown:e=>{(a||o)&&e.preventDefault()},onInteractOutside:e=>{(a||o)&&e.preventDefault()},onPointerDownOutside:e=>{(a||o)&&e.preventDefault()},children:(0,P.jsxs)(Gd,{className:R(`product-entry-dialog-card`,s),children:[(0,P.jsxs)(`header`,{className:`product-entry-dialog-header`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(nd,{children:n}),r===void 0?null:(0,P.jsx)(id,{children:r})]}),(0,P.jsx)(od,{asChild:!0,children:(0,P.jsx)(xs,{type:`button`,label:`Close`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`}),disabled:a})})]}),i]})})]})}function uf({open:e,onOpenChange:t,steps:n,currentStep:r,children:i,action:a,backAction:o,feedback:s,closeDisabled:c=!1,explicitCloseOnly:l=!1,className:u,...d}){return(0,P.jsxs)(lf,{open:e,onOpenChange:t,title:`New project`,description:`Step ${r+1} of ${n.length}`,closeDisabled:c,explicitCloseOnly:l,className:`local-console-create-card`,children:[(0,P.jsx)(`ol`,{className:`local-console-create-steps`,"aria-label":`New project steps`,children:n.map((e,t)=>(0,P.jsxs)(`li`,{className:R(t===r?`is-current`:void 0,t<r?`is-complete`:void 0),"aria-current":t===r?`step`:void 0,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,children:t+1}),(0,P.jsx)(`small`,{children:e})]},e))}),(0,P.jsxs)(`form`,{className:R(`local-console-create-form`,u),...d,children:[(0,P.jsx)(`div`,{className:`local-console-create-body`,children:i}),s===void 0?null:(0,P.jsx)(`div`,{className:`local-console-create-feedback`,children:s}),(0,P.jsxs)(`footer`,{className:`local-console-create-actions`,children:[(0,P.jsx)(`div`,{children:o}),(0,P.jsx)(`div`,{children:a})]})]})]})}function df({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-form-grid`,t),...n,children:e})}function ff({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`local-console-inline-actions`,t),...n,children:e})}function pf({title:e,description:t,children:n,className:r,...i}){return(0,P.jsxs)(`section`,{className:R(`local-console-field-group`,r),...i,children:[(0,P.jsxs)(`header`,{children:[(0,P.jsx)(`strong`,{children:e}),t===void 0?null:(0,P.jsx)(`small`,{children:t})]}),(0,P.jsx)(`div`,{className:`local-console-field-group-body`,children:n})]})}function mf({title:e,children:t,className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`local-console-project-section`,n),...r,children:[(0,P.jsx)(`header`,{className:`local-console-project-section-header`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsx)(af,{children:t})]})}function hf({children:e,className:t,...n}){return(0,P.jsx)(of,{title:`Unavailable`,className:R(`local-console-unavailable-projects`,t),summaryClassName:`local-console-project-section-header`,...n,children:e})}function gf({title:e,statusLabel:t,online:n=!1,path:r,createdLabel:i,providerLabel:a,providerStatus:o,actions:s,className:c,...l}){return(0,P.jsx)(`li`,{className:R(`project-list-item`,`local-console-project-item`,c),...l,children:(0,P.jsxs)(`div`,{className:R(`local-console-project-row`,n?`is-online`:`is-offline`),children:[(0,P.jsxs)(`span`,{className:`project-list-identity`,children:[(0,P.jsx)(`span`,{className:`local-console-project-title`,children:(0,P.jsx)(`strong`,{children:e})}),(0,P.jsxs)(`span`,{className:`local-console-project-signals`,children:[(0,P.jsxs)(`small`,{className:`local-console-runtime-status`,children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),t]}),(0,P.jsxs)(`small`,{className:R(`local-console-provider-status`,`is-${o}`),children:[(0,P.jsx)(`span`,{className:`status-dot`,"aria-hidden":`true`}),a]})]})]}),(0,P.jsxs)(`span`,{className:`local-console-project-metadata`,children:[(0,P.jsx)(`strong`,{className:`local-console-project-date`,children:i}),(0,P.jsx)(`small`,{className:`local-console-project-path`,title:typeof r==`string`?r:void 0,children:r})]}),(0,P.jsx)(`span`,{className:`local-console-project-actions`,children:s})]})})}function _f(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var vf=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yf=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,bf={};function xf(e,t){return((t||bf).jsx?yf:vf).test(e)}var Sf=/[ \t\n\f\r]/g;function Cf(e){return typeof e==`object`?e.type===`text`?wf(e.value):!1:wf(e)}function wf(e){return e.replace(Sf,``)===``}var Tf=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Tf.prototype.normal={},Tf.prototype.property={},Tf.prototype.space=void 0;function Ef(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Tf(n,r,t)}function Df(e){return e.toLowerCase()}var Of=class{constructor(e,t){this.attribute=t,this.property=e}};Of.prototype.attribute=``,Of.prototype.booleanish=!1,Of.prototype.boolean=!1,Of.prototype.commaOrSpaceSeparated=!1,Of.prototype.commaSeparated=!1,Of.prototype.defined=!1,Of.prototype.mustUseProperty=!1,Of.prototype.number=!1,Of.prototype.overloadedBoolean=!1,Of.prototype.property=``,Of.prototype.spaceSeparated=!1,Of.prototype.space=void 0;var kf=s({boolean:()=>U,booleanish:()=>jf,commaOrSpaceSeparated:()=>Ff,commaSeparated:()=>Pf,number:()=>W,overloadedBoolean:()=>Mf,spaceSeparated:()=>Nf}),Af=0,U=If(),jf=If(),Mf=If(),W=If(),Nf=If(),Pf=If(),Ff=If();function If(){return 2**++Af}var Lf=Object.keys(kf),Rf=class extends Of{constructor(e,t,n,r){let i=-1;if(super(e,t),zf(this,`space`,r),typeof n==`number`)for(;++i<Lf.length;){let e=Lf[i];zf(this,Lf[i],(n&kf[e])===kf[e])}}};Rf.prototype.defined=!0;function zf(e,t,n){n&&(e[t]=n)}function Bf(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Rf(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Df(r)]=r,n[Df(a.attribute)]=r}return new Tf(t,n,e.space)}var Vf=Bf({properties:{ariaActiveDescendant:null,ariaAtomic:jf,ariaAutoComplete:null,ariaBusy:jf,ariaChecked:jf,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:Nf,ariaCurrent:null,ariaDescribedBy:Nf,ariaDetails:null,ariaDisabled:jf,ariaDropEffect:Nf,ariaErrorMessage:null,ariaExpanded:jf,ariaFlowTo:Nf,ariaGrabbed:jf,ariaHasPopup:null,ariaHidden:jf,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nf,ariaLevel:W,ariaLive:null,ariaModal:jf,ariaMultiLine:jf,ariaMultiSelectable:jf,ariaOrientation:null,ariaOwns:Nf,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:jf,ariaReadOnly:jf,ariaRelevant:null,ariaRequired:jf,ariaRoleDescription:Nf,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:jf,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Hf(e,t){return t in e?e[t]:t}function Uf(e,t){return Hf(e,t.toLowerCase())}var Wf=Bf({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Pf,acceptCharset:Nf,accessKey:Nf,action:null,allow:null,allowFullScreen:U,allowPaymentRequest:U,allowUserMedia:U,alt:null,as:null,async:U,autoCapitalize:null,autoComplete:Nf,autoFocus:U,autoPlay:U,blocking:Nf,capture:null,charSet:null,checked:U,cite:null,className:Nf,cols:W,colSpan:null,content:null,contentEditable:jf,controls:U,controlsList:Nf,coords:W|Pf,crossOrigin:null,data:null,dateTime:null,decoding:null,default:U,defer:U,dir:null,dirName:null,disabled:U,download:Mf,draggable:jf,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:U,formTarget:null,headers:Nf,height:W,hidden:Mf,high:W,href:null,hrefLang:null,htmlFor:Nf,httpEquiv:Nf,id:null,imageSizes:null,imageSrcSet:null,inert:U,inputMode:null,integrity:null,is:null,isMap:U,itemId:null,itemProp:Nf,itemRef:Nf,itemScope:U,itemType:Nf,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:U,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:U,muted:U,name:null,nonce:null,noModule:U,noValidate:U,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:U,optimum:W,pattern:null,ping:Nf,placeholder:null,playsInline:U,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:U,referrerPolicy:null,rel:Nf,required:U,reversed:U,rows:W,rowSpan:W,sandbox:Nf,scope:null,scoped:U,seamless:U,selected:U,shadowRootClonable:U,shadowRootDelegatesFocus:U,shadowRootMode:null,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:jf,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:U,useMap:null,value:jf,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Nf,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:U,declare:U,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:U,noHref:U,noShade:U,noWrap:U,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:jf,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:U,disableRemotePlayback:U,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:Uf}),Gf=Bf({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Ff,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:Nf,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:U,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Pf,g2:Pf,glyphName:Pf,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:Ff,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Nf,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ff,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ff,rev:Ff,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ff,requiredFeatures:Ff,requiredFonts:Ff,requiredFormats:Ff,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:Ff,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ff,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ff,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Hf}),Kf=Bf({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),qf=Bf({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Uf}),Jf=Bf({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Yf={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Xf=/[A-Z]/g,Zf=/-[a-z]/g,Qf=/^data[-\w.:]+$/i;function $f(e,t){let n=Df(t),r=t,i=Of;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Qf.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Zf,tp);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Zf.test(e)){let n=e.replace(Xf,ep);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Rf}return new i(r,t)}function ep(e){return`-`+e.toLowerCase()}function tp(e){return e.charAt(1).toUpperCase()}var np=Ef([Vf,Wf,Kf,qf,Jf],`html`),rp=Ef([Vf,Gf,Kf,qf,Jf],`svg`);function ip(e){return e.join(` `).trim()}var ap=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
52
52
|
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function ee(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),ee()}function _(e){return e?e.replace(l,p):p}t.exports=g})),op=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(ap());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),sp=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),cp=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(op()),r=sp();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),lp=dp(`end`),up=dp(`start`);function dp(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function fp(e){let t=up(e),n=lp(e);if(t&&n)return{start:t,end:n}}function pp(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?hp(e.position):`start`in e||`end`in e?hp(e):`line`in e||`column`in e?mp(e):``}function mp(e){return gp(e&&e.line)+`:`+gp(e&&e.column)}function hp(e){return mp(e&&e.start)+`-`+mp(e&&e.end)}function gp(e){return e&&typeof e==`number`?e:1}var _p=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=pp(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};_p.prototype.file=``,_p.prototype.name=``,_p.prototype.reason=``,_p.prototype.message=``,_p.prototype.stack=``,_p.prototype.column=void 0,_p.prototype.line=void 0,_p.prototype.ancestors=void 0,_p.prototype.cause=void 0,_p.prototype.fatal=void 0,_p.prototype.place=void 0,_p.prototype.ruleId=void 0,_p.prototype.source=void 0;var vp=l(cp(),1),yp={}.hasOwnProperty,bp=new Map,xp=/[A-Z]/g,Sp=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Cp=new Set([`td`,`th`]),wp=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Tp(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Ip(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Fp(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?rp:np,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Ep(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Ep(e,t,n){if(t.type===`element`)return Dp(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Op(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Ap(e,t,n);if(t.type===`mdxjsEsm`)return kp(e,t);if(t.type===`root`)return jp(e,t,n);if(t.type===`text`)return Mp(e,t)}function Dp(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=rp,e.schema=i),e.ancestors.push(t);let a=Hp(e,t.tagName,!1),o=Lp(e,t),s=zp(e,t);return Sp.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Cf(e):!0})),Np(e,o,a,t),Pp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Op(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Up(e,t.position)}function kp(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Up(e,t.position)}function Ap(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=rp,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Hp(e,t.name,!0),o=Rp(e,t),s=zp(e,t);return Np(e,o,a,t),Pp(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function jp(e,t,n){let r={};return Pp(r,zp(e,t)),e.create(t,e.Fragment,r,n)}function Mp(e,t){return t.value}function Np(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Pp(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Fp(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Ip(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=up(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Lp(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&yp.call(t.properties,i)){let a=Bp(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Cp.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Rp(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Up(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Up(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function zp(e,t){let n=[],r=-1,i=e.passKeys?new Map:bp;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Ep(e,a,o);s!==void 0&&n.push(s)}return n}function Bp(e,t,n){let r=$f(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?_f(n):ip(n)),r.property===`style`){let t=typeof n==`object`?n:Vp(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Wp(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Yf[r.property]||r.property:r.attribute,n]}}function Vp(e,t){try{return(0,vp.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new _p("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=wp+`#cannot-parse-style-attribute`,r}}function Hp(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=xf(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=xf(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return yp.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Up(e)}function Up(e,t){let n=new _p("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=wp+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Wp(e){let t={},n;for(n in e)yp.call(e,n)&&(t[Gp(n)]=e[n]);return t}function Gp(e){let t=e.replace(xp,Kp);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Kp(e){return`-`+e.toLowerCase()}var qp={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Jp={};function Yp(e,t){let n=t||Jp;return Xp(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Xp(e,t,n){if(Qp(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Zp(e.children,t,n)}return Array.isArray(e)?Zp(e,t,n):``}function Zp(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Xp(e[i],t,n);return r.join(``)}function Qp(e){return!!(e&&typeof e==`object`)}var $p=document.createElement(`i`);function em(e){let t=`&`+e+`;`;$p.innerHTML=t;let n=$p.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function tm(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function nm(e,t){return e.length>0?(tm(e,e.length,0,t),e):t}var rm={}.hasOwnProperty;function im(e){let t={},n=-1;for(;++n<e.length;)am(t,e[n]);return t}function am(e,t){let n;for(n in t){let r=(rm.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){rm.call(r,a)||(r[a]=[]);let e=i[a];om(r[a],Array.isArray(e)?e:e?[e]:[])}}}function om(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);tm(e,0,0,r)}function sm(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function cm(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var lm=bm(/[A-Za-z]/),um=bm(/[\dA-Za-z]/),dm=bm(/[#-'*+\--9=?A-Z^-~]/);function fm(e){return e!==null&&(e<32||e===127)}var pm=bm(/\d/),mm=bm(/[\dA-Fa-f]/),hm=bm(/[!-/:-@[-`{-~]/);function G(e){return e!==null&&e<-2}function gm(e){return e!==null&&(e<0||e===32)}function _m(e){return e===-2||e===-1||e===32}var vm=bm(/\p{P}|\p{S}/u),ym=bm(/\s/);function bm(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function xm(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&um(e.charCodeAt(n+1))&&um(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Sm(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return _m(r)?(e.enter(n),s(r)):t(r)}function s(r){return _m(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Cm={tokenize:wm};function wm(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Sm(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return G(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Tm={tokenize:Dm},Em={tokenize:Om};function Dm(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return tm(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Em,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Em,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return G(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;tm(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Om(e,t,n){return Sm(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function km(e){if(e===null||gm(e)||ym(e))return 1;if(vm(e))return 2}function Am(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var jm={name:`attention`,resolveAll:Mm,tokenize:Nm};function Mm(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Pm(d,-c),Pm(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=nm(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=nm(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=nm(l,Am(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=nm(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=nm(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,tm(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Nm(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=km(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=km(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Pm(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Fm={name:`autolink`,tokenize:Im};function Im(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return lm(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||um(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||um(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||fm(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):dm(t)?(e.consume(t),l):n(t)}function u(e){return um(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||um(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Lm={partial:!0,tokenize:Rm};function Rm(e,t,n){return r;function r(t){return _m(t)?Sm(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||G(e)?t(e):n(e)}}var zm={continuation:{tokenize:Vm},exit:Hm,name:`blockQuote`,tokenize:Bm};function Bm(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return _m(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Vm(e,t,n){let r=this;return i;function i(t){return _m(t)?Sm(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(zm,t,n)(r)}}function Hm(e){e.exit(`blockQuote`)}var Um={name:`characterEscape`,tokenize:Wm};function Wm(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return hm(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Gm={name:`characterReference`,tokenize:Km};function Km(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=um,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=mm,u):(e.enter(`characterReferenceValue`),a=7,o=pm,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===um&&!em(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var qm={partial:!0,tokenize:Xm},Jm={concrete:!0,name:`codeFenced`,tokenize:Ym};function Ym(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),_m(t)?Sm(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||G(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(qm,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||G(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):_m(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Sm(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||G(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||G(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&_m(t)?Sm(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||G(t)?e.check(qm,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||G(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),_m(t)?Sm(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),_m(t)?Sm(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||G(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Xm(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Zm={name:`codeIndented`,tokenize:$m},Qm={partial:!0,tokenize:eh};function $m(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Sm(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):G(t)?e.attempt(Qm,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||G(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function eh(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Sm(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):G(e)?i(e):n(e)}}var th={name:`codeText`,previous:rh,resolve:nh,tokenize:ih};function nh(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function rh(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function ih(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||G(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var ah=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&oh(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),oh(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),oh(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);oh(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);oh(this.left,t.reverse())}}};function oh(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function sh(e){let t={},n=-1,r,i,a,o,s,c,l,u=new ah(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,ch(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return tm(e,0,1/0,u.slice(0)),!l}function ch(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var lh={resolve:dh,tokenize:fh},uh={partial:!0,tokenize:ph};function dh(e){return sh(e),e}function fh(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):G(t)?e.check(uh,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function ph(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Sm(e,a,`linePrefix`)}function a(i){if(i===null||G(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function mh(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||fm(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||G(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||gm(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||fm(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function hh(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):G(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||G(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!_m(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function gh(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Sm(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||G(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function _h(e,t){let n;return r;function r(i){return G(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):_m(i)?Sm(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var vh={name:`definition`,tokenize:bh},yh={partial:!0,tokenize:xh};function bh(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return hh.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=cm(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return gm(t)?_h(e,l)(t):l(t)}function l(t){return mh(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(yh,d,d)(t)}function d(t){return _m(t)?Sm(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||G(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function xh(e,t,n){return r;function r(t){return gm(t)?_h(e,i)(t):n(t)}function i(t){return gh(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return _m(t)?Sm(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||G(e)?t(e):n(e)}}var Sh={name:`hardBreakEscape`,tokenize:Ch};function Ch(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return G(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var wh={name:`headingAtx`,resolve:Th,tokenize:Eh};function Th(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},tm(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Eh(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||gm(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||G(n)?(e.exit(`atxHeading`),t(n)):_m(n)?Sm(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||gm(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Dh=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Oh=[`pre`,`script`,`style`,`textarea`],kh={concrete:!0,name:`htmlFlow`,resolveTo:Mh,tokenize:Nh},Ah={partial:!0,tokenize:Fh},jh={partial:!0,tokenize:Ph};function Mh(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Nh(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:j):lm(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):lm(a)?(e.consume(a),i=4,r.interrupt?t:j):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:j):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:D:m):n(i)}function h(t){return lm(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||gm(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Oh.includes(l)?(i=1,r.interrupt?t(s):D(s)):Dh.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):D(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||um(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:D):n(i)}function v(t){return _m(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||lm(t)?(e.consume(t),b):_m(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||um(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):_m(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):_m(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||G(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||gm(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||_m(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),ee):n(t)}function ee(t){return t===null||G(t)?D(t):_m(t)?(e.consume(t),ee):n(t)}function D(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),M):t===63&&i===3?(e.consume(t),j):t===93&&i===5?(e.consume(t),ie):G(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Ah,ae,O)(t)):t===null||G(t)?(e.exit(`htmlFlowData`),O(t)):(e.consume(t),D)}function O(t){return e.check(jh,k,ae)(t)}function k(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||G(t)?O(t):(e.enter(`htmlFlowData`),D(t))}function ne(t){return t===45?(e.consume(t),j):D(t)}function A(t){return t===47?(e.consume(t),o=``,re):D(t)}function re(t){if(t===62){let n=o.toLowerCase();return Oh.includes(n)?(e.consume(t),M):D(t)}return lm(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):D(t)}function ie(t){return t===93?(e.consume(t),j):D(t)}function j(t){return t===62?(e.consume(t),M):t===45&&i===2?(e.consume(t),j):D(t)}function M(t){return t===null||G(t)?(e.exit(`htmlFlowData`),ae(t)):(e.consume(t),M)}function ae(n){return e.exit(`htmlFlow`),t(n)}}function Ph(e,t,n){let r=this;return i;function i(t){return G(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Fh(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Lm,t,n)}}var Ih={name:`htmlText`,tokenize:Lh};function Lh(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):lm(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):lm(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):G(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):G(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):G(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):G(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return lm(t)?(e.consume(t),S):n(t)}function S(t){return t===45||um(t)?(e.consume(t),S):C(t)}function C(t){return G(t)?(o=C,A(t)):_m(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||um(t)?(e.consume(t),w):t===47||t===62||gm(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||lm(t)?(e.consume(t),E):G(t)?(o=T,A(t)):_m(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||um(t)?(e.consume(t),E):ee(t)}function ee(t){return t===61?(e.consume(t),D):G(t)?(o=ee,A(t)):_m(t)?(e.consume(t),ee):T(t)}function D(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,O):G(t)?(o=D,A(t)):_m(t)?(e.consume(t),D):(e.consume(t),k)}function O(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):G(t)?(o=O,A(t)):(e.consume(t),O)}function k(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||gm(t)?T(t):(e.consume(t),k)}function te(e){return e===47||e===62||gm(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return _m(t)?Sm(e,ie,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ie(t)}function ie(t){return e.enter(`htmlTextData`),o(t)}}var Rh={name:`labelEnd`,resolveAll:Hh,resolveTo:Uh,tokenize:Wh},zh={tokenize:Gh},Bh={tokenize:Kh},Vh={tokenize:qh};function Hh(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&tm(e,0,e.length,n),e}function Uh(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=nm(s,e.slice(a+1,a+r+3)),s=nm(s,[[`enter`,u,t]]),s=nm(s,Am(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=nm(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=nm(s,e.slice(o+1)),s=nm(s,[[`exit`,c,t]]),tm(e,a,e.length,s),e}function Wh(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(cm(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(zh,u,o?u:d)(t):t===91?e.attempt(Bh,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Vh,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Gh(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return gm(t)?_h(e,a)(t):a(t)}function a(t){return t===41?u(t):mh(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return gm(t)?_h(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?gh(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return gm(t)?_h(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function Kh(e,t,n){let r=this;return i;function i(t){return hh.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(cm(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function qh(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Jh={name:`labelStartImage`,resolveAll:Rh.resolveAll,tokenize:Yh};function Yh(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Xh={name:`labelStartLink`,resolveAll:Rh.resolveAll,tokenize:Zh};function Zh(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Qh={name:`lineEnding`,tokenize:$h};function $h(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Sm(e,t,`linePrefix`)}}var eg={name:`thematicBreak`,tokenize:tg};function tg(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||G(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),_m(t)?Sm(e,s,`whitespace`)(t):s(t))}}var ng={continuation:{tokenize:og},exit:cg,name:`list`,tokenize:ag},rg={partial:!0,tokenize:lg},ig={partial:!0,tokenize:sg};function ag(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:pm(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(eg,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return pm(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Lm,r.interrupt?n:u,e.attempt(rg,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return _m(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function og(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Lm,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Sm(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!_m(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ig,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Sm(e,e.attempt(ng,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function sg(e,t,n){let r=this;return Sm(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function cg(e){e.exit(this.containerState.type)}function lg(e,t,n){let r=this;return Sm(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!_m(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ug={name:`setextUnderline`,resolveTo:dg,tokenize:fg};function dg(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function fg(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),_m(t)?Sm(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||G(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var pg={tokenize:mg};function mg(e){let t=this,n=e.attempt(Lm,r,e.attempt(this.parser.constructs.flowInitial,i,Sm(e,e.attempt(this.parser.constructs.flow,i,e.attempt(lh,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var hg={resolveAll:yg()},gg=vg(`string`),_g=vg(`text`);function vg(e){return{resolveAll:yg(e===`text`?bg:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function yg(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function bg(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var xg=s({attentionMarkers:()=>kg,contentInitial:()=>Cg,disable:()=>Ag,document:()=>Sg,flow:()=>Tg,flowInitial:()=>wg,insideSpan:()=>Og,string:()=>Eg,text:()=>Dg}),Sg={42:ng,43:ng,45:ng,48:ng,49:ng,50:ng,51:ng,52:ng,53:ng,54:ng,55:ng,56:ng,57:ng,62:zm},Cg={91:vh},wg={[-2]:Zm,[-1]:Zm,32:Zm},Tg={35:wh,42:eg,45:[ug,eg],60:kh,61:ug,95:eg,96:Jm,126:Jm},Eg={38:Gm,92:Um},Dg={[-5]:Qh,[-4]:Qh,[-3]:Qh,33:Jh,38:Gm,42:jm,60:[Fm,Ih],91:Xh,92:[Sh,Um],93:Rh,95:jm,96:th},Og={null:[jm,hg]},kg={null:[42,95]},Ag={null:[]};function jg(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=nm(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Am(a,l.events,l),l.events):[]}function f(e,t){return Ng(p(e),t)}function p(e){return Mg(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){G(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&tm(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Mg(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Ng(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
53
53
|
`;break;case-3:o=`\r
|
|
54
54
|
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Pg(e){let t={constructs:im([xg,...(e||{}).extensions||[]]),content:n(Cm),defined:[],document:n(Tm),flow:n(pg),lazy:{},string:n(gg),text:n(_g)};return t;function n(e){return n;function n(n){return jg(t,e,n)}}}function Fg(e){for(;!sh(e););return e}var Ig=/[\0\t\n\r]/g;function Lg(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Ig.lastIndex=u,c=Ig.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Rg=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function zg(e){return e.replace(Rg,Bg)}function Bg(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return sm(n.slice(t?2:1),t?16:10)}return em(n)||e}var Vg={}.hasOwnProperty;function Hg(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Ug(n)(Fg(Pg(n).document().write(Lg()(e,t,!0))))}function Ug(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(Se),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(ve),blockQuote:a(pe),characterEscape:T,characterReference:T,codeFenced:a(me),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(me,o),codeText:a(he,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(_e),hardBreakEscape:a(ye),hardBreakTrailing:a(ye),htmlFlow:a(be,o),htmlFlowData:T,htmlText:a(be,o),htmlTextData:T,image:a(xe),label:o,link:a(Se),listItem:a(we),listItemValue:f,listOrdered:a(Ce,d),listUnordered:a(Ce),paragraph:a(Te),reference:oe,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(ve),strong:a(Ee),thematicBreak:a(Oe)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:fe,autolinkProtocol:de,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ue,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(O),htmlFlowData:E,htmlText:c(k),htmlTextData:E,image:c(A),label:ie,labelText:re,lineEnding:ee,link:c(ne),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:j,resourceTitleString:M,resource:ae,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};Gg(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Vg.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||qg).call(a,void 0,e[0])}for(r.position={start:Wg(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Wg(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Wg(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||qg).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+pp({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Wg(e.end)}function u(){return Yp(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=cm(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=De(),n.position={start:Wg(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Wg(e.end)}function ee(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Wg(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function D(){this.data.atHardBreak=!0}function O(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function A(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function re(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=zg(t),n.identifier=cm(t).toLowerCase()}function ie(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function M(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ae(){this.data.inReference=void 0}function oe(){this.data.referenceType=`collapsed`}function se(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=cm(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function ce(e){this.data.characterReferenceType=e.type}function le(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=sm(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=em(t);let i=this.stack[this.stack.length-1];i.value+=r}function ue(e){let t=this.stack.pop();t.position.end=Wg(e.end)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function pe(){return{type:`blockquote`,children:[]}}function me(){return{type:`code`,lang:null,meta:null,value:``}}function he(){return{type:`inlineCode`,value:``}}function ge(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function _e(){return{type:`emphasis`,children:[]}}function ve(){return{type:`heading`,depth:0,children:[]}}function ye(){return{type:`break`}}function be(){return{type:`html`,value:``}}function xe(){return{type:`image`,title:null,url:``,alt:null}}function Se(){return{type:`link`,title:null,url:``,children:[]}}function Ce(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function we(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function Te(){return{type:`paragraph`,children:[]}}function Ee(){return{type:`strong`,children:[]}}function De(){return{type:`text`,value:``}}function Oe(){return{type:`thematicBreak`}}}function Wg(e){return{line:e.line,column:e.column,offset:e.offset}}function Gg(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?Gg(e,r):Kg(e,r)}}function Kg(e,t){let n;for(n in t)if(Vg.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function qg(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+pp({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pp({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+pp({start:t.start,end:t.end})+`) is still open`)}function Jg(e){let t=this;t.parser=n;function n(n){return Hg(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Yg(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Xg(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
@@ -67,4 +67,4 @@ Error generating stack: `+e.message+`
|
|
|
67
67
|
`)||T!==e.length||!t.endsWith(`
|
|
68
68
|
`)||n!==t.length-1)return null;let r=e.slice(0,-1);if(!t.startsWith(r))return null;let i=t.slice(r.length,-1);return i===``?null:{nextValue:`${e}${i}`,nextCaret:e.length+i.length}},he=(e,t,n,r=!1)=>{let i=b.current;if(i===null)return{nextValue:e,nextCaret:t};let a=n??i.finalData;return a!==void 0&&(b.current={...i,finalData:a}),a!==void 0&&a!==``&&e.slice(i.start,i.start+i.data.length)===i.data&&e.slice(i.start+i.data.length,i.start+i.data.length+a.length)===a?(b.current=null,{nextValue:`${e.slice(0,i.start)}${e.slice(i.start+i.data.length)}`,nextCaret:Math.max(i.start,t-i.data.length)}):a!==void 0&&a!==``&&e.slice(i.start,i.start+a.length)===a?(b.current=null,{nextValue:e,nextCaret:t}):(r&&a!==void 0&&(b.current=null),{nextValue:e,nextCaret:t})},ge=()=>{let t=h.current,n=t===null||!ae(t)?T:se(t).end;if(dy(e,n)!==null){w(!0),E(n),D(0),le(n);return}let r=n===0?``:e[n-1]??``,i=r!==``&&cy.test(r)?` @`:`@`,a=`${e.slice(0,n)}${i}${e.slice(n)}`,o=n+i.length;w(!0),E(o),D(0),de(a,o)};(0,N.useEffect)(()=>{i===void 0||g.current===i||(g.current=i,ge())},[i]),(0,N.useEffect)(()=>{D(0)},[k?.start,k?.query]),(0,N.useLayoutEffect)(()=>{let t=h.current;if(t===null)return;let n=fy(e,k),r=hy(n);if(!v.current){let i=M(t)!==e,a=t.querySelector(`[data-mention-value]`)!==null,o=(gy(n)||a)&&x.current!==r;(i||o)&&_y(t,n),x.current=r,e===``&&(y.current=null,b.current=null)}_.current!==null&&(ce(t,_.current),_.current=null)},[k,e]);let _e=({clearCompositionSeedOnMiss:e=!1,compositionData:t}={})=>{let n=h.current;if(n===null)return;let r=he(M(n),se(n).end,t,e);de(r.nextValue,r.nextCaret)},ve=n=>{if(v.current||vy(n)){f?.(n);return}if(ne){if(n.key===`ArrowDown`){n.preventDefault(),D(e=>(e+1)%te.length);return}if(n.key===`ArrowUp`){n.preventDefault(),D(e=>(e-1+te.length)%te.length);return}if(n.key===`Enter`&&!n.shiftKey&&!n.metaKey||n.key===`Tab`){let e=te[A];if(e===void 0)return;n.preventDefault(),ue(e);return}}let i=h.current;if(i!==null&&(n.key===`Backspace`||n.key===`Delete`)){let t=se(i);if(t.start!==t.end){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.end)}`,t.start);return}if(n.key===`Backspace`&&t.start>0&&e[t.start-1]===`
|
|
69
69
|
`){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start-1)}${e.slice(t.start)}`,t.start-1);return}if(n.key===`Delete`&&e[t.start]===`
|
|
70
|
-
`){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}let r=py(e).find(r=>n.key===`Backspace`?t.start>r.start&&t.start<=r.end||t.start===r.end+1&&e[r.end]===` `:t.start>=r.start&&t.start<r.end);if(r!==void 0){n.preventDefault(),y.current=null,b.current=null;let i=n.key===`Backspace`&&t.start===r.end+1&&e[r.end]===` `?r.end+1:r.end;de(`${e.slice(0,r.start)}${e.slice(i)}`,r.start);return}if(n.key===`Backspace`&&t.start>0){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start-1)}${e.slice(t.start)}`,t.start-1);return}if(n.key===`Delete`&&t.start<e.length){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}}if(t&&n.key===`Enter`){if(n.preventDefault(),r&&!n.shiftKey&&!n.metaKey){i?.closest(`form`)?.requestSubmit();return}pe();return}if(!t&&n.key===`Enter`){n.preventDefault(),i?.closest(`form`)?.requestSubmit();return}f?.(n)},ye=t=>{if(v.current||vy(t))return;let n=h.current;if(n===null)return;let r=M(n),i=se(n).end,a=me(r,i),o=a?.nextValue??r,s=a?.nextCaret??i,c=yy(t);if(c.inputType===`insertText`&&by(c.data)){let t=s-c.data.length,n=`${o.slice(0,t)}${o.slice(s)}`;y.current=t>=0&&n===e?{data:c.data,start:t,end:s,valueBefore:n,createdAt:Date.now()}:null}else y.current=null;let l=he(o,s,void 0,!0);de(l.nextValue,l.nextCaret)},be=e=>{if(v.current||vy(e))return;let t=yy(e);if(t.inputType===`insertParagraph`||t.inputType===`insertLineBreak`){pe()&&e.preventDefault();return}y.current=null},xe=t=>{t.preventDefault();let n=t.clipboardData.getData(`text/plain`),r=h.current;if(r===null)return;let i=se(r);de(`${e.slice(0,i.start)}${n}${e.slice(i.end)}`,i.start+n.length)},Se=()=>{let e=h.current;e===null||!ae(e)||E(se(e).end)},Ce=R(`mention-input-editor`,t?`is-multiline`:`is-singleline`,c),we=ne?(0,P.jsx)(`div`,{className:`mention-menu`,id:S,role:`listbox`,"aria-label":`Mention people`,children:te.map((e,t)=>(0,P.jsx)(`button`,{className:R(`mention-option`,t===A?`is-selected`:void 0),type:`button`,role:`option`,id:`${S}-option-${t}`,"aria-selected":t===A,onMouseEnter:()=>D(t),onMouseDown:t=>{t.preventDefault(),ue(e)},children:(0,P.jsxs)(`span`,{className:`mention-option-text`,children:[`@`,e.handle]})},e.id))}):null,Te=a?.current;return(0,P.jsxs)(`span`,{className:R(`mention-input`,t?`is-multiline`:void 0),children:[(0,P.jsx)(`div`,{className:Ce,contentEditable:!ie,role:`textbox`,"aria-label":j,"aria-multiline":t,"aria-disabled":ie,"aria-expanded":ne,...ne?{"aria-controls":S}:{},...re===void 0?{}:{"aria-activedescendant":re},"data-placeholder":m.placeholder,"data-max-rows":n,onBlur:e=>{w(!1),l?.(e)},onClick:e=>{Se(),u?.(e)},onFocus:e=>{w(!0),Se(),d?.(e)},onCompositionStart:()=>{v.current=!0;let e=h.current,t=y.current;if(y.current=null,e!==null&&t!==null&&Date.now()-t.createdAt<500&&M(e).slice(t.start,t.end)===t.data){b.current=t,_.current=null,E(t.start),s(t.valueBefore);let n=fy(t.valueBefore,null);_y(e,n),x.current=hy(n),ce(e,t.start)}else b.current=null},onCompositionEnd:e=>{v.current=!1;let t=yy(e);_e(t.data===null?{}:{compositionData:t.data})},onBeforeInput:be,onInput:ye,onKeyDown:ve,onKeyUp:e=>{!v.current&&!vy(e)&&Se(),p?.(e)},onPaste:xe,ref:h,suppressContentEditableWarning:!0}),Te==null?we:(0,mc.createPortal)(we,Te)]})}function wy(e){return(0,P.jsx)(Fi,{...e})}function Ty({avatar:e,author:t,time:n,children:r,system:i=!1,className:a,...o}){return(0,P.jsxs)(`article`,{className:R(`message`,i?`is-system`:void 0,a),...o,children:[(0,P.jsxs)(`div`,{className:`message-byline`,children:[e,(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:t}),n===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:n})]})]}),(0,P.jsx)(`div`,{className:`message-content`,children:(0,P.jsx)(`div`,{className:`message-card`,children:r})})]})}function Ey({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`message-markdown`,t),...n,children:(0,P.jsx)(Zv,{components:Ly,children:e})})}function Dy({children:e}){return(0,P.jsx)(`p`,{children:xy(e)})}function Oy({children:e}){return(0,P.jsx)(`li`,{children:xy(e)})}function ky({children:e}){return(0,P.jsx)(`strong`,{children:xy(e)})}function Ay({children:e}){return(0,P.jsx)(`em`,{children:xy(e)})}function jy({children:e}){return(0,P.jsx)(`h1`,{children:xy(e)})}function My({children:e}){return(0,P.jsx)(`h2`,{children:xy(e)})}function Ny({children:e}){return(0,P.jsx)(`h3`,{children:xy(e)})}function Py({children:e}){return(0,P.jsx)(`h4`,{children:xy(e)})}function Fy({children:e}){return(0,P.jsx)(`h5`,{children:xy(e)})}function Iy({children:e}){return(0,P.jsx)(`h6`,{children:xy(e)})}var Ly={p:Dy,li:Oy,strong:ky,em:Ay,h1:jy,h2:My,h3:Ny,h4:Py,h5:Fy,h6:Iy};function Ry({name:e,category:t,imageUrl:n,className:r,"aria-label":i,...a}){let o=t===`image`&&n!==void 0;return(0,P.jsx)(`button`,{type:`button`,"aria-label":i??`Open ${t===`image`?`image`:`file`} ${e}`,className:R(`reference-message-card`,t===`image`?`is-image`:`is-file`,r),...a,children:o?(0,P.jsx)(`img`,{className:`reference-message-image`,src:n,alt:e,loading:`lazy`,decoding:`async`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`reference-message-icon`,"aria-hidden":`true`,children:t===`image`?(0,P.jsx)(Ei,{}):(0,P.jsx)(Ci,{})}),(0,P.jsx)(`span`,{className:`reference-message-main`,children:(0,P.jsx)(`strong`,{children:e})})]})})}function zy({children:e,composer:t,empty:n,title:r=`Chat`,subtitle:i,actions:a,streamRef:o,streamOverlay:s,onStreamScroll:c,dropUploadPending:l=!1,onDropFiles:u,className:d,...f}){return(0,P.jsxs)(iy,{className:R(`panel chat-panel chat-primary`,d),"aria-label":`Group chat`,dropLabel:`Drop references to upload`,pending:l,onFilesUpload:u,...f,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(wy,{"aria-hidden":`true`})}),(0,P.jsxs)(`div`,{className:`panel-title-copy`,children:[(0,P.jsx)(`h3`,{children:r}),i===void 0?null:(0,P.jsx)(`div`,{className:`panel-subtitle`,children:i})]})]}),a===void 0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:a})]}),(0,P.jsxs)(`div`,{className:`chat-stream-frame`,children:[(0,P.jsx)(`div`,{className:`chat-stream`,ref:o,onScroll:c,children:e??n}),s===void 0?null:(0,P.jsx)(`div`,{className:`chat-stream-overlay`,children:s})]}),t]})}function By({value:e,placeholder:t,ariaLabel:n,maxLength:r,saving:i=!1,disabled:a=!1,allowEmpty:o=!1,onUpdate:s,className:c,...l}){let u=(0,N.useRef)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(e),[h,g]=(0,N.useState)(!1),_=i||h,v=!a&&!_&&s!==void 0,y=e.trim(),b=y.length===0;(0,N.useEffect)(()=>{d||m(e)},[d,e]),(0,N.useEffect)(()=>{d&&(u.current?.focus(),u.current?.select())},[d]);let x=()=>{m(e),f(!1)},S=()=>{let e=p.trim();if(!o&&e.length===0){x();return}if(e===y){f(!1);return}s===void 0||_||(g(!0),Promise.resolve(s(e)).then(()=>{f(!1)}).catch(()=>void 0).finally(()=>{g(!1)}))},C=e=>{if(e.key===`Enter`){e.preventDefault(),S();return}e.key===`Escape`&&(e.preventDefault(),x())};return(0,P.jsx)(`span`,{className:R(`inline-editable-text`,b?`is-empty`:void 0,d?`is-editing`:void 0,v?void 0:`is-disabled`,c),...l,children:d?(0,P.jsx)(`input`,{ref:u,className:`inline-editable-text-input`,"aria-label":n,value:p,maxLength:r,disabled:_,onBlur:S,onChange:e=>m(e.currentTarget.value),onKeyDown:C}):(0,P.jsx)(`button`,{className:`inline-editable-text-button`,type:`button`,"aria-label":n,disabled:!v,onClick:()=>f(!0),children:b?t:y})})}var Vy={bare:``,quiet:`quiet-button`,pill:`pill-action`,action:`action-button`};function Hy({variant:e=`pill`,label:t,pendingLabel:n=t,pending:r=!1,disabled:i=!1,iconOnly:a=!1,accept:o,icon:s,onFileUpload:c,className:l,...u}){let d=i||r||c===void 0,f=r?n:t,p=e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t!==void 0&&c?.(t)};return(0,P.jsxs)(`label`,{...u,className:R(Vy[e],d?`is-disabled`:void 0,l),"aria-disabled":d,"aria-busy":r,"aria-label":u[`aria-label`]??f,title:u.title??f,children:[(0,P.jsx)(`input`,{type:`file`,accept:o,disabled:d,onChange:p}),s??(r?(0,P.jsx)(Mi,{className:`is-spinning`,"aria-hidden":`true`}):(0,P.jsx)(_i,{"aria-hidden":`true`})),a?null:(0,P.jsx)(`span`,{children:f})]})}function Uy({value:e,pending:t=!1,uploadPending:n=!1,placeholder:r=`Write a message`,mentionOptions:i,onValueChange:a,onComposerSubmit:o,onFileUpload:s,className:c,...l}){let[u,d]=(0,N.useState)(0),f=(0,N.useRef)(null);return(0,P.jsx)(`form`,{className:R(`composer`,c),"aria-label":`Message composer`,onSubmit:o,...l,children:(0,P.jsxs)(`div`,{className:`composer-input-shell`,ref:f,children:[(0,P.jsx)(Cy,{"aria-label":`Message`,placeholder:r,value:e,multiline:!0,maxRows:8,submitOnEnter:!0,mentionRequestKey:u,menuPortalTargetRef:f,...i===void 0?{}:{mentionOptions:i},onValueChange:a}),(0,P.jsxs)(`div`,{className:`composer-tools`,"aria-label":`Message tools`,children:[(0,P.jsx)(`button`,{className:`composer-tool-button composer-mention-button`,type:`button`,"aria-label":`Mention people`,title:`Mention people`,onClick:()=>d(e=>e+1),children:(0,P.jsx)(oi,{"aria-hidden":`true`})}),(0,P.jsx)(Hy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload image`,pendingLabel:`Uploading image`,pending:n,accept:`image/*`,icon:(0,P.jsx)(Ei,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(Hy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload file`,pendingLabel:`Uploading file`,pending:n,icon:(0,P.jsx)(Ci,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button`,type:`submit`,disabled:e.trim()===``||t,"aria-label":t?`Sending message`:`Send message`,title:t?`Sending message`:`Send message`,children:(0,P.jsx)(Ki,{"aria-hidden":`true`})})]})]})})}function Wy(e){return(0,P.jsx)(Ri,{...e})}var Gy={a:{advance:504,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 94.5 L346 284 L315 126 L315 31.5 L346 0 L378 0 L441 31.5 L472 63 L536 158`]},b:{advance:441,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 220 L63 31.5 L94.5 0 L126 0 L189 31.5 L252 94.5 L284 189 L284 284 L315 158 L346 126 L410 126 L472 158`]},c:{advance:346,strokes:[`M252 220 L252 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L220 0 L315 63 L378 158`]},d:{advance:504,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 94.5 L472 662`,`M346 284 L315 126 L315 31.5 L346 0 L378 0 L441 31.5 L472 63 L536 158`]},e:{advance:315,strokes:[`M63 63 L126 94.5 L158 126 L189 189 L189 252 L158 284 L126 284 L63 252 L31.5 189 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 63 L346 158`]},f:{advance:252,strokes:[`M31.5 158 L158 315 L220 410 L252 472 L284 567 L284 630 L252 662 L189 630 L158 567 L94.5 315 L0 31.5 L-94.5 -189 L-126 -284 L-126 -346 L-94.5 -378 L-31.5 -346 L0 -252 L31.5 31.5 L63 0 L126 0 L189 31.5 L220 63 L284 158`]},g:{advance:472,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 63`,`M346 284 L284 63 L158 -284 L126 -346 L63 -378 L31.5 -346 L31.5 -284 L63 -189 L158 -94.5 L252 -31.5 L315 0 L410 63 L504 158`]},h:{advance:472,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 252 L31.5 0`,`M31.5 0 L63 94.5 L94.5 158 L158 252 L220 284 L284 284 L315 252 L315 189 L284 94.5 L284 31.5 L315 0 L346 0 L410 31.5 L441 63 L504 158`]},i:{advance:220,strokes:[`M31.5 158 L94.5 284 L31.5 94.5 L31.5 31.5 L63 0 L94.5 0 L158 31.5 L189 63 L252 158`],accents:[`M126 441 L126 410 L158 410 L158 441 L126 441`]},j:{advance:220,strokes:[`M31.5 158 L94.5 284 L-94.5 -284 L-126 -346 L-189 -378 L-220 -346 L-220 -284 L-189 -189 L-94.5 -94.5 L0 -31.5 L63 0 L158 63 L252 158`],accents:[`M126 441 L126 410 L158 410 L158 441 L126 441`]},k:{advance:441,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 252 L31.5 0`,`M31.5 0 L63 94.5 L94.5 158 L158 252 L220 284 L284 284 L315 252 L315 189 L252 158 L158 158`,`M158 158 L220 126 L252 31.5 L284 0 L315 0 L378 31.5 L410 63 L472 158`]},l:{advance:252,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 220 L63 31.5 L94.5 0 L126 0 L189 31.5 L220 63 L284 158`]},m:{advance:788,strokes:[`M31.5 158 L94.5 252 L158 284 L189 252 L189 220 L158 94.5 L126 0`,`M158 94.5 L189 158 L252 252 L315 284 L378 284 L410 252 L410 220 L378 94.5 L346 0`,`M378 94.5 L410 158 L472 252 L536 284 L598 284 L630 252 L630 189 L598 94.5 L598 31.5 L630 0 L662 0 L724 31.5 L756 63 L819 158`]},n:{advance:567,strokes:[`M31.5 158 L94.5 252 L158 284 L189 252 L189 220 L158 94.5 L126 0`,`M158 94.5 L189 158 L252 252 L315 284 L378 284 L410 252 L410 189 L378 94.5 L378 31.5 L410 0 L441 0 L504 31.5 L536 63 L598 158`]},o:{advance:441,strokes:[`M220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 63 L315 126 L315 189 L284 252 L220 284 L189 252 L189 189 L220 126 L284 94.5 L378 94.5 L441 126 L472 158`]},p:{advance:472,strokes:[`M31.5 158 L94.5 252 L126 315 L94.5 189 L-94.5 -378`,`M94.5 189 L126 252 L189 284 L252 284 L315 252 L346 189 L346 126 L315 63 L284 31.5 L220 0`,`M94.5 31.5 L158 0 L252 0 L346 31.5 L410 63 L504 158`]},q:{advance:472,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5`,`M346 284 L315 189 L252 31.5 L158 -189 L126 -284 L126 -346 L158 -378 L220 -346 L252 -252 L252 -31.5 L315 0 L410 63 L504 158`]},r:{advance:410,strokes:[`M31.5 158 L94.5 252 L126 315 L126 252 L220 252 L252 220 L252 158 L220 63 L220 31.5 L252 0 L284 0 L346 31.5 L378 63 L441 158`]},s:{advance:346,strokes:[`M31.5 158 L94.5 252 L126 315 L126 252 L189 158 L220 94.5 L220 31.5 L158 0`,`M31.5 31.5 L94.5 0 L220 0 L284 31.5 L315 63 L378 158`]},t:{advance:284,strokes:[`M31.5 158 L94.5 252 L158 378`,`M252 662 L63 94.5 L63 31.5 L94.5 0 L158 0 L220 31.5 L252 63 L315 158`],accents:[`M63 410 L284 410`]},u:{advance:472,strokes:[`M31.5 158 L94.5 284 L31.5 94.5 L31.5 31.5 L63 0 L126 0 L189 31.5 L252 94.5 L315 189`,`M346 284 L284 94.5 L284 31.5 L315 0 L346 0 L410 31.5 L441 63 L504 158`]},v:{advance:472,strokes:[`M31.5 158 L94.5 284 L63 126 L63 31.5 L94.5 0 L126 0 L220 31.5 L284 94.5 L315 189 L315 284`,`M315 284 L346 158 L378 126 L441 126 L504 158`]},w:{advance:662,strokes:[`M126 284 L63 220 L31.5 126 L31.5 63 L63 0 L126 0 L189 31.5 L252 94.5`,`M315 284 L252 94.5 L252 31.5 L284 0 L346 0 L410 31.5 L472 94.5 L504 189 L504 284`,`M504 284 L536 158 L567 126 L630 126 L693 158`]},x:{advance:504,strokes:[`M31.5 158 L94.5 252 L158 284 L220 284 L252 252 L252 31.5 L284 0 L378 0 L472 63 L536 158`,`M441 252 L410 284 L346 284 L315 252 L189 31.5 L158 0 L94.5 0 L63 31.5`]},y:{advance:472,strokes:[`M31.5 158 L94.5 284 L31.5 94.5 L31.5 31.5 L63 0 L126 0 L189 31.5 L252 94.5 L315 189`,`M346 284 L158 -284 L126 -346 L63 -378 L31.5 -346 L31.5 -284 L63 -189 L158 -94.5 L252 -31.5 L315 0 L410 63 L504 158`]},z:{advance:441,strokes:[`M31.5 158 L94.5 252 L158 284 L220 284 L284 220 L284 158 L252 94.5 L189 31.5 L94.5 0 L158 -31.5 L189 -94.5 L189 -189 L158 -284 L126 -346 L63 -378 L31.5 -346 L31.5 -284 L63 -189 L158 -94.5 L252 -31.5 L378 63 L472 158`]}},Ky=[{id:`collaboration`,weight:30,words:`aligning.pairing.joining.syncing.sharing.weaving.blending.bridging.linking.merging.uniting.teaming.huddling.gathering.relaying.listening.helping.guiding.shaping.connecting.combining.supporting.assisting.exchanging.conversing.adapting.partnering.allying.chatting.consulting.conferring.responding.cooperating`.split(`.`)},{id:`context`,weight:35,words:`reading.noting.jotting.drafting.writing.mapping.sorting.sifting.grouping.capturing.recapping.reviewing.refining.distilling.curating.reflecting.outlining.planning.framing.clarifying.tracing.scanning.parsing.thinking.exploring.studying.checking.polishing.revising.editing.annotating.organizing.focusing.preparing.sketching.collecting.discerning.condensing.digesting.extracting.structuring.surfacing.orienting.grounding.noticing.pondering.considering.reasoning`.split(`.`)},{id:`music`,weight:25,words:`tuning.attuning.cueing.riffing.jamming.humming.echoing.arranging.composing.rehearsing.flowing.scoring.phrasing.voicing.conducting.playing.resonating.balancing.reprising.performing.grooving.tapping.strumming.singing.rhyming.dancing.swaying.drumming.plucking.chanting.whistling`.split(`.`)},{id:`playful`,weight:10,words:`brewing.steeping.simmering.whisking.doodling.tinkering.noodling.puzzling.sprouting.unfurling.vibing.musing.roaming.stitching.threading.blooming.glowing.buzzing.cooking.stirring.mixing.rolling.gliding.looping.twirling.dreaming.imagining.conjuring.hatching.unfolding.shuffling.percolating.scribbling.whittling.bubbling.fizzing.sparkling.whirring.wobbling.growing.ripening.wondering.inventing.crafting`.split(`.`)}];Ky.reduce((e,t)=>e+t.words.length,0);function qy(e){return Math.min(.999999,Math.max(0,e()))}function Jy(e,t){let n=[...e];for(let e=n.length-1;e>0;--e){let r=Math.floor(qy(t)*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}function Yy(e=Math.random,t=()=>!0){let n=Ky.map(e=>({...e,words:e.words.filter(t)})).filter(e=>e.words.length>0),r=n.length>0?n:Ky,i=new Map,a=r.reduce((e,t)=>e+t.weight,0),o;return()=>{let t=qy(e)*a,n=r.find(e=>(t-=e.weight,t<0))??r[0],s=i.get(n.id);(s===void 0||s.length===0)&&(s=Jy(n.words,e),i.set(n.id,s));let c=s.pop()??n.words[0];return c===o&&s.length>0&&(s.unshift(c),c=s.pop()??n.words[0]),o=c,c}}var Xy=.078,Zy=57,Qy=4,$y=.1,eb=.7,tb=.84,nb=.94,rb=.012,ib=1.5,ab=24;function ob(e,t,n){return Math.min(n,Math.max(t,e))}function sb(e){return e<.5?4*e*e*e:1-(-2*e+2)**3/2}function cb(e){return Number(e.toFixed(3)).toString()}function lb(e,t){let n=e.match(/-?\d+(?:\.\d+)?/gu)?.map(Number)??[],r=[];for(let e=0;e<n.length-1;e+=2)r.push({x:t+(n[e]??0)*Xy,y:Zy-(n[e+1]??0)*Xy});return r}function ub(e){if(e.length===0)return``;let t=e[0],n=[`M ${cb(t.x)} ${cb(t.y)}`];for(let t of e.slice(1))n.push(`L ${cb(t.x)} ${cb(t.y)}`);return n.join(` `)}function db(e){if(e.length<3)return[...e];let t=.22,n=[...e];for(let e=0;e<3;e+=1){let e=[n[0]];for(let r=0;r<n.length-1;r+=1){let i=n[r],a=n[r+1];e.push({x:i.x*(1-t)+a.x*t,y:i.y*(1-t)+a.y*t},{x:i.x*t+a.x*(1-t),y:i.y*t+a.y*(1-t)})}e.push(n[n.length-1]),n=e}return n}function fb(e){if(e.length<3)return ub(e);let t=.9,n=e[0],r=[`M ${cb(n.x)} ${cb(n.y)}`];for(let n=0;n<e.length-1;n+=1){let i=e[Math.max(0,n-1)],a=e[n],o=e[n+1],s=e[Math.min(e.length-1,n+2)],c={x:a.x+(o.x-i.x)*t/6,y:a.y+(o.y-i.y)*t/6},l={x:o.x-(s.x-a.x)*t/6,y:o.y-(s.y-a.y)*t/6};r.push(`C ${cb(c.x)} ${cb(c.y)} ${cb(l.x)} ${cb(l.y)} ${cb(o.x)} ${cb(o.y)}`)}return r.join(` `)}function pb(e){let t=Qy,n=[],r=[],i=[];for(let[a,o]of[...e.toLowerCase()].entries()){let e=Gy[o];if(e!==void 0){for(let[r,o]of e.strokes.entries()){let e=db(lb(o,t));i.push(...e),n.push({id:`${a}:body:${r}`,path:fb(e),role:`body`})}for(let[n,o]of(e.accents??[]).entries()){let e=lb(o,t);i.push(...e),r.push({id:`${a}:accent:${n}`,path:ub(e),role:`accent`})}t+=e.advance*Xy}}if(i.length===0)return{height:ab,strokes:[],viewBox:`0 0 64 64`,width:ab};let a=i.map(e=>e.x),o=i.map(e=>e.y),s=Math.floor(Math.min(0,...a.map(e=>e-6))),c=Math.ceil(Math.max(t,...a.map(e=>e+6))),l=Math.floor(Math.min(0,...o.map(e=>e-4))),u=Math.ceil(Math.max(64,...o.map(e=>e+4))),d=c-s,f=u-l;return{height:ab,strokes:[...n,...r],viewBox:`${s} ${l} ${d} ${f}`,width:Number((d*ab/f).toFixed(2))}}var mb=Yy(Math.random,e=>pb(e).width<=96);function hb(e){for(let t of e.strokes)t.path.style.opacity=`0`,t.path.style.strokeDashoffset=`${t.length}`}function gb(e){for(let t of e.strokes)t.path.style.opacity=`1`,t.path.style.strokeDashoffset=`0`}function _b(e,t,n){let r=t;for(let[t,i]of e.strokes.entries()){if(i.path.style.opacity=`${n}`,r<=0){i.path.style.strokeDashoffset=`${i.length}`;continue}let a=Math.min(i.length,r);if(i.path.style.strokeDashoffset=`${i.length-a}`,r-=a,a<i.length)break;if(t<e.strokes.length-1){if(r<e.transitionLength)break;r-=e.transitionLength}}}function vb(e,t){let n=t%e.duration/e.duration;if(n<$y||n>=nb){hb(e);return}if(n<=eb){_b(e,sb(ob((n-$y)/(eb-$y),0,1))*e.totalLength,1);return}let r=n<=tb?1:1-ob((n-tb)/(nb-tb),0,1);_b(e,e.totalLength,r)}function yb({word:e,className:t,...n}){let[r]=(0,N.useState)(()=>e??mb()),i=e??r,a=(0,N.useMemo)(()=>pb(i),[i]),o=(0,N.useRef)(null);return(0,N.useEffect)(()=>{let e=o.current;if(e===null)return;let t=[...e.querySelectorAll(`[data-writing-stroke]`)].map(e=>{let t=e.getTotalLength();return e.style.strokeDasharray=`${t} ${t}`,e.style.strokeDashoffset=`${t}`,{length:t,path:e}});if(t.length===0)return;let n=t.reduce((e,t)=>e+t.length,0),r=n*rb,i=n+r*Math.max(0,t.length-1),a={duration:ob(4e3+i*4.4,5e3,7600)*ib,strokes:t,totalLength:i,transitionLength:r},s=window.matchMedia(`(prefers-reduced-motion: reduce)`),c,l,u=()=>{c!==void 0&&(window.cancelAnimationFrame(c),c=void 0)},d=e=>{l===void 0&&(l=e-a.duration*$y),vb(a,e-l),c=window.requestAnimationFrame(d)},f=()=>{if(u(),s.matches){gb(a);return}hb(a),l=void 0,c=window.requestAnimationFrame(d)};return s.addEventListener(`change`,f),f(),()=>{s.removeEventListener(`change`,f),u()}},[a]),(0,P.jsxs)(`span`,{className:R(`scratchpad-writing-indicator`,t),role:`status`,"aria-label":`Refreshing Scratchpad`,"data-writing-word":i,...n,children:[(0,P.jsx)(zi,{"aria-hidden":`true`,className:`scratchpad-writing-icon`}),(0,P.jsx)(`svg`,{"aria-hidden":`true`,className:`scratchpad-writing-canvas`,focusable:`false`,height:a.height,ref:o,viewBox:a.viewBox,width:a.width,children:a.strokes.map(e=>(0,P.jsx)(`path`,{d:e.path,"data-writing-role":e.role,"data-writing-stroke":``},e.id))})]})}var bb={confirmed:(0,P.jsx)(li,{"aria-hidden":`true`}),question:(0,P.jsx)(pi,{"aria-hidden":`true`}),"task-change":(0,P.jsx)(Zi,{"aria-hidden":`true`})};function xb({kind:e,children:t,className:n,...r}){return(0,P.jsxs)(`div`,{className:R(`scratchpad-row`,`is-${e}`,n),...r,children:[(0,P.jsx)(`span`,{className:`scratchpad-marker`,"aria-hidden":`true`,children:bb[e]}),(0,P.jsx)(`p`,{children:t})]})}function Sb({compiledTasks:e=[],onOpenCompiledTask:t}){return(0,P.jsxs)(`section`,{className:`scratchpad-submitted-receipt`,"aria-label":`Submitted to Worklist`,children:[(0,P.jsx)(`strong`,{children:`Submitted to Worklist`}),e.length===0?(0,P.jsxs)(`div`,{className:`scratchpad-submitted-empty`,role:`status`,children:[(0,P.jsx)(Zi,{"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`scratchpad-submitted-empty-copy`,children:[(0,P.jsx)(`span`,{children:`No new task created`}),(0,P.jsx)(`small`,{children:`This Scratchpad was submitted, but no Worklist task was added.`})]})]}):(0,P.jsx)(`div`,{className:`scratchpad-submitted-task-list`,children:e.map(e=>(0,P.jsxs)(`button`,{className:`scratchpad-submitted-task`,disabled:t===void 0,onClick:()=>t?.(e.taskId),type:`button`,children:[(0,P.jsxs)(`span`,{className:`scratchpad-submitted-task-copy`,children:[(0,P.jsx)(`span`,{children:e.title}),(0,P.jsx)(`small`,{children:e.moduleName})]}),(0,P.jsx)(di,{"aria-hidden":`true`})]},e.taskId))})]})}function Cb({title:e,summary:t,sections:n,updatedLabel:r,updatedLabelPrefix:i=`Updated`,footerNote:a,submitAvailable:o,pages:s,empty:c,actionsDisabled:l=!1,compact:u=!1,syncPending:d=!1,submitPending:f=!1,onSubmitScratchpad:p,onOpenCompiledTask:m,className:h,...g}){let _=s!==void 0&&s.length>0,v=(0,N.useMemo)(()=>s!==void 0&&s.length>0?s:[{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}}],[a,s,n,o,t,e,r,i]),y=Math.max(0,v.length-1),b=v[y]?.key,[x,S]=(0,N.useState)(y);(0,N.useEffect)(()=>{S(y)},[y,b]);let C=Math.min(x,Math.max(0,v.length-1)),w=v[C]??{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}},T=d||f,E=w.submitAvailable??w.sections.length>0,ee=l||T||!E||w.submitted===!0;return(0,P.jsx)(ma,{title:`Scratchpad`,icon:(0,P.jsx)(Wy,{"aria-hidden":`true`}),className:R(`scratchpad-panel`,u?`is-compact`:void 0,h),"aria-busy":T,...g,children:(0,P.jsxs)(`div`,{className:`scratchpad-panel-body scratchpad`,children:[!_&&w.sections.length===0?c??(0,P.jsx)(`div`,{}):(0,P.jsxs)(`div`,{className:R(`scratchpad-content`,w.submitted===!0?`is-submitted`:void 0),children:[(0,P.jsx)(`div`,{className:`scratchpad-head`,children:(0,P.jsx)(`div`,{children:(0,P.jsx)(`h4`,{children:w.title})})}),(0,P.jsx)(`p`,{className:`scratchpad-summary`,children:w.summary}),w.sections.map(e=>(0,P.jsxs)(`section`,{className:`scratchpad-section`,"aria-labelledby":e.id,children:[(0,P.jsx)(`span`,{className:`scratchpad-label`,id:e.id,children:e.label}),(0,P.jsx)(`div`,{className:`scratchpad-list`,children:e.rows.map(t=>(0,P.jsx)(xb,{kind:t.kind,children:t.text},`${e.id}:${t.text}`))})]},e.id)),w.submitted===!0?(0,P.jsx)(Sb,{compiledTasks:w.compiledTasks??[],...m===void 0?{}:{onOpenCompiledTask:m}}):null]},w.key),!u&&v.length>1?(0,P.jsx)(`div`,{className:`scratchpad-history-nav`,children:(0,P.jsx)(pa,{"aria-label":`Scratchpad history`,currentPage:C,maxVisible:7,pageAriaLabel:e=>`Scratchpad page ${e+1}`,pageCount:v.length,onPageChange:S})}):null,(0,P.jsxs)(`div`,{className:`scratchpad-footer`,children:[w.footerNote===void 0?null:(0,P.jsx)(`p`,{className:R(`scratchpad-footer-note`,w.footerNote.tone===`error`?`is-error`:void 0),title:w.footerNote.text,children:w.footerNote.text}),u&&!d?null:(0,P.jsx)(`div`,{className:`scratchpad-submit-context`,children:d?(0,P.jsx)(yb,{}):w.updatedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`scratchpad-updated-at`,children:[(0,P.jsx)(`span`,{children:w.updatedLabelPrefix??`Updated`}),(0,P.jsx)(`span`,{children:w.updatedLabel})]})}),(0,P.jsx)(`div`,{className:`scratchpad-footer-actions`,children:(0,P.jsxs)(Ss,{className:R(`scratchpad-submit-button`,f?`is-submitting`:void 0),type:`button`,"aria-busy":f,disabled:ee,onClick:p,children:[f?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(Bi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:f?`Running`:`Run`})]})})]})]})})}function wb(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`pending`?(0,P.jsx)(na,{"aria-hidden":`true`}):e===`running`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(hi,{"aria-hidden":`true`})}function Tb(e){return e===`complete`?`Complete`:e===`failed`?`Failed`:e===`pending`?`Needs input`:`Running`}function Eb(e){return(0,P.jsx)(ra,{"aria-hidden":`true`,"data-tone":e})}function Db({title:e,summary:t,tone:n,steps:r,metaLabel:i,className:a,...o}){let s=i??Tb(n),c=o[`aria-label`]??`${e}. ${s}. ${t}`;return(0,P.jsx)(ma,{title:e,icon:Eb(n),className:R(`execution-progress-panel`,`is-${n}`,a),"aria-label":c,...o,children:(0,P.jsx)(`div`,{className:`execution-progress-body`,children:(0,P.jsx)(`div`,{className:`execution-progress-list`,children:r.map(e=>(0,P.jsxs)(`div`,{className:R(`execution-progress-step`,`is-${e.status}`),children:[(0,P.jsx)(`span`,{className:R(`execution-progress-marker`,`is-${e.status}`),"aria-hidden":`true`,children:wb(e.status)}),(0,P.jsxs)(`span`,{className:`execution-progress-step-content`,children:[(0,P.jsxs)(`span`,{className:`execution-progress-step-title`,children:[(0,P.jsx)(`span`,{className:`execution-progress-step-label`,children:e.label}),e.elapsedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`execution-progress-step-elapsed`,children:[` `,`(`,e.elapsedLabel,`)`]})]}),e.detail===void 0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-detail`,children:e.detail}),e.metrics===void 0||e.metrics.length===0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-metrics`,children:e.metrics.map(e=>(0,P.jsx)(`span`,{className:`execution-progress-step-metric`,children:e},e))})]})]},e.id))})})})}function Ob({tone:e=`neutral`,compact:t=!1,asChild:n=!1,className:r,...i}){return(0,P.jsx)(n?os:`div`,{className:R(`chat-event-card`,`is-${e}`,t?`is-compact`:void 0,r),...i})}function kb({as:e=`div`,icon:t,title:n,meta:r,action:i,className:a,...o}){return(0,P.jsxs)(e,{className:R(`chat-event-card-header`,a),...o,children:[(0,P.jsx)(Ab,{children:t}),(0,P.jsxs)(`span`,{className:`chat-event-card-title`,children:[(0,P.jsx)(`strong`,{children:n}),r===void 0?null:(0,P.jsx)(`span`,{className:`chat-event-card-meta`,children:r})]}),i]})}function Ab({className:e,...t}){return(0,P.jsx)(`span`,{className:R(`chat-event-card-status-icon`,e),...t})}function jb({className:e,...t}){return(0,P.jsx)(`div`,{className:R(`chat-event-card-body`,e),...t})}function Mb({className:e,...t}){return(0,P.jsx)(`footer`,{className:R(`chat-event-card-footer`,e),...t})}function Nb(e){return e===`done`?`success`:e===`failed`?`danger`:e===`pending`?`warning`:`neutral`}function Pb(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(ia,{"aria-hidden":`true`}):(0,P.jsx)(Pi,{"aria-hidden":`true`})}function Fb({title:e,summary:t,request:n,messages:r,draft:i,contextLabel:a,defaultOpen:o,readOnly:s=!1,replyCount:c,status:l,statusLabel:u,mentionOptions:d,sendPending:f=!1,submitPending:p=!1,onDraftChange:m,onSendMessage:h,onSubmitRound:g,className:_,...v}){let y=t.trim()===``?n:t,b=a===void 0?y:`${y} (${a})`,[x,S]=(0,N.useState)(o??!0),C=l??(s?`done`:`pending`),w=u??(s?`submitted`:`needs input`),T=c??r.length,E=p||T===0,ee=T===0?`No replies`:`${T} ${T===1?`reply`:`replies`}`,D=Nb(C),O=`${w} · ${ee}`,k=(0,P.jsxs)(jb,{className:`chat-clarification-card-body`,children:[(0,P.jsx)(`div`,{className:`chat-event-thread`,children:r.map(e=>(0,P.jsxs)(`article`,{className:`chat-event-message`,children:[e.avatar,(0,P.jsxs)(`div`,{className:`chat-event-message-copy`,children:[(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:e.author}),e.time===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:e.time})]}),(0,P.jsx)(`p`,{children:(0,P.jsx)(Sy,{children:e.body})})]})]},e.id))}),s?null:(0,P.jsx)(`form`,{className:`chat-event-composer`,"aria-label":`Round reply`,onSubmit:h,children:(0,P.jsxs)(`div`,{className:`composer-input-shell chat-event-composer-input-shell`,children:[(0,P.jsx)(Cy,{type:`text`,"aria-label":`Round message`,value:i,placeholder:`Reply in this round`,multiline:!0,maxRows:4,submitOnEnter:!0,...d===void 0?{}:{mentionOptions:d},onValueChange:m}),(0,P.jsx)(`div`,{className:`composer-tools chat-event-composer-tools`,"aria-label":`Round message tools`,children:(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button chat-event-send-button`,type:`submit`,disabled:i.trim()===``||f,"aria-label":f?`Sending round message`:`Send round message`,title:f?`Sending round message`:`Send round message`,children:(0,P.jsx)(Ki,{"aria-hidden":`true`})})})]})})]});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,_),...v,children:s?(0,P.jsx)(Ob,{tone:D,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-clarification-card`,open:x,"aria-label":b,onToggle:e=>S(e.currentTarget.open),children:[(0,P.jsx)(kb,{as:`summary`,icon:Pb(C),title:e,meta:O,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),k]})}):(0,P.jsx)(Ob,{tone:D,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-clarification-card is-fixed-open`,"aria-label":b,children:[(0,P.jsx)(kb,{icon:Pb(C),title:e,meta:O,tabIndex:-1,action:(0,P.jsxs)(Ss,{className:`chat-event-primary-action`,type:`button`,"aria-label":T===0?`Reply before submitting round`:`Submit round`,"aria-busy":p,disabled:E,title:T===0?`Reply before submitting round`:`Submit round`,onClick:g,children:[p?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`button-label`,children:p?`Submitting`:`Submit`})]})}),k]})})})}function Ib({decision:e,disabled:t,onDecide:n}){let r=e.tone===`primary`?Ss:Cs,i=e.decisionId.startsWith(`allow`)?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(ia,{"aria-hidden":`true`});return(0,P.jsxs)(r,{type:`button`,className:R(`chat-approval-card-decision`,e.tone===`primary`?`is-primary`:void 0,e.tone===`danger`?`is-danger`:void 0),disabled:t,onClick:()=>n(e.decisionId),children:[i,(0,P.jsx)(`span`,{className:`button-label`,children:e.label})]})}function Lb(e,t){return e===`pending`?`warning`:e===`resolved`?`success`:/expired|cancelled/iu.test(t)?`neutral`:`danger`}function Rb(e){return e===`success`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`danger`?(0,P.jsx)(ia,{"aria-hidden":`true`}):e===`neutral`?(0,P.jsx)(gi,{"aria-hidden":`true`}):(0,P.jsx)(Yi,{"aria-hidden":`true`})}function zb({title:e,summary:t,reason:n,status:r,statusLabel:i,detailLabel:a,detail:o,detailCode:s=!1,decisions:c=[],decisionPending:l=!1,resolutionLabel:u,defaultOpen:d,onDecide:f,className:p,...m}){let[h,g]=(0,N.useState)(d??r===`pending`),_=Lb(r,i),v=[...c].sort((e,t)=>e.tone===t.tone?0:e.tone===`primary`?-1:+(t.tone===`primary`)),y=r===`pending`&&f!==void 0?(0,P.jsx)(Mb,{className:`chat-approval-card-actions`,children:v.map(e=>(0,P.jsx)(Ib,{decision:e,disabled:l,onDecide:f},e.decisionId))}):null,b=(0,P.jsx)(jb,{className:`chat-approval-card-body`,children:(0,P.jsxs)(`div`,{className:`chat-approval-card-content`,children:[(0,P.jsx)(`p`,{className:`chat-approval-card-summary`,children:t}),n===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-reason`,children:n}),o===void 0?null:(0,P.jsxs)(`div`,{className:`chat-approval-card-detail`,children:[a===void 0?null:(0,P.jsx)(`span`,{className:`chat-approval-card-detail-label`,children:a}),s?(0,P.jsx)(`code`,{className:`chat-approval-card-detail-code`,children:o}):(0,P.jsx)(`span`,{className:`chat-approval-card-detail-text`,children:o})]}),r===`pending`||u===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-resolution`,children:u})]})});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,p),...m,children:r===`pending`?(0,P.jsx)(Ob,{tone:_,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-approval-card is-fixed-open`,"aria-label":t,children:[(0,P.jsx)(kb,{icon:Rb(_),title:e,meta:i,tabIndex:-1}),b,y]})}):(0,P.jsx)(Ob,{tone:_,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-approval-card`,open:h,"aria-label":t,onToggle:e=>g(e.currentTarget.open),children:[(0,P.jsx)(kb,{as:`summary`,icon:Rb(_),title:e,meta:i,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),b]})})})}function Bb({status:e,title:t,taskId:n,taskTitle:r,summary:i,moduleName:a,finalNote:o,generatedFiles:s=[],errorCode:c,onOpenTask:l,className:u,...d}){let f=o?.trim()??``,p=i.trim(),m=f.length>0?f:p,h=e===`completed`?`Task completed`:`Task failed`;return(0,P.jsx)(`article`,{className:R(`message is-chat-event is-task-result`,u),...d,children:(0,P.jsx)(Ob,{tone:e===`completed`?`success`:`danger`,compact:!0,asChild:!0,children:(0,P.jsxs)(`button`,{className:R(`chat-task-result-card`,`is-${e}`),disabled:l===void 0,onClick:()=>l?.(n),type:`button`,"aria-label":`${t}: ${r}`,children:[(0,P.jsx)(Ab,{"aria-hidden":`true`,children:e===`completed`?(0,P.jsx)(li,{}):(0,P.jsx)(ia,{})}),(0,P.jsxs)(`span`,{className:`chat-task-result-card-main`,children:[(0,P.jsx)(`span`,{className:`chat-task-result-card-state`,children:h}),(0,P.jsx)(`strong`,{children:r}),a===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-module`,children:a}),m.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-summary`,children:m}),c===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-error-code`,children:c}),s.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-files`,"aria-label":`Generated files`,children:s.map(e=>(0,P.jsxs)(`span`,{className:`chat-task-result-card-file`,children:[(0,P.jsx)(Ci,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))})]}),(0,P.jsx)(`span`,{className:`chat-task-result-card-arrow`,"aria-hidden":`true`,children:(0,P.jsx)(di,{})})]})})})}function Vb({status:e}){return e===`done`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(li,{})}):e===`pending`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Ii,{})}):e===`failed`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(ia,{})}):e===`running`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Mi,{})}):(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`})}function Hb({title:e,status:t,selected:n=!1,className:r,type:i=`button`,...a}){return(0,P.jsxs)(`button`,{className:R(`task-row`,n?`is-selected`:void 0,`is-${t}`,r),type:i,"aria-current":n?`true`:void 0,...a,children:[(0,P.jsx)(Vb,{status:t}),(0,P.jsx)(`div`,{className:`task-row-main`,children:(0,P.jsx)(`div`,{className:`task-title-line`,children:(0,P.jsx)(`strong`,{children:e})})})]})}function Ub({label:e,value:t,code:n=!1,status:r}){return(0,P.jsxs)(`div`,{className:`detail-row`,children:[(0,P.jsx)(`span`,{children:e}),r===void 0?n?(0,P.jsx)(`code`,{children:t}):(0,P.jsx)(`strong`,{children:t}):(0,P.jsx)(`strong`,{children:(0,P.jsx)(Es,{status:r,children:t})})]})}function Wb({rows:e}){return(0,P.jsx)(P.Fragment,{children:e.map((e,t)=>(0,N.createElement)(Ub,{...e,key:`${e.label}-${t}`}))})}function Gb({...e}){return(0,P.jsx)(Hb,{...e})}function Kb({detail:e,missingTaskId:t}){return e===void 0?(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsx)(`div`,{className:`task-detail-head`,children:(0,P.jsx)(`h4`,{children:t===void 0?`No task selected`:`Task not found`})}),(0,P.jsx)(`p`,{children:t===void 0?`Select a task to inspect its contract, latest result, and run history.`:`No task exists for ${t}. Select another task from the Worklist.`})]}):(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsxs)(`div`,{className:`task-detail-head`,children:[(0,P.jsx)(Es,{status:e.status,children:e.status}),(0,P.jsx)(`h4`,{children:e.title})]}),(0,P.jsx)(`p`,{children:e.summary}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Task contract`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Task contract`}),(0,P.jsx)(Wb,{rows:e.contractRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section task-evidence-section`,"aria-label":`Evidence`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Evidence`}),(0,P.jsx)(Wb,{rows:e.evidenceRows??e.resultRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Run result history`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Run result history`}),e.runResults.length===0?(0,P.jsx)(`p`,{children:`No run result yet.`}):(0,P.jsx)(`div`,{className:`run-result-list`,children:e.runResults.map(e=>(0,P.jsx)(`article`,{className:`run-result-item`,children:(0,P.jsxs)(`div`,{className:`run-result-item-head`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.title}),e.meta===void 0?null:(0,P.jsx)(`small`,{children:e.meta})]}),e.status===void 0?null:(0,P.jsx)(Es,{status:e.status,children:e.status})]})},e.id))})]})]})}function qb({modules:e,taskCount:t,detail:n,missingTaskId:r,runNote:i,onSelectTask:a,empty:o,className:s,...c}){return(0,P.jsx)(ma,{title:`Worklist`,icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),action:(0,P.jsx)(`div`,{className:`worklist-header-summary`,children:(0,P.jsx)(`span`,{className:`mini-meta`,children:t===1?`1 task`:`${t} tasks`})}),className:R(`tasks worklist-page-panel`,s),...c,children:(0,P.jsxs)(`div`,{className:`worklist-page-body`,children:[i===void 0?null:(0,P.jsx)(`p`,{className:`worklist-run-note`,children:i}),e.length===0?(0,P.jsx)(`div`,{className:`worklist-page-empty`,children:o??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No compiled tasks`})}):(0,P.jsxs)(`div`,{className:`task-board-body`,children:[(0,P.jsx)(`div`,{className:`task-list`,"aria-label":`Tasks`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`task-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:e.label}),e.rows.map(e=>(0,P.jsx)(Gb,{title:e.title,status:e.status,onClick:()=>a?.(e.id),...e.selected===void 0?{}:{selected:e.selected}},e.id))]},e.label))}),(0,P.jsx)(Kb,{...n===void 0?{}:{detail:n},...r===void 0?{}:{missingTaskId:r}})]})]})})}function Jb({sections:e,statuses:t=[],className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`settings-sheet`,n),"aria-labelledby":`settings-title`,...r,children:[(0,P.jsxs)(`header`,{className:`settings-sheet-head`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Ji,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{id:`settings-title`,children:`Project settings`})]}),t.length===0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:t.map(e=>(0,P.jsx)(ws,{className:`task-tag`,tone:e.tone,children:e.label},e.label))})]}),e.map(e=>(0,P.jsxs)(`section`,{className:`settings-section`,id:e.id,"aria-label":e.title,children:[(0,P.jsx)(`div`,{className:`settings-section-title`,children:(0,P.jsx)(`h4`,{children:e.title})}),(0,P.jsx)(`div`,{className:`settings-section-body`,children:e.rows.map(e=>(0,P.jsxs)(`div`,{className:`settings-row`,children:[(0,P.jsx)(`span`,{className:`field-label`,children:e.label}),e.value===void 0?(0,P.jsx)(`span`,{}):e.plain===!0?(0,P.jsx)(`div`,{className:`settings-row-value`,children:e.value}):e.code===!0?(0,P.jsx)(`code`,{children:e.value}):(0,P.jsx)(`strong`,{children:e.value})]},e.label))})]},e.id))]})}function Yb({row:e}){return e.category===`image`?(0,P.jsx)(Ei,{"aria-hidden":`true`}):e.canPreview===!1?(0,P.jsx)(xi,{"aria-hidden":`true`}):e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):e.extension===`md`||e.extension===`txt`?(0,P.jsx)(Si,{"aria-hidden":`true`}):(0,P.jsx)(Ci,{"aria-hidden":`true`})}function Xb({row:e,onSelectFile:t}){return(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>t?.(e.path),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Yb,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.meta})]})]})}function Zb({name:e,rows:t,onSelectFile:n}){return(0,P.jsxs)(`details`,{className:`reference-folder-group`,children:[(0,P.jsxs)(`summary`,{className:`reference-folder-head`,children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ti,{})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`span`,{children:[t.length,` `,t.length===1?`file`:`files`]})]})]}),(0,P.jsx)(`div`,{className:`reference-folder-files`,children:t.map(e=>(0,P.jsx)(Xb,{row:e,...n===void 0?{}:{onSelectFile:n}},e.path))})]})}function Qb(e){let t=new Map;for(let n of e){if(n.source!==`tutti_output`||n.generatedGroup===void 0)continue;let e=t.get(n.generatedGroup)??[];e.push(n),t.set(n.generatedGroup,e)}return[...t.entries()].map(([e,t])=>({name:e,rows:t}))}function $b({files:e,detail:t,uploadPending:n=!1,fileSortMode:r=`time`,empty:i,onSelectFile:a,onUploadFile:o,onDropFiles:s,onFileSortModeChange:c,className:l,...u}){let d=e.filter(e=>e.category===`image`&&e.source!==`tutti_output`),f=e.filter(e=>!(e.category===`image`&&e.source!==`tutti_output`)),p=f.filter(e=>e.source!==`tutti_output`||e.generatedGroup===void 0),m=Qb(f),h=e=>(0,P.jsx)(`div`,{className:`reference-image-strip`,role:`list`,"aria-label":`Reference images`,onWheel:e=>{Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(e.currentTarget.scrollLeft+=e.deltaY,e.preventDefault())},children:e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-image-tile`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,"aria-label":`Open ${e.name}`,onClick:()=>a?.(e.path),children:[e.thumbnailUrl===void 0?(0,P.jsx)(`span`,{className:`reference-image-tile-fallback`,"aria-hidden":`true`,children:(0,P.jsx)(Ei,{})}):(0,P.jsx)(`img`,{src:e.thumbnailUrl,alt:e.name,loading:`lazy`,decoding:`async`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))}),g=e=>e.map(e=>(0,P.jsx)(Xb,{row:e,...a===void 0?{}:{onSelectFile:a}},e.path)),_=s??(o===void 0?void 0:e=>{for(let t of e)o(t)});return(0,P.jsxs)(iy,{className:R(`panel references-panel`,l),"aria-label":`References`,dropLabel:`Drop reference files to upload`,pending:n,onFilesUpload:_,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`References`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Hy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:n,onFileUpload:o})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:i??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No reference files`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Reference file list`,children:[d.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Images`}),h(d)]}),f.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-files-head`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Files`}),(0,P.jsxs)(`div`,{className:`reference-list-toolbar`,role:`toolbar`,"aria-label":`Sort files`,children:[(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`time`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by upload time`,"aria-pressed":r===`time`,onClick:()=>c?.(`time`),children:(0,P.jsx)(gi,{"aria-hidden":`true`})}),(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`type`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by type`,"aria-pressed":r===`type`,onClick:()=>c?.(`type`),children:(0,P.jsx)($i,{"aria-hidden":`true`})})]})]}),g(p),m.map(e=>(0,P.jsx)(Zb,{name:e.name,rows:e.rows,...a===void 0?{}:{onSelectFile:a}},e.name))]})]}),(0,P.jsxs)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected reference content`,children:[(0,P.jsxs)(`div`,{className:`reference-detail-head`,children:[(0,P.jsx)(`h4`,{children:t?.title??`No file selected`}),t?.meta===void 0?null:(0,P.jsx)(`p`,{children:t.meta})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Summary`}),(0,P.jsx)(`p`,{className:`reference-summary`,children:t?.summary??`Summary not available yet`}),t?.summaryStatus===void 0?null:(0,P.jsx)(`p`,{className:`reference-summary-status`,children:t.summaryStatus})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Content`}),t?.content===void 0?t?.imageUrl===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:t?.unavailableReason??`Select a reference file`}):(0,P.jsx)(`img`,{className:`reference-image-preview`,src:t.imageUrl,alt:t.title,decoding:`async`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{children:t.content})})]})]})]})})]})}function ex(e){return e.status===`loading`?{status:`running`,label:`Loading`}:e.status===`not_declared`?{status:`todo`,label:`No artifact`}:e.status===`invalid`?{status:`failed`,label:`Invalid`}:e.status===`updating`?{status:`running`,label:`Updating`}:e.previewStatus===`ready`?{status:`done`,label:`Ready`}:e.previewStatus===`starting`?{status:`running`,label:`Starting`}:e.previewStatus===`failed`?{status:`failed`,label:`Failed`}:{status:`todo`,label:`Stopped`}}function tx({state:e,restartPending:t=!1,stopPending:n=!1,compact:r=!1,onRestart:i,onStop:a}){let o=ex(e),s=e.status===`declared`&&e.previewStatus!==`stopped`&&a!==void 0,c=e.status===`declared`&&i!==void 0;return r?s?(0,P.jsx)(xs,{className:`artifact-mobile-control`,type:`button`,label:n?`Stopping artifact`:`Stop artifact`,disabled:n,"aria-busy":n,icon:(0,P.jsx)(Qi,{"aria-hidden":`true`}),onClick:a}):c?(0,P.jsx)(xs,{className:`artifact-mobile-control`,type:`button`,label:t?`Restarting artifact`:`Restart artifact`,disabled:t,"aria-busy":t,icon:(0,P.jsx)(Ui,{className:t?`is-spinning`:void 0,"aria-hidden":`true`}),onClick:i}):null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Es,{status:o.status,children:o.label}),c?(0,P.jsxs)(Cs,{type:`button`,disabled:t,"aria-busy":t,onClick:i,children:[(0,P.jsx)(Ui,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:t?`Restarting`:`Restart`})]}):null,s?(0,P.jsxs)(Cs,{className:`artifact-stop-button`,type:`button`,disabled:n,"aria-busy":n,onClick:a,children:[(0,P.jsx)(Qi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:n?`Stopping`:`Stop`})]}):null]})}function nx({state:e,empty:t,emptyWatermark:n}){if(e.status===`declared`&&e.previewStatus===`ready`&&e.previewUrl!==void 0)return(0,P.jsx)(`iframe`,{className:`artifact-iframe`,src:e.previewUrl,title:`${e.title} artifact preview`,sandbox:`allow-scripts allow-forms allow-same-origin`,referrerPolicy:`no-referrer`});let r,i=`neutral`;return e.status===`loading`?r=`Loading artifact`:e.status===`updating`?r=`Artifact is updating`:e.status===`not_declared`?r=`No artifact`:e.status===`invalid`?(i=`error`,r=`Invalid artifact. ${e.message}`):e.previewStatus===`starting`?r=`Preview is starting`:e.previewStatus===`failed`?(i=`error`,r=e.errorMessage??`Preview failed`):r=`Preview stopped`,(0,P.jsx)(`div`,{className:`artifact-empty-preview`,role:e.status===`invalid`?`alert`:void 0,children:t??(0,P.jsx)(aa,{tone:i,watermark:n,children:r})})}function rx({state:e,error:t=null,empty:n,emptyWatermark:r,restartPending:i=!1,stopPending:a=!1,onRestart:o,onStop:s,className:c,...l}){let u=t===null?e:{status:`invalid`,message:t};return(0,P.jsxs)(`section`,{className:R(`panel artifacts-panel`,c),"aria-label":`Artifacts`,...l,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Artifacts`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(tx,{state:u,restartPending:i,stopPending:a,...o===void 0?{}:{onRestart:o},...s===void 0?{}:{onStop:s}})})]}),(0,P.jsx)(`div`,{className:`artifact-board-body`,children:(0,P.jsx)(`div`,{className:`artifact-preview-frame`,"aria-label":`Current artifact`,children:(0,P.jsx)(nx,{state:u,empty:n,emptyWatermark:r})})})]})}function ix({row:e}){return e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):(0,P.jsx)(Xi,{"aria-hidden":`true`})}function ax({skills:e,communityLinks:t=[],detail:n,uploadPending:r=!1,deletePending:i=!1,empty:a,onSelectSkill:o,onUploadSkill:s,onDeleteSkill:c,className:l,...u}){let d=e.find(e=>e.selected===!0)?.name,f=t.length>0;return(0,P.jsxs)(`section`,{className:R(`panel references-panel skills-panel`,l),"aria-label":`Skills`,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Xi,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Skills`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Hy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:r,accept:`.zip,application/zip,application/x-zip-compressed`,onFileUpload:s})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0&&!f?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Skill list`,children:[f?(0,P.jsxs)(`div`,{className:`skill-community-section`,"aria-label":`Skill communities`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Skill communities`}),(0,P.jsx)(`div`,{className:`skill-community-grid`,children:t.map(e=>(0,P.jsxs)(`a`,{className:`skill-community-card`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(`span`,{className:`skill-community-card-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ai,{})}),(0,P.jsx)(`span`,{className:`skill-community-card-main`,children:(0,P.jsx)(`strong`,{children:e.title})})]},e.href))})]}):null,e.length===0?null:(0,P.jsx)(`div`,{className:`reference-section-label`,children:`User skills`}),e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-label":`Select skill ${e.name}`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>o?.(e.name),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(ix,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.shortDescription??e.description})]})]},e.name))]}),(0,P.jsx)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected skill content`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-detail-head skill-detail-head`,children:[(0,P.jsxs)(`div`,{className:`skill-detail-title`,children:[(0,P.jsx)(`h4`,{children:n?.title??`No skill selected`}),n?.description===void 0?null:(0,P.jsx)(`p`,{children:n.description}),n?.updatedLabel===void 0?null:(0,P.jsx)(`p`,{children:n.updatedLabel})]}),d===void 0||c===void 0?null:(0,P.jsxs)(Cs,{className:`skill-delete-button`,type:`button`,disabled:i,"aria-busy":i,onClick:()=>c(d),children:[(0,P.jsx)(ta,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:i?`Deleting`:`Delete`})]})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`SKILL.md`}),n?.skillMd===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:n?.unavailableReason??`Select a skill`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{"aria-label":`Skill markdown for ${n.title}`,children:n.skillMd})})]})]})})]})})]})}function ox({label:e,children:t}){return(0,P.jsxs)(`section`,{className:`timeline-trace-section`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-label`,children:e}),(0,P.jsx)(`div`,{className:`timeline-trace-section-body`,children:t})]})}function sx(e){return e.replaceAll(`_`,` `)}function cx(e){return e===`passed`?`success`:e===`failed`?`error`:`warning`}function lx(e){return e.status===`promoted`?`success`:e.status===`not_promoted`?`error`:`neutral`}function ux(e){if(e.skipReasonSummary!==void 0)return e.skipReasonSummary;switch(e.checks){case`passed`:return`All validation checks passed.`;case`failed`:return`Validation checks failed.`;case`skipped`:return`Validation was skipped.`}}function dx(e){if(e.summary!==void 0)return e.summary;switch(e.status){case`promoted`:return`Changes were promoted after verification.`;case`not_promoted`:return`Changes were not promoted.`;case`not_attempted`:return`Promotion was not attempted.`}}function fx(e){switch(e){case`added`:return`+`;case`modified`:return`~`;case`deleted`:return`-`;case`renamed`:return`~`;case`unknown`:return`?`}}var px=3;function mx({expanded:e,collapsedLabel:t,expandedLabel:n,onClick:r}){return(0,P.jsxs)(`button`,{"aria-expanded":e,className:R(`timeline-trace-more`,e&&`is-expanded`),onClick:r,type:`button`,children:[(0,P.jsx)(`span`,{children:e?n:t}),(0,P.jsx)(ui,{"aria-hidden":`true`})]})}function hx({expanded:e,hiddenCount:t,label:n,onClick:r}){return t<=0?null:(0,P.jsx)(mx,{collapsedLabel:`Show ${t} more ${n}${t===1?``:`s`}`,expanded:e,expandedLabel:`Show fewer ${n}s`,onClick:r})}function gx(e){let t=[];return(e.origin!==void 0||e.decisions!==void 0||e.clarification!==void 0)&&t.push({id:`context`,label:`Context`,tone:`neutral`}),e.contract!==void 0&&t.push({id:`contract`,label:`Contract`,tone:`neutral`}),(e.result!==void 0||e.changes!==void 0)&&t.push({id:`result`,label:`Result`,tone:e.tone}),e.verification!==void 0&&t.push({id:`checks`,label:`Checks`,tone:cx(e.verification.checks)}),e.promotion!==void 0&&t.push({id:`promotion`,label:`Promotion`,tone:lx(e.promotion)}),e.checkpoint!==void 0&&t.push({id:`checkpoint`,label:`Checkpoint`,tone:e.tone}),t}function _x({trace:e}){let t=gx(e),n=e.links.filter(e=>e.onClick!==void 0),[r,i]=(0,N.useState)(()=>new Set),a=r.has(`origin`),o=r.has(`decisions`),s=r.has(`clarification-answers`),c=r.has(`scope`),l=r.has(`changes`),u=r.has(`checkpoint`),d=r.has(`generated-files`),f=e.origin?.snippets??[],p=e.decisions===void 0||o?e.decisions??[]:e.decisions.slice(0,px),m=e.clarification?.answers===void 0||s?e.clarification?.answers??[]:e.clarification.answers.slice(0,px),h=e.contract===void 0||c?e.contract?.scope??[]:e.contract.scope.slice(0,px),g=e.checkpoint===void 0||u?e.checkpoint?.items??[]:e.checkpoint.items.slice(0,px),_=e.checkpoint?.generatedFiles===void 0||d?e.checkpoint?.generatedFiles??[]:e.checkpoint.generatedFiles.slice(0,px);function v(e){i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:R(`timeline-trace-card`,`is-${e.tone}`),children:[e.summary===void 0||e.result!==void 0?null:(0,P.jsx)(`p`,{className:`timeline-trace-summary`,children:e.summary}),t.length===0?null:(0,P.jsx)(`ol`,{className:`timeline-trace-path`,"aria-label":`Recorded task trace`,children:t.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.tone}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`}),(0,P.jsx)(`strong`,{children:e.label})]},e.id))}),e.origin===void 0?null:(0,P.jsxs)(ox,{label:`Origin`,children:[e.origin.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.origin.title}),e.origin.summary===void 0?null:(0,P.jsx)(`p`,{children:e.origin.summary}),e.origin.unavailableReason===void 0?null:(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:e.origin.unavailableReason}),f.length>0?(0,P.jsx)(mx,{collapsedLabel:`Show ${f.length} source message${f.length===1?``:`s`}`,expanded:a,expandedLabel:`Show fewer source messages`,onClick:()=>v(`origin`)}):e.origin.sourceCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.origin.sourceCount,` source message`,e.origin.sourceCount===1?``:`s`]}),!a||f.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:f.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))})]}),e.decisions===void 0||e.decisions.length===0?null:(0,P.jsxs)(ox,{label:`Accepted Context`,children:[(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:p.map(e=>(0,P.jsxs)(`li`,{children:[e.title===void 0?null:(0,P.jsx)(ws,{tone:`neutral`,children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(hx,{expanded:o,hiddenCount:Math.max(e.decisions.length-px,0),label:`context item`,onClick:()=>v(`decisions`)})]}),e.clarification===void 0?null:(0,P.jsxs)(ox,{label:`Clarification`,children:[e.clarification.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.clarification.title}),e.clarification.summary===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.summary}),e.clarification.request===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.request}),e.clarification.status===void 0&&e.clarification.answerCount===void 0?null:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[e.clarification.status===void 0?null:(0,P.jsx)(ws,{tone:e.clarification.status===`active`?`warning`:`success`,children:e.clarification.status===`active`?`needs input`:`resolved`}),e.clarification.answerCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.clarification.answerCount,` answer`,e.clarification.answerCount===1?``:`s`]})]}),e.clarification.answers===void 0||e.clarification.answers.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:m.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))}),e.clarification.answers===void 0?null:(0,P.jsx)(hx,{expanded:s,hiddenCount:Math.max(e.clarification.answers.length-px,0),label:`answer`,onClick:()=>v(`clarification-answers`)})]}),e.contract===void 0?null:(0,P.jsxs)(ox,{label:`Contract`,children:[(0,P.jsx)(`p`,{children:e.contract.goal}),h.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-list is-bulleted`,children:h.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`span`,{children:e})},`scope-${t}`))}),(0,P.jsx)(hx,{expanded:c,hiddenCount:Math.max(e.contract.scope.length-px,0),label:`scope item`,onClick:()=>v(`scope`)}),c&&e.contract.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional scope items are outside this bounded audit preview.`}):null]}),e.result===void 0?null:(0,P.jsxs)(ox,{label:`Result`,children:[(0,P.jsx)(`p`,{children:e.result.summary}),e.result.errorCode===void 0?null:(0,P.jsx)(`code`,{className:`timeline-trace-code`,children:e.result.errorCode})]}),e.changes===void 0?null:(0,P.jsxs)(ox,{label:`Changes`,children:[e.changes.items.length===0?(0,P.jsx)(`p`,{className:`timeline-trace-muted`,children:`No repo changes recorded.`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(mx,{collapsedLabel:`Show ${e.changes.items.length} file change${e.changes.items.length===1?``:`s`}`,expanded:l,expandedLabel:`Show fewer file changes`,onClick:()=>v(`changes`)}),l?(0,P.jsx)(`ul`,{className:`timeline-trace-diff-list`,children:e.changes.items.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.status}`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-diff-mark`,children:fx(e.status)}),(0,P.jsx)(`code`,{children:e.previousPath===void 0?e.path:`${e.previousPath} -> ${e.path}`})]},`${e.status}:${e.path}`))}):null]}),l&&e.changes.totalCount>e.changes.items.length?(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.changes.totalCount-e.changes.items.length,` additional files are outside this bounded audit preview.`]}):null]}),e.verification===void 0?null:(0,P.jsx)(ox,{label:`Verification`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(ws,{tone:cx(e.verification.checks),children:sx(e.verification.checks)}),(0,P.jsx)(`p`,{children:ux(e.verification)})]})}),e.promotion===void 0?null:(0,P.jsx)(ox,{label:`Promotion`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(ws,{tone:lx(e.promotion),children:sx(e.promotion.status)}),(0,P.jsx)(`p`,{children:dx(e.promotion)})]})}),e.checkpoint===void 0?null:(0,P.jsxs)(ox,{label:`Checkpoint`,children:[(0,P.jsxs)(`div`,{className:`timeline-trace-counters`,children:[(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.completed,` completed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.failed,` failed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.remaining,` remaining`]})]}),(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:g.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(ws,{tone:e.status===`done`?`success`:`error`,children:e.status===`done`?`done`:`failed`}),(0,P.jsx)(`strong`,{children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(hx,{expanded:u,hiddenCount:Math.max(e.checkpoint.items.length-px,0),label:`checkpoint item`,onClick:()=>v(`checkpoint`)}),e.checkpoint.generatedFiles===void 0||e.checkpoint.generatedFiles.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-file-list`,children:_.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`code`,{children:e.path})]},e.id))}),e.checkpoint.generatedFiles===void 0?null:(0,P.jsx)(hx,{expanded:d,hiddenCount:Math.max(e.checkpoint.generatedFiles.length-px,0),label:`generated file`,onClick:()=>v(`generated-files`)}),(u||d)&&e.checkpoint.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional checkpoint evidence is outside this bounded audit preview.`}):null]}),n.length===0?null:(0,P.jsx)(ox,{label:`Links`,children:(0,P.jsx)(`div`,{className:`timeline-trace-links`,children:n.map(e=>(0,P.jsxs)(Cs,{className:`timeline-trace-link`,onClick:e.onClick,type:`button`,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.label})]},e.id))})})]})}function vx({item:e,expanded:t,active:n,onActivate:r,onToggle:i}){let a=e.trace,o=a!==void 0,s=e.tone??`neutral`,c=s===`error`?(0,P.jsx)(ia,{"aria-hidden":`true`}):s===`warning`?(0,P.jsx)(Ii,{"aria-hidden":`true`}):s===`sync`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`});return(0,P.jsxs)(`li`,{className:R(`timeline-event-item`,o?`has-trace`:void 0,t?`is-expanded`:void 0,n?`is-current`:void 0,e.tone===void 0?void 0:`is-${e.tone}`),id:`timeline-event-${e.id}`,children:[(0,P.jsx)(`time`,{className:`timeline-event-time`,children:e.occurredAt}),(0,P.jsx)(`div`,{className:`timeline-event-marker`,"aria-hidden":`true`}),(0,P.jsxs)(`div`,{className:`timeline-event-main`,children:[(0,P.jsxs)(`button`,{"aria-expanded":o?t:void 0,className:`timeline-event-toggle`,disabled:!o,onClick:()=>{r(),i()},type:`button`,children:[(0,P.jsx)(`span`,{className:R(`timeline-event-status-icon`,`is-${s}`),"aria-hidden":`true`,children:c}),(0,P.jsxs)(`span`,{className:`timeline-event-copy`,children:[(0,P.jsx)(`span`,{className:`timeline-event-stage`,children:e.stageLabel??(e.kind===`checkpoint`?`Checkpoint`:`Task event`)}),(0,P.jsxs)(`span`,{className:`timeline-event-title-line`,children:[(0,P.jsx)(`h4`,{children:e.taskTitle??e.title}),e.tokenLabel===void 0?null:(0,P.jsx)(`span`,{className:`timeline-event-token`,children:e.tokenLabel})]})]}),o?(0,P.jsx)(ui,{className:`timeline-event-chevron`,"aria-hidden":`true`}):null]}),a!==void 0&&t?(0,P.jsx)(_x,{trace:a}):null]})]})}function yx(e){let t=new Map;for(let n of e){let e=n.taskId===void 0?`event:${n.id}`:`task:${n.taskId}`,r=t.get(e);r===void 0?t.set(e,{id:e,title:n.taskTitle??n.title,...n.taskId===void 0?{}:{taskId:n.taskId},items:[n]}):r.items.push(n)}return[...t.values()]}function bx({tokenOverview:e,items:t,scoreUnits:n=[],empty:r,defaultExpandedItemIds:i,className:a,...o}){let[s,c]=(0,N.useState)(()=>new Set(i??[])),[l,u]=(0,N.useState)(()=>n.at(-1)?.id),[d,f]=(0,N.useState)(0),p=(0,N.useRef)(null),m=yx(t),h=new Set(t.flatMap(e=>e.taskId===void 0?[]:[e.taskId])).size;(0,N.useEffect)(()=>{if(n.length===0){u(void 0);return}(l===void 0||!n.some(e=>e.id===l))&&u(n.at(-1)?.id)},[l,n]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=e;t.scrollLeft=t.scrollWidth;function n(e){if(Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let n=Math.max(0,t.scrollWidth-t.clientWidth),r=Math.min(n,Math.max(0,t.scrollLeft+e.deltaY));r!==t.scrollLeft&&(e.preventDefault(),t.scrollLeft=r)}return t.addEventListener(`wheel`,n,{passive:!1}),()=>t.removeEventListener(`wheel`,n)},[n.length]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=()=>f(e.clientWidth);if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n.length]);function g(e,t=!1){u(e),t&&(c(t=>new Set(t).add(e)),window.requestAnimationFrame(()=>{document.getElementById(`timeline-event-${e}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))}function _(e){c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsx)(ma,{className:R(`timeline-panel`,a),title:`Timeline`,icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),...o,children:(0,P.jsxs)(`div`,{className:`timeline-board-body`,children:[(0,P.jsxs)(`section`,{className:`timeline-events`,"aria-label":`Project timeline`,children:[(0,P.jsx)(`div`,{className:`timeline-audit-header`,children:(0,P.jsxs)(`div`,{className:`timeline-audit-intro`,children:[(0,P.jsx)(`h4`,{children:`Task traceability`}),(0,P.jsxs)(`div`,{className:`timeline-audit-meta`,"aria-label":`Timeline record summary`,children:[(0,P.jsx)(`span`,{children:h===1?`1 task`:`${h} tasks`}),(0,P.jsx)(`span`,{children:t.length===1?`1 record`:`${t.length} records`})]})]})}),t.length===0?r:(0,P.jsx)(`div`,{className:`timeline-task-groups`,children:m.map(e=>(0,P.jsxs)(`section`,{className:`timeline-task-group`,"aria-label":e.title,children:[(0,P.jsxs)(`header`,{className:`timeline-task-group-head`,children:[(0,P.jsx)(`span`,{children:e.taskId===void 0?`Project record`:`Task trace`}),(0,P.jsx)(`strong`,{children:e.title})]}),(0,P.jsx)(`ol`,{className:`timeline-event-list`,children:e.items.map(e=>(0,P.jsx)(vx,{active:l===e.id,expanded:s.has(e.id),item:e,onActivate:()=>g(e.id),onToggle:()=>_(e.id)},e.id))})]},e.id))})]}),(0,P.jsxs)(`section`,{className:`timeline-overview`,"aria-label":`Timeline score and token usage`,children:[n.length===0?null:(0,P.jsx)(`div`,{className:`timeline-score-index`,ref:p,role:`group`,"aria-label":`Timeline score index`,children:(0,P.jsx)(co,{"aria-label":`Timeline event score`,...l===void 0?{}:{activeUnitId:l},edgePadding:0,minimumWidth:d,onUnitSelect:e=>g(e,!0),openingBarline:`double`,openingClef:`treble`,horizontalSpacingScale:B,reveal:!0,scale:fo,units:n})}),(0,P.jsxs)(`div`,{className:`timeline-overview-token`,"aria-label":`Total tokens`,children:[(0,P.jsx)(`span`,{children:`Total tokens`}),(0,P.jsx)(`strong`,{children:e.totalLabel})]})]})]})})}var xx=new Intl.NumberFormat(`en-US`),Sx=Bo(`beethoven-ode-to-joy`);function Cx(e){return[...e].reverse().map((e,t)=>{let n=Sx.units[t%Sx.units.length];if(n===void 0)throw Error(`Timeline score theme unexpectedly has no units`);return{...n,id:e.id,label:`Open ${e.stageLabel??e.title}`}})}function wx(e){return xx.format(e)}function Tx(e){if(e!==void 0)switch(e){case`completed`:return`success`;case`failed`:return`error`;case`needs_human`:return`warning`}}function Ex(e){if(e.kind===`task_accepted`)return`Task accepted`;if(e.kind===`checkpoint`)return`Checkpoint`;switch(e.update_state){case`completed`:return`Task completed`;case`failed`:return`Task failed`;case`needs_input`:return`Needs input`;default:return`Task update`}}function Dx(e,t){let n=Date.parse(e.occurred_at),r=Date.parse(t.occurred_at),i=Number.isFinite(n)&&Number.isFinite(r)?r-n:t.occurred_at.localeCompare(e.occurred_at);return i===0?t.id.localeCompare(e.id):i}function Ox(e,t={}){let n=e.token_usage?.total_tokens??0,r=Tx(e.status),i={id:e.id,title:e.task_title??e.title,occurredAt:tr(e.occurred_at),kind:e.kind,stageLabel:Ex(e)};return r!==void 0&&(i.tone=r),n>0&&(i.tokenLabel=`${wx(n)} tokens`),e.task_id!==void 0&&(i.taskId=e.task_id),e.task_title!==void 0&&(i.taskTitle=e.task_title),e.trace_card!==void 0&&(i.trace=Ax(e.trace_card,t)),i}function kx(e,t){if(e.kind===`worklist_task`&&e.task_id!==void 0){let n=t.onOpenWorklistTask,r=e.task_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`chat_message`&&e.message_id!==void 0){let n=t.onOpenChatMessage,r=e.message_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`reference_file`&&e.path!==void 0){let n=t.onOpenReferenceFile,r=e.path;return n===void 0?void 0:()=>n(r)}}function Ax(e,t={}){return{tone:e.tone,...e.summary===void 0?{}:{summary:e.summary},...e.origin===void 0?{}:{origin:{...e.origin.title===void 0?{}:{title:e.origin.title},...e.origin.summary===void 0?{}:{summary:e.origin.summary},...e.origin.unavailable_reason===void 0?{}:{unavailableReason:e.origin.unavailable_reason},...e.origin.source_count===void 0?{}:{sourceCount:e.origin.source_count},...e.origin.snippets===void 0?{}:{snippets:e.origin.snippets.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.decisions===void 0?{}:{decisions:e.decisions.map((e,t)=>({id:`${t}:${e.source??`decision`}`,...e.title===void 0?{}:{title:e.title},summary:e.summary}))},...e.clarification===void 0?{}:{clarification:{...e.clarification.title===void 0?{}:{title:e.clarification.title},...e.clarification.summary===void 0?{}:{summary:e.clarification.summary},...e.clarification.request===void 0?{}:{request:e.clarification.request},...e.clarification.status===void 0?{}:{status:e.clarification.status},...e.clarification.answer_count===void 0?{}:{answerCount:e.clarification.answer_count},...e.clarification.answers===void 0?{}:{answers:e.clarification.answers.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.contract===void 0?{}:{contract:{goal:e.contract.goal,scope:e.contract.scope,...e.contract.truncated===void 0?{}:{truncated:e.contract.truncated}}},...e.result===void 0?{}:{result:{summary:e.result.summary,...e.result.error_code===void 0?{}:{errorCode:e.result.error_code}}},...e.changes===void 0?{}:{changes:{items:e.changes.items.map(e=>({status:e.status,path:e.path,...e.previous_path===void 0?{}:{previousPath:e.previous_path}})),totalCount:e.changes.total_count,truncated:e.changes.truncated}},...e.verification===void 0?{}:{verification:{checks:e.verification.checks,...e.verification.skip_reason_code===void 0?{}:{skipReasonCode:e.verification.skip_reason_code},...e.verification.skip_reason_summary===void 0?{}:{skipReasonSummary:e.verification.skip_reason_summary}}},...e.promotion===void 0?{}:{promotion:{status:e.promotion.status,...e.promotion.commit_short_oid===void 0?{}:{commitShortOid:e.promotion.commit_short_oid},...e.promotion.summary===void 0?{}:{summary:e.promotion.summary},...e.promotion.reason_code===void 0?{}:{reasonCode:e.promotion.reason_code}}},...e.checkpoint===void 0?{}:{checkpoint:{counters:e.checkpoint.counters,items:e.checkpoint.items.map(e=>({id:e.task_id,title:e.title,status:e.status,summary:e.summary})),...e.checkpoint.generated_files===void 0?{}:{generatedFiles:e.checkpoint.generated_files.map(e=>({id:e.path,name:e.name,path:e.path}))},...e.checkpoint.truncated===void 0?{}:{truncated:e.checkpoint.truncated}}},links:e.links.flatMap(e=>{let n=e.task_id??e.message_id??e.path,r=kx(e,t);return r===void 0?[]:[{id:`${e.kind}:${n??e.label}`,label:e.label,onClick:r}]})}}function jx(e,t={}){let n=e.usage_overview,r=[...e.items].sort(Dx).map(e=>Ox(e,t));return{tokenOverview:{totalLabel:wx(n.total_tokens)},items:r,scoreUnits:Cx(r)}}var Mx=[{id:`prepare`,label:`Preparing workspace`},{id:`implement`,label:`Implementing with Codex`},{id:`validate`,label:`Validating result`},{id:`save`,label:`Saving result`}],Nx=[{id:`workspace_inspect`,summary:`inspecting the persistent project workspace`,displayStageId:`prepare`},{id:`artifact_candidate_validate`,summary:`validating the candidate Artifact preview`,displayStageId:`validate`},{id:`provider_task_run`,summary:`running Codex task implementation`,displayStageId:`implement`},{id:`provider_retry`,summary:`retrying Codex task after a transient provider failure`,displayStageId:`implement`},{id:`candidate_diff_collect`,summary:`collecting candidate changes`,displayStageId:`validate`},{id:`checks`,summary:`running project checks`,displayStageId:`validate`},{id:`post_checks_diff_collect`,summary:`rechecking candidate changes after checks`,displayStageId:`validate`},{id:`accepted_checkpoint`,summary:`saving the validated project state as an accepted checkpoint`,displayStageId:`save`},{id:`promotion_reconcile`,summary:`reconciling promotion after mainline changed`,displayStageId:`save`},{id:`self_correction`,summary:`retrying task implementation after pipeline feedback`,displayStageId:`implement`}],Px={scratchpad_refresh:{key:`scratchpad_refresh`,label:`Refreshing Scratchpad`,target:{kind:`scratchpad`}},project_context_bootstrap:{key:`project_context_bootstrap`,label:`Preparing project context`,target:{kind:`scratchpad`}},task_compile:{key:`task_compile`,label:`Compiling Worklist tasks`,target:{kind:`scratchpad`}},context_sync:{key:`context_sync`,label:`Synchronizing project context`,target:{kind:`worklist`}},reference_summary_refresh:{key:`reference_summary_refresh`,label:`Processing reference`,target:{kind:`references`}},recovery_check:{key:`recovery_check`,label:`Recovering workspace`,target:{kind:`worklist`}},follow_up_check:{key:`follow_up_check`,label:`Checking follow-up`,target:{kind:`worklist`}}},Fx=`Execution progress`,Ix=new Set([`scratchpad_refresh`]),Lx=`task_compile`,Rx=`project_context_bootstrap`,zx={reading_context:`Codex is reading project context`,planning:`Codex is planning changes`,editing_files:`Codex is editing files`,running_command:`Codex is running a command`,using_tool:`Codex is using a tool`,waiting_for_approval:`Codex is waiting for approval`,finalizing:`Codex is finalizing the result`};function Bx(e){if(e===void 0)return null;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e instanceof Date)return e.getTime();let t=Date.parse(e);return Number.isNaN(t)?null:t}function Vx(e){return Bx(e.now)??Date.now()}function Hx(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;if(t<60)return`${t}m${n}s`;let r=Math.floor(t/60),i=t%60;return`${r}h${String(i).padStart(2,`0`)}m`}function Ux(e,t){let n=Bx(e);if(n!==null)return Hx(Math.max(0,Math.floor((Vx(t)-n)/1e3)))}function Wx(e,t){return Ux(e.active_activity?.started_at??e.runtime?.started_at,t)}function Gx(e){let t=e.runtime;if(t===void 0)return;let n=e.active_activity?.activity_ref;if(!(n!==void 0&&t.activity_ref!==n))return t}function Kx(e){if(e<1e3)return String(e);if(e<1e6){let t=e/1e3;return`${e<1e5?t.toFixed(1).replace(/\.0$/u,``):String(Math.round(t))}k`}return`${(e/1e6).toFixed(1).replace(/\.0$/u,``)}m`}function qx(e){let t=e?.token_usage?.total_tokens;return t===void 0?[]:[`${Kx(t)} tokens`]}function Jx(e){let t=e?.token_usage?.total_tokens;return t===void 0?void 0:`${Kx(t)} tokens`}function Yx(e){let t=e?.current_action;return t===void 0?void 0:zx[t]}function Xx(e){let t=Yx(e);if(t===void 0)return;let n=Jx(e);return n===void 0?t:`${t} (${n})`}function Zx(e){let t={};return e.active_activity?.activity_ref!==void 0&&(t.activityRef=e.active_activity.activity_ref),e.active_activity?.workflow_ref!==void 0&&(t.workflowRef=e.active_activity.workflow_ref),e.active_task?.id!==void 0&&(t.taskId=e.active_task.id),Object.keys(t).length===0?void 0:t}function Qx(e,t,n){return e===`context_sync`&&t.last_conclusion?.task_id!==void 0?{kind:`task`,taskId:t.last_conclusion.task_id}:n.target}function $x(e){return Nx[aS(e)]??Nx[0]}function eS(e){return Mx.findIndex(t=>t.id===e)}function tS(e){return Mx[eS($x(e).displayStageId)]??Mx[0]}function nS(e){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let t=e.active_activity.workflow_kind;if(t===void 0||Ix.has(t))return null;let n=Px[t],r=Qx(t,e,n);return{key:`procedure:${n.key}`,label:n.label,title:n.label,tone:`running`,target:r}}function rS(e,t){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let n=e.active_activity.workflow_kind;if(n===void 0||Ix.has(n))return null;let r=Px[n],i=Qx(n,e,r),a=Zx(e),o=Gx(e),s=n===Lx?qx(o):[],c=n===Rx?`Creating project context for the first time`:void 0,l=Ux(e.active_activity?.started_at??o?.started_at,t);return{key:`procedure:${r.key}`,title:Fx,summary:e.summary,tone:`running`,metaLabel:r.label,completionTarget:i,...a===void 0?{}:{completionSource:a},steps:[{id:`procedure:${r.key}:active`,label:r.label,status:`running`,...l===void 0?{}:{elapsedLabel:l},...c===void 0?{}:{detail:c},...s.length===0?{}:{metrics:s}}]}}function iS(e){let t=e.indexOf(` - `);return t===-1?``:e.slice(t+3).trim().replace(/\.$/u,``)}function aS(e){let t=iS(e).toLocaleLowerCase();if(t===``)return 0;let n=Nx.findIndex(e=>t.includes(e.summary.toLocaleLowerCase()));return n===-1?0:n}function oS(e,t){if(e.status!==`running`||e.active_task===void 0)return null;let n=eS($x(e.summary).displayStageId),r=tS(e.summary),i=Zx(e),a=Gx(e),o=Wx(e,t);return{key:`run:${e.active_task.id}`,title:Fx,summary:e.active_task.title,tone:`running`,metaLabel:r.label,completionTarget:{kind:`task`,taskId:e.active_task.id},...i===void 0?{}:{completionSource:i},steps:Mx.map((e,t)=>{let r=t<n?`done`:t===n?`running`:`waiting`,i=t===n,s=e.id===`implement`,c=i&&s?Xx(a):void 0,l=s&&c===void 0?qx(a):[];return{id:e.id,label:e.label,status:r,...i&&o!==void 0?{elapsedLabel:o}:{},...c===void 0?{}:{detail:c},...l.length>0?{metrics:l}:{}}})}}function sS(e,t){if(e.status!==`running`||e.active_activity?.workflow_kind!==`context_sync`||e.last_conclusion?.kind!==`completed`||e.last_conclusion.task_id===void 0)return null;let n=Zx(e),r=Wx(e,t);return{key:`context-sync:${e.last_conclusion.task_id}`,title:Fx,summary:e.summary,tone:`running`,metaLabel:`Synchronizing context`,completionTarget:{kind:`task`,taskId:e.last_conclusion.task_id},...n===void 0?{}:{completionSource:n},steps:[{id:`task_complete`,label:`Task completed`,status:`done`},{id:`context_sync`,label:`Synchronizing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r}}]}}function cS(e){let t=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};return{key:`pending:${e.blocked_by?.kind===`approval`?e.blocked_by.approval_id:e.blocked_by?.kind===`clarification`?e.blocked_by.round_id:e.updated_at}`,title:Fx,summary:e.summary,tone:`pending`,metaLabel:`Needs input`,completionTarget:t,steps:[{id:`waiting_for_input`,label:`Needs input`,status:`pending`}]}}function lS(e){let t=e.last_conclusion?.task_id??(e.status===`failed`?e.active_task?.id:void 0);return t===void 0&&e.status!==`failed`?null:{key:`failed:${t??e.updated_at}`,title:Fx,summary:e.last_conclusion?.summary??e.summary,tone:`failed`,metaLabel:`Failed`,...t===void 0?{}:{completionTarget:{kind:`task`,taskId:t}},steps:[{id:`run_failed`,label:`Run failed`,status:`failed`}]}}function uS(e,t={}){let n=oS(e,t);if(n!==null)return n;let r=sS(e,t);if(r!==null)return r;let i=rS(e,t);return i===null?e.status===`pending`?cS(e):e.status===`failed`?lS(e):null:i}function dS(e){let t=e.activeTaskCompileClarification&&!e.activeScratchpadRefreshFromSubmit&&!e.activeProjectContextBootstrap&&!e.activeTaskCompile,n=[],r=Ux(e.startedAt,e);if(e.activeProjectContextBootstrap)n.push({id:`scratchpad_submit:project_context`,label:`Preparing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r},detail:`Creating project context for the first time`});else if(e.activeTaskCompile||e.activeScratchpadRefreshFromSubmit){let t=e.activeTaskCompile?qx(e.runtime):[];n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:`running`,...r===void 0?{}:{elapsedLabel:r},...t.length===0?{}:{metrics:t}})}else n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:t?`done`:`running`});t&&n.push({id:`scratchpad_submit:needs_input`,label:`Needs input`,status:`pending`});let i=n.find(e=>e.status===`running`||e.status===`pending`)?.label??`Compiling Worklist tasks`;return{key:`scratchpad-submit`,title:Fx,summary:t?`Task compilation needs a decision before Worklist can update.`:`Preparing the Scratchpad for formal tasks.`,tone:t?`pending`:`running`,metaLabel:t?`Needs input`:i,completionTarget:t?{kind:`clarification`}:{kind:`scratchpad`},steps:n}}function fS(e,t){return{...e,key:`${e.key}:complete`,title:Fx,summary:t,tone:`complete`,metaLabel:`Complete`,steps:e.steps.map(e=>({...e,status:`done`}))}}function pS(e,t){let n=e.completionSource;return n===void 0?!0:n.activityRef===void 0?n.workflowRef===void 0?n.taskId===void 0?!0:t.task_id===n.taskId:t.workflow_ref===n.workflowRef:t.activity_ref===n.activityRef}function mS(e){if(e.status===`idle`)return[];let t=[];if(e.status===`pending`){let n=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};t.push({key:`pending`,label:`Needs input`,title:`Needs input`,tone:`pending`,target:n})}let n=e.last_conclusion?.kind===`failed`?e.last_conclusion.task_id:e.status===`failed`?e.active_task?.id??e.last_conclusion?.task_id:void 0;if(n!==void 0&&t.push({key:`failed`,label:`Run failed`,tone:`failed`,target:{kind:`task`,taskId:n}}),e.status===`running`&&e.active_task!==void 0){let n=tS(e.summary);t.push({key:`running`,label:n.label,title:n.label,tone:`running`,target:{kind:`task`,taskId:e.active_task.id}})}let r=nS(e);return r!==null&&t.push(r),t}var hS=`/assets/beethoven-symphony-5-opening-ypVy5SB4.svg`,gS=`/assets/beethoven-symphony-7-allegretto-B3bc-cZD.svg`,_S=`/assets/dvorak-symphony-9-largo-BEgNL3HB.svg`,vS=`/assets/mozart-symphony-18-allegro-B5-MrLL1.svg`,yS=`/assets/Tutti-square-BqFU7F0D.png`,bS=`/assets/Tutti-B7gEyTp1.png`,xS=`/assets/tutti_avatar-BBhaZGi3.png`,SS=`/assets/avatar-avery-CkLXb185.svg`,CS=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-7dff0831'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-shortCurls-7dff0831'%3e%3cpath%20d='m15.3%2027.49%201.58%204.38%201.06-9.52s2.27%201.27%203.44-.26.16-3.47.16-3.47%201.81.55%203.31-.8c1.87-1.67%201.26-3.46%201.26-3.46s1.71%201.9%204.5%201.1c2.77-.8%203.14-2.76%203.14-2.76s.56%202.18%203.4%202.12%203.2-2.01%203.2-2.01%200%202.43%202.43%203.14%203.43-1.24%203.43-1.24c0%20.02-.9%202.39.66%203.76%201.44%201.26%203.5.35%203.5.35s-.73%202.3.77%203.62c1.6%201.4%203.48.6%203.48.6l.77%208.34%201.8-3.8s1.4-.13%202.72.15c0%20.01%202.58-2.78%201.15-5.9s-3.64-2.86-3.64-2.86%201.95-3.05.13-5.65-4.94-1.96-4.94-1.96%201.18-3.52-1.68-5.27-5.92.46-5.92.46-.1-3.7-3.2-4.16c-3.26-.48-4.58%202.66-4.58%202.66s-1.35-2.89-4.14-2.44c-2.8.44-3.32%203.53-3.32%203.53S27.32%203.57%2024.92%205s-1.8%204.51-1.8%204.51-2.98-2.24-5.32-.23-.14%205.1-.14%205.1-3.87-1.12-5.04%201.8%201.66%204.95%201.66%204.95-5.35%201.16-2.82%207.33c0%200%20.6-.27%202.02-.62s1.8-.38%201.8-.38z'%20fill='%23000000'/%3e%3c/g%3e%3cclipPath%20id='clip-7dff0831'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-7dff0831)'%3e%3crect%20width='80'%20height='80'%20fill='%23e5f4ec'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-7dff0831'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-shortCurls-7dff0831'/%3e%3c/g%3e%3c/svg%3e`,wS=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-46c131e2'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-fluffy-46c131e2'%3e%3cpath%20d='M16.45%2029.48s13.74%2023.53%203.86%2028.24C9.05%2063.08-1.2%2048.01.1%2036.77s10.96-16.35%2010.96-16.35-.58-9.5%209.2-15.04c9.78-5.55%2016.64.44%2016.64.44s8.06-5.9%2015.5-1.37c7.46%204.53%207.26%2014.68%207.26%2014.68s13.74-.56%2013.65%2016.47c-.08%2015.17-10.03%2022.94-16.8%2021.6-10.45-2.07%201.27-29.22%201.27-29.22s-14.4%201.04-20.14-9.75c0%200-4%205.95-9.7%208.62a32%2032%200%200%201-11.47%202.64z'%20fill='%231d5dff'/%3e%3c/g%3e%3cclipPath%20id='clip-46c131e2'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-46c131e2)'%3e%3crect%20width='80'%20height='80'%20fill='%23fbf0d1'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-46c131e2'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-fluffy-46c131e2'/%3e%3c/g%3e%3c/svg%3e`,TS=`/assets/ode-to-joy-SNBUPr3-.svg`,ES=yS,DS=bS,OS=xS,kS={logoSrc:bS,tuttiAvatarSrc:xS,scoreSrc:TS,humanAvatars:{fey:CS,avery:SS,jun:wS}};function AS({onClick:e}){let t=(0,P.jsx)(Ds,{src:DS,label:`Tutti`});return e===void 0?t:(0,P.jsx)(Os,{logo:t,label:`Tutti Project Center`,onClick:e})}function jS({onClick:e}){return(0,P.jsx)(Os,{logo:(0,P.jsx)(Ds,{src:DS,className:`tutti-logo`}),onClick:e})}var MS=[hS,gS,_S,vS];function NS(){return MS[Math.min(MS.length-1,Math.floor(Math.random()*MS.length))]}function PS({backgroundPattern:e,children:t,...n}){let[r]=(0,N.useState)(NS);return(0,P.jsx)(Vo,{...e===void 0?{backgroundImageSrc:r}:{backgroundPattern:e},...n,children:t})}function FS({actions:e,children:t,onBrandClick:n}){return(0,P.jsxs)(PS,{children:[(0,P.jsx)(Ho,{brand:(0,P.jsx)(jS,{onClick:n}),actions:e}),t]})}function IS({children:e,label:t,onBrandClick:n}){return(0,P.jsx)(FS,{onBrandClick:n,children:(0,P.jsx)(Wo,{"aria-label":t,children:e})})}function LS({auth:e,mobileAuth:t,onBrandClick:n}){return(0,P.jsx)(PS,{backgroundPattern:`dots`,className:`homepage-entry-page`,children:(0,P.jsx)(cd,{brand:(0,P.jsx)(jS,{onClick:n}),visual:(0,P.jsx)(Vd,{assets:kS}),auth:e,mobileAuth:t})})}function RS({phase:e,form:t,onChange:n}){return e===`code`?(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ns,{label:`Email verification code`,children:(0,P.jsx)(ks,{autoComplete:`one-time-code`,inputMode:`numeric`,type:`text`,value:t.code,onChange:e=>n({code:e.target.value}),placeholder:`Enter email code`,maxLength:6})})}):e===`profile`?(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ns,{label:`Display name`,children:(0,P.jsx)(ks,{autoComplete:`name`,type:`text`,value:t.displayName,onChange:e=>n({displayName:e.target.value}),placeholder:`username`})}),(0,P.jsx)(`p`,{className:`form-note`,children:`This name cannot be changed yet.`})]}):(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ns,{label:`Email`,children:(0,P.jsx)(ks,{autoComplete:`email`,type:`email`,value:t.email,onChange:e=>n({email:e.target.value}),placeholder:`alex@example.com`})})})}function zS({surface:e,phase:t,form:n,pending:r,error:i,submitDisabled:a,submitLabel:o,pendingLabel:s,onChange:c,onSubmit:l,onBack:u}){let d={title:t===`profile`?`Choose display name`:`Sign in`,description:t===`profile`?`Set the name your teammates will see.`:t===`code`?`Enter your email verification code.`:`Use your email to continue.`,onSubmit:l,action:(0,P.jsxs)(Ss,{type:`submit`,disabled:a||r,children:[r?s??(t===`profile`?`Saving`:t===`code`?`Verifying`:`Sending code`):o??(t===`profile`?`Save name`:t===`code`?`Verify email code`:`Send code`),(0,P.jsx)(ai,{"aria-hidden":`true`})]}),secondaryAction:t===`code`&&u!==void 0?(0,P.jsxs)(Cs,{type:`button`,onClick:u,disabled:r,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:i===null?void 0:(0,P.jsx)(Ps,{children:i}),children:(0,P.jsx)(RS,{phase:t,form:n,onChange:c})};return e===`card`?(0,P.jsx)(Xd,{...d}):(0,P.jsx)(ld,{...d})}function BS(e){return(0,P.jsx)(zS,{...e,surface:`card`})}function VS(e){return(0,P.jsx)(zS,{...e,surface:`rail`})}function HS({onBrandClick:e,...t}){return(0,P.jsx)(LS,{onBrandClick:e,auth:(0,P.jsx)(VS,{...t}),mobileAuth:(0,P.jsx)(BS,{...t})})}function US({nextKind:e,actionPending:t,loginForm:n,onRetry:r,onAccept:i,onOpen:a}){if(e===`loading`)return(0,P.jsx)(Cs,{type:`button`,disabled:!0,children:`Loading`});if(e===`error`)return(0,P.jsx)(Cs,{type:`button`,onClick:r,children:`Retry`});if(e===`invalid_or_expired`)return(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(na,{"aria-hidden":`true`}),`Invalid invite`]});if(e===`login_required`){let e=n?.phase===`profile`?`Save name`:n?.phase===`code`?`Verify email code`:`Send code`,r=n?.phase===`profile`?`Saving`:n?.phase===`code`?`Verifying`:`Sending code`;return(0,P.jsxs)(Ss,{type:`submit`,disabled:t||n?.submitDisabled===!0,children:[t?r:e,(0,P.jsx)(ai,{"aria-hidden":`true`})]})}return e===`accept_join`?(0,P.jsxs)(Ss,{type:`button`,disabled:t,onClick:i,children:[t?`Joining`:`Accept and open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):e===`open_workspace`?(0,P.jsxs)(Ss,{type:`button`,disabled:t,onClick:a,children:[t?`Opening`:`Open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(Hi,{"aria-hidden":`true`}),`Host offline`]})}function WS({nextKind:e,error:t}){return e===`loading`?null:e===`error`?(0,P.jsx)(aa,{tone:`error`,icon:(0,P.jsx)(na,{"aria-hidden":`true`}),children:t??`Invite unavailable`}):e===`invalid_or_expired`?(0,P.jsx)(aa,{tone:`error`,icon:(0,P.jsx)(na,{"aria-hidden":`true`}),children:`Join token is invalid or expired`}):e===`host_offline`?(0,P.jsx)(aa,{tone:`warning`,icon:(0,P.jsx)(Hi,{"aria-hidden":`true`}),children:`Host is offline`}):null}function GS({projectName:e,description:t,hostLabel:n,hostOnline:r,nextKind:i,accountLabel:a,membershipLabel:o,actionPending:s,error:c,loginForm:l,onBrandClick:u,onRetry:d,onAccept:f,onOpen:p}){let m=i===`login_required`&&l!==void 0;return(0,P.jsx)(IS,{label:`Join project`,onBrandClick:u,children:(0,P.jsxs)(Xd,{title:`Join project`,description:t,onSubmit:e=>{if(m){l.onSubmit(e);return}e.preventDefault()},action:(0,P.jsx)(US,{nextKind:i,actionPending:m?l.pending:s,...m?{loginForm:l}:{},onAccept:f,onOpen:p,...d===void 0?{}:{onRetry:d}}),secondaryAction:m&&l.phase===`code`&&l.onBack!==void 0?(0,P.jsxs)(Cs,{type:`button`,onClick:l.onBack,disabled:l.pending,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:(0,P.jsxs)(P.Fragment,{children:[m&&l.error!==null?(0,P.jsx)(Ps,{children:l.error}):null,(0,P.jsx)(WS,{nextKind:i,error:c}),c===null||i===`error`?null:(0,P.jsx)(Ps,{children:c})]}),children:[(0,P.jsx)(Zd,{projectName:e,hostLabel:n,hostOnline:r}),m?(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(RS,{phase:l.phase,form:l.form,onChange:l.onChange})}):(0,P.jsx)(Qd,{label:a===null?`Account`:`Signed in as`,value:a??`Sign in required`,action:o===null?null:(0,P.jsx)(`span`,{className:`quiet-link`,children:o})})]})})}var KS=`https://developers.openai.com/api/reference/resources/responses`;function qS(e){switch(e.status){case`online`:return`Online`;case`reconnecting`:return`Reconnecting`;case`relay-unavailable`:return`Relay unavailable`;case`stale`:return`Needs restart`;case`stopped`:return`Stopped`;case`workspace-missing`:return`Folder missing`;case`workspace-replaced`:return`Folder changed`;case`invalid`:return`Needs attention`}}function JS(e){return(e.status===`online`||e.status===`reconnecting`)&&e.provider_status===`configured`}function YS(e){return(e.status===`stopped`||e.status===`stale`||e.status===`relay-unavailable`)&&e.provider_status===`configured`}function XS(e,t){let n=Date.parse(e.activity_at??``),r=Date.parse(t.activity_at??``),i=Number.isNaN(n)?0:n;return(Number.isNaN(r)?0:r)-i||e.display_name.localeCompare(t.display_name,`en`)||e.project_id.localeCompare(t.project_id,`en`)}function ZS(e){return e.provider_status===`configured`?e.provider_model?.trim()||`Provider ready`:e.provider_status===`invalid`?`Provider issue`:`Provider needed`}function QS({project:e,pending:t,onLaunch:n,onOpen:r,onCopyInvite:i,onStop:a}){return e.status===`online`||e.status===`reconnecting`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Ss,{type:`button`,disabled:t||e.open_url===void 0,onClick:r,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),`Open`]}),(0,P.jsxs)(Cs,{type:`button`,disabled:t,onClick:i,children:[(0,P.jsx)(Ai,{"aria-hidden":`true`}),`Invite`]}),(0,P.jsxs)(Cs,{type:`button`,disabled:t,onClick:a,children:[(0,P.jsx)(Qi,{"aria-hidden":`true`}),`Stop`]})]}):(0,P.jsxs)(Cs,{type:`button`,disabled:t||!YS(e),onClick:n,children:[(0,P.jsx)(Wi,{"aria-hidden":`true`}),`Resume`]})}function $S({form:e,models:t,projects:n,projectsLoading:r,sessionLoading:i,sessionError:a,createOpen:o,createStep:s,modelDiscoveryPending:c,launchPending:l,projectActionPending:u,highlightedProjectId:d,onChange:f,onCreateOpenChange:p,onCreateSubmit:m,onCreateBack:h,onChooseFolder:g,onRefresh:_,onLaunchExisting:v,onOpenProject:y,onCopyInvite:b,onStopProject:x}){let S=[`Folder`,`Details`,`Provider`,`Model`],C=S.findIndex(e=>e.toLowerCase()===s),w=c||l,T=s===`folder`?e.workspacePath.trim()!==``:s===`details`?e.displayName.trim()!==``:s===`provider`?e.baseUrl.trim()!==``&&e.apiKey.trim()!==``:t.length>0&&e.model.trim()!==``,E=n.filter(JS).sort(XS),ee=n.filter(YS).sort(XS),D=n.filter(e=>!JS(e)&&!YS(e)).sort(XS),O=e=>(0,P.jsx)(gf,{title:e.display_name,statusLabel:qS(e),online:e.status===`online`,path:e.workspace_path,createdLabel:Qn(e.created_at),providerLabel:ZS(e),providerStatus:e.provider_status,highlighted:e.project_id===d,actions:(0,P.jsx)(QS,{project:e,pending:u===e.project_id,onLaunch:()=>v(e),onOpen:()=>y(e),onCopyInvite:()=>b(e),onStop:()=>x(e)})},e.project_id);return(0,P.jsx)(FS,{onBrandClick:_,children:(0,P.jsxs)(Uo,{children:[(0,P.jsxs)($d,{className:`local-console-card`,title:`Local projects`,accountAction:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(xs,{type:`button`,label:`Refresh projects`,icon:(0,P.jsx)(Ui,{"aria-hidden":`true`}),disabled:r,onClick:_}),(0,P.jsxs)(Ss,{type:`button`,disabled:i||a!==null,onClick:()=>p(!0),children:[(0,P.jsx)(Vi,{"aria-hidden":`true`}),`New project`]})]}),"aria-label":`Tutti Local Console`,children:[r||i?(0,P.jsx)(af,{"aria-label":`Machine projects`,children:(0,P.jsx)(cf,{"aria-label":`Loading local projects`,children:(0,P.jsx)(oa,{})})}):a===null?n.length===0?(0,P.jsx)(af,{"aria-label":`Machine projects`,children:(0,P.jsx)(cf,{children:(0,P.jsx)(aa,{children:`Create your first local project.`})})}):null:(0,P.jsx)(af,{"aria-label":`Machine projects`,children:(0,P.jsx)(cf,{children:(0,P.jsx)(aa,{children:a})})}),r||i||n.length===0?null:(0,P.jsxs)(P.Fragment,{children:[E.length===0?null:(0,P.jsx)(mf,{title:`Available`,"aria-label":`Available projects`,children:E.map(O)}),ee.length===0?null:(0,P.jsx)(mf,{title:`Ready to resume`,"aria-label":`Projects ready to resume`,children:ee.map(O)}),D.length===0?null:(0,P.jsx)(hf,{children:D.map(O)})]})]}),(0,P.jsxs)(uf,{open:o,onOpenChange:p,steps:S,currentStep:Math.max(0,C),closeDisabled:w,explicitCloseOnly:!0,onSubmit:m,backAction:s===`folder`?void 0:(0,P.jsxs)(Cs,{type:`button`,disabled:w,onClick:h,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Back`]}),action:(0,P.jsxs)(Ss,{type:`submit`,disabled:!T||w||i,children:[s===`model`?(0,P.jsx)(Wi,{"aria-hidden":`true`}):(0,P.jsx)(ai,{"aria-hidden":`true`}),s===`provider`&&c?`Checking provider`:s===`model`?l?`Launching`:`Launch project`:`Continue`]}),children:[s===`folder`?(0,P.jsx)(pf,{title:`Project folder`,description:`Choose an existing folder on this machine. It can be empty or contain an existing project.`,children:(0,P.jsxs)(ff,{children:[(0,P.jsx)(ks,{"aria-label":`Project folder`,autoComplete:`off`,value:e.workspacePath,onChange:e=>f({workspacePath:e.target.value}),placeholder:`Enter an absolute project folder path`,autoFocus:!0}),(0,P.jsxs)(Cs,{type:`button`,onClick:g,children:[(0,P.jsx)(wi,{"aria-hidden":`true`}),`Choose folder`]})]})}):null,s===`details`?(0,P.jsx)(pf,{title:`Project details`,description:`Describe what you want to build with this project.`,children:(0,P.jsxs)(df,{children:[(0,P.jsx)(Ns,{label:`Project name`,className:`local-console-field-wide`,children:(0,P.jsx)(ks,{autoComplete:`off`,value:e.displayName,maxLength:80,onChange:e=>f({displayName:e.target.value}),placeholder:`Enter a project name`,autoFocus:!0})}),(0,P.jsx)(Ns,{label:`Project description (optional)`,className:`local-console-field-wide`,children:(0,P.jsx)(As,{value:e.description,maxLength:160,onChange:e=>f({description:e.target.value}),placeholder:`A short project description helps Tutti produce better code`})})]})}):null,s===`provider`?(0,P.jsx)(pf,{title:`Provider`,description:(0,P.jsxs)(P.Fragment,{children:[`Enter an endpoint compatible with the`,` `,(0,P.jsx)(Fs,{href:KS,"aria-label":`OpenAI Responses API documentation (opens in a new tab)`,icon:(0,P.jsx)(pi,{"aria-hidden":`true`}),children:`OpenAI Responses API`}),`. Credentials stay only on this machine.`]}),children:(0,P.jsxs)(df,{children:[(0,P.jsx)(Ns,{label:`Base URL`,children:(0,P.jsx)(ks,{autoComplete:`off`,inputMode:`url`,type:`url`,value:e.baseUrl,onChange:e=>f({baseUrl:e.target.value}),placeholder:`Enter Provider Base URL`,autoFocus:!0})}),(0,P.jsx)(Ns,{label:`API key`,children:(0,P.jsx)(ks,{autoComplete:`off`,type:`password`,value:e.apiKey,onChange:e=>f({apiKey:e.target.value}),placeholder:`Enter API key`})})]})}):null,s===`model`?(0,P.jsx)(pf,{title:`Model`,description:`Choose an available model or type another model name.`,children:(0,P.jsx)(Ns,{label:`Model`,children:(0,P.jsx)(js,{autoComplete:`off`,value:e.model,options:t,maxVisibleOptions:8,onValueChange:e=>f({model:e}),placeholder:`Choose or enter a model`,autoFocus:!0})})}):null]})]})})}function eC({onBrandClick:e,sessionError:t=null,...n}){let r={...n,error:n.error??t};return(0,P.jsx)(LS,{onBrandClick:e,auth:(0,P.jsx)(VS,{...r}),mobileAuth:(0,P.jsx)(BS,{...r})})}function tC({account:e,projects:t,loading:n,error:r,openPending:i,logoutPending:a,joinLinkForm:o,onCopyLaunchCommands:s,onBrandClick:c,onLogout:l,onOpenProject:u}){let d=n||r!==null||t.length>0,f=t.filter(e=>e.hostStatus===`offline`),p=t.filter(e=>e.hostStatus!==`offline`),m=e=>(0,P.jsx)(sf,{title:e.displayName,statusLabel:`Host ${e.hostStatusLabel.toLowerCase()}`,online:e.canOpen,details:[{label:`Role`,value:e.membershipLabel},{label:`Opened`,value:e.lastOpenedLabel}],disabled:!e.canOpen||i,onClick:()=>u(e.relayProjectRef)},e.relayProjectRef);return(0,P.jsx)(FS,{onBrandClick:c,children:(0,P.jsx)(Uo,{children:(0,P.jsxs)($d,{title:`Projects`,...e===null?{}:{accountName:e.displayName,accountAction:(0,P.jsxs)(Cs,{type:`button`,onClick:l,disabled:a,children:[(0,P.jsx)(Ni,{"aria-hidden":`true`}),`Sign out`]})},"aria-label":`Project Center`,children:[(0,P.jsxs)(ef,{children:[(0,P.jsx)(nf,{title:`Join a project`,description:`Paste an invitation link or the full invitation message.`,inputLabel:`Invitation link or message`,placeholder:`Paste an invitation link or message`,value:o.value,error:o.error,onValueChange:o.onChange,"aria-label":`Join a project`,onSubmit:e=>{e.preventDefault(),o.onSubmit()}}),(0,P.jsx)(rf,{title:`Launch from your computer`,description:`Tutti turns a local project into a collaboration space for your team.`,commandLines:[`npm install -g @xfey/tutti`,`tutti`],onCopyCommands:s,"aria-label":`Launch a project from your computer`})]}),d?n?(0,P.jsx)(af,{children:(0,P.jsx)(cf,{"aria-label":`Loading projects`,children:(0,P.jsx)(oa,{})})}):r===null?(0,P.jsxs)(P.Fragment,{children:[p.length===0?null:(0,P.jsx)(af,{children:p.map(m)}),f.length===0?null:(0,P.jsx)(of,{title:`Host offline`,listLabel:`Host offline projects`,className:`project-center-offline-projects`,children:f.map(m)})]}):(0,P.jsx)(af,{children:(0,P.jsx)(cf,{"aria-label":`Project Center error`,children:(0,P.jsx)(aa,{tone:`error`,children:r})})}):null]})})})}function nC({form:e,pending:t,tokenMissing:n,onChange:r}){return(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ns,{label:`Project name`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.projectName,onChange:e=>r({projectName:e.target.value}),placeholder:`tutti-default`})}),(0,P.jsx)(Ns,{label:`OpenAI API key`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`password`,value:e.apiKey,onChange:e=>r({apiKey:e.target.value}),placeholder:`sk-...`})}),(0,P.jsx)(Ns,{label:`Base URL`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`url`,value:e.baseUrl,onChange:e=>r({baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})}),(0,P.jsx)(Ns,{label:`Default model`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.defaultModel,onChange:e=>r({defaultModel:e.target.value}),placeholder:`gpt-5.5`})})]})}function rC({form:e,statusLabel:t,configured:n,loading:r,pending:i,openProjectPending:a=!1,tokenMissing:o,error:s,success:c,onChange:l,onSubmit:u,onRetry:d,onBrandClick:f}){let p=i||a;return(0,P.jsx)(IS,{label:`Project setup`,onBrandClick:f,children:(0,P.jsxs)(Xd,{title:`Project setup`,description:`Configure the provider for this project.`,size:`wide`,onSubmit:u,action:o?(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(na,{"aria-hidden":`true`}),`Missing token`]}):s!==null&&r?(0,P.jsx)(Cs,{type:`button`,onClick:d,children:`Retry`}):a?(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ai,{"aria-hidden":`true`}),`Opening project`]}):(0,P.jsxs)(Ss,{type:`submit`,disabled:i||e.apiKey.trim()===``||e.projectName.trim()===``,children:[i?`Saving`:`Save provider`,(0,P.jsx)(Gi,{"aria-hidden":`true`})]}),feedback:(0,P.jsxs)(P.Fragment,{children:[c===null?null:(0,P.jsx)(aa,{icon:(0,P.jsx)(fi,{"aria-hidden":`true`}),children:c}),s===null?null:(0,P.jsx)(Ps,{children:s})]}),children:[(0,P.jsx)(Zd,{projectName:`OpenAI provider`,hostLabel:t,hostOnline:n,members:(0,P.jsx)(Oi,{"aria-hidden":`true`})}),(0,P.jsx)(Qd,{label:`Status`,value:r?`Loading`:t,action:n?(0,P.jsx)(fi,{"aria-hidden":`true`}):null}),(0,P.jsx)(nC,{form:e,pending:p,tokenMissing:o,onChange:l})]})})}var iC=`http://127.0.0.1:4370`;function aC(){return typeof window<`u`&&window.location.port!==`4372`?window.location.origin:iC}function oC(e){try{return new URL(e,aC()).toString()}catch{return e}}function sC({avatar:e,label:t,plain:n=!1,online:r=!1}){return(0,P.jsx)(Xo,{label:t,tone:e.color,plain:n,online:r,initials:e.initials,...e.kind===`image`?{imageUrl:oC(e.image_url)}:{}})}function cC({label:e=`Tutti`}){return(0,P.jsx)(Xo,{label:e,tone:`green`,className:`is-system`,imageUrl:OS,icon:(0,P.jsx)(si,{"aria-hidden":`true`})})}function lC({tone:e}){return e===`pending`?(0,P.jsx)(na,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(Mi,{"aria-hidden":`true`})}function uC({members:e}){return e===void 0||e.length===0?null:(0,P.jsx)(Zo,{"aria-label":`Members`,children:e.map(e=>(0,P.jsx)(sC,{avatar:e.avatar,label:e.displayName},e.key))})}function dC({activePage:e,statusShortcuts:t,unread:n,artifactSignal:r,mobileContext:i,children:a,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenTimeline:f,onOpenSettings:p,onActivateStatusShortcut:m,getStatusShortcutAriaControls:h}){let g=e!==`chat`&&n?.chat===!0,_=e!==`worklist`&&n?.worklist===!0,v=r?.available===!0,y=e!==`references`&&n?.references===!0,b=e!==`skills`&&n?.skills===!0;return(0,P.jsx)(Go,{children:(0,P.jsx)(Ko,{className:`is-headerless`,sidebar:(0,P.jsxs)(qo,{brand:(0,P.jsx)(AS,{...o===void 0?{}:{onClick:o}}),mobileTitle:i.title,...i.meta===void 0?{}:{mobileMeta:i.meta},...i.action===void 0?{}:{mobileAction:i.action},...t.length===0?{}:{status:t.map(e=>(0,N.createElement)(Yo,{icon:(0,P.jsx)(lC,{tone:e.tone}),label:e.label,tone:e.tone,onClick:()=>m?.(e),...h?.(e)===void 0?{}:{"aria-controls":h(e)},key:e.key}))},footer:(0,P.jsx)(Jo,{icon:(0,P.jsx)(qi,{"aria-hidden":`true`}),label:`Settings`,active:e===`settings`,onClick:e===`settings`?void 0:p}),children:[(0,P.jsx)(Jo,{icon:(0,P.jsx)(wy,{"aria-hidden":`true`}),label:`Chat`,active:e===`chat`,badge:g?{label:`Unread messages`}:!1,onClick:e===`chat`?void 0:s}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),label:`Worklist`,active:e===`worklist`,badge:_?{label:`Unread worklist updates`}:!1,onClick:e===`worklist`?void 0:c}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`}),label:`Artifacts`,active:e===`artifacts`,badge:v?{label:`Artifacts available`,text:`Live`,variant:`pill`}:!1,onClick:e===`artifacts`?void 0:u}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`}),label:`References`,active:e===`references`,badge:y?{label:`New reference files`}:!1,onClick:e===`references`?void 0:l}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(Xi,{"aria-hidden":`true`}),label:`Skills`,active:e===`skills`,badge:b?{label:`New skill updates`}:!1,onClick:e===`skills`?void 0:d}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),label:`Timeline`,active:e===`timeline`,onClick:e===`timeline`?void 0:f})]}),children:a})})}function fC(){return(0,P.jsx)(Ds,{src:DS,className:`empty-state-brand-logo`})}function pC(e){return(0,P.jsx)(aa,{watermark:(0,P.jsx)(fC,{}),...e})}var mC=`tutti.execution-score-themes.v1`,hC=40,gC={assignments:[],bag:[]};function _C(){return{assignments:[],bag:[]}}function vC(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function yC(e,t){if(typeof e!=`object`||!e)return null;let n=e;if(!Array.isArray(n.assignments)||!Array.isArray(n.bag))return null;let r=n.assignments.filter(e=>typeof e==`object`&&!!e&&typeof e.identity==`string`&&t.has(String(e.themeId))),i=n.bag.filter(e=>typeof e==`string`&&t.has(e)),a=typeof n.recent==`string`&&t.has(n.recent)?n.recent:void 0;return{assignments:r,bag:i,...a===void 0?{}:{recent:a}}}function bC(e,t){if(e===null)return gC;try{let n=e.getItem(mC);return n===null?_C():yC(JSON.parse(n),t)??_C()}catch{return gC}}function xC(e,t){if(gC=t,e!==null)try{e.setItem(mC,JSON.stringify(t))}catch{}}function SC(e,t,n){let r=e.map(e=>e.id);for(let e=r.length-1;e>0;--e){let t=Math.min(e,Math.max(0,Math.floor(n()*(e+1))));[r[e],r[t]]=[r[t],r[e]]}if(r.length>1&&r[0]===t){let e=r.findIndex(e=>e!==t);[r[0],r[e]]=[r[e],r[0]]}return r}function CC(e,t={}){let n=t.themes??zo;if(n.length===0)throw Error(`Execution score themes are unavailable`);let r=new Map(n.map(e=>[e.id,e])),i=new Set(r.keys()),a=t.storage===void 0?vC():t.storage,o=bC(a,i),s=o.assignments.find(t=>t.identity===e),c=s===void 0?void 0:r.get(s.themeId);if(c!==void 0)return c;let l=t.random??Math.random,u=o.bag.length>0?[...o.bag]:SC(n,o.recent,l),d=u.shift(),f=d===void 0?void 0:r.get(d);if(f===void 0)throw Error(`Execution score themes are unavailable`);return xC(a,{assignments:[...o.assignments,{identity:e,themeId:f.id}].slice(-hC),bag:u,recent:f.id}),f}function wC(e){return`round-card-${e}`}function TC(e){return`approval-card-${e}`}function EC(e){return`chat-message-${e}`}var DC=`workspace-scratchpad`,OC=720,kC=80,AC=160,jC=96,MC=160,NC=2;function PC(e){return e.completionSource?.activityRef??e.completionSource?.workflowRef??e.completionSource?.taskId??e.key}function FC({progress:e}){let t=PC(e),[n]=(0,N.useState)(()=>CC(t)),r=(0,N.useRef)(t),i=(0,N.useRef)(e.tone),[a,o]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let n=r.current,a=i.current;if(r.current=t,i.current=e.tone,e.tone!==`running`||a===`pending`||n===t){o(null);return}o(t);let s=window.setTimeout(()=>{o(e=>e===t?null:e)},OC);return()=>{window.clearTimeout(s)}},[e.tone,t]),e.tone===`running`||e.tone===`pending`||e.tone===`complete`){let r=e.tone===`running`&&a===t,i=e.steps.find(e=>e.status===`running`||e.status===`pending`)??e.steps.at(-1),o=e.completionTarget?.kind===`task`?`Task completed`:`Procedure completed`,s=e.tone===`complete`?void 0:i?.detail??(e.tone===`pending`?e.summary:void 0),c=e.tone===`complete`?void 0:i?.elapsedLabel,l=e.tone===`complete`?void 0:i?.metrics;return(0,P.jsx)(xo,{stageLabel:r?`Loading the next movement…`:e.tone===`complete`?o:i?.label??e.summary,...r||s===void 0?{}:{stageDetail:s},...r||c===void 0?{}:{elapsedLabel:c},...r||l===void 0?{}:{metrics:l},scoreLabel:r?`Loading the next movement score`:e.tone===`complete`?`${o} score cadence`:e.tone===`pending`?`Execution score paused while waiting for input`:`${i?.label??`Execution`} running score using ${n.shortName}`,state:r?`handoff`:e.tone===`complete`?`complete`:e.tone===`pending`?`paused`:`running`,units:n.units,playbackBpm:n.tempo,openingClef:n.clef,keySignatureFifths:n.keySignatureFifths,timeSignature:n.meter})}return(0,P.jsx)(Db,{title:e.title,summary:e.summary,tone:e.tone,steps:e.steps,...e.metaLabel===void 0?{}:{metaLabel:e.metaLabel}})}function IC(e){if(e===void 0)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function LC(e,t){if(e===null)return null;let n=IC(e.requestedAt);if(n===null)return t.length;let r=t.findIndex(e=>{let t=IC(e.createdAt);return t!==null&&t>n});return r===-1?t.length:r}function RC(e,{focusSelector:t}={}){let n=typeof document>`u`?null:document.getElementById(e);n!==null&&(n.scrollIntoView({block:`center`}),t!==void 0&&n.querySelector(t)?.focus({preventScroll:!0}))}function zC(e){return e.messageKind===`system_notice`&&e.workflowRef!==void 0&&(e.body.startsWith(`Worklist updated with `)||e.body===`Worklist is already covered by existing tasks.`)}function BC(e,t){if(t===void 0)return;let n=t.label.trim(),r=t.handle?.trim()??n;if(n===``||r===``)return;let i=r.toLocaleLowerCase();e.has(i)||e.set(i,{id:t.id,label:n,handle:r})}function VC({members:e,messages:t,clarificationMessagesByRoundId:n}){let r=new Map;BC(r,{id:`tutti`,label:`Tutti`,handle:`tutti`});for(let t of e)BC(r,{id:t.key,label:t.displayName});for(let e of t)BC(r,{id:`message:${e.author}`,label:e.author,...e.avatarKind===`tutti`?{handle:`tutti`}:{}});for(let e of Object.values(n))for(let t of e)BC(r,{id:`round-message:${t.author}`,label:t.author,...t.avatarKind===`tutti`?{handle:`tutti`}:{}});return[...r.values()]}function HC({message:e}){return e.avatarKind===`tutti`?(0,P.jsx)(cC,{label:e.author}):(0,P.jsx)(sC,{avatar:e.avatar??{kind:`initials`,initials:dr(e.author),color:`blue`},label:e.author,online:e.online})}function UC({projectName:e,projectDescription:t=``,members:n,messages:r,scratchpad:i,executionProgress:a=null,activeApproval:o=null,activeClarification:s,clarificationMessagesByRoundId:c,statusShortcuts:l,unread:u,artifactSignal:d,draft:f,roundDraft:p,sendPending:m,scratchpadSyncPending:h=!1,scratchpadActionsDisabled:g=!1,scratchpadSubmitPending:_=!1,referenceUploadPending:v=!1,focusMessageId:y=null,messageHistoryIdentity:b=`latest`,initialMessagePosition:x=y===null?`latest`:`focus`,hasOlderMessages:S=!1,hasNewerMessages:C=!1,loadingOlderMessages:w=!1,loadingNewerMessages:T=!1,historyConnectedToLatest:E=!0,roundSendPending:ee=!1,roundSubmitPending:D=!1,submittedRoundId:O=null,approvalDecisionPending:k=!1,projectNameSaving:te=!1,projectDescriptionSaving:ne=!1,loading:A=!1,unavailable:re=!1,onDraftChange:ie,onMessageFocused:j,onInitialMessagePositioned:M,onLoadOlderMessages:ae,onLoadNewerMessages:oe,onJumpToLatest:se,onUploadReferenceFile:ce,onOpenReferenceFile:le,onRoundDraftChange:ue,onSendMessage:de,onSendRoundMessage:fe,onSubmitRound:pe,onDecideApproval:me,onSubmitScratchpad:he,onUpdateProjectDisplayName:ge,onUpdateProjectDescription:_e,onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenWorklistTask:be,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Ee}){let[De,Oe]=(0,N.useState)(!1),ke=(0,N.useRef)(null),Ae=(0,N.useRef)(!1),je=(0,N.useRef)(null),Me=(0,N.useRef)(null),Ne=(0,N.useRef)(!0),Pe=(0,N.useRef)(void 0),Fe=(0,N.useRef)(b),Ie=(0,N.useRef)(null),Le=(0,P.jsx)(By,{className:`chat-project-title-edit`,value:e,placeholder:`Untitled project`,ariaLabel:`Edit project name`,maxLength:kC,saving:te,disabled:A,...ge===void 0?{}:{onUpdate:ge}}),Re=(0,P.jsx)(By,{className:`chat-project-description-edit`,value:t,placeholder:`Add a project description`,ariaLabel:`Edit project description`,maxLength:AC,allowEmpty:!0,saving:ne,disabled:A,..._e===void 0?{}:{onUpdate:_e}}),ze=s!==null&&r.some(e=>e.id===s.cardMessageId),Be=new Map;for(let e of r)e.clarificationCard!==void 0&&e.workflowRef!==void 0&&Be.set(e.workflowRef,e.clarificationCard.roundId);let Ve=new Map;for(let e of r){if(!zC(e)||e.workflowRef===void 0)continue;let t=Be.get(e.workflowRef);t!==void 0&&Ve.set(t,{...e,id:`round-result:${e.id}`,messageKind:`agent_text`,author:`Tutti`,avatarKind:`tutti`,online:!1})}let He=e=>{let t=c[e]??[],n=Ve.get(e);return n===void 0||t.some(e=>e.body===n.body)?t:[...t,n]},Ue=VC({members:n,messages:r,clarificationMessagesByRoundId:c}),We=ce===void 0?void 0:e=>{for(let t of e)ce(t)};(0,N.useLayoutEffect)(()=>{Fe.current!==b&&(Fe.current=b,Ae.current=!1,je.current=null,Pe.current=void 0)},[b]),(0,N.useLayoutEffect)(()=>{let e=je.current;if(e!==null){if(r[0]?.id!==e.firstMessageId){let t=ke.current;t!==null&&(t.scrollTop=e.scrollTop+Math.max(0,t.scrollHeight-e.scrollHeight),Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=NC),je.current=null;return}w||(je.current=null)}},[w,r]),(0,N.useEffect)(()=>{if(y===null||!r.some(e=>e.id===y))return;Ae.current=!0,RC(EC(y));let e=ke.current;e!==null&&(Ne.current=e.scrollHeight-e.clientHeight-e.scrollTop<=NC),j?.()},[y,r,j]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`latest`||y!==null||r.length===0&&s===null&&o===null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,Ne.current=!0,Ae.current=!0});return()=>window.cancelAnimationFrame(t)},[o,s,y,A,r,re]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`start`||y!==null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=0,Ne.current=e.scrollHeight<=e.clientHeight+NC,Ae.current=!0,M?.()});return()=>window.cancelAnimationFrame(t)},[y,x,A,r,M,re]);let Ge=()=>{if(!S||w||je.current!==null||ae===void 0)return;let e=ke.current;e!==null&&(je.current={firstMessageId:r[0]?.id,scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ae())},Ke=()=>{!C||T||oe===void 0||oe()},qe=e=>{let t=e.currentTarget;Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=NC,Me.current!==null&&window.cancelAnimationFrame(Me.current),Me.current=window.requestAnimationFrame(()=>{if(Me.current=null,t.scrollTop<=jC){Ge();return}t.scrollHeight-t.clientHeight-t.scrollTop<=MC&&Ke()})};(0,N.useEffect)(()=>()=>{Me.current!==null&&window.cancelAnimationFrame(Me.current)},[]),(0,N.useEffect)(()=>{if(A||re||w||T||!Ae.current)return;let e=ke.current;if(e===null||e.scrollHeight>e.clientHeight+NC)return;let t=window.requestAnimationFrame(()=>{S?Ge():C&&Ke()});return()=>window.cancelAnimationFrame(t)},[C,S,A,T,w,r,re]);let Je=r.at(-1)?.id;(0,N.useEffect)(()=>{let e=Pe.current;if(Pe.current=Je,e===void 0||e===Je||!E||!Ne.current||!Ae.current||je.current!==null)return;let t=ke.current;if(t===null)return;let n=window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight,Ne.current=!0});return()=>window.cancelAnimationFrame(n)},[E,Je]);let Ye=({key:e,roundId:t,title:n,summary:r,request:i,contextLabel:a,writable:o})=>{let s=He(t),c=s.filter(e=>e.messageKind===`user_text`).length;return(0,P.jsx)(Fb,{id:wC(t),tabIndex:-1,title:n,summary:r,request:i,...a===void 0?{}:{contextLabel:a},messages:s.map(e=>({id:e.id,author:e.author,body:e.body,time:e.time,avatar:(0,P.jsx)(HC,{message:e})})),replyCount:c,draft:o?p:``,defaultOpen:!0,readOnly:!o,status:o?`pending`:`done`,statusLabel:o?`needs input`:`submitted`,mentionOptions:Ue,sendPending:o&&ee,submitPending:o&&D,onDraftChange:ue,onSendMessage:fe,onSubmitRound:pe},`${e}:${o?`writable`:`sealed`}`)},Xe=e=>{if(e.target.kind===`approval`&&o!==null){if(!E){Ie.current=e,se?.();return}RC(TC(o.approvalId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`clarification`&&s!==null){if(!E&&!ze){Ie.current=e,se?.();return}RC(wC(s.roundId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`scratchpad`){RC(DC);return}Ee?.(e)};(0,N.useEffect)(()=>{let e=Ie.current;if(!E||A||e===null)return;Ie.current=null;let t=window.requestAnimationFrame(()=>{e.target.kind===`approval`&&o!==null?RC(TC(o.approvalId),{focusSelector:`.chat-event-card-header`}):e.target.kind===`clarification`&&s!==null&&RC(wC(s.roundId),{focusSelector:`.chat-event-card-header`})});return()=>window.cancelAnimationFrame(t)},[o,s,E,A,r]);let Ze=e=>s===null?null:Ye({key:e,roundId:s.roundId,title:s.title,summary:s.summary,request:s.request,contextLabel:s.ownerLabel,writable:s.status===`writable`&&s.roundId!==O}),Qe=()=>o===null?null:(0,P.jsx)(zb,{id:TC(o.approvalId),tabIndex:-1,title:o.title,summary:o.summary,...o.reason===void 0?{}:{reason:o.reason},...o.detail===void 0?{}:{detail:o.detail,...o.detailLabel===void 0?{}:{detailLabel:o.detailLabel},...o.detailCode===void 0?{}:{detailCode:o.detailCode}},status:o.status,statusLabel:o.statusLabel,decisions:o.decisions,decisionPending:k,...o.resolutionLabel===void 0?{}:{resolutionLabel:o.resolutionLabel},onDecide:e=>me?.(o.approvalId,e)},`approval:${o.approvalId}:${o.status}`),$e=e=>{let t=e.clarificationCard;if(t===void 0)return null;let n=s!==null&&s.roundId===t.roundId;return Ye({key:e.id,roundId:t.roundId,title:n&&s!==null?s.title:t.title??`Clarification round ${t.roundId.slice(-4)}`,summary:n&&s!==null?s.summary:t.summary,request:n&&s!==null?s.request:t.summary,...n&&s!==null?{contextLabel:s.ownerLabel}:{},writable:n&&t.status===`writable`&&t.roundId!==O})},et=e=>{if(zC(e)&&Be.has(e.workflowRef??``))return null;if(e.messageKind===`clarification_card`)return $e(e);if(s!==null&&e.id===s.cardMessageId)return Ze(e.id);if(e.taskResult!==void 0)return(0,P.jsx)(Bb,{id:EC(e.id),tabIndex:-1,className:e.id===y?`is-focused`:void 0,title:e.taskResult.title,status:e.taskResult.status,taskId:e.taskResult.taskId,taskTitle:e.taskResult.taskTitle,summary:e.taskResult.summary,...e.taskResult.moduleName===void 0?{}:{moduleName:e.taskResult.moduleName},...e.taskResult.finalNote===void 0?{}:{finalNote:e.taskResult.finalNote},...e.taskResult.generatedFiles===void 0?{}:{generatedFiles:e.taskResult.generatedFiles},...e.taskResult.errorCode===void 0?{}:{errorCode:e.taskResult.errorCode},...be===void 0?{}:{onOpenTask:be}},e.id);let t=e.referenceFile;return(0,P.jsx)(Ty,{id:EC(e.id),tabIndex:-1,author:e.author,time:e.time,avatar:(0,P.jsx)(HC,{message:e}),className:e.id===y?`is-focused`:void 0,children:t===void 0?e.messageKind===`agent_text`?(0,P.jsx)(Ey,{children:e.body}):(0,P.jsx)(`p`,{children:(0,P.jsx)(Sy,{children:e.body})}):(0,P.jsx)(Ry,{name:t.name,category:t.category,...t.imageUrl===void 0?{}:{imageUrl:t.imageUrl},onClick:()=>le?.(t.path)})},e.id)},tt=E?LC(o,r):null,nt=()=>{let e=s!==null&&(ze||E)||o!==null&&E;return r.length===0&&!e&&!w&&!T?(0,P.jsx)(pC,{children:`No messages yet`}):(0,P.jsxs)(P.Fragment,{children:[w?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading earlier messages…`}):null,!E||ze?null:Ze(`active-round`),r.map((e,t)=>(0,P.jsxs)(N.Fragment,{children:[tt===t?Qe():null,et(e)]},`timeline:${e.id}`)),tt===r.length?Qe():null,T?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading newer messages…`}):null]})},rt=(e,t=!1)=>(0,P.jsx)(Cb,{id:e,tabIndex:-1,compact:t,title:i.title,summary:i.summary,sections:i.sections,submitAvailable:i.submitAvailable,...i.pages===void 0?{}:{pages:i.pages},...i.footerNote===void 0?{}:{footerNote:i.footerNote},...i.updatedLabelPrefix===void 0?{}:{updatedLabelPrefix:i.updatedLabelPrefix},syncPending:h,actionsDisabled:g,submitPending:_,onSubmitScratchpad:he,...be===void 0?{}:{onOpenCompiledTask:be},empty:(0,P.jsx)(pC,{children:`Scratchpad empty. Discuss more, tutti together!`}),...i.updatedLabel===void 0?{}:{updatedLabel:i.updatedLabel}}),it=(0,P.jsx)(`div`,{className:`chat-panel-actions`,children:(0,P.jsx)(uC,{members:n})});return(0,P.jsxs)(dC,{activePage:`chat`,statusShortcuts:l,mobileContext:{title:e,action:(0,P.jsx)(Jo,{className:h?`mobile-scratchpad-trigger is-syncing`:`mobile-scratchpad-trigger`,type:`button`,label:De?`Close Scratchpad`:`Open Scratchpad`,active:De,"aria-expanded":De,"aria-controls":`${DC}-mobile-sheet`,icon:(0,P.jsx)(Wy,{"aria-hidden":`true`}),onClick:()=>Oe(e=>!e)})},...u===void 0?{}:{unread:u},...d===void 0?{}:{artifactSignal:d},onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Xe,getStatusShortcutAriaControls:e=>e.target.kind===`approval`&&o!==null&&E?TC(o.approvalId):e.target.kind===`clarification`&&s!==null&&(E||ze)?wC(s.roundId):e.target.kind===`scratchpad`?DC:void 0,children:[(0,P.jsxs)(`section`,{className:`workspace-grid is-tutti chat-workspace-grid`,"aria-label":`Chat workspace`,children:[A?(0,P.jsx)(zy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(oa,{})}):re?(0,P.jsx)(zy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):(0,P.jsx)(zy,{title:Le,subtitle:Re,actions:it,streamRef:ke,onStreamScroll:qe,streamOverlay:C&&se!==void 0?(0,P.jsx)(Cs,{className:`chat-jump-latest`,type:`button`,onClick:se,children:`Jump to latest`}):void 0,dropUploadPending:v,...We===void 0?{}:{onDropFiles:We},composer:(0,P.jsx)(Uy,{value:f,pending:m,uploadPending:v,mentionOptions:Ue,onValueChange:ie,onComposerSubmit:de,...ce===void 0?{}:{onFileUpload:ce}}),empty:(0,P.jsx)(pC,{children:`No messages yet`}),children:nt()}),(0,P.jsxs)(`div`,{className:a===null?`chat-side-column`:`chat-side-column has-progress`,children:[rt(DC),a===null?null:(0,P.jsx)(FC,{progress:a})]})]}),De?(0,P.jsxs)(`div`,{className:`mobile-scratchpad-layer is-open`,id:`${DC}-mobile-sheet`,children:[(0,P.jsx)(`button`,{className:`mobile-scratchpad-backdrop`,type:`button`,"aria-label":`Close Scratchpad`,onClick:()=>Oe(!1)}),(0,P.jsxs)(`section`,{className:`mobile-scratchpad-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`Scratchpad`,children:[(0,P.jsxs)(`div`,{className:`mobile-scratchpad-card-head`,children:[(0,P.jsx)(`h2`,{children:`Scratchpad`}),(0,P.jsx)(xs,{className:`mobile-scratchpad-close`,type:`button`,label:`Close Scratchpad`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`}),onClick:()=>Oe(!1)})]}),(0,P.jsx)(`div`,{className:`mobile-scratchpad-card-body`,children:rt(`${DC}-mobile`,!0)})]})]}):null]})}function WC({statusShortcuts:e,unread:t,artifactSignal:n,state:r,loading:i=!1,unavailable:a=!1,restartPending:o=!1,stopPending:s=!1,onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenSkills:f,onOpenTimeline:p,onOpenSettings:m,onRestart:h,onStop:g,onActivateStatusShortcut:_}){let v=i?{status:`loading`}:a?{status:`not_declared`}:r;return(0,P.jsx)(dC,{activePage:`artifacts`,statusShortcuts:e,mobileContext:{title:v.status===`declared`?v.title:`Artifacts`,action:(0,P.jsx)(tx,{state:v,restartPending:o,stopPending:s,compact:!0,...h===void 0?{}:{onRestart:h},...g===void 0?{}:{onStop:g}})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenSkills:f,onOpenTimeline:p,onOpenSettings:m,onActivateStatusShortcut:_,children:(0,P.jsx)(`section`,{className:`workspace-grid artifacts-workspace-grid`,"aria-label":`Artifacts`,children:(0,P.jsx)(rx,{state:v,...a?{empty:(0,P.jsx)(pC,{children:`Workspace unavailable`})}:{},emptyWatermark:(0,P.jsx)(fC,{}),restartPending:o,stopPending:s,...h===void 0?{}:{onRestart:h},...g===void 0?{}:{onStop:g}})})})}function GC({statusShortcuts:e,unread:t,artifactSignal:n,files:r,detail:i,uploadPending:a=!1,fileSortMode:o=`time`,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectFile:_,onUploadFile:v,onFileSortModeChange:y}){let b=s||c;return(0,P.jsx)(dC,{activePage:`references`,statusShortcuts:e,mobileContext:{title:`References`,action:(0,P.jsx)(Hy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload reference`,pendingLabel:`Uploading reference`,pending:a,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Reference files`,children:(0,P.jsx)($b,{files:b?[]:r,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`References unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,fileSortMode:o,empty:s?(0,P.jsx)(pC,{children:`Loading reference files`}):c?(0,P.jsx)(pC,{children:`Workspace unavailable`}):(0,P.jsx)(pC,{children:`No reference files`}),onSelectFile:_,onUploadFile:v,...y===void 0?{}:{onFileSortModeChange:y}})})})}var KC=6,qC=`......`,JC=80,YC=160;function XC(e){let t=document.createElement(`canvas`).getContext(`2d`);if(t===null)return null;let n=window.getComputedStyle(e);return t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(` `),e=>t.measureText(e).width}function ZC(e,t,n){if(n(e)<=t)return e;let r=e.slice(-KC),i=Math.max(0,e.length-r.length),a=0,o=i;for(;a<o;){let i=Math.ceil((a+o)/2);n(`${e.slice(0,i)}${qC}${r}`)<=t?a=i:o=i-1}return`${e.slice(0,a)}${qC}${r}`}function QC({value:e}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(e);return(0,N.useEffect)(()=>{let n=t.current;if(n===null)return;let i=()=>{let t=XC(n),i=n.getBoundingClientRect().width;if(t===null||i<=0){r(e);return}let a=ZC(e,i,t);r(e=>e===a?e:a)};i();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(i);return a?.observe(n),window.addEventListener(`resize`,i),()=>{a?.disconnect(),window.removeEventListener(`resize`,i)}},[e]),(0,P.jsx)(`code`,{ref:t,className:`settings-masked-link`,title:e,"aria-label":e,children:n})}function $C({value:e,onCopy:t}){return t===void 0?(0,P.jsx)(QC,{value:e}):(0,P.jsx)(`button`,{className:`settings-value-button settings-link-copy-button`,type:`button`,"aria-label":`Copy invite link`,onClick:t,children:(0,P.jsx)(QC,{value:e})})}function ew(e,t){return e.map(e=>({id:e.id,title:e.title,rows:e.rows.map(e=>({label:e.label,value:e.identity===!0?(0,P.jsxs)(`div`,{className:`settings-identity`,children:[(0,P.jsx)(sC,{avatar:t.currentMember.avatar,label:t.currentMember.displayName}),(0,P.jsx)(`strong`,{children:t.currentMember.displayName})]}):e.value,...e.identity===!0?{plain:!0}:{},...e.code===void 0?{}:{code:e.code}}))}))}function tw({settings:e,onCopyJoinUrl:t}){let n=e.invite;return n===void 0?null:{label:`invite link`,value:n.joinUrl===void 0?`not recoverable`:(0,P.jsx)($C,{value:n.joinUrl,onCopy:t}),...n.joinUrl===void 0?{}:{plain:!0}}}function nw({settings:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,projectNameSaving:o=!1,projectDescriptionSaving:s=!1,onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,onCopyJoinUrl:g,onUpdateProjectDisplayName:_,onUpdateProjectDescription:v}){let y=e?.statuses??[],b=e===void 0?null:tw({settings:e,onCopyJoinUrl:g});return(0,P.jsx)(dC,{activePage:`settings`,statusShortcuts:t,mobileContext:{title:`Settings`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,children:(0,P.jsx)(`section`,{className:`workspace-grid settings-workspace-grid`,"aria-label":`Project settings`,children:(0,P.jsx)(`div`,{className:`settings-page-grid`,children:i?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Loading settings`,children:(0,P.jsx)(pC,{children:`Loading settings`})}):a?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(pC,{children:`Settings unavailable`})}):(0,P.jsx)(Jb,{statuses:y,sections:[{id:`settings-project`,title:`Project`,rows:[{label:`display_name`,plain:!0,value:(0,P.jsx)(By,{value:e.project.displayName,placeholder:`Untitled project`,ariaLabel:`Project display name`,maxLength:JC,saving:o,..._===void 0?{}:{onUpdate:_}})},{label:`description`,plain:!0,value:(0,P.jsx)(By,{value:e.project.description,placeholder:`Add a project description`,ariaLabel:`Project description`,maxLength:YC,allowEmpty:!0,saving:s,...v===void 0?{}:{onUpdate:v}})},...b===null?[]:[b]]},...ew(e.sections,e)]})})})})}var rw=[{title:`Awesome GitHub Copilot Skills`,href:`https://awesome-copilot.github.com/skills/`},{title:`Anthropic official skills`,href:`https://github.com/anthropics/skills`},{title:`Claude Skills Marketplace`,href:`https://claudeskills.info/skills/`}];function iw({statusShortcuts:e,unread:t,artifactSignal:n,skills:r,detail:i,uploadPending:a=!1,deletePending:o=!1,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y}){let b=s||c;return(0,P.jsx)(dC,{activePage:`skills`,statusShortcuts:e,mobileContext:{title:`Skills`,action:(0,P.jsx)(Hy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload skill`,pendingLabel:`Uploading skill`,pending:a,accept:`.zip,application/zip,application/x-zip-compressed`,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Skills`,children:(0,P.jsx)(ax,{skills:b?[]:r,communityLinks:b?[]:rw,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`Skills unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,deletePending:o,empty:s?(0,P.jsx)(pC,{children:`Loading skills`}):c?(0,P.jsx)(pC,{children:`Workspace unavailable`}):(0,P.jsx)(pC,{children:`No skills`}),onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y})})})}function aw({timeline:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p}){return(0,P.jsx)(dC,{activePage:`timeline`,statusShortcuts:t,mobileContext:{title:`Timeline`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p,children:(0,P.jsx)(`section`,{className:`workspace-grid timeline-workspace-grid`,"aria-label":`Timeline workspace`,children:i?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Loading timeline`,children:(0,P.jsx)(pC,{children:`Loading timeline`})}):a?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(pC,{children:`Timeline unavailable`})}):(0,P.jsx)(bx,{tokenOverview:e.tokenOverview,items:e.items,scoreUnits:e.scoreUnits,empty:(0,P.jsx)(pC,{children:`No timeline events yet`})})})})}function ow({statusShortcuts:e,unread:t,artifactSignal:n,modules:r,taskCount:i,detail:a,missingTaskId:o,runNote:s,loading:c=!1,unavailable:l=!1,onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,onSelectTask:v}){return(0,P.jsx)(dC,{activePage:`worklist`,statusShortcuts:e,mobileContext:{title:`Worklist`,meta:i===1?`1 task`:`${i} tasks`},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,children:(0,P.jsx)(`section`,{className:`workspace-grid worklist-workspace-grid`,"aria-label":`Worklist workspace`,children:c?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Loading Worklist`,children:(0,P.jsx)(pC,{children:`Loading Worklist`})}):l?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Worklist unavailable`,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):(0,P.jsx)(qb,{modules:r,taskCount:i,...a===void 0?{}:{detail:a},...o===void 0?{}:{missingTaskId:o},...s==null?{}:{runNote:s},onSelectTask:v,empty:(0,P.jsx)(pC,{children:`No compiled tasks`})})})})}function sw(e){return gw(e)&&!cw(e)&&!bw(e)&&Symbol.asyncIterator in e}function cw(e){return Array.isArray(e)}function lw(e){return typeof e==`bigint`}function uw(e){return typeof e==`boolean`}function dw(e){return e instanceof globalThis.Date}function fw(e){return typeof e==`function`}function pw(e){return gw(e)&&!cw(e)&&!bw(e)&&Symbol.iterator in e}function mw(e){return e===null}function hw(e){return typeof e==`number`}function gw(e){return typeof e==`object`&&!!e}function _w(e){return e instanceof globalThis.RegExp}function vw(e){return typeof e==`string`}function yw(e){return typeof e==`symbol`}function bw(e){return e instanceof globalThis.Uint8Array}function xw(e){return e===void 0}function Sw(e){return e.map(e=>Dw(e))}function Cw(e){return new Date(e.getTime())}function ww(e){return new Uint8Array(e)}function Tw(e){return new RegExp(e.source,e.flags)}function Ew(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Dw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Dw(e[n]);return t}function Dw(e){return cw(e)?Sw(e):dw(e)?Cw(e):bw(e)?ww(e):_w(e)?Tw(e):gw(e)?Ew(e):e}function Ow(e){return Dw(e)}function kw(e,t){return Ow(t===void 0?e:{...t,...e})}function Aw(e){return typeof e==`object`&&!!e}function jw(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function Mw(e){return e===void 0}function Nw(e){return typeof e==`number`}var Pw;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=Aw(t);return e.AllowArrayObject?n:n&&!jw(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?Nw(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=Mw(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(Pw||={});function Fw(e){return globalThis.Object.freeze(e).map(e=>Bw(e))}function Iw(e){return e}function Lw(e){return e}function Rw(e){return e}function zw(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Bw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Bw(e[n]);return globalThis.Object.freeze(t)}function Bw(e){return cw(e)?Fw(e):dw(e)?Iw(e):bw(e)?Lw(e):_w(e)?Rw(e):gw(e)?zw(e):e}function K(e,t){let n=t===void 0?e:{...t,...e};switch(Pw.InstanceMode){case`freeze`:return Bw(n);case`clone`:return Ow(n);default:return n}}var Vw=class extends Error{constructor(e){super(e)}},Hw=Symbol.for(`TypeBox.Transform`),Uw=Symbol.for(`TypeBox.Readonly`),Ww=Symbol.for(`TypeBox.Optional`),Gw=Symbol.for(`TypeBox.Hint`),q=Symbol.for(`TypeBox.Kind`);function Kw(e){return gw(e)&&e[Uw]===`Readonly`}function qw(e){return gw(e)&&e[Ww]===`Optional`}function Jw(e){return sT(e,`Any`)}function Yw(e){return sT(e,`Argument`)}function Xw(e){return sT(e,`Array`)}function Zw(e){return sT(e,`AsyncIterator`)}function Qw(e){return sT(e,`BigInt`)}function $w(e){return sT(e,`Boolean`)}function eT(e){return sT(e,`Computed`)}function tT(e){return sT(e,`Constructor`)}function nT(e){return sT(e,`Date`)}function rT(e){return sT(e,`Function`)}function iT(e){return sT(e,`Integer`)}function aT(e){return sT(e,`Intersect`)}function oT(e){return sT(e,`Iterator`)}function sT(e,t){return gw(e)&&q in e&&e[q]===t}function cT(e){return uw(e)||hw(e)||vw(e)}function lT(e){return sT(e,`Literal`)}function uT(e){return sT(e,`MappedKey`)}function dT(e){return sT(e,`MappedResult`)}function fT(e){return sT(e,`Never`)}function pT(e){return sT(e,`Not`)}function mT(e){return sT(e,`Null`)}function hT(e){return sT(e,`Number`)}function gT(e){return sT(e,`Object`)}function _T(e){return sT(e,`Promise`)}function vT(e){return sT(e,`Record`)}function yT(e){return sT(e,`Ref`)}function bT(e){return sT(e,`RegExp`)}function xT(e){return sT(e,`String`)}function ST(e){return sT(e,`Symbol`)}function CT(e){return sT(e,`TemplateLiteral`)}function wT(e){return sT(e,`This`)}function TT(e){return gw(e)&&Hw in e}function ET(e){return sT(e,`Tuple`)}function DT(e){return sT(e,`Undefined`)}function OT(e){return sT(e,`Union`)}function kT(e){return sT(e,`Uint8Array`)}function AT(e){return sT(e,`Unknown`)}function jT(e){return sT(e,`Unsafe`)}function MT(e){return sT(e,`Void`)}function NT(e){return gw(e)&&q in e&&vw(e[q])}function PT(e){return Jw(e)||Yw(e)||Xw(e)||$w(e)||Qw(e)||Zw(e)||eT(e)||tT(e)||nT(e)||rT(e)||iT(e)||aT(e)||oT(e)||lT(e)||uT(e)||dT(e)||fT(e)||pT(e)||mT(e)||hT(e)||gT(e)||_T(e)||vT(e)||yT(e)||bT(e)||xT(e)||ST(e)||CT(e)||wT(e)||ET(e)||DT(e)||OT(e)||kT(e)||AT(e)||jT(e)||MT(e)||NT(e)}var FT=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function IT(e){try{return new RegExp(e),!0}catch{return!1}}function LT(e){if(!vw(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function RT(e){return VT(e)||LE(e)}function zT(e){return xw(e)||lw(e)}function BT(e){return xw(e)||hw(e)}function VT(e){return xw(e)||uw(e)}function HT(e){return xw(e)||vw(e)}function UT(e){return xw(e)||vw(e)&<(e)&&IT(e)}function WT(e){return xw(e)||vw(e)&<(e)}function GT(e){return xw(e)||LE(e)}function KT(e){return gw(e)&&e[Ww]===`Optional`}function qT(e){return sE(e,`Any`)&&HT(e.$id)}function JT(e){return sE(e,`Argument`)&&hw(e.index)}function YT(e){return sE(e,`Array`)&&e.type===`array`&&HT(e.$id)&&LE(e.items)&&BT(e.minItems)&&BT(e.maxItems)&&VT(e.uniqueItems)&>(e.contains)&&BT(e.minContains)&&BT(e.maxContains)}function XT(e){return sE(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&HT(e.$id)&&LE(e.items)}function ZT(e){return sE(e,`BigInt`)&&e.type===`bigint`&&HT(e.$id)&&zT(e.exclusiveMaximum)&&zT(e.exclusiveMinimum)&&zT(e.maximum)&&zT(e.minimum)&&zT(e.multipleOf)}function QT(e){return sE(e,`Boolean`)&&e.type===`boolean`&&HT(e.$id)}function $T(e){return sE(e,`Computed`)&&vw(e.target)&&cw(e.parameters)&&e.parameters.every(e=>LE(e))}function eE(e){return sE(e,`Constructor`)&&e.type===`Constructor`&&HT(e.$id)&&cw(e.parameters)&&e.parameters.every(e=>LE(e))&&LE(e.returns)}function tE(e){return sE(e,`Date`)&&e.type===`Date`&&HT(e.$id)&&BT(e.exclusiveMaximumTimestamp)&&BT(e.exclusiveMinimumTimestamp)&&BT(e.maximumTimestamp)&&BT(e.minimumTimestamp)&&BT(e.multipleOfTimestamp)}function nE(e){return sE(e,`Function`)&&e.type===`Function`&&HT(e.$id)&&cw(e.parameters)&&e.parameters.every(e=>LE(e))&&LE(e.returns)}function rE(e){return sE(e,`Integer`)&&e.type===`integer`&&HT(e.$id)&&BT(e.exclusiveMaximum)&&BT(e.exclusiveMinimum)&&BT(e.maximum)&&BT(e.minimum)&&BT(e.multipleOf)}function iE(e){return gw(e)&&Object.entries(e).every(([e,t])=>LT(e)&&LE(t))}function aE(e){return sE(e,`Intersect`)&&!(vw(e.type)&&e.type!==`object`)&&cw(e.allOf)&&e.allOf.every(e=>LE(e)&&!OE(e))&&HT(e.type)&&(VT(e.unevaluatedProperties)||GT(e.unevaluatedProperties))&&HT(e.$id)}function oE(e){return sE(e,`Iterator`)&&e.type===`Iterator`&&HT(e.$id)&&LE(e.items)}function sE(e,t){return gw(e)&&q in e&&e[q]===t}function cE(e){return dE(e)&&vw(e.const)}function lE(e){return dE(e)&&hw(e.const)}function uE(e){return dE(e)&&uw(e.const)}function dE(e){return sE(e,`Literal`)&&HT(e.$id)&&fE(e.const)}function fE(e){return uw(e)||hw(e)||vw(e)}function pE(e){return sE(e,`MappedKey`)&&cw(e.keys)&&e.keys.every(e=>hw(e)||vw(e))}function mE(e){return sE(e,`MappedResult`)&&iE(e.properties)}function hE(e){return sE(e,`Never`)&&gw(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function gE(e){return sE(e,`Not`)&&LE(e.not)}function _E(e){return sE(e,`Null`)&&e.type===`null`&&HT(e.$id)}function vE(e){return sE(e,`Number`)&&e.type===`number`&&HT(e.$id)&&BT(e.exclusiveMaximum)&&BT(e.exclusiveMinimum)&&BT(e.maximum)&&BT(e.minimum)&&BT(e.multipleOf)}function yE(e){return sE(e,`Object`)&&e.type===`object`&&HT(e.$id)&&iE(e.properties)&&RT(e.additionalProperties)&&BT(e.minProperties)&&BT(e.maxProperties)}function bE(e){return sE(e,`Promise`)&&e.type===`Promise`&&HT(e.$id)&&LE(e.item)}function xE(e){return sE(e,`Record`)&&e.type===`object`&&HT(e.$id)&&RT(e.additionalProperties)&&gw(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&IT(t[0])&&gw(e.patternProperties)&&LE(e.patternProperties[t[0]])})(e)}function SE(e){return sE(e,`Ref`)&&HT(e.$id)&&vw(e.$ref)}function CE(e){return sE(e,`RegExp`)&&HT(e.$id)&&vw(e.source)&&vw(e.flags)&&BT(e.maxLength)&&BT(e.minLength)}function wE(e){return sE(e,`String`)&&e.type===`string`&&HT(e.$id)&&BT(e.minLength)&&BT(e.maxLength)&&UT(e.pattern)&&WT(e.format)}function TE(e){return sE(e,`Symbol`)&&e.type===`symbol`&&HT(e.$id)}function EE(e){return sE(e,`TemplateLiteral`)&&e.type===`string`&&vw(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function DE(e){return sE(e,`This`)&&HT(e.$id)&&vw(e.$ref)}function OE(e){return gw(e)&&Hw in e}function kE(e){return sE(e,`Tuple`)&&e.type===`array`&&HT(e.$id)&&hw(e.minItems)&&hw(e.maxItems)&&e.minItems===e.maxItems&&(xw(e.items)&&xw(e.additionalItems)&&e.minItems===0||cw(e.items)&&e.items.every(e=>LE(e)))}function AE(e){return sE(e,`Undefined`)&&e.type===`undefined`&&HT(e.$id)}function jE(e){return sE(e,`Union`)&&HT(e.$id)&&gw(e)&&cw(e.anyOf)&&e.anyOf.every(e=>LE(e))}function ME(e){return sE(e,`Uint8Array`)&&e.type===`Uint8Array`&&HT(e.$id)&&BT(e.minByteLength)&&BT(e.maxByteLength)}function NE(e){return sE(e,`Unknown`)&&HT(e.$id)}function PE(e){return sE(e,`Unsafe`)}function FE(e){return sE(e,`Void`)&&e.type===`void`&&HT(e.$id)}function IE(e){return gw(e)&&q in e&&vw(e[q])&&!FT.includes(e[q])}function LE(e){return gw(e)&&(qT(e)||JT(e)||YT(e)||QT(e)||ZT(e)||XT(e)||$T(e)||eE(e)||tE(e)||nE(e)||rE(e)||aE(e)||oE(e)||dE(e)||pE(e)||mE(e)||hE(e)||gE(e)||_E(e)||vE(e)||yE(e)||bE(e)||xE(e)||SE(e)||CE(e)||wE(e)||TE(e)||EE(e)||DE(e)||kE(e)||AE(e)||jE(e)||ME(e)||NE(e)||PE(e)||FE(e)||IE(e))}var RE=`(true|false)`,zE=`(0|[1-9][0-9]*)`,BE=`(.*)`,VE=`(?!.*)`;`${RE}`;var HE=`^${zE}$`,UE=`^${BE}$`,WE=`^${VE}$`;function GE(e,t){return e.includes(t)}function KE(e){return[...new Set(e)]}function qE(e,t){return e.filter(e=>t.includes(e))}function JE(e,t){return e.reduce((e,t)=>qE(e,t),t)}function YE(e){return e.length===1?e[0]:e.length>1?JE(e.slice(1),e[0]):[]}function XE(e){let t=[];for(let n of e)t.push(...n);return t}function ZE(e){return K({[q]:`Any`},e)}function QE(e,t){return K({[q]:`Array`,type:`array`,items:e},t)}function $E(e){return K({[q]:`Argument`,index:e})}function eD(e,t){return K({[q]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function tD(e,t,n){return K({[q]:`Computed`,target:e,parameters:t},n)}function nD(e,t){let{[t]:n,...r}=e;return r}function rD(e,t){return t.reduce((e,t)=>nD(e,t),e)}function iD(e){return K({[q]:`Never`,not:{}},e)}function aD(e){return K({[q]:`MappedResult`,properties:e})}function oD(e,t,n){return K({[q]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function sD(e,t,n){return K({[q]:`Function`,type:`Function`,parameters:e,returns:t},n)}function cD(e,t){return K({[q]:`Union`,anyOf:e},t)}function lD(e){return e.some(e=>qw(e))}function uD(e){return e.map(e=>qw(e)?dD(e):e)}function dD(e){return rD(e,[Ww])}function fD(e,t){return lD(e)?QO(cD(uD(e),t)):cD(uD(e),t)}function pD(e,t){return e.length===1?K(e[0],t):e.length===0?iD(t):fD(e,t)}function mD(e,t){return e.length===0?iD(t):e.length===1?K(e[0],t):cD(e,t)}var hD=class extends Vw{};function gD(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function _D(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function vD(e,t){return _D(e,t,`(`)}function yD(e,t){return _D(e,t,`)`)}function bD(e,t){return _D(e,t,`|`)}function xD(e){if(!(vD(e,0)&&yD(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(vD(e,n)&&(t+=1),yD(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function SD(e){return e.slice(1,e.length-1)}function CD(e){let t=0;for(let n=0;n<e.length;n++)if(vD(e,n)&&(t+=1),yD(e,n)&&--t,bD(e,n)&&t===0)return!0;return!1}function wD(e){for(let t=0;t<e.length;t++)if(vD(e,t))return!0;return!1}function TD(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(vD(e,i)&&(t+=1),yD(e,i)&&--t,bD(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(DD(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(DD(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function ED(e){function t(e,t){if(!vD(e,t))throw new hD(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(vD(e,r)&&(n+=1),yD(e,r)&&--n,n===0)return[t,r];throw new hD(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(vD(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(vD(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(DD(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(DD(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function DD(e){return xD(e)?DD(SD(e)):CD(e)?TD(e):wD(e)?ED(e):{type:`const`,const:gD(e)}}function OD(e){return DD(e.slice(1,e.length-1))}var kD=class extends Vw{};function AD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function jD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function MD(e){return e.type===`const`&&e.const===`.*`}function ND(e){return AD(e)||MD(e)?!1:jD(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>ND(e)):e.type===`const`?!0:(()=>{throw new kD(`Unknown expression type`)})()}function PD(e){return ND(OD(e.pattern))}var FD=class extends Vw{};function*ID(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of ID(e.slice(1)))yield`${t}${n}`}function*LD(e){return yield*ID(e.expr.map(e=>[...BD(e)]))}function*RD(e){for(let t of e.expr)yield*BD(t)}function*zD(e){return yield e.const}function*BD(e){return e.type===`and`?yield*LD(e):e.type===`or`?yield*RD(e):e.type===`const`?yield*zD(e):(()=>{throw new FD(`Unknown expression`)})()}function VD(e){let t=OD(e.pattern);return ND(t)?[...BD(t)]:[]}function HD(e,t){return K({[q]:`Literal`,const:e,type:typeof e},t)}function UD(e){return K({[q]:`Boolean`,type:`boolean`},e)}function WD(e){return K({[q]:`BigInt`,type:`bigint`},e)}function GD(e){return K({[q]:`Number`,type:`number`},e)}function KD(e){return K({[q]:`String`,type:`string`},e)}function*qD(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield UD():t===`number`?yield GD():t===`bigint`?yield WD():t===`string`?yield KD():yield(()=>{let e=t.split(`|`).map(e=>HD(e.trim()));return e.length===0?iD():e.length===1?e[0]:pD(e)})()}function*JD(e){if(e[1]!==`{`)return yield*[HD(`$`),...YD(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=qD(e.slice(2,t)),r=YD(e.slice(t+1));return yield*[...n,...r]}yield HD(e)}function*YD(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[HD(e.slice(0,t)),...JD(e.slice(t))];yield HD(e)}function XD(e){return[...YD(e)]}var ZD=class extends Vw{};function QD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $D(e,t){return CT(e)?e.pattern.slice(1,e.pattern.length-1):OT(e)?`(${e.anyOf.map(e=>$D(e,t)).join(`|`)})`:hT(e)||iT(e)||Qw(e)?`${t}${zE}`:xT(e)?`${t}${BE}`:lT(e)?`${t}${QD(e.const.toString())}`:$w(e)?`${t}${RE}`:(()=>{throw new ZD(`Unexpected Kind '${e[q]}'`)})()}function eO(e){return`^${e.map(e=>$D(e,``)).join(``)}\$`}function tO(e){return pD(VD(e).map(e=>HD(e)))}function nO(e,t){let n=vw(e)?eO(XD(e)):eO(e);return K({[q]:`TemplateLiteral`,type:`string`,pattern:n},t)}function rO(e){return VD(e).map(e=>e.toString())}function iO(e){let t=[];for(let n of e)t.push(...oO(n));return t}function aO(e){return[e.toString()]}function oO(e){return[...new Set(CT(e)?rO(e):OT(e)?iO(e.anyOf):lT(e)?aO(e.const):hT(e)||iT(e)?[`[number]`]:[])]}function sO(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=xO(e,oO(t[i]),n);return r}function cO(e,t,n){return sO(e,t.properties,n)}function lO(e,t,n){return aD(cO(e,t,n))}function uO(e,t){return e.map(e=>vO(e,t))}function dO(e){return e.filter(e=>!fT(e))}function fO(e,t){return sk(dO(uO(e,t)))}function pO(e){return e.some(e=>fT(e))?[]:e}function mO(e,t){return pD(pO(uO(e,t)))}function hO(e,t){return t in e?e[t]:t===`[number]`?pD(e):iD()}function gO(e,t){return t===`[number]`?e:iD()}function _O(e,t){return t in e?e[t]:iD()}function vO(e,t){return aT(e)?fO(e.allOf,t):OT(e)?mO(e.anyOf,t):ET(e)?hO(e.items??[],t):Xw(e)?gO(e.items,t):gT(e)?_O(e.properties,t):iD()}function yO(e,t){return t.map(t=>vO(e,t))}function bO(e,t){return pD(yO(e,t))}function xO(e,t,n){if(yT(e)||yT(t)){if(!PT(e)||!PT(t))throw new Vw(`Index types using Ref parameters require both Type and Key to be of TSchema`);return tD(`Index`,[e,t])}return dT(t)?lO(e,t,n):uT(t)?TO(e,t,n):K(PT(t)?bO(e,oO(t)):bO(e,t),n)}function SO(e,t,n){return{[t]:xO(e,[t],Ow(n))}}function CO(e,t,n){return t.reduce((t,r)=>({...t,...SO(e,r,n)}),{})}function wO(e,t,n){return CO(e,t.keys,n)}function TO(e,t,n){return aD(wO(e,t,n))}function EO(e,t){return K({[q]:`Iterator`,type:`Iterator`,items:e},t)}function DO(e){return globalThis.Object.keys(e).filter(t=>!qw(e[t]))}function OO(e,t){let n=DO(e);return K(n.length>0?{[q]:`Object`,type:`object`,required:n,properties:e}:{[q]:`Object`,type:`object`,properties:e},t)}var kO=OO;function AO(e,t){return K({[q]:`Promise`,type:`Promise`,item:e},t)}function jO(e){return K(rD(e,[Uw]))}function MO(e){return K({...e,[Uw]:`Readonly`})}function NO(e,t){return t===!1?jO(e):MO(e)}function PO(e,t){let n=t??!0;return dT(e)?LO(e,n):NO(e,n)}function FO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=PO(e[r],t);return n}function IO(e,t){return FO(e.properties,t)}function LO(e,t){return aD(IO(e,t))}function RO(e,t){return K(e.length>0?{[q]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[q]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function zO(e,t){return e in t?KO(e,t[e]):aD(t)}function BO(e){return{[e]:HD(e)}}function VO(e){let t={};for(let n of e)t[n]=HD(n);return t}function HO(e,t){return GE(t,e)?BO(e):VO(t)}function UO(e,t){return zO(e,HO(e,t))}function WO(e,t){return t.map(t=>KO(e,t))}function GO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=KO(e,t[r]);return n}function KO(e,t){let n={...t};return qw(t)?QO(KO(e,rD(t,[Ww]))):Kw(t)?PO(KO(e,rD(t,[Uw]))):dT(t)?zO(e,t.properties):uT(t)?UO(e,t.keys):tT(t)?oD(WO(e,t.parameters),KO(e,t.returns),n):rT(t)?sD(WO(e,t.parameters),KO(e,t.returns),n):Zw(t)?eD(KO(e,t.items),n):oT(t)?EO(KO(e,t.items),n):aT(t)?ck(WO(e,t.allOf),n):OT(t)?mD(WO(e,t.anyOf),n):ET(t)?RO(WO(e,t.items??[]),n):gT(t)?kO(GO(e,t.properties),n):Xw(t)?QE(KO(e,t.items),n):_T(t)?AO(KO(e,t.item),n):t}function qO(e,t){let n={};for(let r of e)n[r]=KO(r,t);return n}function JO(e,t,n){let r=PT(e)?oO(e):e;return kO(qO(r,t({[q]:`MappedKey`,keys:r})),n)}function YO(e){return K(rD(e,[Ww]))}function XO(e){return K({...e,[Ww]:`Optional`})}function ZO(e,t){return t===!1?YO(e):XO(e)}function QO(e,t){let n=t??!0;return dT(e)?tk(e,n):ZO(e,n)}function $O(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=QO(e[r],t);return n}function ek(e,t){return $O(e.properties,t)}function tk(e,t){return aD(ek(e,t))}function nk(e,t={}){let n=e.every(e=>gT(e)),r=PT(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return K(t.unevaluatedProperties===!1||PT(t.unevaluatedProperties)||n?{...r,[q]:`Intersect`,type:`object`,allOf:e}:{...r,[q]:`Intersect`,allOf:e},t)}function rk(e){return e.every(e=>qw(e))}function ik(e){return rD(e,[Ww])}function ak(e){return e.map(e=>qw(e)?ik(e):e)}function ok(e,t){return rk(e)?QO(nk(ak(e),t)):nk(ak(e),t)}function sk(e,t={}){if(e.length===1)return K(e[0],t);if(e.length===0)return iD(t);if(e.some(e=>TT(e)))throw Error(`Cannot intersect transform types`);return ok(e,t)}function ck(e,t){if(e.length===1)return K(e[0],t);if(e.length===0)return iD(t);if(e.some(e=>TT(e)))throw Error(`Cannot intersect transform types`);return nk(e,t)}function lk(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new Vw(`Ref: $ref must be a string`);return K({[q]:`Ref`,$ref:t},n)}function uk(e,t){return tD(`Awaited`,[tD(e,t)])}function dk(e){return tD(`Awaited`,[lk(e)])}function fk(e){return ck(hk(e))}function pk(e){return mD(hk(e))}function mk(e){return gk(e)}function hk(e){return e.map(e=>gk(e))}function gk(e,t){return K(eT(e)?uk(e.target,e.parameters):aT(e)?fk(e.allOf):OT(e)?pk(e.anyOf):_T(e)?mk(e.item):yT(e)?dk(e.$ref):e,t)}function _k(e){let t=[];for(let n of e)t.push(wk(n));return t}function vk(e){return XE(_k(e))}function yk(e){return YE(_k(e))}function bk(e){return e.map((e,t)=>t.toString())}function xk(e){return[`[number]`]}function Sk(e){return globalThis.Object.getOwnPropertyNames(e)}function Ck(e){return Tk?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function wk(e){return aT(e)?vk(e.allOf):OT(e)?yk(e.anyOf):ET(e)?bk(e.items??[]):Xw(e)?xk(e.items):gT(e)?Sk(e.properties):vT(e)?Ck(e.patternProperties):[]}var Tk=!1;function Ek(e,t){return tD(`KeyOf`,[tD(e,t)])}function Dk(e){return tD(`KeyOf`,[lk(e)])}function Ok(e,t){return K(pD(kk(wk(e))),t)}function kk(e){return e.map(e=>e===`[number]`?GD():HD(e))}function Ak(e,t){return eT(e)?Ek(e.target,e.parameters):yT(e)?Dk(e.$ref):dT(e)?Nk(e,t):Ok(e,t)}function jk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Ak(e[r],Ow(t));return n}function Mk(e,t){return jk(e.properties,t)}function Nk(e,t){return aD(Mk(e,t))}function Pk(e){let t=[];for(let n of e)t.push(...wk(n));return KE(t)}function Fk(e){return e.filter(e=>!fT(e))}function Ik(e,t){let n=[];for(let r of e)n.push(...yO(r,[t]));return Fk(n)}function Lk(e,t){let n={};for(let r of t)n[r]=sk(Ik(e,r));return n}function Rk(e,t){return kO(Lk(e,Pk(e)),t)}function zk(e){return K({[q]:`Date`,type:`Date`},e)}function Bk(e){return K({[q]:`Null`,type:`null`},e)}function Vk(e){return K({[q]:`Symbol`,type:`symbol`},e)}function Hk(e){return K({[q]:`Undefined`,type:`undefined`},e)}function Uk(e){return K({[q]:`Uint8Array`,type:`Uint8Array`},e)}function Wk(e){return K({[q]:`Unknown`},e)}function Gk(e){return e.map(e=>Jk(e,!1))}function Kk(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=PO(Jk(e[n],!1));return t}function qk(e,t){return t===!0?e:PO(e)}function Jk(e,t){return sw(e)||pw(e)?qk(ZE(),t):cw(e)?PO(RO(Gk(e))):bw(e)?Uk():dw(e)?zk():gw(e)?qk(kO(Kk(e)),t):fw(e)?qk(sD([],Wk()),t):xw(e)?Hk():mw(e)?Bk():yw(e)?Vk():lw(e)?WD():hw(e)||uw(e)||vw(e)?HD(e):kO({})}function Yk(e,t){return K(Jk(e,!0),t)}function Xk(e,t){return tT(e)?RO(e.parameters,t):iD(t)}function Zk(e,t){if(xw(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return mD([...new Set(n)].map(e=>HD(e)),{...t,[Gw]:`Enum`})}var Qk=class extends Vw{},J;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(J||={});function $k(e){return e===J.False?e:J.True}function eA(e){throw new Qk(e)}function tA(e){return hE(e)||aE(e)||jE(e)||NE(e)||qT(e)}function nA(e,t){return hE(t)?bA(e,t):aE(t)?gA(e,t):jE(t)?rj(e,t):NE(t)?aj(e,t):qT(t)?rA(e,t):eA(`StructuralRight`)}function rA(e,t){return J.True}function iA(e,t){return aE(t)?gA(e,t):jE(t)&&t.anyOf.some(e=>qT(e)||NE(e))?J.True:jE(t)?J.Union:NE(t)||qT(t)?J.True:J.Union}function aA(e,t){return NE(e)?J.False:qT(e)?J.Union:hE(e)?J.True:J.False}function oA(e,t){return yE(t)&&LA(t)?J.True:tA(t)?nA(e,t):YT(t)?$k(lj(e.items,t.items)):J.False}function sA(e,t){return tA(t)?nA(e,t):XT(t)?$k(lj(e.items,t.items)):J.False}function cA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):ZT(t)?J.True:J.False}function lA(e,t){return uE(e)||QT(e)?J.True:J.False}function uA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):QT(t)?J.True:J.False}function dA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):eE(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>$k(lj(t.parameters[n],e))===J.True)?$k(lj(e.returns,t.returns)):J.False:J.False}function fA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):tE(t)?J.True:J.False}function pA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):nE(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>$k(lj(t.parameters[n],e))===J.True)?$k(lj(e.returns,t.returns)):J.False:J.False}function mA(e,t){return dE(e)&&hw(e.const)||vE(e)||rE(e)?J.True:J.False}function hA(e,t){return rE(t)||vE(t)?J.True:tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):J.False}function gA(e,t){return t.allOf.every(t=>lj(e,t)===J.True)?J.True:J.False}function _A(e,t){return e.allOf.some(e=>lj(e,t)===J.True)?J.True:J.False}function vA(e,t){return tA(t)?nA(e,t):oE(t)?$k(lj(e.items,t.items)):J.False}function yA(e,t){return dE(t)&&t.const===e.const?J.True:tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):wE(t)?JA(e,t):vE(t)?TA(e,t):rE(t)?mA(e,t):QT(t)?lA(e,t):J.False}function bA(e,t){return J.False}function xA(e,t){return J.True}function SA(e){let[t,n]=[e,0];for(;gE(t);)t=t.not,n+=1;return n%2==0?t:Wk()}function CA(e,t){return gE(e)?lj(SA(e),t):gE(t)?lj(e,SA(t)):eA(`Invalid fallthrough for Not`)}function wA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):_E(t)?J.True:J.False}function TA(e,t){return lE(e)||vE(e)||rE(e)?J.True:J.False}function EA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):rE(t)||vE(t)?J.True:J.False}function DA(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function OA(e){return LA(e)}function kA(e){return DA(e,0)||DA(e,1)&&`description`in e.properties&&jE(e.properties.description)&&e.properties.description.anyOf.length===2&&(wE(e.properties.description.anyOf[0])&&AE(e.properties.description.anyOf[1])||wE(e.properties.description.anyOf[1])&&AE(e.properties.description.anyOf[0]))}function AA(e){return DA(e,0)}function jA(e){return DA(e,0)}function MA(e){return DA(e,0)}function NA(e){return DA(e,0)}function PA(e){return LA(e)}function FA(e){let t=GD();return DA(e,0)||DA(e,1)&&`length`in e.properties&&$k(lj(e.properties.length,t))===J.True}function IA(e){return DA(e,0)}function LA(e){let t=GD();return DA(e,0)||DA(e,1)&&`length`in e.properties&&$k(lj(e.properties.length,t))===J.True}function RA(e){let t=sD([ZE()],ZE());return DA(e,0)||DA(e,1)&&`then`in e.properties&&$k(lj(e.properties.then,t))===J.True}function zA(e,t){return lj(e,t)===J.False||KT(e)&&!KT(t)?J.False:J.True}function BA(e,t){return NE(e)?J.False:qT(e)?J.Union:hE(e)||cE(e)&&OA(t)||lE(e)&&AA(t)||uE(e)&&jA(t)||TE(e)&&kA(t)||ZT(e)&&MA(t)||wE(e)&&OA(t)||TE(e)&&kA(t)||vE(e)&&AA(t)||rE(e)&&AA(t)||QT(e)&&jA(t)||ME(e)&&PA(t)||tE(e)&&NA(t)||eE(e)&&IA(t)||nE(e)&&FA(t)?J.True:xE(e)&&wE(UA(e))?t[Gw]===`Record`?J.True:J.False:xE(e)&&vE(UA(e))&&DA(t,0)?J.True:J.False}function VA(e,t){return tA(t)?nA(e,t):xE(t)?GA(e,t):yE(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!KT(t.properties[n]))return J.False;if(KT(t.properties[n]))return J.True;if(zA(e.properties[n],t.properties[n])===J.False)return J.False}return J.True})():J.False}function HA(e,t){return tA(t)?nA(e,t):yE(t)&&RA(t)?J.True:bE(t)?$k(lj(e.item,t.item)):J.False}function UA(e){return HE in e.patternProperties?GD():UE in e.patternProperties?KD():eA(`Unknown record key pattern`)}function WA(e){return HE in e.patternProperties?e.patternProperties[HE]:UE in e.patternProperties?e.patternProperties[UE]:eA(`Unable to get record value schema`)}function GA(e,t){let[n,r]=[UA(t),WA(t)];return cE(e)&&vE(n)&&$k(lj(e,r))===J.True?J.True:ME(e)&&vE(n)||wE(e)&&vE(n)||YT(e)&&vE(n)?lj(e,r):yE(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(zA(r,e.properties[t])===J.False)return J.False;return J.True})():J.False}function KA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?lj(WA(e),WA(t)):J.False}function qA(e,t){return lj(CE(e)?KD():e,CE(t)?KD():t)}function JA(e,t){return dE(e)&&vw(e.const)||wE(e)?J.True:J.False}function YA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):wE(t)?J.True:J.False}function XA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):TE(t)?J.True:J.False}function ZA(e,t){return EE(e)?lj(tO(e),t):EE(t)?lj(e,tO(t)):eA(`Invalid fallthrough for TemplateLiteral`)}function QA(e,t){return YT(t)&&e.items!==void 0&&e.items.every(e=>lj(e,t.items)===J.True)}function $A(e,t){return hE(e)?J.True:NE(e)?J.False:qT(e)?J.Union:J.False}function ej(e,t){return tA(t)?nA(e,t):yE(t)&&LA(t)||YT(t)&&QA(e,t)?J.True:kE(t)?xw(e.items)&&!xw(t.items)||!xw(e.items)&&xw(t.items)?J.False:xw(e.items)&&!xw(t.items)||e.items.every((e,n)=>lj(e,t.items[n])===J.True)?J.True:J.False:J.False}function tj(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):ME(t)?J.True:J.False}function nj(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):FE(t)?sj(e,t):AE(t)?J.True:J.False}function rj(e,t){return t.anyOf.some(t=>lj(e,t)===J.True)?J.True:J.False}function ij(e,t){return e.anyOf.every(e=>lj(e,t)===J.True)?J.True:J.False}function aj(e,t){return J.True}function oj(e,t){return hE(t)?bA(e,t):aE(t)?gA(e,t):jE(t)?rj(e,t):qT(t)?rA(e,t):wE(t)?JA(e,t):vE(t)?TA(e,t):rE(t)?mA(e,t):QT(t)?lA(e,t):YT(t)?aA(e,t):kE(t)?$A(e,t):yE(t)?BA(e,t):NE(t)?J.True:J.False}function sj(e,t){return AE(e)||AE(e)?J.True:J.False}function cj(e,t){return aE(t)?gA(e,t):jE(t)?rj(e,t):NE(t)?aj(e,t):qT(t)?rA(e,t):yE(t)?BA(e,t):FE(t)?J.True:J.False}function lj(e,t){return EE(e)||EE(t)?ZA(e,t):CE(e)||CE(t)?qA(e,t):gE(e)||gE(t)?CA(e,t):qT(e)?iA(e,t):YT(e)?oA(e,t):ZT(e)?cA(e,t):QT(e)?uA(e,t):XT(e)?sA(e,t):eE(e)?dA(e,t):tE(e)?fA(e,t):nE(e)?pA(e,t):rE(e)?hA(e,t):aE(e)?_A(e,t):oE(e)?vA(e,t):dE(e)?yA(e,t):hE(e)?xA(e,t):_E(e)?wA(e,t):vE(e)?EA(e,t):yE(e)?VA(e,t):xE(e)?KA(e,t):wE(e)?YA(e,t):TE(e)?XA(e,t):kE(e)?ej(e,t):bE(e)?HA(e,t):ME(e)?tj(e,t):AE(e)?nj(e,t):jE(e)?ij(e,t):NE(e)?oj(e,t):FE(e)?cj(e,t):eA(`Unknown left type operand '${e[q]}'`)}function uj(e,t){return lj(e,t)}function dj(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=hj(e[o],t,n,r,Ow(i));return a}function fj(e,t,n,r,i){return dj(e.properties,t,n,r,i)}function pj(e,t,n,r,i){return aD(fj(e,t,n,r,i))}function mj(e,t,n,r){let i=uj(e,t);return i===J.Union?mD([n,r]):i===J.True?n:r}function hj(e,t,n,r,i){return dT(e)?pj(e,t,n,r,i):uT(e)?K(yj(e,t,n,r,i)):K(mj(e,t,n,r),i)}function gj(e,t,n,r,i){return{[e]:hj(HD(e),t,n,r,Ow(i))}}function _j(e,t,n,r,i){return e.reduce((e,a)=>({...e,...gj(a,t,n,r,i)}),{})}function vj(e,t,n,r,i){return _j(e.keys,t,n,r,i)}function yj(e,t,n,r,i){return aD(vj(e,t,n,r,i))}function bj(e,t){return Sj(tO(e),t)}function xj(e,t){let n=e.filter(e=>uj(e,t)===J.False);return n.length===1?n[0]:mD(n)}function Sj(e,t,n={}){return CT(e)?K(bj(e,t),n):dT(e)?K(Tj(e,t),n):K(OT(e)?xj(e.anyOf,t):uj(e,t)===J.False?e:iD(),n)}function Cj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Sj(e[r],t);return n}function wj(e,t){return Cj(e.properties,t)}function Tj(e,t){return aD(wj(e,t))}function Ej(e,t){return Oj(tO(e),t)}function Dj(e,t){let n=e.filter(e=>uj(e,t)!==J.False);return n.length===1?n[0]:mD(n)}function Oj(e,t,n){return CT(e)?K(Ej(e,t),n):dT(e)?K(jj(e,t),n):K(OT(e)?Dj(e.anyOf,t):uj(e,t)===J.False?iD():e,n)}function kj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Oj(e[r],t);return n}function Aj(e,t){return kj(e.properties,t)}function jj(e,t){return aD(Aj(e,t))}function Mj(e,t){return tT(e)?K(e.returns,t):iD(t)}function Nj(e){return PO(QO(e))}function Pj(e,t,n){return K({[q]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function Fj(e,t,n){let r={};for(let n of e)r[n]=t;return kO(r,{...n,[Gw]:`Record`})}function Ij(e,t,n){return PD(e)?Fj(oO(e),t,n):Pj(e.pattern,t,n)}function Lj(e,t,n){return Fj(oO(mD(e)),t,n)}function Rj(e,t,n){return Fj([e.toString()],t,n)}function zj(e,t,n){return Pj(e.source,t,n)}function Bj(e,t,n){return Pj(xw(e.pattern)?UE:e.pattern,t,n)}function Vj(e,t,n){return Pj(UE,t,n)}function Hj(e,t,n){return Pj(WE,t,n)}function Uj(e,t,n){return kO({true:t,false:t},n)}function Wj(e,t,n){return Pj(HE,t,n)}function Gj(e,t,n){return Pj(HE,t,n)}function Kj(e,t,n={}){return OT(e)?Lj(e.anyOf,t,n):CT(e)?Ij(e,t,n):lT(e)?Rj(e.const,t,n):$w(e)?Uj(e,t,n):iT(e)?Wj(e,t,n):hT(e)?Gj(e,t,n):bT(e)?zj(e,t,n):xT(e)?Bj(e,t,n):Jw(e)?Vj(e,t,n):fT(e)?Hj(e,t,n):iD(n)}function qj(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function Jj(e){let t=qj(e);return t===UE?KD():t===HE?GD():KD({pattern:t})}function Yj(e){return e.patternProperties[qj(e)]}function Xj(e,t){return t.parameters=uM(e,t.parameters),t.returns=dM(e,t.returns),t}function Zj(e,t){return t.parameters=uM(e,t.parameters),t.returns=dM(e,t.returns),t}function Qj(e,t){return t.allOf=uM(e,t.allOf),t}function $j(e,t){return t.anyOf=uM(e,t.anyOf),t}function eM(e,t){return xw(t.items)||(t.items=uM(e,t.items)),t}function tM(e,t){return t.items=dM(e,t.items),t}function nM(e,t){return t.items=dM(e,t.items),t}function rM(e,t){return t.items=dM(e,t.items),t}function iM(e,t){return t.item=dM(e,t.item),t}function aM(e,t){let n=lM(e,t.properties);return{...t,...kO(n)}}function oM(e,t){let n=Kj(dM(e,Jj(t)),dM(e,Yj(t)));return{...t,...n}}function sM(e,t){return t.index in e?e[t.index]:Wk()}function cM(e,t){let n=Kw(t),r=qw(t),i=dM(e,t);return n&&r?Nj(i):n&&!r?PO(i):!n&&r?QO(i):i}function lM(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:cM(e,t[r])}),{})}function uM(e,t){return t.map(t=>dM(e,t))}function dM(e,t){return tT(t)?Xj(e,t):rT(t)?Zj(e,t):aT(t)?Qj(e,t):OT(t)?$j(e,t):ET(t)?eM(e,t):Xw(t)?tM(e,t):Zw(t)?nM(e,t):oT(t)?rM(e,t):_T(t)?iM(e,t):gT(t)?aM(e,t):vT(t)?oM(e,t):Yw(t)?sM(e,t):t}function fM(e,t){return dM(t,kw(e))}function pM(e){return K({[q]:`Integer`,type:`integer`},e)}function mM(e,t,n){return{[e]:TM(HD(e),t,Ow(n))}}function hM(e,t,n){return e.reduce((e,r)=>({...e,...mM(r,t,n)}),{})}function gM(e,t,n){return hM(e.keys,t,n)}function _M(e,t,n){return aD(gM(e,t,n))}function vM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function yM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function bM(e){return e.toUpperCase()}function xM(e){return e.toLowerCase()}function SM(e,t,n){let r=OD(e.pattern);return ND(r)?nO([mD(wM([...BD(r)].map(e=>HD(e)),t))],n):{...e,pattern:CM(e.pattern,t)}}function CM(e,t){return typeof e==`string`?t===`Uncapitalize`?vM(e):t===`Capitalize`?yM(e):t===`Uppercase`?bM(e):t===`Lowercase`?xM(e):e:e.toString()}function wM(e,t){return e.map(e=>TM(e,t))}function TM(e,t,n={}){return uT(e)?_M(e,t,n):CT(e)?SM(e,t,n):OT(e)?mD(wM(e.anyOf,t),n):lT(e)?HD(CM(e.const,t),n):K(e,n)}function EM(e,t={}){return TM(e,`Capitalize`,t)}function DM(e,t={}){return TM(e,`Lowercase`,t)}function OM(e,t={}){return TM(e,`Uncapitalize`,t)}function kM(e,t={}){return TM(e,`Uppercase`,t)}function AM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=BM(e[i],t,Ow(n));return r}function jM(e,t,n){return AM(e.properties,t,n)}function MM(e,t,n){return aD(jM(e,t,n))}function NM(e,t){return e.map(e=>zM(e,t))}function PM(e,t){return e.map(e=>zM(e,t))}function FM(e,t){let{[t]:n,...r}=e;return r}function IM(e,t){return t.reduce((e,t)=>FM(e,t),e)}function LM(e,t,n){let r=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(IM(n,t),r)}function RM(e){return mD(e.reduce((e,t)=>cT(t)?[...e,HD(t)]:e,[]))}function zM(e,t){return aT(e)?ck(NM(e.allOf,t)):OT(e)?mD(PM(e.anyOf,t)):gT(e)?LM(e,t,e.properties):kO({})}function BM(e,t,n){let r=cw(t)?RM(t):t,i=PT(t)?oO(t):t,a=yT(e),o=yT(t);return dT(e)?MM(e,i,n):uT(t)?WM(e,t,n):a&&o||!a&&o||a&&!o?tD(`Omit`,[e,r],n):K({...zM(e,i),...n})}function VM(e,t,n){return{[t]:BM(e,[t],Ow(n))}}function HM(e,t,n){return t.reduce((t,r)=>({...t,...VM(e,r,n)}),{})}function UM(e,t,n){return HM(e,t.keys,n)}function WM(e,t,n){return aD(UM(e,t,n))}function GM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=eN(e[i],t,Ow(n));return r}function KM(e,t,n){return GM(e.properties,t,n)}function qM(e,t,n){return aD(KM(e,t,n))}function JM(e,t){return e.map(e=>$M(e,t))}function YM(e,t){return e.map(e=>$M(e,t))}function XM(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function ZM(e,t,n){let r=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(XM(n,t),r)}function QM(e){return mD(e.reduce((e,t)=>cT(t)?[...e,HD(t)]:e,[]))}function $M(e,t){return aT(e)?ck(JM(e.allOf,t)):OT(e)?mD(YM(e.anyOf,t)):gT(e)?ZM(e,t,e.properties):kO({})}function eN(e,t,n){let r=cw(t)?QM(t):t,i=PT(t)?oO(t):t,a=yT(e),o=yT(t);return dT(e)?qM(e,i,n):uT(t)?iN(e,t,n):a&&o||!a&&o||a&&!o?tD(`Pick`,[e,r],n):K({...$M(e,i),...n})}function tN(e,t,n){return{[t]:eN(e,[t],Ow(n))}}function nN(e,t,n){return t.reduce((t,r)=>({...t,...tN(e,r,n)}),{})}function rN(e,t,n){return nN(e,t.keys,n)}function iN(e,t,n){return aD(rN(e,t,n))}function aN(e,t){return tD(`Partial`,[tD(e,t)])}function oN(e){return tD(`Partial`,[lk(e)])}function sN(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=QO(e[n]);return t}function cN(e,t){let n=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(sN(t),n)}function lN(e){return e.map(e=>uN(e))}function uN(e){return eT(e)?aN(e.target,e.parameters):yT(e)?oN(e.$ref):aT(e)?ck(lN(e.allOf)):OT(e)?mD(lN(e.anyOf)):gT(e)?cN(e,e.properties):Qw(e)||$w(e)||iT(e)||lT(e)||mT(e)||hT(e)||xT(e)||ST(e)||DT(e)?e:kO({})}function dN(e,t){return dT(e)?mN(e,t):K({...uN(e),...t})}function fN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=dN(e[r],Ow(t));return n}function pN(e,t){return fN(e.properties,t)}function mN(e,t){return aD(pN(e,t))}function hN(e,t){return tD(`Required`,[tD(e,t)])}function gN(e){return tD(`Required`,[lk(e)])}function _N(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=rD(e[n],[Ww]);return t}function vN(e,t){let n=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(_N(t),n)}function yN(e){return e.map(e=>bN(e))}function bN(e){return eT(e)?hN(e.target,e.parameters):yT(e)?gN(e.$ref):aT(e)?ck(yN(e.allOf)):OT(e)?mD(yN(e.anyOf)):gT(e)?vN(e,e.properties):Qw(e)||$w(e)||iT(e)||lT(e)||mT(e)||hT(e)||xT(e)||ST(e)||DT(e)?e:kO({})}function xN(e,t){return dT(e)?wN(e,t):K({...bN(e),...t})}function SN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=xN(e[r],t);return n}function CN(e,t){return SN(e.properties,t)}function wN(e,t){return aD(CN(e,t))}function TN(e,t){return t.map(t=>yT(t)?EN(e,t.$ref):qN(e,t))}function EN(e,t){return t in e?yT(e[t])?EN(e,e[t].$ref):qN(e,e[t]):iD()}function DN(e){return gk(e[0])}function ON(e){return xO(e[0],e[1])}function kN(e){return Ak(e[0])}function AN(e){return dN(e[0])}function jN(e){return BM(e[0],e[1])}function MN(e){return eN(e[0],e[1])}function NN(e){return xN(e[0])}function PN(e,t,n){let r=TN(e,n);return t===`Awaited`?DN(r):t===`Index`?ON(r):t===`KeyOf`?kN(r):t===`Partial`?AN(r):t===`Omit`?jN(r):t===`Pick`?MN(r):t===`Required`?NN(r):iD()}function FN(e,t){return QE(qN(e,t))}function IN(e,t){return eD(qN(e,t))}function LN(e,t,n){return oD(KN(e,t),qN(e,n))}function RN(e,t,n){return sD(KN(e,t),qN(e,n))}function zN(e,t){return ck(KN(e,t))}function BN(e,t){return EO(qN(e,t))}function VN(e,t){return kO(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:qN(e,t[r])}),{}))}function HN(e,t){let[n,r]=[qN(e,Yj(t)),qj(t)],i=kw(t);return i.patternProperties[r]=n,i}function UN(e,t){return yT(t)?{...EN(e,t.$ref),[Hw]:t[Hw]}:t}function WN(e,t){return RO(KN(e,t))}function GN(e,t){return mD(KN(e,t))}function KN(e,t){return t.map(t=>qN(e,t))}function qN(e,t){return qw(t)?K(qN(e,rD(t,[Ww])),t):Kw(t)?K(qN(e,rD(t,[Uw])),t):TT(t)?K(UN(e,t),t):Xw(t)?K(FN(e,t.items),t):Zw(t)?K(IN(e,t.items),t):eT(t)?K(PN(e,t.target,t.parameters)):tT(t)?K(LN(e,t.parameters,t.returns),t):rT(t)?K(RN(e,t.parameters,t.returns),t):aT(t)?K(zN(e,t.allOf),t):oT(t)?K(BN(e,t.items),t):gT(t)?K(VN(e,t.properties),t):vT(t)?K(HN(e,t)):ET(t)?K(WN(e,t.items||[]),t):OT(t)?K(GN(e,t.anyOf),t):t}function JN(e,t){return t in e?qN(e,e[t]):iD()}function YN(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:JN(e,n)}),{})}var XN=class{constructor(e){let t=YN(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:K(this.$defs[e],t)};return K({[q]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function ZN(e){return new XN(e)}function QN(e,t){return K({[q]:`Not`,not:e},t)}function $N(e,t){return rT(e)?RO(e.parameters,t):iD()}var eP=0;function tP(e,t={}){xw(t.$id)&&(t.$id=`T${eP++}`);let n=kw(e({[q]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,K({[Gw]:`Recursive`,...n},t)}function nP(e,t){let n=vw(e)?new globalThis.RegExp(e):e;return K({[q]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function rP(e){return aT(e)?e.allOf:OT(e)?e.anyOf:ET(e)?e.items??[]:[]}function iP(e){return rP(e)}function aP(e,t){return rT(e)?K(e.returns,t):iD(t)}var oP=class{constructor(e){this.schema=e}Decode(e){return new sP(this.schema,e)}},sP=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[Hw].Encode(e(n)),Decode:e=>this.decode(t[Hw].Decode(e))};return{...t,[Hw]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[Hw]:n}}Encode(e){return TT(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function cP(e){return new oP(e)}function lP(e={}){return K({[q]:e[q]??`Unsafe`},e)}function uP(e){return K({[q]:`Void`,type:`void`},e)}var Y=s({Any:()=>ZE,Argument:()=>$E,Array:()=>QE,AsyncIterator:()=>eD,Awaited:()=>gk,BigInt:()=>WD,Boolean:()=>UD,Capitalize:()=>EM,Composite:()=>Rk,Const:()=>Yk,Constructor:()=>oD,ConstructorParameters:()=>Xk,Date:()=>zk,Enum:()=>Zk,Exclude:()=>Sj,Extends:()=>hj,Extract:()=>Oj,Function:()=>sD,Index:()=>xO,InstanceType:()=>Mj,Instantiate:()=>fM,Integer:()=>pM,Intersect:()=>ck,Iterator:()=>EO,KeyOf:()=>Ak,Literal:()=>HD,Lowercase:()=>DM,Mapped:()=>JO,Module:()=>ZN,Never:()=>iD,Not:()=>QN,Null:()=>Bk,Number:()=>GD,Object:()=>kO,Omit:()=>BM,Optional:()=>QO,Parameters:()=>$N,Partial:()=>dN,Pick:()=>eN,Promise:()=>AO,Readonly:()=>PO,ReadonlyOptional:()=>Nj,Record:()=>Kj,Recursive:()=>tP,Ref:()=>lk,RegExp:()=>nP,Required:()=>xN,Rest:()=>iP,ReturnType:()=>aP,String:()=>KD,Symbol:()=>Vk,TemplateLiteral:()=>nO,Transform:()=>cP,Tuple:()=>RO,Uint8Array:()=>Uk,Uncapitalize:()=>OM,Undefined:()=>Hk,Union:()=>mD,Unknown:()=>Wk,Unsafe:()=>lP,Uppercase:()=>kM,Void:()=>uP});function dP(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fP(e,t){return Y.String({pattern:`^${dP(e)}${Ft}$`,...t===void 0?{}:{description:t}})}var X=Y.String({minLength:1,description:`ISO 8601 date-time string`}),pP=Y.String({minLength:1});fP(Lt.project,`ProjectId`);var mP=fP(Lt.message,`MessageId`),hP=fP(Lt.taskModule,`TaskModuleId`),gP=fP(Lt.task,`TaskId`),_P=fP(Lt.runResult,`RunResultId`),vP=fP(Lt.recoverySummary,`RecoverySummaryId`),yP=fP(Lt.activity,`ActivityRef`),bP=fP(Lt.event,`EventRef`),xP=fP(Lt.workflowInvocation,`WorkflowInvocationRef`),SP=fP(Lt.clarificationThread,`ClarificationThreadRef`),CP=fP(Lt.clarificationRound,`ClarificationRoundRef`);fP(Lt.clarificationInteractionResponse,`ClarificationInteractionResponseId`);var wP=fP(Lt.approvalRequest,`ApprovalRequestId`),TP=fP(Lt.idempotency,`IdempotencyKey`),EP=fP(Lt.relayProject,`RelayProjectRef`);fP(Lt.relayAccount,`RelayAccountRef`),fP(Lt.relayMembership,`RelayMembershipRef`),fP(Lt.relayAccountSession,`RelayAccountSessionRef`),fP(Lt.relayClientSession,`RelayClientSessionId`);var DP=fP(Lt.relayUpload,`RelayUploadRef`);fP(Lt.relayAuthChallenge,`RelayAuthChallengeRef`),fP(Lt.hostConnection,`HostConnectionRef`),fP(Lt.joinToken,`JoinTokenRef`);var OP=Y.Union([Y.Literal(`project_context_bootstrap`),Y.Literal(`scratchpad_refresh`),Y.Literal(`task_compile`),Y.Literal(`context_sync`),Y.Literal(`reference_summary_refresh`),Y.Literal(`recovery_check`),Y.Literal(`follow_up_check`)]);Y.Object({cursor:Y.Optional(pP),limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50}))},{additionalProperties:!1});function kP(e){return Y.Object({items:Y.Array(e),page:Y.Object({next_cursor:Y.Optional(pP),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}function AP(e){return Y.Object({items:Y.Array(e),window:Y.Object({older_cursor:Y.Optional(pP),newer_cursor:Y.Optional(pP),has_older:Y.Boolean(),has_newer:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}var jP=Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workspace`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`session`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`bootstrap`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`clarification_round`),round_id:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`read_state`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_detail`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_run_results`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification`),thread_id:Y.Optional(SP),round_id:Y.Optional(CP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`execution_status`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`activity`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_config`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_usage`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_timeline`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`skills`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`artifacts`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`viewer`),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recovery_summaries`)},{additionalProperties:!1})]);Y.Object({kind:Y.String({minLength:1})});var MP=Y.Object({kind:Y.Literal(`interrupted`),retry_with_new_command_id:Y.Literal(!0)},{additionalProperties:!1});function NP(e){return Y.Object({command_id:TP,issued_at:X,payload:e},{additionalProperties:!1})}function PP(e){return Y.Object({command_id:TP,disposition:e,invalidates:Y.Optional(Y.Array(jP))},{additionalProperties:!1})}function FP(e,t){return Y.Object({command_id:TP,disposition:e,result:Y.Optional(t),invalidates:Y.Optional(Y.Array(jP))},{additionalProperties:!1})}var IP=Y.Union([Y.Literal(`bad_request`),Y.Literal(`unauthorized`),Y.Literal(`forbidden`),Y.Literal(`not_found`),Y.Literal(`conflict`),Y.Literal(`validation_failed`),Y.Literal(`provider_not_configured`),Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`relay_session_invalid`),Y.Literal(`command_replay_mismatch`),Y.Literal(`repo_snapshot_unavailable`),Y.Literal(`host_unavailable`),Y.Literal(`internal_error`)]);Y.Object({error:Y.Object({code:IP,message:Y.String({minLength:1}),retryable:Y.Boolean(),details:Y.Optional(Y.Unknown())},{additionalProperties:!1})},{additionalProperties:!1}),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`message.created`),Y.Literal(`scratchpad.updated`),Y.Literal(`worklist.changed`),Y.Literal(`task.updated`),Y.Literal(`task_detail.updated`),Y.Literal(`clarification.changed`),Y.Literal(`approval.changed`),Y.Literal(`activity.event`),Y.Literal(`execution_status.changed`),Y.Literal(`provider_config.changed`),Y.Literal(`workspace.recovered`),Y.Literal(`query.invalidate`)]),Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`me`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recent_projects`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`join_entries`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_presence`),relay_project_ref:EP},{additionalProperties:!1})]),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`query.invalidate`)]);var LP=Y.Object({retention_seconds:Y.Literal(300),max_events:Y.Literal(1e3)},{additionalProperties:!1}),Z=Y.String({minLength:1}),RP=Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`unknown`)]),zP=RP,BP=Y.Union([Y.Object({status:Y.Literal(`not_configured`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`configured`),provider:Y.Literal(`openai`),auth_kind:Y.Literal(`api_key`),redacted_key:Z,default_model:Z,validated_at:X},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),provider:Y.Optional(Y.Literal(`openai`)),auth_kind:Y.Optional(Y.Literal(`api_key`)),redacted_key:Y.Optional(Z),default_model:Y.Optional(Z),validated_at:Y.Optional(X),invalid_reason_code:Y.Optional(RP)},{additionalProperties:!1})]),VP=Y.Union([Y.Literal(`implementation`),Y.Literal(`planning`),Y.Literal(`context`),Y.Literal(`qna`),Y.Literal(`other`)]),HP=Y.Object({input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),UP=Y.Object({source:Y.String({minLength:1}),label:Y.String({minLength:1}),category:VP,input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),WP=Y.Object({model:Y.String({minLength:1}),input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),GP=Y.Object({total_tokens:Y.Integer({minimum:0}),totals:HP,by_source:Y.Array(UP),by_model:Y.Array(WP),recent_windows:Y.Object({today:HP,last_7_days:HP,last_30_days:HP},{additionalProperties:!1})},{additionalProperties:!1}),KP=Y.Union([Y.Literal(`task_accepted`),Y.Literal(`task_update`),Y.Literal(`checkpoint`)]),qP=Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`)]),JP=Y.Union([Y.Literal(`needs_input`),Y.Literal(`completed`),Y.Literal(`failed`)]),YP=Y.Union([Y.Literal(`neutral`),Y.Literal(`success`),Y.Literal(`warning`),Y.Literal(`error`)]),XP=Y.Object({kind:Y.Union([Y.Literal(`worklist_task`),Y.Literal(`chat_message`),Y.Literal(`reference_file`),Y.Literal(`repo_path`)]),label:Y.String({minLength:1}),task_id:Y.Optional(gP),message_id:Y.Optional(mP),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),ZP=Y.Object({message_id:mP,author:Y.String({minLength:1}),body:Y.String(),created_at:X},{additionalProperties:!1}),QP=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.String({minLength:1}),source:Y.Optional(Y.Union([Y.Literal(`scratchpad`),Y.Literal(`clarification`),Y.Literal(`contract`)]))},{additionalProperties:!1}),$P=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),request:Y.Optional(Y.String()),status:Y.Optional(Y.Union([Y.Literal(`active`),Y.Literal(`resolved`)])),answer_count:Y.Optional(Y.Integer({minimum:0})),answers:Y.Optional(Y.Array(ZP))},{additionalProperties:!1}),eF=Y.Union([Y.Literal(`added`),Y.Literal(`modified`),Y.Literal(`deleted`),Y.Literal(`renamed`),Y.Literal(`unknown`)]),tF=Y.Object({tone:YP,summary:Y.Optional(Y.String()),origin:Y.Optional(Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),snippets:Y.Optional(Y.Array(ZP)),source_count:Y.Optional(Y.Integer({minimum:0})),unavailable_reason:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),decisions:Y.Optional(Y.Array(QP)),clarification:Y.Optional($P),contract:Y.Optional(Y.Object({goal:Y.String(),scope:Y.Array(Y.String()),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),result:Y.Optional(Y.Object({summary:Y.String(),error_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),changes:Y.Optional(Y.Object({items:Y.Array(Y.Object({status:eF,path:Y.String({minLength:1}),previous_path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),total_count:Y.Integer({minimum:0}),truncated:Y.Boolean()},{additionalProperties:!1})),verification:Y.Optional(Y.Object({checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),skip_reason_code:Y.Optional(Y.String({minLength:1})),skip_reason_summary:Y.Optional(Y.String())},{additionalProperties:!1})),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),commit_oid:Y.Optional(Y.String({minLength:1})),commit_short_oid:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),checkpoint:Y.Optional(Y.Object({counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(Y.Object({task_id:gP,title:Y.String({minLength:1}),status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1})),generated_files:Y.Optional(Y.Array(Y.Object({path:Y.String({minLength:1}),name:Y.String({minLength:1})},{additionalProperties:!1}))),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),links:Y.Array(XP)},{additionalProperties:!1}),nF=Y.Object({id:Y.String({minLength:1}),kind:KP,occurred_at:X,title:Y.String({minLength:1}),summary:Y.Optional(Y.String()),task_id:Y.Optional(gP),task_title:Y.Optional(Y.String({minLength:1})),activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),run_result_id:Y.Optional(_P),message_id:Y.Optional(mP),status:Y.Optional(qP),update_state:Y.Optional(JP),token_usage:Y.Optional(HP),usage_sources:Y.Optional(Y.Array(UP)),usage_models:Y.Optional(Y.Array(WP)),trace_card:Y.Optional(tF)},{additionalProperties:!1});Y.Object({generated_at:X,usage_overview:GP,items:Y.Array(nF)},{additionalProperties:!1});var rF=10*1024*1024,iF=50*1024*1024,aF=iF,oF=Y.Union([Y.Literal(`reference_file`),Y.Literal(`skill_zip`)]),sF=Y.String({pattern:`^sha256:[a-f0-9]{64}$`});function cF(e){return{upload_id:DP,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:e}),sha256:sF,media_type:Y.Optional(Z)}}function lF(e){return e===`skill_zip`?iF:rF}var uF=cF(aF),dF=cF(rF),fF=cF(iF),pF={relay_project_ref:EP,file_name:Z,sha256:sF,media_type:Y.Optional(Z)},mF=Y.Object({...pF,purpose:Y.Literal(`reference_file`),size_bytes:Y.Integer({minimum:1,maximum:rF})},{additionalProperties:!1}),hF=Y.Object({...pF,purpose:Y.Literal(`skill_zip`),size_bytes:Y.Integer({minimum:1,maximum:iF})},{additionalProperties:!1});Y.Object(uF,{additionalProperties:!1});var gF=Y.Union([mF,hF]),_F=Y.Object({upload_id:DP,relay_project_ref:EP,purpose:oF,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:aF}),sha256:sF,media_type:Y.Optional(Z),expires_at:X},{additionalProperties:!1}),vF=Y.Object({method:Y.Literal(`PUT`),url:Y.String({minLength:1}),headers:Y.Optional(Y.Record(Y.String({minLength:1}),Y.String()))},{additionalProperties:!1}),yF=Y.Union([Y.Object({kind:Y.Literal(`started`)},{additionalProperties:!1})]),bF=Y.Object({upload:_F,put:vF},{additionalProperties:!1});NP(gF),FP(yF,bF);var xF=Y.Union([Y.Literal(`chat`),Y.Literal(`worklist`),Y.Literal(`references`),Y.Literal(`skills`)]),SF=Y.Object({scope:xF,latest_event_cursor:Y.Integer({minimum:0}),read_event_cursor:Y.Integer({minimum:0}),has_unread:Y.Boolean(),updated_at:Y.Optional(X)},{additionalProperties:!1}),CF=Y.Object({generated_at:X,scopes:Y.Object({chat:SF,worklist:SF,references:SF,skills:SF},{additionalProperties:!1})},{additionalProperties:!1}),wF=Y.Object({scope:xF,up_to_event_cursor:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),TF=Y.Union([Y.Object({kind:Y.Literal(`marked`)},{additionalProperties:!1}),MP]),EF=Y.Object({read_state:CF},{additionalProperties:!1});NP(wF),FP(TF,EF);var DF=Y.Object({attempt:Y.Integer({minimum:1}),kind:Y.Union([Y.Literal(`initial`),Y.Literal(`continuation`),Y.Literal(`retry`)]),parent_activity_ref:Y.Optional(yP),root_activity_ref:Y.Optional(yP)},{additionalProperties:!1}),OF=Y.Union([Y.Object({kind:Y.Literal(`task`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workflow`),workflow_ref:xP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:CP},{additionalProperties:!1})]),kF=Y.Union([Y.Literal(`todo`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`done`),Y.Literal(`failed`)]),AF=Y.Object({task_id:gP,title:Z,summary:Y.String(),status:kF,module_id:hP,module_name:Z},{additionalProperties:!1}),jF=Y.Object({workflow_ref:xP,activity_ref:yP,topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),submitted_at:X,compiled_tasks:Y.Optional(Y.Array(AF))},{additionalProperties:!1}),MF=Y.Object({id:Y.Literal(`current`),state:Y.Union([Y.Literal(`empty`),Y.Literal(`ready`),Y.Literal(`submitted`)]),topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),updated_by_activity_ref:Y.Optional(yP),updated_at:Y.Optional(X),submitted_by_activity_ref:Y.Optional(yP),submitted_by_workflow_ref:Y.Optional(xP),submitted_at:Y.Optional(X),receipts:Y.Array(jF)},{additionalProperties:!1}),NF=Y.Object({id:hP,name:Z,summary:Y.Optional(Y.String()),order:Y.Integer(),archived:Y.Boolean(),created_at:X,updated_at:Y.Optional(X)},{additionalProperties:!1}),PF=Y.Object({id:gP,module_id:hP,title:Z,summary:Y.String(),status:kF,order:Y.Integer(),current_activity_ref:Y.Optional(yP),active_clarification_thread_ref:Y.Optional(SP),latest_run_result_id:Y.Optional(_P),created_from_workflow_ref:xP,created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({modules:Y.Array(Y.Object({module:NF,tasks:Y.Array(PF)},{additionalProperties:!1})),updated_at:Y.Optional(X)},{additionalProperties:!1});var FF=Y.Object({goal:Y.String(),scope:Y.Array(Y.String())},{additionalProperties:!1}),IF=Y.Union([Y.Literal(`no_validation_command_found`),Y.Literal(`project_has_no_test_setup`),Y.Literal(`validation_not_applicable`),Y.Literal(`command_prerequisite_missing`),Y.Literal(`command_requires_external_service`),Y.Literal(`command_requires_secret`),Y.Literal(`command_requires_interactive_input`),Y.Literal(`command_too_expensive_for_mvp`),Y.Literal(`unsafe_command_blocked`),Y.Literal(`known_failing_baseline`)]),LF=Y.Object({status:Y.Union([Y.Literal(`succeeded`),Y.Literal(`failed`),Y.Literal(`unknown`)]),target:Y.Optional(Z),redacted_summary:Y.String(),started_at:Y.Optional(X),finished_at:Y.Optional(X)},{additionalProperties:!1}),RF=Y.Object({latest_run_result_id:Y.Optional(_P),result_kind:Y.Optional(Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)])),run_lineage:Y.Optional(DF),clarification_thread_ref:Y.Optional(SP),outcome:Y.Optional(Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)])),summary:Y.Optional(Y.String()),checks:Y.Optional(Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)])),docs:Y.Optional(Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)])),skip_reason_code:Y.Optional(IF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(LF)),changed_paths:Y.Optional(Y.Array(Y.String())),user_note_candidate:Y.Optional(Y.String()),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Z),commit_oid:Y.Optional(Z)},{additionalProperties:!1})),error_code:Y.Optional(Z),retryable:Y.Optional(Y.Boolean()),updated_at:Y.Optional(X)},{additionalProperties:!1}),zF=Y.Object({task:PF,detail:Y.Object({task_id:gP,contract:FF,result:RF,frozen_contract_since_activity_ref:Y.Optional(yP),updated_at:X},{additionalProperties:!1})},{additionalProperties:!1});kP(Y.Union([Y.Object({id:_P,activity_ref:yP,task_id:gP,run_lineage:DF,result_kind:Y.Literal(`needs_human`),summary:Y.String(),clarification_thread_ref:SP,created_at:X},{additionalProperties:!1}),Y.Object({id:_P,activity_ref:yP,task_id:gP,run_lineage:DF,result_kind:Y.Literal(`finished`),outcome:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),summary:Y.String(),user_note_candidate:Y.Optional(Y.String()),checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),docs:Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)]),skip_reason_code:Y.Optional(IF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(LF)),created_at:X},{additionalProperties:!1}),Y.Object({id:_P,activity_ref:yP,task_id:gP,run_lineage:DF,result_kind:Y.Literal(`failed`),summary:Y.String(),error_code:Z,retryable:Y.Boolean(),created_at:X},{additionalProperties:!1})]));var BF=Y.Object({recovery_summary_id:vP,summary:Y.String({minLength:1}),affected_activities:Y.Array(yP),affected_activity_count:Y.Integer({minimum:0}),created_at:X},{additionalProperties:!1});kP(BF),Y.Object({recovery_summary:BF},{additionalProperties:!1});var VF=Y.Union(or.map(e=>Y.Literal(e))),HF=Y.Union([Y.Object({kind:Y.Literal(`initials`),initials:Y.String({minLength:1}),color:VF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`image`),image_url:Y.String({minLength:1}),initials:Y.String({minLength:1}),color:VF},{additionalProperties:!1})]),UF=Y.Union([Y.Object({kind:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:CP},{additionalProperties:!1})]),WF=Y.Object({kind:Y.Union([Y.Literal(`human`),Y.Literal(`system`),Y.Literal(`agent`)]),ref:Y.Optional(Z),display_name:Y.Optional(Z),avatar:Y.Optional(HF)},{additionalProperties:!1}),GF=Y.Union([Y.Literal(`user_text`),Y.Literal(`agent_text`),Y.Literal(`system_notice`),Y.Literal(`clarification_request`),Y.Literal(`clarification_card`)]),KF=Y.Union([Y.Literal(`file`),Y.Literal(`image`)]),qF=Y.Object({path:Y.String({minLength:1}),name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:KF,blob_oid:Y.Optional(Z),media_type:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]))},{additionalProperties:!1})},{additionalProperties:!1}),JF=Y.Object({task_id:gP,title:Z,status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(_P)},{additionalProperties:!1}),YF=Y.Object({path:Y.String({minLength:1}),name:Z,group:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z)},{additionalProperties:!1}),XF=Y.Object({kind:Y.Literal(`worklist_terminal`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),reason:Y.Union([Y.Literal(`all_tasks_done`),Y.Literal(`run_failed`)]),title:Z,feedback_key:Z,counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(JF),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(YF)),primary_task_id:Y.Optional(gP)},{additionalProperties:!1}),ZF=Y.Object({kind:Y.Literal(`task_result`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),title:Z,task_id:gP,task_title:Z,result_key:Z,summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(_P),activity_ref:Y.Optional(yP),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(YF)),error_code:Y.Optional(Z)},{additionalProperties:!1}),QF=Y.Object({kind:Y.Literal(`worklist_compile`),workflow_ref:xP,title:Z,task_count:Y.Integer({minimum:0}),tasks:Y.Array(AF)},{additionalProperties:!1}),$F=Y.Object({kind:Y.Literal(`artifact_preview`),title:Z,status:Y.Union([Y.Literal(`available`),Y.Literal(`updated`)]),task_id:Y.Optional(gP),run_result_id:Y.Optional(_P)},{additionalProperties:!1}),eI=Y.Object({task_id:Y.Optional(gP),activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),clarification_thread_ref:Y.Optional(SP),clarification_round_ref:Y.Optional(CP),scratchpad_source:Y.Optional(Y.Union([Y.Literal(`include`),Y.Literal(`exclude`)])),reference_file:Y.Optional(qF),worklist_compile:Y.Optional(QF),worklist_feedback:Y.Optional(XF),task_result:Y.Optional(ZF),artifact_preview:Y.Optional($F)},{additionalProperties:!1}),tI=Y.Object({id:mP,scope:UF,author:WF,message_kind:GF,body:Y.String(),refs:Y.Optional(eI),clarification_card:Y.Optional(Y.Object({thread_id:SP,round_id:CP,title:Y.Optional(Z),summary:Z,status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),is_current_round:Y.Boolean()},{additionalProperties:!1})),created_at:X},{additionalProperties:!1});AP(tI);var nI=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),rI=Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),iI=Y.Union([rI,MP]),aI=Y.Object({message:tI},{additionalProperties:!1});Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`latest`),Y.Literal(`start`)])),before:Y.Optional(pP),after:Y.Optional(pP),around:Y.Optional(mP)},{additionalProperties:!1}),NP(nI),FP(iI,aI),Y.Object({message:tI},{additionalProperties:!1});var oI=Y.Union([Y.Literal(`command_execution`),Y.Literal(`file_change`),Y.Literal(`permissions`),Y.Literal(`legacy_exec_command`),Y.Literal(`legacy_apply_patch`)]),sI=Y.Union([Y.Literal(`allow_once`),Y.Literal(`allow_session`),Y.Literal(`deny`),Y.Literal(`cancel`)]),cI=Y.Union([Y.Literal(`primary`),Y.Literal(`neutral`),Y.Literal(`danger`)]),lI=Y.Object({decision_id:Z,kind:sI,label:Z,tone:cI},{additionalProperties:!1}),uI=Y.Object({text:Z,cwd_label:Y.Optional(Z),actions:Y.Optional(Y.Array(Y.Object({label:Z,detail:Y.Optional(Z)},{additionalProperties:!1}))),network:Y.Optional(Y.Object({host:Z,protocol:Z},{additionalProperties:!1}))},{additionalProperties:!1}),dI=Y.Object({grant_root_label:Y.Optional(Z),paths:Y.Optional(Y.Array(Z))},{additionalProperties:!1}),fI=Y.Object({network:Y.Optional(Y.Object({enabled:Y.Boolean()},{additionalProperties:!1})),filesystem:Y.Optional(Y.Object({read:Y.Optional(Y.Array(Z)),write:Y.Optional(Y.Array(Z))},{additionalProperties:!1}))},{additionalProperties:!1}),pI=Y.Object({approval_id:wP,request_kind:oI,title:Z,summary:Z,reason:Y.Optional(Z),requested_at:X,expires_at:Y.Optional(X),task_id:Y.Optional(gP),activity_ref:Y.Optional(yP),command:Y.Optional(uI),file_change:Y.Optional(dI),permissions:Y.Optional(fI),decisions:Y.Array(lI,{minItems:1})},{additionalProperties:!1}),mI=Y.Union([Y.Literal(`accepted`),Y.Literal(`declined`),Y.Literal(`cancelled`),Y.Literal(`expired`)]),hI=Y.Object({decision_id:Z,label:Z,outcome:mI,decided_at:X,decided_by:Y.Optional(Y.Object({account_ref:Z,display_name:Z},{additionalProperties:!1}))},{additionalProperties:!1}),gI=Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`pending`),request:pI},{additionalProperties:!1}),Y.Object({state:Y.Literal(`resolved`),request:pI,resolution:hI},{additionalProperties:!1})]),_I=Y.Object({decision_id:Z},{additionalProperties:!1}),vI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`decision_unavailable`)},{additionalProperties:!1}),MP]),yI=Y.Object({approval:Y.Optional(gI)},{additionalProperties:!1});NP(_I),FP(vI,yI);var bI=Y.Union([Y.Object({ref_kind:Y.Literal(`project_doc`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`directory_readme`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`task_detail`),task_id:gP},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`worklist`),module_id:Y.Optional(hP),task_id:Y.Optional(gP)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`scratchpad`),id:Y.Literal(`current`)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`clarification_round`),clarification_round_ref:CP},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`chat_messages`),message_refs:Y.Array(mP)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`repo_paths`),paths:Y.Array(Z)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`recovery_summary`),recovery_summary_id:vP},{additionalProperties:!1})]),xI=Y.Object({kind:Y.Literal(`freeform`),purpose:Y.Union([Y.Literal(`clarify_requirement`),Y.Literal(`confirm_risk`)]),prompt:Y.Object({title:Y.Optional(Z),summary:Z,request:Z},{additionalProperties:!1}),subject:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`task`),Y.Literal(`deployment_target`),Y.Literal(`project_context`)]),ref:Y.Optional(Z),summary:Z},{additionalProperties:!1})),expires_when:Y.Optional(Y.Union([Y.Literal(`current_run_only`),Y.Literal(`until_task_contract_changes`)]))},{additionalProperties:!1});Y.Object({summary:Z,request:Z,interaction:Y.Optional(xI)},{additionalProperties:!1});var SI=Y.Object({summary:Z,request:Z,interaction:Y.Optional(xI),title:Y.Optional(Z),related_refs:Y.Optional(Y.Array(bI))},{additionalProperties:!1}),CI=Y.Union([Y.Object({kind:Y.Literal(`task_compile`),workflow_ref:xP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:gP},{additionalProperties:!1})]),wI=Y.Object({id:SP,owner:CI,status:Y.Union([Y.Literal(`active`),Y.Literal(`closed`)]),current_round_id:Y.Optional(CP),created_from_activity_ref:Y.Optional(yP),closed_reason:Y.Optional(Y.Union([Y.Literal(`resolved`),Y.Literal(`contract_changed`),Y.Literal(`cancelled`)])),created_at:X,updated_at:X},{additionalProperties:!1}),TI=Y.Union([Y.Object({kind:Y.Literal(`next_round`),clarification_round_ref:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`run`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`proposal_applied`),workflow_ref:xP},{additionalProperties:!1})]),EI=Y.Object({id:CP,thread_id:SP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),request_payload:SI,card_message_id:mP,opening_message_id:mP,submitted_at:Y.Optional(X),submitted_message_refs:Y.Optional(Y.Array(mP)),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(TI),capabilities:Y.Object({send_message:Y.Boolean(),submit:Y.Boolean()},{additionalProperties:!1}),created_at:X,updated_at:X},{additionalProperties:!1});Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`active`),thread:wI,round:EI},{additionalProperties:!1})]);var DI=Y.Object({id:CP,thread_id:SP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),title:Y.Optional(Z),summary:Z,submitted_at:Y.Optional(X),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({thread:wI,rounds:Y.Array(DI)},{additionalProperties:!1}),Y.Object({thread:wI,round:EI},{additionalProperties:!1}),Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`start`),Y.Literal(`latest`)])),before:Y.Optional(pP),after:Y.Optional(pP)},{additionalProperties:!1});var OI=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),kI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(CP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),MP]),AI=Y.Object({message:Y.Optional(tI)},{additionalProperties:!1});NP(OI),FP(kI,AI);var jI=Y.Object({},{additionalProperties:!1}),MI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_submitted`),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(TI)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(CP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),MP]),NI=Y.Object({round:Y.Optional(EI),materialization:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`queued`),Y.Literal(`already_materialized`)]),successor_ref:Y.Optional(TI)},{additionalProperties:!1}))},{additionalProperties:!1});NP(jI),FP(MI,NI),Y.Object({reason:Y.Union([Y.Literal(`round_opened`),Y.Literal(`round_message_created`),Y.Literal(`round_submitted`),Y.Literal(`successor_materialized`),Y.Literal(`chain_closed`),Y.Literal(`recovered`)]),thread_id:SP,round_id:Y.Optional(CP),successor_ref:Y.Optional(TI)},{additionalProperties:!1});var PI=Y.String(),FI=Y.Object({source:Y.Literal(`mainline`),branch:Y.Literal(`tutti/mainline`),head:Y.Optional(Y.Object({oid:Z,short_oid:Z},{additionalProperties:!1})),mainline_clean:Y.Boolean(),generated_at:X},{additionalProperties:!1}),II=Y.Union([Y.Literal(`product`),Y.Literal(`tech`),Y.Literal(`structure`),Y.Literal(`architecture_principles`)]),LI=Y.Union([Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),RI=Y.Object({doc_key:II,path:PI,status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),unreadable_reason:Y.Optional(LI),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),last_commit:Y.Optional(Y.Object({oid:Z,short_oid:Z,committed_at:X,title:Y.Optional(Z)},{additionalProperties:!1}))},{additionalProperties:!1}),zI=Y.Union([Y.Literal(`directory`),Y.Literal(`symlink`),Y.Literal(`submodule`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unknown`)]),BI=Y.Object({path:PI,name:Y.String(),kind:Y.Union([Y.Literal(`directory`),Y.Literal(`file`),Y.Literal(`symlink`),Y.Literal(`submodule`)]),depth:Y.Integer({minimum:0}),parent_path:Y.Optional(PI),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),has_children:Y.Optional(Y.Boolean()),project_doc_key:Y.Optional(II),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(zI)},{additionalProperties:!1})},{additionalProperties:!1}),VI=Y.Union([Y.Object({kind:Y.Literal(`text`),encoding:Y.Literal(`utf-8`),text:Y.String(),truncated:Y.Boolean(),bytes_returned:Y.Integer({minimum:0}),total_bytes:Y.Integer({minimum:0}),line_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`omitted`),reason:Y.Union([Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),total_bytes:Y.Integer({minimum:0})},{additionalProperties:!1})]),HI=Y.Object({path:PI,name:Z,kind:Y.Literal(`file`),size_bytes:Y.Integer({minimum:0}),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),media_type:Y.Optional(Z)},{additionalProperties:!1});Y.Object({snapshot:FI,docs:Y.Array(RI)},{additionalProperties:!1}),Y.Object({doc_key:II},{additionalProperties:!1}),Y.Object({max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1}),Y.Object({snapshot:FI,doc:RI,content:VI},{additionalProperties:!1}),Y.Object({path:Y.Optional(PI),depth:Y.Optional(Y.Integer({minimum:1,maximum:3})),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(pP)},{additionalProperties:!1});var UI=Y.Object({next_cursor:Y.Optional(pP),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:1e3})},{additionalProperties:!1});Y.Object({snapshot:FI,root:BI,items:Y.Array(BI),page:UI},{additionalProperties:!1}),Y.Object({path:PI,max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1});var WI=Y.Union([Y.Literal(`thumbnail`),Y.Literal(`preview`),Y.Literal(`original`)]);Y.Object({path:PI,variant:WI,v:Z},{additionalProperties:!1}),Y.Object({snapshot:FI,file:HI,content:VI},{additionalProperties:!1});var GI=Y.Object({path:Y.Literal(`docs/reference`),status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`)]),index_path:Y.Literal(`docs/reference/README.md`),files_path:Y.Literal(`docs/reference/files`),images_path:Y.Literal(`docs/reference/images`),tutti_path:Y.Literal(`docs/reference/tutti`),index_status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),index_unreadable_reason:Y.Optional(LI)},{additionalProperties:!1}),KI=Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]),qI=Y.Object({status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`stale`),Y.Literal(`unavailable`)]),text:Y.Optional(Y.String()),generated_at:Y.Optional(X),source_blob_oid:Y.Optional(Z),unavailable_reason:Y.Optional(Y.String()),read_paths:Y.Optional(Y.Array(PI))},{additionalProperties:!1}),JI=Y.Object({path:PI,name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:KF,size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),blob_oid:Y.Optional(Z),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(KI)},{additionalProperties:!1}),summary:Y.Optional(qI)},{additionalProperties:!1});Y.Object({include_index:Y.Optional(Y.Boolean()),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(pP)},{additionalProperties:!1}),Y.Object({snapshot:FI,directory:GI,items:Y.Array(JI),page:UI},{additionalProperties:!1});var YI=Y.Object({...dF,note:Y.Optional(Y.String())},{additionalProperties:!1}),XI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),MP]),ZI=Y.Object({file:JI,message:tI,index_path:Y.Literal(`docs/reference/README.md`)},{additionalProperties:!1});NP(YI),FP(XI,ZI);var QI=Y.Object({paths:Y.Optional(Y.Array(PI))},{additionalProperties:!1}),$I=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_targets`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`)]),retryable:Y.Boolean()},{additionalProperties:!1}),MP]),eL=Y.Object({activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),target_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1});NP(QI),FP($I,eL);var tL=Y.Literal(`tutti.artifact.json`),nL=Y.Union([Y.Literal(`static`),Y.Literal(`server`)]),rL=Y.String({minLength:1,maxLength:120,pattern:`\\S`}),iL=Y.String({minLength:1}),aL=Y.Object({title:rL,kind:Y.Literal(`static`),root:iL,entry:iL,network:Y.Boolean()},{additionalProperties:!1}),oL=Y.Object({title:rL,kind:Y.Literal(`server`),cwd:iL,entry:Y.String({minLength:1,maxLength:256,pattern:`^/`}),network:Y.Boolean()},{additionalProperties:!1});Y.Object({version:Y.Literal(1),artifact:Y.Union([aL,oL])},{additionalProperties:!1});var sL=Y.Union([Y.Literal(`ready`),Y.Literal(`starting`),Y.Literal(`stopped`),Y.Literal(`failed`)]),cL=Y.Object({title:rL,kind:nL,network:Y.Boolean()},{additionalProperties:!1}),lL=Y.Object({status:sL,url:Y.Optional(Y.String({minLength:1})),error_message:Y.Optional(Z)},{additionalProperties:!1}),uL=Y.Union([Y.Object({status:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),manifest_path:tL,error:Y.Object({code:Z,message:Z},{additionalProperties:!1})},{additionalProperties:!1}),Y.Object({status:Y.Literal(`declared`),manifest_path:tL,manifest_blob_oid:Z,artifact:cL,preview:lL},{additionalProperties:!1})]);Y.Object({artifact:uL},{additionalProperties:!1});var dL=Y.Object({},{additionalProperties:!1}),fL=Y.Union([Y.Object({kind:Y.Literal(`issued`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`preview_not_ready`),status:Y.Union([Y.Literal(`starting`),Y.Literal(`stopped`),Y.Literal(`failed`)]),message:Y.Optional(Z)},{additionalProperties:!1}),MP]),pL=Y.Object({bootstrap_url:Y.String({minLength:1}),expires_at:X},{additionalProperties:!1});NP(dL),FP(fL,pL);var mL=Y.Object({},{additionalProperties:!1}),hL=Y.Union([Y.Object({kind:Y.Literal(`started`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`starting`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unsupported`)},{additionalProperties:!1}),MP]),gL=Y.Union([Y.Object({kind:Y.Literal(`recorded`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_running`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),MP]),_L=Y.Union([Y.Object({kind:Y.Literal(`stopped`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_running`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),MP]),vL=Y.Object({artifact:uL},{additionalProperties:!1});NP(mL),FP(hL,vL),NP(mL),FP(gL,vL),NP(mL),FP(_L,vL);var yL=Y.String({minLength:1,maxLength:96,pattern:`^[a-z0-9_-]+$`}),bL=Y.Object({name:yL,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X)},{additionalProperties:!1}),xL=Y.Object({name:yL,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X),skill_md:Y.String({minLength:1})},{additionalProperties:!1});Y.Object({items:Y.Array(bL)},{additionalProperties:!1}),Y.Object({skill_name:yL},{additionalProperties:!1}),Y.Object({skill:xL},{additionalProperties:!1});var SL=Y.Object(fF,{additionalProperties:!1}),CL=Y.Union([Y.Object({kind:Y.Literal(`created`),skill_name:yL},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`replaced`),skill_name:yL},{additionalProperties:!1}),MP]),wL=Y.Object({skill:xL},{additionalProperties:!1});NP(SL),FP(CL,wL);var TL=Y.Object({skill_name:yL},{additionalProperties:!1}),EL=Y.Union([Y.Object({kind:Y.Literal(`deleted`),skill_name:yL},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_found`),skill_name:yL},{additionalProperties:!1}),MP]);NP(TL),PP(EL);var DL=Y.Union([Y.Literal(`idle`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`failed`)]),OL=Y.Union([Y.Literal(`foreground`),Y.Literal(`scratchpad_background`)]),kL=Y.Object({activity_ref:yP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),workflow_ref:Y.Optional(xP),workflow_kind:Y.Optional(OP),lane:Y.Optional(OL),started_at:Y.Optional(X)},{additionalProperties:!1}),AL=Y.Union([Y.Literal(`reading_context`),Y.Literal(`planning`),Y.Literal(`editing_files`),Y.Literal(`running_command`),Y.Literal(`using_tool`),Y.Literal(`waiting_for_approval`),Y.Literal(`finalizing`)]),jL=Y.Object({input_tokens:Y.Optional(Y.Integer({minimum:0})),cached_input_tokens:Y.Optional(Y.Integer({minimum:0})),output_tokens:Y.Optional(Y.Integer({minimum:0})),reasoning_output_tokens:Y.Optional(Y.Integer({minimum:0})),total_tokens:Y.Integer({minimum:0})},{additionalProperties:!1}),ML=Y.Object({activity_ref:yP,stage_id:Y.Optional(Y.String()),started_at:Y.Optional(X),updated_at:Y.Optional(X),token_usage:Y.Optional(jL),current_action:Y.Optional(AL)},{additionalProperties:!1}),NL=Y.Object({status:DL,summary:Y.String(),active_task:Y.Optional(PF),active_activity:Y.Optional(kL),active_activities:Y.Optional(Y.Array(kL)),runtime:Y.Optional(ML),blocked_by:Y.Optional(Y.Union([Y.Object({kind:Y.Literal(`clarification`),thread_id:SP,round_id:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`),approval_id:wP},{additionalProperties:!1})])),last_conclusion:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`),Y.Literal(`recovered`)]),summary:Y.String(),task_id:Y.Optional(gP),activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),occurred_at:X},{additionalProperties:!1})),updated_at:X},{additionalProperties:!1}),PL=Y.Object({activity_ref:yP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),status:Y.Union([Y.Literal(`running`),Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`),Y.Literal(`interrupted`)]),title:Z,summary:Y.String(),task_id:Y.Optional(gP),workflow_ref:Y.Optional(xP),workflow_kind:Y.Optional(OP),lane:Y.Optional(OL),run_lineage:Y.Optional(DF),started_at:Y.Optional(X),ended_at:Y.Optional(X),latest_event_ref:Y.Optional(bP),result_anchor:Y.Optional(OF)},{additionalProperties:!1}),FL=Y.Object({event_ref:bP,activity_ref:yP,event_kind:Y.Union([Y.Literal(`started`),Y.Literal(`progress`),Y.Literal(`needs_human`),Y.Literal(`artifact_snapshot`),Y.Literal(`finished`),Y.Literal(`failed`)]),occurred_at:X,summary:Y.String(),payload:Y.Optional(Y.Object({progress:Y.Optional(Y.Object({message:Y.String(),phase:Y.Optional(Y.String())},{additionalProperties:!1})),artifact:Y.Optional(Y.Object({artifact_kind:Y.Union([Y.Literal(`scratchpad_snapshot`),Y.Literal(`task_compile_proposal`),Y.Literal(`context_sync_findings`),Y.Literal(`recovery_summary`),Y.Literal(`run_changed_paths`)]),summary:Y.String()},{additionalProperties:!1})),terminal:Y.Optional(Y.Object({result_kind:Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1}))},{additionalProperties:!1}))},{additionalProperties:!1});Y.Object({server_time:X,current_event_cursor:Z,replay:Y.Object({requested_cursor:Y.Optional(Z),status:Y.Union([Y.Literal(`not_requested`),Y.Literal(`replayed`),Y.Literal(`missed`)]),replayed_event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),retry_after_ms:Y.Integer({minimum:0}),replay_window:LP},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`replay_missed`),Y.Literal(`bulk_state_change`),Y.Literal(`workspace_recovered`),Y.Literal(`viewer_changed`)]),message:Y.Optional(Y.String())},{additionalProperties:!1}),Y.Object({execution_status:NL},{additionalProperties:!1}),Y.Object({approval:gI},{additionalProperties:!1}),Y.Object({activity:PL,event:FL},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`task_compile_applied`),Y.Literal(`task_state_changed`),Y.Literal(`task_result_recorded`),Y.Literal(`workspace_recovered`)]),workflow_ref:Y.Optional(xP),activity_ref:Y.Optional(yP),changed_module_ids:Y.Optional(Y.Array(hP)),changed_task_ids:Y.Optional(Y.Array(gP))},{additionalProperties:!1}),Y.Object({task:PF},{additionalProperties:!1}),Y.Object({task_id:gP,task:Y.Optional(PF),detail:Y.Optional(zF),latest_run_result_id:Y.Optional(_P)},{additionalProperties:!1}),Y.Object({scratchpad:MF,activity_ref:Y.Optional(yP)},{additionalProperties:!1}),Y.Object({provider_config:BP},{additionalProperties:!1}),Y.Object({recovery_summary_id:vP,summary:Y.String(),affected_activities:Y.Array(yP),replayed_round_ids:Y.Optional(Y.Array(CP))},{additionalProperties:!1}),Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_source_messages`)},{additionalProperties:!1}),MP]),Y.Object({activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),scratchpad:Y.Optional(MF)},{additionalProperties:!1});var IL=Y.Object({expected_scratchpad_updated_at:Y.Optional(X)},{additionalProperties:!1}),LL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad_empty`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_scratchpad`),current_scratchpad:MF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),MP]),RL=Y.Object({activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP)},{additionalProperties:!1});NP(IL),FP(LL,RL);var zL=Y.Object({scope:Y.Optional(Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}))},{additionalProperties:!1}),BL=Y.Union([Y.Object({kind:Y.Literal(`scheduled`),task_id:gP,activity_ref:yP,queued_task_ids:Y.Array(gP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)])},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`blocked_by_clarification`),thread_id:SP,round_id:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`nothing_to_run`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`mainline_not_clean`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),MP]);NP(zL),PP(BL);var VL=Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1}),HL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),MP]),UL=Y.Object({project:Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1})},{additionalProperties:!1});NP(VL),FP(HL,UL);var WL=Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1}),GL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),MP]),KL=Y.Object({project:Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1})},{additionalProperties:!1});NP(WL),FP(GL,KL);var qL=Y.Object({},{additionalProperties:!1}),JL=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_initialized`)},{additionalProperties:!1}),MP]),YL=Y.Object({activity_ref:yP,workflow_ref:xP},{additionalProperties:!1}),XL=Y.Object({docs:Y.Array(RI),created_paths:Y.Array(PI),commit_oid:Y.Optional(Z)},{additionalProperties:!1});NP(qL),FP(JL,XL);var ZL=Y.Object({},{additionalProperties:!1}),QL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),MP]),$L=YL;NP(ZL),FP(QL,$L);function eR(e){try{return decodeURIComponent(e)}catch{return e}}function tR(e){return Ut(eR(e))}function nR(e,t=``){if(/^\/$/u.test(e))return{kind:`home`};if(/^\/console\/?$/u.test(e))return{kind:`local_console`};if(/^\/setup\/?$/u.test(e))return{kind:`setup`};if(/^\/projects\/?$/u.test(e)){let e=new URLSearchParams(t).get(`open`);if(e!==null){let t=tR(e);if(t!==null)return{kind:`project_open`,relayProjectRef:t}}return{kind:`project_center`}}let n=/^\/join\/([^/]+)\/?$/u.exec(e);if(n?.[1]!==void 0)return{kind:`join`,joinToken:eR(n[1])};let r=/^\/projects\/([^/]+)\/workspace\/?$/u.exec(e);if(r?.[1]!==void 0){let e=tR(r[1]);return e===null?{kind:`project_center`}:{kind:`workspace`,relayProjectRef:e}}let i=/^\/projects\/([^/]+)\/references\/?$/u.exec(e);if(i?.[1]!==void 0){let e=tR(i[1]);return e===null?{kind:`project_center`}:{kind:`references`,relayProjectRef:e}}let a=/^\/projects\/([^/]+)\/artifacts\/?$/u.exec(e);if(a?.[1]!==void 0){let e=tR(a[1]);return e===null?{kind:`project_center`}:{kind:`artifacts`,relayProjectRef:e}}let o=/^\/projects\/([^/]+)\/worklist\/?$/u.exec(e);if(o?.[1]!==void 0){let e=tR(o[1]);return e===null?{kind:`project_center`}:{kind:`worklist`,relayProjectRef:e}}let s=/^\/projects\/([^/]+)\/skills\/?$/u.exec(e);if(s?.[1]!==void 0){let e=tR(s[1]);return e===null?{kind:`project_center`}:{kind:`skills`,relayProjectRef:e}}let c=/^\/projects\/([^/]+)\/timeline\/?$/u.exec(e);if(c?.[1]!==void 0){let e=tR(c[1]);return e===null?{kind:`project_center`}:{kind:`timeline`,relayProjectRef:e}}let l=/^\/projects\/([^/]+)\/settings\/?$/u.exec(e);if(l?.[1]!==void 0){let e=tR(l[1]);return e===null?{kind:`project_center`}:{kind:`settings`,relayProjectRef:e}}return{kind:`project_center`}}var rR={success:3e3,error:9e3,warning:6e3,info:4500},iR=5,aR=(0,N.createContext)(null);function oR(e){return e.persistent===!0||e.tone===`loading`?e.durationMs:e.durationMs??rR[e.tone]}function sR(e){return e.persistent??e.tone===`loading`}function cR(e){return e.dismissible??e.tone!==`loading`}function lR(e,t){let n=oR(t);return{id:e,tone:t.tone,title:t.title,persistent:sR(t),dismissible:cR(t),...t.message===void 0?{}:{message:t.message},...n===void 0?{}:{durationMs:n}}}function uR(e,t){let n=t.tone===void 0,r={tone:t.tone??e.tone,title:t.title??e.title,...t.message===void 0?e.message===void 0?{}:{message:e.message}:{message:t.message},...t.durationMs===void 0?!n||e.durationMs===void 0?{}:{durationMs:e.durationMs}:{durationMs:t.durationMs},...t.persistent===void 0?!n||e.persistent===void 0?{}:{persistent:e.persistent}:{persistent:t.persistent},...t.dismissible===void 0?!n||e.dismissible===void 0?{}:{dismissible:e.dismissible}:{dismissible:t.dismissible}};return lR(e.id,r)}function dR(e){return[e.id,e.tone,e.title,e.message??``,e.durationMs??``,e.persistent===!0?`persistent`:`timed`].join(`:`)}function fR({children:e}){let[t,n]=(0,N.useState)([]),r=(0,N.useRef)(new Map),i=(0,N.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]),a=(0,N.useCallback)(e=>{let t=Gt(),r=lR(t,e);return n(e=>[...e,r].slice(-iR)),t},[]),o=(0,N.useCallback)((e,t)=>{if(e===void 0){a(t);return}n(n=>n.map(n=>n.id===e?uR(n,t):n))},[a]);(0,N.useEffect)(()=>{let e=new Set(t.map(e=>e.id));for(let[t,n]of r.current)e.has(t)||(window.clearTimeout(n.timeout),r.current.delete(t));for(let e of t){let t=r.current.get(e.id),n=dR(e);if(t!==void 0&&t.key!==n&&(window.clearTimeout(t.timeout),r.current.delete(e.id)),e.persistent===!0||e.durationMs===void 0||r.current.has(e.id))continue;let a=window.setTimeout(()=>i(e.id),e.durationMs);r.current.set(e.id,{key:n,timeout:a})}},[i,t]),(0,N.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e.timeout);r.current.clear()},[]);let s=(0,N.useMemo)(()=>({notify:a,update:o,dismiss:i}),[i,a,o]);return(0,P.jsxs)(aR.Provider,{value:s,children:[e,(0,P.jsx)(da,{notices:t,onDismiss:i})]})}function pR(){let e=(0,N.useContext)(aR);if(e===null)throw Error(`useNotify must be used inside NotificationProvider`);return e}var mR=`http://127.0.0.1:4370`;function hR(){return typeof window<`u`?window.location.origin:mR}function gR(){return hR()}var _R=gR(),vR={relayBaseUrl:_R},yR=3e4,Q={relayRoot:[`relay`],me:[`relay`,`me`],recentProjects:[`relay`,`projects`,`recent`],projectPresence:e=>[`relay`,`projects`,e,`presence`],relayJoinRoot:[`relay`,`join`],join:e=>[`relay`,`join`,e],bootstrap:e=>[`host`,e,`bootstrap`],hostRoot:e=>[`host`,e],hostSession:e=>[`host`,e,`session`],hostWorkspace:e=>[`host`,e,`workspace`],messages:e=>[`host`,e,`messages`,`main_chat`],messagesWindow:(e,t)=>[...Q.messages(e),{limit:t}],messagesAround:(e,t,n)=>[...Q.messages(e),{around:t,limit:n}],messageHistory:(e,t,n)=>[...Q.messages(e),{history:t,limit:n}],scratchpad:e=>[`host`,e,`scratchpad`],worklist:e=>[`host`,e,`worklist`],readState:e=>[`host`,e,`read-state`],activeClarification:e=>[`host`,e,`clarification`,`active`],activeApproval:e=>[`host`,e,`approval`,`active`],noActiveClarificationRoundMessages:e=>[`host`,e,`clarification-round-messages`,`none`],clarificationRoundMessages:(e,t)=>[`host`,e,`clarification-round-messages`,t],task:(e,t)=>[`host`,e,`task`,t],taskDetail:(e,t)=>[`host`,e,`task-detail`,t],taskRunResults:(e,t)=>[`host`,e,`task-run-results`,t],executionStatus:e=>[`host`,e,`execution-status`],providerConfig:e=>[`host`,e,`provider-config`],providerUsage:e=>[`host`,e,`provider-usage`],projectTimeline:e=>[`host`,e,`project-timeline`],viewerRoot:e=>[`host`,e,`viewer`],viewerFile:(e,t)=>[`host`,e,`viewer`,`file`,t],referenceFiles:e=>[`host`,e,`references`,`files`],artifacts:e=>[`host`,e,`artifacts`],artifactPreviewSession:(e,t)=>[`relay`,e,`artifact-preview-session`,t],skills:e=>[`host`,e,`skills`],skillDetail:(e,t)=>[`host`,e,`skills`,t]};function bR(){return`${window.location.pathname}${window.location.search}${window.location.hash}`}function $(e,t={}){t.replace===!0?window.history.replaceState(null,``,e):window.history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function xR(e){let t=new URL(e,window.location.origin);$(`${t.pathname}${t.search}${t.hash}`)}function SR(){let[e,t]=(0,N.useState)(bR);return(0,N.useEffect)(()=>{let e=()=>{t(bR())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),(0,N.useMemo)(()=>{let t=new URL(e,window.location.origin);return nR(t.pathname,t.search)},[e])}function CR(e){return e instanceof Error?e.message:`Request failed`}function wR(e){e.invalidateQueries({queryKey:Q.me}),e.invalidateQueries({queryKey:Q.recentProjects})}function TR(e,t){if(t!==void 0)for(let n of t)switch(n.kind){case`all`:e.invalidateQueries({queryKey:Q.relayRoot});break;case`me`:e.invalidateQueries({queryKey:Q.me});break;case`recent_projects`:e.invalidateQueries({queryKey:Q.recentProjects});break;case`join_entries`:e.invalidateQueries({queryKey:Q.relayJoinRoot});break;case`project_presence`:Vt(n.relay_project_ref,Lt.relayProject)&&e.invalidateQueries({queryKey:Q.projectPresence(n.relay_project_ref)});break}}function ER(e){let t=rt(),n=(0,N.useMemo)(()=>zn(vR),[]);(0,N.useEffect)(()=>{if(e)try{let e=n.connectEvents({onReady:e=>{e.payload.replay.status===`missed`&&t.invalidateQueries({queryKey:Q.relayRoot})},onInvalidate:e=>{TR(t,e)}});return()=>{e.close()}}catch{return}},[e,t,n])}function DR(e,t,n){if(n!==void 0)for(let r of n)switch(r.kind){case`all`:e.invalidateQueries({queryKey:Q.hostRoot(t)});break;case`workspace`:e.invalidateQueries({queryKey:Q.hostWorkspace(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`session`:e.invalidateQueries({queryKey:Q.hostSession(t)});break;case`bootstrap`:e.invalidateQueries({queryKey:Q.bootstrap(t)});break;case`messages`:r.scope===`main_chat`?e.invalidateQueries({queryKey:Q.messages(t)}):e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break;case`scratchpad`:e.invalidateQueries({queryKey:Q.scratchpad(t)});break;case`worklist`:e.invalidateQueries({queryKey:Q.worklist(t)});break;case`read_state`:e.invalidateQueries({queryKey:Q.readState(t)});break;case`task`:e.invalidateQueries({queryKey:Q.task(t,r.task_id)});break;case`task_detail`:e.invalidateQueries({queryKey:Q.taskDetail(t,r.task_id)});break;case`task_run_results`:e.invalidateQueries({queryKey:Q.taskRunResults(t,r.task_id)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`execution_status`:e.invalidateQueries({queryKey:Q.executionStatus(t)});break;case`approval`:e.invalidateQueries({queryKey:Q.activeApproval(t)});break;case`provider_config`:e.invalidateQueries({queryKey:Q.providerConfig(t)});break;case`provider_usage`:e.invalidateQueries({queryKey:Q.providerUsage(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`project_timeline`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`viewer`:e.invalidateQueries({queryKey:Q.viewerRoot(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),(r.path===void 0||r.path.startsWith(`docs/reference`))&&e.invalidateQueries({queryKey:Q.referenceFiles(t)}),r.path!==void 0&&e.invalidateQueries({queryKey:Q.viewerFile(t,r.path)});break;case`skills`:e.invalidateQueries({queryKey:Q.skills(t)});break;case`artifacts`:e.invalidateQueries({queryKey:Q.artifacts(t)});break;case`recovery_summaries`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`activity`:break;case`clarification`:e.invalidateQueries({queryKey:Q.activeClarification(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),r.round_id!==void 0&&e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break}}function OR(){return{items:[],window:{has_older:!1,has_newer:!1,limit:50}}}function kR(){return{modules:[]}}function AR(){return{id:`current`,state:`empty`,topic:``,background_summary:``,current_consensus:[],open_questions:[],task_changes:[],receipts:[]}}function jR(e){return{chat:e?.scopes.chat.has_unread===!0,worklist:e?.scopes.worklist.has_unread===!0,references:e?.scopes.references.has_unread===!0,skills:e?.scopes.skills.has_unread===!0}}function MR(e){return e?.artifact.status===`declared`?{available:!0}:{available:!1}}function NR({enabled:e,hostClient:t,relayProjectRef:n,readState:r,scope:i}){let a=rt(),o=(0,N.useRef)(null),s=yt({mutationFn:e=>t.markRead({scope:i,up_to_event_cursor:e}),onSuccess:e=>{DR(a,n,e.invalidates)},onError:()=>{o.current=null}});(0,N.useEffect)(()=>{if(!e||r===void 0)return;let t=r.scopes[i];if(!t.has_unread){t.read_event_cursor>=t.latest_event_cursor&&(o.current=null);return}let n=`${i}:${t.latest_event_cursor}`;o.current===n||s.isPending||(o.current=n,s.mutate(t.latest_event_cursor))},[e,s,r,i])}function PR(){return{state:`none`}}function FR(e){return{status:`idle`,summary:`Idle`,updated_at:e}}function IR(e){return e.active_activities??(e.active_activity===void 0?[]:[e.active_activity])}function LR(e,t,n){return IR(e).some(e=>e.workflow_kind===t?n===void 0||(e.lane??`foreground`)===n:!1)}function RR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/references`;return t===void 0?n:`${n}?path=${encodeURIComponent(t)}`}function zR(e){return`/projects/${encodeURIComponent(Ht(e))}/artifacts`}function BR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/worklist`;return t===void 0?n:`${n}?task=${encodeURIComponent(t)}`}function VR(e,t){return`${rn(e)}?message=${encodeURIComponent(t)}`}function HR(e){return`/projects/${encodeURIComponent(Ht(e))}/settings`}function UR(e){return`/projects/${encodeURIComponent(Ht(e))}/timeline`}function WR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/skills`;return t===void 0?n:`${n}?skill=${encodeURIComponent(t)}`}function GR(e,t){switch(t.target.kind){case`approval`:case`clarification`:case`scratchpad`:return rn(e);case`worklist`:return BR(e);case`references`:return RR(e);case`task`:return BR(e,t.target.taskId)}}function KR(e,t){$(GR(e,t))}function qR(e,t){let n=Fr(e);if(t!==void 0&&n.some(e=>e.id===t))return t;for(let e of[`running`,`pending`,`failed`,`todo`,`done`]){let t=n.find(t=>t.status===e);if(t!==void 0)return t.id}}function JR(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function YR(e){switch(e){case`binary`:return`Binary file`;case`too_large`:return`File too large`;case`unsupported_encoding`:return`Unsupported encoding`;case`restricted_path`:case`secret_like`:return`Restricted file`;default:return`Preview unavailable`}}function XR(e){if(!(e===void 0||e.kind===`text`))return YR(e.reason)}function ZR(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function QR(e){if(globalThis.crypto?.subtle===void 0)throw Error(`This browser does not support file upload hashing.`);return`sha256:${ZR(await globalThis.crypto.subtle.digest(`SHA-256`,await e.arrayBuffer()))}`}async function $R(e){if(e.file.size<=0)throw Error(`Upload file cannot be empty.`);let t=lF(e.purpose);if(e.file.size>t)throw Error(`Upload file cannot exceed ${JR(t)}.`);let n=await QR(e.file),r=e.file.type===``?void 0:e.file.type,i=zn(vR),a=e.purpose===`skill_zip`?{relay_project_ref:e.relayProjectRef,purpose:`skill_zip`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}}:{relay_project_ref:e.relayProjectRef,purpose:`reference_file`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}},o=await i.startUpload(a);if(o.result===void 0)throw Error(`Upload session could not be started.`);let s=new Headers(o.result.put.headers??{});r!==void 0&&!s.has(`content-type`)&&s.set(`content-type`,r);let c;try{c=await fetch(o.result.put.url,{method:o.result.put.method,headers:s,body:e.file})}catch{throw Error(`File upload failed while sending the file to upload storage. Check that R2 CORS allows PUT from this Web origin.`)}if(!c.ok)throw Error(`File upload failed while sending the file to upload storage (${c.status}).`);return{upload_id:o.result.upload.upload_id,file_name:o.result.upload.file_name,size_bytes:o.result.upload.size_bytes,sha256:o.result.upload.sha256,...o.result.upload.media_type===void 0?{}:{media_type:o.result.upload.media_type}}}function ez(e){let t=rt(),n=pR(),[r,i]=(0,N.useState)(`identity`),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)({email:``,displayName:``,code:``}),l=yt({mutationFn:async()=>{let e=s.email.trim(),t=await Vn(vR,{email:e});if(t.result===void 0)throw Error(`Login challenge was not returned`);return{challenge:t.result.challenge,disposition:t.disposition,email:e}},onSuccess:({challenge:e,disposition:t,email:r})=>{o(e),c(e=>({...e,code:``})),i(`code`),n.notify({tone:`success`,title:t.kind===`otp_already_pending`?`Verification email already sent`:`Verification email sent`,message:t.kind===`otp_already_pending`?`Verification email already sent to ${r}.`:`Verification email sent to ${r}.`})}}),u=yt({mutationFn:async()=>{if(a===null)throw Error(`Login challenge is missing`);let e=await Hn(vR,{challenge_ref:a.challenge_ref,code:s.code.trim()});if(e.result===void 0)throw Error(`Login response was not returned`);return e.result},onSuccess:n=>{if(!n.account.profile_complete){t.invalidateQueries({queryKey:Q.me}),c(e=>({...e,displayName:``})),i(`profile`);return}wR(t),e?.()}}),d=yt({mutationFn:async()=>{let e=await Un(vR,{display_name:s.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{wR(t),e?.()}}),f=e=>{if(e.preventDefault(),r===`identity`&&s.email.trim()!==``){l.mutate();return}if(r===`code`&&a!==null&&s.code.trim()!==``){u.mutate();return}r===`profile`&&s.displayName.trim()!==``&&d.mutate()},p=l.isPending||u.isPending||d.isPending,m=r===`identity`?l.error:r===`code`?u.error??l.error:d.error;return{phase:r,form:s,pending:p,submitDisabled:r===`identity`?s.email.trim()===``:r===`code`?a===null||s.code.replace(/\s+/gu,``).length!==6:s.displayName.trim()===``,challengeEmailHint:a?.email_hint??null,error:m===null?null:CR(m),onChange:e=>{c(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:f,onBack:()=>{l.reset(),u.reset(),d.reset(),o(null),c(e=>({...e,code:``})),i(`identity`)}}}function tz(e){let t=rt(),[n,r]=(0,N.useState)({email:``,displayName:``,code:``}),i=yt({mutationFn:async()=>{let e=await Un(vR,{display_name:n.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{wR(t),e?.()}});return{phase:`profile`,form:n,pending:i.isPending,submitDisabled:n.displayName.trim()===``,challengeEmailHint:null,error:i.error===null?null:CR(i.error),onChange:e=>{r(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:e=>{e.preventDefault(),n.displayName.trim()!==``&&i.mutate()}}}var nz=`tutti.workspace-onboarding.v1`,rz={version:1,start_chat_pending:!1,tour_pending:!1};function iz(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function az(e){return e.storage===void 0?iz():e.storage}function oz(e,t){return`${nz}:${e}:${t}`}function sz(e){if(typeof e!=`object`||!e)return null;let t=e;return t.version===1&&typeof t.start_chat_pending==`boolean`&&typeof t.tour_pending==`boolean`?{version:1,start_chat_pending:t.start_chat_pending,tour_pending:t.tour_pending}:null}function cz(e,t,n){if(e!==null)try{if(!n.start_chat_pending&&!n.tour_pending){e.removeItem(t);return}e.setItem(t,JSON.stringify(n))}catch{}}function lz(e,t,n={}){let r=az(n);if(r===null)return{...rz};try{let n=r.getItem(oz(e,t));return n===null?{...rz}:sz(JSON.parse(n))??{...rz}}catch{return{...rz}}}function uz(e,t,n={}){cz(az(n),oz(e,t),{version:1,start_chat_pending:!0,tour_pending:!0})}function dz(e,t,n,r){let i=az(r),a=lz(e,t,{storage:i});a[n]&&cz(i,oz(e,t),{...a,[n]:!1})}function fz(e,t,n={}){dz(e,t,`start_chat_pending`,n)}function pz(e,t,n={}){dz(e,t,`tour_pending`,n)}function mz({joinToken:e}){let t=rt(),n=F({queryKey:Q.join(e),queryFn:()=>Gn(vR,e)}),r=ez(()=>{n.refetch()}),i=tz(()=>{n.refetch()}),a=yt({mutationFn:()=>Kn(vR,e),onSuccess:n=>{wR(t),t.invalidateQueries({queryKey:Q.join(e)}),n.disposition.kind===`joined`&&n.result!==void 0&&uz(n.result.account.account_ref,n.result.relay_project.relay_project_ref),n.result?.relay_project.host_status===`online`&&$(rn(n.result.relay_project.relay_project_ref))}}),o=yt({mutationFn:e=>Jn(vR,e),onSuccess:e=>{wR(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0&&xR(e.result.open_url)}}),s=n.data;ER(s?.account!==void 0);let c=s?.relay_project?.display_name??`Project`,l=s?.relay_project?.host_status??`unknown`,u=s?.account?.profile_complete===!1,d=u?`login_required`:n.isLoading?`loading`:n.error===null?s?.next.kind??`invalid_or_expired`:`error`;return(0,P.jsx)(GS,{projectName:c,description:d===`invalid_or_expired`?`This invite can no longer be used.`:`You have been invited to join ${c}.`,hostLabel:rr(l),hostOnline:l===`online`,nextKind:d,accountLabel:s?.account?.display_name??null,membershipLabel:s?.membership?.label??null,actionPending:a.isPending||o.isPending,error:n.error===null?a.error===null?o.error===null?null:CR(o.error):CR(a.error):CR(n.error),onBrandClick:()=>$(`/`),onRetry:()=>void n.refetch(),onAccept:()=>a.mutate(),onOpen:()=>{s?.next.kind===`open_workspace`&&o.mutate(s.next.relay_project_ref)},...d===`login_required`?{loginForm:u?i:r}:{}})}function hz(){$(`/projects`,{replace:!0})}function gz(){let e=F({queryKey:Q.me,queryFn:()=>Bn(vR)}),t=ez(hz);return(0,N.useEffect)(()=>{e.data!==void 0&&hz()},[e.data]),e.isLoading||e.data!==void 0?null:(0,P.jsx)(eC,{...t,onBrandClick:()=>$(`/`),sessionError:e.error===null||Qt(e.error)?null:`Tutti could not check your current session. You can still try signing in.`})}function _z(e){let t=e.trim().replace(/[\\/]+$/u,``);return t===``?``:t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1)}function vz(e=``){return{workspacePath:e,displayName:_z(e),description:``,baseUrl:``,apiKey:``,model:``}}function yz(e,t,n){return{...e,workspacePath:t,...n?{}:{displayName:_z(t)}}}function bz(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length===0?t:n}function xz({inviterName:e,projectName:t,joinUrl:n}){return`${bz(e,`A teammate`)} invited you to join the Tutti project “${bz(t,`Untitled project`)}”.\n\nOpen the invitation link:\n${n.trim()}`}var Sz=vz();function Cz(){let e=window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash;return new URLSearchParams(e).get(`access_token`)}function wz(){window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}`)}function Tz(e){return window.open(e,`_blank`,`noopener,noreferrer`)}function Ez(){let e=window.open(`about:blank`,`_blank`);return e!==null&&(e.opener=null),e}function Dz(){let e=pR(),t=(0,N.useRef)(void 0),n=(0,N.useRef)(void 0),r=(0,N.useRef)(!1),i=(0,N.useMemo)(()=>Fn({baseUrl:window.location.origin,csrfToken:()=>t.current,contextToken:()=>n.current}),[]),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(Sz),d=(0,N.useRef)(!1),f=(0,N.useRef)({baseUrl:``,apiKey:``}),[p,m]=(0,N.useState)([]),[h,g]=(0,N.useState)(!1),[_,v]=(0,N.useState)(`folder`),[y,b]=(0,N.useState)([]),[x,S]=(0,N.useState)(!0),[C,w]=(0,N.useState)(!1),[T,E]=(0,N.useState)(!1),[ee,D]=(0,N.useState)(null),[O,k]=(0,N.useState)(null);async function te(){if(t.current!==void 0){S(!0);try{b((await i.getProjects()).projects)}catch(t){e.notify({tone:`error`,title:`Projects unavailable`,message:CR(t)})}finally{S(!1)}}}(0,N.useEffect)(()=>{r.current||(r.current=!0,(async()=>{try{let e=Cz();if(e!==null&&e.trim()!==``){wz();let r=await i.exchangeSession(e);t.current=r.csrf_token,n.current=r.context_token}let r=await i.getBootstrap();t.current=r.csrf_token,o(r),c(null),await te()}catch(e){S(!1),c(CR(e))}})())},[i]),(0,N.useEffect)(()=>{if(a===null)return;let e=window.setInterval(()=>{i.heartbeat().catch(()=>void 0)},6e4);return()=>window.clearInterval(e)},[a,i]),(0,N.useEffect)(()=>{if(O===null)return;let e=window.setTimeout(()=>k(null),3200);return()=>window.clearTimeout(e)},[O]);async function ne(){try{let t=await i.pickFolder();t.kind===`selected`?oe({workspacePath:t.path}):t.kind===`unavailable`&&e.notify({tone:`info`,title:`Use a folder path`,message:t.message})}catch(t){e.notify({tone:`error`,title:`Folder picker unavailable`,message:CR(t)})}}async function A(){let t={baseUrl:l.baseUrl.trim(),apiKey:l.apiKey.trim()},n=()=>f.current.baseUrl.trim()===t.baseUrl&&f.current.apiKey.trim()===t.apiKey;w(!0);try{let r=await i.discoverModels({base_url:t.baseUrl,api_key:t.apiKey});if(!n())return;r.kind===`ok`?(m(r.models),u(e=>({...e,model:``})),v(`model`)):(m([]),e.notify({tone:`error`,title:`Provider check failed`,message:r.reason===`model_list_empty`?`The endpoint did not return any available models.`:`Check the Base URL and API key, then try again.`}))}catch(t){if(!n())return;m([]),e.notify({tone:`error`,title:`Provider check failed`,message:CR(t)})}finally{w(!1)}}async function re(){E(!0);try{let t=await i.launchProject({workspace_path:l.workspacePath.trim(),project:{display_name:l.displayName.trim(),...l.description.trim()===``?{}:{description:l.description.trim()}},provider:{base_url:l.baseUrl.trim(),api_key:l.apiKey.trim(),model:l.model.trim()}});se(),k(t.project_created?t.project.project_id:null),await te(),e.notify({tone:`success`,title:t.project_created?`Project created`:`Configuration saved`,message:`${t.project.display_name} is ready.`})}catch(t){e.notify({tone:`error`,title:`Launch failed`,message:CR(t)})}finally{E(!1)}}async function ie(t){D(t.project_id);try{await i.launchProject({workspace_path:t.workspace_path}),await te(),e.notify({tone:`success`,title:`${t.display_name} is ready`})}catch(t){let n=t instanceof Jt&&t.code===`provider_configuration_required`;e.notify({tone:n?`warning`:`error`,title:n?`Provider required`:`Launch failed`,message:n?`Use New project with this folder to update its Provider configuration.`:CR(t)})}finally{D(null)}}async function j(t){D(t.project_id);try{let n=await i.refreshInvite(t.project_id);await navigator.clipboard.writeText(xz({inviterName:``,projectName:t.display_name,joinUrl:n.join_url})),b(e=>e.map(e=>e.project_id===t.project_id?{...e,join_url:n.join_url}:e)),e.notify({tone:`success`,title:`Invitation copied`})}catch(t){e.notify({tone:`error`,title:`Invite unavailable`,message:CR(t)})}finally{D(null)}}async function M(t){if(t.open_url===void 0)return;if(t.update_required!==!0){Tz(t.open_url);return}let n=Ez();D(t.project_id);try{let r=await i.openProject(t.project_id);b(e=>e.map(e=>e.project_id===r.project.project_id?r.project:e)),n===null?window.location.assign(r.open_url):n.location.replace(r.open_url),r.disposition===`updated`?e.notify({tone:`success`,title:`${t.display_name} updated`}):r.disposition===`deferred_busy`?e.notify({tone:`info`,title:`Opened without updating`,message:`Try Open again after the current project activity finishes.`}):r.disposition===`deferred_unsupported`?e.notify({tone:`info`,title:`Opened with the current Host`,message:`Stop and Resume this project once to enable safe automatic updates.`}):r.disposition===`deferred_unavailable`&&e.notify({tone:`warning`,title:`Update deferred`,message:`The current Host could not be safely restarted, so the project opened as-is.`})}catch(t){n?.close(),e.notify({tone:`error`,title:`Open failed`,message:CR(t)})}finally{D(null)}}async function ae(t){D(t.project_id);try{await i.stopProject(t.project_id),b(e=>e.map(e=>{if(e.project_id!==t.project_id)return e;let n={...e,status:`stopped`};return delete n.join_url,n})),e.notify({tone:`success`,title:`${t.display_name} stopped`})}catch(t){e.notify({tone:`error`,title:`Stop failed`,message:CR(t)})}finally{D(null)}}function oe(e){e.displayName!==void 0&&(d.current=!0);let t=e.baseUrl!==void 0&&e.baseUrl!==l.baseUrl||e.apiKey!==void 0&&e.apiKey!==l.apiKey;t&&(m([]),f.current={baseUrl:e.baseUrl??l.baseUrl,apiKey:e.apiKey??l.apiKey}),u(n=>({...e.workspacePath===void 0?n:yz(n,e.workspacePath,d.current),...e,...t?{model:``}:{}}))}function se(){g(!1),v(`folder`),m([]),f.current={baseUrl:``,apiKey:``},d.current=!1,u(vz())}function ce(e){if(!e){!C&&!T&&se();return}let t=a?.current_directory??``;d.current=!1,f.current={baseUrl:``,apiKey:``},m([]),u(vz(t)),v(`folder`),g(!0)}function le(e){if(e.preventDefault(),_===`folder`){v(`details`);return}if(_===`details`){v(`provider`);return}if(_===`provider`){A();return}re()}function ue(){v(e=>{switch(e){case`folder`:return`folder`;case`details`:return`folder`;case`provider`:return`details`;case`model`:return`provider`}})}return(0,P.jsx)($S,{form:l,models:p,projects:y,projectsLoading:x,sessionLoading:a===null&&s===null,sessionError:s,createOpen:h,createStep:_,modelDiscoveryPending:C,launchPending:T,projectActionPending:ee,highlightedProjectId:O,onChange:oe,onCreateOpenChange:ce,onCreateSubmit:le,onCreateBack:ue,onChooseFolder:()=>void ne(),onRefresh:()=>void te(),onLaunchExisting:e=>void ie(e),onOpenProject:e=>void M(e),onCopyInvite:e=>void j(e),onStopProject:e=>void ae(e)})}var Oz=/^[A-Za-z0-9_-]{8,256}$/u,kz=/https?:\/\/[^\s<>"'`“”‘’]+/giu,Az=/(?:^|[\s("'“‘])((?:\/)?join\/[A-Za-z0-9_-]{8,256})(?=$|[\s?#.,;:!'"”’)\]}])/giu,jz=/[.,;:!?)}\]]+$/u;function Mz(e){let t;try{t=decodeURIComponent(e)}catch{return null}return Oz.test(t)?t:null}function Nz(e){let t=e.split(`/`).filter(Boolean);return t.length!==2||t[0]!==`join`?null:Mz(t[1]??``)}function Pz(e,t){let n=Nz(t);n!==null&&e.add(`/join/${encodeURIComponent(n)}`)}function Fz(e,t){try{Pz(e,new URL(t.replace(jz,``)).pathname)}catch{}}function Iz(e){let t=e.trim();if(t===``)return{kind:`empty`};let n=new Set;for(let e of t.matchAll(kz))Fz(n,e[0]);for(let e of t.matchAll(Az)){let t=e[1];if(t!==void 0)try{Pz(n,new URL(t,`https://tutti.invalid`).pathname)}catch{}}let r=Mz(t);return r!==null&&n.add(`/join/${encodeURIComponent(r)}`),n.size===0?{kind:`invalid`}:n.size>1?{kind:`ambiguous`}:{kind:`matched`,route:[...n][0]}}function Lz({requestedOpenProjectRef:e}){let t=rt(),n=pR(),r=ez(),i=tz(),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(null),l=(0,N.useRef)(null),u=F({queryKey:Q.me,queryFn:()=>Bn(vR)}),d=F({queryKey:Q.recentProjects,queryFn:()=>qn(vR),enabled:u.isSuccess});ER(u.isSuccess);let f=yt({mutationFn:e=>Jn(vR,e),onSuccess:e=>{if(wR(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0){xR(e.result.open_url);return}n.notify({tone:`warning`,title:`Host is offline`})},onError:e=>{n.notify({tone:`error`,title:`Project open failed`,message:CR(e)})}}),p=f.mutate;(0,N.useEffect)(()=>{e===void 0||u.data?.account.profile_complete!==!0||l.current===e||(l.current=e,p(e))},[u.data?.account.profile_complete,p,e]);let m=yt({mutationFn:()=>Wn(vR),onSuccess:()=>{t.invalidateQueries({queryKey:Q.relayRoot}),t.invalidateQueries({queryKey:Q.me}),t.invalidateQueries({queryKey:Q.recentProjects})},onError:e=>{n.notify({tone:`error`,title:`Sign out failed`,message:CR(e)})}});if(u.error!==null&&Qt(u.error))return(0,P.jsx)(HS,{...r,onBrandClick:()=>$(`/`)});let h=u.data?.account;if(h!==void 0&&!h.profile_complete)return(0,P.jsx)(HS,{...i,onBrandClick:()=>$(`/`)});let g=(d.data?.projects??[]).map(ar);return(0,P.jsx)(tC,{account:h===void 0?null:{displayName:h.display_name},projects:g,loading:u.isLoading||d.isLoading,error:u.error===null?d.error===null?null:CR(d.error):CR(u.error),openPending:f.isPending,logoutPending:m.isPending,joinLinkForm:{value:a,error:s,onChange:e=>{o(e),c(null)},onSubmit:()=>{let e=Iz(a);if(e.kind!==`matched`){c(e.kind===`ambiguous`?`Paste one Tutti invitation at a time.`:`Paste a valid Tutti invitation.`);return}$(e.route)}},onCopyLaunchCommands:e=>{navigator.clipboard.writeText(e).then(()=>{n.notify({tone:`success`,title:`Commands copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the launch commands.`})})},onBrandClick:()=>$(`/`),onOpenProject:e=>f.mutate(e),onLogout:()=>m.mutate()})}function Rz(e){let t=e?.relay;if(t?.join_url_visibility===`visible_once`&&t.join_url!==void 0&&t.join_url.trim()!==``)return t.join_url}function zz(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return!1}}function Bz(e,t){let n=Rz(e);if(n!==void 0)return{kind:`join`,joinUrl:n};let r=e?.relay?.relay_project_ref;return r===void 0?{kind:`unavailable`,message:`Relay project is unavailable`}:zz(t.currentOrigin,t.relayBaseUrl)?{kind:`relay_open`,relayProjectRef:r}:{kind:`unavailable`,message:`Open the latest Join URL printed by tutti launch.`}}var Vz=`gpt-5.5`,Hz=`/host-local/v1`;function Uz(){return new URL(window.location.href).searchParams.get(`token`)?.trim()??``}function Wz(e){return{baseUrl:Hz,credentials:`same-origin`,headers:{authorization:`Bearer ${e}`}}}function Gz(e){return I(Wz(e),`/provider/config`)}function Kz(e){return I(Wz(e),`/launch-status`)}function qz(e){return I(Wz(e),`/project`)}function Jz(e,t){return I(Wz(e),`/project`,{method:`POST`,body:t})}function Yz(e,t){return I(Wz(e),`/provider/config`,{method:`POST`,body:t})}function Xz(e){return e===void 0?`loading`:e.status===`configured`?`configured`:e.status===`invalid`?`invalid`:`not configured`}function Zz(e){let t=e instanceof Error&&`code`in e?String(e.code):``;return t.startsWith(`provider_`)?t:CR(e)}function Qz(){let e=Uz(),t=e===``,[n,r]=(0,N.useState)({projectName:``,apiKey:``,baseUrl:``,defaultModel:Vz}),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)(null),c=(0,N.useRef)(!1),l=F({queryKey:[`host-local`,`provider-config`,e],queryFn:()=>Gz(e),enabled:!t}),u=F({queryKey:[`host-local`,`launch-status`,e],queryFn:()=>Kz(e),enabled:!t}),d=F({queryKey:[`host-local`,`project`,e],queryFn:()=>qz(e),enabled:!t}),f=u.data,p=yt({mutationFn:e=>Jn(vR,e.relayProjectRef),onSuccess:e=>{if(e.disposition.kind===`opened`&&e.result?.open_url!==void 0){xR(e.result.open_url);return}s(`Host is offline`)},onError:e=>{s(CR(e))}}),m=yt({mutationFn:async()=>{let t=n.projectName.trim(),r=d.data?.display_name.trim()??``;t!==``&&t!==r&&await Jz(e,{display_name:t});let i={api_key:n.apiKey.trim()},a=n.baseUrl.trim(),o=n.defaultModel.trim();return a!==``&&(i.base_url=a),o!==``&&(i.default_model=o),await Yz(e,i)},onSuccess:()=>{a(`Provider saved.`),r(e=>({...e,apiKey:``})),d.refetch(),l.refetch(),v()}}),h=l.data;(0,N.useEffect)(()=>{let e=d.data?.display_name;e!==void 0&&r(t=>t.projectName.trim()===``?{...t,projectName:e}:t)},[d.data?.display_name]),(0,N.useEffect)(()=>{t||h?.status!==`configured`||v()},[h?.status,t]);let g=t?`Setup token is missing.`:d.error===null?l.error===null?m.error===null?o:Zz(m.error):Zz(l.error):Zz(d.error);function _(e){e.preventDefault(),a(null),s(null),c.current=!1,!t&&n.apiKey.trim()!==``&&n.projectName.trim()!==``&&m.mutate()}async function v(){if(c.current)return;c.current=!0;let e=Bz(f??(await u.refetch()).data,{currentOrigin:window.location.origin,relayBaseUrl:_R});if(e.kind===`join`){window.location.assign(e.joinUrl);return}if(e.kind===`unavailable`){s(e.message);return}p.mutate({relayProjectRef:e.relayProjectRef})}return(0,P.jsx)(rC,{form:n,statusLabel:Xz(h),configured:h?.status===`configured`,loading:l.isLoading||d.isLoading,pending:m.isPending,tokenMissing:t,error:g,success:i,openProjectPending:p.isPending,onChange:e=>r(t=>({...t,...e})),onSubmit:_,onRetry:()=>void l.refetch(),onBrandClick:()=>$(`/`)})}function $z(e){return`${e.created_at}:${e.id}`}function eB(e){return{kind:`initial`,entry:e}}function tB(e,t=50){if(e.kind===`older`)return{before:e.before,limit:t};if(e.kind===`newer`)return{after:e.after,limit:t};switch(e.entry.kind){case`latest`:return{limit:t};case`start`:return{anchor:`start`,limit:t};case`around`:return{around:e.entry.messageId,limit:t}}}function nB(e){let t=e.window.older_cursor;return e.window.has_older&&t!==void 0?{kind:`older`,before:t}:void 0}function rB(e){let t=e.window.newer_cursor;return e.window.has_newer&&t!==void 0?{kind:`newer`,after:t}:void 0}function iB(e,t=50){let n=e[0],r=e.at(-1);if(n===void 0||r===void 0)return{items:[],window:{has_older:!1,has_newer:!1,limit:t}};let i=new Map;for(let t of e)for(let e of t.items)i.set(e.id,e);let a=[...i.values()].sort((e,t)=>$z(e).localeCompare($z(t))),o={has_older:n.window.has_older,has_newer:r.window.has_newer,limit:n.window.limit};return o.has_older&&n.window.older_cursor!==void 0&&(o.older_cursor=n.window.older_cursor),o.has_newer&&r.window.newer_cursor!==void 0&&(o.newer_cursor=r.window.newer_cursor),{items:a,window:o}}var aB=5400,oB=1500;function sB(e){let t=e.completionSource;return t?.activityRef??t?.workflowRef??t?.taskId??e.key}function cB(e){switch(e.kind){case`accepted`:case`already_running`:return null;case`scratchpad_empty`:return{label:`Scratchpad is empty. Let it refresh before running.`,tone:`error`};case`stale_scratchpad`:return{label:`Scratchpad changed. Review the latest snapshot and run again.`,tone:`error`};case`provider_not_configured`:return{label:`Provider is not configured yet.`,tone:`error`};case`provider_unavailable`:return{label:`Provider unavailable: ${e.reason}.`,tone:`error`};case`interrupted`:return{label:`Run was interrupted. Try again.`,tone:`error`}}}function lB(e,t){t.displayName.trim()===``||e.has(t.key)||e.set(t.key,t)}function uB(e){if(e.author.kind!==`human`)return null;let t=e.author.display_name?.trim()||`Member`;return{key:e.author.ref===void 0?`message-author:${t.toLocaleLowerCase()}`:e.author.ref,displayName:t,avatar:e.author.avatar??{kind:`initials`,initials:dr(t),color:`blue`}}}function dB({account:e,presence:t,messages:n=[]}){let r=new Map;e!==void 0&&lB(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.sample_members??[])lB(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.members??[])lB(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of n){let t=uB(e);t!==null&&lB(r,t)}return[...r.values()]}function fB({account:e,presence:t}){let n={},r=(e,t)=>{let r=n[e];n[e]={avatar:t.avatar,online:r?.online===!0||t.online}};for(let e of t?.members??[])r(e.account_ref,{avatar:e.avatar,online:e.online});for(let e of t?.sample_members??[])r(e.account_ref,{avatar:e.avatar,online:!0});return e!==void 0&&r(e.account_ref,{avatar:e.avatar,online:!0}),n}function pB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(null),[m,h]=(0,N.useState)(()=>Date.now()),[g,_]=(0,N.useState)(null),v=new URL(bR(),window.location.origin).searchParams.get(`message`),y=v!==null&&Vt(v,Lt.message)?v:void 0,[b,x]=(0,N.useState)(()=>y===void 0?{kind:`latest`}:{kind:`around`,messageId:y}),S=(0,N.useRef)(null),C=(0,N.useRef)(null),w=(0,N.useRef)(null),[T,E]=(0,N.useState)(null),ee=u!==null;(0,N.useEffect)(()=>{y!==void 0&&(b.kind!==`around`||b.messageId!==y)&&x({kind:`around`,messageId:y})},[b,y]);let D=(t=null)=>{x({kind:`latest`}),_(t),y!==void 0&&$(rn(e),{replace:!0})},O=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),k=O.data?.session.account.account_ref,te=k===void 0?null:`${k}:${e}`,ne=y!==void 0||te!==null&&T===te;(0,N.useEffect)(()=>{te===null||T===te||(y===void 0&&k!==void 0&&x(lz(k,e).start_chat_pending?{kind:`start`}:{kind:`latest`}),E(te))},[k,te,e,y,T]);let A=bt({queryKey:Q.messageHistory(e,b,50),queryFn:({pageParam:e})=>r.getMessages(tB(e)),initialPageParam:eB(b),getPreviousPageParam:e=>nB(e),getNextPageParam:e=>rB(e),enabled:O.isSuccess&&ne,staleTime:yR}),re=F({queryKey:Q.scratchpad(e),queryFn:()=>r.getScratchpad(),enabled:O.isSuccess,staleTime:yR,refetchInterval:ee?oB:!1}),ie=F({queryKey:Q.activeClarification(e),queryFn:()=>r.getActiveClarification(),enabled:O.isSuccess,staleTime:yR,refetchInterval:ee?oB:!1}),j=F({queryKey:Q.activeApproval(e),queryFn:()=>r.getActiveApproval(),enabled:O.isSuccess,staleTime:yR}),M=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:O.isSuccess,staleTime:yR,refetchInterval:ee?oB:!1}),ae=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:O.isSuccess,staleTime:yR}),oe=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:O.isSuccess,staleTime:yR}),se=F({queryKey:Q.projectPresence(e),queryFn:()=>Yn(vR,e),enabled:O.isSuccess,staleTime:yR,refetchInterval:6e4});ER(O.isSuccess);let ce=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${CR(e)}`})}}),le=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:CR(e)})}}),ue=yt({mutationFn:({body:e,commandId:t})=>r.sendMainChatMessage({body:e},{commandId:t}),onSuccess:(n,r)=>{S.current=null,a(e=>e.trim()===r.body?``:e),n.result?.message!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(n.result.message.id):D(n.result.message.id)),DR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Message send failed`,message:CR(e)})}}),de=yt({mutationFn:async t=>{let n=await $R({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{let o=r.result?.message;o!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(o.id):D(o.id)),DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:CR(e)})}}),fe=yt({mutationFn:e=>r.submitWorklist(e===void 0?{}:{expected_scratchpad_updated_at:e}),onMutate:()=>(d({kind:`request`}),n.notify({tone:`loading`,title:`Running Scratchpad`})),onSuccess:(r,i,a)=>{if(r.disposition.kind===`accepted`){let e=r.result?.activity_ref;d(e===void 0?null:{kind:`activity`,activityRef:e,...r.result?.workflow_ref===void 0?{}:{workflowRef:r.result.workflow_ref}}),n.update(a,{tone:`success`,title:`Scratchpad run started`,message:`Tutti is preparing Worklist tasks.`})}else if(r.disposition.kind===`already_running`)d(null),n.update(a,{tone:`info`,title:`Already running`,message:`Tutti is already processing work.`});else{d(null);let e=cB(r.disposition);n.update(a,{tone:e?.tone??`warning`,title:`Scratchpad run blocked`,...e?.label===void 0?{}:{message:e.label}})}DR(t,e,r.invalidates)},onError:(e,t,r)=>{d(null),n.update(r,{tone:`error`,title:`Scratchpad run failed`,message:CR(e)})}}),pe=O.data,me=fB({account:pe?.session.account,presence:se.data?.presence}),he=pe?.generated_at??new Date(0).toISOString(),ge=A.data===void 0?void 0:iB(A.data.pages,50),_e=ge??(ne&&b.kind===`latest`?pe?.snapshots.main_chat:void 0)??OR(),ve=A.data!==void 0&&A.hasPreviousPage===!0,ye=A.data!==void 0&&A.hasNextPage===!0,be=b.kind===`latest`||b.kind===`start`&&!ye||b.kind===`around`&&_e.items.length>0&&!ye,xe=b.kind===`around`?`around:${b.messageId}`:b.kind,Se=b.kind===`around`?`focus`:b.kind===`start`?`start`:`latest`,Ce=pe!==void 0&&(!ne||ge===void 0&&A.isLoading&&(b.kind!==`latest`||pe.snapshots.main_chat===void 0)),we=re.data??pe?.snapshots.scratchpad??AR(),Te=ae.data??pe?.snapshots.read_state;NR({enabled:O.isSuccess,hostClient:r,relayProjectRef:e,readState:Te,scope:`chat`});let Ee=ie.data??pe?.snapshots.active_clarification??PR(),De=j.data??pe?.snapshots.active_approval??{state:`none`},Oe=Ee.state===`active`?Ee.round.id:void 0;(0,N.useEffect)(()=>{c!==null&&(Oe===void 0||c!==Oe)&&l(null)},[Oe,c]);let ke=Ee.state===`active`&&Ee.thread.owner.kind===`task_compile`,Ae=(0,N.useMemo)(()=>{let e=new Set;for(let t of _e.items)t.clarification_card!==void 0&&e.add(t.clarification_card.round_id);return Oe!==void 0&&e.add(Oe),[...e]},[Oe,_e.items]),je=_t({queries:Ae.map(t=>({queryKey:Q.clarificationRoundMessages(e,t),queryFn:()=>r.getClarificationRoundMessages(t,{anchor:`start`,limit:50}),enabled:O.isSuccess}))}),Me=yt({mutationFn:({roundId:e,body:t})=>r.sendClarificationRoundMessage(e,{body:t}),onSuccess:n=>{s(``),DR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Reply send failed`,message:CR(e)})}}),Ne=yt({mutationFn:e=>r.submitClarificationRound(e),onMutate:e=>(l(e),n.notify({tone:`loading`,title:`Submitting reply`})),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reply submitted`})},onError:(e,t,r)=>{l(e=>e===t?null:e),n.update(r,{tone:`error`,title:`Reply submit failed`,message:CR(e)})}}),Pe=yt({mutationFn:({approvalId:e,decisionId:t})=>r.decideApproval(e,{decision_id:t}),onMutate:()=>n.notify({tone:`loading`,title:`Sending decision`}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Decision sent`})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Decision failed`,message:CR(e)})}}),Fe=Object.fromEntries(Ae.map((e,t)=>[e,(je[t]?.data??OR()).items.map(e=>_r(e,{authorProfiles:me}))])),Ie=dB({account:pe?.session.account,presence:se.data?.presence,messages:[..._e.items,...je.flatMap(e=>e.data?.items??[])]}),Le=M.data??pe?.snapshots.execution_status??FR(he),Re=IR(Le),ze=LR(Le,`scratchpad_refresh`),Be=LR(Le,`scratchpad_refresh`,`foreground`),Ve=LR(Le,`task_compile`,`foreground`),He=LR(Le,`project_context_bootstrap`,`foreground`),Ue=u?.kind===`activity`?u.activityRef:void 0,We=u?.kind===`activity`?u.workflowRef:void 0;(0,N.useEffect)(()=>{if(u===null)return;if(we.state===`submitted`){d(null);return}if(we.state===`empty`){d(null);return}if(Le.status===`pending`){ke||d(null);return}let e=Le.last_conclusion,t=We!==void 0&&e?.workflow_ref===We,r=Ue!==void 0&&e?.activity_ref===Ue;if(!(!t&&!r)){if(d(null),e?.kind===`failed`){n.notify({tone:`error`,title:`Scratchpad run failed`,message:e.summary});return}if(e?.kind===`needs_human`){n.notify({tone:`warning`,title:`Scratchpad needs input`,message:e.summary});return}}},[Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.summary,Le.last_conclusion?.workflow_ref,Le.status,Le.summary,ke,n,we.state,u,Ue,We]);let Ge=Ue!==void 0&&Re.some(e=>e.activity_ref===Ue),Ke=Ge&&Re.some(e=>e.activity_ref===Ue&&e.workflow_kind===`scratchpad_refresh`)||u!==null&&Be,qe=Ve||He||Ke||Ge||ke,Je=ze,Ye=fe.isPending||qe||u!==null&&Le.status===`idle`,Xe=Le.status!==`idle`||Ye||f!==null;(0,N.useEffect)(()=>{if(!Xe)return;h(Date.now());let e=window.setInterval(()=>{h(Date.now())},1e3);return()=>{window.clearInterval(e)}},[Xe]);let Ze=Re.some(e=>e.activity_kind===`procedure`&&(e.lane??`foreground`)===`foreground`)&&!Je&&!Ye,Qe=mS(Le),$e={key:`scratchpad-submit`,label:ke?`Needs input`:Ke?`Compiling Worklist tasks`:He?`Preparing project context`:Ve?`Compiling Worklist tasks`:`Preparing Worklist`,title:ke?`Needs input`:`Preparing Scratchpad for Worklist.`,tone:ke?`pending`:`running`,target:ke?{kind:`clarification`}:{kind:`scratchpad`}},et=Ye&&Qe.length===0?[$e]:Qe,tt=uS(Le,{now:m}),nt=Re.find(e=>(e.lane??`foreground`)===`foreground`?e.workflow_kind===`project_context_bootstrap`&&He||e.workflow_kind===`task_compile`&&Ve||e.workflow_kind===`scratchpad_refresh`&&Ke?!0:Ue!==void 0&&e.activity_ref===Ue:!1),it=(Ye?dS({activeScratchpadRefreshFromSubmit:Ke,activeProjectContextBootstrap:He,activeTaskCompile:Ve,activeTaskCompileClarification:ke,now:m,...nt?.started_at===void 0?{}:{startedAt:nt.started_at},...Le.runtime===void 0?{}:{runtime:Le.runtime}}):null)??tt;(0,N.useEffect)(()=>{it!==null&&(C.current=it,p(null))},[it]),(0,N.useEffect)(()=>{if(!ze||it!==null)return;let e=C.current;if(e?.completionSource===void 0)return;let t=`hidden:${sB(e)}`;if(w.current===t)return;w.current=t;let n=fS(e,e.summary);p(n),C.current=null;let r=window.setTimeout(()=>{p(e=>e?.key===n.key?null:e)},aB);return()=>{window.clearTimeout(r)}},[it,ze]),(0,N.useEffect)(()=>{if(it!==null||Le.status!==`idle`)return;let e=Le.last_conclusion;if(e?.kind!==`completed`)return;let t=e.activity_ref??`${e.kind}:${e.task_id??`none`}:${e.occurred_at}`;if(w.current===t)return;let n=C.current;if(n===null)return;if(!pS(n,e)){C.current=null;return}w.current=t;let r=fS(n,e.summary);p(r);let i=window.setTimeout(()=>{p(e=>e?.key===r.key?null:e),C.current=null},aB);return()=>{window.clearTimeout(i)}},[it,Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.occurred_at,Le.last_conclusion?.summary,Le.last_conclusion?.task_id,Le.status]);let at=it??f,ot=f===null?null:{key:`completed`,label:`Completed`,tone:`done`,target:f.completionTarget??{kind:`scratchpad`}},st=ot===null?et:[ot,...et],ct=e=>{e.preventDefault();let t=i.trim();if(t!==``&&!ue.isPending){let e=S.current?.body===t?S.current:{body:t,commandId:Wt()};S.current=e,ue.mutate(e)}},lt=e=>{e.preventDefault();let t=o.trim();t!==``&&Oe!==void 0&&!Me.isPending&&Me.mutate({roundId:Oe,body:t})},ut=ne&&ge===void 0&&A.error!==null&&(b.kind!==`latest`||pe?.snapshots.main_chat===void 0),dt=pe===void 0&&O.error!==null||ut;return(0,N.useEffect)(()=>{y!==void 0&&_(y)},[y]),(0,P.jsx)(UC,{projectName:pe?.workspace.project.display_name??`Workspace`,projectDescription:pe?.workspace.project.description??``,members:Ie,messages:_e.items.map(e=>_r(e,{authorProfiles:me,referenceAssetUrl:(e,t,n)=>r.viewerAssetUrl({path:e,variant:t,v:n})})),scratchpad:Nr(we,_e.items),executionProgress:at,activeApproval:Sr(De),activeClarification:vr(Ee),clarificationMessagesByRoundId:Fe,statusShortcuts:st,unread:jR(Te),artifactSignal:MR(oe.data),draft:i,roundDraft:o,sendPending:ue.isPending,focusMessageId:g,messageHistoryIdentity:xe,initialMessagePosition:Se,hasOlderMessages:ve,hasNewerMessages:ye,loadingOlderMessages:A.isFetchingPreviousPage,loadingNewerMessages:A.isFetchingNextPage,historyConnectedToLatest:be,submittedRoundId:c,referenceUploadPending:de.isPending,scratchpadSyncPending:Je,scratchpadActionsDisabled:Ze,scratchpadSubmitPending:Ye,roundSendPending:Me.isPending,roundSubmitPending:Ne.isPending,approvalDecisionPending:Pe.isPending,projectNameSaving:ce.isPending,projectDescriptionSaving:le.isPending,loading:pe===void 0&&O.isLoading||Ce,unavailable:dt,onDraftChange:e=>{S.current?.body!==e.trim()&&(S.current=null),a(e)},onMessageFocused:()=>_(null),onInitialMessagePositioned:()=>{b.kind===`start`&&A.isSuccess&&k!==void 0&&fz(k,e)},onLoadOlderMessages:()=>{A.fetchPreviousPage()},onLoadNewerMessages:()=>{A.fetchNextPage()},onJumpToLatest:()=>D(),onUploadReferenceFile:e=>de.mutate(e),onOpenReferenceFile:t=>$(RR(e,t)),onRoundDraftChange:s,onSendMessage:ct,onSendRoundMessage:lt,onSubmitRound:()=>{Oe!==void 0&&Ne.mutate(Oe)},onDecideApproval:(e,t)=>Pe.mutate({approvalId:e,decisionId:t}),onSubmitScratchpad:()=>fe.mutate(we.updated_at),onUpdateProjectDisplayName:async e=>{await ce.mutateAsync(e)},onUpdateProjectDescription:async e=>{await le.mutateAsync(e)},onOpenProjectCenter:()=>$(`/projects`),onOpenWorklist:()=>$(BR(e)),onOpenWorklistTask:t=>$(BR(e,t)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t)})}function mB(e){return Qt(e)?Zt(e,`relay_session_invalid`)?`client_session`:`account_session`:null}function hB(e){return e===`client_session`?{title:`Workspace session expired`,message:`Open the project again from Project Center.`}:{title:`Sign in required`,message:`Sign in to Tutti before opening this workspace.`}}function gB(e){return e===`client_session`?`/projects`:`/`}function _B({relayProjectRef:e,children:t}){let n=rt(),r=pR(),i=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),a=(0,N.useRef)(void 0),o=(0,N.useRef)(null),s=F({queryKey:Q.bootstrap(e),queryFn:()=>i.getBootstrap(),staleTime:yR}),c=mB(s.error),l=c===null&&s.data?.workspace.capabilities.sse===!0;return a.current===void 0&&s.data!==void 0&&(a.current=s.data.event_cursor),(0,N.useEffect)(()=>{if(c===null)return;let t=`${e}:${c}`;o.current!==t&&(o.current=t,r.notify({tone:`warning`,...hB(c)}),$(gB(c),{replace:!0}))},[c,r,e]),(0,N.useEffect)(()=>{if(!l)return;let t=i.connectEvents({...a.current===void 0?{}:{after:a.current},onReady:t=>{t.payload.replay.status===`missed`&&n.invalidateQueries({queryKey:Q.hostRoot(e)})},onInvalidate:t=>{DR(n,e,t)},onError:()=>void 0});return()=>t.close()},[i,n,e,l]),c===null?t:null}function vB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:yR}).data?.session.account.account_ref,r=n===void 0?null:`${n}:${e}`,[i,a]=(0,N.useState)({identity:null,pending:!1}),[o,s]=(0,N.useState)(!1),c=Id();(0,N.useEffect)(()=>{n===void 0||r===null||i.identity===r||a({identity:r,pending:lz(n,e).tour_pending})},[n,r,i.identity,e]);let l=t=>{pz(t,e),a({identity:r,pending:!1})};return(0,P.jsxs)(P.Fragment,{children:[c&&r!==null&&i.identity===r&&i.pending&&n!==void 0&&typeof document<`u`?(0,mc.createPortal)((0,P.jsx)(Ud,{onOpen:()=>{l(n),s(!0)},onDismiss:()=>l(n)}),document.body):null,(0,P.jsx)(Wd,{assets:kS,open:o,onOpenChange:s})]})}var yB=2e4,bB=3e4;function xB(e,t,n={}){let r=n.runActive??!1;if(e===void 0)return r?{status:`updating`}:{status:`loading`};if(e.status===`not_declared`)return r?{status:`updating`}:{status:`not_declared`};if(e.status===`invalid`)return r?{status:`updating`}:{status:`invalid`,message:e.error.message};let i={status:`declared`,title:e.artifact.title,artifactKind:e.artifact.kind,network:e.artifact.network,previewStatus:e.preview.status,...e.preview.error_message===void 0?{}:{errorMessage:e.preview.error_message}};return e.preview.status===`ready`?t.previewUrl===void 0?r?{status:`updating`}:t.errorMessage===void 0?{...i,previewStatus:t.pending?`starting`:`failed`,...t.pending?{}:{errorMessage:`Preview session is unavailable`}}:{...i,previewStatus:`failed`,errorMessage:t.errorMessage}:{...i,previewUrl:t.previewUrl}:r?{status:`updating`}:i}function SB(e){if(!(e===void 0||e.disposition.kind===`issued`))return e.disposition.kind===`invalid_manifest`?e.disposition.message:e.disposition.kind===`preview_not_ready`?e.disposition.message??`Preview is not ready`:e.disposition.kind===`not_declared`?`Artifact is no longer declared`:`Preview session expired before it could be opened`}function CB(e){return e===void 0?!1:e.disposition.kind!==`issued`||e.result===void 0?e.disposition.kind===`preview_not_ready`||e.disposition.kind===`interrupted`?1e3:!1:Math.max(1e3,Date.parse(e.result.expires_at)-Date.now()-bB)}function wB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=(0,N.useMemo)(()=>zn(vR),[]),a=(0,N.useRef)(null),o=(0,N.useRef)(!1),s=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),c=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:s.isSuccess,staleTime:yR}),l=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:s.isSuccess,staleTime:yR}),u=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:s.isSuccess,staleTime:yR}),d=yt({mutationFn:(e={})=>r.startArtifactPreview(),onSuccess:(r,i)=>{DR(t,e,r.invalidates),i.noticeId!==void 0&&n.update(i.noticeId,{tone:`success`,title:`Preview restarted`})},onError:(e,t)=>{a.current=null,t.noticeId!==void 0&&n.update(t.noticeId,{tone:`error`,title:`Preview restart failed`,message:CR(e)})}}),f=yt({mutationFn:()=>r.heartbeatArtifactPreview(),onSuccess:n=>{n.result?.artifact===void 0?DR(t,e,n.invalidates):t.setQueryData(Q.artifacts(e),{artifact:n.result.artifact})}}),p=yt({mutationFn:()=>r.stopArtifactPreview(),onMutate:()=>n.notify({tone:`loading`,title:`Stopping preview`}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Preview stopped`})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Preview stop failed`,message:CR(e)})}}),m=s.data,h=m?.generated_at??new Date(0).toISOString(),g=u.data??m?.snapshots.read_state,_=l.data??m?.snapshots.execution_status??FR(h),v=_.active_activity?.activity_kind===`run`||_.active_activities?.some(e=>e.activity_kind===`run`)===!0;(0,N.useEffect)(()=>{o.current&&!v&&(a.current=null),o.current=v},[v]);let y=c.data?.artifact,b=y?.status===`declared`&&y.preview.status===`ready`&&y.preview.url!==void 0?y.preview.url:null,x=F({queryKey:Q.artifactPreviewSession(e,b??`not-ready`),queryFn:()=>i.issueArtifactPreviewSession(e),enabled:b!==null,staleTime:1/0,retry:1,refetchInterval:e=>CB(e.state.data)}),S=x.data,C=S?.disposition.kind===`issued`?S.result?.bootstrap_url:void 0,w=x.error===null?SB(S):CR(x.error),T=y?.status===`declared`&&y.artifact.kind===`server`?y.manifest_blob_oid:null,E=T!==null,ee=y?.status===`declared`&&y.artifact.kind===`server`&&y.preview.status===`stopped`&&a.current!==y.manifest_blob_oid&&!v&&!d.isPending;(0,N.useEffect)(()=>{ee&&(a.current=y?.status===`declared`?y.manifest_blob_oid:null,d.mutate({}))},[y,ee,d]),(0,N.useEffect)(()=>{if(T===null){a.current=null;return}a.current!==null&&a.current!==T&&(a.current=null)},[T]),(0,N.useEffect)(()=>{if(y?.status!==`declared`||y.artifact.kind!==`server`||y.preview.status!==`starting`&&y.preview.status!==`ready`)return;f.mutate();let e=window.setInterval(()=>{f.isPending||f.mutate()},yB);return()=>{window.clearInterval(e)}},[y,f]);let D=c.data!==void 0,O=!D&&(s.error!==null||c.error!==null);return(0,P.jsx)(WC,{statusShortcuts:mS(_),unread:jR(g),artifactSignal:MR(c.data),state:xB(c.data?.artifact,{...C===void 0?{}:{previewUrl:C},pending:b!==null&&C===void 0&&w===void 0,...w===void 0?{}:{errorMessage:w}},{runActive:v}),loading:!D&&(s.isLoading||c.isLoading),unavailable:O,restartPending:d.isPending,stopPending:p.isPending,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),...E?{onRestart:()=>{let e=n.notify({tone:`loading`,title:`Restarting preview`});d.mutate({noticeId:e})},onStop:()=>p.mutate()}:{},onActivateStatusShortcut:t=>KR(e,t)})}function TB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=new URL(bR(),window.location.origin).searchParams.get(`path`)??void 0,[a,o]=(0,N.useState)(i),[s,c]=(0,N.useState)(`time`),l=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),u=F({queryKey:Q.referenceFiles(e),queryFn:()=>r.getReferenceFiles({limit:200}),enabled:l.isSuccess,staleTime:yR}),d=F({queryKey:Q.messagesWindow(e,200),queryFn:()=>r.getMessages({limit:200}),enabled:l.isSuccess,staleTime:yR}),f=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:l.isSuccess,staleTime:yR}),p=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:l.isSuccess,staleTime:yR}),m=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:l.isSuccess,staleTime:yR}),h=u.data?.items??[],g=(0,N.useMemo)(()=>{let e=new Map;for(let t of d.data?.items??[]){let n=t.refs?.reference_file;if(n===void 0)continue;let r=e.get(n.path);(r===void 0||t.created_at>r)&&e.set(n.path,t.created_at)}return e},[d.data?.items]),_=(0,N.useMemo)(()=>{let e=(e,t)=>e.name.localeCompare(t.name),t=(t,n)=>{let r=g.get(t.path)??``,i=g.get(n.path)??``;return r===i?e(t,n):i.localeCompare(r)},n=(e,n)=>{let r=e.extension??e.media_type??`file`,i=n.extension??n.media_type??`file`;return r===i?t(e,n):r.localeCompare(i)},r=[...h.filter(e=>e.category===`image`&&e.source===`human_upload`)].sort(t),i=[...h.filter(e=>!(e.category===`image`&&e.source===`human_upload`))].sort(s===`time`?t:n);return[...r,...i]},[s,h,g]);(0,N.useEffect)(()=>{if(_.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&_.some(e=>e.path===i)){a!==i&&o(i);return}(a===void 0||!_.some(e=>e.path===a))&&o(_[0]?.path)},[_,i,a]);let v=h.find(e=>e.path===a),y=v?.category===`image`,b=v?.text_read.can_read===!0,x=F({queryKey:a===void 0?Q.viewerFile(e,`none`):Q.viewerFile(e,a),queryFn:()=>r.getViewerFile({path:a,max_bytes:204800}),enabled:l.isSuccess&&a!==void 0&&b&&!y,staleTime:yR}),S=yt({mutationFn:async t=>{let n=await $R({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),r.result?.file.path!==void 0&&(o(r.result.file.path),$(RR(e,r.result.file.path))),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:CR(e)||t.name})}}),C=l.data,w=C?.generated_at??new Date(0).toISOString(),T=p.data??C?.snapshots.read_state;NR({enabled:l.isSuccess,hostClient:r,relayProjectRef:e,readState:T,scope:`references`});let E=f.data??C?.snapshots.execution_status??FR(w),ee=_.map(e=>{let t=OB(e,u.data?.directory.tutti_path);return{path:e.path,name:e.name,meta:DB(e),source:e.source,...t===void 0?{}:{generatedGroup:t},selected:e.path===a,canPreview:e.text_read.can_read,category:e.category,...e.category===`image`&&e.source===`human_upload`?{...e.blob_oid===void 0?{}:{thumbnailUrl:r.viewerAssetUrl({path:e.path,variant:`thumbnail`,v:e.blob_oid})}}:{},...e.extension===void 0?{}:{extension:e.extension}}}),D=x.data?.content,O=(()=>{if(v===void 0)return{title:h.length===0?`No reference files`:`No file selected`,unavailableReason:h.length===0?`No reference files`:`Select a reference file`};if(D?.kind===`text`)return{title:v.name,meta:JR(v.size_bytes),...EB(v),content:D.text};if(y&&a!==void 0)return v.blob_oid===void 0?{title:v.name,meta:JR(v.size_bytes),...EB(v),unavailableReason:`Image version unavailable`}:{title:v.name,meta:JR(v.size_bytes),...EB(v),imageUrl:r.viewerAssetUrl({path:a,variant:`preview`,v:v.blob_oid})};let e=b&&x.isLoading?`Loading`:XR(D)??(b?void 0:YR(v.text_read.blocked_reason));return e===void 0?{title:v.name,meta:JR(v.size_bytes),...EB(v)}:{title:v.name,meta:JR(v.size_bytes),...EB(v),unavailableReason:e}})(),k=u.data!==void 0,te=!k&&(l.error!==null||u.error!==null);return(0,P.jsx)(GC,{statusShortcuts:mS(E),unread:jR(T),artifactSignal:MR(m.data),files:ee,detail:O,uploadPending:S.isPending,fileSortMode:s,loading:!k&&(l.isLoading||u.isLoading),unavailable:te,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t),onSelectFile:t=>{o(t),$(RR(e,t))},onUploadFile:e=>S.mutate(e),onFileSortModeChange:c})}function EB(e){let t=e.summary;return t===void 0||t.status===`missing`?{summaryStatus:`Summary not available yet`}:t.status===`stale`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:`Summary may be out of date`}:t.status===`unavailable`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:t.unavailable_reason===void 0?`Summary unavailable`:`Summary unavailable: ${t.unavailable_reason}`}:t.text===void 0?{summaryStatus:`Summary unavailable`}:{summary:t.text}}function DB(e){let t=e.source===`tutti_output`?`Tutti`:`Uploaded`;if(e.category===`image`)return[t,e.media_type??`Image`,JR(e.size_bytes)].join(` · `);let n=[t,JR(e.size_bytes)];return e.text_read.can_read||n.push(YR(e.text_read.blocked_reason)),n.join(` · `)}function OB(e,t){if(e.source!==`tutti_output`||t===void 0)return;let n=`${t}/`;if(!e.path.startsWith(n))return;let[r,i]=e.path.slice(n.length).split(`/`);if(!(r===void 0||r.length===0||i===void 0))return r}function kB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap()}),a=F({queryKey:Q.hostWorkspace(e),queryFn:()=>r.getWorkspace(),enabled:i.isSuccess}),o=F({queryKey:Q.hostSession(e),queryFn:()=>r.getSession(),enabled:i.isSuccess}),s=F({queryKey:Q.providerConfig(e),queryFn:()=>r.getProviderConfig(),enabled:i.isSuccess}),c=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:i.isSuccess}),l=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:i.isSuccess}),u=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:i.isSuccess}),d=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${CR(e)}`})}}),f=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:CR(e)})}}),p=i.data,m=p?.generated_at??new Date(0).toISOString(),h=l.data??p?.snapshots.read_state,g=a.data??p?.workspace,_=o.data??p?.session,v=s.data??p?.provider_config,y=c.data??p?.snapshots.execution_status??FR(m),b=g===void 0||_===void 0||v===void 0?void 0:Jr(g,_,v),x=b===void 0&&(i.error!==null||a.error!==null||o.error!==null||s.error!==null),S=g?.relay.join_url,C=S===void 0||g===void 0||_===void 0?void 0:xz({inviterName:_.account.display_name,projectName:g.project.display_name,joinUrl:S});return(0,P.jsx)(nw,{...b===void 0?{}:{settings:b},statusShortcuts:mS(y),unread:jR(h),artifactSignal:MR(u.data),loading:b===void 0&&(i.isLoading||a.isLoading||o.isLoading||s.isLoading),unavailable:x,projectNameSaving:d.isPending,projectDescriptionSaving:f.isPending,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onActivateStatusShortcut:t=>KR(e,t),...C===void 0?{}:{onCopyJoinUrl:()=>{navigator.clipboard.writeText(C).then(()=>{n.notify({tone:`success`,title:`Invitation copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the invite link.`})})}},onUpdateProjectDisplayName:async e=>{await d.mutateAsync(e)},onUpdateProjectDescription:async e=>{await f.mutateAsync(e)}})}function AB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=new URL(bR(),window.location.origin).searchParams.get(`skill`)??void 0,[a,o]=(0,N.useState)(i),s=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),c=F({queryKey:Q.skills(e),queryFn:()=>r.getSkills(),enabled:s.isSuccess,staleTime:yR}),l=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:s.isSuccess,staleTime:yR}),u=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:s.isSuccess,staleTime:yR}),d=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:s.isSuccess,staleTime:yR}),f=c.data?.items??[];(0,N.useEffect)(()=>{if(f.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&f.some(e=>e.name===i)){a!==i&&o(i);return}(a===void 0||!f.some(e=>e.name===a))&&o(f[0]?.name)},[i,a,f]);let p=F({queryKey:a===void 0?Q.skillDetail(e,`none`):Q.skillDetail(e,a),queryFn:()=>r.getSkill(a),enabled:s.isSuccess&&a!==void 0,staleTime:yR}),m=yt({mutationFn:async t=>{let n=await $R({relayProjectRef:e,purpose:`skill_zip`,file:t});return r.importSkillZip(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading skill`,message:e.name}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates);let s=r.result?.skill.name??(r.disposition.kind===`created`||r.disposition.kind===`replaced`?r.disposition.skill_name:void 0);s!==void 0&&(o(s),$(WR(e,s))),n.update(a,{tone:`success`,title:`Skill installed`,message:s??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill upload failed`,message:CR(e)})}}),h=yt({mutationFn:e=>r.deleteSkill({skill_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Deleting skill`,message:e}),onSuccess:(r,i,s)=>{DR(t,e,r.invalidates);let c=r.disposition.kind===`deleted`||r.disposition.kind===`not_found`?r.disposition.skill_name:a,l=f.find(e=>e.name!==c);o(l?.name),$(l===void 0?WR(e):WR(e,l.name)),n.update(s,{tone:`success`,title:`Skill deleted`,message:c??i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill delete failed`,message:`${t}: ${CR(e)}`})}}),g=s.data,_=g?.generated_at??new Date(0).toISOString(),v=u.data??g?.snapshots.read_state;NR({enabled:s.isSuccess,hostClient:r,relayProjectRef:e,readState:v,scope:`skills`});let y=l.data??g?.snapshots.execution_status??FR(_),b=f.map(e=>({name:e.name,description:e.description,...e.short_description===void 0?{}:{shortDescription:e.short_description},selected:e.name===a,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`}})),x=f.find(e=>e.name===a),S=(()=>{let e=p.data?.skill;return e===void 0?a===void 0?{title:f.length===0?`No skills`:`No skill selected`,unavailableReason:f.length===0?`No user skills`:`Select a skill`}:{title:x?.name??a,...x?.description===void 0?{}:{description:x.description},unavailableReason:p.isLoading?`Loading`:`Skill unavailable`}:{title:e.name,description:e.description,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`},skillMd:e.skill_md}})(),C=c.data!==void 0,w=!C&&(s.error!==null||c.error!==null);return(0,P.jsx)(iw,{statusShortcuts:mS(y),unread:jR(v),artifactSignal:MR(d.data),skills:b,detail:S,uploadPending:m.isPending,deletePending:h.isPending,loading:!C&&(s.isLoading||c.isLoading),unavailable:w,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t),onSelectSkill:t=>{o(t),$(WR(e,t))},onUploadSkill:e=>m.mutate(e),onDeleteSkill:e=>h.mutate(e)})}function jB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:yR}),r=F({queryKey:Q.projectTimeline(e),queryFn:()=>t.getProjectTimeline(),enabled:n.isSuccess,staleTime:yR}),i=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:n.isSuccess,staleTime:yR}),a=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:n.isSuccess,staleTime:yR}),o=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:n.isSuccess,staleTime:yR}),s=n.data,c=s?.generated_at??new Date(0).toISOString(),l=a.data??s?.snapshots.read_state,u=i.data??s?.snapshots.execution_status??FR(c),d=r.data===void 0&&(n.error!==null||r.error!==null);return(0,P.jsx)(aw,{...r.data===void 0?{}:{timeline:jx(r.data,{onOpenWorklistTask:t=>$(BR(e,t)),onOpenChatMessage:t=>$(VR(e,t)),onOpenReferenceFile:t=>$(RR(e,t))})},statusShortcuts:mS(u),unread:jR(l),artifactSignal:MR(o.data),loading:r.data===void 0&&(n.isLoading||r.isLoading),unavailable:d,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t)})}function MB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),n=new URL(bR(),window.location.origin).searchParams.get(`task`)??void 0,[r,i]=(0,N.useState)(void 0),a=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap()}),o=F({queryKey:Q.worklist(e),queryFn:()=>t.getWorklist(),enabled:a.isSuccess}),s=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:a.isSuccess}),c=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:a.isSuccess}),l=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:a.isSuccess}),u=a.data,d=u?.generated_at??new Date(0).toISOString(),f=o.data??u?.snapshots.worklist??kR(),p=c.data??u?.snapshots.read_state;NR({enabled:a.isSuccess,hostClient:t,relayProjectRef:e,readState:p,scope:`worklist`});let m=(0,N.useMemo)(()=>Fr(f),[f]),h=n!==void 0&&m.some(e=>e.id===n),g=n!==void 0&&!h?n:void 0;(0,N.useEffect)(()=>{if(n!==void 0){i(h?e=>e===n?e:n:void 0);return}if(m.length===0){i(void 0);return}(r===void 0||!m.some(e=>e.id===r))&&i(qR(f,void 0))},[h,n,r,m,f]);let _=F({queryKey:r===void 0?Q.taskDetail(e,`none`):Q.taskDetail(e,r),queryFn:()=>t.getTaskDetail(r),enabled:a.isSuccess&&r!==void 0}),v=F({queryKey:r===void 0?Q.taskRunResults(e,`none`):Q.taskRunResults(e,r),queryFn:()=>t.getTaskRunResults(r,{limit:50}),enabled:a.isSuccess&&r!==void 0}),y=s.data??u?.snapshots.execution_status??FR(d),b=Pr(f,r),x=Gr(_.data,v.data),S=o.data!==void 0||u?.snapshots.worklist!==void 0,C=!S&&(a.error!==null||o.error!==null);return(0,P.jsx)(ow,{statusShortcuts:mS(y),unread:jR(p),artifactSignal:MR(l.data),modules:b.modules,taskCount:b.taskCount,...x===void 0?{}:{detail:x},...g===void 0?{}:{missingTaskId:g},loading:!S&&(a.isLoading||o.isLoading),unavailable:C,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t),onSelectTask:t=>{i(t),$(BR(e,t))}})}var NB=`is-scrollbar-active`,PB=1e3;function FB(e,t){let n=e.target;return n instanceof Element?n:t.scrollingElement??t.documentElement}function IB(e){let t=new Map,n=e=>{let n=t.get(e);n!==void 0&&(window.clearTimeout(n),t.delete(e)),e.classList.remove(NB)},r=e=>{let r=t.get(e);r!==void 0&&window.clearTimeout(r),e.classList.add(NB);let i=window.setTimeout(()=>n(e),PB);t.set(e,i)},i=t=>{r(FB(t,e))};return e.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>{e.removeEventListener(`scroll`,i,!0);for(let[e,n]of t)window.clearTimeout(n),e.classList.remove(NB);t.clear()}}var LB=`--tutti-viewport-height`,RB=`--tutti-viewport-offset-top`;function zB(e,t=window){let n=e.documentElement,r=t.visualViewport,i=()=>{let e=r?.height??t.innerHeight,i=r?.offsetTop??0;n.style.setProperty(LB,`${Math.max(0,e)}px`),n.style.setProperty(RB,`${Math.max(0,i)}px`)};return i(),t.addEventListener(`resize`,i),t.addEventListener(`orientationchange`,i),r?.addEventListener(`resize`,i),r?.addEventListener(`scroll`,i),()=>{t.removeEventListener(`resize`,i),t.removeEventListener(`orientationchange`,i),r?.removeEventListener(`resize`,i),r?.removeEventListener(`scroll`,i),n.style.removeProperty(LB),n.style.removeProperty(RB)}}var BB=new $e({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function VB(){let e=SR();if(e.kind===`local_console`)return(0,P.jsx)(Dz,{});if(e.kind===`home`)return(0,P.jsx)(gz,{});if(e.kind===`join`)return(0,P.jsx)(mz,{joinToken:e.joinToken});if(e.kind===`setup`)return(0,P.jsx)(Qz,{});if(e.kind===`project_open`)return(0,P.jsx)(Lz,{requestedOpenProjectRef:e.relayProjectRef});if(e.kind===`workspace`||e.kind===`worklist`||e.kind===`references`||e.kind===`artifacts`||e.kind===`skills`||e.kind===`timeline`||e.kind===`settings`){let t=e.kind===`workspace`?(0,P.jsx)(pB,{relayProjectRef:e.relayProjectRef}):e.kind===`worklist`?(0,P.jsx)(MB,{relayProjectRef:e.relayProjectRef}):e.kind===`references`?(0,P.jsx)(TB,{relayProjectRef:e.relayProjectRef}):e.kind===`artifacts`?(0,P.jsx)(wB,{relayProjectRef:e.relayProjectRef}):e.kind===`skills`?(0,P.jsx)(AB,{relayProjectRef:e.relayProjectRef}):e.kind===`timeline`?(0,P.jsx)(jB,{relayProjectRef:e.relayProjectRef}):(0,P.jsx)(kB,{relayProjectRef:e.relayProjectRef});return(0,P.jsxs)(_B,{relayProjectRef:e.relayProjectRef,children:[t,(0,P.jsx)(vB,{relayProjectRef:e.relayProjectRef})]},e.relayProjectRef)}return(0,P.jsx)(Lz,{})}function HB(){return(0,N.useEffect)(()=>{let e=IB(document),t=zB(document);return()=>{e(),t()}},[]),(0,P.jsx)(it,{client:BB,children:(0,P.jsx)(fR,{children:(0,P.jsx)(VB,{})})})}function UB(e){let t=document.querySelector(`link[rel="icon"]`),n=t??document.createElement(`link`);n.rel=`icon`,n.type=`image/png`,n.sizes=`1204x1204`,n.href=e,t===null&&document.head.append(n)}UB(ES),(0,xt.createRoot)(document.getElementById(`root`)).render((0,P.jsx)(N.StrictMode,{children:(0,P.jsx)(HB,{})}));export{L as C,ci as S,Mi as _,bd as a,di as b,H as c,Zi as d,Xi as f,Fi as g,Li as h,Dd as i,wd as l,Bi as m,fd as n,Sd as o,qi as p,kd as r,Od as s,Wy as t,ra as u,ji as v,tt as w,li as x,Si as y};
|
|
70
|
+
`){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}let r=py(e).find(r=>n.key===`Backspace`?t.start>r.start&&t.start<=r.end||t.start===r.end+1&&e[r.end]===` `:t.start>=r.start&&t.start<r.end);if(r!==void 0){n.preventDefault(),y.current=null,b.current=null;let i=n.key===`Backspace`&&t.start===r.end+1&&e[r.end]===` `?r.end+1:r.end;de(`${e.slice(0,r.start)}${e.slice(i)}`,r.start);return}if(n.key===`Backspace`&&t.start>0){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start-1)}${e.slice(t.start)}`,t.start-1);return}if(n.key===`Delete`&&t.start<e.length){n.preventDefault(),y.current=null,b.current=null,de(`${e.slice(0,t.start)}${e.slice(t.start+1)}`,t.start);return}}if(t&&n.key===`Enter`){if(n.preventDefault(),r&&!n.shiftKey&&!n.metaKey){i?.closest(`form`)?.requestSubmit();return}pe();return}if(!t&&n.key===`Enter`){n.preventDefault(),i?.closest(`form`)?.requestSubmit();return}f?.(n)},ye=t=>{if(v.current||vy(t))return;let n=h.current;if(n===null)return;let r=M(n),i=se(n).end,a=me(r,i),o=a?.nextValue??r,s=a?.nextCaret??i,c=yy(t);if(c.inputType===`insertText`&&by(c.data)){let t=s-c.data.length,n=`${o.slice(0,t)}${o.slice(s)}`;y.current=t>=0&&n===e?{data:c.data,start:t,end:s,valueBefore:n,createdAt:Date.now()}:null}else y.current=null;let l=he(o,s,void 0,!0);de(l.nextValue,l.nextCaret)},be=e=>{if(v.current||vy(e))return;let t=yy(e);if(t.inputType===`insertParagraph`||t.inputType===`insertLineBreak`){pe()&&e.preventDefault();return}y.current=null},xe=t=>{t.preventDefault();let n=t.clipboardData.getData(`text/plain`),r=h.current;if(r===null)return;let i=se(r);de(`${e.slice(0,i.start)}${n}${e.slice(i.end)}`,i.start+n.length)},Se=()=>{let e=h.current;e===null||!ae(e)||E(se(e).end)},Ce=R(`mention-input-editor`,t?`is-multiline`:`is-singleline`,c),we=ne?(0,P.jsx)(`div`,{className:`mention-menu`,id:S,role:`listbox`,"aria-label":`Mention people`,children:te.map((e,t)=>(0,P.jsx)(`button`,{className:R(`mention-option`,t===A?`is-selected`:void 0),type:`button`,role:`option`,id:`${S}-option-${t}`,"aria-selected":t===A,onMouseEnter:()=>D(t),onMouseDown:t=>{t.preventDefault(),ue(e)},children:(0,P.jsxs)(`span`,{className:`mention-option-text`,children:[`@`,e.handle]})},e.id))}):null,Te=a?.current;return(0,P.jsxs)(`span`,{className:R(`mention-input`,t?`is-multiline`:void 0),children:[(0,P.jsx)(`div`,{className:Ce,contentEditable:!ie,role:`textbox`,"aria-label":j,"aria-multiline":t,"aria-disabled":ie,"aria-expanded":ne,...ne?{"aria-controls":S}:{},...re===void 0?{}:{"aria-activedescendant":re},"data-placeholder":m.placeholder,"data-max-rows":n,onBlur:e=>{w(!1),l?.(e)},onClick:e=>{Se(),u?.(e)},onFocus:e=>{w(!0),Se(),d?.(e)},onCompositionStart:()=>{v.current=!0;let e=h.current,t=y.current;if(y.current=null,e!==null&&t!==null&&Date.now()-t.createdAt<500&&M(e).slice(t.start,t.end)===t.data){b.current=t,_.current=null,E(t.start),s(t.valueBefore);let n=fy(t.valueBefore,null);_y(e,n),x.current=hy(n),ce(e,t.start)}else b.current=null},onCompositionEnd:e=>{v.current=!1;let t=yy(e);_e(t.data===null?{}:{compositionData:t.data})},onBeforeInput:be,onInput:ye,onKeyDown:ve,onKeyUp:e=>{!v.current&&!vy(e)&&Se(),p?.(e)},onPaste:xe,ref:h,suppressContentEditableWarning:!0}),Te==null?we:(0,mc.createPortal)(we,Te)]})}function wy(e){return(0,P.jsx)(Fi,{...e})}function Ty({avatar:e,author:t,time:n,children:r,system:i=!1,className:a,...o}){return(0,P.jsxs)(`article`,{className:R(`message`,i?`is-system`:void 0,a),...o,children:[(0,P.jsxs)(`div`,{className:`message-byline`,children:[e,(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:t}),n===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:n})]})]}),(0,P.jsx)(`div`,{className:`message-content`,children:(0,P.jsx)(`div`,{className:`message-card`,children:r})})]})}function Ey({children:e,className:t,...n}){return(0,P.jsx)(`div`,{className:R(`message-markdown`,t),...n,children:(0,P.jsx)(Zv,{components:Ly,children:e})})}function Dy({children:e}){return(0,P.jsx)(`p`,{children:xy(e)})}function Oy({children:e}){return(0,P.jsx)(`li`,{children:xy(e)})}function ky({children:e}){return(0,P.jsx)(`strong`,{children:xy(e)})}function Ay({children:e}){return(0,P.jsx)(`em`,{children:xy(e)})}function jy({children:e}){return(0,P.jsx)(`h1`,{children:xy(e)})}function My({children:e}){return(0,P.jsx)(`h2`,{children:xy(e)})}function Ny({children:e}){return(0,P.jsx)(`h3`,{children:xy(e)})}function Py({children:e}){return(0,P.jsx)(`h4`,{children:xy(e)})}function Fy({children:e}){return(0,P.jsx)(`h5`,{children:xy(e)})}function Iy({children:e}){return(0,P.jsx)(`h6`,{children:xy(e)})}var Ly={p:Dy,li:Oy,strong:ky,em:Ay,h1:jy,h2:My,h3:Ny,h4:Py,h5:Fy,h6:Iy};function Ry({name:e,category:t,imageUrl:n,className:r,"aria-label":i,...a}){let o=t===`image`&&n!==void 0;return(0,P.jsx)(`button`,{type:`button`,"aria-label":i??`Open ${t===`image`?`image`:`file`} ${e}`,className:R(`reference-message-card`,t===`image`?`is-image`:`is-file`,r),...a,children:o?(0,P.jsx)(`img`,{className:`reference-message-image`,src:n,alt:e,loading:`lazy`,decoding:`async`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{className:`reference-message-icon`,"aria-hidden":`true`,children:t===`image`?(0,P.jsx)(Ei,{}):(0,P.jsx)(Ci,{})}),(0,P.jsx)(`span`,{className:`reference-message-main`,children:(0,P.jsx)(`strong`,{children:e})})]})})}function zy({children:e,composer:t,empty:n,title:r=`Chat`,subtitle:i,actions:a,streamRef:o,streamOverlay:s,onStreamScroll:c,dropUploadPending:l=!1,onDropFiles:u,className:d,...f}){return(0,P.jsxs)(iy,{className:R(`panel chat-panel chat-primary`,d),"aria-label":`Group chat`,dropLabel:`Drop references to upload`,pending:l,onFilesUpload:u,...f,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(wy,{"aria-hidden":`true`})}),(0,P.jsxs)(`div`,{className:`panel-title-copy`,children:[(0,P.jsx)(`h3`,{children:r}),i===void 0?null:(0,P.jsx)(`div`,{className:`panel-subtitle`,children:i})]})]}),a===void 0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:a})]}),(0,P.jsxs)(`div`,{className:`chat-stream-frame`,children:[(0,P.jsx)(`div`,{className:`chat-stream`,ref:o,onScroll:c,children:e??n}),s===void 0?null:(0,P.jsx)(`div`,{className:`chat-stream-overlay`,children:s})]}),t]})}function By({value:e,placeholder:t,ariaLabel:n,maxLength:r,saving:i=!1,disabled:a=!1,allowEmpty:o=!1,onUpdate:s,className:c,...l}){let u=(0,N.useRef)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(e),[h,g]=(0,N.useState)(!1),_=i||h,v=!a&&!_&&s!==void 0,y=e.trim(),b=y.length===0;(0,N.useEffect)(()=>{d||m(e)},[d,e]),(0,N.useEffect)(()=>{d&&(u.current?.focus(),u.current?.select())},[d]);let x=()=>{m(e),f(!1)},S=()=>{let e=p.trim();if(!o&&e.length===0){x();return}if(e===y){f(!1);return}s===void 0||_||(g(!0),Promise.resolve(s(e)).then(()=>{f(!1)}).catch(()=>void 0).finally(()=>{g(!1)}))},C=e=>{if(e.key===`Enter`){e.preventDefault(),S();return}e.key===`Escape`&&(e.preventDefault(),x())};return(0,P.jsx)(`span`,{className:R(`inline-editable-text`,b?`is-empty`:void 0,d?`is-editing`:void 0,v?void 0:`is-disabled`,c),...l,children:d?(0,P.jsx)(`input`,{ref:u,className:`inline-editable-text-input`,"aria-label":n,value:p,maxLength:r,disabled:_,onBlur:S,onChange:e=>m(e.currentTarget.value),onKeyDown:C}):(0,P.jsx)(`button`,{className:`inline-editable-text-button`,type:`button`,"aria-label":n,disabled:!v,onClick:()=>f(!0),children:b?t:y})})}var Vy={bare:``,quiet:`quiet-button`,pill:`pill-action`,action:`action-button`};function Hy({variant:e=`pill`,label:t,pendingLabel:n=t,pending:r=!1,disabled:i=!1,iconOnly:a=!1,accept:o,icon:s,onFileUpload:c,className:l,...u}){let d=i||r||c===void 0,f=r?n:t,p=e=>{let t=e.currentTarget.files?.[0];e.currentTarget.value=``,t!==void 0&&c?.(t)};return(0,P.jsxs)(`label`,{...u,className:R(Vy[e],d?`is-disabled`:void 0,l),"aria-disabled":d,"aria-busy":r,"aria-label":u[`aria-label`]??f,title:u.title??f,children:[(0,P.jsx)(`input`,{type:`file`,accept:o,disabled:d,onChange:p}),s??(r?(0,P.jsx)(Mi,{className:`is-spinning`,"aria-hidden":`true`}):(0,P.jsx)(_i,{"aria-hidden":`true`})),a?null:(0,P.jsx)(`span`,{children:f})]})}function Uy({value:e,pending:t=!1,uploadPending:n=!1,placeholder:r=`Write a message`,mentionOptions:i,onValueChange:a,onComposerSubmit:o,onFileUpload:s,className:c,...l}){let[u,d]=(0,N.useState)(0),f=(0,N.useRef)(null);return(0,P.jsx)(`form`,{className:R(`composer`,c),"aria-label":`Message composer`,onSubmit:o,...l,children:(0,P.jsxs)(`div`,{className:`composer-input-shell`,ref:f,children:[(0,P.jsx)(Cy,{"aria-label":`Message`,placeholder:r,value:e,multiline:!0,maxRows:8,submitOnEnter:!0,mentionRequestKey:u,menuPortalTargetRef:f,...i===void 0?{}:{mentionOptions:i},onValueChange:a}),(0,P.jsxs)(`div`,{className:`composer-tools`,"aria-label":`Message tools`,children:[(0,P.jsx)(`button`,{className:`composer-tool-button composer-mention-button`,type:`button`,"aria-label":`Mention people`,title:`Mention people`,onClick:()=>d(e=>e+1),children:(0,P.jsx)(oi,{"aria-hidden":`true`})}),(0,P.jsx)(Hy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload image`,pendingLabel:`Uploading image`,pending:n,accept:`image/*`,icon:(0,P.jsx)(Ei,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(Hy,{variant:`bare`,className:`composer-tool-button composer-upload-button`,label:`Upload file`,pendingLabel:`Uploading file`,pending:n,icon:(0,P.jsx)(Ci,{"aria-hidden":`true`}),iconOnly:!0,onFileUpload:s}),(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button`,type:`submit`,disabled:e.trim()===``||t,"aria-label":t?`Sending message`:`Send message`,title:t?`Sending message`:`Send message`,children:(0,P.jsx)(Ki,{"aria-hidden":`true`})})]})]})})}function Wy(e){return(0,P.jsx)(Ri,{...e})}var Gy={a:{advance:504,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 94.5 L346 284 L315 126 L315 31.5 L346 0 L378 0 L441 31.5 L472 63 L536 158`]},b:{advance:441,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 220 L63 31.5 L94.5 0 L126 0 L189 31.5 L252 94.5 L284 189 L284 284 L315 158 L346 126 L410 126 L472 158`]},c:{advance:346,strokes:[`M252 220 L252 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L220 0 L315 63 L378 158`]},d:{advance:504,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 94.5 L472 662`,`M346 284 L315 126 L315 31.5 L346 0 L378 0 L441 31.5 L472 63 L536 158`]},e:{advance:315,strokes:[`M63 63 L126 94.5 L158 126 L189 189 L189 252 L158 284 L126 284 L63 252 L31.5 189 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 63 L346 158`]},f:{advance:252,strokes:[`M31.5 158 L158 315 L220 410 L252 472 L284 567 L284 630 L252 662 L189 630 L158 567 L94.5 315 L0 31.5 L-94.5 -189 L-126 -284 L-126 -346 L-94.5 -378 L-31.5 -346 L0 -252 L31.5 31.5 L63 0 L126 0 L189 31.5 L220 63 L284 158`]},g:{advance:472,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 63`,`M346 284 L284 63 L158 -284 L126 -346 L63 -378 L31.5 -346 L31.5 -284 L63 -189 L158 -94.5 L252 -31.5 L315 0 L410 63 L504 158`]},h:{advance:472,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 252 L31.5 0`,`M31.5 0 L63 94.5 L94.5 158 L158 252 L220 284 L284 284 L315 252 L315 189 L284 94.5 L284 31.5 L315 0 L346 0 L410 31.5 L441 63 L504 158`]},i:{advance:220,strokes:[`M31.5 158 L94.5 284 L31.5 94.5 L31.5 31.5 L63 0 L94.5 0 L158 31.5 L189 63 L252 158`],accents:[`M126 441 L126 410 L158 410 L158 441 L126 441`]},j:{advance:220,strokes:[`M31.5 158 L94.5 284 L-94.5 -284 L-126 -346 L-189 -378 L-220 -346 L-220 -284 L-189 -189 L-94.5 -94.5 L0 -31.5 L63 0 L158 63 L252 158`],accents:[`M126 441 L126 410 L158 410 L158 441 L126 441`]},k:{advance:441,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 252 L31.5 0`,`M31.5 0 L63 94.5 L94.5 158 L158 252 L220 284 L284 284 L315 252 L315 189 L252 158 L158 158`,`M158 158 L220 126 L252 31.5 L284 0 L315 0 L378 31.5 L410 63 L472 158`]},l:{advance:252,strokes:[`M31.5 158 L94.5 252 L189 410 L220 472 L252 567 L252 630 L220 662 L158 630 L126 567 L94.5 441 L63 220 L63 31.5 L94.5 0 L126 0 L189 31.5 L220 63 L284 158`]},m:{advance:788,strokes:[`M31.5 158 L94.5 252 L158 284 L189 252 L189 220 L158 94.5 L126 0`,`M158 94.5 L189 158 L252 252 L315 284 L378 284 L410 252 L410 220 L378 94.5 L346 0`,`M378 94.5 L410 158 L472 252 L536 284 L598 284 L630 252 L630 189 L598 94.5 L598 31.5 L630 0 L662 0 L724 31.5 L756 63 L819 158`]},n:{advance:567,strokes:[`M31.5 158 L94.5 252 L158 284 L189 252 L189 220 L158 94.5 L126 0`,`M158 94.5 L189 158 L252 252 L315 284 L378 284 L410 252 L410 189 L378 94.5 L378 31.5 L410 0 L441 0 L504 31.5 L536 63 L598 158`]},o:{advance:441,strokes:[`M220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5 L284 63 L315 126 L315 189 L284 252 L220 284 L189 252 L189 189 L220 126 L284 94.5 L378 94.5 L441 126 L472 158`]},p:{advance:472,strokes:[`M31.5 158 L94.5 252 L126 315 L94.5 189 L-94.5 -378`,`M94.5 189 L126 252 L189 284 L252 284 L315 252 L346 189 L346 126 L315 63 L284 31.5 L220 0`,`M94.5 31.5 L158 0 L252 0 L346 31.5 L410 63 L504 158`]},q:{advance:472,strokes:[`M315 189 L284 252 L220 284 L158 284 L94.5 252 L63 220 L31.5 158 L31.5 94.5 L63 31.5 L126 0 L189 0 L252 31.5`,`M346 284 L315 189 L252 31.5 L158 -189 L126 -284 L126 -346 L158 -378 L220 -346 L252 -252 L252 -31.5 L315 0 L410 63 L504 158`]},r:{advance:410,strokes:[`M31.5 158 L94.5 252 L126 315 L126 252 L220 252 L252 220 L252 158 L220 63 L220 31.5 L252 0 L284 0 L346 31.5 L378 63 L441 158`]},s:{advance:346,strokes:[`M31.5 158 L94.5 252 L126 315 L126 252 L189 158 L220 94.5 L220 31.5 L158 0`,`M31.5 31.5 L94.5 0 L220 0 L284 31.5 L315 63 L378 158`]},t:{advance:284,strokes:[`M31.5 158 L94.5 252 L158 378`,`M252 662 L63 94.5 L63 31.5 L94.5 0 L158 0 L220 31.5 L252 63 L315 158`],accents:[`M63 410 L284 410`]},u:{advance:472,strokes:[`M31.5 158 L94.5 284 L31.5 94.5 L31.5 31.5 L63 0 L126 0 L189 31.5 L252 94.5 L315 189`,`M346 284 L284 94.5 L284 31.5 L315 0 L346 0 L410 31.5 L441 63 L504 158`]},v:{advance:472,strokes:[`M31.5 158 L94.5 284 L63 126 L63 31.5 L94.5 0 L126 0 L220 31.5 L284 94.5 L315 189 L315 284`,`M315 284 L346 158 L378 126 L441 126 L504 158`]},w:{advance:662,strokes:[`M126 284 L63 220 L31.5 126 L31.5 63 L63 0 L126 0 L189 31.5 L252 94.5`,`M315 284 L252 94.5 L252 31.5 L284 0 L346 0 L410 31.5 L472 94.5 L504 189 L504 284`,`M504 284 L536 158 L567 126 L630 126 L693 158`]},x:{advance:504,strokes:[`M31.5 158 L94.5 252 L158 284 L220 284 L252 252 L252 31.5 L284 0 L378 0 L472 63 L536 158`,`M441 252 L410 284 L346 284 L315 252 L189 31.5 L158 0 L94.5 0 L63 31.5`]},y:{advance:472,strokes:[`M31.5 158 L94.5 284 L31.5 94.5 L31.5 31.5 L63 0 L126 0 L189 31.5 L252 94.5 L315 189`,`M346 284 L158 -284 L126 -346 L63 -378 L31.5 -346 L31.5 -284 L63 -189 L158 -94.5 L252 -31.5 L315 0 L410 63 L504 158`]},z:{advance:441,strokes:[`M31.5 158 L94.5 252 L158 284 L220 284 L284 220 L284 158 L252 94.5 L189 31.5 L94.5 0 L158 -31.5 L189 -94.5 L189 -189 L158 -284 L126 -346 L63 -378 L31.5 -346 L31.5 -284 L63 -189 L158 -94.5 L252 -31.5 L378 63 L472 158`]}},Ky=[{id:`collaboration`,weight:30,words:`aligning.pairing.joining.syncing.sharing.weaving.blending.bridging.linking.merging.uniting.teaming.huddling.gathering.relaying.listening.helping.guiding.shaping.connecting.combining.supporting.assisting.exchanging.conversing.adapting.partnering.allying.chatting.consulting.conferring.responding.cooperating`.split(`.`)},{id:`context`,weight:35,words:`reading.noting.jotting.drafting.writing.mapping.sorting.sifting.grouping.capturing.recapping.reviewing.refining.distilling.curating.reflecting.outlining.planning.framing.clarifying.tracing.scanning.parsing.thinking.exploring.studying.checking.polishing.revising.editing.annotating.organizing.focusing.preparing.sketching.collecting.discerning.condensing.digesting.extracting.structuring.surfacing.orienting.grounding.noticing.pondering.considering.reasoning`.split(`.`)},{id:`music`,weight:25,words:`tuning.attuning.cueing.riffing.jamming.humming.echoing.arranging.composing.rehearsing.flowing.scoring.phrasing.voicing.conducting.playing.resonating.balancing.reprising.performing.grooving.tapping.strumming.singing.rhyming.dancing.swaying.drumming.plucking.chanting.whistling`.split(`.`)},{id:`playful`,weight:10,words:`brewing.steeping.simmering.whisking.doodling.tinkering.noodling.puzzling.sprouting.unfurling.vibing.musing.roaming.stitching.threading.blooming.glowing.buzzing.cooking.stirring.mixing.rolling.gliding.looping.twirling.dreaming.imagining.conjuring.hatching.unfolding.shuffling.percolating.scribbling.whittling.bubbling.fizzing.sparkling.whirring.wobbling.growing.ripening.wondering.inventing.crafting`.split(`.`)}];Ky.reduce((e,t)=>e+t.words.length,0);function qy(e){return Math.min(.999999,Math.max(0,e()))}function Jy(e,t){let n=[...e];for(let e=n.length-1;e>0;--e){let r=Math.floor(qy(t)*(e+1));[n[e],n[r]]=[n[r],n[e]]}return n}function Yy(e=Math.random,t=()=>!0){let n=Ky.map(e=>({...e,words:e.words.filter(t)})).filter(e=>e.words.length>0),r=n.length>0?n:Ky,i=new Map,a=r.reduce((e,t)=>e+t.weight,0),o;return()=>{let t=qy(e)*a,n=r.find(e=>(t-=e.weight,t<0))??r[0],s=i.get(n.id);(s===void 0||s.length===0)&&(s=Jy(n.words,e),i.set(n.id,s));let c=s.pop()??n.words[0];return c===o&&s.length>0&&(s.unshift(c),c=s.pop()??n.words[0]),o=c,c}}var Xy=.078,Zy=57,Qy=4,$y=.1,eb=.7,tb=.84,nb=.94,rb=.012,ib=1.5,ab=24;function ob(e,t,n){return Math.min(n,Math.max(t,e))}function sb(e){return e<.5?4*e*e*e:1-(-2*e+2)**3/2}function cb(e){return Number(e.toFixed(3)).toString()}function lb(e,t){let n=e.match(/-?\d+(?:\.\d+)?/gu)?.map(Number)??[],r=[];for(let e=0;e<n.length-1;e+=2)r.push({x:t+(n[e]??0)*Xy,y:Zy-(n[e+1]??0)*Xy});return r}function ub(e){if(e.length===0)return``;let t=e[0],n=[`M ${cb(t.x)} ${cb(t.y)}`];for(let t of e.slice(1))n.push(`L ${cb(t.x)} ${cb(t.y)}`);return n.join(` `)}function db(e){if(e.length<3)return[...e];let t=.22,n=[...e];for(let e=0;e<3;e+=1){let e=[n[0]];for(let r=0;r<n.length-1;r+=1){let i=n[r],a=n[r+1];e.push({x:i.x*(1-t)+a.x*t,y:i.y*(1-t)+a.y*t},{x:i.x*t+a.x*(1-t),y:i.y*t+a.y*(1-t)})}e.push(n[n.length-1]),n=e}return n}function fb(e){if(e.length<3)return ub(e);let t=.9,n=e[0],r=[`M ${cb(n.x)} ${cb(n.y)}`];for(let n=0;n<e.length-1;n+=1){let i=e[Math.max(0,n-1)],a=e[n],o=e[n+1],s=e[Math.min(e.length-1,n+2)],c={x:a.x+(o.x-i.x)*t/6,y:a.y+(o.y-i.y)*t/6},l={x:o.x-(s.x-a.x)*t/6,y:o.y-(s.y-a.y)*t/6};r.push(`C ${cb(c.x)} ${cb(c.y)} ${cb(l.x)} ${cb(l.y)} ${cb(o.x)} ${cb(o.y)}`)}return r.join(` `)}function pb(e){let t=Qy,n=[],r=[],i=[];for(let[a,o]of[...e.toLowerCase()].entries()){let e=Gy[o];if(e!==void 0){for(let[r,o]of e.strokes.entries()){let e=db(lb(o,t));i.push(...e),n.push({id:`${a}:body:${r}`,path:fb(e),role:`body`})}for(let[n,o]of(e.accents??[]).entries()){let e=lb(o,t);i.push(...e),r.push({id:`${a}:accent:${n}`,path:ub(e),role:`accent`})}t+=e.advance*Xy}}if(i.length===0)return{height:ab,strokes:[],viewBox:`0 0 64 64`,width:ab};let a=i.map(e=>e.x),o=i.map(e=>e.y),s=Math.floor(Math.min(0,...a.map(e=>e-6))),c=Math.ceil(Math.max(t,...a.map(e=>e+6))),l=Math.floor(Math.min(0,...o.map(e=>e-4))),u=Math.ceil(Math.max(64,...o.map(e=>e+4))),d=c-s,f=u-l;return{height:ab,strokes:[...n,...r],viewBox:`${s} ${l} ${d} ${f}`,width:Number((d*ab/f).toFixed(2))}}var mb=Yy(Math.random,e=>pb(e).width<=96);function hb(e){for(let t of e.strokes)t.path.style.opacity=`0`,t.path.style.strokeDashoffset=`${t.length}`}function gb(e){for(let t of e.strokes)t.path.style.opacity=`1`,t.path.style.strokeDashoffset=`0`}function _b(e,t,n){let r=t;for(let[t,i]of e.strokes.entries()){if(i.path.style.opacity=`${n}`,r<=0){i.path.style.strokeDashoffset=`${i.length}`;continue}let a=Math.min(i.length,r);if(i.path.style.strokeDashoffset=`${i.length-a}`,r-=a,a<i.length)break;if(t<e.strokes.length-1){if(r<e.transitionLength)break;r-=e.transitionLength}}}function vb(e,t){let n=t%e.duration/e.duration;if(n<$y||n>=nb){hb(e);return}if(n<=eb){_b(e,sb(ob((n-$y)/(eb-$y),0,1))*e.totalLength,1);return}let r=n<=tb?1:1-ob((n-tb)/(nb-tb),0,1);_b(e,e.totalLength,r)}function yb({word:e,className:t,...n}){let[r]=(0,N.useState)(()=>e??mb()),i=e??r,a=(0,N.useMemo)(()=>pb(i),[i]),o=(0,N.useRef)(null);return(0,N.useEffect)(()=>{let e=o.current;if(e===null)return;let t=[...e.querySelectorAll(`[data-writing-stroke]`)].map(e=>{let t=e.getTotalLength();return e.style.strokeDasharray=`${t} ${t}`,e.style.strokeDashoffset=`${t}`,{length:t,path:e}});if(t.length===0)return;let n=t.reduce((e,t)=>e+t.length,0),r=n*rb,i=n+r*Math.max(0,t.length-1),a={duration:ob(4e3+i*4.4,5e3,7600)*ib,strokes:t,totalLength:i,transitionLength:r},s=window.matchMedia(`(prefers-reduced-motion: reduce)`),c,l,u=()=>{c!==void 0&&(window.cancelAnimationFrame(c),c=void 0)},d=e=>{l===void 0&&(l=e-a.duration*$y),vb(a,e-l),c=window.requestAnimationFrame(d)},f=()=>{if(u(),s.matches){gb(a);return}hb(a),l=void 0,c=window.requestAnimationFrame(d)};return s.addEventListener(`change`,f),f(),()=>{s.removeEventListener(`change`,f),u()}},[a]),(0,P.jsxs)(`span`,{className:R(`scratchpad-writing-indicator`,t),role:`status`,"aria-label":`Refreshing Scratchpad`,"data-writing-word":i,...n,children:[(0,P.jsx)(zi,{"aria-hidden":`true`,className:`scratchpad-writing-icon`}),(0,P.jsx)(`svg`,{"aria-hidden":`true`,className:`scratchpad-writing-canvas`,focusable:`false`,height:a.height,ref:o,viewBox:a.viewBox,width:a.width,children:a.strokes.map(e=>(0,P.jsx)(`path`,{d:e.path,"data-writing-role":e.role,"data-writing-stroke":``},e.id))})]})}var bb={confirmed:(0,P.jsx)(li,{"aria-hidden":`true`}),question:(0,P.jsx)(pi,{"aria-hidden":`true`}),"task-change":(0,P.jsx)(Zi,{"aria-hidden":`true`})};function xb({kind:e,children:t,className:n,...r}){return(0,P.jsxs)(`div`,{className:R(`scratchpad-row`,`is-${e}`,n),...r,children:[(0,P.jsx)(`span`,{className:`scratchpad-marker`,"aria-hidden":`true`,children:bb[e]}),(0,P.jsx)(`p`,{children:t})]})}function Sb({compiledTasks:e=[],onOpenCompiledTask:t}){return(0,P.jsxs)(`section`,{className:`scratchpad-submitted-receipt`,"aria-label":`Submitted to Worklist`,children:[(0,P.jsx)(`strong`,{children:`Submitted to Worklist`}),e.length===0?(0,P.jsxs)(`div`,{className:`scratchpad-submitted-empty`,role:`status`,children:[(0,P.jsx)(Zi,{"aria-hidden":`true`}),(0,P.jsxs)(`span`,{className:`scratchpad-submitted-empty-copy`,children:[(0,P.jsx)(`span`,{children:`No new task created`}),(0,P.jsx)(`small`,{children:`This Scratchpad was submitted, but no Worklist task was added.`})]})]}):(0,P.jsx)(`div`,{className:`scratchpad-submitted-task-list`,children:e.map(e=>(0,P.jsxs)(`button`,{className:`scratchpad-submitted-task`,disabled:t===void 0,onClick:()=>t?.(e.taskId),type:`button`,children:[(0,P.jsxs)(`span`,{className:`scratchpad-submitted-task-copy`,children:[(0,P.jsx)(`span`,{children:e.title}),(0,P.jsx)(`small`,{children:e.moduleName})]}),(0,P.jsx)(di,{"aria-hidden":`true`})]},e.taskId))})]})}function Cb({title:e,summary:t,sections:n,updatedLabel:r,updatedLabelPrefix:i=`Updated`,footerNote:a,submitAvailable:o,pages:s,empty:c,actionsDisabled:l=!1,compact:u=!1,syncPending:d=!1,submitPending:f=!1,onSubmitScratchpad:p,onOpenCompiledTask:m,className:h,...g}){let _=s!==void 0&&s.length>0,v=(0,N.useMemo)(()=>s!==void 0&&s.length>0?s:[{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}}],[a,s,n,o,t,e,r,i]),y=Math.max(0,v.length-1),b=v[y]?.key,[x,S]=(0,N.useState)(y);(0,N.useEffect)(()=>{S(y)},[y,b]);let C=Math.min(x,Math.max(0,v.length-1)),w=v[C]??{key:`current`,title:e,summary:t,sections:n,...r===void 0?{}:{updatedLabel:r},updatedLabelPrefix:i,...a===void 0?{}:{footerNote:a},...o===void 0?{}:{submitAvailable:o}},T=d||f,E=w.submitAvailable??w.sections.length>0,ee=l||T||!E||w.submitted===!0;return(0,P.jsx)(ma,{title:`Scratchpad`,icon:(0,P.jsx)(Wy,{"aria-hidden":`true`}),className:R(`scratchpad-panel`,u?`is-compact`:void 0,h),"aria-busy":T,...g,children:(0,P.jsxs)(`div`,{className:`scratchpad-panel-body scratchpad`,children:[!_&&w.sections.length===0?c??(0,P.jsx)(`div`,{}):(0,P.jsxs)(`div`,{className:R(`scratchpad-content`,w.submitted===!0?`is-submitted`:void 0),children:[(0,P.jsx)(`div`,{className:`scratchpad-head`,children:(0,P.jsx)(`div`,{children:(0,P.jsx)(`h4`,{children:w.title})})}),(0,P.jsx)(`p`,{className:`scratchpad-summary`,children:w.summary}),w.sections.map(e=>(0,P.jsxs)(`section`,{className:`scratchpad-section`,"aria-labelledby":e.id,children:[(0,P.jsx)(`span`,{className:`scratchpad-label`,id:e.id,children:e.label}),(0,P.jsx)(`div`,{className:`scratchpad-list`,children:e.rows.map(t=>(0,P.jsx)(xb,{kind:t.kind,children:t.text},`${e.id}:${t.text}`))})]},e.id)),w.submitted===!0?(0,P.jsx)(Sb,{compiledTasks:w.compiledTasks??[],...m===void 0?{}:{onOpenCompiledTask:m}}):null]},w.key),!u&&v.length>1?(0,P.jsx)(`div`,{className:`scratchpad-history-nav`,children:(0,P.jsx)(pa,{"aria-label":`Scratchpad history`,currentPage:C,maxVisible:7,pageAriaLabel:e=>`Scratchpad page ${e+1}`,pageCount:v.length,onPageChange:S})}):null,(0,P.jsxs)(`div`,{className:`scratchpad-footer`,children:[w.footerNote===void 0?null:(0,P.jsx)(`p`,{className:R(`scratchpad-footer-note`,w.footerNote.tone===`error`?`is-error`:void 0),title:w.footerNote.text,children:w.footerNote.text}),u&&!d?null:(0,P.jsx)(`div`,{className:`scratchpad-submit-context`,children:d?(0,P.jsx)(yb,{}):w.updatedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`scratchpad-updated-at`,children:[(0,P.jsx)(`span`,{children:w.updatedLabelPrefix??`Updated`}),(0,P.jsx)(`span`,{children:w.updatedLabel})]})}),(0,P.jsx)(`div`,{className:`scratchpad-footer-actions`,children:(0,P.jsxs)(Ss,{className:R(`scratchpad-submit-button`,f?`is-submitting`:void 0),type:`button`,"aria-busy":f,disabled:ee,onClick:p,children:[f?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(Bi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:f?`Running`:`Run`})]})})]})]})})}function wb(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`pending`?(0,P.jsx)(na,{"aria-hidden":`true`}):e===`running`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(hi,{"aria-hidden":`true`})}function Tb(e){return e===`complete`?`Complete`:e===`failed`?`Failed`:e===`pending`?`Needs input`:`Running`}function Eb(e){return(0,P.jsx)(ra,{"aria-hidden":`true`,"data-tone":e})}function Db({title:e,summary:t,tone:n,steps:r,metaLabel:i,className:a,...o}){let s=i??Tb(n),c=o[`aria-label`]??`${e}. ${s}. ${t}`;return(0,P.jsx)(ma,{title:e,icon:Eb(n),className:R(`execution-progress-panel`,`is-${n}`,a),"aria-label":c,...o,children:(0,P.jsx)(`div`,{className:`execution-progress-body`,children:(0,P.jsx)(`div`,{className:`execution-progress-list`,children:r.map(e=>(0,P.jsxs)(`div`,{className:R(`execution-progress-step`,`is-${e.status}`),children:[(0,P.jsx)(`span`,{className:R(`execution-progress-marker`,`is-${e.status}`),"aria-hidden":`true`,children:wb(e.status)}),(0,P.jsxs)(`span`,{className:`execution-progress-step-content`,children:[(0,P.jsxs)(`span`,{className:`execution-progress-step-title`,children:[(0,P.jsx)(`span`,{className:`execution-progress-step-label`,children:e.label}),e.elapsedLabel===void 0?null:(0,P.jsxs)(`span`,{className:`execution-progress-step-elapsed`,children:[` `,`(`,e.elapsedLabel,`)`]})]}),e.detail===void 0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-detail`,children:e.detail}),e.metrics===void 0||e.metrics.length===0?null:(0,P.jsx)(`span`,{className:`execution-progress-step-metrics`,children:e.metrics.map(e=>(0,P.jsx)(`span`,{className:`execution-progress-step-metric`,children:e},e))})]})]},e.id))})})})}function Ob({tone:e=`neutral`,compact:t=!1,asChild:n=!1,className:r,...i}){return(0,P.jsx)(n?os:`div`,{className:R(`chat-event-card`,`is-${e}`,t?`is-compact`:void 0,r),...i})}function kb({as:e=`div`,icon:t,title:n,meta:r,action:i,className:a,...o}){return(0,P.jsxs)(e,{className:R(`chat-event-card-header`,a),...o,children:[(0,P.jsx)(Ab,{children:t}),(0,P.jsxs)(`span`,{className:`chat-event-card-title`,children:[(0,P.jsx)(`strong`,{children:n}),r===void 0?null:(0,P.jsx)(`span`,{className:`chat-event-card-meta`,children:r})]}),i]})}function Ab({className:e,...t}){return(0,P.jsx)(`span`,{className:R(`chat-event-card-status-icon`,e),...t})}function jb({className:e,...t}){return(0,P.jsx)(`div`,{className:R(`chat-event-card-body`,e),...t})}function Mb({className:e,...t}){return(0,P.jsx)(`footer`,{className:R(`chat-event-card-footer`,e),...t})}function Nb(e){return e===`done`?`success`:e===`failed`?`danger`:e===`pending`?`warning`:`neutral`}function Pb(e){return e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(ia,{"aria-hidden":`true`}):(0,P.jsx)(Pi,{"aria-hidden":`true`})}function Fb({title:e,summary:t,request:n,messages:r,draft:i,contextLabel:a,defaultOpen:o,readOnly:s=!1,replyCount:c,status:l,statusLabel:u,mentionOptions:d,sendPending:f=!1,submitPending:p=!1,onDraftChange:m,onSendMessage:h,onSubmitRound:g,className:_,...v}){let y=t.trim()===``?n:t,b=a===void 0?y:`${y} (${a})`,[x,S]=(0,N.useState)(o??!0),C=l??(s?`done`:`pending`),w=u??(s?`submitted`:`needs input`),T=c??r.length,E=p||T===0,ee=T===0?`No replies`:`${T} ${T===1?`reply`:`replies`}`,D=Nb(C),O=`${w} · ${ee}`,k=(0,P.jsxs)(jb,{className:`chat-clarification-card-body`,children:[(0,P.jsx)(`div`,{className:`chat-event-thread`,children:r.map(e=>(0,P.jsxs)(`article`,{className:`chat-event-message`,children:[e.avatar,(0,P.jsxs)(`div`,{className:`chat-event-message-copy`,children:[(0,P.jsxs)(`div`,{className:`message-meta`,children:[(0,P.jsx)(`span`,{className:`message-author`,children:e.author}),e.time===void 0?null:(0,P.jsx)(`span`,{className:`message-time`,children:e.time})]}),(0,P.jsx)(`p`,{children:(0,P.jsx)(Sy,{children:e.body})})]})]},e.id))}),s?null:(0,P.jsx)(`form`,{className:`chat-event-composer`,"aria-label":`Round reply`,onSubmit:h,children:(0,P.jsxs)(`div`,{className:`composer-input-shell chat-event-composer-input-shell`,children:[(0,P.jsx)(Cy,{type:`text`,"aria-label":`Round message`,value:i,placeholder:`Reply in this round`,multiline:!0,maxRows:4,submitOnEnter:!0,...d===void 0?{}:{mentionOptions:d},onValueChange:m}),(0,P.jsx)(`div`,{className:`composer-tools chat-event-composer-tools`,"aria-label":`Round message tools`,children:(0,P.jsx)(`button`,{className:`composer-tool-button composer-send-button chat-event-send-button`,type:`submit`,disabled:i.trim()===``||f,"aria-label":f?`Sending round message`:`Send round message`,title:f?`Sending round message`:`Send round message`,children:(0,P.jsx)(Ki,{"aria-hidden":`true`})})})]})})]});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,_),...v,children:s?(0,P.jsx)(Ob,{tone:D,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-clarification-card`,open:x,"aria-label":b,onToggle:e=>S(e.currentTarget.open),children:[(0,P.jsx)(kb,{as:`summary`,icon:Pb(C),title:e,meta:O,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),k]})}):(0,P.jsx)(Ob,{tone:D,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-clarification-card is-fixed-open`,"aria-label":b,children:[(0,P.jsx)(kb,{icon:Pb(C),title:e,meta:O,tabIndex:-1,action:(0,P.jsxs)(Ss,{className:`chat-event-primary-action`,type:`button`,"aria-label":T===0?`Reply before submitting round`:`Submit round`,"aria-busy":p,disabled:E,title:T===0?`Reply before submitting round`:`Submit round`,onClick:g,children:[p?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`button-label`,children:p?`Submitting`:`Submit`})]})}),k]})})})}function Ib({decision:e,disabled:t,onDecide:n}){let r=e.tone===`primary`?Ss:Cs,i=e.decisionId.startsWith(`allow`)?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(ia,{"aria-hidden":`true`});return(0,P.jsxs)(r,{type:`button`,className:R(`chat-approval-card-decision`,e.tone===`primary`?`is-primary`:void 0,e.tone===`danger`?`is-danger`:void 0),disabled:t,onClick:()=>n(e.decisionId),children:[i,(0,P.jsx)(`span`,{className:`button-label`,children:e.label})]})}function Lb(e,t){return e===`pending`?`warning`:e===`resolved`?`success`:/expired|cancelled/iu.test(t)?`neutral`:`danger`}function Rb(e){return e===`success`?(0,P.jsx)(li,{"aria-hidden":`true`}):e===`danger`?(0,P.jsx)(ia,{"aria-hidden":`true`}):e===`neutral`?(0,P.jsx)(gi,{"aria-hidden":`true`}):(0,P.jsx)(Yi,{"aria-hidden":`true`})}function zb({title:e,summary:t,reason:n,status:r,statusLabel:i,detailLabel:a,detail:o,detailCode:s=!1,decisions:c=[],decisionPending:l=!1,resolutionLabel:u,defaultOpen:d,onDecide:f,className:p,...m}){let[h,g]=(0,N.useState)(d??r===`pending`),_=Lb(r,i),v=[...c].sort((e,t)=>e.tone===t.tone?0:e.tone===`primary`?-1:+(t.tone===`primary`)),y=r===`pending`&&f!==void 0?(0,P.jsx)(Mb,{className:`chat-approval-card-actions`,children:v.map(e=>(0,P.jsx)(Ib,{decision:e,disabled:l,onDecide:f},e.decisionId))}):null,b=(0,P.jsx)(jb,{className:`chat-approval-card-body`,children:(0,P.jsxs)(`div`,{className:`chat-approval-card-content`,children:[(0,P.jsx)(`p`,{className:`chat-approval-card-summary`,children:t}),n===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-reason`,children:n}),o===void 0?null:(0,P.jsxs)(`div`,{className:`chat-approval-card-detail`,children:[a===void 0?null:(0,P.jsx)(`span`,{className:`chat-approval-card-detail-label`,children:a}),s?(0,P.jsx)(`code`,{className:`chat-approval-card-detail-code`,children:o}):(0,P.jsx)(`span`,{className:`chat-approval-card-detail-text`,children:o})]}),r===`pending`||u===void 0?null:(0,P.jsx)(`p`,{className:`chat-approval-card-resolution`,children:u})]})});return(0,P.jsx)(`article`,{className:R(`message is-chat-event`,p),...m,children:r===`pending`?(0,P.jsx)(Ob,{tone:_,asChild:!0,children:(0,P.jsxs)(`section`,{className:`chat-approval-card is-fixed-open`,"aria-label":t,children:[(0,P.jsx)(kb,{icon:Rb(_),title:e,meta:i,tabIndex:-1}),b,y]})}):(0,P.jsx)(Ob,{tone:_,asChild:!0,children:(0,P.jsxs)(`details`,{className:`chat-approval-card`,open:h,"aria-label":t,onToggle:e=>g(e.currentTarget.open),children:[(0,P.jsx)(kb,{as:`summary`,icon:Rb(_),title:e,meta:i,action:(0,P.jsx)(`span`,{className:`chat-event-card-toggle`,"aria-hidden":`true`,children:(0,P.jsx)(ui,{})})}),b]})})})}function Bb({status:e,title:t,taskId:n,taskTitle:r,summary:i,moduleName:a,finalNote:o,generatedFiles:s=[],errorCode:c,onOpenTask:l,className:u,...d}){let f=o?.trim()??``,p=i.trim(),m=f.length>0?f:p,h=e===`completed`?`Task completed`:`Task failed`;return(0,P.jsx)(`article`,{className:R(`message is-chat-event is-task-result`,u),...d,children:(0,P.jsx)(Ob,{tone:e===`completed`?`success`:`danger`,compact:!0,asChild:!0,children:(0,P.jsxs)(`button`,{className:R(`chat-task-result-card`,`is-${e}`),disabled:l===void 0,onClick:()=>l?.(n),type:`button`,"aria-label":`${t}: ${r}`,children:[(0,P.jsx)(Ab,{"aria-hidden":`true`,children:e===`completed`?(0,P.jsx)(li,{}):(0,P.jsx)(ia,{})}),(0,P.jsxs)(`span`,{className:`chat-task-result-card-main`,children:[(0,P.jsx)(`span`,{className:`chat-task-result-card-state`,children:h}),(0,P.jsx)(`strong`,{children:r}),a===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-module`,children:a}),m.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-summary`,children:m}),c===void 0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-error-code`,children:c}),s.length===0?null:(0,P.jsx)(`span`,{className:`chat-task-result-card-files`,"aria-label":`Generated files`,children:s.map(e=>(0,P.jsxs)(`span`,{className:`chat-task-result-card-file`,children:[(0,P.jsx)(Ci,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))})]}),(0,P.jsx)(`span`,{className:`chat-task-result-card-arrow`,"aria-hidden":`true`,children:(0,P.jsx)(di,{})})]})})})}function Vb({status:e}){return e===`done`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(li,{})}):e===`pending`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Ii,{})}):e===`failed`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(ia,{})}):e===`running`?(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`,children:(0,P.jsx)(Mi,{})}):(0,P.jsx)(`span`,{className:`task-check`,"aria-hidden":`true`})}function Hb({title:e,status:t,selected:n=!1,className:r,type:i=`button`,...a}){return(0,P.jsxs)(`button`,{className:R(`task-row`,n?`is-selected`:void 0,`is-${t}`,r),type:i,"aria-current":n?`true`:void 0,...a,children:[(0,P.jsx)(Vb,{status:t}),(0,P.jsx)(`div`,{className:`task-row-main`,children:(0,P.jsx)(`div`,{className:`task-title-line`,children:(0,P.jsx)(`strong`,{children:e})})})]})}function Ub({label:e,value:t,code:n=!1,status:r}){return(0,P.jsxs)(`div`,{className:`detail-row`,children:[(0,P.jsx)(`span`,{children:e}),r===void 0?n?(0,P.jsx)(`code`,{children:t}):(0,P.jsx)(`strong`,{children:t}):(0,P.jsx)(`strong`,{children:(0,P.jsx)(Es,{status:r,children:t})})]})}function Wb({rows:e}){return(0,P.jsx)(P.Fragment,{children:e.map((e,t)=>(0,N.createElement)(Ub,{...e,key:`${e.label}-${t}`}))})}function Gb({...e}){return(0,P.jsx)(Hb,{...e})}function Kb({detail:e,missingTaskId:t}){return e===void 0?(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsx)(`div`,{className:`task-detail-head`,children:(0,P.jsx)(`h4`,{children:t===void 0?`No task selected`:`Task not found`})}),(0,P.jsx)(`p`,{children:t===void 0?`Select a task to inspect its contract, latest result, and run history.`:`No task exists for ${t}. Select another task from the Worklist.`})]}):(0,P.jsxs)(`aside`,{className:`task-detail-card`,"aria-label":`Selected task details`,children:[(0,P.jsxs)(`div`,{className:`task-detail-head`,children:[(0,P.jsx)(Es,{status:e.status,children:e.status}),(0,P.jsx)(`h4`,{children:e.title})]}),(0,P.jsx)(`p`,{children:e.summary}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Task contract`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Task contract`}),(0,P.jsx)(Wb,{rows:e.contractRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section task-evidence-section`,"aria-label":`Evidence`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Evidence`}),(0,P.jsx)(Wb,{rows:e.evidenceRows??e.resultRows})]}),(0,P.jsxs)(`section`,{className:`task-detail-section`,"aria-label":`Run result history`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Run result history`}),e.runResults.length===0?(0,P.jsx)(`p`,{children:`No run result yet.`}):(0,P.jsx)(`div`,{className:`run-result-list`,children:e.runResults.map(e=>(0,P.jsx)(`article`,{className:`run-result-item`,children:(0,P.jsxs)(`div`,{className:`run-result-item-head`,children:[(0,P.jsxs)(`span`,{children:[(0,P.jsx)(`strong`,{children:e.title}),e.meta===void 0?null:(0,P.jsx)(`small`,{children:e.meta})]}),e.status===void 0?null:(0,P.jsx)(Es,{status:e.status,children:e.status})]})},e.id))})]})]})}function qb({modules:e,taskCount:t,detail:n,missingTaskId:r,runNote:i,onSelectTask:a,empty:o,className:s,...c}){return(0,P.jsx)(ma,{title:`Worklist`,icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),action:(0,P.jsx)(`div`,{className:`worklist-header-summary`,children:(0,P.jsx)(`span`,{className:`mini-meta`,children:t===1?`1 task`:`${t} tasks`})}),className:R(`tasks worklist-page-panel`,s),...c,children:(0,P.jsxs)(`div`,{className:`worklist-page-body`,children:[i===void 0?null:(0,P.jsx)(`p`,{className:`worklist-run-note`,children:i}),e.length===0?(0,P.jsx)(`div`,{className:`worklist-page-empty`,children:o??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No compiled tasks`})}):(0,P.jsxs)(`div`,{className:`task-board-body`,children:[(0,P.jsx)(`div`,{className:`task-list`,"aria-label":`Tasks`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`task-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:e.label}),e.rows.map(e=>(0,P.jsx)(Gb,{title:e.title,status:e.status,onClick:()=>a?.(e.id),...e.selected===void 0?{}:{selected:e.selected}},e.id))]},e.label))}),(0,P.jsx)(Kb,{...n===void 0?{}:{detail:n},...r===void 0?{}:{missingTaskId:r}})]})]})})}function Jb({sections:e,statuses:t=[],className:n,...r}){return(0,P.jsxs)(`section`,{className:R(`settings-sheet`,n),"aria-labelledby":`settings-title`,...r,children:[(0,P.jsxs)(`header`,{className:`settings-sheet-head`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Ji,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{id:`settings-title`,children:`Project settings`})]}),t.length===0?null:(0,P.jsx)(`div`,{className:`panel-actions`,children:t.map(e=>(0,P.jsx)(ws,{className:`task-tag`,tone:e.tone,children:e.label},e.label))})]}),e.map(e=>(0,P.jsxs)(`section`,{className:`settings-section`,id:e.id,"aria-label":e.title,children:[(0,P.jsx)(`div`,{className:`settings-section-title`,children:(0,P.jsx)(`h4`,{children:e.title})}),(0,P.jsx)(`div`,{className:`settings-section-body`,children:e.rows.map(e=>(0,P.jsxs)(`div`,{className:`settings-row`,children:[(0,P.jsx)(`span`,{className:`field-label`,children:e.label}),e.value===void 0?(0,P.jsx)(`span`,{}):e.plain===!0?(0,P.jsx)(`div`,{className:`settings-row-value`,children:e.value}):e.code===!0?(0,P.jsx)(`code`,{children:e.value}):(0,P.jsx)(`strong`,{children:e.value})]},e.label))})]},e.id))]})}function Yb({row:e}){return e.category===`image`?(0,P.jsx)(Ei,{"aria-hidden":`true`}):e.canPreview===!1?(0,P.jsx)(xi,{"aria-hidden":`true`}):e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):e.extension===`md`||e.extension===`txt`?(0,P.jsx)(Si,{"aria-hidden":`true`}):(0,P.jsx)(Ci,{"aria-hidden":`true`})}function Xb({row:e,onSelectFile:t}){return(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>t?.(e.path),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Yb,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.meta})]})]})}function Zb({name:e,rows:t,onSelectFile:n}){return(0,P.jsxs)(`details`,{className:`reference-folder-group`,children:[(0,P.jsxs)(`summary`,{className:`reference-folder-head`,children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ti,{})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e}),(0,P.jsxs)(`span`,{children:[t.length,` `,t.length===1?`file`:`files`]})]})]}),(0,P.jsx)(`div`,{className:`reference-folder-files`,children:t.map(e=>(0,P.jsx)(Xb,{row:e,...n===void 0?{}:{onSelectFile:n}},e.path))})]})}function Qb(e){let t=new Map;for(let n of e){if(n.source!==`tutti_output`||n.generatedGroup===void 0)continue;let e=t.get(n.generatedGroup)??[];e.push(n),t.set(n.generatedGroup,e)}return[...t.entries()].map(([e,t])=>({name:e,rows:t}))}function $b({files:e,detail:t,uploadPending:n=!1,fileSortMode:r=`time`,empty:i,onSelectFile:a,onUploadFile:o,onDropFiles:s,onFileSortModeChange:c,className:l,...u}){let d=e.filter(e=>e.category===`image`&&e.source!==`tutti_output`),f=e.filter(e=>!(e.category===`image`&&e.source!==`tutti_output`)),p=f.filter(e=>e.source!==`tutti_output`||e.generatedGroup===void 0),m=Qb(f),h=e=>(0,P.jsx)(`div`,{className:`reference-image-strip`,role:`list`,"aria-label":`Reference images`,onWheel:e=>{Math.abs(e.deltaY)>Math.abs(e.deltaX)&&(e.currentTarget.scrollLeft+=e.deltaY,e.preventDefault())},children:e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-image-tile`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-current":e.selected===!0?`true`:void 0,"aria-label":`Open ${e.name}`,onClick:()=>a?.(e.path),children:[e.thumbnailUrl===void 0?(0,P.jsx)(`span`,{className:`reference-image-tile-fallback`,"aria-hidden":`true`,children:(0,P.jsx)(Ei,{})}):(0,P.jsx)(`img`,{src:e.thumbnailUrl,alt:e.name,loading:`lazy`,decoding:`async`}),(0,P.jsx)(`span`,{children:e.name})]},e.path))}),g=e=>e.map(e=>(0,P.jsx)(Xb,{row:e,...a===void 0?{}:{onSelectFile:a}},e.path)),_=s??(o===void 0?void 0:e=>{for(let t of e)o(t)});return(0,P.jsxs)(iy,{className:R(`panel references-panel`,l),"aria-label":`References`,dropLabel:`Drop reference files to upload`,pending:n,onFilesUpload:_,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`References`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Hy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:n,onFileUpload:o})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:i??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No reference files`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Reference file list`,children:[d.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Images`}),h(d)]}),f.length===0?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-files-head`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Files`}),(0,P.jsxs)(`div`,{className:`reference-list-toolbar`,role:`toolbar`,"aria-label":`Sort files`,children:[(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`time`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by upload time`,"aria-pressed":r===`time`,onClick:()=>c?.(`time`),children:(0,P.jsx)(gi,{"aria-hidden":`true`})}),(0,P.jsx)(`button`,{className:R(`reference-sort-button`,r===`type`?`is-active`:void 0),type:`button`,"aria-label":`Sort files by type`,"aria-pressed":r===`type`,onClick:()=>c?.(`type`),children:(0,P.jsx)($i,{"aria-hidden":`true`})})]})]}),g(p),m.map(e=>(0,P.jsx)(Zb,{name:e.name,rows:e.rows,...a===void 0?{}:{onSelectFile:a}},e.name))]})]}),(0,P.jsxs)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected reference content`,children:[(0,P.jsxs)(`div`,{className:`reference-detail-head`,children:[(0,P.jsx)(`h4`,{children:t?.title??`No file selected`}),t?.meta===void 0?null:(0,P.jsx)(`p`,{children:t.meta})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Summary`}),(0,P.jsx)(`p`,{className:`reference-summary`,children:t?.summary??`Summary not available yet`}),t?.summaryStatus===void 0?null:(0,P.jsx)(`p`,{className:`reference-summary-status`,children:t.summaryStatus})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`Content`}),t?.content===void 0?t?.imageUrl===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:t?.unavailableReason??`Select a reference file`}):(0,P.jsx)(`img`,{className:`reference-image-preview`,src:t.imageUrl,alt:t.title,decoding:`async`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{children:t.content})})]})]})]})})]})}function ex(e){return e.status===`loading`?{status:`running`,label:`Loading`}:e.status===`not_declared`?{status:`todo`,label:`No artifact`}:e.status===`invalid`?{status:`failed`,label:`Invalid`}:e.status===`updating`?{status:`running`,label:`Updating`}:e.previewStatus===`ready`?{status:`done`,label:`Ready`}:e.previewStatus===`starting`?{status:`running`,label:`Starting`}:e.previewStatus===`failed`?{status:`failed`,label:`Failed`}:{status:`todo`,label:`Stopped`}}function tx({state:e,restartPending:t=!1,stopPending:n=!1,compact:r=!1,onRestart:i,onStop:a}){let o=ex(e),s=e.status===`declared`&&e.previewStatus!==`stopped`&&a!==void 0,c=e.status===`declared`&&i!==void 0;return r?s?(0,P.jsx)(xs,{className:`artifact-mobile-control`,type:`button`,label:n?`Stopping artifact`:`Stop artifact`,disabled:n,"aria-busy":n,icon:(0,P.jsx)(Qi,{"aria-hidden":`true`}),onClick:a}):c?(0,P.jsx)(xs,{className:`artifact-mobile-control`,type:`button`,label:t?`Restarting artifact`:`Restart artifact`,disabled:t,"aria-busy":t,icon:(0,P.jsx)(Ui,{className:t?`is-spinning`:void 0,"aria-hidden":`true`}),onClick:i}):null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Es,{status:o.status,children:o.label}),c?(0,P.jsxs)(Cs,{type:`button`,disabled:t,"aria-busy":t,onClick:i,children:[(0,P.jsx)(Ui,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:t?`Restarting`:`Restart`})]}):null,s?(0,P.jsxs)(Cs,{className:`artifact-stop-button`,type:`button`,disabled:n,"aria-busy":n,onClick:a,children:[(0,P.jsx)(Qi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:n?`Stopping`:`Stop`})]}):null]})}function nx({state:e,empty:t,emptyWatermark:n}){if(e.status===`declared`&&e.previewStatus===`ready`&&e.previewUrl!==void 0)return(0,P.jsx)(`iframe`,{className:`artifact-iframe`,src:e.previewUrl,title:`${e.title} artifact preview`,sandbox:`allow-scripts allow-forms allow-same-origin`,referrerPolicy:`no-referrer`});let r,i=`neutral`;return e.status===`loading`?r=`Loading artifact`:e.status===`updating`?r=`Artifact is updating`:e.status===`not_declared`?r=`No artifact`:e.status===`invalid`?(i=`error`,r=`Invalid artifact. ${e.message}`):e.previewStatus===`starting`?r=`Preview is starting`:e.previewStatus===`failed`?(i=`error`,r=e.errorMessage??`Preview failed`):r=`Preview stopped`,(0,P.jsx)(`div`,{className:`artifact-empty-preview`,role:e.status===`invalid`?`alert`:void 0,children:t??(0,P.jsx)(aa,{tone:i,watermark:n,children:r})})}function rx({state:e,error:t=null,empty:n,emptyWatermark:r,restartPending:i=!1,stopPending:a=!1,onRestart:o,onStop:s,className:c,...l}){let u=t===null?e:{status:`invalid`,message:t};return(0,P.jsxs)(`section`,{className:R(`panel artifacts-panel`,c),"aria-label":`Artifacts`,...l,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Artifacts`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(tx,{state:u,restartPending:i,stopPending:a,...o===void 0?{}:{onRestart:o},...s===void 0?{}:{onStop:s}})})]}),(0,P.jsx)(`div`,{className:`artifact-board-body`,children:(0,P.jsx)(`div`,{className:`artifact-preview-frame`,"aria-label":`Current artifact`,children:(0,P.jsx)(nx,{state:u,empty:n,emptyWatermark:r})})})]})}function ix({row:e}){return e.selected===!0?(0,P.jsx)(bi,{"aria-hidden":`true`}):(0,P.jsx)(Xi,{"aria-hidden":`true`})}function ax({skills:e,communityLinks:t=[],detail:n,uploadPending:r=!1,deletePending:i=!1,empty:a,onSelectSkill:o,onUploadSkill:s,onDeleteSkill:c,className:l,...u}){let d=e.find(e=>e.selected===!0)?.name,f=t.length>0;return(0,P.jsxs)(`section`,{className:R(`panel references-panel skills-panel`,l),"aria-label":`Skills`,...u,children:[(0,P.jsxs)(`div`,{className:`panel-header`,children:[(0,P.jsxs)(`div`,{className:`panel-title`,children:[(0,P.jsx)(ha,{icon:(0,P.jsx)(Xi,{"aria-hidden":`true`})}),(0,P.jsx)(`h3`,{children:`Skills`})]}),(0,P.jsx)(`div`,{className:`panel-actions`,children:(0,P.jsx)(Hy,{variant:`action`,className:`reference-upload-button`,label:`Upload`,pendingLabel:`Uploading`,pending:r,accept:`.zip,application/zip,application/x-zip-compressed`,onFileUpload:s})})]}),(0,P.jsx)(`div`,{className:`reference-board-body`,children:e.length===0&&!f?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-list`,"aria-label":`Skill list`,children:[f?(0,P.jsxs)(`div`,{className:`skill-community-section`,"aria-label":`Skill communities`,children:[(0,P.jsx)(`div`,{className:`reference-section-label`,children:`Skill communities`}),(0,P.jsx)(`div`,{className:`skill-community-grid`,children:t.map(e=>(0,P.jsxs)(`a`,{className:`skill-community-card`,href:e.href,target:`_blank`,rel:`noreferrer`,children:[(0,P.jsx)(`span`,{className:`skill-community-card-icon`,"aria-hidden":`true`,children:(0,P.jsx)(Ai,{})}),(0,P.jsx)(`span`,{className:`skill-community-card-main`,children:(0,P.jsx)(`strong`,{children:e.title})})]},e.href))})]}):null,e.length===0?null:(0,P.jsx)(`div`,{className:`reference-section-label`,children:`User skills`}),e.map(e=>(0,P.jsxs)(`button`,{className:R(`reference-row`,e.selected===!0?`is-selected`:void 0),type:`button`,"aria-label":`Select skill ${e.name}`,"aria-current":e.selected===!0?`true`:void 0,onClick:()=>o?.(e.name),children:[(0,P.jsx)(`span`,{className:`reference-file-icon`,"aria-hidden":`true`,children:(0,P.jsx)(ix,{row:e})}),(0,P.jsxs)(`span`,{className:`reference-row-main`,children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`span`,{children:e.shortDescription??e.description})]})]},e.name))]}),(0,P.jsx)(`aside`,{className:`reference-detail-card`,"aria-label":`Selected skill content`,children:e.length===0?(0,P.jsx)(`div`,{className:`reference-board-empty`,children:a??(0,P.jsx)(`div`,{className:`reference-empty`,children:`No skills`})}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`div`,{className:`reference-detail-head skill-detail-head`,children:[(0,P.jsxs)(`div`,{className:`skill-detail-title`,children:[(0,P.jsx)(`h4`,{children:n?.title??`No skill selected`}),n?.description===void 0?null:(0,P.jsx)(`p`,{children:n.description}),n?.updatedLabel===void 0?null:(0,P.jsx)(`p`,{children:n.updatedLabel})]}),d===void 0||c===void 0?null:(0,P.jsxs)(Cs,{className:`skill-delete-button`,type:`button`,disabled:i,"aria-busy":i,onClick:()=>c(d),children:[(0,P.jsx)(ta,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:i?`Deleting`:`Delete`})]})]}),(0,P.jsxs)(`div`,{className:`reference-detail-section`,children:[(0,P.jsx)(`span`,{className:`task-section-label`,children:`SKILL.md`}),n?.skillMd===void 0?(0,P.jsx)(`p`,{className:`reference-content`,children:n?.unavailableReason??`Select a skill`}):(0,P.jsx)(`pre`,{className:`reference-content`,children:(0,P.jsx)(`code`,{"aria-label":`Skill markdown for ${n.title}`,children:n.skillMd})})]})]})})]})})]})}function ox({label:e,children:t}){return(0,P.jsxs)(`section`,{className:`timeline-trace-section`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-label`,children:e}),(0,P.jsx)(`div`,{className:`timeline-trace-section-body`,children:t})]})}function sx(e){return e.replaceAll(`_`,` `)}function cx(e){return e===`passed`?`success`:e===`failed`?`error`:`warning`}function lx(e){return e.status===`promoted`?`success`:e.status===`not_promoted`?`error`:`neutral`}function ux(e){if(e.skipReasonSummary!==void 0)return e.skipReasonSummary;switch(e.checks){case`passed`:return`All validation checks passed.`;case`failed`:return`Validation checks failed.`;case`skipped`:return`Validation was skipped.`}}function dx(e){if(e.summary!==void 0)return e.summary;switch(e.status){case`promoted`:return`Changes were promoted after verification.`;case`not_promoted`:return`Changes were not promoted.`;case`not_attempted`:return`Promotion was not attempted.`}}function fx(e){switch(e){case`added`:return`+`;case`modified`:return`~`;case`deleted`:return`-`;case`renamed`:return`~`;case`unknown`:return`?`}}var px=3;function mx({expanded:e,collapsedLabel:t,expandedLabel:n,onClick:r}){return(0,P.jsxs)(`button`,{"aria-expanded":e,className:R(`timeline-trace-more`,e&&`is-expanded`),onClick:r,type:`button`,children:[(0,P.jsx)(`span`,{children:e?n:t}),(0,P.jsx)(ui,{"aria-hidden":`true`})]})}function hx({expanded:e,hiddenCount:t,label:n,onClick:r}){return t<=0?null:(0,P.jsx)(mx,{collapsedLabel:`Show ${t} more ${n}${t===1?``:`s`}`,expanded:e,expandedLabel:`Show fewer ${n}s`,onClick:r})}function gx(e){let t=[];return(e.origin!==void 0||e.decisions!==void 0||e.clarification!==void 0)&&t.push({id:`context`,label:`Context`,tone:`neutral`}),e.contract!==void 0&&t.push({id:`contract`,label:`Contract`,tone:`neutral`}),(e.result!==void 0||e.changes!==void 0)&&t.push({id:`result`,label:`Result`,tone:e.tone}),e.verification!==void 0&&t.push({id:`checks`,label:`Checks`,tone:cx(e.verification.checks)}),e.promotion!==void 0&&t.push({id:`promotion`,label:`Promotion`,tone:lx(e.promotion)}),e.checkpoint!==void 0&&t.push({id:`checkpoint`,label:`Checkpoint`,tone:e.tone}),t}function _x({trace:e}){let t=gx(e),n=e.links.filter(e=>e.onClick!==void 0),[r,i]=(0,N.useState)(()=>new Set),a=r.has(`origin`),o=r.has(`decisions`),s=r.has(`clarification-answers`),c=r.has(`scope`),l=r.has(`changes`),u=r.has(`checkpoint`),d=r.has(`generated-files`),f=e.origin?.snippets??[],p=e.decisions===void 0||o?e.decisions??[]:e.decisions.slice(0,px),m=e.clarification?.answers===void 0||s?e.clarification?.answers??[]:e.clarification.answers.slice(0,px),h=e.contract===void 0||c?e.contract?.scope??[]:e.contract.scope.slice(0,px),g=e.checkpoint===void 0||u?e.checkpoint?.items??[]:e.checkpoint.items.slice(0,px),_=e.checkpoint?.generatedFiles===void 0||d?e.checkpoint?.generatedFiles??[]:e.checkpoint.generatedFiles.slice(0,px);function v(e){i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:R(`timeline-trace-card`,`is-${e.tone}`),children:[e.summary===void 0||e.result!==void 0?null:(0,P.jsx)(`p`,{className:`timeline-trace-summary`,children:e.summary}),t.length===0?null:(0,P.jsx)(`ol`,{className:`timeline-trace-path`,"aria-label":`Recorded task trace`,children:t.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.tone}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`}),(0,P.jsx)(`strong`,{children:e.label})]},e.id))}),e.origin===void 0?null:(0,P.jsxs)(ox,{label:`Origin`,children:[e.origin.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.origin.title}),e.origin.summary===void 0?null:(0,P.jsx)(`p`,{children:e.origin.summary}),e.origin.unavailableReason===void 0?null:(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:e.origin.unavailableReason}),f.length>0?(0,P.jsx)(mx,{collapsedLabel:`Show ${f.length} source message${f.length===1?``:`s`}`,expanded:a,expandedLabel:`Show fewer source messages`,onClick:()=>v(`origin`)}):e.origin.sourceCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.origin.sourceCount,` source message`,e.origin.sourceCount===1?``:`s`]}),!a||f.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:f.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))})]}),e.decisions===void 0||e.decisions.length===0?null:(0,P.jsxs)(ox,{label:`Accepted Context`,children:[(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:p.map(e=>(0,P.jsxs)(`li`,{children:[e.title===void 0?null:(0,P.jsx)(ws,{tone:`neutral`,children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(hx,{expanded:o,hiddenCount:Math.max(e.decisions.length-px,0),label:`context item`,onClick:()=>v(`decisions`)})]}),e.clarification===void 0?null:(0,P.jsxs)(ox,{label:`Clarification`,children:[e.clarification.title===void 0?null:(0,P.jsx)(`strong`,{className:`timeline-trace-title`,children:e.clarification.title}),e.clarification.summary===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.summary}),e.clarification.request===void 0?null:(0,P.jsx)(`p`,{children:e.clarification.request}),e.clarification.status===void 0&&e.clarification.answerCount===void 0?null:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[e.clarification.status===void 0?null:(0,P.jsx)(ws,{tone:e.clarification.status===`active`?`warning`:`success`,children:e.clarification.status===`active`?`needs input`:`resolved`}),e.clarification.answerCount===void 0?null:(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.clarification.answerCount,` answer`,e.clarification.answerCount===1?``:`s`]})]}),e.clarification.answers===void 0||e.clarification.answers.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-snippet-list`,children:m.map(e=>(0,P.jsx)(`li`,{className:`timeline-trace-snippet`,children:e.onClick===void 0?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]}):(0,P.jsxs)(`button`,{className:`timeline-trace-snippet-button`,onClick:e.onClick,type:`button`,children:[(0,P.jsxs)(`span`,{children:[e.author,` · `,e.createdAt]}),(0,P.jsx)(`p`,{children:e.body})]})},e.id))}),e.clarification.answers===void 0?null:(0,P.jsx)(hx,{expanded:s,hiddenCount:Math.max(e.clarification.answers.length-px,0),label:`answer`,onClick:()=>v(`clarification-answers`)})]}),e.contract===void 0?null:(0,P.jsxs)(ox,{label:`Contract`,children:[(0,P.jsx)(`p`,{children:e.contract.goal}),h.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-list is-bulleted`,children:h.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`span`,{children:e})},`scope-${t}`))}),(0,P.jsx)(hx,{expanded:c,hiddenCount:Math.max(e.contract.scope.length-px,0),label:`scope item`,onClick:()=>v(`scope`)}),c&&e.contract.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional scope items are outside this bounded audit preview.`}):null]}),e.result===void 0?null:(0,P.jsxs)(ox,{label:`Result`,children:[(0,P.jsx)(`p`,{children:e.result.summary}),e.result.errorCode===void 0?null:(0,P.jsx)(`code`,{className:`timeline-trace-code`,children:e.result.errorCode})]}),e.changes===void 0?null:(0,P.jsxs)(ox,{label:`Changes`,children:[e.changes.items.length===0?(0,P.jsx)(`p`,{className:`timeline-trace-muted`,children:`No repo changes recorded.`}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(mx,{collapsedLabel:`Show ${e.changes.items.length} file change${e.changes.items.length===1?``:`s`}`,expanded:l,expandedLabel:`Show fewer file changes`,onClick:()=>v(`changes`)}),l?(0,P.jsx)(`ul`,{className:`timeline-trace-diff-list`,children:e.changes.items.map(e=>(0,P.jsxs)(`li`,{className:`is-${e.status}`,children:[(0,P.jsx)(`span`,{className:`timeline-trace-diff-mark`,children:fx(e.status)}),(0,P.jsx)(`code`,{children:e.previousPath===void 0?e.path:`${e.previousPath} -> ${e.path}`})]},`${e.status}:${e.path}`))}):null]}),l&&e.changes.totalCount>e.changes.items.length?(0,P.jsxs)(`small`,{className:`timeline-trace-muted`,children:[e.changes.totalCount-e.changes.items.length,` additional files are outside this bounded audit preview.`]}):null]}),e.verification===void 0?null:(0,P.jsx)(ox,{label:`Verification`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(ws,{tone:cx(e.verification.checks),children:sx(e.verification.checks)}),(0,P.jsx)(`p`,{children:ux(e.verification)})]})}),e.promotion===void 0?null:(0,P.jsx)(ox,{label:`Promotion`,children:(0,P.jsxs)(`div`,{className:`timeline-trace-inline`,children:[(0,P.jsx)(ws,{tone:lx(e.promotion),children:sx(e.promotion.status)}),(0,P.jsx)(`p`,{children:dx(e.promotion)})]})}),e.checkpoint===void 0?null:(0,P.jsxs)(ox,{label:`Checkpoint`,children:[(0,P.jsxs)(`div`,{className:`timeline-trace-counters`,children:[(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.completed,` completed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.failed,` failed`]}),(0,P.jsxs)(`span`,{children:[e.checkpoint.counters.remaining,` remaining`]})]}),(0,P.jsx)(`ul`,{className:`timeline-trace-list`,children:g.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(ws,{tone:e.status===`done`?`success`:`error`,children:e.status===`done`?`done`:`failed`}),(0,P.jsx)(`strong`,{children:e.title}),(0,P.jsx)(`span`,{children:e.summary})]},e.id))}),(0,P.jsx)(hx,{expanded:u,hiddenCount:Math.max(e.checkpoint.items.length-px,0),label:`checkpoint item`,onClick:()=>v(`checkpoint`)}),e.checkpoint.generatedFiles===void 0||e.checkpoint.generatedFiles.length===0?null:(0,P.jsx)(`ul`,{className:`timeline-trace-file-list`,children:_.map(e=>(0,P.jsxs)(`li`,{children:[(0,P.jsx)(`strong`,{children:e.name}),(0,P.jsx)(`code`,{children:e.path})]},e.id))}),e.checkpoint.generatedFiles===void 0?null:(0,P.jsx)(hx,{expanded:d,hiddenCount:Math.max(e.checkpoint.generatedFiles.length-px,0),label:`generated file`,onClick:()=>v(`generated-files`)}),(u||d)&&e.checkpoint.truncated===!0?(0,P.jsx)(`small`,{className:`timeline-trace-muted`,children:`Additional checkpoint evidence is outside this bounded audit preview.`}):null]}),n.length===0?null:(0,P.jsx)(ox,{label:`Links`,children:(0,P.jsx)(`div`,{className:`timeline-trace-links`,children:n.map(e=>(0,P.jsxs)(Cs,{className:`timeline-trace-link`,onClick:e.onClick,type:`button`,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),(0,P.jsx)(`span`,{children:e.label})]},e.id))})})]})}function vx({item:e,expanded:t,active:n,onActivate:r,onToggle:i}){let a=e.trace,o=a!==void 0,s=e.tone??`neutral`,c=s===`error`?(0,P.jsx)(ia,{"aria-hidden":`true`}):s===`warning`?(0,P.jsx)(Ii,{"aria-hidden":`true`}):s===`sync`?(0,P.jsx)(Mi,{"aria-hidden":`true`}):(0,P.jsx)(li,{"aria-hidden":`true`});return(0,P.jsxs)(`li`,{className:R(`timeline-event-item`,o?`has-trace`:void 0,t?`is-expanded`:void 0,n?`is-current`:void 0,e.tone===void 0?void 0:`is-${e.tone}`),id:`timeline-event-${e.id}`,children:[(0,P.jsx)(`time`,{className:`timeline-event-time`,children:e.occurredAt}),(0,P.jsx)(`div`,{className:`timeline-event-marker`,"aria-hidden":`true`}),(0,P.jsxs)(`div`,{className:`timeline-event-main`,children:[(0,P.jsxs)(`button`,{"aria-expanded":o?t:void 0,className:`timeline-event-toggle`,disabled:!o,onClick:()=>{r(),i()},type:`button`,children:[(0,P.jsx)(`span`,{className:R(`timeline-event-status-icon`,`is-${s}`),"aria-hidden":`true`,children:c}),(0,P.jsxs)(`span`,{className:`timeline-event-copy`,children:[(0,P.jsx)(`span`,{className:`timeline-event-stage`,children:e.stageLabel??(e.kind===`checkpoint`?`Checkpoint`:`Task event`)}),(0,P.jsxs)(`span`,{className:`timeline-event-title-line`,children:[(0,P.jsx)(`h4`,{children:e.taskTitle??e.title}),e.tokenLabel===void 0?null:(0,P.jsx)(`span`,{className:`timeline-event-token`,children:e.tokenLabel})]})]}),o?(0,P.jsx)(ui,{className:`timeline-event-chevron`,"aria-hidden":`true`}):null]}),a!==void 0&&t?(0,P.jsx)(_x,{trace:a}):null]})]})}function yx(e){let t=new Map;for(let n of e){let e=n.taskId===void 0?`event:${n.id}`:`task:${n.taskId}`,r=t.get(e);r===void 0?t.set(e,{id:e,title:n.taskTitle??n.title,...n.taskId===void 0?{}:{taskId:n.taskId},items:[n]}):r.items.push(n)}return[...t.values()]}function bx({tokenOverview:e,items:t,scoreUnits:n=[],empty:r,defaultExpandedItemIds:i,className:a,...o}){let[s,c]=(0,N.useState)(()=>new Set(i??[])),[l,u]=(0,N.useState)(()=>n.at(-1)?.id),[d,f]=(0,N.useState)(0),p=(0,N.useRef)(null),m=yx(t),h=new Set(t.flatMap(e=>e.taskId===void 0?[]:[e.taskId])).size;(0,N.useEffect)(()=>{if(n.length===0){u(void 0);return}(l===void 0||!n.some(e=>e.id===l))&&u(n.at(-1)?.id)},[l,n]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=e;t.scrollLeft=t.scrollWidth;function n(e){if(Math.abs(e.deltaY)<=Math.abs(e.deltaX))return;let n=Math.max(0,t.scrollWidth-t.clientWidth),r=Math.min(n,Math.max(0,t.scrollLeft+e.deltaY));r!==t.scrollLeft&&(e.preventDefault(),t.scrollLeft=r)}return t.addEventListener(`wheel`,n,{passive:!1}),()=>t.removeEventListener(`wheel`,n)},[n.length]),(0,N.useEffect)(()=>{let e=p.current;if(e===null)return;let t=()=>f(e.clientWidth);if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[n.length]);function g(e,t=!1){u(e),t&&(c(t=>new Set(t).add(e)),window.requestAnimationFrame(()=>{document.getElementById(`timeline-event-${e}`)?.scrollIntoView({behavior:`smooth`,block:`center`})}))}function _(e){c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsx)(ma,{className:R(`timeline-panel`,a),title:`Timeline`,icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),...o,children:(0,P.jsxs)(`div`,{className:`timeline-board-body`,children:[(0,P.jsxs)(`section`,{className:`timeline-events`,"aria-label":`Project timeline`,children:[(0,P.jsx)(`div`,{className:`timeline-audit-header`,children:(0,P.jsxs)(`div`,{className:`timeline-audit-intro`,children:[(0,P.jsx)(`h4`,{children:`Task traceability`}),(0,P.jsxs)(`div`,{className:`timeline-audit-meta`,"aria-label":`Timeline record summary`,children:[(0,P.jsx)(`span`,{children:h===1?`1 task`:`${h} tasks`}),(0,P.jsx)(`span`,{children:t.length===1?`1 record`:`${t.length} records`})]})]})}),t.length===0?r:(0,P.jsx)(`div`,{className:`timeline-task-groups`,children:m.map(e=>(0,P.jsxs)(`section`,{className:`timeline-task-group`,"aria-label":e.title,children:[(0,P.jsxs)(`header`,{className:`timeline-task-group-head`,children:[(0,P.jsx)(`span`,{children:e.taskId===void 0?`Project record`:`Task trace`}),(0,P.jsx)(`strong`,{children:e.title})]}),(0,P.jsx)(`ol`,{className:`timeline-event-list`,children:e.items.map(e=>(0,P.jsx)(vx,{active:l===e.id,expanded:s.has(e.id),item:e,onActivate:()=>g(e.id),onToggle:()=>_(e.id)},e.id))})]},e.id))})]}),(0,P.jsxs)(`section`,{className:`timeline-overview`,"aria-label":`Timeline score and token usage`,children:[n.length===0?null:(0,P.jsx)(`div`,{className:`timeline-score-index`,ref:p,role:`group`,"aria-label":`Timeline score index`,children:(0,P.jsx)(co,{"aria-label":`Timeline event score`,...l===void 0?{}:{activeUnitId:l},edgePadding:0,minimumWidth:d,onUnitSelect:e=>g(e,!0),openingBarline:`double`,openingClef:`treble`,horizontalSpacingScale:B,reveal:!0,scale:fo,units:n})}),(0,P.jsxs)(`div`,{className:`timeline-overview-token`,"aria-label":`Total tokens`,children:[(0,P.jsx)(`span`,{children:`Total tokens`}),(0,P.jsx)(`strong`,{children:e.totalLabel})]})]})]})})}var xx=new Intl.NumberFormat(`en-US`),Sx=Bo(`beethoven-ode-to-joy`);function Cx(e){return[...e].reverse().map((e,t)=>{let n=Sx.units[t%Sx.units.length];if(n===void 0)throw Error(`Timeline score theme unexpectedly has no units`);return{...n,id:e.id,label:`Open ${e.stageLabel??e.title}`}})}function wx(e){return xx.format(e)}function Tx(e){if(e!==void 0)switch(e){case`completed`:return`success`;case`failed`:return`error`;case`needs_human`:return`warning`}}function Ex(e){if(e.kind===`task_accepted`)return`Task accepted`;if(e.kind===`checkpoint`)return`Checkpoint`;switch(e.update_state){case`completed`:return`Task completed`;case`failed`:return`Task failed`;case`needs_input`:return`Needs input`;default:return`Task update`}}function Dx(e,t){let n=Date.parse(e.occurred_at),r=Date.parse(t.occurred_at),i=Number.isFinite(n)&&Number.isFinite(r)?r-n:t.occurred_at.localeCompare(e.occurred_at);return i===0?t.id.localeCompare(e.id):i}function Ox(e,t={}){let n=e.token_usage?.total_tokens??0,r=Tx(e.status),i={id:e.id,title:e.task_title??e.title,occurredAt:tr(e.occurred_at),kind:e.kind,stageLabel:Ex(e)};return r!==void 0&&(i.tone=r),n>0&&(i.tokenLabel=`${wx(n)} tokens`),e.task_id!==void 0&&(i.taskId=e.task_id),e.task_title!==void 0&&(i.taskTitle=e.task_title),e.trace_card!==void 0&&(i.trace=Ax(e.trace_card,t)),i}function kx(e,t){if(e.kind===`worklist_task`&&e.task_id!==void 0){let n=t.onOpenWorklistTask,r=e.task_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`chat_message`&&e.message_id!==void 0){let n=t.onOpenChatMessage,r=e.message_id;return n===void 0?void 0:()=>n(r)}if(e.kind===`reference_file`&&e.path!==void 0){let n=t.onOpenReferenceFile,r=e.path;return n===void 0?void 0:()=>n(r)}}function Ax(e,t={}){return{tone:e.tone,...e.summary===void 0?{}:{summary:e.summary},...e.origin===void 0?{}:{origin:{...e.origin.title===void 0?{}:{title:e.origin.title},...e.origin.summary===void 0?{}:{summary:e.origin.summary},...e.origin.unavailable_reason===void 0?{}:{unavailableReason:e.origin.unavailable_reason},...e.origin.source_count===void 0?{}:{sourceCount:e.origin.source_count},...e.origin.snippets===void 0?{}:{snippets:e.origin.snippets.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.decisions===void 0?{}:{decisions:e.decisions.map((e,t)=>({id:`${t}:${e.source??`decision`}`,...e.title===void 0?{}:{title:e.title},summary:e.summary}))},...e.clarification===void 0?{}:{clarification:{...e.clarification.title===void 0?{}:{title:e.clarification.title},...e.clarification.summary===void 0?{}:{summary:e.clarification.summary},...e.clarification.request===void 0?{}:{request:e.clarification.request},...e.clarification.status===void 0?{}:{status:e.clarification.status},...e.clarification.answer_count===void 0?{}:{answerCount:e.clarification.answer_count},...e.clarification.answers===void 0?{}:{answers:e.clarification.answers.map(e=>({id:e.message_id,author:e.author,body:e.body,createdAt:tr(e.created_at),...t.onOpenChatMessage===void 0?{}:{onClick:()=>t.onOpenChatMessage?.(e.message_id)}}))}}},...e.contract===void 0?{}:{contract:{goal:e.contract.goal,scope:e.contract.scope,...e.contract.truncated===void 0?{}:{truncated:e.contract.truncated}}},...e.result===void 0?{}:{result:{summary:e.result.summary,...e.result.error_code===void 0?{}:{errorCode:e.result.error_code}}},...e.changes===void 0?{}:{changes:{items:e.changes.items.map(e=>({status:e.status,path:e.path,...e.previous_path===void 0?{}:{previousPath:e.previous_path}})),totalCount:e.changes.total_count,truncated:e.changes.truncated}},...e.verification===void 0?{}:{verification:{checks:e.verification.checks,...e.verification.skip_reason_code===void 0?{}:{skipReasonCode:e.verification.skip_reason_code},...e.verification.skip_reason_summary===void 0?{}:{skipReasonSummary:e.verification.skip_reason_summary}}},...e.promotion===void 0?{}:{promotion:{status:e.promotion.status,...e.promotion.commit_short_oid===void 0?{}:{commitShortOid:e.promotion.commit_short_oid},...e.promotion.summary===void 0?{}:{summary:e.promotion.summary},...e.promotion.reason_code===void 0?{}:{reasonCode:e.promotion.reason_code}}},...e.checkpoint===void 0?{}:{checkpoint:{counters:e.checkpoint.counters,items:e.checkpoint.items.map(e=>({id:e.task_id,title:e.title,status:e.status,summary:e.summary})),...e.checkpoint.generated_files===void 0?{}:{generatedFiles:e.checkpoint.generated_files.map(e=>({id:e.path,name:e.name,path:e.path}))},...e.checkpoint.truncated===void 0?{}:{truncated:e.checkpoint.truncated}}},links:e.links.flatMap(e=>{let n=e.task_id??e.message_id??e.path,r=kx(e,t);return r===void 0?[]:[{id:`${e.kind}:${n??e.label}`,label:e.label,onClick:r}]})}}function jx(e,t={}){let n=e.usage_overview,r=[...e.items].sort(Dx).map(e=>Ox(e,t));return{tokenOverview:{totalLabel:wx(n.total_tokens)},items:r,scoreUnits:Cx(r)}}var Mx=[{id:`prepare`,label:`Preparing workspace`},{id:`implement`,label:`Implementing with Codex`},{id:`validate`,label:`Validating result`},{id:`save`,label:`Saving result`}],Nx=[{id:`workspace_inspect`,summary:`inspecting the persistent project workspace`,displayStageId:`prepare`},{id:`artifact_candidate_validate`,summary:`validating the candidate Artifact preview`,displayStageId:`validate`},{id:`provider_task_run`,summary:`running Codex task implementation`,displayStageId:`implement`},{id:`provider_retry`,summary:`retrying Codex task after a transient provider failure`,displayStageId:`implement`},{id:`candidate_diff_collect`,summary:`collecting candidate changes`,displayStageId:`validate`},{id:`checks`,summary:`running project checks`,displayStageId:`validate`},{id:`post_checks_diff_collect`,summary:`rechecking candidate changes after checks`,displayStageId:`validate`},{id:`accepted_checkpoint`,summary:`saving the validated project state as an accepted checkpoint`,displayStageId:`save`},{id:`promotion_reconcile`,summary:`reconciling promotion after mainline changed`,displayStageId:`save`},{id:`self_correction`,summary:`retrying task implementation after pipeline feedback`,displayStageId:`implement`}],Px={scratchpad_refresh:{key:`scratchpad_refresh`,label:`Refreshing Scratchpad`,target:{kind:`scratchpad`}},project_context_bootstrap:{key:`project_context_bootstrap`,label:`Preparing project context`,target:{kind:`scratchpad`}},task_compile:{key:`task_compile`,label:`Compiling Worklist tasks`,target:{kind:`scratchpad`}},context_sync:{key:`context_sync`,label:`Synchronizing project context`,target:{kind:`worklist`}},reference_summary_refresh:{key:`reference_summary_refresh`,label:`Processing reference`,target:{kind:`references`}},recovery_check:{key:`recovery_check`,label:`Recovering workspace`,target:{kind:`worklist`}},follow_up_check:{key:`follow_up_check`,label:`Checking follow-up`,target:{kind:`worklist`}}},Fx=`Execution progress`,Ix=new Set([`scratchpad_refresh`]),Lx=`task_compile`,Rx=`project_context_bootstrap`,zx={reading_context:`Codex is reading project context`,planning:`Codex is planning changes`,editing_files:`Codex is editing files`,running_command:`Codex is running a command`,using_tool:`Codex is using a tool`,waiting_for_approval:`Codex is waiting for approval`,finalizing:`Codex is finalizing the result`};function Bx(e){if(e===void 0)return null;if(typeof e==`number`)return Number.isFinite(e)?e:null;if(e instanceof Date)return e.getTime();let t=Date.parse(e);return Number.isNaN(t)?null:t}function Vx(e){return Bx(e.now)??Date.now()}function Hx(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;if(t<60)return`${t}m${n}s`;let r=Math.floor(t/60),i=t%60;return`${r}h${String(i).padStart(2,`0`)}m`}function Ux(e,t){let n=Bx(e);if(n!==null)return Hx(Math.max(0,Math.floor((Vx(t)-n)/1e3)))}function Wx(e,t){return Ux(e.active_activity?.started_at??e.runtime?.started_at,t)}function Gx(e){let t=e.runtime;if(t===void 0)return;let n=e.active_activity?.activity_ref;if(!(n!==void 0&&t.activity_ref!==n))return t}function Kx(e){if(e<1e3)return String(e);if(e<1e6){let t=e/1e3;return`${e<1e5?t.toFixed(1).replace(/\.0$/u,``):String(Math.round(t))}k`}return`${(e/1e6).toFixed(1).replace(/\.0$/u,``)}m`}function qx(e){let t=e?.token_usage?.total_tokens;return t===void 0?[]:[`${Kx(t)} tokens`]}function Jx(e){let t=e?.token_usage?.total_tokens;return t===void 0?void 0:`${Kx(t)} tokens`}function Yx(e){let t=e?.current_action;return t===void 0?void 0:zx[t]}function Xx(e){let t=Yx(e);if(t===void 0)return;let n=Jx(e);return n===void 0?t:`${t} (${n})`}function Zx(e){let t={};return e.active_activity?.activity_ref!==void 0&&(t.activityRef=e.active_activity.activity_ref),e.active_activity?.workflow_ref!==void 0&&(t.workflowRef=e.active_activity.workflow_ref),e.active_task?.id!==void 0&&(t.taskId=e.active_task.id),Object.keys(t).length===0?void 0:t}function Qx(e,t,n){return e===`context_sync`&&t.last_conclusion?.task_id!==void 0?{kind:`task`,taskId:t.last_conclusion.task_id}:n.target}function $x(e){return Nx[aS(e)]??Nx[0]}function eS(e){return Mx.findIndex(t=>t.id===e)}function tS(e){return Mx[eS($x(e).displayStageId)]??Mx[0]}function nS(e){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let t=e.active_activity.workflow_kind;if(t===void 0||Ix.has(t))return null;let n=Px[t],r=Qx(t,e,n);return{key:`procedure:${n.key}`,label:n.label,title:n.label,tone:`running`,target:r}}function rS(e,t){if(e.status!==`running`||e.active_activity?.activity_kind!==`procedure`)return null;let n=e.active_activity.workflow_kind;if(n===void 0||Ix.has(n))return null;let r=Px[n],i=Qx(n,e,r),a=Zx(e),o=Gx(e),s=n===Lx?qx(o):[],c=n===Rx?`Creating project context for the first time`:void 0,l=Ux(e.active_activity?.started_at??o?.started_at,t);return{key:`procedure:${r.key}`,title:Fx,summary:e.summary,tone:`running`,metaLabel:r.label,completionTarget:i,...a===void 0?{}:{completionSource:a},steps:[{id:`procedure:${r.key}:active`,label:r.label,status:`running`,...l===void 0?{}:{elapsedLabel:l},...c===void 0?{}:{detail:c},...s.length===0?{}:{metrics:s}}]}}function iS(e){let t=e.indexOf(` - `);return t===-1?``:e.slice(t+3).trim().replace(/\.$/u,``)}function aS(e){let t=iS(e).toLocaleLowerCase();if(t===``)return 0;let n=Nx.findIndex(e=>t.includes(e.summary.toLocaleLowerCase()));return n===-1?0:n}function oS(e,t){if(e.status!==`running`||e.active_task===void 0)return null;let n=eS($x(e.summary).displayStageId),r=tS(e.summary),i=Zx(e),a=Gx(e),o=Wx(e,t);return{key:`run:${e.active_task.id}`,title:Fx,summary:e.active_task.title,tone:`running`,metaLabel:r.label,completionTarget:{kind:`task`,taskId:e.active_task.id},...i===void 0?{}:{completionSource:i},steps:Mx.map((e,t)=>{let r=t<n?`done`:t===n?`running`:`waiting`,i=t===n,s=e.id===`implement`,c=i&&s?Xx(a):void 0,l=s&&c===void 0?qx(a):[];return{id:e.id,label:e.label,status:r,...i&&o!==void 0?{elapsedLabel:o}:{},...c===void 0?{}:{detail:c},...l.length>0?{metrics:l}:{}}})}}function sS(e,t){if(e.status!==`running`||e.active_activity?.workflow_kind!==`context_sync`||e.last_conclusion?.kind!==`completed`||e.last_conclusion.task_id===void 0)return null;let n=Zx(e),r=Wx(e,t);return{key:`context-sync:${e.last_conclusion.task_id}`,title:Fx,summary:e.summary,tone:`running`,metaLabel:`Synchronizing context`,completionTarget:{kind:`task`,taskId:e.last_conclusion.task_id},...n===void 0?{}:{completionSource:n},steps:[{id:`task_complete`,label:`Task completed`,status:`done`},{id:`context_sync`,label:`Synchronizing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r}}]}}function cS(e){let t=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};return{key:`pending:${e.blocked_by?.kind===`approval`?e.blocked_by.approval_id:e.blocked_by?.kind===`clarification`?e.blocked_by.round_id:e.updated_at}`,title:Fx,summary:e.summary,tone:`pending`,metaLabel:`Needs input`,completionTarget:t,steps:[{id:`waiting_for_input`,label:`Needs input`,status:`pending`}]}}function lS(e){let t=e.last_conclusion?.task_id??(e.status===`failed`?e.active_task?.id:void 0);return t===void 0&&e.status!==`failed`?null:{key:`failed:${t??e.updated_at}`,title:Fx,summary:e.last_conclusion?.summary??e.summary,tone:`failed`,metaLabel:`Failed`,...t===void 0?{}:{completionTarget:{kind:`task`,taskId:t}},steps:[{id:`run_failed`,label:`Run failed`,status:`failed`}]}}function uS(e,t={}){let n=oS(e,t);if(n!==null)return n;let r=sS(e,t);if(r!==null)return r;let i=rS(e,t);return i===null?e.status===`pending`?cS(e):e.status===`failed`?lS(e):null:i}function dS(e){let t=e.activeTaskCompileClarification&&!e.activeScratchpadRefreshFromSubmit&&!e.activeProjectContextBootstrap&&!e.activeTaskCompile,n=[],r=Ux(e.startedAt,e);if(e.activeProjectContextBootstrap)n.push({id:`scratchpad_submit:project_context`,label:`Preparing project context`,status:`running`,...r===void 0?{}:{elapsedLabel:r},detail:`Creating project context for the first time`});else if(e.activeTaskCompile||e.activeScratchpadRefreshFromSubmit){let t=e.activeTaskCompile?qx(e.runtime):[];n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:`running`,...r===void 0?{}:{elapsedLabel:r},...t.length===0?{}:{metrics:t}})}else n.push({id:`scratchpad_submit:task_compile`,label:`Compiling Worklist tasks`,status:t?`done`:`running`});t&&n.push({id:`scratchpad_submit:needs_input`,label:`Needs input`,status:`pending`});let i=n.find(e=>e.status===`running`||e.status===`pending`)?.label??`Compiling Worklist tasks`;return{key:`scratchpad-submit`,title:Fx,summary:t?`Task compilation needs a decision before Worklist can update.`:`Preparing the Scratchpad for formal tasks.`,tone:t?`pending`:`running`,metaLabel:t?`Needs input`:i,completionTarget:t?{kind:`clarification`}:{kind:`scratchpad`},steps:n}}function fS(e,t){return{...e,key:`${e.key}:complete`,title:Fx,summary:t,tone:`complete`,metaLabel:`Complete`,steps:e.steps.map(e=>({...e,status:`done`}))}}function pS(e,t){let n=e.completionSource;return n===void 0?!0:n.activityRef===void 0?n.workflowRef===void 0?n.taskId===void 0?!0:t.task_id===n.taskId:t.workflow_ref===n.workflowRef:t.activity_ref===n.activityRef}function mS(e){if(e.status===`idle`)return[];let t=[];if(e.status===`pending`){let n=e.blocked_by?.kind===`approval`?{kind:`approval`}:{kind:`clarification`};t.push({key:`pending`,label:`Needs input`,title:`Needs input`,tone:`pending`,target:n})}let n=e.last_conclusion?.kind===`failed`?e.last_conclusion.task_id:e.status===`failed`?e.active_task?.id??e.last_conclusion?.task_id:void 0;if(n!==void 0&&t.push({key:`failed`,label:`Run failed`,tone:`failed`,target:{kind:`task`,taskId:n}}),e.status===`running`&&e.active_task!==void 0){let n=tS(e.summary);t.push({key:`running`,label:n.label,title:n.label,tone:`running`,target:{kind:`task`,taskId:e.active_task.id}})}let r=nS(e);return r!==null&&t.push(r),t}var hS=`/assets/beethoven-symphony-5-opening-ypVy5SB4.svg`,gS=`/assets/beethoven-symphony-7-allegretto-B3bc-cZD.svg`,_S=`/assets/dvorak-symphony-9-largo-BEgNL3HB.svg`,vS=`/assets/mozart-symphony-18-allegro-B5-MrLL1.svg`,yS=`/assets/Tutti-square-BqFU7F0D.png`,bS=`/assets/Tutti-B7gEyTp1.png`,xS=`/assets/tutti_avatar-BBhaZGi3.png`,SS=`/assets/avatar-avery-CkLXb185.svg`,CS=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-7dff0831'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-shortCurls-7dff0831'%3e%3cpath%20d='m15.3%2027.49%201.58%204.38%201.06-9.52s2.27%201.27%203.44-.26.16-3.47.16-3.47%201.81.55%203.31-.8c1.87-1.67%201.26-3.46%201.26-3.46s1.71%201.9%204.5%201.1c2.77-.8%203.14-2.76%203.14-2.76s.56%202.18%203.4%202.12%203.2-2.01%203.2-2.01%200%202.43%202.43%203.14%203.43-1.24%203.43-1.24c0%20.02-.9%202.39.66%203.76%201.44%201.26%203.5.35%203.5.35s-.73%202.3.77%203.62c1.6%201.4%203.48.6%203.48.6l.77%208.34%201.8-3.8s1.4-.13%202.72.15c0%20.01%202.58-2.78%201.15-5.9s-3.64-2.86-3.64-2.86%201.95-3.05.13-5.65-4.94-1.96-4.94-1.96%201.18-3.52-1.68-5.27-5.92.46-5.92.46-.1-3.7-3.2-4.16c-3.26-.48-4.58%202.66-4.58%202.66s-1.35-2.89-4.14-2.44c-2.8.44-3.32%203.53-3.32%203.53S27.32%203.57%2024.92%205s-1.8%204.51-1.8%204.51-2.98-2.24-5.32-.23-.14%205.1-.14%205.1-3.87-1.12-5.04%201.8%201.66%204.95%201.66%204.95-5.35%201.16-2.82%207.33c0%200%20.6-.27%202.02-.62s1.8-.38%201.8-.38z'%20fill='%23000000'/%3e%3c/g%3e%3cclipPath%20id='clip-7dff0831'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-7dff0831)'%3e%3crect%20width='80'%20height='80'%20fill='%23e5f4ec'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-7dff0831'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-shortCurls-7dff0831'/%3e%3c/g%3e%3c/svg%3e`,wS=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2080%2080'%20fill='none'%20shape-rendering='auto'%20aria-hidden='true'%3e%3c!--%20Generated%20by%20DiceBear%20(https://dicebear.com)%20--%3e%3cmetadata%20xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23'%20xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'%20xmlns:dc='http://purl.org/dc/elements/1.1/'%20xmlns:dcterms='http://purl.org/dc/terms/'%3e%3crdf:RDF%3e%3crdf:Description%3e%3cdc:title%3eDylan!%20The%20Avatar%20Generator%3c/dc:title%3e%3cdc:creator%3eNatalia%20Spivak%3c/dc:creator%3e%3cdc:source%20xsi:type='dcterms:URI'%3ehttps://www.figma.com/community/file/1356575240759683500%3c/dc:source%3e%3cdcterms:license%20xsi:type='dcterms:URI'%3ehttps://creativecommons.org/licenses/by/4.0/%3c/dcterms:license%3e%3cdc:rights%3eRemix%20of%20“Dylan!%20The%20Avatar%20Generator”%20(https://www.figma.com/community/file/1356575240759683500)%20by%20“Natalia%20Spivak”,%20licensed%20under%20“CC%20BY%204.0”%20(https://creativecommons.org/licenses/by/4.0/)%3c/dc:rights%3e%3c/rdf:Description%3e%3c/rdf:RDF%3e%3c/metadata%3e%3cdefs%3e%3cg%20id='mood-happy-46c131e2'%3e%3cpath%20d='M.04%2017.04c2.41%209.29%2015.16%2012.28%2022.34%206.67a14%2014%200%200%200%204.7-7.22c.36-1.28-1.57-1.8-1.93-.57-1.24%204.23-4.33%207.4-8.68%208.33-3.77.8-8.03-.1-11.05-2.52a10%2010%200%200%201-3.45-5.26c-.32-1.25-2.25-.72-1.93.53'%20fill='black'/%3e%3c/g%3e%3cg%20id='hair-fluffy-46c131e2'%3e%3cpath%20d='M16.45%2029.48s13.74%2023.53%203.86%2028.24C9.05%2063.08-1.2%2048.01.1%2036.77s10.96-16.35%2010.96-16.35-.58-9.5%209.2-15.04c9.78-5.55%2016.64.44%2016.64.44s8.06-5.9%2015.5-1.37c7.46%204.53%207.26%2014.68%207.26%2014.68s13.74-.56%2013.65%2016.47c-.08%2015.17-10.03%2022.94-16.8%2021.6-10.45-2.07%201.27-29.22%201.27-29.22s-14.4%201.04-20.14-9.75c0%200-4%205.95-9.7%208.62a32%2032%200%200%201-11.47%202.64z'%20fill='%231d5dff'/%3e%3c/g%3e%3cclipPath%20id='clip-46c131e2'%3e%3crect%20width='80'%20height='80'%20rx='0'%20ry='0'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23clip-46c131e2)'%3e%3crect%20width='80'%20height='80'%20fill='%23fbf0d1'/%3e%3cpath%20d='M19.07%2030.47s1.57-20.23%2021.59-20.23S62.3%2030.55%2062.3%2030.55s9.43-.8%209.43%207.6c0%208.42-9.28%207.13-9.28%207.13S60.9%2067.15%2042.03%2067.15c-21.11%200-23.4-20.8-23.4-20.8s-9%20.72-9.93-6.25c-1.08-8.2%2010.37-9.64%2010.37-9.64'%20fill='%23c26450'/%3e%3cpath%20d='m64.3%2039.49.46-.41.1-.09c.12-.1-.13.1-.02.02l.24-.17q.5-.35%201.06-.62l.26-.12.05-.02.05-.02.58-.21q.6-.18%201.2-.28c.52-.08.85-.76.7-1.23-.18-.56-.67-.8-1.23-.7a9.3%209.3%200%200%200-4.87%202.43c-.38.36-.4%201.06%200%201.4.4.36%201%20.4%201.4%200zm-51.8-1.16.14.01c-.27-.02-.11-.01-.04%200l.3.05.52.14.28.09.12.05c.02%200%20.22.09.06.02-.14-.1%200-.04.03-.03l.15.06.26.13.47.3.27.22q.47.38.83.83c.33.4%201.07.37%201.41%200%20.4-.43.36-.98%200-1.4a7.3%207.3%200%200%200-4.84-2.53c-.52-.06-1.02.5-1%201%20.03.59.44.94%201%201m18.3-1.9v4.54c0%20.52.46%201.02%201%201s1-.44%201-1V36.4c0-.52-.46-1.02-1-1s-1%20.44-1%201M49.2%2036l-.15%204.81a1%201%200%200%200%201%201c.56-.02.98-.44%201-1l.15-4.8a1%201%200%200%200-1-1%201%201%200%200%200-1%201'%20fill='black'/%3e%3cuse%20transform='translate(27.82%2026.75)'%20href='%23mood-happy-46c131e2'/%3e%3cuse%20transform='translate(3.78%202.95)'%20href='%23hair-fluffy-46c131e2'/%3e%3c/g%3e%3c/svg%3e`,TS=`/assets/ode-to-joy-SNBUPr3-.svg`,ES=yS,DS=bS,OS=xS,kS={logoSrc:bS,tuttiAvatarSrc:xS,scoreSrc:TS,humanAvatars:{fey:CS,avery:SS,jun:wS}};function AS({onClick:e}){let t=(0,P.jsx)(Ds,{src:DS,label:`Tutti`});return e===void 0?t:(0,P.jsx)(Os,{logo:t,label:`Tutti Project Center`,onClick:e})}function jS({onClick:e}){return(0,P.jsx)(Os,{logo:(0,P.jsx)(Ds,{src:DS,className:`tutti-logo`}),onClick:e})}var MS=[hS,gS,_S,vS];function NS(){return MS[Math.min(MS.length-1,Math.floor(Math.random()*MS.length))]}function PS({backgroundPattern:e,children:t,...n}){let[r]=(0,N.useState)(NS);return(0,P.jsx)(Vo,{...e===void 0?{backgroundImageSrc:r}:{backgroundPattern:e},...n,children:t})}function FS({actions:e,children:t,onBrandClick:n}){return(0,P.jsxs)(PS,{children:[(0,P.jsx)(Ho,{brand:(0,P.jsx)(jS,{onClick:n}),actions:e}),t]})}function IS({children:e,label:t,onBrandClick:n}){return(0,P.jsx)(FS,{onBrandClick:n,children:(0,P.jsx)(Wo,{"aria-label":t,children:e})})}function LS({auth:e,mobileAuth:t,onBrandClick:n}){return(0,P.jsx)(PS,{backgroundPattern:`dots`,className:`homepage-entry-page`,children:(0,P.jsx)(cd,{brand:(0,P.jsx)(jS,{onClick:n}),visual:(0,P.jsx)(Vd,{assets:kS}),auth:e,mobileAuth:t})})}function RS({phase:e,form:t,onChange:n}){return e===`code`?(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ns,{label:`Email verification code`,children:(0,P.jsx)(ks,{autoComplete:`one-time-code`,inputMode:`numeric`,type:`text`,value:t.code,onChange:e=>n({code:e.target.value}),placeholder:`Enter email code`,maxLength:6})})}):e===`profile`?(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ns,{label:`Display name`,children:(0,P.jsx)(ks,{autoComplete:`name`,type:`text`,value:t.displayName,onChange:e=>n({displayName:e.target.value}),placeholder:`username`})}),(0,P.jsx)(`p`,{className:`form-note`,children:`This name cannot be changed yet.`})]}):(0,P.jsx)(`div`,{className:`form-stack`,children:(0,P.jsx)(Ns,{label:`Email`,children:(0,P.jsx)(ks,{autoComplete:`email`,type:`email`,value:t.email,onChange:e=>n({email:e.target.value}),placeholder:`alex@example.com`})})})}function zS({surface:e,phase:t,form:n,pending:r,error:i,submitDisabled:a,submitLabel:o,pendingLabel:s,onChange:c,onSubmit:l,onBack:u}){let d={title:t===`profile`?`Choose display name`:`Sign in`,description:t===`profile`?`Set the name your teammates will see.`:t===`code`?`Enter your email verification code.`:`Use your email to continue.`,onSubmit:l,action:(0,P.jsxs)(Ss,{type:`submit`,disabled:a||r,children:[r?s??(t===`profile`?`Saving`:t===`code`?`Verifying`:`Sending code`):o??(t===`profile`?`Save name`:t===`code`?`Verify email code`:`Send code`),(0,P.jsx)(ai,{"aria-hidden":`true`})]}),secondaryAction:t===`code`&&u!==void 0?(0,P.jsxs)(Cs,{type:`button`,onClick:u,disabled:r,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:i===null?void 0:(0,P.jsx)(Ps,{children:i}),children:(0,P.jsx)(RS,{phase:t,form:n,onChange:c})};return e===`card`?(0,P.jsx)(Xd,{...d}):(0,P.jsx)(ld,{...d})}function BS(e){return(0,P.jsx)(zS,{...e,surface:`card`})}function VS(e){return(0,P.jsx)(zS,{...e,surface:`rail`})}function HS({onBrandClick:e,...t}){return(0,P.jsx)(LS,{onBrandClick:e,auth:(0,P.jsx)(VS,{...t}),mobileAuth:(0,P.jsx)(BS,{...t})})}function US({nextKind:e,actionPending:t,loginForm:n,onRetry:r,onAccept:i,onOpen:a}){if(e===`loading`)return(0,P.jsx)(Cs,{type:`button`,disabled:!0,children:`Loading`});if(e===`error`)return(0,P.jsx)(Cs,{type:`button`,onClick:r,children:`Retry`});if(e===`invalid_or_expired`)return(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(na,{"aria-hidden":`true`}),`Invalid invite`]});if(e===`login_required`){let e=n?.phase===`profile`?`Save name`:n?.phase===`code`?`Verify email code`:`Send code`,r=n?.phase===`profile`?`Saving`:n?.phase===`code`?`Verifying`:`Sending code`;return(0,P.jsxs)(Ss,{type:`submit`,disabled:t||n?.submitDisabled===!0,children:[t?r:e,(0,P.jsx)(ai,{"aria-hidden":`true`})]})}return e===`accept_join`?(0,P.jsxs)(Ss,{type:`button`,disabled:t,onClick:i,children:[t?`Joining`:`Accept and open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):e===`open_workspace`?(0,P.jsxs)(Ss,{type:`button`,disabled:t,onClick:a,children:[t?`Opening`:`Open workspace`,(0,P.jsx)(ai,{"aria-hidden":`true`})]}):(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(Hi,{"aria-hidden":`true`}),`Host offline`]})}function WS({nextKind:e,error:t}){return e===`loading`?null:e===`error`?(0,P.jsx)(aa,{tone:`error`,icon:(0,P.jsx)(na,{"aria-hidden":`true`}),children:t??`Invite unavailable`}):e===`invalid_or_expired`?(0,P.jsx)(aa,{tone:`error`,icon:(0,P.jsx)(na,{"aria-hidden":`true`}),children:`Join token is invalid or expired`}):e===`host_offline`?(0,P.jsx)(aa,{tone:`warning`,icon:(0,P.jsx)(Hi,{"aria-hidden":`true`}),children:`Host is offline`}):null}function GS({projectName:e,description:t,hostLabel:n,hostOnline:r,nextKind:i,accountLabel:a,membershipLabel:o,actionPending:s,error:c,loginForm:l,onBrandClick:u,onRetry:d,onAccept:f,onOpen:p}){let m=i===`login_required`&&l!==void 0;return(0,P.jsx)(IS,{label:`Join project`,onBrandClick:u,children:(0,P.jsxs)(Xd,{title:`Join project`,description:t,onSubmit:e=>{if(m){l.onSubmit(e);return}e.preventDefault()},action:(0,P.jsx)(US,{nextKind:i,actionPending:m?l.pending:s,...m?{loginForm:l}:{},onAccept:f,onOpen:p,...d===void 0?{}:{onRetry:d}}),secondaryAction:m&&l.phase===`code`&&l.onBack!==void 0?(0,P.jsxs)(Cs,{type:`button`,onClick:l.onBack,disabled:l.pending,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Change email`]}):void 0,feedback:(0,P.jsxs)(P.Fragment,{children:[m&&l.error!==null?(0,P.jsx)(Ps,{children:l.error}):null,(0,P.jsx)(WS,{nextKind:i,error:c}),c===null||i===`error`?null:(0,P.jsx)(Ps,{children:c})]}),children:[(0,P.jsx)(Zd,{projectName:e,hostLabel:n,hostOnline:r}),m?(0,P.jsx)(P.Fragment,{children:(0,P.jsx)(RS,{phase:l.phase,form:l.form,onChange:l.onChange})}):(0,P.jsx)(Qd,{label:a===null?`Account`:`Signed in as`,value:a??`Sign in required`,action:o===null?null:(0,P.jsx)(`span`,{className:`quiet-link`,children:o})})]})})}var KS=`https://developers.openai.com/api/reference/resources/responses`;function qS(e){switch(e.status){case`online`:return`Online`;case`reconnecting`:return`Reconnecting`;case`relay-unavailable`:return`Relay unavailable`;case`stale`:return`Needs restart`;case`stopped`:return`Stopped`;case`workspace-missing`:return`Folder missing`;case`workspace-replaced`:return`Folder changed`;case`invalid`:return`Needs attention`}}function JS(e){return(e.status===`online`||e.status===`reconnecting`)&&e.provider_status===`configured`}function YS(e){return(e.status===`stopped`||e.status===`stale`||e.status===`relay-unavailable`)&&e.provider_status===`configured`}function XS(e,t){let n=Date.parse(e.activity_at??``),r=Date.parse(t.activity_at??``),i=Number.isNaN(n)?0:n;return(Number.isNaN(r)?0:r)-i||e.display_name.localeCompare(t.display_name,`en`)||e.project_id.localeCompare(t.project_id,`en`)}function ZS(e){return e.provider_status===`configured`?e.provider_model?.trim()||`Provider ready`:e.provider_status===`invalid`?`Provider issue`:`Provider needed`}function QS({project:e,pending:t,onLaunch:n,onOpen:r,onCopyInvite:i,onStop:a}){return e.status===`online`||e.status===`reconnecting`?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(Ss,{type:`button`,disabled:t||e.open_url===void 0,onClick:r,children:[(0,P.jsx)(yi,{"aria-hidden":`true`}),`Open`]}),(0,P.jsxs)(Cs,{type:`button`,disabled:t,onClick:i,children:[(0,P.jsx)(Ai,{"aria-hidden":`true`}),`Invite`]}),(0,P.jsxs)(Cs,{type:`button`,disabled:t,onClick:a,children:[(0,P.jsx)(Qi,{"aria-hidden":`true`}),`Stop`]})]}):(0,P.jsxs)(Cs,{type:`button`,disabled:t||!YS(e),onClick:n,children:[(0,P.jsx)(Wi,{"aria-hidden":`true`}),`Resume`]})}function $S({form:e,models:t,projects:n,projectsLoading:r,sessionLoading:i,sessionError:a,createOpen:o,createStep:s,modelDiscoveryPending:c,launchPending:l,projectActionPending:u,onChange:d,onCreateOpenChange:f,onCreateSubmit:p,onCreateBack:m,onChooseFolder:h,onRefresh:g,onLaunchExisting:_,onOpenProject:v,onCopyInvite:y,onStopProject:b}){let x=[`Folder`,`Details`,`Provider`,`Model`],S=x.findIndex(e=>e.toLowerCase()===s),C=c||l,w=s===`folder`?e.workspacePath.trim()!==``:s===`details`?e.displayName.trim()!==``:s===`provider`?e.baseUrl.trim()!==``&&e.apiKey.trim()!==``:t.length>0&&e.model.trim()!==``,T=n.filter(JS).sort(XS),E=n.filter(YS).sort(XS),ee=n.filter(e=>!JS(e)&&!YS(e)).sort(XS),D=e=>(0,P.jsx)(gf,{title:e.display_name,statusLabel:qS(e),online:e.status===`online`,path:e.workspace_path,createdLabel:Qn(e.created_at),providerLabel:ZS(e),providerStatus:e.provider_status,actions:(0,P.jsx)(QS,{project:e,pending:u===e.project_id,onLaunch:()=>_(e),onOpen:()=>v(e),onCopyInvite:()=>y(e),onStop:()=>b(e)})},e.project_id);return(0,P.jsx)(FS,{onBrandClick:g,children:(0,P.jsxs)(Uo,{children:[(0,P.jsxs)($d,{className:`local-console-card`,title:`Local projects`,accountAction:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(xs,{type:`button`,label:`Refresh projects`,icon:(0,P.jsx)(Ui,{"aria-hidden":`true`}),disabled:r,onClick:g}),(0,P.jsxs)(Ss,{type:`button`,disabled:i||a!==null,onClick:()=>f(!0),children:[(0,P.jsx)(Vi,{"aria-hidden":`true`}),`New project`]})]}),"aria-label":`Tutti Local Console`,children:[r||i?(0,P.jsx)(af,{"aria-label":`Machine projects`,children:(0,P.jsx)(cf,{"aria-label":`Loading local projects`,children:(0,P.jsx)(oa,{})})}):a===null?n.length===0?(0,P.jsx)(af,{"aria-label":`Machine projects`,children:(0,P.jsx)(cf,{children:(0,P.jsx)(aa,{children:`Create your first local project.`})})}):null:(0,P.jsx)(af,{"aria-label":`Machine projects`,children:(0,P.jsx)(cf,{children:(0,P.jsx)(aa,{children:a})})}),r||i||n.length===0?null:(0,P.jsxs)(P.Fragment,{children:[T.length===0?null:(0,P.jsx)(mf,{title:`Available`,"aria-label":`Available projects`,children:T.map(D)}),E.length===0?null:(0,P.jsx)(mf,{title:`Ready to resume`,"aria-label":`Projects ready to resume`,children:E.map(D)}),ee.length===0?null:(0,P.jsx)(hf,{children:ee.map(D)})]})]}),(0,P.jsxs)(uf,{open:o,onOpenChange:f,steps:x,currentStep:Math.max(0,S),closeDisabled:C,explicitCloseOnly:!0,onSubmit:p,backAction:s===`folder`?void 0:(0,P.jsxs)(Cs,{type:`button`,disabled:C,onClick:m,children:[(0,P.jsx)(ii,{"aria-hidden":`true`}),`Back`]}),action:(0,P.jsxs)(Ss,{type:`submit`,disabled:!w||C||i,children:[s===`model`?(0,P.jsx)(Wi,{"aria-hidden":`true`}):(0,P.jsx)(ai,{"aria-hidden":`true`}),s===`provider`&&c?`Checking provider`:s===`model`?l?`Launching`:`Launch and continue`:`Continue`]}),children:[s===`folder`?(0,P.jsx)(pf,{title:`Project folder`,description:`Choose an existing folder on this machine. It can be empty or contain an existing project.`,children:(0,P.jsxs)(ff,{children:[(0,P.jsx)(ks,{"aria-label":`Project folder`,autoComplete:`off`,value:e.workspacePath,onChange:e=>d({workspacePath:e.target.value}),placeholder:`Enter an absolute project folder path`,autoFocus:!0}),(0,P.jsxs)(Cs,{type:`button`,onClick:h,children:[(0,P.jsx)(wi,{"aria-hidden":`true`}),`Choose folder`]})]})}):null,s===`details`?(0,P.jsx)(pf,{title:`Project details`,description:`Describe what you want to build with this project.`,children:(0,P.jsxs)(df,{children:[(0,P.jsx)(Ns,{label:`Project name`,className:`local-console-field-wide`,children:(0,P.jsx)(ks,{autoComplete:`off`,value:e.displayName,maxLength:80,onChange:e=>d({displayName:e.target.value}),placeholder:`Enter a project name`,autoFocus:!0})}),(0,P.jsx)(Ns,{label:`Project description (optional)`,className:`local-console-field-wide`,children:(0,P.jsx)(As,{value:e.description,maxLength:160,onChange:e=>d({description:e.target.value}),placeholder:`A short project description helps Tutti produce better code`})})]})}):null,s===`provider`?(0,P.jsx)(pf,{title:`Provider`,description:(0,P.jsxs)(P.Fragment,{children:[`Enter an endpoint compatible with the`,` `,(0,P.jsx)(Fs,{href:KS,"aria-label":`OpenAI Responses API documentation (opens in a new tab)`,icon:(0,P.jsx)(pi,{"aria-hidden":`true`}),children:`OpenAI Responses API`}),`. Credentials stay only on this machine.`]}),children:(0,P.jsxs)(df,{children:[(0,P.jsx)(Ns,{label:`Base URL`,children:(0,P.jsx)(ks,{autoComplete:`off`,inputMode:`url`,type:`url`,value:e.baseUrl,onChange:e=>d({baseUrl:e.target.value}),placeholder:`Enter Provider Base URL`,autoFocus:!0})}),(0,P.jsx)(Ns,{label:`API key`,children:(0,P.jsx)(ks,{autoComplete:`off`,type:`password`,value:e.apiKey,onChange:e=>d({apiKey:e.target.value}),placeholder:`Enter API key`})})]})}):null,s===`model`?(0,P.jsx)(pf,{title:`Model`,description:`Choose an available model or type another model name.`,children:(0,P.jsx)(Ns,{label:`Model`,children:(0,P.jsx)(js,{autoComplete:`off`,value:e.model,options:t,maxVisibleOptions:8,onValueChange:e=>d({model:e}),placeholder:`Choose or enter a model`,autoFocus:!0})})}):null]})]})})}function eC({onBrandClick:e,sessionError:t=null,...n}){let r={...n,error:n.error??t};return(0,P.jsx)(LS,{onBrandClick:e,auth:(0,P.jsx)(VS,{...r}),mobileAuth:(0,P.jsx)(BS,{...r})})}function tC({account:e,projects:t,loading:n,error:r,openPending:i,logoutPending:a,joinLinkForm:o,onCopyLaunchCommands:s,onBrandClick:c,onLogout:l,onOpenProject:u}){let d=n||r!==null||t.length>0,f=t.filter(e=>e.hostStatus===`offline`),p=t.filter(e=>e.hostStatus!==`offline`),m=e=>(0,P.jsx)(sf,{title:e.displayName,statusLabel:`Host ${e.hostStatusLabel.toLowerCase()}`,online:e.canOpen,details:[{label:`Role`,value:e.membershipLabel},{label:`Opened`,value:e.lastOpenedLabel}],disabled:!e.canOpen||i,onClick:()=>u(e.relayProjectRef)},e.relayProjectRef);return(0,P.jsx)(FS,{onBrandClick:c,children:(0,P.jsx)(Uo,{children:(0,P.jsxs)($d,{title:`Projects`,...e===null?{}:{accountName:e.displayName,accountAction:(0,P.jsxs)(Cs,{type:`button`,onClick:l,disabled:a,children:[(0,P.jsx)(Ni,{"aria-hidden":`true`}),`Sign out`]})},"aria-label":`Project Center`,children:[(0,P.jsxs)(ef,{children:[(0,P.jsx)(nf,{title:`Join a project`,description:`Paste an invitation link or the full invitation message.`,inputLabel:`Invitation link or message`,placeholder:`Paste an invitation link or message`,value:o.value,error:o.error,onValueChange:o.onChange,"aria-label":`Join a project`,onSubmit:e=>{e.preventDefault(),o.onSubmit()}}),(0,P.jsx)(rf,{title:`Launch from your computer`,description:`Tutti turns a local project into a collaboration space for your team.`,commandLines:[`npm install -g @xfey/tutti`,`tutti`],onCopyCommands:s,"aria-label":`Launch a project from your computer`})]}),d?n?(0,P.jsx)(af,{children:(0,P.jsx)(cf,{"aria-label":`Loading projects`,children:(0,P.jsx)(oa,{})})}):r===null?(0,P.jsxs)(P.Fragment,{children:[p.length===0?null:(0,P.jsx)(af,{children:p.map(m)}),f.length===0?null:(0,P.jsx)(of,{title:`Host offline`,listLabel:`Host offline projects`,className:`project-center-offline-projects`,children:f.map(m)})]}):(0,P.jsx)(af,{children:(0,P.jsx)(cf,{"aria-label":`Project Center error`,children:(0,P.jsx)(aa,{tone:`error`,children:r})})}):null]})})})}function nC({form:e,pending:t,tokenMissing:n,onChange:r}){return(0,P.jsxs)(`div`,{className:`form-stack`,children:[(0,P.jsx)(Ns,{label:`Project name`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.projectName,onChange:e=>r({projectName:e.target.value}),placeholder:`tutti-default`})}),(0,P.jsx)(Ns,{label:`OpenAI API key`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`password`,value:e.apiKey,onChange:e=>r({apiKey:e.target.value}),placeholder:`sk-...`})}),(0,P.jsx)(Ns,{label:`Base URL`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`url`,value:e.baseUrl,onChange:e=>r({baseUrl:e.target.value}),placeholder:`https://api.openai.com/v1`})}),(0,P.jsx)(Ns,{label:`Default model`,children:(0,P.jsx)(ks,{autoComplete:`off`,disabled:t||n,type:`text`,value:e.defaultModel,onChange:e=>r({defaultModel:e.target.value}),placeholder:`gpt-5.5`})})]})}function rC({form:e,statusLabel:t,configured:n,loading:r,pending:i,openProjectPending:a=!1,tokenMissing:o,error:s,success:c,onChange:l,onSubmit:u,onRetry:d,onBrandClick:f}){let p=i||a;return(0,P.jsx)(IS,{label:`Project setup`,onBrandClick:f,children:(0,P.jsxs)(Xd,{title:`Project setup`,description:`Configure the provider for this project.`,size:`wide`,onSubmit:u,action:o?(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(na,{"aria-hidden":`true`}),`Missing token`]}):s!==null&&r?(0,P.jsx)(Cs,{type:`button`,onClick:d,children:`Retry`}):a?(0,P.jsxs)(Cs,{type:`button`,disabled:!0,children:[(0,P.jsx)(ai,{"aria-hidden":`true`}),`Opening project`]}):(0,P.jsxs)(Ss,{type:`submit`,disabled:i||e.apiKey.trim()===``||e.projectName.trim()===``,children:[i?`Saving`:`Save provider`,(0,P.jsx)(Gi,{"aria-hidden":`true`})]}),feedback:(0,P.jsxs)(P.Fragment,{children:[c===null?null:(0,P.jsx)(aa,{icon:(0,P.jsx)(fi,{"aria-hidden":`true`}),children:c}),s===null?null:(0,P.jsx)(Ps,{children:s})]}),children:[(0,P.jsx)(Zd,{projectName:`OpenAI provider`,hostLabel:t,hostOnline:n,members:(0,P.jsx)(Oi,{"aria-hidden":`true`})}),(0,P.jsx)(Qd,{label:`Status`,value:r?`Loading`:t,action:n?(0,P.jsx)(fi,{"aria-hidden":`true`}):null}),(0,P.jsx)(nC,{form:e,pending:p,tokenMissing:o,onChange:l})]})})}var iC=`http://127.0.0.1:4370`;function aC(){return typeof window<`u`&&window.location.port!==`4372`?window.location.origin:iC}function oC(e){try{return new URL(e,aC()).toString()}catch{return e}}function sC({avatar:e,label:t,plain:n=!1,online:r=!1}){return(0,P.jsx)(Xo,{label:t,tone:e.color,plain:n,online:r,initials:e.initials,...e.kind===`image`?{imageUrl:oC(e.image_url)}:{}})}function cC({label:e=`Tutti`}){return(0,P.jsx)(Xo,{label:e,tone:`green`,className:`is-system`,imageUrl:OS,icon:(0,P.jsx)(si,{"aria-hidden":`true`})})}function lC({tone:e}){return e===`pending`?(0,P.jsx)(na,{"aria-hidden":`true`}):e===`failed`?(0,P.jsx)(mi,{"aria-hidden":`true`}):e===`done`?(0,P.jsx)(li,{"aria-hidden":`true`}):(0,P.jsx)(Mi,{"aria-hidden":`true`})}function uC({members:e}){return e===void 0||e.length===0?null:(0,P.jsx)(Zo,{"aria-label":`Members`,children:e.map(e=>(0,P.jsx)(sC,{avatar:e.avatar,label:e.displayName},e.key))})}function dC({activePage:e,statusShortcuts:t,unread:n,artifactSignal:r,mobileContext:i,children:a,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenTimeline:f,onOpenSettings:p,onActivateStatusShortcut:m,getStatusShortcutAriaControls:h}){let g=e!==`chat`&&n?.chat===!0,_=e!==`worklist`&&n?.worklist===!0,v=r?.available===!0,y=e!==`references`&&n?.references===!0,b=e!==`skills`&&n?.skills===!0;return(0,P.jsx)(Go,{children:(0,P.jsx)(Ko,{className:`is-headerless`,sidebar:(0,P.jsxs)(qo,{brand:(0,P.jsx)(AS,{...o===void 0?{}:{onClick:o}}),mobileTitle:i.title,...i.meta===void 0?{}:{mobileMeta:i.meta},...i.action===void 0?{}:{mobileAction:i.action},...t.length===0?{}:{status:t.map(e=>(0,N.createElement)(Yo,{icon:(0,P.jsx)(lC,{tone:e.tone}),label:e.label,tone:e.tone,onClick:()=>m?.(e),...h?.(e)===void 0?{}:{"aria-controls":h(e)},key:e.key}))},footer:(0,P.jsx)(Jo,{icon:(0,P.jsx)(qi,{"aria-hidden":`true`}),label:`Settings`,active:e===`settings`,onClick:e===`settings`?void 0:p}),children:[(0,P.jsx)(Jo,{icon:(0,P.jsx)(wy,{"aria-hidden":`true`}),label:`Chat`,active:e===`chat`,badge:g?{label:`Unread messages`}:!1,onClick:e===`chat`?void 0:s}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(ji,{"aria-hidden":`true`}),label:`Worklist`,active:e===`worklist`,badge:_?{label:`Unread worklist updates`}:!1,onClick:e===`worklist`?void 0:c}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(Li,{"aria-hidden":`true`}),label:`Artifacts`,active:e===`artifacts`,badge:v?{label:`Artifacts available`,text:`Live`,variant:`pill`}:!1,onClick:e===`artifacts`?void 0:u}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(Si,{"aria-hidden":`true`}),label:`References`,active:e===`references`,badge:y?{label:`New reference files`}:!1,onClick:e===`references`?void 0:l}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(Xi,{"aria-hidden":`true`}),label:`Skills`,active:e===`skills`,badge:b?{label:`New skill updates`}:!1,onClick:e===`skills`?void 0:d}),(0,P.jsx)(Jo,{icon:(0,P.jsx)(ci,{"aria-hidden":`true`}),label:`Timeline`,active:e===`timeline`,onClick:e===`timeline`?void 0:f})]}),children:a})})}function fC(){return(0,P.jsx)(Ds,{src:DS,className:`empty-state-brand-logo`})}function pC(e){return(0,P.jsx)(aa,{watermark:(0,P.jsx)(fC,{}),...e})}var mC=`tutti.execution-score-themes.v1`,hC=40,gC={assignments:[],bag:[]};function _C(){return{assignments:[],bag:[]}}function vC(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function yC(e,t){if(typeof e!=`object`||!e)return null;let n=e;if(!Array.isArray(n.assignments)||!Array.isArray(n.bag))return null;let r=n.assignments.filter(e=>typeof e==`object`&&!!e&&typeof e.identity==`string`&&t.has(String(e.themeId))),i=n.bag.filter(e=>typeof e==`string`&&t.has(e)),a=typeof n.recent==`string`&&t.has(n.recent)?n.recent:void 0;return{assignments:r,bag:i,...a===void 0?{}:{recent:a}}}function bC(e,t){if(e===null)return gC;try{let n=e.getItem(mC);return n===null?_C():yC(JSON.parse(n),t)??_C()}catch{return gC}}function xC(e,t){if(gC=t,e!==null)try{e.setItem(mC,JSON.stringify(t))}catch{}}function SC(e,t,n){let r=e.map(e=>e.id);for(let e=r.length-1;e>0;--e){let t=Math.min(e,Math.max(0,Math.floor(n()*(e+1))));[r[e],r[t]]=[r[t],r[e]]}if(r.length>1&&r[0]===t){let e=r.findIndex(e=>e!==t);[r[0],r[e]]=[r[e],r[0]]}return r}function CC(e,t={}){let n=t.themes??zo;if(n.length===0)throw Error(`Execution score themes are unavailable`);let r=new Map(n.map(e=>[e.id,e])),i=new Set(r.keys()),a=t.storage===void 0?vC():t.storage,o=bC(a,i),s=o.assignments.find(t=>t.identity===e),c=s===void 0?void 0:r.get(s.themeId);if(c!==void 0)return c;let l=t.random??Math.random,u=o.bag.length>0?[...o.bag]:SC(n,o.recent,l),d=u.shift(),f=d===void 0?void 0:r.get(d);if(f===void 0)throw Error(`Execution score themes are unavailable`);return xC(a,{assignments:[...o.assignments,{identity:e,themeId:f.id}].slice(-hC),bag:u,recent:f.id}),f}function wC(e){return`round-card-${e}`}function TC(e){return`approval-card-${e}`}function EC(e){return`chat-message-${e}`}var DC=`workspace-scratchpad`,OC=720,kC=80,AC=160,jC=96,MC=160,NC=2;function PC(e){return e.completionSource?.activityRef??e.completionSource?.workflowRef??e.completionSource?.taskId??e.key}function FC({progress:e}){let t=PC(e),[n]=(0,N.useState)(()=>CC(t)),r=(0,N.useRef)(t),i=(0,N.useRef)(e.tone),[a,o]=(0,N.useState)(null);if((0,N.useEffect)(()=>{let n=r.current,a=i.current;if(r.current=t,i.current=e.tone,e.tone!==`running`||a===`pending`||n===t){o(null);return}o(t);let s=window.setTimeout(()=>{o(e=>e===t?null:e)},OC);return()=>{window.clearTimeout(s)}},[e.tone,t]),e.tone===`running`||e.tone===`pending`||e.tone===`complete`){let r=e.tone===`running`&&a===t,i=e.steps.find(e=>e.status===`running`||e.status===`pending`)??e.steps.at(-1),o=e.completionTarget?.kind===`task`?`Task completed`:`Procedure completed`,s=e.tone===`complete`?void 0:i?.detail??(e.tone===`pending`?e.summary:void 0),c=e.tone===`complete`?void 0:i?.elapsedLabel,l=e.tone===`complete`?void 0:i?.metrics;return(0,P.jsx)(xo,{stageLabel:r?`Loading the next movement…`:e.tone===`complete`?o:i?.label??e.summary,...r||s===void 0?{}:{stageDetail:s},...r||c===void 0?{}:{elapsedLabel:c},...r||l===void 0?{}:{metrics:l},scoreLabel:r?`Loading the next movement score`:e.tone===`complete`?`${o} score cadence`:e.tone===`pending`?`Execution score paused while waiting for input`:`${i?.label??`Execution`} running score using ${n.shortName}`,state:r?`handoff`:e.tone===`complete`?`complete`:e.tone===`pending`?`paused`:`running`,units:n.units,playbackBpm:n.tempo,openingClef:n.clef,keySignatureFifths:n.keySignatureFifths,timeSignature:n.meter})}return(0,P.jsx)(Db,{title:e.title,summary:e.summary,tone:e.tone,steps:e.steps,...e.metaLabel===void 0?{}:{metaLabel:e.metaLabel}})}function IC(e){if(e===void 0)return null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function LC(e,t){if(e===null)return null;let n=IC(e.requestedAt);if(n===null)return t.length;let r=t.findIndex(e=>{let t=IC(e.createdAt);return t!==null&&t>n});return r===-1?t.length:r}function RC(e,{focusSelector:t}={}){let n=typeof document>`u`?null:document.getElementById(e);n!==null&&(n.scrollIntoView({block:`center`}),t!==void 0&&n.querySelector(t)?.focus({preventScroll:!0}))}function zC(e){return e.messageKind===`system_notice`&&e.workflowRef!==void 0&&(e.body.startsWith(`Worklist updated with `)||e.body===`Worklist is already covered by existing tasks.`)}function BC(e,t){if(t===void 0)return;let n=t.label.trim(),r=t.handle?.trim()??n;if(n===``||r===``)return;let i=r.toLocaleLowerCase();e.has(i)||e.set(i,{id:t.id,label:n,handle:r})}function VC({members:e,messages:t,clarificationMessagesByRoundId:n}){let r=new Map;BC(r,{id:`tutti`,label:`Tutti`,handle:`tutti`});for(let t of e)BC(r,{id:t.key,label:t.displayName});for(let e of t)BC(r,{id:`message:${e.author}`,label:e.author,...e.avatarKind===`tutti`?{handle:`tutti`}:{}});for(let e of Object.values(n))for(let t of e)BC(r,{id:`round-message:${t.author}`,label:t.author,...t.avatarKind===`tutti`?{handle:`tutti`}:{}});return[...r.values()]}function HC({message:e}){return e.avatarKind===`tutti`?(0,P.jsx)(cC,{label:e.author}):(0,P.jsx)(sC,{avatar:e.avatar??{kind:`initials`,initials:dr(e.author),color:`blue`},label:e.author,online:e.online})}function UC({projectName:e,projectDescription:t=``,members:n,messages:r,scratchpad:i,executionProgress:a=null,activeApproval:o=null,activeClarification:s,clarificationMessagesByRoundId:c,statusShortcuts:l,unread:u,artifactSignal:d,draft:f,roundDraft:p,sendPending:m,scratchpadSyncPending:h=!1,scratchpadActionsDisabled:g=!1,scratchpadSubmitPending:_=!1,referenceUploadPending:v=!1,focusMessageId:y=null,messageHistoryIdentity:b=`latest`,initialMessagePosition:x=y===null?`latest`:`focus`,hasOlderMessages:S=!1,hasNewerMessages:C=!1,loadingOlderMessages:w=!1,loadingNewerMessages:T=!1,historyConnectedToLatest:E=!0,roundSendPending:ee=!1,roundSubmitPending:D=!1,submittedRoundId:O=null,approvalDecisionPending:k=!1,projectNameSaving:te=!1,projectDescriptionSaving:ne=!1,loading:A=!1,unavailable:re=!1,onDraftChange:ie,onMessageFocused:j,onInitialMessagePositioned:M,onLoadOlderMessages:ae,onLoadNewerMessages:oe,onJumpToLatest:se,onUploadReferenceFile:ce,onOpenReferenceFile:le,onRoundDraftChange:ue,onSendMessage:de,onSendRoundMessage:fe,onSubmitRound:pe,onDecideApproval:me,onSubmitScratchpad:he,onUpdateProjectDisplayName:ge,onUpdateProjectDescription:_e,onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenWorklistTask:be,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Ee}){let[De,Oe]=(0,N.useState)(!1),ke=(0,N.useRef)(null),Ae=(0,N.useRef)(!1),je=(0,N.useRef)(null),Me=(0,N.useRef)(null),Ne=(0,N.useRef)(!0),Pe=(0,N.useRef)(void 0),Fe=(0,N.useRef)(b),Ie=(0,N.useRef)(null),Le=(0,P.jsx)(By,{className:`chat-project-title-edit`,value:e,placeholder:`Untitled project`,ariaLabel:`Edit project name`,maxLength:kC,saving:te,disabled:A,...ge===void 0?{}:{onUpdate:ge}}),Re=(0,P.jsx)(By,{className:`chat-project-description-edit`,value:t,placeholder:`Add a project description`,ariaLabel:`Edit project description`,maxLength:AC,allowEmpty:!0,saving:ne,disabled:A,..._e===void 0?{}:{onUpdate:_e}}),ze=s!==null&&r.some(e=>e.id===s.cardMessageId),Be=new Map;for(let e of r)e.clarificationCard!==void 0&&e.workflowRef!==void 0&&Be.set(e.workflowRef,e.clarificationCard.roundId);let Ve=new Map;for(let e of r){if(!zC(e)||e.workflowRef===void 0)continue;let t=Be.get(e.workflowRef);t!==void 0&&Ve.set(t,{...e,id:`round-result:${e.id}`,messageKind:`agent_text`,author:`Tutti`,avatarKind:`tutti`,online:!1})}let He=e=>{let t=c[e]??[],n=Ve.get(e);return n===void 0||t.some(e=>e.body===n.body)?t:[...t,n]},Ue=VC({members:n,messages:r,clarificationMessagesByRoundId:c}),We=ce===void 0?void 0:e=>{for(let t of e)ce(t)};(0,N.useLayoutEffect)(()=>{Fe.current!==b&&(Fe.current=b,Ae.current=!1,je.current=null,Pe.current=void 0)},[b]),(0,N.useLayoutEffect)(()=>{let e=je.current;if(e!==null){if(r[0]?.id!==e.firstMessageId){let t=ke.current;t!==null&&(t.scrollTop=e.scrollTop+Math.max(0,t.scrollHeight-e.scrollHeight),Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=NC),je.current=null;return}w||(je.current=null)}},[w,r]),(0,N.useEffect)(()=>{if(y===null||!r.some(e=>e.id===y))return;Ae.current=!0,RC(EC(y));let e=ke.current;e!==null&&(Ne.current=e.scrollHeight-e.clientHeight-e.scrollTop<=NC),j?.()},[y,r,j]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`latest`||y!==null||r.length===0&&s===null&&o===null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight,Ne.current=!0,Ae.current=!0});return()=>window.cancelAnimationFrame(t)},[o,s,y,A,r,re]),(0,N.useEffect)(()=>{if(Ae.current||A||re||x!==`start`||y!==null)return;let e=ke.current;if(e===null)return;let t=window.requestAnimationFrame(()=>{e.scrollTop=0,Ne.current=e.scrollHeight<=e.clientHeight+NC,Ae.current=!0,M?.()});return()=>window.cancelAnimationFrame(t)},[y,x,A,r,M,re]);let Ge=()=>{if(!S||w||je.current!==null||ae===void 0)return;let e=ke.current;e!==null&&(je.current={firstMessageId:r[0]?.id,scrollHeight:e.scrollHeight,scrollTop:e.scrollTop},ae())},Ke=()=>{!C||T||oe===void 0||oe()},qe=e=>{let t=e.currentTarget;Ne.current=t.scrollHeight-t.clientHeight-t.scrollTop<=NC,Me.current!==null&&window.cancelAnimationFrame(Me.current),Me.current=window.requestAnimationFrame(()=>{if(Me.current=null,t.scrollTop<=jC){Ge();return}t.scrollHeight-t.clientHeight-t.scrollTop<=MC&&Ke()})};(0,N.useEffect)(()=>()=>{Me.current!==null&&window.cancelAnimationFrame(Me.current)},[]),(0,N.useEffect)(()=>{if(A||re||w||T||!Ae.current)return;let e=ke.current;if(e===null||e.scrollHeight>e.clientHeight+NC)return;let t=window.requestAnimationFrame(()=>{S?Ge():C&&Ke()});return()=>window.cancelAnimationFrame(t)},[C,S,A,T,w,r,re]);let Je=r.at(-1)?.id;(0,N.useEffect)(()=>{let e=Pe.current;if(Pe.current=Je,e===void 0||e===Je||!E||!Ne.current||!Ae.current||je.current!==null)return;let t=ke.current;if(t===null)return;let n=window.requestAnimationFrame(()=>{t.scrollTop=t.scrollHeight,Ne.current=!0});return()=>window.cancelAnimationFrame(n)},[E,Je]);let Ye=({key:e,roundId:t,title:n,summary:r,request:i,contextLabel:a,writable:o})=>{let s=He(t),c=s.filter(e=>e.messageKind===`user_text`).length;return(0,P.jsx)(Fb,{id:wC(t),tabIndex:-1,title:n,summary:r,request:i,...a===void 0?{}:{contextLabel:a},messages:s.map(e=>({id:e.id,author:e.author,body:e.body,time:e.time,avatar:(0,P.jsx)(HC,{message:e})})),replyCount:c,draft:o?p:``,defaultOpen:!0,readOnly:!o,status:o?`pending`:`done`,statusLabel:o?`needs input`:`submitted`,mentionOptions:Ue,sendPending:o&&ee,submitPending:o&&D,onDraftChange:ue,onSendMessage:fe,onSubmitRound:pe},`${e}:${o?`writable`:`sealed`}`)},Xe=e=>{if(e.target.kind===`approval`&&o!==null){if(!E){Ie.current=e,se?.();return}RC(TC(o.approvalId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`clarification`&&s!==null){if(!E&&!ze){Ie.current=e,se?.();return}RC(wC(s.roundId),{focusSelector:`.chat-event-card-header`});return}if(e.target.kind===`scratchpad`){RC(DC);return}Ee?.(e)};(0,N.useEffect)(()=>{let e=Ie.current;if(!E||A||e===null)return;Ie.current=null;let t=window.requestAnimationFrame(()=>{e.target.kind===`approval`&&o!==null?RC(TC(o.approvalId),{focusSelector:`.chat-event-card-header`}):e.target.kind===`clarification`&&s!==null&&RC(wC(s.roundId),{focusSelector:`.chat-event-card-header`})});return()=>window.cancelAnimationFrame(t)},[o,s,E,A,r]);let Ze=e=>s===null?null:Ye({key:e,roundId:s.roundId,title:s.title,summary:s.summary,request:s.request,contextLabel:s.ownerLabel,writable:s.status===`writable`&&s.roundId!==O}),Qe=()=>o===null?null:(0,P.jsx)(zb,{id:TC(o.approvalId),tabIndex:-1,title:o.title,summary:o.summary,...o.reason===void 0?{}:{reason:o.reason},...o.detail===void 0?{}:{detail:o.detail,...o.detailLabel===void 0?{}:{detailLabel:o.detailLabel},...o.detailCode===void 0?{}:{detailCode:o.detailCode}},status:o.status,statusLabel:o.statusLabel,decisions:o.decisions,decisionPending:k,...o.resolutionLabel===void 0?{}:{resolutionLabel:o.resolutionLabel},onDecide:e=>me?.(o.approvalId,e)},`approval:${o.approvalId}:${o.status}`),$e=e=>{let t=e.clarificationCard;if(t===void 0)return null;let n=s!==null&&s.roundId===t.roundId;return Ye({key:e.id,roundId:t.roundId,title:n&&s!==null?s.title:t.title??`Clarification round ${t.roundId.slice(-4)}`,summary:n&&s!==null?s.summary:t.summary,request:n&&s!==null?s.request:t.summary,...n&&s!==null?{contextLabel:s.ownerLabel}:{},writable:n&&t.status===`writable`&&t.roundId!==O})},et=e=>{if(zC(e)&&Be.has(e.workflowRef??``))return null;if(e.messageKind===`clarification_card`)return $e(e);if(s!==null&&e.id===s.cardMessageId)return Ze(e.id);if(e.taskResult!==void 0)return(0,P.jsx)(Bb,{id:EC(e.id),tabIndex:-1,className:e.id===y?`is-focused`:void 0,title:e.taskResult.title,status:e.taskResult.status,taskId:e.taskResult.taskId,taskTitle:e.taskResult.taskTitle,summary:e.taskResult.summary,...e.taskResult.moduleName===void 0?{}:{moduleName:e.taskResult.moduleName},...e.taskResult.finalNote===void 0?{}:{finalNote:e.taskResult.finalNote},...e.taskResult.generatedFiles===void 0?{}:{generatedFiles:e.taskResult.generatedFiles},...e.taskResult.errorCode===void 0?{}:{errorCode:e.taskResult.errorCode},...be===void 0?{}:{onOpenTask:be}},e.id);let t=e.referenceFile;return(0,P.jsx)(Ty,{id:EC(e.id),tabIndex:-1,author:e.author,time:e.time,avatar:(0,P.jsx)(HC,{message:e}),className:e.id===y?`is-focused`:void 0,children:t===void 0?e.messageKind===`agent_text`?(0,P.jsx)(Ey,{children:e.body}):(0,P.jsx)(`p`,{children:(0,P.jsx)(Sy,{children:e.body})}):(0,P.jsx)(Ry,{name:t.name,category:t.category,...t.imageUrl===void 0?{}:{imageUrl:t.imageUrl},onClick:()=>le?.(t.path)})},e.id)},tt=E?LC(o,r):null,nt=()=>{let e=s!==null&&(ze||E)||o!==null&&E;return r.length===0&&!e&&!w&&!T?(0,P.jsx)(pC,{children:`No messages yet`}):(0,P.jsxs)(P.Fragment,{children:[w?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading earlier messages…`}):null,!E||ze?null:Ze(`active-round`),r.map((e,t)=>(0,P.jsxs)(N.Fragment,{children:[tt===t?Qe():null,et(e)]},`timeline:${e.id}`)),tt===r.length?Qe():null,T?(0,P.jsx)(`div`,{className:`chat-history-status`,role:`status`,children:`Loading newer messages…`}):null]})},rt=(e,t=!1)=>(0,P.jsx)(Cb,{id:e,tabIndex:-1,compact:t,title:i.title,summary:i.summary,sections:i.sections,submitAvailable:i.submitAvailable,...i.pages===void 0?{}:{pages:i.pages},...i.footerNote===void 0?{}:{footerNote:i.footerNote},...i.updatedLabelPrefix===void 0?{}:{updatedLabelPrefix:i.updatedLabelPrefix},syncPending:h,actionsDisabled:g,submitPending:_,onSubmitScratchpad:he,...be===void 0?{}:{onOpenCompiledTask:be},empty:(0,P.jsx)(pC,{children:`Scratchpad empty. Discuss more, tutti together!`}),...i.updatedLabel===void 0?{}:{updatedLabel:i.updatedLabel}}),it=(0,P.jsx)(`div`,{className:`chat-panel-actions`,children:(0,P.jsx)(uC,{members:n})});return(0,P.jsxs)(dC,{activePage:`chat`,statusShortcuts:l,mobileContext:{title:e,action:(0,P.jsx)(Jo,{className:h?`mobile-scratchpad-trigger is-syncing`:`mobile-scratchpad-trigger`,type:`button`,label:De?`Close Scratchpad`:`Open Scratchpad`,active:De,"aria-expanded":De,"aria-controls":`${DC}-mobile-sheet`,icon:(0,P.jsx)(Wy,{"aria-hidden":`true`}),onClick:()=>Oe(e=>!e)})},...u===void 0?{}:{unread:u},...d===void 0?{}:{artifactSignal:d},onOpenProjectCenter:ve,onOpenWorklist:ye,onOpenReferences:xe,onOpenArtifacts:Se,onOpenSkills:Ce,onOpenTimeline:we,onOpenSettings:Te,onActivateStatusShortcut:Xe,getStatusShortcutAriaControls:e=>e.target.kind===`approval`&&o!==null&&E?TC(o.approvalId):e.target.kind===`clarification`&&s!==null&&(E||ze)?wC(s.roundId):e.target.kind===`scratchpad`?DC:void 0,children:[(0,P.jsxs)(`section`,{className:`workspace-grid is-tutti chat-workspace-grid`,"aria-label":`Chat workspace`,children:[A?(0,P.jsx)(zy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(oa,{})}):re?(0,P.jsx)(zy,{title:Le,subtitle:Re,actions:it,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):(0,P.jsx)(zy,{title:Le,subtitle:Re,actions:it,streamRef:ke,onStreamScroll:qe,streamOverlay:C&&se!==void 0?(0,P.jsx)(Cs,{className:`chat-jump-latest`,type:`button`,onClick:se,children:`Jump to latest`}):void 0,dropUploadPending:v,...We===void 0?{}:{onDropFiles:We},composer:(0,P.jsx)(Uy,{value:f,pending:m,uploadPending:v,mentionOptions:Ue,onValueChange:ie,onComposerSubmit:de,...ce===void 0?{}:{onFileUpload:ce}}),empty:(0,P.jsx)(pC,{children:`No messages yet`}),children:nt()}),(0,P.jsxs)(`div`,{className:a===null?`chat-side-column`:`chat-side-column has-progress`,children:[rt(DC),a===null?null:(0,P.jsx)(FC,{progress:a})]})]}),De?(0,P.jsxs)(`div`,{className:`mobile-scratchpad-layer is-open`,id:`${DC}-mobile-sheet`,children:[(0,P.jsx)(`button`,{className:`mobile-scratchpad-backdrop`,type:`button`,"aria-label":`Close Scratchpad`,onClick:()=>Oe(!1)}),(0,P.jsxs)(`section`,{className:`mobile-scratchpad-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`Scratchpad`,children:[(0,P.jsxs)(`div`,{className:`mobile-scratchpad-card-head`,children:[(0,P.jsx)(`h2`,{children:`Scratchpad`}),(0,P.jsx)(xs,{className:`mobile-scratchpad-close`,type:`button`,label:`Close Scratchpad`,icon:(0,P.jsx)(ia,{"aria-hidden":`true`}),onClick:()=>Oe(!1)})]}),(0,P.jsx)(`div`,{className:`mobile-scratchpad-card-body`,children:rt(`${DC}-mobile`,!0)})]})]}):null]})}function WC({statusShortcuts:e,unread:t,artifactSignal:n,state:r,loading:i=!1,unavailable:a=!1,restartPending:o=!1,stopPending:s=!1,onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenSkills:f,onOpenTimeline:p,onOpenSettings:m,onRestart:h,onStop:g,onActivateStatusShortcut:_}){let v=i?{status:`loading`}:a?{status:`not_declared`}:r;return(0,P.jsx)(dC,{activePage:`artifacts`,statusShortcuts:e,mobileContext:{title:v.status===`declared`?v.title:`Artifacts`,action:(0,P.jsx)(tx,{state:v,restartPending:o,stopPending:s,compact:!0,...h===void 0?{}:{onRestart:h},...g===void 0?{}:{onStop:g}})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenSkills:f,onOpenTimeline:p,onOpenSettings:m,onActivateStatusShortcut:_,children:(0,P.jsx)(`section`,{className:`workspace-grid artifacts-workspace-grid`,"aria-label":`Artifacts`,children:(0,P.jsx)(rx,{state:v,...a?{empty:(0,P.jsx)(pC,{children:`Workspace unavailable`})}:{},emptyWatermark:(0,P.jsx)(fC,{}),restartPending:o,stopPending:s,...h===void 0?{}:{onRestart:h},...g===void 0?{}:{onStop:g}})})})}function GC({statusShortcuts:e,unread:t,artifactSignal:n,files:r,detail:i,uploadPending:a=!1,fileSortMode:o=`time`,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectFile:_,onUploadFile:v,onFileSortModeChange:y}){let b=s||c;return(0,P.jsx)(dC,{activePage:`references`,statusShortcuts:e,mobileContext:{title:`References`,action:(0,P.jsx)(Hy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload reference`,pendingLabel:`Uploading reference`,pending:a,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Reference files`,children:(0,P.jsx)($b,{files:b?[]:r,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`References unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,fileSortMode:o,empty:s?(0,P.jsx)(pC,{children:`Loading reference files`}):c?(0,P.jsx)(pC,{children:`Workspace unavailable`}):(0,P.jsx)(pC,{children:`No reference files`}),onSelectFile:_,onUploadFile:v,...y===void 0?{}:{onFileSortModeChange:y}})})})}var KC=6,qC=`......`,JC=80,YC=160;function XC(e){let t=document.createElement(`canvas`).getContext(`2d`);if(t===null)return null;let n=window.getComputedStyle(e);return t.font=[n.fontStyle,n.fontVariant,n.fontWeight,n.fontSize,n.fontFamily].join(` `),e=>t.measureText(e).width}function ZC(e,t,n){if(n(e)<=t)return e;let r=e.slice(-KC),i=Math.max(0,e.length-r.length),a=0,o=i;for(;a<o;){let i=Math.ceil((a+o)/2);n(`${e.slice(0,i)}${qC}${r}`)<=t?a=i:o=i-1}return`${e.slice(0,a)}${qC}${r}`}function QC({value:e}){let t=(0,N.useRef)(null),[n,r]=(0,N.useState)(e);return(0,N.useEffect)(()=>{let n=t.current;if(n===null)return;let i=()=>{let t=XC(n),i=n.getBoundingClientRect().width;if(t===null||i<=0){r(e);return}let a=ZC(e,i,t);r(e=>e===a?e:a)};i();let a=typeof ResizeObserver>`u`?null:new ResizeObserver(i);return a?.observe(n),window.addEventListener(`resize`,i),()=>{a?.disconnect(),window.removeEventListener(`resize`,i)}},[e]),(0,P.jsx)(`code`,{ref:t,className:`settings-masked-link`,title:e,"aria-label":e,children:n})}function $C({value:e,onCopy:t}){return t===void 0?(0,P.jsx)(QC,{value:e}):(0,P.jsx)(`button`,{className:`settings-value-button settings-link-copy-button`,type:`button`,"aria-label":`Copy invite link`,onClick:t,children:(0,P.jsx)(QC,{value:e})})}function ew(e,t){return e.map(e=>({id:e.id,title:e.title,rows:e.rows.map(e=>({label:e.label,value:e.identity===!0?(0,P.jsxs)(`div`,{className:`settings-identity`,children:[(0,P.jsx)(sC,{avatar:t.currentMember.avatar,label:t.currentMember.displayName}),(0,P.jsx)(`strong`,{children:t.currentMember.displayName})]}):e.value,...e.identity===!0?{plain:!0}:{},...e.code===void 0?{}:{code:e.code}}))}))}function tw({settings:e,onCopyJoinUrl:t}){let n=e.invite;return n===void 0?null:{label:`invite link`,value:n.joinUrl===void 0?`not recoverable`:(0,P.jsx)($C,{value:n.joinUrl,onCopy:t}),...n.joinUrl===void 0?{}:{plain:!0}}}function nw({settings:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,projectNameSaving:o=!1,projectDescriptionSaving:s=!1,onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,onCopyJoinUrl:g,onUpdateProjectDisplayName:_,onUpdateProjectDescription:v}){let y=e?.statuses??[],b=e===void 0?null:tw({settings:e,onCopyJoinUrl:g});return(0,P.jsx)(dC,{activePage:`settings`,statusShortcuts:t,mobileContext:{title:`Settings`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:c,onOpenChat:l,onOpenWorklist:u,onOpenReferences:d,onOpenArtifacts:f,onOpenSkills:p,onOpenTimeline:m,onActivateStatusShortcut:h,children:(0,P.jsx)(`section`,{className:`workspace-grid settings-workspace-grid`,"aria-label":`Project settings`,children:(0,P.jsx)(`div`,{className:`settings-page-grid`,children:i?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Loading settings`,children:(0,P.jsx)(pC,{children:`Loading settings`})}):a?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`settings-sheet`,"aria-label":`Settings unavailable`,children:(0,P.jsx)(pC,{children:`Settings unavailable`})}):(0,P.jsx)(Jb,{statuses:y,sections:[{id:`settings-project`,title:`Project`,rows:[{label:`display_name`,plain:!0,value:(0,P.jsx)(By,{value:e.project.displayName,placeholder:`Untitled project`,ariaLabel:`Project display name`,maxLength:JC,saving:o,..._===void 0?{}:{onUpdate:_}})},{label:`description`,plain:!0,value:(0,P.jsx)(By,{value:e.project.description,placeholder:`Add a project description`,ariaLabel:`Project description`,maxLength:YC,allowEmpty:!0,saving:s,...v===void 0?{}:{onUpdate:v}})},...b===null?[]:[b]]},...ew(e.sections,e)]})})})})}var rw=[{title:`Awesome GitHub Copilot Skills`,href:`https://awesome-copilot.github.com/skills/`},{title:`Anthropic official skills`,href:`https://github.com/anthropics/skills`},{title:`Claude Skills Marketplace`,href:`https://claudeskills.info/skills/`}];function iw({statusShortcuts:e,unread:t,artifactSignal:n,skills:r,detail:i,uploadPending:a=!1,deletePending:o=!1,loading:s=!1,unavailable:c=!1,onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y}){let b=s||c;return(0,P.jsx)(dC,{activePage:`skills`,statusShortcuts:e,mobileContext:{title:`Skills`,action:(0,P.jsx)(Hy,{variant:`bare`,className:`sidebar-button reference-upload-button`,label:`Upload skill`,pendingLabel:`Uploading skill`,pending:a,accept:`.zip,application/zip,application/x-zip-compressed`,iconOnly:!0,onFileUpload:v})},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:l,onOpenChat:u,onOpenWorklist:d,onOpenReferences:f,onOpenArtifacts:p,onOpenTimeline:m,onOpenSettings:h,onActivateStatusShortcut:g,children:(0,P.jsx)(`section`,{className:`workspace-grid references-workspace-grid`,"aria-label":`Skills`,children:(0,P.jsx)(ax,{skills:b?[]:r,communityLinks:b?[]:rw,...s?{detail:{title:`Loading`,unavailableReason:`Loading`}}:c?{detail:{title:`Skills unavailable`,unavailableReason:`Workspace unavailable`}}:i===void 0?{}:{detail:i},uploadPending:a,deletePending:o,empty:s?(0,P.jsx)(pC,{children:`Loading skills`}):c?(0,P.jsx)(pC,{children:`Workspace unavailable`}):(0,P.jsx)(pC,{children:`No skills`}),onSelectSkill:_,onUploadSkill:v,onDeleteSkill:y})})})}function aw({timeline:e,statusShortcuts:t,unread:n,artifactSignal:r,loading:i=!1,unavailable:a=!1,onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p}){return(0,P.jsx)(dC,{activePage:`timeline`,statusShortcuts:t,mobileContext:{title:`Timeline`},...n===void 0?{}:{unread:n},...r===void 0?{}:{artifactSignal:r},onOpenProjectCenter:o,onOpenChat:s,onOpenWorklist:c,onOpenReferences:l,onOpenArtifacts:u,onOpenSkills:d,onOpenSettings:f,onActivateStatusShortcut:p,children:(0,P.jsx)(`section`,{className:`workspace-grid timeline-workspace-grid`,"aria-label":`Timeline workspace`,children:i?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Loading timeline`,children:(0,P.jsx)(pC,{children:`Loading timeline`})}):a?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):e===void 0?(0,P.jsx)(`section`,{className:`panel timeline-panel`,"aria-label":`Timeline unavailable`,children:(0,P.jsx)(pC,{children:`Timeline unavailable`})}):(0,P.jsx)(bx,{tokenOverview:e.tokenOverview,items:e.items,scoreUnits:e.scoreUnits,empty:(0,P.jsx)(pC,{children:`No timeline events yet`})})})})}function ow({statusShortcuts:e,unread:t,artifactSignal:n,modules:r,taskCount:i,detail:a,missingTaskId:o,runNote:s,loading:c=!1,unavailable:l=!1,onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,onSelectTask:v}){return(0,P.jsx)(dC,{activePage:`worklist`,statusShortcuts:e,mobileContext:{title:`Worklist`,meta:i===1?`1 task`:`${i} tasks`},...t===void 0?{}:{unread:t},...n===void 0?{}:{artifactSignal:n},onOpenProjectCenter:u,onOpenChat:d,onOpenReferences:f,onOpenArtifacts:p,onOpenSkills:m,onOpenTimeline:h,onOpenSettings:g,onActivateStatusShortcut:_,children:(0,P.jsx)(`section`,{className:`workspace-grid worklist-workspace-grid`,"aria-label":`Worklist workspace`,children:c?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Loading Worklist`,children:(0,P.jsx)(pC,{children:`Loading Worklist`})}):l?(0,P.jsx)(`section`,{className:`panel tasks worklist-page-panel`,"aria-label":`Worklist unavailable`,children:(0,P.jsx)(pC,{children:`Workspace unavailable`})}):(0,P.jsx)(qb,{modules:r,taskCount:i,...a===void 0?{}:{detail:a},...o===void 0?{}:{missingTaskId:o},...s==null?{}:{runNote:s},onSelectTask:v,empty:(0,P.jsx)(pC,{children:`No compiled tasks`})})})})}function sw(e){return gw(e)&&!cw(e)&&!bw(e)&&Symbol.asyncIterator in e}function cw(e){return Array.isArray(e)}function lw(e){return typeof e==`bigint`}function uw(e){return typeof e==`boolean`}function dw(e){return e instanceof globalThis.Date}function fw(e){return typeof e==`function`}function pw(e){return gw(e)&&!cw(e)&&!bw(e)&&Symbol.iterator in e}function mw(e){return e===null}function hw(e){return typeof e==`number`}function gw(e){return typeof e==`object`&&!!e}function _w(e){return e instanceof globalThis.RegExp}function vw(e){return typeof e==`string`}function yw(e){return typeof e==`symbol`}function bw(e){return e instanceof globalThis.Uint8Array}function xw(e){return e===void 0}function Sw(e){return e.map(e=>Dw(e))}function Cw(e){return new Date(e.getTime())}function ww(e){return new Uint8Array(e)}function Tw(e){return new RegExp(e.source,e.flags)}function Ew(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Dw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Dw(e[n]);return t}function Dw(e){return cw(e)?Sw(e):dw(e)?Cw(e):bw(e)?ww(e):_w(e)?Tw(e):gw(e)?Ew(e):e}function Ow(e){return Dw(e)}function kw(e,t){return Ow(t===void 0?e:{...t,...e})}function Aw(e){return typeof e==`object`&&!!e}function jw(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function Mw(e){return e===void 0}function Nw(e){return typeof e==`number`}var Pw;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=Aw(t);return e.AllowArrayObject?n:n&&!jw(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?Nw(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=Mw(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(Pw||={});function Fw(e){return globalThis.Object.freeze(e).map(e=>Bw(e))}function Iw(e){return e}function Lw(e){return e}function Rw(e){return e}function zw(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Bw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Bw(e[n]);return globalThis.Object.freeze(t)}function Bw(e){return cw(e)?Fw(e):dw(e)?Iw(e):bw(e)?Lw(e):_w(e)?Rw(e):gw(e)?zw(e):e}function K(e,t){let n=t===void 0?e:{...t,...e};switch(Pw.InstanceMode){case`freeze`:return Bw(n);case`clone`:return Ow(n);default:return n}}var Vw=class extends Error{constructor(e){super(e)}},Hw=Symbol.for(`TypeBox.Transform`),Uw=Symbol.for(`TypeBox.Readonly`),Ww=Symbol.for(`TypeBox.Optional`),Gw=Symbol.for(`TypeBox.Hint`),q=Symbol.for(`TypeBox.Kind`);function Kw(e){return gw(e)&&e[Uw]===`Readonly`}function qw(e){return gw(e)&&e[Ww]===`Optional`}function Jw(e){return sT(e,`Any`)}function Yw(e){return sT(e,`Argument`)}function Xw(e){return sT(e,`Array`)}function Zw(e){return sT(e,`AsyncIterator`)}function Qw(e){return sT(e,`BigInt`)}function $w(e){return sT(e,`Boolean`)}function eT(e){return sT(e,`Computed`)}function tT(e){return sT(e,`Constructor`)}function nT(e){return sT(e,`Date`)}function rT(e){return sT(e,`Function`)}function iT(e){return sT(e,`Integer`)}function aT(e){return sT(e,`Intersect`)}function oT(e){return sT(e,`Iterator`)}function sT(e,t){return gw(e)&&q in e&&e[q]===t}function cT(e){return uw(e)||hw(e)||vw(e)}function lT(e){return sT(e,`Literal`)}function uT(e){return sT(e,`MappedKey`)}function dT(e){return sT(e,`MappedResult`)}function fT(e){return sT(e,`Never`)}function pT(e){return sT(e,`Not`)}function mT(e){return sT(e,`Null`)}function hT(e){return sT(e,`Number`)}function gT(e){return sT(e,`Object`)}function _T(e){return sT(e,`Promise`)}function vT(e){return sT(e,`Record`)}function yT(e){return sT(e,`Ref`)}function bT(e){return sT(e,`RegExp`)}function xT(e){return sT(e,`String`)}function ST(e){return sT(e,`Symbol`)}function CT(e){return sT(e,`TemplateLiteral`)}function wT(e){return sT(e,`This`)}function TT(e){return gw(e)&&Hw in e}function ET(e){return sT(e,`Tuple`)}function DT(e){return sT(e,`Undefined`)}function OT(e){return sT(e,`Union`)}function kT(e){return sT(e,`Uint8Array`)}function AT(e){return sT(e,`Unknown`)}function jT(e){return sT(e,`Unsafe`)}function MT(e){return sT(e,`Void`)}function NT(e){return gw(e)&&q in e&&vw(e[q])}function PT(e){return Jw(e)||Yw(e)||Xw(e)||$w(e)||Qw(e)||Zw(e)||eT(e)||tT(e)||nT(e)||rT(e)||iT(e)||aT(e)||oT(e)||lT(e)||uT(e)||dT(e)||fT(e)||pT(e)||mT(e)||hT(e)||gT(e)||_T(e)||vT(e)||yT(e)||bT(e)||xT(e)||ST(e)||CT(e)||wT(e)||ET(e)||DT(e)||OT(e)||kT(e)||AT(e)||jT(e)||MT(e)||NT(e)}var FT=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function IT(e){try{return new RegExp(e),!0}catch{return!1}}function LT(e){if(!vw(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function RT(e){return VT(e)||LE(e)}function zT(e){return xw(e)||lw(e)}function BT(e){return xw(e)||hw(e)}function VT(e){return xw(e)||uw(e)}function HT(e){return xw(e)||vw(e)}function UT(e){return xw(e)||vw(e)&<(e)&&IT(e)}function WT(e){return xw(e)||vw(e)&<(e)}function GT(e){return xw(e)||LE(e)}function KT(e){return gw(e)&&e[Ww]===`Optional`}function qT(e){return sE(e,`Any`)&&HT(e.$id)}function JT(e){return sE(e,`Argument`)&&hw(e.index)}function YT(e){return sE(e,`Array`)&&e.type===`array`&&HT(e.$id)&&LE(e.items)&&BT(e.minItems)&&BT(e.maxItems)&&VT(e.uniqueItems)&>(e.contains)&&BT(e.minContains)&&BT(e.maxContains)}function XT(e){return sE(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&HT(e.$id)&&LE(e.items)}function ZT(e){return sE(e,`BigInt`)&&e.type===`bigint`&&HT(e.$id)&&zT(e.exclusiveMaximum)&&zT(e.exclusiveMinimum)&&zT(e.maximum)&&zT(e.minimum)&&zT(e.multipleOf)}function QT(e){return sE(e,`Boolean`)&&e.type===`boolean`&&HT(e.$id)}function $T(e){return sE(e,`Computed`)&&vw(e.target)&&cw(e.parameters)&&e.parameters.every(e=>LE(e))}function eE(e){return sE(e,`Constructor`)&&e.type===`Constructor`&&HT(e.$id)&&cw(e.parameters)&&e.parameters.every(e=>LE(e))&&LE(e.returns)}function tE(e){return sE(e,`Date`)&&e.type===`Date`&&HT(e.$id)&&BT(e.exclusiveMaximumTimestamp)&&BT(e.exclusiveMinimumTimestamp)&&BT(e.maximumTimestamp)&&BT(e.minimumTimestamp)&&BT(e.multipleOfTimestamp)}function nE(e){return sE(e,`Function`)&&e.type===`Function`&&HT(e.$id)&&cw(e.parameters)&&e.parameters.every(e=>LE(e))&&LE(e.returns)}function rE(e){return sE(e,`Integer`)&&e.type===`integer`&&HT(e.$id)&&BT(e.exclusiveMaximum)&&BT(e.exclusiveMinimum)&&BT(e.maximum)&&BT(e.minimum)&&BT(e.multipleOf)}function iE(e){return gw(e)&&Object.entries(e).every(([e,t])=>LT(e)&&LE(t))}function aE(e){return sE(e,`Intersect`)&&!(vw(e.type)&&e.type!==`object`)&&cw(e.allOf)&&e.allOf.every(e=>LE(e)&&!OE(e))&&HT(e.type)&&(VT(e.unevaluatedProperties)||GT(e.unevaluatedProperties))&&HT(e.$id)}function oE(e){return sE(e,`Iterator`)&&e.type===`Iterator`&&HT(e.$id)&&LE(e.items)}function sE(e,t){return gw(e)&&q in e&&e[q]===t}function cE(e){return dE(e)&&vw(e.const)}function lE(e){return dE(e)&&hw(e.const)}function uE(e){return dE(e)&&uw(e.const)}function dE(e){return sE(e,`Literal`)&&HT(e.$id)&&fE(e.const)}function fE(e){return uw(e)||hw(e)||vw(e)}function pE(e){return sE(e,`MappedKey`)&&cw(e.keys)&&e.keys.every(e=>hw(e)||vw(e))}function mE(e){return sE(e,`MappedResult`)&&iE(e.properties)}function hE(e){return sE(e,`Never`)&&gw(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function gE(e){return sE(e,`Not`)&&LE(e.not)}function _E(e){return sE(e,`Null`)&&e.type===`null`&&HT(e.$id)}function vE(e){return sE(e,`Number`)&&e.type===`number`&&HT(e.$id)&&BT(e.exclusiveMaximum)&&BT(e.exclusiveMinimum)&&BT(e.maximum)&&BT(e.minimum)&&BT(e.multipleOf)}function yE(e){return sE(e,`Object`)&&e.type===`object`&&HT(e.$id)&&iE(e.properties)&&RT(e.additionalProperties)&&BT(e.minProperties)&&BT(e.maxProperties)}function bE(e){return sE(e,`Promise`)&&e.type===`Promise`&&HT(e.$id)&&LE(e.item)}function xE(e){return sE(e,`Record`)&&e.type===`object`&&HT(e.$id)&&RT(e.additionalProperties)&&gw(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&IT(t[0])&&gw(e.patternProperties)&&LE(e.patternProperties[t[0]])})(e)}function SE(e){return sE(e,`Ref`)&&HT(e.$id)&&vw(e.$ref)}function CE(e){return sE(e,`RegExp`)&&HT(e.$id)&&vw(e.source)&&vw(e.flags)&&BT(e.maxLength)&&BT(e.minLength)}function wE(e){return sE(e,`String`)&&e.type===`string`&&HT(e.$id)&&BT(e.minLength)&&BT(e.maxLength)&&UT(e.pattern)&&WT(e.format)}function TE(e){return sE(e,`Symbol`)&&e.type===`symbol`&&HT(e.$id)}function EE(e){return sE(e,`TemplateLiteral`)&&e.type===`string`&&vw(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function DE(e){return sE(e,`This`)&&HT(e.$id)&&vw(e.$ref)}function OE(e){return gw(e)&&Hw in e}function kE(e){return sE(e,`Tuple`)&&e.type===`array`&&HT(e.$id)&&hw(e.minItems)&&hw(e.maxItems)&&e.minItems===e.maxItems&&(xw(e.items)&&xw(e.additionalItems)&&e.minItems===0||cw(e.items)&&e.items.every(e=>LE(e)))}function AE(e){return sE(e,`Undefined`)&&e.type===`undefined`&&HT(e.$id)}function jE(e){return sE(e,`Union`)&&HT(e.$id)&&gw(e)&&cw(e.anyOf)&&e.anyOf.every(e=>LE(e))}function ME(e){return sE(e,`Uint8Array`)&&e.type===`Uint8Array`&&HT(e.$id)&&BT(e.minByteLength)&&BT(e.maxByteLength)}function NE(e){return sE(e,`Unknown`)&&HT(e.$id)}function PE(e){return sE(e,`Unsafe`)}function FE(e){return sE(e,`Void`)&&e.type===`void`&&HT(e.$id)}function IE(e){return gw(e)&&q in e&&vw(e[q])&&!FT.includes(e[q])}function LE(e){return gw(e)&&(qT(e)||JT(e)||YT(e)||QT(e)||ZT(e)||XT(e)||$T(e)||eE(e)||tE(e)||nE(e)||rE(e)||aE(e)||oE(e)||dE(e)||pE(e)||mE(e)||hE(e)||gE(e)||_E(e)||vE(e)||yE(e)||bE(e)||xE(e)||SE(e)||CE(e)||wE(e)||TE(e)||EE(e)||DE(e)||kE(e)||AE(e)||jE(e)||ME(e)||NE(e)||PE(e)||FE(e)||IE(e))}var RE=`(true|false)`,zE=`(0|[1-9][0-9]*)`,BE=`(.*)`,VE=`(?!.*)`;`${RE}`;var HE=`^${zE}$`,UE=`^${BE}$`,WE=`^${VE}$`;function GE(e,t){return e.includes(t)}function KE(e){return[...new Set(e)]}function qE(e,t){return e.filter(e=>t.includes(e))}function JE(e,t){return e.reduce((e,t)=>qE(e,t),t)}function YE(e){return e.length===1?e[0]:e.length>1?JE(e.slice(1),e[0]):[]}function XE(e){let t=[];for(let n of e)t.push(...n);return t}function ZE(e){return K({[q]:`Any`},e)}function QE(e,t){return K({[q]:`Array`,type:`array`,items:e},t)}function $E(e){return K({[q]:`Argument`,index:e})}function eD(e,t){return K({[q]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function tD(e,t,n){return K({[q]:`Computed`,target:e,parameters:t},n)}function nD(e,t){let{[t]:n,...r}=e;return r}function rD(e,t){return t.reduce((e,t)=>nD(e,t),e)}function iD(e){return K({[q]:`Never`,not:{}},e)}function aD(e){return K({[q]:`MappedResult`,properties:e})}function oD(e,t,n){return K({[q]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function sD(e,t,n){return K({[q]:`Function`,type:`Function`,parameters:e,returns:t},n)}function cD(e,t){return K({[q]:`Union`,anyOf:e},t)}function lD(e){return e.some(e=>qw(e))}function uD(e){return e.map(e=>qw(e)?dD(e):e)}function dD(e){return rD(e,[Ww])}function fD(e,t){return lD(e)?QO(cD(uD(e),t)):cD(uD(e),t)}function pD(e,t){return e.length===1?K(e[0],t):e.length===0?iD(t):fD(e,t)}function mD(e,t){return e.length===0?iD(t):e.length===1?K(e[0],t):cD(e,t)}var hD=class extends Vw{};function gD(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function _D(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function vD(e,t){return _D(e,t,`(`)}function yD(e,t){return _D(e,t,`)`)}function bD(e,t){return _D(e,t,`|`)}function xD(e){if(!(vD(e,0)&&yD(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(vD(e,n)&&(t+=1),yD(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function SD(e){return e.slice(1,e.length-1)}function CD(e){let t=0;for(let n=0;n<e.length;n++)if(vD(e,n)&&(t+=1),yD(e,n)&&--t,bD(e,n)&&t===0)return!0;return!1}function wD(e){for(let t=0;t<e.length;t++)if(vD(e,t))return!0;return!1}function TD(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(vD(e,i)&&(t+=1),yD(e,i)&&--t,bD(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(DD(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(DD(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function ED(e){function t(e,t){if(!vD(e,t))throw new hD(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(vD(e,r)&&(n+=1),yD(e,r)&&--n,n===0)return[t,r];throw new hD(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(vD(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(vD(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(DD(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(DD(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function DD(e){return xD(e)?DD(SD(e)):CD(e)?TD(e):wD(e)?ED(e):{type:`const`,const:gD(e)}}function OD(e){return DD(e.slice(1,e.length-1))}var kD=class extends Vw{};function AD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function jD(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function MD(e){return e.type===`const`&&e.const===`.*`}function ND(e){return AD(e)||MD(e)?!1:jD(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>ND(e)):e.type===`const`?!0:(()=>{throw new kD(`Unknown expression type`)})()}function PD(e){return ND(OD(e.pattern))}var FD=class extends Vw{};function*ID(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of ID(e.slice(1)))yield`${t}${n}`}function*LD(e){return yield*ID(e.expr.map(e=>[...BD(e)]))}function*RD(e){for(let t of e.expr)yield*BD(t)}function*zD(e){return yield e.const}function*BD(e){return e.type===`and`?yield*LD(e):e.type===`or`?yield*RD(e):e.type===`const`?yield*zD(e):(()=>{throw new FD(`Unknown expression`)})()}function VD(e){let t=OD(e.pattern);return ND(t)?[...BD(t)]:[]}function HD(e,t){return K({[q]:`Literal`,const:e,type:typeof e},t)}function UD(e){return K({[q]:`Boolean`,type:`boolean`},e)}function WD(e){return K({[q]:`BigInt`,type:`bigint`},e)}function GD(e){return K({[q]:`Number`,type:`number`},e)}function KD(e){return K({[q]:`String`,type:`string`},e)}function*qD(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield UD():t===`number`?yield GD():t===`bigint`?yield WD():t===`string`?yield KD():yield(()=>{let e=t.split(`|`).map(e=>HD(e.trim()));return e.length===0?iD():e.length===1?e[0]:pD(e)})()}function*JD(e){if(e[1]!==`{`)return yield*[HD(`$`),...YD(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=qD(e.slice(2,t)),r=YD(e.slice(t+1));return yield*[...n,...r]}yield HD(e)}function*YD(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[HD(e.slice(0,t)),...JD(e.slice(t))];yield HD(e)}function XD(e){return[...YD(e)]}var ZD=class extends Vw{};function QD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $D(e,t){return CT(e)?e.pattern.slice(1,e.pattern.length-1):OT(e)?`(${e.anyOf.map(e=>$D(e,t)).join(`|`)})`:hT(e)||iT(e)||Qw(e)?`${t}${zE}`:xT(e)?`${t}${BE}`:lT(e)?`${t}${QD(e.const.toString())}`:$w(e)?`${t}${RE}`:(()=>{throw new ZD(`Unexpected Kind '${e[q]}'`)})()}function eO(e){return`^${e.map(e=>$D(e,``)).join(``)}\$`}function tO(e){return pD(VD(e).map(e=>HD(e)))}function nO(e,t){let n=vw(e)?eO(XD(e)):eO(e);return K({[q]:`TemplateLiteral`,type:`string`,pattern:n},t)}function rO(e){return VD(e).map(e=>e.toString())}function iO(e){let t=[];for(let n of e)t.push(...oO(n));return t}function aO(e){return[e.toString()]}function oO(e){return[...new Set(CT(e)?rO(e):OT(e)?iO(e.anyOf):lT(e)?aO(e.const):hT(e)||iT(e)?[`[number]`]:[])]}function sO(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=xO(e,oO(t[i]),n);return r}function cO(e,t,n){return sO(e,t.properties,n)}function lO(e,t,n){return aD(cO(e,t,n))}function uO(e,t){return e.map(e=>vO(e,t))}function dO(e){return e.filter(e=>!fT(e))}function fO(e,t){return sk(dO(uO(e,t)))}function pO(e){return e.some(e=>fT(e))?[]:e}function mO(e,t){return pD(pO(uO(e,t)))}function hO(e,t){return t in e?e[t]:t===`[number]`?pD(e):iD()}function gO(e,t){return t===`[number]`?e:iD()}function _O(e,t){return t in e?e[t]:iD()}function vO(e,t){return aT(e)?fO(e.allOf,t):OT(e)?mO(e.anyOf,t):ET(e)?hO(e.items??[],t):Xw(e)?gO(e.items,t):gT(e)?_O(e.properties,t):iD()}function yO(e,t){return t.map(t=>vO(e,t))}function bO(e,t){return pD(yO(e,t))}function xO(e,t,n){if(yT(e)||yT(t)){if(!PT(e)||!PT(t))throw new Vw(`Index types using Ref parameters require both Type and Key to be of TSchema`);return tD(`Index`,[e,t])}return dT(t)?lO(e,t,n):uT(t)?TO(e,t,n):K(PT(t)?bO(e,oO(t)):bO(e,t),n)}function SO(e,t,n){return{[t]:xO(e,[t],Ow(n))}}function CO(e,t,n){return t.reduce((t,r)=>({...t,...SO(e,r,n)}),{})}function wO(e,t,n){return CO(e,t.keys,n)}function TO(e,t,n){return aD(wO(e,t,n))}function EO(e,t){return K({[q]:`Iterator`,type:`Iterator`,items:e},t)}function DO(e){return globalThis.Object.keys(e).filter(t=>!qw(e[t]))}function OO(e,t){let n=DO(e);return K(n.length>0?{[q]:`Object`,type:`object`,required:n,properties:e}:{[q]:`Object`,type:`object`,properties:e},t)}var kO=OO;function AO(e,t){return K({[q]:`Promise`,type:`Promise`,item:e},t)}function jO(e){return K(rD(e,[Uw]))}function MO(e){return K({...e,[Uw]:`Readonly`})}function NO(e,t){return t===!1?jO(e):MO(e)}function PO(e,t){let n=t??!0;return dT(e)?LO(e,n):NO(e,n)}function FO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=PO(e[r],t);return n}function IO(e,t){return FO(e.properties,t)}function LO(e,t){return aD(IO(e,t))}function RO(e,t){return K(e.length>0?{[q]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[q]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function zO(e,t){return e in t?KO(e,t[e]):aD(t)}function BO(e){return{[e]:HD(e)}}function VO(e){let t={};for(let n of e)t[n]=HD(n);return t}function HO(e,t){return GE(t,e)?BO(e):VO(t)}function UO(e,t){return zO(e,HO(e,t))}function WO(e,t){return t.map(t=>KO(e,t))}function GO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=KO(e,t[r]);return n}function KO(e,t){let n={...t};return qw(t)?QO(KO(e,rD(t,[Ww]))):Kw(t)?PO(KO(e,rD(t,[Uw]))):dT(t)?zO(e,t.properties):uT(t)?UO(e,t.keys):tT(t)?oD(WO(e,t.parameters),KO(e,t.returns),n):rT(t)?sD(WO(e,t.parameters),KO(e,t.returns),n):Zw(t)?eD(KO(e,t.items),n):oT(t)?EO(KO(e,t.items),n):aT(t)?ck(WO(e,t.allOf),n):OT(t)?mD(WO(e,t.anyOf),n):ET(t)?RO(WO(e,t.items??[]),n):gT(t)?kO(GO(e,t.properties),n):Xw(t)?QE(KO(e,t.items),n):_T(t)?AO(KO(e,t.item),n):t}function qO(e,t){let n={};for(let r of e)n[r]=KO(r,t);return n}function JO(e,t,n){let r=PT(e)?oO(e):e;return kO(qO(r,t({[q]:`MappedKey`,keys:r})),n)}function YO(e){return K(rD(e,[Ww]))}function XO(e){return K({...e,[Ww]:`Optional`})}function ZO(e,t){return t===!1?YO(e):XO(e)}function QO(e,t){let n=t??!0;return dT(e)?tk(e,n):ZO(e,n)}function $O(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=QO(e[r],t);return n}function ek(e,t){return $O(e.properties,t)}function tk(e,t){return aD(ek(e,t))}function nk(e,t={}){let n=e.every(e=>gT(e)),r=PT(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return K(t.unevaluatedProperties===!1||PT(t.unevaluatedProperties)||n?{...r,[q]:`Intersect`,type:`object`,allOf:e}:{...r,[q]:`Intersect`,allOf:e},t)}function rk(e){return e.every(e=>qw(e))}function ik(e){return rD(e,[Ww])}function ak(e){return e.map(e=>qw(e)?ik(e):e)}function ok(e,t){return rk(e)?QO(nk(ak(e),t)):nk(ak(e),t)}function sk(e,t={}){if(e.length===1)return K(e[0],t);if(e.length===0)return iD(t);if(e.some(e=>TT(e)))throw Error(`Cannot intersect transform types`);return ok(e,t)}function ck(e,t){if(e.length===1)return K(e[0],t);if(e.length===0)return iD(t);if(e.some(e=>TT(e)))throw Error(`Cannot intersect transform types`);return nk(e,t)}function lk(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new Vw(`Ref: $ref must be a string`);return K({[q]:`Ref`,$ref:t},n)}function uk(e,t){return tD(`Awaited`,[tD(e,t)])}function dk(e){return tD(`Awaited`,[lk(e)])}function fk(e){return ck(hk(e))}function pk(e){return mD(hk(e))}function mk(e){return gk(e)}function hk(e){return e.map(e=>gk(e))}function gk(e,t){return K(eT(e)?uk(e.target,e.parameters):aT(e)?fk(e.allOf):OT(e)?pk(e.anyOf):_T(e)?mk(e.item):yT(e)?dk(e.$ref):e,t)}function _k(e){let t=[];for(let n of e)t.push(wk(n));return t}function vk(e){return XE(_k(e))}function yk(e){return YE(_k(e))}function bk(e){return e.map((e,t)=>t.toString())}function xk(e){return[`[number]`]}function Sk(e){return globalThis.Object.getOwnPropertyNames(e)}function Ck(e){return Tk?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function wk(e){return aT(e)?vk(e.allOf):OT(e)?yk(e.anyOf):ET(e)?bk(e.items??[]):Xw(e)?xk(e.items):gT(e)?Sk(e.properties):vT(e)?Ck(e.patternProperties):[]}var Tk=!1;function Ek(e,t){return tD(`KeyOf`,[tD(e,t)])}function Dk(e){return tD(`KeyOf`,[lk(e)])}function Ok(e,t){return K(pD(kk(wk(e))),t)}function kk(e){return e.map(e=>e===`[number]`?GD():HD(e))}function Ak(e,t){return eT(e)?Ek(e.target,e.parameters):yT(e)?Dk(e.$ref):dT(e)?Nk(e,t):Ok(e,t)}function jk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Ak(e[r],Ow(t));return n}function Mk(e,t){return jk(e.properties,t)}function Nk(e,t){return aD(Mk(e,t))}function Pk(e){let t=[];for(let n of e)t.push(...wk(n));return KE(t)}function Fk(e){return e.filter(e=>!fT(e))}function Ik(e,t){let n=[];for(let r of e)n.push(...yO(r,[t]));return Fk(n)}function Lk(e,t){let n={};for(let r of t)n[r]=sk(Ik(e,r));return n}function Rk(e,t){return kO(Lk(e,Pk(e)),t)}function zk(e){return K({[q]:`Date`,type:`Date`},e)}function Bk(e){return K({[q]:`Null`,type:`null`},e)}function Vk(e){return K({[q]:`Symbol`,type:`symbol`},e)}function Hk(e){return K({[q]:`Undefined`,type:`undefined`},e)}function Uk(e){return K({[q]:`Uint8Array`,type:`Uint8Array`},e)}function Wk(e){return K({[q]:`Unknown`},e)}function Gk(e){return e.map(e=>Jk(e,!1))}function Kk(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=PO(Jk(e[n],!1));return t}function qk(e,t){return t===!0?e:PO(e)}function Jk(e,t){return sw(e)||pw(e)?qk(ZE(),t):cw(e)?PO(RO(Gk(e))):bw(e)?Uk():dw(e)?zk():gw(e)?qk(kO(Kk(e)),t):fw(e)?qk(sD([],Wk()),t):xw(e)?Hk():mw(e)?Bk():yw(e)?Vk():lw(e)?WD():hw(e)||uw(e)||vw(e)?HD(e):kO({})}function Yk(e,t){return K(Jk(e,!0),t)}function Xk(e,t){return tT(e)?RO(e.parameters,t):iD(t)}function Zk(e,t){if(xw(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return mD([...new Set(n)].map(e=>HD(e)),{...t,[Gw]:`Enum`})}var Qk=class extends Vw{},J;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(J||={});function $k(e){return e===J.False?e:J.True}function eA(e){throw new Qk(e)}function tA(e){return hE(e)||aE(e)||jE(e)||NE(e)||qT(e)}function nA(e,t){return hE(t)?bA(e,t):aE(t)?gA(e,t):jE(t)?rj(e,t):NE(t)?aj(e,t):qT(t)?rA(e,t):eA(`StructuralRight`)}function rA(e,t){return J.True}function iA(e,t){return aE(t)?gA(e,t):jE(t)&&t.anyOf.some(e=>qT(e)||NE(e))?J.True:jE(t)?J.Union:NE(t)||qT(t)?J.True:J.Union}function aA(e,t){return NE(e)?J.False:qT(e)?J.Union:hE(e)?J.True:J.False}function oA(e,t){return yE(t)&&LA(t)?J.True:tA(t)?nA(e,t):YT(t)?$k(lj(e.items,t.items)):J.False}function sA(e,t){return tA(t)?nA(e,t):XT(t)?$k(lj(e.items,t.items)):J.False}function cA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):ZT(t)?J.True:J.False}function lA(e,t){return uE(e)||QT(e)?J.True:J.False}function uA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):QT(t)?J.True:J.False}function dA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):eE(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>$k(lj(t.parameters[n],e))===J.True)?$k(lj(e.returns,t.returns)):J.False:J.False}function fA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):tE(t)?J.True:J.False}function pA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):nE(t)?e.parameters.length>t.parameters.length?J.False:e.parameters.every((e,n)=>$k(lj(t.parameters[n],e))===J.True)?$k(lj(e.returns,t.returns)):J.False:J.False}function mA(e,t){return dE(e)&&hw(e.const)||vE(e)||rE(e)?J.True:J.False}function hA(e,t){return rE(t)||vE(t)?J.True:tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):J.False}function gA(e,t){return t.allOf.every(t=>lj(e,t)===J.True)?J.True:J.False}function _A(e,t){return e.allOf.some(e=>lj(e,t)===J.True)?J.True:J.False}function vA(e,t){return tA(t)?nA(e,t):oE(t)?$k(lj(e.items,t.items)):J.False}function yA(e,t){return dE(t)&&t.const===e.const?J.True:tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):wE(t)?JA(e,t):vE(t)?TA(e,t):rE(t)?mA(e,t):QT(t)?lA(e,t):J.False}function bA(e,t){return J.False}function xA(e,t){return J.True}function SA(e){let[t,n]=[e,0];for(;gE(t);)t=t.not,n+=1;return n%2==0?t:Wk()}function CA(e,t){return gE(e)?lj(SA(e),t):gE(t)?lj(e,SA(t)):eA(`Invalid fallthrough for Not`)}function wA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):_E(t)?J.True:J.False}function TA(e,t){return lE(e)||vE(e)||rE(e)?J.True:J.False}function EA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):rE(t)||vE(t)?J.True:J.False}function DA(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function OA(e){return LA(e)}function kA(e){return DA(e,0)||DA(e,1)&&`description`in e.properties&&jE(e.properties.description)&&e.properties.description.anyOf.length===2&&(wE(e.properties.description.anyOf[0])&&AE(e.properties.description.anyOf[1])||wE(e.properties.description.anyOf[1])&&AE(e.properties.description.anyOf[0]))}function AA(e){return DA(e,0)}function jA(e){return DA(e,0)}function MA(e){return DA(e,0)}function NA(e){return DA(e,0)}function PA(e){return LA(e)}function FA(e){let t=GD();return DA(e,0)||DA(e,1)&&`length`in e.properties&&$k(lj(e.properties.length,t))===J.True}function IA(e){return DA(e,0)}function LA(e){let t=GD();return DA(e,0)||DA(e,1)&&`length`in e.properties&&$k(lj(e.properties.length,t))===J.True}function RA(e){let t=sD([ZE()],ZE());return DA(e,0)||DA(e,1)&&`then`in e.properties&&$k(lj(e.properties.then,t))===J.True}function zA(e,t){return lj(e,t)===J.False||KT(e)&&!KT(t)?J.False:J.True}function BA(e,t){return NE(e)?J.False:qT(e)?J.Union:hE(e)||cE(e)&&OA(t)||lE(e)&&AA(t)||uE(e)&&jA(t)||TE(e)&&kA(t)||ZT(e)&&MA(t)||wE(e)&&OA(t)||TE(e)&&kA(t)||vE(e)&&AA(t)||rE(e)&&AA(t)||QT(e)&&jA(t)||ME(e)&&PA(t)||tE(e)&&NA(t)||eE(e)&&IA(t)||nE(e)&&FA(t)?J.True:xE(e)&&wE(UA(e))?t[Gw]===`Record`?J.True:J.False:xE(e)&&vE(UA(e))&&DA(t,0)?J.True:J.False}function VA(e,t){return tA(t)?nA(e,t):xE(t)?GA(e,t):yE(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!KT(t.properties[n]))return J.False;if(KT(t.properties[n]))return J.True;if(zA(e.properties[n],t.properties[n])===J.False)return J.False}return J.True})():J.False}function HA(e,t){return tA(t)?nA(e,t):yE(t)&&RA(t)?J.True:bE(t)?$k(lj(e.item,t.item)):J.False}function UA(e){return HE in e.patternProperties?GD():UE in e.patternProperties?KD():eA(`Unknown record key pattern`)}function WA(e){return HE in e.patternProperties?e.patternProperties[HE]:UE in e.patternProperties?e.patternProperties[UE]:eA(`Unable to get record value schema`)}function GA(e,t){let[n,r]=[UA(t),WA(t)];return cE(e)&&vE(n)&&$k(lj(e,r))===J.True?J.True:ME(e)&&vE(n)||wE(e)&&vE(n)||YT(e)&&vE(n)?lj(e,r):yE(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(zA(r,e.properties[t])===J.False)return J.False;return J.True})():J.False}function KA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?lj(WA(e),WA(t)):J.False}function qA(e,t){return lj(CE(e)?KD():e,CE(t)?KD():t)}function JA(e,t){return dE(e)&&vw(e.const)||wE(e)?J.True:J.False}function YA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):wE(t)?J.True:J.False}function XA(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):TE(t)?J.True:J.False}function ZA(e,t){return EE(e)?lj(tO(e),t):EE(t)?lj(e,tO(t)):eA(`Invalid fallthrough for TemplateLiteral`)}function QA(e,t){return YT(t)&&e.items!==void 0&&e.items.every(e=>lj(e,t.items)===J.True)}function $A(e,t){return hE(e)?J.True:NE(e)?J.False:qT(e)?J.Union:J.False}function ej(e,t){return tA(t)?nA(e,t):yE(t)&&LA(t)||YT(t)&&QA(e,t)?J.True:kE(t)?xw(e.items)&&!xw(t.items)||!xw(e.items)&&xw(t.items)?J.False:xw(e.items)&&!xw(t.items)||e.items.every((e,n)=>lj(e,t.items[n])===J.True)?J.True:J.False:J.False}function tj(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):ME(t)?J.True:J.False}function nj(e,t){return tA(t)?nA(e,t):yE(t)?BA(e,t):xE(t)?GA(e,t):FE(t)?sj(e,t):AE(t)?J.True:J.False}function rj(e,t){return t.anyOf.some(t=>lj(e,t)===J.True)?J.True:J.False}function ij(e,t){return e.anyOf.every(e=>lj(e,t)===J.True)?J.True:J.False}function aj(e,t){return J.True}function oj(e,t){return hE(t)?bA(e,t):aE(t)?gA(e,t):jE(t)?rj(e,t):qT(t)?rA(e,t):wE(t)?JA(e,t):vE(t)?TA(e,t):rE(t)?mA(e,t):QT(t)?lA(e,t):YT(t)?aA(e,t):kE(t)?$A(e,t):yE(t)?BA(e,t):NE(t)?J.True:J.False}function sj(e,t){return AE(e)||AE(e)?J.True:J.False}function cj(e,t){return aE(t)?gA(e,t):jE(t)?rj(e,t):NE(t)?aj(e,t):qT(t)?rA(e,t):yE(t)?BA(e,t):FE(t)?J.True:J.False}function lj(e,t){return EE(e)||EE(t)?ZA(e,t):CE(e)||CE(t)?qA(e,t):gE(e)||gE(t)?CA(e,t):qT(e)?iA(e,t):YT(e)?oA(e,t):ZT(e)?cA(e,t):QT(e)?uA(e,t):XT(e)?sA(e,t):eE(e)?dA(e,t):tE(e)?fA(e,t):nE(e)?pA(e,t):rE(e)?hA(e,t):aE(e)?_A(e,t):oE(e)?vA(e,t):dE(e)?yA(e,t):hE(e)?xA(e,t):_E(e)?wA(e,t):vE(e)?EA(e,t):yE(e)?VA(e,t):xE(e)?KA(e,t):wE(e)?YA(e,t):TE(e)?XA(e,t):kE(e)?ej(e,t):bE(e)?HA(e,t):ME(e)?tj(e,t):AE(e)?nj(e,t):jE(e)?ij(e,t):NE(e)?oj(e,t):FE(e)?cj(e,t):eA(`Unknown left type operand '${e[q]}'`)}function uj(e,t){return lj(e,t)}function dj(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=hj(e[o],t,n,r,Ow(i));return a}function fj(e,t,n,r,i){return dj(e.properties,t,n,r,i)}function pj(e,t,n,r,i){return aD(fj(e,t,n,r,i))}function mj(e,t,n,r){let i=uj(e,t);return i===J.Union?mD([n,r]):i===J.True?n:r}function hj(e,t,n,r,i){return dT(e)?pj(e,t,n,r,i):uT(e)?K(yj(e,t,n,r,i)):K(mj(e,t,n,r),i)}function gj(e,t,n,r,i){return{[e]:hj(HD(e),t,n,r,Ow(i))}}function _j(e,t,n,r,i){return e.reduce((e,a)=>({...e,...gj(a,t,n,r,i)}),{})}function vj(e,t,n,r,i){return _j(e.keys,t,n,r,i)}function yj(e,t,n,r,i){return aD(vj(e,t,n,r,i))}function bj(e,t){return Sj(tO(e),t)}function xj(e,t){let n=e.filter(e=>uj(e,t)===J.False);return n.length===1?n[0]:mD(n)}function Sj(e,t,n={}){return CT(e)?K(bj(e,t),n):dT(e)?K(Tj(e,t),n):K(OT(e)?xj(e.anyOf,t):uj(e,t)===J.False?e:iD(),n)}function Cj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Sj(e[r],t);return n}function wj(e,t){return Cj(e.properties,t)}function Tj(e,t){return aD(wj(e,t))}function Ej(e,t){return Oj(tO(e),t)}function Dj(e,t){let n=e.filter(e=>uj(e,t)!==J.False);return n.length===1?n[0]:mD(n)}function Oj(e,t,n){return CT(e)?K(Ej(e,t),n):dT(e)?K(jj(e,t),n):K(OT(e)?Dj(e.anyOf,t):uj(e,t)===J.False?iD():e,n)}function kj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Oj(e[r],t);return n}function Aj(e,t){return kj(e.properties,t)}function jj(e,t){return aD(Aj(e,t))}function Mj(e,t){return tT(e)?K(e.returns,t):iD(t)}function Nj(e){return PO(QO(e))}function Pj(e,t,n){return K({[q]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function Fj(e,t,n){let r={};for(let n of e)r[n]=t;return kO(r,{...n,[Gw]:`Record`})}function Ij(e,t,n){return PD(e)?Fj(oO(e),t,n):Pj(e.pattern,t,n)}function Lj(e,t,n){return Fj(oO(mD(e)),t,n)}function Rj(e,t,n){return Fj([e.toString()],t,n)}function zj(e,t,n){return Pj(e.source,t,n)}function Bj(e,t,n){return Pj(xw(e.pattern)?UE:e.pattern,t,n)}function Vj(e,t,n){return Pj(UE,t,n)}function Hj(e,t,n){return Pj(WE,t,n)}function Uj(e,t,n){return kO({true:t,false:t},n)}function Wj(e,t,n){return Pj(HE,t,n)}function Gj(e,t,n){return Pj(HE,t,n)}function Kj(e,t,n={}){return OT(e)?Lj(e.anyOf,t,n):CT(e)?Ij(e,t,n):lT(e)?Rj(e.const,t,n):$w(e)?Uj(e,t,n):iT(e)?Wj(e,t,n):hT(e)?Gj(e,t,n):bT(e)?zj(e,t,n):xT(e)?Bj(e,t,n):Jw(e)?Vj(e,t,n):fT(e)?Hj(e,t,n):iD(n)}function qj(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function Jj(e){let t=qj(e);return t===UE?KD():t===HE?GD():KD({pattern:t})}function Yj(e){return e.patternProperties[qj(e)]}function Xj(e,t){return t.parameters=uM(e,t.parameters),t.returns=dM(e,t.returns),t}function Zj(e,t){return t.parameters=uM(e,t.parameters),t.returns=dM(e,t.returns),t}function Qj(e,t){return t.allOf=uM(e,t.allOf),t}function $j(e,t){return t.anyOf=uM(e,t.anyOf),t}function eM(e,t){return xw(t.items)||(t.items=uM(e,t.items)),t}function tM(e,t){return t.items=dM(e,t.items),t}function nM(e,t){return t.items=dM(e,t.items),t}function rM(e,t){return t.items=dM(e,t.items),t}function iM(e,t){return t.item=dM(e,t.item),t}function aM(e,t){let n=lM(e,t.properties);return{...t,...kO(n)}}function oM(e,t){let n=Kj(dM(e,Jj(t)),dM(e,Yj(t)));return{...t,...n}}function sM(e,t){return t.index in e?e[t.index]:Wk()}function cM(e,t){let n=Kw(t),r=qw(t),i=dM(e,t);return n&&r?Nj(i):n&&!r?PO(i):!n&&r?QO(i):i}function lM(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:cM(e,t[r])}),{})}function uM(e,t){return t.map(t=>dM(e,t))}function dM(e,t){return tT(t)?Xj(e,t):rT(t)?Zj(e,t):aT(t)?Qj(e,t):OT(t)?$j(e,t):ET(t)?eM(e,t):Xw(t)?tM(e,t):Zw(t)?nM(e,t):oT(t)?rM(e,t):_T(t)?iM(e,t):gT(t)?aM(e,t):vT(t)?oM(e,t):Yw(t)?sM(e,t):t}function fM(e,t){return dM(t,kw(e))}function pM(e){return K({[q]:`Integer`,type:`integer`},e)}function mM(e,t,n){return{[e]:TM(HD(e),t,Ow(n))}}function hM(e,t,n){return e.reduce((e,r)=>({...e,...mM(r,t,n)}),{})}function gM(e,t,n){return hM(e.keys,t,n)}function _M(e,t,n){return aD(gM(e,t,n))}function vM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function yM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function bM(e){return e.toUpperCase()}function xM(e){return e.toLowerCase()}function SM(e,t,n){let r=OD(e.pattern);return ND(r)?nO([mD(wM([...BD(r)].map(e=>HD(e)),t))],n):{...e,pattern:CM(e.pattern,t)}}function CM(e,t){return typeof e==`string`?t===`Uncapitalize`?vM(e):t===`Capitalize`?yM(e):t===`Uppercase`?bM(e):t===`Lowercase`?xM(e):e:e.toString()}function wM(e,t){return e.map(e=>TM(e,t))}function TM(e,t,n={}){return uT(e)?_M(e,t,n):CT(e)?SM(e,t,n):OT(e)?mD(wM(e.anyOf,t),n):lT(e)?HD(CM(e.const,t),n):K(e,n)}function EM(e,t={}){return TM(e,`Capitalize`,t)}function DM(e,t={}){return TM(e,`Lowercase`,t)}function OM(e,t={}){return TM(e,`Uncapitalize`,t)}function kM(e,t={}){return TM(e,`Uppercase`,t)}function AM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=BM(e[i],t,Ow(n));return r}function jM(e,t,n){return AM(e.properties,t,n)}function MM(e,t,n){return aD(jM(e,t,n))}function NM(e,t){return e.map(e=>zM(e,t))}function PM(e,t){return e.map(e=>zM(e,t))}function FM(e,t){let{[t]:n,...r}=e;return r}function IM(e,t){return t.reduce((e,t)=>FM(e,t),e)}function LM(e,t,n){let r=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(IM(n,t),r)}function RM(e){return mD(e.reduce((e,t)=>cT(t)?[...e,HD(t)]:e,[]))}function zM(e,t){return aT(e)?ck(NM(e.allOf,t)):OT(e)?mD(PM(e.anyOf,t)):gT(e)?LM(e,t,e.properties):kO({})}function BM(e,t,n){let r=cw(t)?RM(t):t,i=PT(t)?oO(t):t,a=yT(e),o=yT(t);return dT(e)?MM(e,i,n):uT(t)?WM(e,t,n):a&&o||!a&&o||a&&!o?tD(`Omit`,[e,r],n):K({...zM(e,i),...n})}function VM(e,t,n){return{[t]:BM(e,[t],Ow(n))}}function HM(e,t,n){return t.reduce((t,r)=>({...t,...VM(e,r,n)}),{})}function UM(e,t,n){return HM(e,t.keys,n)}function WM(e,t,n){return aD(UM(e,t,n))}function GM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=eN(e[i],t,Ow(n));return r}function KM(e,t,n){return GM(e.properties,t,n)}function qM(e,t,n){return aD(KM(e,t,n))}function JM(e,t){return e.map(e=>$M(e,t))}function YM(e,t){return e.map(e=>$M(e,t))}function XM(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function ZM(e,t,n){let r=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(XM(n,t),r)}function QM(e){return mD(e.reduce((e,t)=>cT(t)?[...e,HD(t)]:e,[]))}function $M(e,t){return aT(e)?ck(JM(e.allOf,t)):OT(e)?mD(YM(e.anyOf,t)):gT(e)?ZM(e,t,e.properties):kO({})}function eN(e,t,n){let r=cw(t)?QM(t):t,i=PT(t)?oO(t):t,a=yT(e),o=yT(t);return dT(e)?qM(e,i,n):uT(t)?iN(e,t,n):a&&o||!a&&o||a&&!o?tD(`Pick`,[e,r],n):K({...$M(e,i),...n})}function tN(e,t,n){return{[t]:eN(e,[t],Ow(n))}}function nN(e,t,n){return t.reduce((t,r)=>({...t,...tN(e,r,n)}),{})}function rN(e,t,n){return nN(e,t.keys,n)}function iN(e,t,n){return aD(rN(e,t,n))}function aN(e,t){return tD(`Partial`,[tD(e,t)])}function oN(e){return tD(`Partial`,[lk(e)])}function sN(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=QO(e[n]);return t}function cN(e,t){let n=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(sN(t),n)}function lN(e){return e.map(e=>uN(e))}function uN(e){return eT(e)?aN(e.target,e.parameters):yT(e)?oN(e.$ref):aT(e)?ck(lN(e.allOf)):OT(e)?mD(lN(e.anyOf)):gT(e)?cN(e,e.properties):Qw(e)||$w(e)||iT(e)||lT(e)||mT(e)||hT(e)||xT(e)||ST(e)||DT(e)?e:kO({})}function dN(e,t){return dT(e)?mN(e,t):K({...uN(e),...t})}function fN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=dN(e[r],Ow(t));return n}function pN(e,t){return fN(e.properties,t)}function mN(e,t){return aD(pN(e,t))}function hN(e,t){return tD(`Required`,[tD(e,t)])}function gN(e){return tD(`Required`,[lk(e)])}function _N(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=rD(e[n],[Ww]);return t}function vN(e,t){let n=rD(e,[Hw,`$id`,`required`,`properties`]);return kO(_N(t),n)}function yN(e){return e.map(e=>bN(e))}function bN(e){return eT(e)?hN(e.target,e.parameters):yT(e)?gN(e.$ref):aT(e)?ck(yN(e.allOf)):OT(e)?mD(yN(e.anyOf)):gT(e)?vN(e,e.properties):Qw(e)||$w(e)||iT(e)||lT(e)||mT(e)||hT(e)||xT(e)||ST(e)||DT(e)?e:kO({})}function xN(e,t){return dT(e)?wN(e,t):K({...bN(e),...t})}function SN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=xN(e[r],t);return n}function CN(e,t){return SN(e.properties,t)}function wN(e,t){return aD(CN(e,t))}function TN(e,t){return t.map(t=>yT(t)?EN(e,t.$ref):qN(e,t))}function EN(e,t){return t in e?yT(e[t])?EN(e,e[t].$ref):qN(e,e[t]):iD()}function DN(e){return gk(e[0])}function ON(e){return xO(e[0],e[1])}function kN(e){return Ak(e[0])}function AN(e){return dN(e[0])}function jN(e){return BM(e[0],e[1])}function MN(e){return eN(e[0],e[1])}function NN(e){return xN(e[0])}function PN(e,t,n){let r=TN(e,n);return t===`Awaited`?DN(r):t===`Index`?ON(r):t===`KeyOf`?kN(r):t===`Partial`?AN(r):t===`Omit`?jN(r):t===`Pick`?MN(r):t===`Required`?NN(r):iD()}function FN(e,t){return QE(qN(e,t))}function IN(e,t){return eD(qN(e,t))}function LN(e,t,n){return oD(KN(e,t),qN(e,n))}function RN(e,t,n){return sD(KN(e,t),qN(e,n))}function zN(e,t){return ck(KN(e,t))}function BN(e,t){return EO(qN(e,t))}function VN(e,t){return kO(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:qN(e,t[r])}),{}))}function HN(e,t){let[n,r]=[qN(e,Yj(t)),qj(t)],i=kw(t);return i.patternProperties[r]=n,i}function UN(e,t){return yT(t)?{...EN(e,t.$ref),[Hw]:t[Hw]}:t}function WN(e,t){return RO(KN(e,t))}function GN(e,t){return mD(KN(e,t))}function KN(e,t){return t.map(t=>qN(e,t))}function qN(e,t){return qw(t)?K(qN(e,rD(t,[Ww])),t):Kw(t)?K(qN(e,rD(t,[Uw])),t):TT(t)?K(UN(e,t),t):Xw(t)?K(FN(e,t.items),t):Zw(t)?K(IN(e,t.items),t):eT(t)?K(PN(e,t.target,t.parameters)):tT(t)?K(LN(e,t.parameters,t.returns),t):rT(t)?K(RN(e,t.parameters,t.returns),t):aT(t)?K(zN(e,t.allOf),t):oT(t)?K(BN(e,t.items),t):gT(t)?K(VN(e,t.properties),t):vT(t)?K(HN(e,t)):ET(t)?K(WN(e,t.items||[]),t):OT(t)?K(GN(e,t.anyOf),t):t}function JN(e,t){return t in e?qN(e,e[t]):iD()}function YN(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:JN(e,n)}),{})}var XN=class{constructor(e){let t=YN(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:K(this.$defs[e],t)};return K({[q]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function ZN(e){return new XN(e)}function QN(e,t){return K({[q]:`Not`,not:e},t)}function $N(e,t){return rT(e)?RO(e.parameters,t):iD()}var eP=0;function tP(e,t={}){xw(t.$id)&&(t.$id=`T${eP++}`);let n=kw(e({[q]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,K({[Gw]:`Recursive`,...n},t)}function nP(e,t){let n=vw(e)?new globalThis.RegExp(e):e;return K({[q]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function rP(e){return aT(e)?e.allOf:OT(e)?e.anyOf:ET(e)?e.items??[]:[]}function iP(e){return rP(e)}function aP(e,t){return rT(e)?K(e.returns,t):iD(t)}var oP=class{constructor(e){this.schema=e}Decode(e){return new sP(this.schema,e)}},sP=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[Hw].Encode(e(n)),Decode:e=>this.decode(t[Hw].Decode(e))};return{...t,[Hw]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[Hw]:n}}Encode(e){return TT(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function cP(e){return new oP(e)}function lP(e={}){return K({[q]:e[q]??`Unsafe`},e)}function uP(e){return K({[q]:`Void`,type:`void`},e)}var Y=s({Any:()=>ZE,Argument:()=>$E,Array:()=>QE,AsyncIterator:()=>eD,Awaited:()=>gk,BigInt:()=>WD,Boolean:()=>UD,Capitalize:()=>EM,Composite:()=>Rk,Const:()=>Yk,Constructor:()=>oD,ConstructorParameters:()=>Xk,Date:()=>zk,Enum:()=>Zk,Exclude:()=>Sj,Extends:()=>hj,Extract:()=>Oj,Function:()=>sD,Index:()=>xO,InstanceType:()=>Mj,Instantiate:()=>fM,Integer:()=>pM,Intersect:()=>ck,Iterator:()=>EO,KeyOf:()=>Ak,Literal:()=>HD,Lowercase:()=>DM,Mapped:()=>JO,Module:()=>ZN,Never:()=>iD,Not:()=>QN,Null:()=>Bk,Number:()=>GD,Object:()=>kO,Omit:()=>BM,Optional:()=>QO,Parameters:()=>$N,Partial:()=>dN,Pick:()=>eN,Promise:()=>AO,Readonly:()=>PO,ReadonlyOptional:()=>Nj,Record:()=>Kj,Recursive:()=>tP,Ref:()=>lk,RegExp:()=>nP,Required:()=>xN,Rest:()=>iP,ReturnType:()=>aP,String:()=>KD,Symbol:()=>Vk,TemplateLiteral:()=>nO,Transform:()=>cP,Tuple:()=>RO,Uint8Array:()=>Uk,Uncapitalize:()=>OM,Undefined:()=>Hk,Union:()=>mD,Unknown:()=>Wk,Unsafe:()=>lP,Uppercase:()=>kM,Void:()=>uP});function dP(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fP(e,t){return Y.String({pattern:`^${dP(e)}${Ft}$`,...t===void 0?{}:{description:t}})}var X=Y.String({minLength:1,description:`ISO 8601 date-time string`}),pP=Y.String({minLength:1});fP(Lt.project,`ProjectId`);var mP=fP(Lt.message,`MessageId`),hP=fP(Lt.taskModule,`TaskModuleId`),gP=fP(Lt.task,`TaskId`),_P=fP(Lt.runResult,`RunResultId`),vP=fP(Lt.recoverySummary,`RecoverySummaryId`),yP=fP(Lt.activity,`ActivityRef`),bP=fP(Lt.event,`EventRef`),xP=fP(Lt.workflowInvocation,`WorkflowInvocationRef`),SP=fP(Lt.clarificationThread,`ClarificationThreadRef`),CP=fP(Lt.clarificationRound,`ClarificationRoundRef`);fP(Lt.clarificationInteractionResponse,`ClarificationInteractionResponseId`);var wP=fP(Lt.approvalRequest,`ApprovalRequestId`),TP=fP(Lt.idempotency,`IdempotencyKey`),EP=fP(Lt.relayProject,`RelayProjectRef`);fP(Lt.relayAccount,`RelayAccountRef`),fP(Lt.relayMembership,`RelayMembershipRef`),fP(Lt.relayAccountSession,`RelayAccountSessionRef`),fP(Lt.relayClientSession,`RelayClientSessionId`);var DP=fP(Lt.relayUpload,`RelayUploadRef`);fP(Lt.relayAuthChallenge,`RelayAuthChallengeRef`),fP(Lt.hostConnection,`HostConnectionRef`),fP(Lt.joinToken,`JoinTokenRef`);var OP=Y.Union([Y.Literal(`project_context_bootstrap`),Y.Literal(`scratchpad_refresh`),Y.Literal(`task_compile`),Y.Literal(`context_sync`),Y.Literal(`reference_summary_refresh`),Y.Literal(`recovery_check`),Y.Literal(`follow_up_check`)]);Y.Object({cursor:Y.Optional(pP),limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50}))},{additionalProperties:!1});function kP(e){return Y.Object({items:Y.Array(e),page:Y.Object({next_cursor:Y.Optional(pP),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}function AP(e){return Y.Object({items:Y.Array(e),window:Y.Object({older_cursor:Y.Optional(pP),newer_cursor:Y.Optional(pP),has_older:Y.Boolean(),has_newer:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:200})},{additionalProperties:!1})},{additionalProperties:!1})}var jP=Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workspace`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`session`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`bootstrap`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`messages`),scope:Y.Literal(`clarification_round`),round_id:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`read_state`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_detail`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task_run_results`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification`),thread_id:Y.Optional(SP),round_id:Y.Optional(CP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`execution_status`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`activity`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_config`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_usage`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_timeline`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`skills`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`artifacts`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`viewer`),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recovery_summaries`)},{additionalProperties:!1})]);Y.Object({kind:Y.String({minLength:1})});var MP=Y.Object({kind:Y.Literal(`interrupted`),retry_with_new_command_id:Y.Literal(!0)},{additionalProperties:!1});function NP(e){return Y.Object({command_id:TP,issued_at:X,payload:e},{additionalProperties:!1})}function PP(e){return Y.Object({command_id:TP,disposition:e,invalidates:Y.Optional(Y.Array(jP))},{additionalProperties:!1})}function FP(e,t){return Y.Object({command_id:TP,disposition:e,result:Y.Optional(t),invalidates:Y.Optional(Y.Array(jP))},{additionalProperties:!1})}var IP=Y.Union([Y.Literal(`bad_request`),Y.Literal(`unauthorized`),Y.Literal(`forbidden`),Y.Literal(`not_found`),Y.Literal(`conflict`),Y.Literal(`validation_failed`),Y.Literal(`provider_not_configured`),Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`relay_session_invalid`),Y.Literal(`command_replay_mismatch`),Y.Literal(`repo_snapshot_unavailable`),Y.Literal(`host_unavailable`),Y.Literal(`internal_error`)]);Y.Object({error:Y.Object({code:IP,message:Y.String({minLength:1}),retryable:Y.Boolean(),details:Y.Optional(Y.Unknown())},{additionalProperties:!1})},{additionalProperties:!1}),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`message.created`),Y.Literal(`scratchpad.updated`),Y.Literal(`worklist.changed`),Y.Literal(`task.updated`),Y.Literal(`task_detail.updated`),Y.Literal(`clarification.changed`),Y.Literal(`approval.changed`),Y.Literal(`activity.event`),Y.Literal(`execution_status.changed`),Y.Literal(`provider_config.changed`),Y.Literal(`workspace.recovered`),Y.Literal(`query.invalidate`)]),Y.Union([Y.Object({kind:Y.Literal(`all`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`me`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`recent_projects`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`join_entries`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project_presence`),relay_project_ref:EP},{additionalProperties:!1})]),Y.Union([Y.Literal(`connection.ready`),Y.Literal(`query.invalidate`)]);var LP=Y.Object({retention_seconds:Y.Literal(300),max_events:Y.Literal(1e3)},{additionalProperties:!1}),Z=Y.String({minLength:1}),RP=Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`),Y.Literal(`unknown`)]),zP=RP,BP=Y.Union([Y.Object({status:Y.Literal(`not_configured`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`configured`),provider:Y.Literal(`openai`),auth_kind:Y.Literal(`api_key`),redacted_key:Z,default_model:Z,validated_at:X},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),provider:Y.Optional(Y.Literal(`openai`)),auth_kind:Y.Optional(Y.Literal(`api_key`)),redacted_key:Y.Optional(Z),default_model:Y.Optional(Z),validated_at:Y.Optional(X),invalid_reason_code:Y.Optional(RP)},{additionalProperties:!1})]),VP=Y.Union([Y.Literal(`implementation`),Y.Literal(`planning`),Y.Literal(`context`),Y.Literal(`qna`),Y.Literal(`other`)]),HP=Y.Object({input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),UP=Y.Object({source:Y.String({minLength:1}),label:Y.String({minLength:1}),category:VP,input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),WP=Y.Object({model:Y.String({minLength:1}),input_tokens:Y.Integer({minimum:0}),cached_input_tokens:Y.Integer({minimum:0}),output_tokens:Y.Integer({minimum:0}),reasoning_output_tokens:Y.Integer({minimum:0}),total_tokens:Y.Integer({minimum:0}),event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),GP=Y.Object({total_tokens:Y.Integer({minimum:0}),totals:HP,by_source:Y.Array(UP),by_model:Y.Array(WP),recent_windows:Y.Object({today:HP,last_7_days:HP,last_30_days:HP},{additionalProperties:!1})},{additionalProperties:!1}),KP=Y.Union([Y.Literal(`task_accepted`),Y.Literal(`task_update`),Y.Literal(`checkpoint`)]),qP=Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`)]),JP=Y.Union([Y.Literal(`needs_input`),Y.Literal(`completed`),Y.Literal(`failed`)]),YP=Y.Union([Y.Literal(`neutral`),Y.Literal(`success`),Y.Literal(`warning`),Y.Literal(`error`)]),XP=Y.Object({kind:Y.Union([Y.Literal(`worklist_task`),Y.Literal(`chat_message`),Y.Literal(`reference_file`),Y.Literal(`repo_path`)]),label:Y.String({minLength:1}),task_id:Y.Optional(gP),message_id:Y.Optional(mP),path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1}),ZP=Y.Object({message_id:mP,author:Y.String({minLength:1}),body:Y.String(),created_at:X},{additionalProperties:!1}),QP=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.String({minLength:1}),source:Y.Optional(Y.Union([Y.Literal(`scratchpad`),Y.Literal(`clarification`),Y.Literal(`contract`)]))},{additionalProperties:!1}),$P=Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),request:Y.Optional(Y.String()),status:Y.Optional(Y.Union([Y.Literal(`active`),Y.Literal(`resolved`)])),answer_count:Y.Optional(Y.Integer({minimum:0})),answers:Y.Optional(Y.Array(ZP))},{additionalProperties:!1}),eF=Y.Union([Y.Literal(`added`),Y.Literal(`modified`),Y.Literal(`deleted`),Y.Literal(`renamed`),Y.Literal(`unknown`)]),tF=Y.Object({tone:YP,summary:Y.Optional(Y.String()),origin:Y.Optional(Y.Object({title:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),snippets:Y.Optional(Y.Array(ZP)),source_count:Y.Optional(Y.Integer({minimum:0})),unavailable_reason:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),decisions:Y.Optional(Y.Array(QP)),clarification:Y.Optional($P),contract:Y.Optional(Y.Object({goal:Y.String(),scope:Y.Array(Y.String()),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),result:Y.Optional(Y.Object({summary:Y.String(),error_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),changes:Y.Optional(Y.Object({items:Y.Array(Y.Object({status:eF,path:Y.String({minLength:1}),previous_path:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),total_count:Y.Integer({minimum:0}),truncated:Y.Boolean()},{additionalProperties:!1})),verification:Y.Optional(Y.Object({checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),skip_reason_code:Y.Optional(Y.String({minLength:1})),skip_reason_summary:Y.Optional(Y.String())},{additionalProperties:!1})),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),commit_oid:Y.Optional(Y.String({minLength:1})),commit_short_oid:Y.Optional(Y.String({minLength:1})),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Y.String({minLength:1}))},{additionalProperties:!1})),checkpoint:Y.Optional(Y.Object({counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(Y.Object({task_id:gP,title:Y.String({minLength:1}),status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1})),generated_files:Y.Optional(Y.Array(Y.Object({path:Y.String({minLength:1}),name:Y.String({minLength:1})},{additionalProperties:!1}))),truncated:Y.Optional(Y.Boolean())},{additionalProperties:!1})),links:Y.Array(XP)},{additionalProperties:!1}),nF=Y.Object({id:Y.String({minLength:1}),kind:KP,occurred_at:X,title:Y.String({minLength:1}),summary:Y.Optional(Y.String()),task_id:Y.Optional(gP),task_title:Y.Optional(Y.String({minLength:1})),activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),run_result_id:Y.Optional(_P),message_id:Y.Optional(mP),status:Y.Optional(qP),update_state:Y.Optional(JP),token_usage:Y.Optional(HP),usage_sources:Y.Optional(Y.Array(UP)),usage_models:Y.Optional(Y.Array(WP)),trace_card:Y.Optional(tF)},{additionalProperties:!1});Y.Object({generated_at:X,usage_overview:GP,items:Y.Array(nF)},{additionalProperties:!1});var rF=10*1024*1024,iF=50*1024*1024,aF=iF,oF=Y.Union([Y.Literal(`reference_file`),Y.Literal(`skill_zip`)]),sF=Y.String({pattern:`^sha256:[a-f0-9]{64}$`});function cF(e){return{upload_id:DP,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:e}),sha256:sF,media_type:Y.Optional(Z)}}function lF(e){return e===`skill_zip`?iF:rF}var uF=cF(aF),dF=cF(rF),fF=cF(iF),pF={relay_project_ref:EP,file_name:Z,sha256:sF,media_type:Y.Optional(Z)},mF=Y.Object({...pF,purpose:Y.Literal(`reference_file`),size_bytes:Y.Integer({minimum:1,maximum:rF})},{additionalProperties:!1}),hF=Y.Object({...pF,purpose:Y.Literal(`skill_zip`),size_bytes:Y.Integer({minimum:1,maximum:iF})},{additionalProperties:!1});Y.Object(uF,{additionalProperties:!1});var gF=Y.Union([mF,hF]),_F=Y.Object({upload_id:DP,relay_project_ref:EP,purpose:oF,file_name:Z,size_bytes:Y.Integer({minimum:1,maximum:aF}),sha256:sF,media_type:Y.Optional(Z),expires_at:X},{additionalProperties:!1}),vF=Y.Object({method:Y.Literal(`PUT`),url:Y.String({minLength:1}),headers:Y.Optional(Y.Record(Y.String({minLength:1}),Y.String()))},{additionalProperties:!1}),yF=Y.Union([Y.Object({kind:Y.Literal(`started`)},{additionalProperties:!1})]),bF=Y.Object({upload:_F,put:vF},{additionalProperties:!1});NP(gF),FP(yF,bF);var xF=Y.Union([Y.Literal(`chat`),Y.Literal(`worklist`),Y.Literal(`references`),Y.Literal(`skills`)]),SF=Y.Object({scope:xF,latest_event_cursor:Y.Integer({minimum:0}),read_event_cursor:Y.Integer({minimum:0}),has_unread:Y.Boolean(),updated_at:Y.Optional(X)},{additionalProperties:!1}),CF=Y.Object({generated_at:X,scopes:Y.Object({chat:SF,worklist:SF,references:SF,skills:SF},{additionalProperties:!1})},{additionalProperties:!1}),wF=Y.Object({scope:xF,up_to_event_cursor:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),TF=Y.Union([Y.Object({kind:Y.Literal(`marked`)},{additionalProperties:!1}),MP]),EF=Y.Object({read_state:CF},{additionalProperties:!1});NP(wF),FP(TF,EF);var DF=Y.Object({attempt:Y.Integer({minimum:1}),kind:Y.Union([Y.Literal(`initial`),Y.Literal(`continuation`),Y.Literal(`retry`)]),parent_activity_ref:Y.Optional(yP),root_activity_ref:Y.Optional(yP)},{additionalProperties:!1}),OF=Y.Union([Y.Object({kind:Y.Literal(`task`),task_id:gP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`workflow`),workflow_ref:xP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`project`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:CP},{additionalProperties:!1})]),kF=Y.Union([Y.Literal(`todo`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`done`),Y.Literal(`failed`)]),AF=Y.Object({task_id:gP,title:Z,summary:Y.String(),status:kF,module_id:hP,module_name:Z},{additionalProperties:!1}),jF=Y.Object({workflow_ref:xP,activity_ref:yP,topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),submitted_at:X,compiled_tasks:Y.Optional(Y.Array(AF))},{additionalProperties:!1}),MF=Y.Object({id:Y.Literal(`current`),state:Y.Union([Y.Literal(`empty`),Y.Literal(`ready`),Y.Literal(`submitted`)]),topic:Y.String(),background_summary:Y.String(),current_consensus:Y.Array(Y.String()),open_questions:Y.Array(Y.String()),task_changes:Y.Array(Y.String()),updated_by_activity_ref:Y.Optional(yP),updated_at:Y.Optional(X),submitted_by_activity_ref:Y.Optional(yP),submitted_by_workflow_ref:Y.Optional(xP),submitted_at:Y.Optional(X),receipts:Y.Array(jF)},{additionalProperties:!1}),NF=Y.Object({id:hP,name:Z,summary:Y.Optional(Y.String()),order:Y.Integer(),archived:Y.Boolean(),created_at:X,updated_at:Y.Optional(X)},{additionalProperties:!1}),PF=Y.Object({id:gP,module_id:hP,title:Z,summary:Y.String(),status:kF,order:Y.Integer(),current_activity_ref:Y.Optional(yP),active_clarification_thread_ref:Y.Optional(SP),latest_run_result_id:Y.Optional(_P),created_from_workflow_ref:xP,created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({modules:Y.Array(Y.Object({module:NF,tasks:Y.Array(PF)},{additionalProperties:!1})),updated_at:Y.Optional(X)},{additionalProperties:!1});var FF=Y.Object({goal:Y.String(),scope:Y.Array(Y.String())},{additionalProperties:!1}),IF=Y.Union([Y.Literal(`no_validation_command_found`),Y.Literal(`project_has_no_test_setup`),Y.Literal(`validation_not_applicable`),Y.Literal(`command_prerequisite_missing`),Y.Literal(`command_requires_external_service`),Y.Literal(`command_requires_secret`),Y.Literal(`command_requires_interactive_input`),Y.Literal(`command_too_expensive_for_mvp`),Y.Literal(`unsafe_command_blocked`),Y.Literal(`known_failing_baseline`)]),LF=Y.Object({status:Y.Union([Y.Literal(`succeeded`),Y.Literal(`failed`),Y.Literal(`unknown`)]),target:Y.Optional(Z),redacted_summary:Y.String(),started_at:Y.Optional(X),finished_at:Y.Optional(X)},{additionalProperties:!1}),RF=Y.Object({latest_run_result_id:Y.Optional(_P),result_kind:Y.Optional(Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)])),run_lineage:Y.Optional(DF),clarification_thread_ref:Y.Optional(SP),outcome:Y.Optional(Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)])),summary:Y.Optional(Y.String()),checks:Y.Optional(Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)])),docs:Y.Optional(Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)])),skip_reason_code:Y.Optional(IF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(LF)),changed_paths:Y.Optional(Y.Array(Y.String())),user_note_candidate:Y.Optional(Y.String()),promotion:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`promoted`),Y.Literal(`not_promoted`),Y.Literal(`not_attempted`)]),summary:Y.Optional(Y.String()),reason_code:Y.Optional(Z),commit_oid:Y.Optional(Z)},{additionalProperties:!1})),error_code:Y.Optional(Z),retryable:Y.Optional(Y.Boolean()),updated_at:Y.Optional(X)},{additionalProperties:!1}),zF=Y.Object({task:PF,detail:Y.Object({task_id:gP,contract:FF,result:RF,frozen_contract_since_activity_ref:Y.Optional(yP),updated_at:X},{additionalProperties:!1})},{additionalProperties:!1});kP(Y.Union([Y.Object({id:_P,activity_ref:yP,task_id:gP,run_lineage:DF,result_kind:Y.Literal(`needs_human`),summary:Y.String(),clarification_thread_ref:SP,created_at:X},{additionalProperties:!1}),Y.Object({id:_P,activity_ref:yP,task_id:gP,run_lineage:DF,result_kind:Y.Literal(`finished`),outcome:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),summary:Y.String(),user_note_candidate:Y.Optional(Y.String()),checks:Y.Union([Y.Literal(`passed`),Y.Literal(`failed`),Y.Literal(`skipped`)]),docs:Y.Union([Y.Literal(`updated`),Y.Literal(`checked_no_change`),Y.Literal(`not_checked`),Y.Literal(`sync_deferred`)]),skip_reason_code:Y.Optional(IF),skip_reason_summary:Y.Optional(Y.String()),external_side_effects:Y.Optional(Y.Array(LF)),created_at:X},{additionalProperties:!1}),Y.Object({id:_P,activity_ref:yP,task_id:gP,run_lineage:DF,result_kind:Y.Literal(`failed`),summary:Y.String(),error_code:Z,retryable:Y.Boolean(),created_at:X},{additionalProperties:!1})]));var BF=Y.Object({recovery_summary_id:vP,summary:Y.String({minLength:1}),affected_activities:Y.Array(yP),affected_activity_count:Y.Integer({minimum:0}),created_at:X},{additionalProperties:!1});kP(BF),Y.Object({recovery_summary:BF},{additionalProperties:!1});var VF=Y.Union(or.map(e=>Y.Literal(e))),HF=Y.Union([Y.Object({kind:Y.Literal(`initials`),initials:Y.String({minLength:1}),color:VF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`image`),image_url:Y.String({minLength:1}),initials:Y.String({minLength:1}),color:VF},{additionalProperties:!1})]),UF=Y.Union([Y.Object({kind:Y.Literal(`main_chat`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`clarification_round`),clarification_round_ref:CP},{additionalProperties:!1})]),WF=Y.Object({kind:Y.Union([Y.Literal(`human`),Y.Literal(`system`),Y.Literal(`agent`)]),ref:Y.Optional(Z),display_name:Y.Optional(Z),avatar:Y.Optional(HF)},{additionalProperties:!1}),GF=Y.Union([Y.Literal(`user_text`),Y.Literal(`agent_text`),Y.Literal(`system_notice`),Y.Literal(`clarification_request`),Y.Literal(`clarification_card`)]),KF=Y.Union([Y.Literal(`file`),Y.Literal(`image`)]),qF=Y.Object({path:Y.String({minLength:1}),name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:KF,blob_oid:Y.Optional(Z),media_type:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]))},{additionalProperties:!1})},{additionalProperties:!1}),JF=Y.Object({task_id:gP,title:Z,status:Y.Union([Y.Literal(`done`),Y.Literal(`failed`)]),summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(_P)},{additionalProperties:!1}),YF=Y.Object({path:Y.String({minLength:1}),name:Z,group:Y.Optional(Z),size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z)},{additionalProperties:!1}),XF=Y.Object({kind:Y.Literal(`worklist_terminal`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),reason:Y.Union([Y.Literal(`all_tasks_done`),Y.Literal(`run_failed`)]),title:Z,feedback_key:Z,counters:Y.Object({completed:Y.Integer({minimum:0}),failed:Y.Integer({minimum:0}),remaining:Y.Integer({minimum:0})},{additionalProperties:!1}),items:Y.Array(JF),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(YF)),primary_task_id:Y.Optional(gP)},{additionalProperties:!1}),ZF=Y.Object({kind:Y.Literal(`task_result`),status:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`)]),title:Z,task_id:gP,task_title:Z,result_key:Z,summary:Y.String(),module_name:Y.Optional(Z),latest_run_result_id:Y.Optional(_P),activity_ref:Y.Optional(yP),final_note:Y.Optional(Y.String()),generated_files:Y.Optional(Y.Array(YF)),error_code:Y.Optional(Z)},{additionalProperties:!1}),QF=Y.Object({kind:Y.Literal(`worklist_compile`),workflow_ref:xP,title:Z,task_count:Y.Integer({minimum:0}),tasks:Y.Array(AF)},{additionalProperties:!1}),$F=Y.Object({kind:Y.Literal(`artifact_preview`),title:Z,status:Y.Union([Y.Literal(`available`),Y.Literal(`updated`)]),task_id:Y.Optional(gP),run_result_id:Y.Optional(_P)},{additionalProperties:!1}),eI=Y.Object({task_id:Y.Optional(gP),activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),clarification_thread_ref:Y.Optional(SP),clarification_round_ref:Y.Optional(CP),scratchpad_source:Y.Optional(Y.Union([Y.Literal(`include`),Y.Literal(`exclude`)])),reference_file:Y.Optional(qF),worklist_compile:Y.Optional(QF),worklist_feedback:Y.Optional(XF),task_result:Y.Optional(ZF),artifact_preview:Y.Optional($F)},{additionalProperties:!1}),tI=Y.Object({id:mP,scope:UF,author:WF,message_kind:GF,body:Y.String(),refs:Y.Optional(eI),clarification_card:Y.Optional(Y.Object({thread_id:SP,round_id:CP,title:Y.Optional(Z),summary:Z,status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),is_current_round:Y.Boolean()},{additionalProperties:!1})),created_at:X},{additionalProperties:!1});AP(tI);var nI=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),rI=Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),iI=Y.Union([rI,MP]),aI=Y.Object({message:tI},{additionalProperties:!1});Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`latest`),Y.Literal(`start`)])),before:Y.Optional(pP),after:Y.Optional(pP),around:Y.Optional(mP)},{additionalProperties:!1}),NP(nI),FP(iI,aI),Y.Object({message:tI},{additionalProperties:!1});var oI=Y.Union([Y.Literal(`command_execution`),Y.Literal(`file_change`),Y.Literal(`permissions`),Y.Literal(`legacy_exec_command`),Y.Literal(`legacy_apply_patch`)]),sI=Y.Union([Y.Literal(`allow_once`),Y.Literal(`allow_session`),Y.Literal(`deny`),Y.Literal(`cancel`)]),cI=Y.Union([Y.Literal(`primary`),Y.Literal(`neutral`),Y.Literal(`danger`)]),lI=Y.Object({decision_id:Z,kind:sI,label:Z,tone:cI},{additionalProperties:!1}),uI=Y.Object({text:Z,cwd_label:Y.Optional(Z),actions:Y.Optional(Y.Array(Y.Object({label:Z,detail:Y.Optional(Z)},{additionalProperties:!1}))),network:Y.Optional(Y.Object({host:Z,protocol:Z},{additionalProperties:!1}))},{additionalProperties:!1}),dI=Y.Object({grant_root_label:Y.Optional(Z),paths:Y.Optional(Y.Array(Z))},{additionalProperties:!1}),fI=Y.Object({network:Y.Optional(Y.Object({enabled:Y.Boolean()},{additionalProperties:!1})),filesystem:Y.Optional(Y.Object({read:Y.Optional(Y.Array(Z)),write:Y.Optional(Y.Array(Z))},{additionalProperties:!1}))},{additionalProperties:!1}),pI=Y.Object({approval_id:wP,request_kind:oI,title:Z,summary:Z,reason:Y.Optional(Z),requested_at:X,expires_at:Y.Optional(X),task_id:Y.Optional(gP),activity_ref:Y.Optional(yP),command:Y.Optional(uI),file_change:Y.Optional(dI),permissions:Y.Optional(fI),decisions:Y.Array(lI,{minItems:1})},{additionalProperties:!1}),mI=Y.Union([Y.Literal(`accepted`),Y.Literal(`declined`),Y.Literal(`cancelled`),Y.Literal(`expired`)]),hI=Y.Object({decision_id:Z,label:Z,outcome:mI,decided_at:X,decided_by:Y.Optional(Y.Object({account_ref:Z,display_name:Z},{additionalProperties:!1}))},{additionalProperties:!1}),gI=Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`pending`),request:pI},{additionalProperties:!1}),Y.Object({state:Y.Literal(`resolved`),request:pI,resolution:hI},{additionalProperties:!1})]),_I=Y.Object({decision_id:Z},{additionalProperties:!1}),vI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_approval`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`decision_unavailable`)},{additionalProperties:!1}),MP]),yI=Y.Object({approval:Y.Optional(gI)},{additionalProperties:!1});NP(_I),FP(vI,yI);var bI=Y.Union([Y.Object({ref_kind:Y.Literal(`project_doc`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`directory_readme`),path:Z},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`task_detail`),task_id:gP},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`worklist`),module_id:Y.Optional(hP),task_id:Y.Optional(gP)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`scratchpad`),id:Y.Literal(`current`)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`clarification_round`),clarification_round_ref:CP},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`chat_messages`),message_refs:Y.Array(mP)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`repo_paths`),paths:Y.Array(Z)},{additionalProperties:!1}),Y.Object({ref_kind:Y.Literal(`recovery_summary`),recovery_summary_id:vP},{additionalProperties:!1})]),xI=Y.Object({kind:Y.Literal(`freeform`),purpose:Y.Union([Y.Literal(`clarify_requirement`),Y.Literal(`confirm_risk`)]),prompt:Y.Object({title:Y.Optional(Z),summary:Z,request:Z},{additionalProperties:!1}),subject:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`task`),Y.Literal(`deployment_target`),Y.Literal(`project_context`)]),ref:Y.Optional(Z),summary:Z},{additionalProperties:!1})),expires_when:Y.Optional(Y.Union([Y.Literal(`current_run_only`),Y.Literal(`until_task_contract_changes`)]))},{additionalProperties:!1});Y.Object({summary:Z,request:Z,interaction:Y.Optional(xI)},{additionalProperties:!1});var SI=Y.Object({summary:Z,request:Z,interaction:Y.Optional(xI),title:Y.Optional(Z),related_refs:Y.Optional(Y.Array(bI))},{additionalProperties:!1}),CI=Y.Union([Y.Object({kind:Y.Literal(`task_compile`),workflow_ref:xP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`task`),task_id:gP},{additionalProperties:!1})]),wI=Y.Object({id:SP,owner:CI,status:Y.Union([Y.Literal(`active`),Y.Literal(`closed`)]),current_round_id:Y.Optional(CP),created_from_activity_ref:Y.Optional(yP),closed_reason:Y.Optional(Y.Union([Y.Literal(`resolved`),Y.Literal(`contract_changed`),Y.Literal(`cancelled`)])),created_at:X,updated_at:X},{additionalProperties:!1}),TI=Y.Union([Y.Object({kind:Y.Literal(`next_round`),clarification_round_ref:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`run`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`proposal_applied`),workflow_ref:xP},{additionalProperties:!1})]),EI=Y.Object({id:CP,thread_id:SP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),request_payload:SI,card_message_id:mP,opening_message_id:mP,submitted_at:Y.Optional(X),submitted_message_refs:Y.Optional(Y.Array(mP)),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(TI),capabilities:Y.Object({send_message:Y.Boolean(),submit:Y.Boolean()},{additionalProperties:!1}),created_at:X,updated_at:X},{additionalProperties:!1});Y.Union([Y.Object({state:Y.Literal(`none`)},{additionalProperties:!1}),Y.Object({state:Y.Literal(`active`),thread:wI,round:EI},{additionalProperties:!1})]);var DI=Y.Object({id:CP,thread_id:SP,round_index:Y.Integer({minimum:1}),status:Y.Union([Y.Literal(`writable`),Y.Literal(`sealed`)]),title:Y.Optional(Z),summary:Z,submitted_at:Y.Optional(X),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),created_at:X,updated_at:X},{additionalProperties:!1});Y.Object({thread:wI,rounds:Y.Array(DI)},{additionalProperties:!1}),Y.Object({thread:wI,round:EI},{additionalProperties:!1}),Y.Object({limit:Y.Optional(Y.Integer({minimum:1,maximum:200,default:50})),anchor:Y.Optional(Y.Union([Y.Literal(`start`),Y.Literal(`latest`)])),before:Y.Optional(pP),after:Y.Optional(pP)},{additionalProperties:!1});var OI=Y.Object({body:Y.String({minLength:1,maxLength:8e3})},{additionalProperties:!1}),kI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(CP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),MP]),AI=Y.Object({message:Y.Optional(tI)},{additionalProperties:!1});NP(OI),FP(kI,AI);var jI=Y.Object({},{additionalProperties:!1}),MI=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_submitted`),successor_status:Y.Union([Y.Literal(`not_materialized`),Y.Literal(`materialized`)]),successor_ref:Y.Optional(TI)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_round`),current_round_id:Y.Optional(CP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`chain_closed`)},{additionalProperties:!1}),MP]),NI=Y.Object({round:Y.Optional(EI),materialization:Y.Optional(Y.Object({status:Y.Union([Y.Literal(`queued`),Y.Literal(`already_materialized`)]),successor_ref:Y.Optional(TI)},{additionalProperties:!1}))},{additionalProperties:!1});NP(jI),FP(MI,NI),Y.Object({reason:Y.Union([Y.Literal(`round_opened`),Y.Literal(`round_message_created`),Y.Literal(`round_submitted`),Y.Literal(`successor_materialized`),Y.Literal(`chain_closed`),Y.Literal(`recovered`)]),thread_id:SP,round_id:Y.Optional(CP),successor_ref:Y.Optional(TI)},{additionalProperties:!1});var PI=Y.String(),FI=Y.Object({source:Y.Literal(`mainline`),branch:Y.Literal(`tutti/mainline`),head:Y.Optional(Y.Object({oid:Z,short_oid:Z},{additionalProperties:!1})),mainline_clean:Y.Boolean(),generated_at:X},{additionalProperties:!1}),II=Y.Union([Y.Literal(`product`),Y.Literal(`tech`),Y.Literal(`structure`),Y.Literal(`architecture_principles`)]),LI=Y.Union([Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),RI=Y.Object({doc_key:II,path:PI,status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),unreadable_reason:Y.Optional(LI),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),last_commit:Y.Optional(Y.Object({oid:Z,short_oid:Z,committed_at:X,title:Y.Optional(Z)},{additionalProperties:!1}))},{additionalProperties:!1}),zI=Y.Union([Y.Literal(`directory`),Y.Literal(`symlink`),Y.Literal(`submodule`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unknown`)]),BI=Y.Object({path:PI,name:Y.String(),kind:Y.Union([Y.Literal(`directory`),Y.Literal(`file`),Y.Literal(`symlink`),Y.Literal(`submodule`)]),depth:Y.Integer({minimum:0}),parent_path:Y.Optional(PI),size_bytes:Y.Optional(Y.Integer({minimum:0})),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),has_children:Y.Optional(Y.Boolean()),project_doc_key:Y.Optional(II),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(zI)},{additionalProperties:!1})},{additionalProperties:!1}),VI=Y.Union([Y.Object({kind:Y.Literal(`text`),encoding:Y.Literal(`utf-8`),text:Y.String(),truncated:Y.Boolean(),bytes_returned:Y.Integer({minimum:0}),total_bytes:Y.Integer({minimum:0}),line_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`omitted`),reason:Y.Union([Y.Literal(`binary`),Y.Literal(`unsupported_encoding`),Y.Literal(`too_large`)]),total_bytes:Y.Integer({minimum:0})},{additionalProperties:!1})]),HI=Y.Object({path:PI,name:Z,kind:Y.Literal(`file`),size_bytes:Y.Integer({minimum:0}),blob_oid:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),media_type:Y.Optional(Z)},{additionalProperties:!1});Y.Object({snapshot:FI,docs:Y.Array(RI)},{additionalProperties:!1}),Y.Object({doc_key:II},{additionalProperties:!1}),Y.Object({max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1}),Y.Object({snapshot:FI,doc:RI,content:VI},{additionalProperties:!1}),Y.Object({path:Y.Optional(PI),depth:Y.Optional(Y.Integer({minimum:1,maximum:3})),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(pP)},{additionalProperties:!1});var UI=Y.Object({next_cursor:Y.Optional(pP),has_more:Y.Boolean(),limit:Y.Integer({minimum:1,maximum:1e3})},{additionalProperties:!1});Y.Object({snapshot:FI,root:BI,items:Y.Array(BI),page:UI},{additionalProperties:!1}),Y.Object({path:PI,max_bytes:Y.Optional(Y.Integer({minimum:1,maximum:1048576}))},{additionalProperties:!1});var WI=Y.Union([Y.Literal(`thumbnail`),Y.Literal(`preview`),Y.Literal(`original`)]);Y.Object({path:PI,variant:WI,v:Z},{additionalProperties:!1}),Y.Object({snapshot:FI,file:HI,content:VI},{additionalProperties:!1});var GI=Y.Object({path:Y.Literal(`docs/reference`),status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`)]),index_path:Y.Literal(`docs/reference/README.md`),files_path:Y.Literal(`docs/reference/files`),images_path:Y.Literal(`docs/reference/images`),tutti_path:Y.Literal(`docs/reference/tutti`),index_status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`unreadable`)]),index_unreadable_reason:Y.Optional(LI)},{additionalProperties:!1}),KI=Y.Union([Y.Literal(`binary`),Y.Literal(`too_large`),Y.Literal(`unsupported_encoding`),Y.Literal(`restricted_path`),Y.Literal(`secret_like`),Y.Literal(`unknown`)]),qI=Y.Object({status:Y.Union([Y.Literal(`available`),Y.Literal(`missing`),Y.Literal(`stale`),Y.Literal(`unavailable`)]),text:Y.Optional(Y.String()),generated_at:Y.Optional(X),source_blob_oid:Y.Optional(Z),unavailable_reason:Y.Optional(Y.String()),read_paths:Y.Optional(Y.Array(PI))},{additionalProperties:!1}),JI=Y.Object({path:PI,name:Z,source:Y.Union([Y.Literal(`human_upload`),Y.Literal(`tutti_output`)]),category:KF,size_bytes:Y.Integer({minimum:0}),media_type:Y.Optional(Z),extension:Y.Optional(Z),language_hint:Y.Optional(Z),blob_oid:Y.Optional(Z),text_read:Y.Object({can_read:Y.Boolean(),blocked_reason:Y.Optional(KI)},{additionalProperties:!1}),summary:Y.Optional(qI)},{additionalProperties:!1});Y.Object({include_index:Y.Optional(Y.Boolean()),limit:Y.Optional(Y.Integer({minimum:1,maximum:1e3})),cursor:Y.Optional(pP)},{additionalProperties:!1}),Y.Object({snapshot:FI,directory:GI,items:Y.Array(JI),page:UI},{additionalProperties:!1});var YI=Y.Object({...dF,note:Y.Optional(Y.String())},{additionalProperties:!1}),XI=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),MP]),ZI=Y.Object({file:JI,message:tI,index_path:Y.Literal(`docs/reference/README.md`)},{additionalProperties:!1});NP(YI),FP(XI,ZI);var QI=Y.Object({paths:Y.Optional(Y.Array(PI))},{additionalProperties:!1}),$I=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_targets`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:Y.Union([Y.Literal(`provider_auth_invalid`),Y.Literal(`provider_quota_or_billing_required`),Y.Literal(`provider_rate_limited`),Y.Literal(`provider_model_unavailable`),Y.Literal(`provider_network_error`)]),retryable:Y.Boolean()},{additionalProperties:!1}),MP]),eL=Y.Object({activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),target_count:Y.Optional(Y.Integer({minimum:0}))},{additionalProperties:!1});NP(QI),FP($I,eL);var tL=Y.Literal(`tutti.artifact.json`),nL=Y.Union([Y.Literal(`static`),Y.Literal(`server`)]),rL=Y.String({minLength:1,maxLength:120,pattern:`\\S`}),iL=Y.String({minLength:1}),aL=Y.Object({title:rL,kind:Y.Literal(`static`),root:iL,entry:iL,network:Y.Boolean()},{additionalProperties:!1}),oL=Y.Object({title:rL,kind:Y.Literal(`server`),cwd:iL,entry:Y.String({minLength:1,maxLength:256,pattern:`^/`}),network:Y.Boolean()},{additionalProperties:!1});Y.Object({version:Y.Literal(1),artifact:Y.Union([aL,oL])},{additionalProperties:!1});var sL=Y.Union([Y.Literal(`ready`),Y.Literal(`starting`),Y.Literal(`stopped`),Y.Literal(`failed`)]),cL=Y.Object({title:rL,kind:nL,network:Y.Boolean()},{additionalProperties:!1}),lL=Y.Object({status:sL,url:Y.Optional(Y.String({minLength:1})),error_message:Y.Optional(Z)},{additionalProperties:!1}),uL=Y.Union([Y.Object({status:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({status:Y.Literal(`invalid`),manifest_path:tL,error:Y.Object({code:Z,message:Z},{additionalProperties:!1})},{additionalProperties:!1}),Y.Object({status:Y.Literal(`declared`),manifest_path:tL,manifest_blob_oid:Z,artifact:cL,preview:lL},{additionalProperties:!1})]);Y.Object({artifact:uL},{additionalProperties:!1});var dL=Y.Object({},{additionalProperties:!1}),fL=Y.Union([Y.Object({kind:Y.Literal(`issued`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`preview_not_ready`),status:Y.Union([Y.Literal(`starting`),Y.Literal(`stopped`),Y.Literal(`failed`)]),message:Y.Optional(Z)},{additionalProperties:!1}),MP]),pL=Y.Object({bootstrap_url:Y.String({minLength:1}),expires_at:X},{additionalProperties:!1});NP(dL),FP(fL,pL);var mL=Y.Object({},{additionalProperties:!1}),hL=Y.Union([Y.Object({kind:Y.Literal(`started`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`starting`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unsupported`)},{additionalProperties:!1}),MP]),gL=Y.Union([Y.Object({kind:Y.Literal(`recorded`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_running`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),MP]),_L=Y.Union([Y.Object({kind:Y.Literal(`stopped`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_running`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_declared`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`invalid_manifest`),message:Z},{additionalProperties:!1}),MP]),vL=Y.Object({artifact:uL},{additionalProperties:!1});NP(mL),FP(hL,vL),NP(mL),FP(gL,vL),NP(mL),FP(_L,vL);var yL=Y.String({minLength:1,maxLength:96,pattern:`^[a-z0-9_-]+$`}),bL=Y.Object({name:yL,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X)},{additionalProperties:!1}),xL=Y.Object({name:yL,description:Z,short_description:Y.Optional(Z),enabled:Y.Boolean(),source:Y.Literal(`user`),updated_at:Y.Optional(X),skill_md:Y.String({minLength:1})},{additionalProperties:!1});Y.Object({items:Y.Array(bL)},{additionalProperties:!1}),Y.Object({skill_name:yL},{additionalProperties:!1}),Y.Object({skill:xL},{additionalProperties:!1});var SL=Y.Object(fF,{additionalProperties:!1}),CL=Y.Union([Y.Object({kind:Y.Literal(`created`),skill_name:yL},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`replaced`),skill_name:yL},{additionalProperties:!1}),MP]),wL=Y.Object({skill:xL},{additionalProperties:!1});NP(SL),FP(CL,wL);var TL=Y.Object({skill_name:yL},{additionalProperties:!1}),EL=Y.Union([Y.Object({kind:Y.Literal(`deleted`),skill_name:yL},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`not_found`),skill_name:yL},{additionalProperties:!1}),MP]);NP(TL),PP(EL);var DL=Y.Union([Y.Literal(`idle`),Y.Literal(`running`),Y.Literal(`pending`),Y.Literal(`failed`)]),OL=Y.Union([Y.Literal(`foreground`),Y.Literal(`scratchpad_background`)]),kL=Y.Object({activity_ref:yP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),workflow_ref:Y.Optional(xP),workflow_kind:Y.Optional(OP),lane:Y.Optional(OL),started_at:Y.Optional(X)},{additionalProperties:!1}),AL=Y.Union([Y.Literal(`reading_context`),Y.Literal(`planning`),Y.Literal(`editing_files`),Y.Literal(`running_command`),Y.Literal(`using_tool`),Y.Literal(`waiting_for_approval`),Y.Literal(`finalizing`)]),jL=Y.Object({input_tokens:Y.Optional(Y.Integer({minimum:0})),cached_input_tokens:Y.Optional(Y.Integer({minimum:0})),output_tokens:Y.Optional(Y.Integer({minimum:0})),reasoning_output_tokens:Y.Optional(Y.Integer({minimum:0})),total_tokens:Y.Integer({minimum:0})},{additionalProperties:!1}),ML=Y.Object({activity_ref:yP,stage_id:Y.Optional(Y.String()),started_at:Y.Optional(X),updated_at:Y.Optional(X),token_usage:Y.Optional(jL),current_action:Y.Optional(AL)},{additionalProperties:!1}),NL=Y.Object({status:DL,summary:Y.String(),active_task:Y.Optional(PF),active_activity:Y.Optional(kL),active_activities:Y.Optional(Y.Array(kL)),runtime:Y.Optional(ML),blocked_by:Y.Optional(Y.Union([Y.Object({kind:Y.Literal(`clarification`),thread_id:SP,round_id:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`approval`),approval_id:wP},{additionalProperties:!1})])),last_conclusion:Y.Optional(Y.Object({kind:Y.Union([Y.Literal(`completed`),Y.Literal(`failed`),Y.Literal(`needs_human`),Y.Literal(`recovered`)]),summary:Y.String(),task_id:Y.Optional(gP),activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),occurred_at:X},{additionalProperties:!1})),updated_at:X},{additionalProperties:!1}),PL=Y.Object({activity_ref:yP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)]),status:Y.Union([Y.Literal(`running`),Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`),Y.Literal(`interrupted`)]),title:Z,summary:Y.String(),task_id:Y.Optional(gP),workflow_ref:Y.Optional(xP),workflow_kind:Y.Optional(OP),lane:Y.Optional(OL),run_lineage:Y.Optional(DF),started_at:Y.Optional(X),ended_at:Y.Optional(X),latest_event_ref:Y.Optional(bP),result_anchor:Y.Optional(OF)},{additionalProperties:!1}),FL=Y.Object({event_ref:bP,activity_ref:yP,event_kind:Y.Union([Y.Literal(`started`),Y.Literal(`progress`),Y.Literal(`needs_human`),Y.Literal(`artifact_snapshot`),Y.Literal(`finished`),Y.Literal(`failed`)]),occurred_at:X,summary:Y.String(),payload:Y.Optional(Y.Object({progress:Y.Optional(Y.Object({message:Y.String(),phase:Y.Optional(Y.String())},{additionalProperties:!1})),artifact:Y.Optional(Y.Object({artifact_kind:Y.Union([Y.Literal(`scratchpad_snapshot`),Y.Literal(`task_compile_proposal`),Y.Literal(`context_sync_findings`),Y.Literal(`recovery_summary`),Y.Literal(`run_changed_paths`)]),summary:Y.String()},{additionalProperties:!1})),terminal:Y.Optional(Y.Object({result_kind:Y.Union([Y.Literal(`needs_human`),Y.Literal(`finished`),Y.Literal(`failed`)]),summary:Y.String()},{additionalProperties:!1}))},{additionalProperties:!1}))},{additionalProperties:!1});Y.Object({server_time:X,current_event_cursor:Z,replay:Y.Object({requested_cursor:Y.Optional(Z),status:Y.Union([Y.Literal(`not_requested`),Y.Literal(`replayed`),Y.Literal(`missed`)]),replayed_event_count:Y.Integer({minimum:0})},{additionalProperties:!1}),retry_after_ms:Y.Integer({minimum:0}),replay_window:LP},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`replay_missed`),Y.Literal(`bulk_state_change`),Y.Literal(`workspace_recovered`),Y.Literal(`viewer_changed`)]),message:Y.Optional(Y.String())},{additionalProperties:!1}),Y.Object({execution_status:NL},{additionalProperties:!1}),Y.Object({approval:gI},{additionalProperties:!1}),Y.Object({activity:PL,event:FL},{additionalProperties:!1}),Y.Object({reason:Y.Union([Y.Literal(`task_compile_applied`),Y.Literal(`task_state_changed`),Y.Literal(`task_result_recorded`),Y.Literal(`workspace_recovered`)]),workflow_ref:Y.Optional(xP),activity_ref:Y.Optional(yP),changed_module_ids:Y.Optional(Y.Array(hP)),changed_task_ids:Y.Optional(Y.Array(gP))},{additionalProperties:!1}),Y.Object({task:PF},{additionalProperties:!1}),Y.Object({task_id:gP,task:Y.Optional(PF),detail:Y.Optional(zF),latest_run_result_id:Y.Optional(_P)},{additionalProperties:!1}),Y.Object({scratchpad:MF,activity_ref:Y.Optional(yP)},{additionalProperties:!1}),Y.Object({provider_config:BP},{additionalProperties:!1}),Y.Object({recovery_summary_id:vP,summary:Y.String(),affected_activities:Y.Array(yP),replayed_round_ids:Y.Optional(Y.Array(CP))},{additionalProperties:!1}),Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`no_source_messages`)},{additionalProperties:!1}),MP]),Y.Object({activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP),scratchpad:Y.Optional(MF)},{additionalProperties:!1});var IL=Y.Object({expected_scratchpad_updated_at:Y.Optional(X)},{additionalProperties:!1}),LL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`scratchpad_empty`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`stale_scratchpad`),current_scratchpad:MF},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),MP]),RL=Y.Object({activity_ref:Y.Optional(yP),workflow_ref:Y.Optional(xP)},{additionalProperties:!1});NP(IL),FP(LL,RL);var zL=Y.Object({scope:Y.Optional(Y.Object({kind:Y.Literal(`worklist`)},{additionalProperties:!1}))},{additionalProperties:!1}),BL=Y.Union([Y.Object({kind:Y.Literal(`scheduled`),task_id:gP,activity_ref:yP,queued_task_ids:Y.Array(gP)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP,activity_kind:Y.Union([Y.Literal(`run`),Y.Literal(`procedure`)])},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`blocked_by_clarification`),thread_id:SP,round_id:CP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`nothing_to_run`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`mainline_not_clean`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),MP]);NP(zL),PP(BL);var VL=Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1}),HL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),MP]),UL=Y.Object({project:Y.Object({display_name:Y.String({minLength:1,maxLength:80})},{additionalProperties:!1})},{additionalProperties:!1});NP(VL),FP(HL,UL);var WL=Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1}),GL=Y.Union([Y.Object({kind:Y.Literal(`updated`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`unchanged`)},{additionalProperties:!1}),MP]),KL=Y.Object({project:Y.Object({description:Y.String({maxLength:160})},{additionalProperties:!1})},{additionalProperties:!1});NP(WL),FP(GL,KL);var qL=Y.Object({},{additionalProperties:!1}),JL=Y.Union([Y.Object({kind:Y.Literal(`created`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_initialized`)},{additionalProperties:!1}),MP]),YL=Y.Object({activity_ref:yP,workflow_ref:xP},{additionalProperties:!1}),XL=Y.Object({docs:Y.Array(RI),created_paths:Y.Array(PI),commit_oid:Y.Optional(Z)},{additionalProperties:!1});NP(qL),FP(JL,XL);var ZL=Y.Object({},{additionalProperties:!1}),QL=Y.Union([Y.Object({kind:Y.Literal(`accepted`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`already_running`),activity_ref:yP},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_not_configured`)},{additionalProperties:!1}),Y.Object({kind:Y.Literal(`provider_unavailable`),reason:zP,retryable:Y.Boolean()},{additionalProperties:!1}),MP]),$L=YL;NP(ZL),FP(QL,$L);function eR(e){try{return decodeURIComponent(e)}catch{return e}}function tR(e){return Ut(eR(e))}function nR(e,t=``){if(/^\/$/u.test(e))return{kind:`home`};if(/^\/console\/?$/u.test(e))return{kind:`local_console`};if(/^\/setup\/?$/u.test(e))return{kind:`setup`};if(/^\/projects\/?$/u.test(e)){let e=new URLSearchParams(t).get(`open`);if(e!==null){let t=tR(e);if(t!==null)return{kind:`project_open`,relayProjectRef:t}}return{kind:`project_center`}}let n=/^\/join\/([^/]+)\/?$/u.exec(e);if(n?.[1]!==void 0)return{kind:`join`,joinToken:eR(n[1])};let r=/^\/projects\/([^/]+)\/workspace\/?$/u.exec(e);if(r?.[1]!==void 0){let e=tR(r[1]);return e===null?{kind:`project_center`}:{kind:`workspace`,relayProjectRef:e}}let i=/^\/projects\/([^/]+)\/references\/?$/u.exec(e);if(i?.[1]!==void 0){let e=tR(i[1]);return e===null?{kind:`project_center`}:{kind:`references`,relayProjectRef:e}}let a=/^\/projects\/([^/]+)\/artifacts\/?$/u.exec(e);if(a?.[1]!==void 0){let e=tR(a[1]);return e===null?{kind:`project_center`}:{kind:`artifacts`,relayProjectRef:e}}let o=/^\/projects\/([^/]+)\/worklist\/?$/u.exec(e);if(o?.[1]!==void 0){let e=tR(o[1]);return e===null?{kind:`project_center`}:{kind:`worklist`,relayProjectRef:e}}let s=/^\/projects\/([^/]+)\/skills\/?$/u.exec(e);if(s?.[1]!==void 0){let e=tR(s[1]);return e===null?{kind:`project_center`}:{kind:`skills`,relayProjectRef:e}}let c=/^\/projects\/([^/]+)\/timeline\/?$/u.exec(e);if(c?.[1]!==void 0){let e=tR(c[1]);return e===null?{kind:`project_center`}:{kind:`timeline`,relayProjectRef:e}}let l=/^\/projects\/([^/]+)\/settings\/?$/u.exec(e);if(l?.[1]!==void 0){let e=tR(l[1]);return e===null?{kind:`project_center`}:{kind:`settings`,relayProjectRef:e}}return{kind:`project_center`}}var rR={success:3e3,error:9e3,warning:6e3,info:4500},iR=5,aR=(0,N.createContext)(null);function oR(e){return e.persistent===!0||e.tone===`loading`?e.durationMs:e.durationMs??rR[e.tone]}function sR(e){return e.persistent??e.tone===`loading`}function cR(e){return e.dismissible??e.tone!==`loading`}function lR(e,t){let n=oR(t);return{id:e,tone:t.tone,title:t.title,persistent:sR(t),dismissible:cR(t),...t.message===void 0?{}:{message:t.message},...n===void 0?{}:{durationMs:n}}}function uR(e,t){let n=t.tone===void 0,r={tone:t.tone??e.tone,title:t.title??e.title,...t.message===void 0?e.message===void 0?{}:{message:e.message}:{message:t.message},...t.durationMs===void 0?!n||e.durationMs===void 0?{}:{durationMs:e.durationMs}:{durationMs:t.durationMs},...t.persistent===void 0?!n||e.persistent===void 0?{}:{persistent:e.persistent}:{persistent:t.persistent},...t.dismissible===void 0?!n||e.dismissible===void 0?{}:{dismissible:e.dismissible}:{dismissible:t.dismissible}};return lR(e.id,r)}function dR(e){return[e.id,e.tone,e.title,e.message??``,e.durationMs??``,e.persistent===!0?`persistent`:`timed`].join(`:`)}function fR({children:e}){let[t,n]=(0,N.useState)([]),r=(0,N.useRef)(new Map),i=(0,N.useCallback)(e=>{n(t=>t.filter(t=>t.id!==e))},[]),a=(0,N.useCallback)(e=>{let t=Gt(),r=lR(t,e);return n(e=>[...e,r].slice(-iR)),t},[]),o=(0,N.useCallback)((e,t)=>{if(e===void 0){a(t);return}n(n=>n.map(n=>n.id===e?uR(n,t):n))},[a]);(0,N.useEffect)(()=>{let e=new Set(t.map(e=>e.id));for(let[t,n]of r.current)e.has(t)||(window.clearTimeout(n.timeout),r.current.delete(t));for(let e of t){let t=r.current.get(e.id),n=dR(e);if(t!==void 0&&t.key!==n&&(window.clearTimeout(t.timeout),r.current.delete(e.id)),e.persistent===!0||e.durationMs===void 0||r.current.has(e.id))continue;let a=window.setTimeout(()=>i(e.id),e.durationMs);r.current.set(e.id,{key:n,timeout:a})}},[i,t]),(0,N.useEffect)(()=>()=>{for(let e of r.current.values())window.clearTimeout(e.timeout);r.current.clear()},[]);let s=(0,N.useMemo)(()=>({notify:a,update:o,dismiss:i}),[i,a,o]);return(0,P.jsxs)(aR.Provider,{value:s,children:[e,(0,P.jsx)(da,{notices:t,onDismiss:i})]})}function pR(){let e=(0,N.useContext)(aR);if(e===null)throw Error(`useNotify must be used inside NotificationProvider`);return e}var mR=`http://127.0.0.1:4370`;function hR(){return typeof window<`u`?window.location.origin:mR}function gR(){return hR()}var _R=gR(),vR={relayBaseUrl:_R},yR=3e4,Q={relayRoot:[`relay`],me:[`relay`,`me`],recentProjects:[`relay`,`projects`,`recent`],projectPresence:e=>[`relay`,`projects`,e,`presence`],relayJoinRoot:[`relay`,`join`],join:e=>[`relay`,`join`,e],bootstrap:e=>[`host`,e,`bootstrap`],hostRoot:e=>[`host`,e],hostSession:e=>[`host`,e,`session`],hostWorkspace:e=>[`host`,e,`workspace`],messages:e=>[`host`,e,`messages`,`main_chat`],messagesWindow:(e,t)=>[...Q.messages(e),{limit:t}],messagesAround:(e,t,n)=>[...Q.messages(e),{around:t,limit:n}],messageHistory:(e,t,n)=>[...Q.messages(e),{history:t,limit:n}],scratchpad:e=>[`host`,e,`scratchpad`],worklist:e=>[`host`,e,`worklist`],readState:e=>[`host`,e,`read-state`],activeClarification:e=>[`host`,e,`clarification`,`active`],activeApproval:e=>[`host`,e,`approval`,`active`],noActiveClarificationRoundMessages:e=>[`host`,e,`clarification-round-messages`,`none`],clarificationRoundMessages:(e,t)=>[`host`,e,`clarification-round-messages`,t],task:(e,t)=>[`host`,e,`task`,t],taskDetail:(e,t)=>[`host`,e,`task-detail`,t],taskRunResults:(e,t)=>[`host`,e,`task-run-results`,t],executionStatus:e=>[`host`,e,`execution-status`],providerConfig:e=>[`host`,e,`provider-config`],providerUsage:e=>[`host`,e,`provider-usage`],projectTimeline:e=>[`host`,e,`project-timeline`],viewerRoot:e=>[`host`,e,`viewer`],viewerFile:(e,t)=>[`host`,e,`viewer`,`file`,t],referenceFiles:e=>[`host`,e,`references`,`files`],artifacts:e=>[`host`,e,`artifacts`],artifactPreviewSession:(e,t)=>[`relay`,e,`artifact-preview-session`,t],skills:e=>[`host`,e,`skills`],skillDetail:(e,t)=>[`host`,e,`skills`,t]};function bR(){return`${window.location.pathname}${window.location.search}${window.location.hash}`}function $(e,t={}){t.replace===!0?window.history.replaceState(null,``,e):window.history.pushState(null,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}function xR(e){let t=new URL(e,window.location.origin);$(`${t.pathname}${t.search}${t.hash}`)}function SR(){let[e,t]=(0,N.useState)(bR);return(0,N.useEffect)(()=>{let e=()=>{t(bR())};return window.addEventListener(`popstate`,e),()=>{window.removeEventListener(`popstate`,e)}},[]),(0,N.useMemo)(()=>{let t=new URL(e,window.location.origin);return nR(t.pathname,t.search)},[e])}function CR(e){return e instanceof Error?e.message:`Request failed`}function wR(e){e.invalidateQueries({queryKey:Q.me}),e.invalidateQueries({queryKey:Q.recentProjects})}function TR(e,t){if(t!==void 0)for(let n of t)switch(n.kind){case`all`:e.invalidateQueries({queryKey:Q.relayRoot});break;case`me`:e.invalidateQueries({queryKey:Q.me});break;case`recent_projects`:e.invalidateQueries({queryKey:Q.recentProjects});break;case`join_entries`:e.invalidateQueries({queryKey:Q.relayJoinRoot});break;case`project_presence`:Vt(n.relay_project_ref,Lt.relayProject)&&e.invalidateQueries({queryKey:Q.projectPresence(n.relay_project_ref)});break}}function ER(e){let t=rt(),n=(0,N.useMemo)(()=>zn(vR),[]);(0,N.useEffect)(()=>{if(e)try{let e=n.connectEvents({onReady:e=>{e.payload.replay.status===`missed`&&t.invalidateQueries({queryKey:Q.relayRoot})},onInvalidate:e=>{TR(t,e)}});return()=>{e.close()}}catch{return}},[e,t,n])}function DR(e,t,n){if(n!==void 0)for(let r of n)switch(r.kind){case`all`:e.invalidateQueries({queryKey:Q.hostRoot(t)});break;case`workspace`:e.invalidateQueries({queryKey:Q.hostWorkspace(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`session`:e.invalidateQueries({queryKey:Q.hostSession(t)});break;case`bootstrap`:e.invalidateQueries({queryKey:Q.bootstrap(t)});break;case`messages`:r.scope===`main_chat`?e.invalidateQueries({queryKey:Q.messages(t)}):e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break;case`scratchpad`:e.invalidateQueries({queryKey:Q.scratchpad(t)});break;case`worklist`:e.invalidateQueries({queryKey:Q.worklist(t)});break;case`read_state`:e.invalidateQueries({queryKey:Q.readState(t)});break;case`task`:e.invalidateQueries({queryKey:Q.task(t,r.task_id)});break;case`task_detail`:e.invalidateQueries({queryKey:Q.taskDetail(t,r.task_id)});break;case`task_run_results`:e.invalidateQueries({queryKey:Q.taskRunResults(t,r.task_id)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`execution_status`:e.invalidateQueries({queryKey:Q.executionStatus(t)});break;case`approval`:e.invalidateQueries({queryKey:Q.activeApproval(t)});break;case`provider_config`:e.invalidateQueries({queryKey:Q.providerConfig(t)});break;case`provider_usage`:e.invalidateQueries({queryKey:Q.providerUsage(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`project_timeline`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`viewer`:e.invalidateQueries({queryKey:Q.viewerRoot(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),(r.path===void 0||r.path.startsWith(`docs/reference`))&&e.invalidateQueries({queryKey:Q.referenceFiles(t)}),r.path!==void 0&&e.invalidateQueries({queryKey:Q.viewerFile(t,r.path)});break;case`skills`:e.invalidateQueries({queryKey:Q.skills(t)});break;case`artifacts`:e.invalidateQueries({queryKey:Q.artifacts(t)});break;case`recovery_summaries`:e.invalidateQueries({queryKey:Q.projectTimeline(t)});break;case`activity`:break;case`clarification`:e.invalidateQueries({queryKey:Q.activeClarification(t)}),e.invalidateQueries({queryKey:Q.projectTimeline(t)}),r.round_id!==void 0&&e.invalidateQueries({queryKey:Q.clarificationRoundMessages(t,r.round_id)});break}}function OR(){return{items:[],window:{has_older:!1,has_newer:!1,limit:50}}}function kR(){return{modules:[]}}function AR(){return{id:`current`,state:`empty`,topic:``,background_summary:``,current_consensus:[],open_questions:[],task_changes:[],receipts:[]}}function jR(e){return{chat:e?.scopes.chat.has_unread===!0,worklist:e?.scopes.worklist.has_unread===!0,references:e?.scopes.references.has_unread===!0,skills:e?.scopes.skills.has_unread===!0}}function MR(e){return e?.artifact.status===`declared`?{available:!0}:{available:!1}}function NR({enabled:e,hostClient:t,relayProjectRef:n,readState:r,scope:i}){let a=rt(),o=(0,N.useRef)(null),s=yt({mutationFn:e=>t.markRead({scope:i,up_to_event_cursor:e}),onSuccess:e=>{DR(a,n,e.invalidates)},onError:()=>{o.current=null}});(0,N.useEffect)(()=>{if(!e||r===void 0)return;let t=r.scopes[i];if(!t.has_unread){t.read_event_cursor>=t.latest_event_cursor&&(o.current=null);return}let n=`${i}:${t.latest_event_cursor}`;o.current===n||s.isPending||(o.current=n,s.mutate(t.latest_event_cursor))},[e,s,r,i])}function PR(){return{state:`none`}}function FR(e){return{status:`idle`,summary:`Idle`,updated_at:e}}function IR(e){return e.active_activities??(e.active_activity===void 0?[]:[e.active_activity])}function LR(e,t,n){return IR(e).some(e=>e.workflow_kind===t?n===void 0||(e.lane??`foreground`)===n:!1)}function RR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/references`;return t===void 0?n:`${n}?path=${encodeURIComponent(t)}`}function zR(e){return`/projects/${encodeURIComponent(Ht(e))}/artifacts`}function BR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/worklist`;return t===void 0?n:`${n}?task=${encodeURIComponent(t)}`}function VR(e,t){return`${rn(e)}?message=${encodeURIComponent(t)}`}function HR(e){return`/projects/${encodeURIComponent(Ht(e))}/settings`}function UR(e){return`/projects/${encodeURIComponent(Ht(e))}/timeline`}function WR(e,t){let n=`/projects/${encodeURIComponent(Ht(e))}/skills`;return t===void 0?n:`${n}?skill=${encodeURIComponent(t)}`}function GR(e,t){switch(t.target.kind){case`approval`:case`clarification`:case`scratchpad`:return rn(e);case`worklist`:return BR(e);case`references`:return RR(e);case`task`:return BR(e,t.target.taskId)}}function KR(e,t){$(GR(e,t))}function qR(e,t){let n=Fr(e);if(t!==void 0&&n.some(e=>e.id===t))return t;for(let e of[`running`,`pending`,`failed`,`todo`,`done`]){let t=n.find(t=>t.status===e);if(t!==void 0)return t.id}}function JR(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function YR(e){switch(e){case`binary`:return`Binary file`;case`too_large`:return`File too large`;case`unsupported_encoding`:return`Unsupported encoding`;case`restricted_path`:case`secret_like`:return`Restricted file`;default:return`Preview unavailable`}}function XR(e){if(!(e===void 0||e.kind===`text`))return YR(e.reason)}function ZR(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function QR(e){if(globalThis.crypto?.subtle===void 0)throw Error(`This browser does not support file upload hashing.`);return`sha256:${ZR(await globalThis.crypto.subtle.digest(`SHA-256`,await e.arrayBuffer()))}`}async function $R(e){if(e.file.size<=0)throw Error(`Upload file cannot be empty.`);let t=lF(e.purpose);if(e.file.size>t)throw Error(`Upload file cannot exceed ${JR(t)}.`);let n=await QR(e.file),r=e.file.type===``?void 0:e.file.type,i=zn(vR),a=e.purpose===`skill_zip`?{relay_project_ref:e.relayProjectRef,purpose:`skill_zip`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}}:{relay_project_ref:e.relayProjectRef,purpose:`reference_file`,file_name:e.file.name,size_bytes:e.file.size,sha256:n,...r===void 0?{}:{media_type:r}},o=await i.startUpload(a);if(o.result===void 0)throw Error(`Upload session could not be started.`);let s=new Headers(o.result.put.headers??{});r!==void 0&&!s.has(`content-type`)&&s.set(`content-type`,r);let c;try{c=await fetch(o.result.put.url,{method:o.result.put.method,headers:s,body:e.file})}catch{throw Error(`File upload failed while sending the file to upload storage. Check that R2 CORS allows PUT from this Web origin.`)}if(!c.ok)throw Error(`File upload failed while sending the file to upload storage (${c.status}).`);return{upload_id:o.result.upload.upload_id,file_name:o.result.upload.file_name,size_bytes:o.result.upload.size_bytes,sha256:o.result.upload.sha256,...o.result.upload.media_type===void 0?{}:{media_type:o.result.upload.media_type}}}function ez(e){let t=rt(),n=pR(),[r,i]=(0,N.useState)(`identity`),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)({email:``,displayName:``,code:``}),l=yt({mutationFn:async()=>{let e=s.email.trim(),t=await Vn(vR,{email:e});if(t.result===void 0)throw Error(`Login challenge was not returned`);return{challenge:t.result.challenge,disposition:t.disposition,email:e}},onSuccess:({challenge:e,disposition:t,email:r})=>{o(e),c(e=>({...e,code:``})),i(`code`),n.notify({tone:`success`,title:t.kind===`otp_already_pending`?`Verification email already sent`:`Verification email sent`,message:t.kind===`otp_already_pending`?`Verification email already sent to ${r}.`:`Verification email sent to ${r}.`})}}),u=yt({mutationFn:async()=>{if(a===null)throw Error(`Login challenge is missing`);let e=await Hn(vR,{challenge_ref:a.challenge_ref,code:s.code.trim()});if(e.result===void 0)throw Error(`Login response was not returned`);return e.result},onSuccess:n=>{if(!n.account.profile_complete){t.invalidateQueries({queryKey:Q.me}),c(e=>({...e,displayName:``})),i(`profile`);return}wR(t),e?.()}}),d=yt({mutationFn:async()=>{let e=await Un(vR,{display_name:s.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{wR(t),e?.()}}),f=e=>{if(e.preventDefault(),r===`identity`&&s.email.trim()!==``){l.mutate();return}if(r===`code`&&a!==null&&s.code.trim()!==``){u.mutate();return}r===`profile`&&s.displayName.trim()!==``&&d.mutate()},p=l.isPending||u.isPending||d.isPending,m=r===`identity`?l.error:r===`code`?u.error??l.error:d.error;return{phase:r,form:s,pending:p,submitDisabled:r===`identity`?s.email.trim()===``:r===`code`?a===null||s.code.replace(/\s+/gu,``).length!==6:s.displayName.trim()===``,challengeEmailHint:a?.email_hint??null,error:m===null?null:CR(m),onChange:e=>{c(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:f,onBack:()=>{l.reset(),u.reset(),d.reset(),o(null),c(e=>({...e,code:``})),i(`identity`)}}}function tz(e){let t=rt(),[n,r]=(0,N.useState)({email:``,displayName:``,code:``}),i=yt({mutationFn:async()=>{let e=await Un(vR,{display_name:n.displayName.trim()});if(e.result===void 0)throw Error(`Profile response was not returned`);return e.result.account},onSuccess:()=>{wR(t),e?.()}});return{phase:`profile`,form:n,pending:i.isPending,submitDisabled:n.displayName.trim()===``,challengeEmailHint:null,error:i.error===null?null:CR(i.error),onChange:e=>{r(t=>({...t,...e,...e.code===void 0?{}:{code:e.code.replace(/\D/gu,``).slice(0,6)}}))},onSubmit:e=>{e.preventDefault(),n.displayName.trim()!==``&&i.mutate()}}}var nz=`tutti.workspace-onboarding.v1`,rz={version:1,start_chat_pending:!1,tour_pending:!1};function iz(){try{return typeof window>`u`?null:window.sessionStorage}catch{return null}}function az(e){return e.storage===void 0?iz():e.storage}function oz(e,t){return`${nz}:${e}:${t}`}function sz(e){if(typeof e!=`object`||!e)return null;let t=e;return t.version===1&&typeof t.start_chat_pending==`boolean`&&typeof t.tour_pending==`boolean`?{version:1,start_chat_pending:t.start_chat_pending,tour_pending:t.tour_pending}:null}function cz(e,t,n){if(e!==null)try{if(!n.start_chat_pending&&!n.tour_pending){e.removeItem(t);return}e.setItem(t,JSON.stringify(n))}catch{}}function lz(e,t,n={}){let r=az(n);if(r===null)return{...rz};try{let n=r.getItem(oz(e,t));return n===null?{...rz}:sz(JSON.parse(n))??{...rz}}catch{return{...rz}}}function uz(e,t,n={}){cz(az(n),oz(e,t),{version:1,start_chat_pending:!0,tour_pending:!0})}function dz(e,t,n,r){let i=az(r),a=lz(e,t,{storage:i});a[n]&&cz(i,oz(e,t),{...a,[n]:!1})}function fz(e,t,n={}){dz(e,t,`start_chat_pending`,n)}function pz(e,t,n={}){dz(e,t,`tour_pending`,n)}function mz({joinToken:e}){let t=rt(),n=F({queryKey:Q.join(e),queryFn:()=>Gn(vR,e)}),r=ez(()=>{n.refetch()}),i=tz(()=>{n.refetch()}),a=yt({mutationFn:()=>Kn(vR,e),onSuccess:n=>{wR(t),t.invalidateQueries({queryKey:Q.join(e)}),n.disposition.kind===`joined`&&n.result!==void 0&&uz(n.result.account.account_ref,n.result.relay_project.relay_project_ref),n.result?.relay_project.host_status===`online`&&$(rn(n.result.relay_project.relay_project_ref))}}),o=yt({mutationFn:e=>Jn(vR,e),onSuccess:e=>{wR(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0&&xR(e.result.open_url)}}),s=n.data;ER(s?.account!==void 0);let c=s?.relay_project?.display_name??`Project`,l=s?.relay_project?.host_status??`unknown`,u=s?.account?.profile_complete===!1,d=u?`login_required`:n.isLoading?`loading`:n.error===null?s?.next.kind??`invalid_or_expired`:`error`;return(0,P.jsx)(GS,{projectName:c,description:d===`invalid_or_expired`?`This invite can no longer be used.`:`You have been invited to join ${c}.`,hostLabel:rr(l),hostOnline:l===`online`,nextKind:d,accountLabel:s?.account?.display_name??null,membershipLabel:s?.membership?.label??null,actionPending:a.isPending||o.isPending,error:n.error===null?a.error===null?o.error===null?null:CR(o.error):CR(a.error):CR(n.error),onBrandClick:()=>$(`/`),onRetry:()=>void n.refetch(),onAccept:()=>a.mutate(),onOpen:()=>{s?.next.kind===`open_workspace`&&o.mutate(s.next.relay_project_ref)},...d===`login_required`?{loginForm:u?i:r}:{}})}function hz(){$(`/projects`,{replace:!0})}function gz(){let e=F({queryKey:Q.me,queryFn:()=>Bn(vR)}),t=ez(hz);return(0,N.useEffect)(()=>{e.data!==void 0&&hz()},[e.data]),e.isLoading||e.data!==void 0?null:(0,P.jsx)(eC,{...t,onBrandClick:()=>$(`/`),sessionError:e.error===null||Qt(e.error)?null:`Tutti could not check your current session. You can still try signing in.`})}function _z(e){let t=e.trim().replace(/[\\/]+$/u,``);return t===``?``:t.slice(Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`))+1)}function vz(e=``){return{workspacePath:e,displayName:_z(e),description:``,baseUrl:``,apiKey:``,model:``}}function yz(e,t,n){return{...e,workspacePath:t,...n?{}:{displayName:_z(t)}}}function bz(e,t){let n=e.replace(/\s+/g,` `).trim();return n.length===0?t:n}function xz({inviterName:e,projectName:t,joinUrl:n}){return`${bz(e,`A teammate`)} invited you to join the Tutti project “${bz(t,`Untitled project`)}”.\n\nOpen the invitation link:\n${n.trim()}`}var Sz=vz();function Cz(){let e=window.location.hash.startsWith(`#`)?window.location.hash.slice(1):window.location.hash;return new URLSearchParams(e).get(`access_token`)}function wz(){window.history.replaceState(null,``,`${window.location.pathname}${window.location.search}`)}function Tz(e){return window.open(e,`_blank`,`noopener,noreferrer`)}function Ez(){let e=window.open(`about:blank`,`_blank`);return e!==null&&(e.opener=null),e}function Dz(){let e=pR(),t=(0,N.useRef)(void 0),n=(0,N.useRef)(void 0),r=(0,N.useRef)(!1),i=(0,N.useMemo)(()=>Fn({baseUrl:window.location.origin,csrfToken:()=>t.current,contextToken:()=>n.current}),[]),[a,o]=(0,N.useState)(null),[s,c]=(0,N.useState)(null),[l,u]=(0,N.useState)(Sz),d=(0,N.useRef)(!1),f=(0,N.useRef)({baseUrl:``,apiKey:``}),[p,m]=(0,N.useState)([]),[h,g]=(0,N.useState)(!1),[_,v]=(0,N.useState)(`folder`),[y,b]=(0,N.useState)([]),[x,S]=(0,N.useState)(!0),[C,w]=(0,N.useState)(!1),[T,E]=(0,N.useState)(!1),[ee,D]=(0,N.useState)(null);async function O(){if(t.current!==void 0){S(!0);try{b((await i.getProjects()).projects)}catch(t){e.notify({tone:`error`,title:`Projects unavailable`,message:CR(t)})}finally{S(!1)}}}(0,N.useEffect)(()=>{r.current||(r.current=!0,(async()=>{try{let e=Cz();if(e!==null&&e.trim()!==``){wz();let r=await i.exchangeSession(e);t.current=r.csrf_token,n.current=r.context_token}let r=await i.getBootstrap();t.current=r.csrf_token,o(r),c(null),await O()}catch(e){S(!1),c(CR(e))}})())},[i]),(0,N.useEffect)(()=>{if(a===null)return;let e=window.setInterval(()=>{i.heartbeat().catch(()=>void 0)},6e4);return()=>window.clearInterval(e)},[a,i]);async function k(){try{let t=await i.pickFolder();t.kind===`selected`?M({workspacePath:t.path}):t.kind===`unavailable`&&e.notify({tone:`info`,title:`Use a folder path`,message:t.message})}catch(t){e.notify({tone:`error`,title:`Folder picker unavailable`,message:CR(t)})}}async function te(){let t={baseUrl:l.baseUrl.trim(),apiKey:l.apiKey.trim()},n=()=>f.current.baseUrl.trim()===t.baseUrl&&f.current.apiKey.trim()===t.apiKey;w(!0);try{let r=await i.discoverModels({base_url:t.baseUrl,api_key:t.apiKey});if(!n())return;r.kind===`ok`?(m(r.models),u(e=>({...e,model:``})),v(`model`)):(m([]),e.notify({tone:`error`,title:`Provider check failed`,message:r.reason===`model_list_empty`?`The endpoint did not return any available models.`:`Check the Base URL and API key, then try again.`}))}catch(t){if(!n())return;m([]),e.notify({tone:`error`,title:`Provider check failed`,message:CR(t)})}finally{w(!1)}}async function ne(){E(!0);try{let e=await i.launchProject({workspace_path:l.workspacePath.trim(),project:{display_name:l.displayName.trim(),...l.description.trim()===``?{}:{description:l.description.trim()}},provider:{base_url:l.baseUrl.trim(),api_key:l.apiKey.trim(),model:l.model.trim()}});ae(),window.location.assign(e.join_url)}catch(t){e.notify({tone:`error`,title:`Launch failed`,message:CR(t)})}finally{E(!1)}}async function A(t){D(t.project_id);try{await i.launchProject({workspace_path:t.workspace_path}),await O(),e.notify({tone:`success`,title:`${t.display_name} is ready`})}catch(t){let n=t instanceof Jt&&t.code===`provider_configuration_required`;e.notify({tone:n?`warning`:`error`,title:n?`Provider required`:`Launch failed`,message:n?`Use New project with this folder to update its Provider configuration.`:CR(t)})}finally{D(null)}}async function re(t){D(t.project_id);try{let n=await i.refreshInvite(t.project_id);await navigator.clipboard.writeText(xz({inviterName:``,projectName:t.display_name,joinUrl:n.join_url})),b(e=>e.map(e=>e.project_id===t.project_id?{...e,join_url:n.join_url}:e)),e.notify({tone:`success`,title:`Invitation copied`})}catch(t){e.notify({tone:`error`,title:`Invite unavailable`,message:CR(t)})}finally{D(null)}}async function ie(t){if(t.open_url===void 0)return;if(t.update_required!==!0){Tz(t.open_url);return}let n=Ez();D(t.project_id);try{let r=await i.openProject(t.project_id);b(e=>e.map(e=>e.project_id===r.project.project_id?r.project:e)),n===null?window.location.assign(r.open_url):n.location.replace(r.open_url),r.disposition===`updated`?e.notify({tone:`success`,title:`${t.display_name} updated`}):r.disposition===`deferred_busy`?e.notify({tone:`info`,title:`Opened without updating`,message:`Try Open again after the current project activity finishes.`}):r.disposition===`deferred_unsupported`?e.notify({tone:`info`,title:`Opened with the current Host`,message:`Stop and Resume this project once to enable safe automatic updates.`}):r.disposition===`deferred_unavailable`&&e.notify({tone:`warning`,title:`Update deferred`,message:`The current Host could not be safely restarted, so the project opened as-is.`})}catch(t){n?.close(),e.notify({tone:`error`,title:`Open failed`,message:CR(t)})}finally{D(null)}}async function j(t){D(t.project_id);try{await i.stopProject(t.project_id),b(e=>e.map(e=>{if(e.project_id!==t.project_id)return e;let n={...e,status:`stopped`};return delete n.join_url,n})),e.notify({tone:`success`,title:`${t.display_name} stopped`})}catch(t){e.notify({tone:`error`,title:`Stop failed`,message:CR(t)})}finally{D(null)}}function M(e){e.displayName!==void 0&&(d.current=!0);let t=e.baseUrl!==void 0&&e.baseUrl!==l.baseUrl||e.apiKey!==void 0&&e.apiKey!==l.apiKey;t&&(m([]),f.current={baseUrl:e.baseUrl??l.baseUrl,apiKey:e.apiKey??l.apiKey}),u(n=>({...e.workspacePath===void 0?n:yz(n,e.workspacePath,d.current),...e,...t?{model:``}:{}}))}function ae(){g(!1),v(`folder`),m([]),f.current={baseUrl:``,apiKey:``},d.current=!1,u(vz())}function oe(e){if(!e){!C&&!T&&ae();return}let t=a?.current_directory??``;d.current=!1,f.current={baseUrl:``,apiKey:``},m([]),u(vz(t)),v(`folder`),g(!0)}function se(e){if(e.preventDefault(),_===`folder`){v(`details`);return}if(_===`details`){v(`provider`);return}if(_===`provider`){te();return}ne()}function ce(){v(e=>{switch(e){case`folder`:return`folder`;case`details`:return`folder`;case`provider`:return`details`;case`model`:return`provider`}})}return(0,P.jsx)($S,{form:l,models:p,projects:y,projectsLoading:x,sessionLoading:a===null&&s===null,sessionError:s,createOpen:h,createStep:_,modelDiscoveryPending:C,launchPending:T,projectActionPending:ee,onChange:M,onCreateOpenChange:oe,onCreateSubmit:se,onCreateBack:ce,onChooseFolder:()=>void k(),onRefresh:()=>void O(),onLaunchExisting:e=>void A(e),onOpenProject:e=>void ie(e),onCopyInvite:e=>void re(e),onStopProject:e=>void j(e)})}var Oz=/^[A-Za-z0-9_-]{8,256}$/u,kz=/https?:\/\/[^\s<>"'`“”‘’]+/giu,Az=/(?:^|[\s("'“‘])((?:\/)?join\/[A-Za-z0-9_-]{8,256})(?=$|[\s?#.,;:!'"”’)\]}])/giu,jz=/[.,;:!?)}\]]+$/u;function Mz(e){let t;try{t=decodeURIComponent(e)}catch{return null}return Oz.test(t)?t:null}function Nz(e){let t=e.split(`/`).filter(Boolean);return t.length!==2||t[0]!==`join`?null:Mz(t[1]??``)}function Pz(e,t){let n=Nz(t);n!==null&&e.add(`/join/${encodeURIComponent(n)}`)}function Fz(e,t){try{Pz(e,new URL(t.replace(jz,``)).pathname)}catch{}}function Iz(e){let t=e.trim();if(t===``)return{kind:`empty`};let n=new Set;for(let e of t.matchAll(kz))Fz(n,e[0]);for(let e of t.matchAll(Az)){let t=e[1];if(t!==void 0)try{Pz(n,new URL(t,`https://tutti.invalid`).pathname)}catch{}}let r=Mz(t);return r!==null&&n.add(`/join/${encodeURIComponent(r)}`),n.size===0?{kind:`invalid`}:n.size>1?{kind:`ambiguous`}:{kind:`matched`,route:[...n][0]}}function Lz({requestedOpenProjectRef:e}){let t=rt(),n=pR(),r=ez(),i=tz(),[a,o]=(0,N.useState)(``),[s,c]=(0,N.useState)(null),l=(0,N.useRef)(null),u=F({queryKey:Q.me,queryFn:()=>Bn(vR)}),d=F({queryKey:Q.recentProjects,queryFn:()=>qn(vR),enabled:u.isSuccess});ER(u.isSuccess);let f=yt({mutationFn:e=>Jn(vR,e),onSuccess:e=>{if(wR(t),e.disposition.kind===`opened`&&e.result?.open_url!==void 0){xR(e.result.open_url);return}n.notify({tone:`warning`,title:`Host is offline`})},onError:e=>{n.notify({tone:`error`,title:`Project open failed`,message:CR(e)})}}),p=f.mutate;(0,N.useEffect)(()=>{e===void 0||u.data?.account.profile_complete!==!0||l.current===e||(l.current=e,p(e))},[u.data?.account.profile_complete,p,e]);let m=yt({mutationFn:()=>Wn(vR),onSuccess:()=>{t.invalidateQueries({queryKey:Q.relayRoot}),t.invalidateQueries({queryKey:Q.me}),t.invalidateQueries({queryKey:Q.recentProjects})},onError:e=>{n.notify({tone:`error`,title:`Sign out failed`,message:CR(e)})}});if(u.error!==null&&Qt(u.error))return(0,P.jsx)(HS,{...r,onBrandClick:()=>$(`/`)});let h=u.data?.account;if(h!==void 0&&!h.profile_complete)return(0,P.jsx)(HS,{...i,onBrandClick:()=>$(`/`)});let g=(d.data?.projects??[]).map(ar);return(0,P.jsx)(tC,{account:h===void 0?null:{displayName:h.display_name},projects:g,loading:u.isLoading||d.isLoading,error:u.error===null?d.error===null?null:CR(d.error):CR(u.error),openPending:f.isPending,logoutPending:m.isPending,joinLinkForm:{value:a,error:s,onChange:e=>{o(e),c(null)},onSubmit:()=>{let e=Iz(a);if(e.kind!==`matched`){c(e.kind===`ambiguous`?`Paste one Tutti invitation at a time.`:`Paste a valid Tutti invitation.`);return}$(e.route)}},onCopyLaunchCommands:e=>{navigator.clipboard.writeText(e).then(()=>{n.notify({tone:`success`,title:`Commands copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the launch commands.`})})},onBrandClick:()=>$(`/`),onOpenProject:e=>f.mutate(e),onLogout:()=>m.mutate()})}function Rz(e){let t=e?.relay;if(t?.join_url_visibility===`visible_once`&&t.join_url!==void 0&&t.join_url.trim()!==``)return t.join_url}function zz(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return!1}}function Bz(e,t){let n=Rz(e);if(n!==void 0)return{kind:`join`,joinUrl:n};let r=e?.relay?.relay_project_ref;return r===void 0?{kind:`unavailable`,message:`Relay project is unavailable`}:zz(t.currentOrigin,t.relayBaseUrl)?{kind:`relay_open`,relayProjectRef:r}:{kind:`unavailable`,message:`Open the latest Join URL printed by tutti launch.`}}var Vz=`gpt-5.5`,Hz=`/host-local/v1`;function Uz(){return new URL(window.location.href).searchParams.get(`token`)?.trim()??``}function Wz(e){return{baseUrl:Hz,credentials:`same-origin`,headers:{authorization:`Bearer ${e}`}}}function Gz(e){return I(Wz(e),`/provider/config`)}function Kz(e){return I(Wz(e),`/launch-status`)}function qz(e){return I(Wz(e),`/project`)}function Jz(e,t){return I(Wz(e),`/project`,{method:`POST`,body:t})}function Yz(e,t){return I(Wz(e),`/provider/config`,{method:`POST`,body:t})}function Xz(e){return e===void 0?`loading`:e.status===`configured`?`configured`:e.status===`invalid`?`invalid`:`not configured`}function Zz(e){let t=e instanceof Error&&`code`in e?String(e.code):``;return t.startsWith(`provider_`)?t:CR(e)}function Qz(){let e=Uz(),t=e===``,[n,r]=(0,N.useState)({projectName:``,apiKey:``,baseUrl:``,defaultModel:Vz}),[i,a]=(0,N.useState)(null),[o,s]=(0,N.useState)(null),c=(0,N.useRef)(!1),l=F({queryKey:[`host-local`,`provider-config`,e],queryFn:()=>Gz(e),enabled:!t}),u=F({queryKey:[`host-local`,`launch-status`,e],queryFn:()=>Kz(e),enabled:!t}),d=F({queryKey:[`host-local`,`project`,e],queryFn:()=>qz(e),enabled:!t}),f=u.data,p=yt({mutationFn:e=>Jn(vR,e.relayProjectRef),onSuccess:e=>{if(e.disposition.kind===`opened`&&e.result?.open_url!==void 0){xR(e.result.open_url);return}s(`Host is offline`)},onError:e=>{s(CR(e))}}),m=yt({mutationFn:async()=>{let t=n.projectName.trim(),r=d.data?.display_name.trim()??``;t!==``&&t!==r&&await Jz(e,{display_name:t});let i={api_key:n.apiKey.trim()},a=n.baseUrl.trim(),o=n.defaultModel.trim();return a!==``&&(i.base_url=a),o!==``&&(i.default_model=o),await Yz(e,i)},onSuccess:()=>{a(`Provider saved.`),r(e=>({...e,apiKey:``})),d.refetch(),l.refetch(),v()}}),h=l.data;(0,N.useEffect)(()=>{let e=d.data?.display_name;e!==void 0&&r(t=>t.projectName.trim()===``?{...t,projectName:e}:t)},[d.data?.display_name]),(0,N.useEffect)(()=>{t||h?.status!==`configured`||v()},[h?.status,t]);let g=t?`Setup token is missing.`:d.error===null?l.error===null?m.error===null?o:Zz(m.error):Zz(l.error):Zz(d.error);function _(e){e.preventDefault(),a(null),s(null),c.current=!1,!t&&n.apiKey.trim()!==``&&n.projectName.trim()!==``&&m.mutate()}async function v(){if(c.current)return;c.current=!0;let e=Bz(f??(await u.refetch()).data,{currentOrigin:window.location.origin,relayBaseUrl:_R});if(e.kind===`join`){window.location.assign(e.joinUrl);return}if(e.kind===`unavailable`){s(e.message);return}p.mutate({relayProjectRef:e.relayProjectRef})}return(0,P.jsx)(rC,{form:n,statusLabel:Xz(h),configured:h?.status===`configured`,loading:l.isLoading||d.isLoading,pending:m.isPending,tokenMissing:t,error:g,success:i,openProjectPending:p.isPending,onChange:e=>r(t=>({...t,...e})),onSubmit:_,onRetry:()=>void l.refetch(),onBrandClick:()=>$(`/`)})}function $z(e){return`${e.created_at}:${e.id}`}function eB(e){return{kind:`initial`,entry:e}}function tB(e,t=50){if(e.kind===`older`)return{before:e.before,limit:t};if(e.kind===`newer`)return{after:e.after,limit:t};switch(e.entry.kind){case`latest`:return{limit:t};case`start`:return{anchor:`start`,limit:t};case`around`:return{around:e.entry.messageId,limit:t}}}function nB(e){let t=e.window.older_cursor;return e.window.has_older&&t!==void 0?{kind:`older`,before:t}:void 0}function rB(e){let t=e.window.newer_cursor;return e.window.has_newer&&t!==void 0?{kind:`newer`,after:t}:void 0}function iB(e,t=50){let n=e[0],r=e.at(-1);if(n===void 0||r===void 0)return{items:[],window:{has_older:!1,has_newer:!1,limit:t}};let i=new Map;for(let t of e)for(let e of t.items)i.set(e.id,e);let a=[...i.values()].sort((e,t)=>$z(e).localeCompare($z(t))),o={has_older:n.window.has_older,has_newer:r.window.has_newer,limit:n.window.limit};return o.has_older&&n.window.older_cursor!==void 0&&(o.older_cursor=n.window.older_cursor),o.has_newer&&r.window.newer_cursor!==void 0&&(o.newer_cursor=r.window.newer_cursor),{items:a,window:o}}var aB=5400,oB=1500;function sB(e){let t=e.completionSource;return t?.activityRef??t?.workflowRef??t?.taskId??e.key}function cB(e){switch(e.kind){case`accepted`:case`already_running`:return null;case`scratchpad_empty`:return{label:`Scratchpad is empty. Let it refresh before running.`,tone:`error`};case`stale_scratchpad`:return{label:`Scratchpad changed. Review the latest snapshot and run again.`,tone:`error`};case`provider_not_configured`:return{label:`Provider is not configured yet.`,tone:`error`};case`provider_unavailable`:return{label:`Provider unavailable: ${e.reason}.`,tone:`error`};case`interrupted`:return{label:`Run was interrupted. Try again.`,tone:`error`}}}function lB(e,t){t.displayName.trim()===``||e.has(t.key)||e.set(t.key,t)}function uB(e){if(e.author.kind!==`human`)return null;let t=e.author.display_name?.trim()||`Member`;return{key:e.author.ref===void 0?`message-author:${t.toLocaleLowerCase()}`:e.author.ref,displayName:t,avatar:e.author.avatar??{kind:`initials`,initials:dr(t),color:`blue`}}}function dB({account:e,presence:t,messages:n=[]}){let r=new Map;e!==void 0&&lB(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.sample_members??[])lB(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of t?.members??[])lB(r,{key:e.account_ref,displayName:e.display_name,avatar:e.avatar});for(let e of n){let t=uB(e);t!==null&&lB(r,t)}return[...r.values()]}function fB({account:e,presence:t}){let n={},r=(e,t)=>{let r=n[e];n[e]={avatar:t.avatar,online:r?.online===!0||t.online}};for(let e of t?.members??[])r(e.account_ref,{avatar:e.avatar,online:e.online});for(let e of t?.sample_members??[])r(e.account_ref,{avatar:e.avatar,online:!0});return e!==void 0&&r(e.account_ref,{avatar:e.avatar,online:!0}),n}function pB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),[i,a]=(0,N.useState)(``),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(null),[u,d]=(0,N.useState)(null),[f,p]=(0,N.useState)(null),[m,h]=(0,N.useState)(()=>Date.now()),[g,_]=(0,N.useState)(null),v=new URL(bR(),window.location.origin).searchParams.get(`message`),y=v!==null&&Vt(v,Lt.message)?v:void 0,[b,x]=(0,N.useState)(()=>y===void 0?{kind:`latest`}:{kind:`around`,messageId:y}),S=(0,N.useRef)(null),C=(0,N.useRef)(null),w=(0,N.useRef)(null),[T,E]=(0,N.useState)(null),ee=u!==null;(0,N.useEffect)(()=>{y!==void 0&&(b.kind!==`around`||b.messageId!==y)&&x({kind:`around`,messageId:y})},[b,y]);let D=(t=null)=>{x({kind:`latest`}),_(t),y!==void 0&&$(rn(e),{replace:!0})},O=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),k=O.data?.session.account.account_ref,te=k===void 0?null:`${k}:${e}`,ne=y!==void 0||te!==null&&T===te;(0,N.useEffect)(()=>{te===null||T===te||(y===void 0&&k!==void 0&&x(lz(k,e).start_chat_pending?{kind:`start`}:{kind:`latest`}),E(te))},[k,te,e,y,T]);let A=bt({queryKey:Q.messageHistory(e,b,50),queryFn:({pageParam:e})=>r.getMessages(tB(e)),initialPageParam:eB(b),getPreviousPageParam:e=>nB(e),getNextPageParam:e=>rB(e),enabled:O.isSuccess&&ne,staleTime:yR}),re=F({queryKey:Q.scratchpad(e),queryFn:()=>r.getScratchpad(),enabled:O.isSuccess,staleTime:yR,refetchInterval:ee?oB:!1}),ie=F({queryKey:Q.activeClarification(e),queryFn:()=>r.getActiveClarification(),enabled:O.isSuccess,staleTime:yR,refetchInterval:ee?oB:!1}),j=F({queryKey:Q.activeApproval(e),queryFn:()=>r.getActiveApproval(),enabled:O.isSuccess,staleTime:yR}),M=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:O.isSuccess,staleTime:yR,refetchInterval:ee?oB:!1}),ae=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:O.isSuccess,staleTime:yR}),oe=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:O.isSuccess,staleTime:yR}),se=F({queryKey:Q.projectPresence(e),queryFn:()=>Yn(vR,e),enabled:O.isSuccess,staleTime:yR,refetchInterval:6e4});ER(O.isSuccess);let ce=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${CR(e)}`})}}),le=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:CR(e)})}}),ue=yt({mutationFn:({body:e,commandId:t})=>r.sendMainChatMessage({body:e},{commandId:t}),onSuccess:(n,r)=>{S.current=null,a(e=>e.trim()===r.body?``:e),n.result?.message!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(n.result.message.id):D(n.result.message.id)),DR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Message send failed`,message:CR(e)})}}),de=yt({mutationFn:async t=>{let n=await $R({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{let o=r.result?.message;o!==void 0&&(b.kind===`latest`&&!A.hasNextPage?_(o.id):D(o.id)),DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:CR(e)})}}),fe=yt({mutationFn:e=>r.submitWorklist(e===void 0?{}:{expected_scratchpad_updated_at:e}),onMutate:()=>(d({kind:`request`}),n.notify({tone:`loading`,title:`Running Scratchpad`})),onSuccess:(r,i,a)=>{if(r.disposition.kind===`accepted`){let e=r.result?.activity_ref;d(e===void 0?null:{kind:`activity`,activityRef:e,...r.result?.workflow_ref===void 0?{}:{workflowRef:r.result.workflow_ref}}),n.update(a,{tone:`success`,title:`Scratchpad run started`,message:`Tutti is preparing Worklist tasks.`})}else if(r.disposition.kind===`already_running`)d(null),n.update(a,{tone:`info`,title:`Already running`,message:`Tutti is already processing work.`});else{d(null);let e=cB(r.disposition);n.update(a,{tone:e?.tone??`warning`,title:`Scratchpad run blocked`,...e?.label===void 0?{}:{message:e.label}})}DR(t,e,r.invalidates)},onError:(e,t,r)=>{d(null),n.update(r,{tone:`error`,title:`Scratchpad run failed`,message:CR(e)})}}),pe=O.data,me=fB({account:pe?.session.account,presence:se.data?.presence}),he=pe?.generated_at??new Date(0).toISOString(),ge=A.data===void 0?void 0:iB(A.data.pages,50),_e=ge??(ne&&b.kind===`latest`?pe?.snapshots.main_chat:void 0)??OR(),ve=A.data!==void 0&&A.hasPreviousPage===!0,ye=A.data!==void 0&&A.hasNextPage===!0,be=b.kind===`latest`||b.kind===`start`&&!ye||b.kind===`around`&&_e.items.length>0&&!ye,xe=b.kind===`around`?`around:${b.messageId}`:b.kind,Se=b.kind===`around`?`focus`:b.kind===`start`?`start`:`latest`,Ce=pe!==void 0&&(!ne||ge===void 0&&A.isLoading&&(b.kind!==`latest`||pe.snapshots.main_chat===void 0)),we=re.data??pe?.snapshots.scratchpad??AR(),Te=ae.data??pe?.snapshots.read_state;NR({enabled:O.isSuccess,hostClient:r,relayProjectRef:e,readState:Te,scope:`chat`});let Ee=ie.data??pe?.snapshots.active_clarification??PR(),De=j.data??pe?.snapshots.active_approval??{state:`none`},Oe=Ee.state===`active`?Ee.round.id:void 0;(0,N.useEffect)(()=>{c!==null&&(Oe===void 0||c!==Oe)&&l(null)},[Oe,c]);let ke=Ee.state===`active`&&Ee.thread.owner.kind===`task_compile`,Ae=(0,N.useMemo)(()=>{let e=new Set;for(let t of _e.items)t.clarification_card!==void 0&&e.add(t.clarification_card.round_id);return Oe!==void 0&&e.add(Oe),[...e]},[Oe,_e.items]),je=_t({queries:Ae.map(t=>({queryKey:Q.clarificationRoundMessages(e,t),queryFn:()=>r.getClarificationRoundMessages(t,{anchor:`start`,limit:50}),enabled:O.isSuccess}))}),Me=yt({mutationFn:({roundId:e,body:t})=>r.sendClarificationRoundMessage(e,{body:t}),onSuccess:n=>{s(``),DR(t,e,n.invalidates)},onError:e=>{n.notify({tone:`error`,title:`Reply send failed`,message:CR(e)})}}),Ne=yt({mutationFn:e=>r.submitClarificationRound(e),onMutate:e=>(l(e),n.notify({tone:`loading`,title:`Submitting reply`})),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Reply submitted`})},onError:(e,t,r)=>{l(e=>e===t?null:e),n.update(r,{tone:`error`,title:`Reply submit failed`,message:CR(e)})}}),Pe=yt({mutationFn:({approvalId:e,decisionId:t})=>r.decideApproval(e,{decision_id:t}),onMutate:()=>n.notify({tone:`loading`,title:`Sending decision`}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Decision sent`})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Decision failed`,message:CR(e)})}}),Fe=Object.fromEntries(Ae.map((e,t)=>[e,(je[t]?.data??OR()).items.map(e=>_r(e,{authorProfiles:me}))])),Ie=dB({account:pe?.session.account,presence:se.data?.presence,messages:[..._e.items,...je.flatMap(e=>e.data?.items??[])]}),Le=M.data??pe?.snapshots.execution_status??FR(he),Re=IR(Le),ze=LR(Le,`scratchpad_refresh`),Be=LR(Le,`scratchpad_refresh`,`foreground`),Ve=LR(Le,`task_compile`,`foreground`),He=LR(Le,`project_context_bootstrap`,`foreground`),Ue=u?.kind===`activity`?u.activityRef:void 0,We=u?.kind===`activity`?u.workflowRef:void 0;(0,N.useEffect)(()=>{if(u===null)return;if(we.state===`submitted`){d(null);return}if(we.state===`empty`){d(null);return}if(Le.status===`pending`){ke||d(null);return}let e=Le.last_conclusion,t=We!==void 0&&e?.workflow_ref===We,r=Ue!==void 0&&e?.activity_ref===Ue;if(!(!t&&!r)){if(d(null),e?.kind===`failed`){n.notify({tone:`error`,title:`Scratchpad run failed`,message:e.summary});return}if(e?.kind===`needs_human`){n.notify({tone:`warning`,title:`Scratchpad needs input`,message:e.summary});return}}},[Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.summary,Le.last_conclusion?.workflow_ref,Le.status,Le.summary,ke,n,we.state,u,Ue,We]);let Ge=Ue!==void 0&&Re.some(e=>e.activity_ref===Ue),Ke=Ge&&Re.some(e=>e.activity_ref===Ue&&e.workflow_kind===`scratchpad_refresh`)||u!==null&&Be,qe=Ve||He||Ke||Ge||ke,Je=ze,Ye=fe.isPending||qe||u!==null&&Le.status===`idle`,Xe=Le.status!==`idle`||Ye||f!==null;(0,N.useEffect)(()=>{if(!Xe)return;h(Date.now());let e=window.setInterval(()=>{h(Date.now())},1e3);return()=>{window.clearInterval(e)}},[Xe]);let Ze=Re.some(e=>e.activity_kind===`procedure`&&(e.lane??`foreground`)===`foreground`)&&!Je&&!Ye,Qe=mS(Le),$e={key:`scratchpad-submit`,label:ke?`Needs input`:Ke?`Compiling Worklist tasks`:He?`Preparing project context`:Ve?`Compiling Worklist tasks`:`Preparing Worklist`,title:ke?`Needs input`:`Preparing Scratchpad for Worklist.`,tone:ke?`pending`:`running`,target:ke?{kind:`clarification`}:{kind:`scratchpad`}},et=Ye&&Qe.length===0?[$e]:Qe,tt=uS(Le,{now:m}),nt=Re.find(e=>(e.lane??`foreground`)===`foreground`?e.workflow_kind===`project_context_bootstrap`&&He||e.workflow_kind===`task_compile`&&Ve||e.workflow_kind===`scratchpad_refresh`&&Ke?!0:Ue!==void 0&&e.activity_ref===Ue:!1),it=(Ye?dS({activeScratchpadRefreshFromSubmit:Ke,activeProjectContextBootstrap:He,activeTaskCompile:Ve,activeTaskCompileClarification:ke,now:m,...nt?.started_at===void 0?{}:{startedAt:nt.started_at},...Le.runtime===void 0?{}:{runtime:Le.runtime}}):null)??tt;(0,N.useEffect)(()=>{it!==null&&(C.current=it,p(null))},[it]),(0,N.useEffect)(()=>{if(!ze||it!==null)return;let e=C.current;if(e?.completionSource===void 0)return;let t=`hidden:${sB(e)}`;if(w.current===t)return;w.current=t;let n=fS(e,e.summary);p(n),C.current=null;let r=window.setTimeout(()=>{p(e=>e?.key===n.key?null:e)},aB);return()=>{window.clearTimeout(r)}},[it,ze]),(0,N.useEffect)(()=>{if(it!==null||Le.status!==`idle`)return;let e=Le.last_conclusion;if(e?.kind!==`completed`)return;let t=e.activity_ref??`${e.kind}:${e.task_id??`none`}:${e.occurred_at}`;if(w.current===t)return;let n=C.current;if(n===null)return;if(!pS(n,e)){C.current=null;return}w.current=t;let r=fS(n,e.summary);p(r);let i=window.setTimeout(()=>{p(e=>e?.key===r.key?null:e),C.current=null},aB);return()=>{window.clearTimeout(i)}},[it,Le.last_conclusion?.activity_ref,Le.last_conclusion?.kind,Le.last_conclusion?.occurred_at,Le.last_conclusion?.summary,Le.last_conclusion?.task_id,Le.status]);let at=it??f,ot=f===null?null:{key:`completed`,label:`Completed`,tone:`done`,target:f.completionTarget??{kind:`scratchpad`}},st=ot===null?et:[ot,...et],ct=e=>{e.preventDefault();let t=i.trim();if(t!==``&&!ue.isPending){let e=S.current?.body===t?S.current:{body:t,commandId:Wt()};S.current=e,ue.mutate(e)}},lt=e=>{e.preventDefault();let t=o.trim();t!==``&&Oe!==void 0&&!Me.isPending&&Me.mutate({roundId:Oe,body:t})},ut=ne&&ge===void 0&&A.error!==null&&(b.kind!==`latest`||pe?.snapshots.main_chat===void 0),dt=pe===void 0&&O.error!==null||ut;return(0,N.useEffect)(()=>{y!==void 0&&_(y)},[y]),(0,P.jsx)(UC,{projectName:pe?.workspace.project.display_name??`Workspace`,projectDescription:pe?.workspace.project.description??``,members:Ie,messages:_e.items.map(e=>_r(e,{authorProfiles:me,referenceAssetUrl:(e,t,n)=>r.viewerAssetUrl({path:e,variant:t,v:n})})),scratchpad:Nr(we,_e.items),executionProgress:at,activeApproval:Sr(De),activeClarification:vr(Ee),clarificationMessagesByRoundId:Fe,statusShortcuts:st,unread:jR(Te),artifactSignal:MR(oe.data),draft:i,roundDraft:o,sendPending:ue.isPending,focusMessageId:g,messageHistoryIdentity:xe,initialMessagePosition:Se,hasOlderMessages:ve,hasNewerMessages:ye,loadingOlderMessages:A.isFetchingPreviousPage,loadingNewerMessages:A.isFetchingNextPage,historyConnectedToLatest:be,submittedRoundId:c,referenceUploadPending:de.isPending,scratchpadSyncPending:Je,scratchpadActionsDisabled:Ze,scratchpadSubmitPending:Ye,roundSendPending:Me.isPending,roundSubmitPending:Ne.isPending,approvalDecisionPending:Pe.isPending,projectNameSaving:ce.isPending,projectDescriptionSaving:le.isPending,loading:pe===void 0&&O.isLoading||Ce,unavailable:dt,onDraftChange:e=>{S.current?.body!==e.trim()&&(S.current=null),a(e)},onMessageFocused:()=>_(null),onInitialMessagePositioned:()=>{b.kind===`start`&&A.isSuccess&&k!==void 0&&fz(k,e)},onLoadOlderMessages:()=>{A.fetchPreviousPage()},onLoadNewerMessages:()=>{A.fetchNextPage()},onJumpToLatest:()=>D(),onUploadReferenceFile:e=>de.mutate(e),onOpenReferenceFile:t=>$(RR(e,t)),onRoundDraftChange:s,onSendMessage:ct,onSendRoundMessage:lt,onSubmitRound:()=>{Oe!==void 0&&Ne.mutate(Oe)},onDecideApproval:(e,t)=>Pe.mutate({approvalId:e,decisionId:t}),onSubmitScratchpad:()=>fe.mutate(we.updated_at),onUpdateProjectDisplayName:async e=>{await ce.mutateAsync(e)},onUpdateProjectDescription:async e=>{await le.mutateAsync(e)},onOpenProjectCenter:()=>$(`/projects`),onOpenWorklist:()=>$(BR(e)),onOpenWorklistTask:t=>$(BR(e,t)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t)})}function mB(e){return Qt(e)?Zt(e,`relay_session_invalid`)?`client_session`:`account_session`:null}function hB(e){return e===`client_session`?{title:`Workspace session expired`,message:`Open the project again from Project Center.`}:{title:`Sign in required`,message:`Sign in to Tutti before opening this workspace.`}}function gB(e){return e===`client_session`?`/projects`:`/`}function _B({relayProjectRef:e,children:t}){let n=rt(),r=pR(),i=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),a=(0,N.useRef)(void 0),o=(0,N.useRef)(null),s=F({queryKey:Q.bootstrap(e),queryFn:()=>i.getBootstrap(),staleTime:yR}),c=mB(s.error),l=c===null&&s.data?.workspace.capabilities.sse===!0;return a.current===void 0&&s.data!==void 0&&(a.current=s.data.event_cursor),(0,N.useEffect)(()=>{if(c===null)return;let t=`${e}:${c}`;o.current!==t&&(o.current=t,r.notify({tone:`warning`,...hB(c)}),$(gB(c),{replace:!0}))},[c,r,e]),(0,N.useEffect)(()=>{if(!l)return;let t=i.connectEvents({...a.current===void 0?{}:{after:a.current},onReady:t=>{t.payload.replay.status===`missed`&&n.invalidateQueries({queryKey:Q.hostRoot(e)})},onInvalidate:t=>{DR(n,e,t)},onError:()=>void 0});return()=>t.close()},[i,n,e,l]),c===null?t:null}function vB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:yR}).data?.session.account.account_ref,r=n===void 0?null:`${n}:${e}`,[i,a]=(0,N.useState)({identity:null,pending:!1}),[o,s]=(0,N.useState)(!1),c=Id();(0,N.useEffect)(()=>{n===void 0||r===null||i.identity===r||a({identity:r,pending:lz(n,e).tour_pending})},[n,r,i.identity,e]);let l=t=>{pz(t,e),a({identity:r,pending:!1})};return(0,P.jsxs)(P.Fragment,{children:[c&&r!==null&&i.identity===r&&i.pending&&n!==void 0&&typeof document<`u`?(0,mc.createPortal)((0,P.jsx)(Ud,{onOpen:()=>{l(n),s(!0)},onDismiss:()=>l(n)}),document.body):null,(0,P.jsx)(Wd,{assets:kS,open:o,onOpenChange:s})]})}var yB=2e4,bB=3e4;function xB(e,t,n={}){let r=n.runActive??!1;if(e===void 0)return r?{status:`updating`}:{status:`loading`};if(e.status===`not_declared`)return r?{status:`updating`}:{status:`not_declared`};if(e.status===`invalid`)return r?{status:`updating`}:{status:`invalid`,message:e.error.message};let i={status:`declared`,title:e.artifact.title,artifactKind:e.artifact.kind,network:e.artifact.network,previewStatus:e.preview.status,...e.preview.error_message===void 0?{}:{errorMessage:e.preview.error_message}};return e.preview.status===`ready`?t.previewUrl===void 0?r?{status:`updating`}:t.errorMessage===void 0?{...i,previewStatus:t.pending?`starting`:`failed`,...t.pending?{}:{errorMessage:`Preview session is unavailable`}}:{...i,previewStatus:`failed`,errorMessage:t.errorMessage}:{...i,previewUrl:t.previewUrl}:r?{status:`updating`}:i}function SB(e){if(!(e===void 0||e.disposition.kind===`issued`))return e.disposition.kind===`invalid_manifest`?e.disposition.message:e.disposition.kind===`preview_not_ready`?e.disposition.message??`Preview is not ready`:e.disposition.kind===`not_declared`?`Artifact is no longer declared`:`Preview session expired before it could be opened`}function CB(e){return e===void 0?!1:e.disposition.kind!==`issued`||e.result===void 0?e.disposition.kind===`preview_not_ready`||e.disposition.kind===`interrupted`?1e3:!1:Math.max(1e3,Date.parse(e.result.expires_at)-Date.now()-bB)}function wB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=(0,N.useMemo)(()=>zn(vR),[]),a=(0,N.useRef)(null),o=(0,N.useRef)(!1),s=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),c=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:s.isSuccess,staleTime:yR}),l=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:s.isSuccess,staleTime:yR}),u=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:s.isSuccess,staleTime:yR}),d=yt({mutationFn:(e={})=>r.startArtifactPreview(),onSuccess:(r,i)=>{DR(t,e,r.invalidates),i.noticeId!==void 0&&n.update(i.noticeId,{tone:`success`,title:`Preview restarted`})},onError:(e,t)=>{a.current=null,t.noticeId!==void 0&&n.update(t.noticeId,{tone:`error`,title:`Preview restart failed`,message:CR(e)})}}),f=yt({mutationFn:()=>r.heartbeatArtifactPreview(),onSuccess:n=>{n.result?.artifact===void 0?DR(t,e,n.invalidates):t.setQueryData(Q.artifacts(e),{artifact:n.result.artifact})}}),p=yt({mutationFn:()=>r.stopArtifactPreview(),onMutate:()=>n.notify({tone:`loading`,title:`Stopping preview`}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),n.update(a,{tone:`success`,title:`Preview stopped`})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Preview stop failed`,message:CR(e)})}}),m=s.data,h=m?.generated_at??new Date(0).toISOString(),g=u.data??m?.snapshots.read_state,_=l.data??m?.snapshots.execution_status??FR(h),v=_.active_activity?.activity_kind===`run`||_.active_activities?.some(e=>e.activity_kind===`run`)===!0;(0,N.useEffect)(()=>{o.current&&!v&&(a.current=null),o.current=v},[v]);let y=c.data?.artifact,b=y?.status===`declared`&&y.preview.status===`ready`&&y.preview.url!==void 0?y.preview.url:null,x=F({queryKey:Q.artifactPreviewSession(e,b??`not-ready`),queryFn:()=>i.issueArtifactPreviewSession(e),enabled:b!==null,staleTime:1/0,retry:1,refetchInterval:e=>CB(e.state.data)}),S=x.data,C=S?.disposition.kind===`issued`?S.result?.bootstrap_url:void 0,w=x.error===null?SB(S):CR(x.error),T=y?.status===`declared`&&y.artifact.kind===`server`?y.manifest_blob_oid:null,E=T!==null,ee=y?.status===`declared`&&y.artifact.kind===`server`&&y.preview.status===`stopped`&&a.current!==y.manifest_blob_oid&&!v&&!d.isPending;(0,N.useEffect)(()=>{ee&&(a.current=y?.status===`declared`?y.manifest_blob_oid:null,d.mutate({}))},[y,ee,d]),(0,N.useEffect)(()=>{if(T===null){a.current=null;return}a.current!==null&&a.current!==T&&(a.current=null)},[T]),(0,N.useEffect)(()=>{if(y?.status!==`declared`||y.artifact.kind!==`server`||y.preview.status!==`starting`&&y.preview.status!==`ready`)return;f.mutate();let e=window.setInterval(()=>{f.isPending||f.mutate()},yB);return()=>{window.clearInterval(e)}},[y,f]);let D=c.data!==void 0,O=!D&&(s.error!==null||c.error!==null);return(0,P.jsx)(WC,{statusShortcuts:mS(_),unread:jR(g),artifactSignal:MR(c.data),state:xB(c.data?.artifact,{...C===void 0?{}:{previewUrl:C},pending:b!==null&&C===void 0&&w===void 0,...w===void 0?{}:{errorMessage:w}},{runActive:v}),loading:!D&&(s.isLoading||c.isLoading),unavailable:O,restartPending:d.isPending,stopPending:p.isPending,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),...E?{onRestart:()=>{let e=n.notify({tone:`loading`,title:`Restarting preview`});d.mutate({noticeId:e})},onStop:()=>p.mutate()}:{},onActivateStatusShortcut:t=>KR(e,t)})}function TB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=new URL(bR(),window.location.origin).searchParams.get(`path`)??void 0,[a,o]=(0,N.useState)(i),[s,c]=(0,N.useState)(`time`),l=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),u=F({queryKey:Q.referenceFiles(e),queryFn:()=>r.getReferenceFiles({limit:200}),enabled:l.isSuccess,staleTime:yR}),d=F({queryKey:Q.messagesWindow(e,200),queryFn:()=>r.getMessages({limit:200}),enabled:l.isSuccess,staleTime:yR}),f=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:l.isSuccess,staleTime:yR}),p=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:l.isSuccess,staleTime:yR}),m=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:l.isSuccess,staleTime:yR}),h=u.data?.items??[],g=(0,N.useMemo)(()=>{let e=new Map;for(let t of d.data?.items??[]){let n=t.refs?.reference_file;if(n===void 0)continue;let r=e.get(n.path);(r===void 0||t.created_at>r)&&e.set(n.path,t.created_at)}return e},[d.data?.items]),_=(0,N.useMemo)(()=>{let e=(e,t)=>e.name.localeCompare(t.name),t=(t,n)=>{let r=g.get(t.path)??``,i=g.get(n.path)??``;return r===i?e(t,n):i.localeCompare(r)},n=(e,n)=>{let r=e.extension??e.media_type??`file`,i=n.extension??n.media_type??`file`;return r===i?t(e,n):r.localeCompare(i)},r=[...h.filter(e=>e.category===`image`&&e.source===`human_upload`)].sort(t),i=[...h.filter(e=>!(e.category===`image`&&e.source===`human_upload`))].sort(s===`time`?t:n);return[...r,...i]},[s,h,g]);(0,N.useEffect)(()=>{if(_.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&_.some(e=>e.path===i)){a!==i&&o(i);return}(a===void 0||!_.some(e=>e.path===a))&&o(_[0]?.path)},[_,i,a]);let v=h.find(e=>e.path===a),y=v?.category===`image`,b=v?.text_read.can_read===!0,x=F({queryKey:a===void 0?Q.viewerFile(e,`none`):Q.viewerFile(e,a),queryFn:()=>r.getViewerFile({path:a,max_bytes:204800}),enabled:l.isSuccess&&a!==void 0&&b&&!y,staleTime:yR}),S=yt({mutationFn:async t=>{let n=await $R({relayProjectRef:e,purpose:`reference_file`,file:t});return r.uploadReferenceFile(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading reference`,message:e.name}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates),r.result?.file.path!==void 0&&(o(r.result.file.path),$(RR(e,r.result.file.path))),n.update(a,{tone:`success`,title:`Reference uploaded`,message:r.result?.file.name??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Reference upload failed`,message:CR(e)||t.name})}}),C=l.data,w=C?.generated_at??new Date(0).toISOString(),T=p.data??C?.snapshots.read_state;NR({enabled:l.isSuccess,hostClient:r,relayProjectRef:e,readState:T,scope:`references`});let E=f.data??C?.snapshots.execution_status??FR(w),ee=_.map(e=>{let t=OB(e,u.data?.directory.tutti_path);return{path:e.path,name:e.name,meta:DB(e),source:e.source,...t===void 0?{}:{generatedGroup:t},selected:e.path===a,canPreview:e.text_read.can_read,category:e.category,...e.category===`image`&&e.source===`human_upload`?{...e.blob_oid===void 0?{}:{thumbnailUrl:r.viewerAssetUrl({path:e.path,variant:`thumbnail`,v:e.blob_oid})}}:{},...e.extension===void 0?{}:{extension:e.extension}}}),D=x.data?.content,O=(()=>{if(v===void 0)return{title:h.length===0?`No reference files`:`No file selected`,unavailableReason:h.length===0?`No reference files`:`Select a reference file`};if(D?.kind===`text`)return{title:v.name,meta:JR(v.size_bytes),...EB(v),content:D.text};if(y&&a!==void 0)return v.blob_oid===void 0?{title:v.name,meta:JR(v.size_bytes),...EB(v),unavailableReason:`Image version unavailable`}:{title:v.name,meta:JR(v.size_bytes),...EB(v),imageUrl:r.viewerAssetUrl({path:a,variant:`preview`,v:v.blob_oid})};let e=b&&x.isLoading?`Loading`:XR(D)??(b?void 0:YR(v.text_read.blocked_reason));return e===void 0?{title:v.name,meta:JR(v.size_bytes),...EB(v)}:{title:v.name,meta:JR(v.size_bytes),...EB(v),unavailableReason:e}})(),k=u.data!==void 0,te=!k&&(l.error!==null||u.error!==null);return(0,P.jsx)(GC,{statusShortcuts:mS(E),unread:jR(T),artifactSignal:MR(m.data),files:ee,detail:O,uploadPending:S.isPending,fileSortMode:s,loading:!k&&(l.isLoading||u.isLoading),unavailable:te,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t),onSelectFile:t=>{o(t),$(RR(e,t))},onUploadFile:e=>S.mutate(e),onFileSortModeChange:c})}function EB(e){let t=e.summary;return t===void 0||t.status===`missing`?{summaryStatus:`Summary not available yet`}:t.status===`stale`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:`Summary may be out of date`}:t.status===`unavailable`?{...t.text===void 0?{}:{summary:t.text},summaryStatus:t.unavailable_reason===void 0?`Summary unavailable`:`Summary unavailable: ${t.unavailable_reason}`}:t.text===void 0?{summaryStatus:`Summary unavailable`}:{summary:t.text}}function DB(e){let t=e.source===`tutti_output`?`Tutti`:`Uploaded`;if(e.category===`image`)return[t,e.media_type??`Image`,JR(e.size_bytes)].join(` · `);let n=[t,JR(e.size_bytes)];return e.text_read.can_read||n.push(YR(e.text_read.blocked_reason)),n.join(` · `)}function OB(e,t){if(e.source!==`tutti_output`||t===void 0)return;let n=`${t}/`;if(!e.path.startsWith(n))return;let[r,i]=e.path.slice(n.length).split(`/`);if(!(r===void 0||r.length===0||i===void 0))return r}function kB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap()}),a=F({queryKey:Q.hostWorkspace(e),queryFn:()=>r.getWorkspace(),enabled:i.isSuccess}),o=F({queryKey:Q.hostSession(e),queryFn:()=>r.getSession(),enabled:i.isSuccess}),s=F({queryKey:Q.providerConfig(e),queryFn:()=>r.getProviderConfig(),enabled:i.isSuccess}),c=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:i.isSuccess}),l=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:i.isSuccess}),u=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:i.isSuccess}),d=yt({mutationFn:e=>r.updateProjectDisplayName({display_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project name`,message:e}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project name saved`,message:i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project name save failed`,message:`${t}: ${CR(e)}`})}}),f=yt({mutationFn:e=>r.updateProjectDescription({description:e}),onMutate:e=>n.notify({tone:`loading`,title:`Saving project description`,...e.length===0?{}:{message:e}}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates??[{kind:`workspace`},{kind:`bootstrap`}]),n.update(a,{tone:`success`,title:`Project description saved`,...i.length===0?{}:{message:i}})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Project description save failed`,message:CR(e)})}}),p=i.data,m=p?.generated_at??new Date(0).toISOString(),h=l.data??p?.snapshots.read_state,g=a.data??p?.workspace,_=o.data??p?.session,v=s.data??p?.provider_config,y=c.data??p?.snapshots.execution_status??FR(m),b=g===void 0||_===void 0||v===void 0?void 0:Jr(g,_,v),x=b===void 0&&(i.error!==null||a.error!==null||o.error!==null||s.error!==null),S=g?.relay.join_url,C=S===void 0||g===void 0||_===void 0?void 0:xz({inviterName:_.account.display_name,projectName:g.project.display_name,joinUrl:S});return(0,P.jsx)(nw,{...b===void 0?{}:{settings:b},statusShortcuts:mS(y),unread:jR(h),artifactSignal:MR(u.data),loading:b===void 0&&(i.isLoading||a.isLoading||o.isLoading||s.isLoading),unavailable:x,projectNameSaving:d.isPending,projectDescriptionSaving:f.isPending,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onActivateStatusShortcut:t=>KR(e,t),...C===void 0?{}:{onCopyJoinUrl:()=>{navigator.clipboard.writeText(C).then(()=>{n.notify({tone:`success`,title:`Invitation copied`})}).catch(()=>{n.notify({tone:`error`,title:`Copy failed`,message:`The browser could not copy the invite link.`})})}},onUpdateProjectDisplayName:async e=>{await d.mutateAsync(e)},onUpdateProjectDescription:async e=>{await f.mutateAsync(e)}})}function AB({relayProjectRef:e}){let t=rt(),n=pR(),r=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),i=new URL(bR(),window.location.origin).searchParams.get(`skill`)??void 0,[a,o]=(0,N.useState)(i),s=F({queryKey:Q.bootstrap(e),queryFn:()=>r.getBootstrap(),staleTime:yR}),c=F({queryKey:Q.skills(e),queryFn:()=>r.getSkills(),enabled:s.isSuccess,staleTime:yR}),l=F({queryKey:Q.executionStatus(e),queryFn:()=>r.getExecutionStatus(),enabled:s.isSuccess,staleTime:yR}),u=F({queryKey:Q.readState(e),queryFn:()=>r.getReadState(),enabled:s.isSuccess,staleTime:yR}),d=F({queryKey:Q.artifacts(e),queryFn:()=>r.getArtifacts(),enabled:s.isSuccess,staleTime:yR}),f=c.data?.items??[];(0,N.useEffect)(()=>{if(f.length===0){a!==void 0&&o(void 0);return}if(i!==void 0&&f.some(e=>e.name===i)){a!==i&&o(i);return}(a===void 0||!f.some(e=>e.name===a))&&o(f[0]?.name)},[i,a,f]);let p=F({queryKey:a===void 0?Q.skillDetail(e,`none`):Q.skillDetail(e,a),queryFn:()=>r.getSkill(a),enabled:s.isSuccess&&a!==void 0,staleTime:yR}),m=yt({mutationFn:async t=>{let n=await $R({relayProjectRef:e,purpose:`skill_zip`,file:t});return r.importSkillZip(n)},onMutate:e=>n.notify({tone:`loading`,title:`Uploading skill`,message:e.name}),onSuccess:(r,i,a)=>{DR(t,e,r.invalidates);let s=r.result?.skill.name??(r.disposition.kind===`created`||r.disposition.kind===`replaced`?r.disposition.skill_name:void 0);s!==void 0&&(o(s),$(WR(e,s))),n.update(a,{tone:`success`,title:`Skill installed`,message:s??i.name})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill upload failed`,message:CR(e)})}}),h=yt({mutationFn:e=>r.deleteSkill({skill_name:e}),onMutate:e=>n.notify({tone:`loading`,title:`Deleting skill`,message:e}),onSuccess:(r,i,s)=>{DR(t,e,r.invalidates);let c=r.disposition.kind===`deleted`||r.disposition.kind===`not_found`?r.disposition.skill_name:a,l=f.find(e=>e.name!==c);o(l?.name),$(l===void 0?WR(e):WR(e,l.name)),n.update(s,{tone:`success`,title:`Skill deleted`,message:c??i})},onError:(e,t,r)=>{n.update(r,{tone:`error`,title:`Skill delete failed`,message:`${t}: ${CR(e)}`})}}),g=s.data,_=g?.generated_at??new Date(0).toISOString(),v=u.data??g?.snapshots.read_state;NR({enabled:s.isSuccess,hostClient:r,relayProjectRef:e,readState:v,scope:`skills`});let y=l.data??g?.snapshots.execution_status??FR(_),b=f.map(e=>({name:e.name,description:e.description,...e.short_description===void 0?{}:{shortDescription:e.short_description},selected:e.name===a,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`}})),x=f.find(e=>e.name===a),S=(()=>{let e=p.data?.skill;return e===void 0?a===void 0?{title:f.length===0?`No skills`:`No skill selected`,unavailableReason:f.length===0?`No user skills`:`Select a skill`}:{title:x?.name??a,...x?.description===void 0?{}:{description:x.description},unavailableReason:p.isLoading?`Loading`:`Skill unavailable`}:{title:e.name,description:e.description,...e.updated_at===void 0?{}:{updatedLabel:`Updated ${Zn(e.updated_at)}`},skillMd:e.skill_md}})(),C=c.data!==void 0,w=!C&&(s.error!==null||c.error!==null);return(0,P.jsx)(iw,{statusShortcuts:mS(y),unread:jR(v),artifactSignal:MR(d.data),skills:b,detail:S,uploadPending:m.isPending,deletePending:h.isPending,loading:!C&&(s.isLoading||c.isLoading),unavailable:w,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t),onSelectSkill:t=>{o(t),$(WR(e,t))},onUploadSkill:e=>m.mutate(e),onDeleteSkill:e=>h.mutate(e)})}function jB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),n=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap(),staleTime:yR}),r=F({queryKey:Q.projectTimeline(e),queryFn:()=>t.getProjectTimeline(),enabled:n.isSuccess,staleTime:yR}),i=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:n.isSuccess,staleTime:yR}),a=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:n.isSuccess,staleTime:yR}),o=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:n.isSuccess,staleTime:yR}),s=n.data,c=s?.generated_at??new Date(0).toISOString(),l=a.data??s?.snapshots.read_state,u=i.data??s?.snapshots.execution_status??FR(c),d=r.data===void 0&&(n.error!==null||r.error!==null);return(0,P.jsx)(aw,{...r.data===void 0?{}:{timeline:jx(r.data,{onOpenWorklistTask:t=>$(BR(e,t)),onOpenChatMessage:t=>$(VR(e,t)),onOpenReferenceFile:t=>$(RR(e,t))})},statusShortcuts:mS(u),unread:jR(l),artifactSignal:MR(o.data),loading:r.data===void 0&&(n.isLoading||r.isLoading),unavailable:d,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenWorklist:()=>$(BR(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t)})}function MB({relayProjectRef:e}){let t=(0,N.useMemo)(()=>Pn({...vR,relayProjectRef:e}),[e]),n=new URL(bR(),window.location.origin).searchParams.get(`task`)??void 0,[r,i]=(0,N.useState)(void 0),a=F({queryKey:Q.bootstrap(e),queryFn:()=>t.getBootstrap()}),o=F({queryKey:Q.worklist(e),queryFn:()=>t.getWorklist(),enabled:a.isSuccess}),s=F({queryKey:Q.executionStatus(e),queryFn:()=>t.getExecutionStatus(),enabled:a.isSuccess}),c=F({queryKey:Q.readState(e),queryFn:()=>t.getReadState(),enabled:a.isSuccess}),l=F({queryKey:Q.artifacts(e),queryFn:()=>t.getArtifacts(),enabled:a.isSuccess}),u=a.data,d=u?.generated_at??new Date(0).toISOString(),f=o.data??u?.snapshots.worklist??kR(),p=c.data??u?.snapshots.read_state;NR({enabled:a.isSuccess,hostClient:t,relayProjectRef:e,readState:p,scope:`worklist`});let m=(0,N.useMemo)(()=>Fr(f),[f]),h=n!==void 0&&m.some(e=>e.id===n),g=n!==void 0&&!h?n:void 0;(0,N.useEffect)(()=>{if(n!==void 0){i(h?e=>e===n?e:n:void 0);return}if(m.length===0){i(void 0);return}(r===void 0||!m.some(e=>e.id===r))&&i(qR(f,void 0))},[h,n,r,m,f]);let _=F({queryKey:r===void 0?Q.taskDetail(e,`none`):Q.taskDetail(e,r),queryFn:()=>t.getTaskDetail(r),enabled:a.isSuccess&&r!==void 0}),v=F({queryKey:r===void 0?Q.taskRunResults(e,`none`):Q.taskRunResults(e,r),queryFn:()=>t.getTaskRunResults(r,{limit:50}),enabled:a.isSuccess&&r!==void 0}),y=s.data??u?.snapshots.execution_status??FR(d),b=Pr(f,r),x=Gr(_.data,v.data),S=o.data!==void 0||u?.snapshots.worklist!==void 0,C=!S&&(a.error!==null||o.error!==null);return(0,P.jsx)(ow,{statusShortcuts:mS(y),unread:jR(p),artifactSignal:MR(l.data),modules:b.modules,taskCount:b.taskCount,...x===void 0?{}:{detail:x},...g===void 0?{}:{missingTaskId:g},loading:!S&&(a.isLoading||o.isLoading),unavailable:C,onOpenProjectCenter:()=>$(`/projects`),onOpenChat:()=>$(rn(e)),onOpenReferences:()=>$(RR(e)),onOpenArtifacts:()=>$(zR(e)),onOpenSkills:()=>$(WR(e)),onOpenTimeline:()=>$(UR(e)),onOpenSettings:()=>$(HR(e)),onActivateStatusShortcut:t=>KR(e,t),onSelectTask:t=>{i(t),$(BR(e,t))}})}var NB=`is-scrollbar-active`,PB=1e3;function FB(e,t){let n=e.target;return n instanceof Element?n:t.scrollingElement??t.documentElement}function IB(e){let t=new Map,n=e=>{let n=t.get(e);n!==void 0&&(window.clearTimeout(n),t.delete(e)),e.classList.remove(NB)},r=e=>{let r=t.get(e);r!==void 0&&window.clearTimeout(r),e.classList.add(NB);let i=window.setTimeout(()=>n(e),PB);t.set(e,i)},i=t=>{r(FB(t,e))};return e.addEventListener(`scroll`,i,{capture:!0,passive:!0}),()=>{e.removeEventListener(`scroll`,i,!0);for(let[e,n]of t)window.clearTimeout(n),e.classList.remove(NB);t.clear()}}var LB=`--tutti-viewport-height`,RB=`--tutti-viewport-offset-top`;function zB(e,t=window){let n=e.documentElement,r=t.visualViewport,i=()=>{let e=r?.height??t.innerHeight,i=r?.offsetTop??0;n.style.setProperty(LB,`${Math.max(0,e)}px`),n.style.setProperty(RB,`${Math.max(0,i)}px`)};return i(),t.addEventListener(`resize`,i),t.addEventListener(`orientationchange`,i),r?.addEventListener(`resize`,i),r?.addEventListener(`scroll`,i),()=>{t.removeEventListener(`resize`,i),t.removeEventListener(`orientationchange`,i),r?.removeEventListener(`resize`,i),r?.removeEventListener(`scroll`,i),n.style.removeProperty(LB),n.style.removeProperty(RB)}}var BB=new $e({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function VB(){let e=SR();if(e.kind===`local_console`)return(0,P.jsx)(Dz,{});if(e.kind===`home`)return(0,P.jsx)(gz,{});if(e.kind===`join`)return(0,P.jsx)(mz,{joinToken:e.joinToken});if(e.kind===`setup`)return(0,P.jsx)(Qz,{});if(e.kind===`project_open`)return(0,P.jsx)(Lz,{requestedOpenProjectRef:e.relayProjectRef});if(e.kind===`workspace`||e.kind===`worklist`||e.kind===`references`||e.kind===`artifacts`||e.kind===`skills`||e.kind===`timeline`||e.kind===`settings`){let t=e.kind===`workspace`?(0,P.jsx)(pB,{relayProjectRef:e.relayProjectRef}):e.kind===`worklist`?(0,P.jsx)(MB,{relayProjectRef:e.relayProjectRef}):e.kind===`references`?(0,P.jsx)(TB,{relayProjectRef:e.relayProjectRef}):e.kind===`artifacts`?(0,P.jsx)(wB,{relayProjectRef:e.relayProjectRef}):e.kind===`skills`?(0,P.jsx)(AB,{relayProjectRef:e.relayProjectRef}):e.kind===`timeline`?(0,P.jsx)(jB,{relayProjectRef:e.relayProjectRef}):(0,P.jsx)(kB,{relayProjectRef:e.relayProjectRef});return(0,P.jsxs)(_B,{relayProjectRef:e.relayProjectRef,children:[t,(0,P.jsx)(vB,{relayProjectRef:e.relayProjectRef})]},e.relayProjectRef)}return(0,P.jsx)(Lz,{})}function HB(){return(0,N.useEffect)(()=>{let e=IB(document),t=zB(document);return()=>{e(),t()}},[]),(0,P.jsx)(it,{client:BB,children:(0,P.jsx)(fR,{children:(0,P.jsx)(VB,{})})})}function UB(e){let t=document.querySelector(`link[rel="icon"]`),n=t??document.createElement(`link`);n.rel=`icon`,n.type=`image/png`,n.sizes=`1204x1204`,n.href=e,t===null&&document.head.append(n)}UB(ES),(0,xt.createRoot)(document.getElementById(`root`)).render((0,P.jsx)(N.StrictMode,{children:(0,P.jsx)(HB,{})}));export{L as C,ci as S,Mi as _,bd as a,di as b,H as c,Zi as d,Xi as f,Fi as g,Li as h,Dd as i,wd as l,Bi as m,fd as n,Sd as o,qi as p,kd as r,Od as s,Wy as t,ra as u,ji as v,tt as w,li as x,Si as y};
|