@spikonado/sprocket 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +3 -2
  2. package/package.json +6 -6
  3. package/web/_app/immutable/assets/0.Btn1dfCy.css +2 -0
  4. package/web/_app/immutable/chunks/BxbMz3h1.js +1 -0
  5. package/web/_app/immutable/chunks/CeNjyCLa.js +2 -0
  6. package/web/_app/immutable/chunks/CrsnnmTA.js +1 -0
  7. package/web/_app/immutable/chunks/D_7QcTZV.js +6 -0
  8. package/web/_app/immutable/chunks/Dtk4_9sS.js +64 -0
  9. package/web/_app/immutable/chunks/OmCPj9EG.js +7 -0
  10. package/web/_app/immutable/chunks/{C7n7Hkve.js → PSXYTcvE.js} +1 -1
  11. package/web/_app/immutable/chunks/mPrToSgq.js +1 -0
  12. package/web/_app/immutable/entry/{app.CeGw4OSi.js → app.D45zMGUe.js} +2 -2
  13. package/web/_app/immutable/entry/start.DjZ5YK4X.js +1 -0
  14. package/web/_app/immutable/nodes/0.mG7tw7cg.js +1 -0
  15. package/web/_app/immutable/nodes/1.C19uY9DR.js +1 -0
  16. package/web/_app/immutable/nodes/2.Bq6t6SjB.js +127 -0
  17. package/web/_app/immutable/nodes/{3.D40OcmEn.js → 3.DBnPhkDo.js} +1 -1
  18. package/web/_app/immutable/nodes/{4.coTLLCMq.js → 4.C52Ki53w.js} +1 -1
  19. package/web/_app/version.json +1 -1
  20. package/web/callback.html +14 -13
  21. package/web/index.html +11 -10
  22. package/web/pair.html +15 -14
  23. package/web/_app/immutable/assets/0.CAFzdT87.css +0 -2
  24. package/web/_app/immutable/chunks/B2QV2lSm.js +0 -1
  25. package/web/_app/immutable/chunks/DQzmXkOB.js +0 -1
  26. package/web/_app/immutable/chunks/DXwWhsEw.js +0 -6
  27. package/web/_app/immutable/chunks/D_6EnlQE.js +0 -2
  28. package/web/_app/immutable/chunks/DtbzskMF.js +0 -1
  29. package/web/_app/immutable/entry/start.B77P4R2b.js +0 -1
  30. package/web/_app/immutable/nodes/0.DmC-g_Lj.js +0 -1
  31. package/web/_app/immutable/nodes/1.Djk_ySAI.js +0 -1
  32. package/web/_app/immutable/nodes/2.DOq86jPW.js +0 -124
@@ -0,0 +1,127 @@
1
+ import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,Q as g,R as _,S as v,T as y,U as b,V as x,W as S,X as C,Y as w,Z as T,_ as E,a as D,at as O,b as k,c as ee,d as A,et as te,f as ne,ft as j,h as M,ht as N,i as P,j as re,k as F,l as ie,m as I,mt as ae,n as oe,nt as se,o as L,ot as R,p as z,pt as B,q as V,s as ce,st as H,tt as le,u as ue,v as de,w as U,x as fe,y as pe,z as me}from"../chunks/D-3DgMVM.js";import{c as W}from"../chunks/CrsnnmTA.js";import"../chunks/xihTtKlq.js";import{a as he,d as ge,f as _e,i as ve,l as ye,n as be,p as G,r as xe,s as Se,t as Ce,u as we}from"../chunks/D_7QcTZV.js";import{a as Te,l as Ee,n as De,o as K,r as Oe,s as ke,t as Ae}from"../chunks/Dtk4_9sS.js";import{a as je,c as q,i as Me,o as Ne,r as Pe,s as Fe}from"../chunks/CeNjyCLa.js";import{t as Ie}from"../chunks/mPrToSgq.js";import{a as J,i as Le,n as Re,r as ze,t as Be}from"../chunks/PSXYTcvE.js";import{a as Ve,n as He,o as Ue}from"../chunks/OmCPj9EG.js";var We=Object.defineProperty,Ge=(e,t,n)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>Ge(e,typeof t==`symbol`?t:t+``,n),Ke=`https://docs.convex.dev/error#undefined-validator`;function X(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${Ke} for details.`)}var qe=class{constructor({isOptional:e}){Y(this,`type`),Y(this,`fieldPaths`),Y(this,`isOptional`),Y(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},Je=class e extends qe{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),Y(this,`tableName`),Y(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},Ye=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},Xe=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},Ze=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`commitTs`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Qe=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},$e=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},et=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},tt=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},nt=class e extends qe{constructor(){super(...arguments),Y(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},rt=class e extends qe{constructor({isOptional:e,fields:t}){super({isOptional:e}),Y(this,`fields`),Y(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&X(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},it=class e extends qe{constructor({isOptional:e,value:t}){if(super({isOptional:e}),Y(this,`value`),Y(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:q(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},at=class e extends qe{constructor({isOptional:e,element:t}){super({isOptional:e}),Y(this,`element`),Y(this,`kind`,`array`),t===void 0&&X(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},ot=class e extends qe{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),Y(this,`key`),Y(this,`value`),Y(this,`kind`,`record`),t===void 0&&X(`v.record()`,`key`),n===void 0&&X(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},st=class e extends qe{constructor({isOptional:e,members:t}){super({isOptional:e}),Y(this,`members`),Y(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&X(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},Z={id:e=>new Je({isOptional:`required`,tableName:e}),null:()=>new tt({isOptional:`required`}),number:()=>new Ye({isOptional:`required`}),float64:()=>new Ye({isOptional:`required`}),bigint:()=>new Xe({isOptional:`required`}),int64:()=>new Xe({isOptional:`required`}),commitTs:()=>new Ze({isOptional:`required`}),boolean:()=>new Qe({isOptional:`required`}),string:()=>new et({isOptional:`required`}),bytes:()=>new $e({isOptional:`required`}),literal:e=>new it({isOptional:`required`,value:e}),array:e=>new at({isOptional:`required`,element:e}),object:e=>new rt({isOptional:`required`,fields:e}),record:(e,t)=>new ot({isOptional:`required`,key:e,value:t}),union:(...e)=>new st({isOptional:`required`,members:e}),any:()=>new nt({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>Z.union(e,Z.null())},ct={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},lt=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ut=Symbol(`lucide-context`),dt=()=>O(ut),ft=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),pt=t(`<svg><!><!></svg>`);function Q(t,n){H(n,!0);let a=dt()??{},c=P(n,`color`,19,()=>a.color??`currentColor`),l=P(n,`size`,19,()=>a.size??24),d=P(n,`strokeWidth`,19,()=>a.strokeWidth??2),f=P(n,`absoluteStrokeWidth`,19,()=>a.absoluteStrokeWidth??!1),p=P(n,`iconNode`,19,()=>[]),h=D(n,ft),g=e(()=>f()?Number(d())*24/Number(l()):d());var _=pt();ie(_,e=>({...ct,...e,...h,width:l(),height:l(),stroke:c(),"stroke-width":o(g),class:[`lucide-icon lucide`,a.class,n.name&&`lucide-${n.name}`,n.class]}),[()=>!n.children&&!lt(h)&&{"aria-hidden":`true`}]);var y=s(_);v(y,17,p,r,(t,n)=>{var r=e(()=>N(o(n),2));let a=()=>o(r)[0],s=()=>o(r)[1];var c=m(),l=u(c);de(l,a,!0,(e,t)=>{ie(e,()=>({...s()}))}),i(t,c)});var b=V(y);k(b,()=>n.children??ae),B(_),i(t,_),R()}var mt=new Set([`$$slots`,`$$events`,`$$legacy`]);function ht(e,t){let n=D(t,mt),r=[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`}],[`path`,{d:`M10 12h4`}]];Q(e,L({name:`archive`},()=>n,{get iconNode(){return r}}))}var gt=new Set([`$$slots`,`$$events`,`$$legacy`]);function _t(e,t){let n=D(t,gt),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];Q(e,L({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var vt=new Set([`$$slots`,`$$events`,`$$legacy`]);function yt(e,t){let n=D(t,vt),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];Q(e,L({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var bt=new Set([`$$slots`,`$$events`,`$$legacy`]);function xt(e,t){let n=D(t,bt),r=[[`path`,{d:`M12 5v16`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`}]];Q(e,L({name:`book-open`},()=>n,{get iconNode(){return r}}))}var St=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ct(e,t){let n=D(t,St),r=[[`path`,{d:`M12 18V5`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`}]];Q(e,L({name:`brain`},()=>n,{get iconNode(){return r}}))}var wt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tt(e,t){let n=D(t,wt),r=[[`path`,{d:`M5 21v-6`}],[`path`,{d:`M12 21V3`}],[`path`,{d:`M19 21V9`}]];Q(e,L({name:`chart-no-axes-column`},()=>n,{get iconNode(){return r}}))}var Et=new Set([`$$slots`,`$$events`,`$$legacy`]);function Dt(e,t){let n=D(t,Et),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];Q(e,L({name:`check`},()=>n,{get iconNode(){return r}}))}var Ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function kt(e,t){let n=D(t,Ot),r=[[`path`,{d:`m6 9 6 6 6-6`}]];Q(e,L({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var At=new Set([`$$slots`,`$$events`,`$$legacy`]);function jt(e,t){let n=D(t,At),r=[[`path`,{d:`m9 18 6-6-6-6`}]];Q(e,L({name:`chevron-right`},()=>n,{get iconNode(){return r}}))}var Mt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nt(e,t){let n=D(t,Mt),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}]];Q(e,L({name:`circle-alert`},()=>n,{get iconNode(){return r}}))}var Pt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ft(e,t){let n=D(t,Pt),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`}],[`path`,{d:`M12 18V6`}]];Q(e,L({name:`circle-dollar-sign`},()=>n,{get iconNode(){return r}}))}var It=new Set([`$$slots`,`$$events`,`$$legacy`]);function Lt(e,t){let n=D(t,It),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]];Q(e,L({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var Rt=new Set([`$$slots`,`$$events`,`$$legacy`]);function zt(e,t){let n=D(t,Rt),r=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]];Q(e,L({name:`code-xml`},()=>n,{get iconNode(){return r}}))}var Bt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vt(e,t){let n=D(t,Bt),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];Q(e,L({name:`copy`},()=>n,{get iconNode(){return r}}))}var Ht=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ut(e,t){let n=D(t,Ht),r=[[`path`,{d:`M14 9 9 4 4 9`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`}]];Q(e,L({name:`corner-left-up`},()=>n,{get iconNode(){return r}}))}var Wt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gt(e,t){let n=D(t,Wt),r=[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`}]];Q(e,L({name:`credit-card`},()=>n,{get iconNode(){return r}}))}var Kt=new Set([`$$slots`,`$$events`,`$$legacy`]);function qt(e,t){let n=D(t,Kt),r=[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]];Q(e,L({name:`download`},()=>n,{get iconNode(){return r}}))}var Jt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yt(e,t){let n=D(t,Jt),r=[[`path`,{d:`m15 15 6 6`}],[`path`,{d:`m15 9 6-6`}],[`path`,{d:`M21 16v5h-5`}],[`path`,{d:`M21 8V3h-5`}],[`path`,{d:`M3 16v5h5`}],[`path`,{d:`m3 21 6-6`}],[`path`,{d:`M3 8V3h5`}],[`path`,{d:`M9 9 3 3`}]];Q(e,L({name:`expand`},()=>n,{get iconNode(){return r}}))}var Xt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zt(e,t){let n=D(t,Xt),r=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`M10 14 21 3`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}]];Q(e,L({name:`external-link`},()=>n,{get iconNode(){return r}}))}var Qt=new Set([`$$slots`,`$$events`,`$$legacy`]);function $t(e,t){let n=D(t,Qt),r=[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];Q(e,L({name:`eye`},()=>n,{get iconNode(){return r}}))}var en=new Set([`$$slots`,`$$events`,`$$legacy`]);function tn(e,t){let n=D(t,en),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 12.5 8 15l2 2.5`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`}]];Q(e,L({name:`file-code`},()=>n,{get iconNode(){return r}}))}var nn=new Set([`$$slots`,`$$events`,`$$legacy`]);function rn(e,t){let n=D(t,nn),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M9 10h6`}],[`path`,{d:`M12 13V7`}],[`path`,{d:`M9 17h6`}]];Q(e,L({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var an=new Set([`$$slots`,`$$events`,`$$legacy`]);function on(e,t){let n=D(t,an),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]];Q(e,L({name:`file-text`},()=>n,{get iconNode(){return r}}))}var sn=new Set([`$$slots`,`$$events`,`$$legacy`]);function cn(e,t){let n=D(t,sn),r=[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}]];Q(e,L({name:`folder-open`},()=>n,{get iconNode(){return r}}))}var ln=new Set([`$$slots`,`$$events`,`$$legacy`]);function un(e,t){let n=D(t,ln),r=[[`path`,{d:`M12 10v6`}],[`path`,{d:`M9 13h6`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];Q(e,L({name:`folder-plus`},()=>n,{get iconNode(){return r}}))}var dn=new Set([`$$slots`,`$$events`,`$$legacy`]);function fn(e,t){let n=D(t,dn),r=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];Q(e,L({name:`folder`},()=>n,{get iconNode(){return r}}))}var pn=new Set([`$$slots`,`$$events`,`$$legacy`]);function mn(e,t){let n=D(t,pn),r=[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`}],[`rect`,{width:`10`,height:`8`,x:`7`,y:`8`,rx:`1`}]];Q(e,L({name:`fullscreen`},()=>n,{get iconNode(){return r}}))}var hn=new Set([`$$slots`,`$$events`,`$$legacy`]);function gn(e,t){let n=D(t,hn),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}],[`path`,{d:`M2 12h20`}]];Q(e,L({name:`globe`},()=>n,{get iconNode(){return r}}))}var _n=new Set([`$$slots`,`$$events`,`$$legacy`]);function vn(e,t){let n=D(t,_n),r=[[`path`,{d:`M5 22h14`}],[`path`,{d:`M5 2h14`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`}]];Q(e,L({name:`hourglass`},()=>n,{get iconNode(){return r}}))}var yn=new Set([`$$slots`,`$$events`,`$$legacy`]);function bn(e,t){let n=D(t,yn),r=[[`path`,{d:`M16 5h6`}],[`path`,{d:`M19 2v6`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}]];Q(e,L({name:`image-plus`},()=>n,{get iconNode(){return r}}))}var xn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sn(e,t){let n=D(t,xn),r=[[`path`,{d:`M13 5h8`}],[`path`,{d:`M13 12h8`}],[`path`,{d:`M13 19h8`}],[`path`,{d:`m3 17 2 2 4-4`}],[`path`,{d:`m3 7 2 2 4-4`}]];Q(e,L({name:`list-checks`},()=>n,{get iconNode(){return r}}))}var Cn=new Set([`$$slots`,`$$events`,`$$legacy`]);function wn(e,t){let n=D(t,Cn),r=[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]];Q(e,L({name:`loader-circle`},()=>n,{get iconNode(){return r}}))}var Tn=new Set([`$$slots`,`$$events`,`$$legacy`]);function En(e,t){let n=D(t,Tn),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];Q(e,L({name:`lock`},()=>n,{get iconNode(){return r}}))}var Dn=new Set([`$$slots`,`$$events`,`$$legacy`]);function On(e,t){let n=D(t,Dn),r=[[`path`,{d:`m16 17 5-5-5-5`}],[`path`,{d:`M21 12H9`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}]];Q(e,L({name:`log-out`},()=>n,{get iconNode(){return r}}))}var kn=new Set([`$$slots`,`$$events`,`$$legacy`]);function An(e,t){let n=D(t,kn),r=[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]];Q(e,L({name:`moon`},()=>n,{get iconNode(){return r}}))}var jn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mn(e,t){let n=D(t,jn),r=[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`}],[`path`,{d:`M2 6h4`}],[`path`,{d:`M2 10h4`}],[`path`,{d:`M2 14h4`}],[`path`,{d:`M2 18h4`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`}]];Q(e,L({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var Nn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pn(e,t){let n=D(t,Nn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}]];Q(e,L({name:`panel-right`},()=>n,{get iconNode(){return r}}))}var Fn=new Set([`$$slots`,`$$events`,`$$legacy`]);function In(e,t){let n=D(t,Fn),r=[[`path`,{d:`M15 12h-5`}],[`path`,{d:`M15 8h-5`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`}]];Q(e,L({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var Ln=new Set([`$$slots`,`$$events`,`$$legacy`]);function Rn(e,t){let n=D(t,Ln),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];Q(e,L({name:`search`},()=>n,{get iconNode(){return r}}))}var zn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Bn(e,t){let n=D(t,zn),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];Q(e,L({name:`settings`},()=>n,{get iconNode(){return r}}))}var Vn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Hn(e,t){let n=D(t,Vn),r=[[`path`,{d:`m15 15 6 6m-6-6v4.8m0-4.8h4.8`}],[`path`,{d:`M9 19.8V15m0 0H4.2M9 15l-6 6`}],[`path`,{d:`M15 4.2V9m0 0h4.8M15 9l6-6`}],[`path`,{d:`M9 4.2V9m0 0H4.2M9 9 3 3`}]];Q(e,L({name:`shrink`},()=>n,{get iconNode(){return r}}))}var Un=new Set([`$$slots`,`$$events`,`$$legacy`]);function Wn(e,t){let n=D(t,Un),r=[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`}]];Q(e,L({name:`square-pen`},()=>n,{get iconNode(){return r}}))}var Gn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Kn(e,t){let n=D(t,Gn),r=[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]];Q(e,L({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var qn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jn(e,t){let n=D(t,qn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];Q(e,L({name:`square`},()=>n,{get iconNode(){return r}}))}var Yn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xn(e,t){let n=D(t,Yn),r=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]];Q(e,L({name:`sun`},()=>n,{get iconNode(){return r}}))}var Zn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qn(e,t){let n=D(t,Zn),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];Q(e,L({name:`terminal`},()=>n,{get iconNode(){return r}}))}var $n=new Set([`$$slots`,`$$events`,`$$legacy`]);function er(e,t){let n=D(t,$n),r=[[`circle`,{cx:`12`,cy:`8`,r:`5`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`}]];Q(e,L({name:`user-round`},()=>n,{get iconNode(){return r}}))}var tr=new Set([`$$slots`,`$$events`,`$$legacy`]);function nr(e,t){let n=D(t,tr),r=[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`}]];Q(e,L({name:`wallet`},()=>n,{get iconNode(){return r}}))}var rr=new Set([`$$slots`,`$$events`,`$$legacy`]);function ir(e,t){let n=D(t,rr),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];Q(e,L({name:`wrench`},()=>n,{get iconNode(){return r}}))}var ar=new Set([`$$slots`,`$$events`,`$$legacy`]);function or(e,t){let n=D(t,ar),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];Q(e,L({name:`x`},()=>n,{get iconNode(){return r}}))}var sr=new Set([`$$slots`,`$$events`,`$$legacy`]);function cr(e,t){let n=D(t,sr),r=[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`}]];Q(e,L({name:`zap`},()=>n,{get iconNode(){return r}}))}var lr=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],ur=[`difference`,`intersection`,`symmetricDifference`,`union`],dr=!1,fr=class e extends Set{#e=new Map;#t=g(0);#n=g(0);#r=me||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}dr||this.#a()}#i(e){return me===this.#r?g(e):T(e)}#a(){dr=!0;var t=e.prototype,n=Set.prototype;for(let e of lr)t[e]=function(...t){return o(this.#t),n[e].apply(this,t)};for(let r of ur)t[r]=function(...t){o(this.#t);var i=n[r].apply(this,t);return new e(i)}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return o(this.#t),!1;r=this.#i(!0),n.set(e,r)}return o(r),t}add(e){return super.has(e)||(super.add(e),C(this.#n,super.size),w(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),C(r,!1)),t&&(C(this.#n,super.size),w(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())C(t,!1);e.clear(),C(this.#n,0),w(this.#t)}}keys(){return this.values()}values(){return o(this.#t),super.values()}entries(){return o(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return o(this.#n)}},pr=class extends Map{#e=new Map;#t=g(0);#n=g(0);#r=me||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return me===this.#r?g(e):T(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else return o(this.#t),!1}return o(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else{o(this.#t);return}}return o(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),C(this.#n,super.size),w(o);else if(i!==t){w(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&w(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),C(n,-1)),r&&(C(this.#n,super.size),w(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;C(this.#n,0);for(var t of e.values())C(t,-1);w(this.#t),e.clear()}}#a(){o(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)o(n)}keys(){return o(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return o(this.#n),super.size}},mr=F(`<a><!></a>`),hr=F(`<button><!></button>`);function gr(t,n){H(n,!0);let r=P(n,`type`,3,`button`),a=P(n,`variant`,3,`default`),c=P(n,`className`,3,``),l=P(n,`disabled`,3,!1),d=e(()=>a()===`outline`?`border-border bg-surface/80 text-foreground hover:bg-hover-fill`:`bg-primary text-primary-foreground hover:opacity-90`),f=e(()=>J(`focus-visible:ring-ring/50 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-transparent px-5 py-2 text-sm font-medium transition-opacity focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50`,o(d),c()));var h=m(),g=u(h),_=e=>{var t=mr(),r=s(t);k(r,()=>n.children??ae),B(t),x(()=>{A(t,`href`,n.href),I(t,1,M(o(f)))}),p(`click`,t,function(...e){n.onclick?.apply(this,e)}),i(e,t)},v=e=>{var t=hr(),a=s(t);k(a,()=>n.children??ae),B(t),x(()=>{A(t,`type`,r()),t.disabled=l(),I(t,1,M(o(f)))}),p(`click`,t,function(...e){n.onclick?.apply(this,e)}),i(e,t)};y(g,e=>{n.href&&!l()?e(_):e(v,-1)}),i(t,h),R()}f([`click`]);var _r=F(`<!> <!>`,1),vr=F(`<p class="text-destructive text-center text-sm" role="alert"> </p>`),yr=F(`<div class="text-muted-foreground flex items-center justify-center gap-2 text-sm" aria-live="polite" aria-busy="true"><!> <span> </span></div>`),br=F(`<div><!></div>`);function xr(t,n){H(n,!0);let r=P(n,`overlayOpen`,3,!1),c=e(()=>n.authState.isAuthenticated&&(n.authState.isLoading||!n.authState.connectionFailed)),l=e(()=>!n.authState.isAuthenticated&&n.authState.isLoading),d=e(()=>n.authState.isConfigured?o(c)?`Confirming your session`:n.authState.connectionFailed?`Couldn’t connect your account`:o(l)?`Preparing sign-in`:`Sign in to continue`:`Sign-in unavailable`),f=e(()=>n.authState.isConfigured?o(c)?`Verifying your secure connection before opening your projects.`:n.authState.connectionFailed?`You’re signed in, but the secure connection could not be confirmed. Retry or sign out and sign in again.`:o(l)?`Getting account sign-in ready. This usually takes a moment.`:`Sign in to sync your coding threads, streaming responses, and projects.`:`Account sign-in is not configured on this deployment, so account actions are disabled.`),p=e(()=>n.authState.isAuthenticated?`Almost there`:`One moment`),h=e(()=>!!(n.authState.isConfigured&&n.authState.error&&!r()));var g=br(),_=s(g);Be(_,{get title(){return o(d)},get description(){return o(f)},actions:e=>{var t=m(),r=u(t),a=e=>{var t=_r(),r=u(t),a=e=>{gr(e,{get onclick(){return n.onRetry},get disabled(){return n.authState.isLoading},children:(e,t)=>{j();var n=re(`Retry`);i(e,n)},$$slots:{default:!0}})};y(r,e=>{n.authState.connectionFailed&&e(a)}),gr(V(r,2),{variant:`outline`,get onclick(){return n.onSignOut},children:(e,t)=>{j();var n=re(`Sign Out`);i(e,n)},$$slots:{default:!0}}),i(e,t)},o=e=>{var t=_r(),r=u(t);gr(r,{get onclick(){return n.onSignIn},get disabled(){return n.authState.isLoading},children:(e,t)=>{j();var n=re(`Sign In`);i(e,n)},$$slots:{default:!0}}),gr(V(r,2),{variant:`outline`,get onclick(){return n.onSignUp},get disabled(){return n.authState.isLoading},children:(e,t)=>{j();var n=re(`Create Account`);i(e,n)},$$slots:{default:!0}}),i(e,t)};y(r,e=>{n.authState.isAuthenticated?e(a):n.authState.isConfigured&&e(o,1)}),i(e,t)},children:(e,t)=>{var r=_r(),c=u(r),l=e=>{var t=vr(),r=s(t,!0);B(t),x(()=>a(r,n.authState.error)),i(e,t)};y(c,e=>{o(h)&&e(l)});var d=V(c,2),f=e=>{var t=yr(),n=s(t);wn(n,{class:`size-3.5 animate-spin`,"aria-hidden":`true`});var r=V(n,2),c=s(r,!0);B(r),B(t),x(()=>a(c,o(p))),i(e,t)};y(d,e=>{n.authState.isLoading&&e(f)}),i(e,r)},$$slots:{actions:!0,default:!0}}),B(g),x(()=>{g.inert=r(),A(g,`aria-hidden`,r()?!0:void 0)}),i(t,g),R()}var Sr=F(`<div class="text-muted-foreground mb-4 flex justify-center" aria-hidden="true"><!></div>`),Cr=F(`<p class="text-muted-foreground mt-6 max-h-24 overflow-y-auto font-mono text-[11px] leading-5 break-all select-all"> </p>`),wr=F(`<p class="text-destructive mt-4 text-sm" role="alert"> </p>`),Tr=F(`<p class="mt-4 text-sm text-amber-700" role="alert"> </p>`),Er=F(`<!> Open browser`,1),Dr=F(`<!> Copied`,1),Or=F(`<!> Copy link`,1),kr=F(`<!> <!>`,1),Ar=F(`<span class="text-muted-foreground border-border inline-flex h-10 items-center justify-center gap-2 rounded-full border px-4 text-sm">Preparing link…</span>`),jr=F(`<div class="app-entry-shell fixed inset-0 z-50 flex items-center justify-center px-6" role="presentation"><div class="border-border/70 bg-surface relative z-10 w-full max-w-md rounded-2xl border p-8 text-center shadow-[0_18px_50px_-28px_oklch(0.2_0.02_260/0.45)] outline-none" role="dialog" aria-modal="true" aria-labelledby="browser-signin-title" aria-describedby="browser-signin-desc" tabindex="-1"><!> <h2 id="browser-signin-title" class="font-brand text-foreground text-[1.35rem] font-semibold tracking-tight"> </h2> <p id="browser-signin-desc" class="text-muted-foreground mt-3 text-sm leading-[1.55]"> </p> <!> <!> <!> <div class="mt-6 flex flex-wrap items-center justify-center gap-3"><!></div> <div class="mt-6"><button type="button" class="text-muted-foreground hover:text-foreground decoration-foreground/30 hover:decoration-foreground text-[13px] underline underline-offset-4 transition-colors">Cancel</button></div></div></div>`);function Mr(t,n){H(n,!0);let r=P(n,`error`,3,null),l=g(!1),f=g(null),h=g(null),_=null;c(()=>{if(!n.open){C(l,!1),C(f,null);return}let e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=!1;d().then(()=>{t||o(h)?.focus()});function r(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n.onCancel();return}if(e.key!==`Tab`||!o(h))return;let t=Array.from(o(h).querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`)&&e.offsetParent!==null);if(t.length===0){e.preventDefault(),o(h).focus();return}let r=t[0],i=t[t.length-1],a=document.activeElement;e.shiftKey&&(a===o(h)||a===r||!o(h).contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===o(h)||a===i||!o(h).contains(a))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,r,!0),()=>{t=!0,window.removeEventListener(`keydown`,r,!0),_!==null&&(window.clearTimeout(_),_=null),e?.isConnected&&e.focus()}});async function v(){if(n.signInUrl)try{await navigator.clipboard.writeText(n.signInUrl),C(l,!0),C(f,null),_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{C(l,!1),_=null},2e3)}catch{C(l,!1),C(f,`Could not copy the sign-in link. Select it above and copy manually.`)}}function b(){if(!n.signInUrl)return;let e=window.open(n.signInUrl,`_blank`);if(e){try{e.opener=null}catch{}n.onClearOpenError?.()}}let S=e(()=>n.signInUrl?r()?{title:`Open the sign-in link`,description:`Your browser didn’t open automatically. Continue with the options below.`}:{title:`Finish signing in`,description:`We opened your browser to complete sign-in. Waiting for you to finish there.`}:{title:`Preparing sign-in`,description:`Preparing a secure sign-in link. This usually takes a moment.`});var w=m(),T=u(w),E=e=>{var t=jr(),c=s(t),d=s(c),g=e=>{var t=Sr();wn(s(t),{class:`size-5 animate-spin`}),B(t),i(e,t)};y(d,e=>{n.signInUrl||e(g)});var _=V(d,2),w=s(_,!0);B(_);var T=V(_,2),E=s(T,!0);B(T);var D=V(T,2),O=e=>{var t=Cr(),r=s(t,!0);B(t),x(()=>{A(t,`title`,n.signInUrl),a(r,n.signInUrl)}),i(e,t)};y(D,e=>{n.signInUrl&&e(O)});var k=V(D,2),ee=e=>{var t=wr(),n=s(t,!0);B(t),x(()=>a(n,r())),i(e,t)};y(k,e=>{r()&&e(ee)});var te=V(k,2),ne=e=>{var t=Tr(),n=s(t,!0);B(t),x(()=>a(n,o(f))),i(e,t)};y(te,e=>{o(f)&&e(ne)});var M=V(te,2),N=s(M),P=e=>{var t=kr(),n=u(t);gr(n,{onclick:b,children:(e,t)=>{var n=Er();Zt(u(n),{class:`size-4`,"aria-hidden":`true`}),j(),i(e,n)},$$slots:{default:!0}}),gr(V(n,2),{variant:`outline`,onclick:()=>void v(),children:(e,t)=>{var n=m(),r=u(n),a=e=>{var t=Dr();Dt(u(t),{class:`size-4`,"aria-hidden":`true`}),j(),i(e,t)},s=e=>{var t=Or();Vt(u(t),{class:`size-4`,"aria-hidden":`true`}),j(),i(e,t)};y(r,e=>{o(l)?e(a):e(s,-1)}),i(e,n)},$$slots:{default:!0}}),i(e,t)},re=e=>{var t=Ar();i(e,t)};y(N,e=>{n.signInUrl?e(P):e(re,-1)}),B(M);var F=V(M,2),ie=s(F);B(F),B(c),ce(c,e=>C(h,e),()=>o(h)),B(t),x(()=>{a(w,o(S).title),a(E,o(S).description)}),p(`click`,t,e=>{e.target===e.currentTarget&&n.onCancel()}),p(`click`,ie,function(...e){n.onCancel?.apply(this,e)}),i(e,t)};y(T,e=>{n.open&&e(E)}),i(t,w),R()}f([`click`]);function Nr(){let e=g(null),t=g(!1),n=null;function r(){n&&=(clearTimeout(n),null)}function i(i,a,o=!1){let s=i.currentTarget;if(!(s instanceof HTMLElement))return;let c=s.getBoundingClientRect();r(),C(t,o,!0),C(e,{top:c.top-8,left:c.left+c.width/2,label:a},!0),o&&(n=setTimeout(()=>{C(t,!1),n=null,C(e,null)},2500))}function a(n=!1){o(t)&&!n||(r(),C(t,!1),C(e,null))}return c(()=>r),{get lockTooltip(){return o(e)},showLockTooltip:i,hideLockTooltip:a}}function Pr(e){function t(t){let n=t.target;n instanceof Node&&(e.getRoot()?.contains(n)||e.onOutside())}function n(t){t.key===`Escape`&&e.onEscape()}return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}}var Fr=F(`<div class="text-tooltip-foreground bg-tooltip ring-border pointer-events-none fixed z-100 -translate-x-1/2 -translate-y-full rounded-md px-2.5 py-1.5 text-[12px] leading-4 whitespace-nowrap shadow-lg ring-1" role="tooltip"> </div>`);function Ir(e,t){H(t,!0);var n=m(),r=u(n),o=e=>{var n=Fr(),r=s(n,!0);B(n),x(()=>{z(n,`top: ${t.tooltip.top}px; left: ${t.tooltip.left}px;`),a(r,t.tooltip.label)}),i(e,n)};y(r,e=>{t.tooltip&&e(o)}),i(e,n),R()}var Lr=F(`<label class="text-muted-foreground flex h-10 items-center gap-2 border-b border-[var(--hairline)] px-2"><!> <span class="sr-only"> </span> <input class="text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none"/></label>`),Rr=F(`<p class="text-muted-foreground px-3 pt-1 pb-2 text-[11px] font-medium"> </p>`),zr=F(`<span><!></span>`),Br=F(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Vr=F(`<button type="button"><!> <span> </span> <!></button>`),Hr=F(`<p class="text-muted-foreground px-3 py-5 text-center text-sm">No matches found</p>`),Ur=F(`<div class="bg-popover/96 absolute bottom-[calc(100%+0.75rem)] left-0 z-50 min-w-[19rem] rounded-[18px] border border-[var(--hairline)] p-2 shadow-[var(--composer-shadow)] backdrop-blur-xl" role="dialog"><!> <div><!> <!></div></div>`),Wr=F(`<div><button type="button" aria-haspopup="dialog"><!> <span class="truncate"> </span> <!></button> <!></div> <!>`,1);function Gr(t,n){H(n,!0);let r=P(n,`value`,15,``),l=P(n,`disabled`,3,!1),d=P(n,`className`,3,``),f=P(n,`triggerClassName`,3,``),_=P(n,`searchable`,3,!1),b=g(!1),S=g(``),w=g(null),T=g(null),E=g(null),D=Nr(),O=e(()=>{let e=n.options.find(e=>e.id===r());return e&&!e.locked?e:n.options.find(e=>!e.locked)??e??n.options[0]??null}),te=e(()=>_()&&o(S).trim()?n.options.filter(e=>e.label.toLocaleLowerCase().includes(o(S).trim().toLocaleLowerCase())):n.options),ne=e(()=>o(te).filter(e=>!e.locked));function j(){l()||(C(b,!o(b)),o(b)&&_()?queueMicrotask(()=>o(E)?.focus()):C(S,``))}function N(e,t){let i=n.options.find(t=>t.id===e);if(i){if(i.locked){t&&i.lockTooltip&&D.showLockTooltip(t,i.lockTooltip,!0);return}e!==r()&&(r(e),n.onValueChange?.(e)),C(b,!1),C(S,``),D.hideLockTooltip(!0),o(T)?.focus()}}function re(e){e.key===`Enter`&&o(ne).length!==0&&(e.preventDefault(),N(o(ne)[0].id))}c(()=>{if(!o(b)){C(S,``),D.hideLockTooltip();return}return Pr({getRoot:()=>o(w),onOutside:()=>{C(b,!1)},onEscape:()=>{C(b,!1),o(T)?.focus()}})}),c(()=>{l()&&C(b,!1)});var F=Wr(),ie=u(F),ae=s(ie),oe=s(ae),se=e=>{var t=m(),r=u(t);k(r,()=>n.optionIcon,()=>o(O)),i(e,t)};y(oe,e=>{n.optionIcon&&o(O)&&e(se)});var L=V(oe,2),z=s(L,!0);B(L);var le=V(L,2);{let t=e(()=>J(`text-muted-foreground size-3 shrink-0 transition-transform`,o(b)&&`rotate-180`));kt(le,{get class(){return o(t)}})}B(ae),ce(ae,e=>C(T,e),()=>o(T));var de=V(ae,2),U=t=>{var c=Ur(),l=s(c),u=e=>{var t=Lr(),r=s(t);Rn(r,{class:`size-4 shrink-0`});var c=V(r,2),l=s(c);B(c);var u=V(c,2);ue(u),ce(u,e=>C(E,e),()=>o(E)),B(t),x((e,t)=>{a(l,`Search ${e??``}`),A(u,`placeholder`,t)},[()=>n.menuTitle.toLocaleLowerCase(),()=>`Search ${n.menuTitle.toLocaleLowerCase()}…`]),p(`keydown`,u,re),ee(u,()=>o(S),e=>C(S,e)),i(e,t)},d=e=>{var t=Rr(),r=s(t,!0);B(t),x(()=>a(r,n.menuTitle)),i(e,t)};y(l,e=>{_()?e(u):e(d,-1)});var f=V(l,2),m=s(f);v(m,17,()=>o(te),e=>e.id,(t,c)=>{let l=e(()=>!!o(c).locked);var u=Vr(),d=s(u),f=e=>{var t=zr(),r=s(t);k(r,()=>n.optionIcon,()=>o(c)),B(t),x(e=>I(t,1,e),[()=>M(J(`flex size-7 shrink-0 items-center justify-center`,(o(l),`text-muted-foreground`)))]),i(e,t)};y(d,e=>{n.optionIcon&&e(f)});var m=V(d,2),g=s(m,!0);B(m);var _=V(m,2),v=e=>{var t=Br();En(s(t),{class:`size-3.5`}),B(t),i(e,t)},b=t=>{{let n=e(()=>J(`text-accent-strong size-4 shrink-0 transition-opacity`,o(c).id===r()?`opacity-100`:`opacity-0`));Dt(t,{get class(){return o(n)}})}};y(_,e=>{o(l)?e(v):e(b,-1)}),B(u),x((e,t)=>{I(u,1,e),A(u,`aria-pressed`,!o(l)&&o(c).id===r()),A(u,`aria-disabled`,o(l)),A(u,`aria-label`,o(l)&&o(c).lockTooltip?`${o(c).label}. ${o(c).lockTooltip}`:void 0),I(m,1,t),a(g,o(c).label)},[()=>M(J(`focus-visible:ring-ring/60 flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left outline-none focus-visible:ring-2`,o(l)?`cursor-not-allowed opacity-45`:`hover:bg-hover-fill`,!o(l)&&o(c).id===r()&&`bg-hover-fill`)),()=>M(J(`min-w-0 flex-1 truncate text-sm font-medium`,o(l)?`text-muted-foreground`:`text-foreground`))]),h(`mouseenter`,u,e=>{o(l)&&o(c).lockTooltip&&D.showLockTooltip(e,o(c).lockTooltip)}),h(`mouseleave`,u,()=>D.hideLockTooltip()),h(`focus`,u,e=>{o(l)&&o(c).lockTooltip&&D.showLockTooltip(e,o(c).lockTooltip)}),h(`blur`,u,()=>D.hideLockTooltip()),p(`click`,u,e=>{N(o(c).id,e)}),i(t,u)});var g=V(m,2),b=e=>{var t=Hr();i(e,t)};y(g,e=>{o(te).length===0&&e(b)}),B(f),B(c),x(e=>{A(c,`aria-label`,n.menuTitle),I(f,1,e)},[()=>M(J(`space-y-0.5`,_()&&`pt-1.5`))]),i(t,c)};y(de,e=>{o(b)&&e(U)}),B(ie),ce(ie,e=>C(w,e),()=>o(w)),Ir(V(ie,2),{get tooltip(){return D.lockTooltip}}),x((e,t)=>{I(ie,1,e),I(ae,1,t),A(ae,`aria-expanded`,o(b)),A(ae,`aria-label`,n.ariaLabel),ae.disabled=l(),a(z,o(O)?.triggerLabel??o(O)?.label??r())},[()=>M(J(`relative`,d())),()=>M(J(`focus-visible:ring-ring/60 text-muted-foreground hover:bg-hover-fill inline-flex h-8 shrink-0 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-sm font-medium transition outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50`,!n.optionIcon&&`gap-1`,f()))]),p(`click`,ae,j),i(t,F),R()}f([`click`,`keydown`]);var Kr=t(`<title> </title>`),qr=t(`<svg viewBox="146.694 227.042 267.198 264.812" xmlns="http://www.w3.org/2000/svg" role="img" fill="none"><!><path d="M249.176 323.434V298.276C249.176 296.158 249.971 294.569 251.825 293.509L302.406 264.381C309.29 260.409 317.5 258.555 325.973 258.555C357.75 258.555 377.877 283.185 377.877 309.399C377.877 311.253 377.877 313.371 377.611 315.49L325.178 284.771C322.001 282.919 318.822 282.919 315.645 284.771L249.176 323.434ZM367.283 421.415V361.301C367.283 357.592 365.694 354.945 362.516 353.092L296.048 314.43L317.763 301.982C319.617 300.925 321.206 300.925 323.058 301.982L373.639 331.112C388.205 339.586 398.003 357.592 398.003 375.069C398.003 395.195 386.087 413.733 367.283 421.412V421.415ZM233.553 368.452L211.838 355.742C209.986 354.684 209.19 353.095 209.19 350.975V292.718C209.19 264.383 230.905 242.932 260.301 242.932C271.423 242.932 281.748 246.641 290.49 253.26L238.321 283.449C235.146 285.303 233.555 287.951 233.555 291.659V368.455L233.553 368.452ZM280.292 395.462L249.176 377.985V340.913L280.292 323.436L311.407 340.913V377.985L280.292 395.462ZM300.286 475.968C289.163 475.968 278.837 472.259 270.097 465.64L322.264 435.449C325.441 433.597 327.03 430.949 327.03 427.239V350.445L349.011 363.155C350.865 364.213 351.66 365.802 351.66 367.922V426.179C351.66 454.514 329.679 475.965 300.286 475.965V475.968ZM237.525 416.915L186.944 387.785C172.378 379.31 162.582 361.305 162.582 343.827C162.582 323.436 174.763 305.164 193.563 297.485V357.861C193.563 361.571 195.154 364.217 198.33 366.071L264.535 404.467L242.82 416.915C240.967 417.972 239.377 417.972 237.525 416.915ZM234.614 460.343C204.689 460.343 182.71 437.833 182.71 410.028C182.71 407.91 182.976 405.792 183.238 403.672L235.405 433.863C238.582 435.715 241.763 435.715 244.938 433.863L311.407 395.466V420.622C311.407 422.742 310.612 424.331 308.758 425.389L258.179 454.519C251.293 458.491 243.083 460.343 234.611 460.343H234.614ZM300.286 491.854C332.329 491.854 359.073 469.082 365.167 438.892C394.825 431.211 413.892 403.406 413.892 375.073C413.892 356.535 405.948 338.529 391.648 325.552C392.972 319.991 393.766 314.43 393.766 308.87C393.766 271.003 363.048 242.666 327.562 242.666C320.413 242.666 313.528 243.723 306.644 246.109C294.725 234.457 278.307 227.042 260.301 227.042C228.258 227.042 201.513 249.815 195.42 280.004C165.761 287.685 146.694 315.49 146.694 343.824C146.694 362.362 154.638 380.368 168.938 393.344C167.613 398.906 166.819 404.467 166.819 410.027C166.819 447.894 197.538 476.231 233.024 476.231C240.172 476.231 247.058 475.173 253.943 472.788C265.859 484.441 282.278 491.854 300.286 491.854Z" fill="currentColor"></path></svg>`);function Jr(e,t){H(t,!0);let n=P(t,`className`,3,``),r=P(t,`title`,3,`OpenAI`);var o=qr(),c=s(o),l=e=>{var t=Kr(),n=s(t,!0);B(t),x(()=>a(n,r())),i(e,t)};y(c,e=>{r()&&e(l)}),j(),B(o),x(e=>{I(o,0,e),A(o,`aria-hidden`,!r()||void 0)},[()=>M(J(`size-4`,n()))]),i(e,o),R()}var Yr=t(`<svg viewBox="0 0 24 24" role="img" aria-label="Anthropic" fill="currentColor"><path d="M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223 2.291-5.945 2.292 5.945Z"></path></svg>`),Xr=t(`<svg viewBox="0 0 24 24" role="img" aria-label="Z.AI" fill="currentColor"><path d="M12.606 1.806l-1.677 2.388c-0.258 0.374-0.697 0.606-1.161 0.606h-9.162V1.794C0.594 1.806 12.606 1.806 12.606 1.806zM24 1.806L9.6 22.206 0 22.206 14.4 1.806zM11.394 22.206l1.69-2.4c0.258-0.374 0.697-0.606 1.161-0.606h9.149v3.006H11.394z"></path></svg>`),Zr=t(`<svg viewBox="0 0 24 24" role="img" aria-label="DeepSeek" fill="currentColor"><path d="M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45"></path></svg>`),Qr=t(`<svg viewBox="0 0 465 465" role="img" aria-label="Moonshot AI" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M418.766 93.78C388.626 53.17 345.086 22.07 292.446 7.97C239.806 -6.13 186.536 -0.97 140.136 19.13L418.766 93.78ZM40.7758 100.85C61.3758 70.84 88.5858 46.43 119.776 29.15L325.036 84.15C311.566 91.92 297.136 105.31 285.966 120.03L454.736 165.25C459.526 181.08 462.646 197.49 463.956 214.24L40.7758 100.85ZM456.686 292.45C454.306 301.35 451.436 309.99 448.116 318.34L2.44584 198.93C3.74584 190.03 5.58584 181.12 7.96584 172.22C13.5658 151.31 21.8458 131.84 32.3458 114.08L250.436 172.52C241.706 185 233.756 198.56 226.756 213.07L460.516 275.71C459.446 281.3 458.166 286.88 456.676 292.47L456.686 292.45ZM13.4858 310.23C2.67584 279.96 -1.93416 247.22 0.745843 213.95L206.426 269.06C204.946 273.74 203.556 278.48 202.266 283.29C199.646 293.08 197.506 302.85 195.846 312.55L417.946 372.06C407.606 385.79 395.826 398.23 382.896 409.21L13.4858 310.23ZM172.206 456.69C102.096 437.9 48.1158 388.98 20.4758 327.59L187.846 372.44C187.576 388.05 188.546 403.26 190.676 417.85L312.286 450.43C268.876 466.39 220.286 469.57 172.206 456.69Z"></path></svg>`),$r=t(`<svg viewBox="0 0 24 24" role="img" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="9"></circle><path d="M12 8v4l2.5 1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);function ei(t,n){H(n,!0);let r=P(n,`className`,3,``);var a=m(),s=u(a),c=t=>{{let n=e(()=>J(`size-4 text-foreground`,r()));Jr(t,{get className(){return o(n)}})}},l=e=>{var t=Yr();x(e=>I(t,0,e),[()=>M(J(`size-4 text-[#D97757]`,r()))]),i(e,t)},d=e=>{var t=Xr();x(e=>I(t,0,e),[()=>M(J(`text-foreground size-4`,r()))]),i(e,t)},f=e=>{var t=Zr();x(e=>I(t,0,e),[()=>M(J(`size-4 text-[#4D6BFE]`,r()))]),i(e,t)},p=e=>{var t=Qr();x(e=>I(t,0,e),[()=>M(J(`text-foreground size-4`,r()))]),i(e,t)},h=e=>{var t=$r();x(e=>{I(t,0,e),A(t,`aria-label`,n.provider||`Unknown provider`)},[()=>M(J(`text-muted-foreground size-4`,r()))]),i(e,t)};y(s,e=>{n.provider===`openai`?e(c):n.provider===`anthropic`?e(l,1):n.provider===`zai`?e(d,2):n.provider===`deepseek`?e(f,3):n.provider===`kimi`?e(p,4):e(h,-1)}),i(t,a),R()}var ti=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],ni=[`standard`,`fast`],ri=`deepseek-v4-pro-0813`,ii=`standard`,ai={"stealth/ox-alpha":`deepseek-v4-pro-0813`,"gpt-5.6-terra":`gpt-5.6-sol`,"gpt-5.6-luna":`gpt-5.6-sol`,"grok-4.5":`gpt-5.6-sol`,"deepseek-v4-pro":`deepseek-v4-pro-0813`,"deepseek-v4-flash":`deepseek-v4-flash-0731`};function oi(e){return ti.some(t=>t===e)}function si(e){return ni.some(t=>t===e)}function ci(e){for(let[t,n]of Object.entries(ai))if(t===e)return n}function li(e){return ci(e)??e}function ui(e,t){return{modelId:li(e),serviceTier:si(t)?t:ii}}function di(e,t){return oi(t)?t:`max`}var fi=`/api`,pi=`Model catalog is unavailable.`;function mi(e,t){return e.models.find(e=>e.id===t)}function hi(e,t,n){return(e.tierAllowedModels[t]??[]).includes(n)}function gi(e,t,n){return hi(e,t,n)?n:e.tierAllowedModels[t]?.[0]??e.defaultModelId}function _i(e,t,n){return(e.tierAllowedServiceTiers[t]??[]).includes(n)}function vi(e,t,n){return n.serviceTiers.filter(n=>_i(e,t,n))}function yi(e,t,n){return n.serviceTiers.map(n=>{let r={id:n,label:Si(n)};return _i(e,t,n)?r:{...r,locked:!0,lockTooltip:e.serviceTierLockUpgradeMessage}})}function bi(e,t){let n=[],r=[];for(let i of e.models){let a={id:i.id,label:i.label,provider:i.provider};hi(e,t,i.id)?n.push(a):r.push({...a,locked:!0,lockTooltip:e.modelLockUpgradeMessage})}return[...n,...r]}function xi(e){switch(e){case`none`:return`None`;case`low`:return`Low`;case`medium`:return`Medium`;case`high`:return`High`;case`xhigh`:return`Extra High`;case`max`:return`Max`;default:return e}}function Si(e){switch(e){case`standard`:return`Standard`;case`fast`:return`Fast`;default:return e}}var Ci=ke({id:Ee().min(1),label:Ee().min(1),provider:Ee().min(1),supportsImages:Oe(),contextWindowTokens:K().finite(),autoCompactTokenLimit:K().finite(),reasoningEfforts:De(Ee()).min(1),defaultReasoningEffort:Ee().min(1),serviceTiers:De(Ee()).min(1),usagePolicy:Te(`unlimited`).optional()}).passthrough(),wi=ke({sprocket:ke({protocolVersion:K().finite(),catalogVersion:Ee().min(1),defaultModelId:Ee().min(1),defaultReasoningEffort:Ee().min(1),defaultServiceTier:Ee().min(1),models:De(Ci).min(1),tierAllowedModels:ke({free:De(Ee()),pro:De(Ee()),admin:De(Ee())}),tierAllowedServiceTiers:ke({free:De(Ee()),pro:De(Ee()),admin:De(Ee())}),modelLockUpgradeMessage:Ee().min(1),serviceTierLockUpgradeMessage:Ee().min(1)})});function Ti(e){let t=e.sprocket;if(t.protocolVersion!==1)throw Error(`${pi} Unsupported protocol version ${t.protocolVersion}.`);return{protocolVersion:t.protocolVersion,catalogVersion:t.catalogVersion,defaultModelId:t.defaultModelId,defaultReasoningEffort:t.defaultReasoningEffort,defaultServiceTier:t.defaultServiceTier,models:t.models.map(e=>({id:e.id,label:e.label,provider:e.provider,supportsImages:e.supportsImages,contextWindowTokens:e.contextWindowTokens,autoCompactTokenLimit:e.autoCompactTokenLimit,reasoningEfforts:e.reasoningEfforts,defaultReasoningEffort:e.defaultReasoningEffort,serviceTiers:e.serviceTiers,usagePolicy:e.usagePolicy})),tierAllowedModels:t.tierAllowedModels,tierAllowedServiceTiers:t.tierAllowedServiceTiers,modelLockUpgradeMessage:t.modelLockUpgradeMessage,serviceTierLockUpgradeMessage:t.serviceTierLockUpgradeMessage}}async function Ei(e){let t=e.replace(/\/+$/,``);if(!t)throw Error(pi);let n=await fetch(`${t}${fi}/v1/models`,{headers:{accept:`application/json`}});if(!n.ok)throw Error(pi);let r=wi.safeParse(await n.json());if(!r.success)throw Error(pi);return Ti(r.data)}var Di=F(`<span class="text-muted-foreground ml-auto text-xs">Default</span>`),Oi=F(`<button type="button" class="focus-visible:ring-ring/60 text-foreground hover:bg-hover-fill flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm outline-none focus-visible:ring-2"><!> <span> </span> <!></button>`),ki=F(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Ai=F(`<button type="button"><!> <!> <span> </span> <!></button>`),ji=F(`<div class="bg-popover/96 absolute bottom-[calc(100%+0.75rem)] left-0 z-50 min-w-[15rem] rounded-[18px] border border-[var(--hairline)] p-2 shadow-[var(--composer-shadow)] backdrop-blur-xl" role="dialog" aria-label="Reasoning and service tier"><p class="text-muted-foreground px-3 pt-1 pb-1.5 text-[11px] font-medium">Reasoning</p> <div class="space-y-0.5"></div> <div class="mx-2 my-2 h-px bg-[var(--hairline)]"></div> <p class="text-muted-foreground px-3 pb-1.5 text-[11px] font-medium">Service tier</p> <div class="space-y-0.5"></div></div>`),Mi=F(`<div><button type="button" class="focus-visible:ring-ring/60 text-muted-foreground hover:bg-hover-fill inline-flex h-9 shrink-0 items-center gap-1 rounded-lg px-2 text-[15px] transition outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50" aria-haspopup="dialog" aria-label="Select reasoning effort and service tier"><span> </span> <!></button> <!></div> <!>`,1);function Ni(t,n){H(n,!0);let r=P(n,`reasoningEffort`,31,()=>l(`max`)),d=P(n,`serviceTier`,31,()=>l(ii)),f=P(n,`disabled`,3,!1),m=P(n,`className`,3,``),_=e(()=>n.serviceTierOptions?n.serviceTierOptions:n.model.serviceTiers.map(e=>({id:e,label:Si(e)}))),b=e(()=>o(_).filter(e=>!e.locked).map(e=>e.id)),S=g(!1),w=g(null),T=g(null),E=Nr();function D(e){r(e)}function O(e,t){let n=o(_).find(t=>t.id===e);if(n){if(n.locked){t&&n.lockTooltip&&E.showLockTooltip(t,n.lockTooltip,!0);return}d(e)}}c(()=>{n.model.reasoningEfforts.includes(r())||r(n.model.defaultReasoningEffort),o(b).includes(d())||d(o(b)[0]??`standard`)}),c(()=>{if(!o(S)){E.hideLockTooltip();return}return Pr({getRoot:()=>o(w),onOutside:()=>{C(S,!1)},onEscape:()=>{C(S,!1),o(T)?.focus()}})}),c(()=>{f()&&C(S,!1)});var k=Mi(),ee=u(k),te=s(ee),ne=s(te),j=s(ne);B(ne);var N=V(ne,2);{let t=e(()=>J(`text-muted-foreground size-3 shrink-0 transition-transform`,o(S)&&`rotate-180`));kt(N,{get class(){return o(t)}})}B(te),ce(te,e=>C(T,e),()=>o(T));var re=V(te,2),F=t=>{var c=ji(),l=V(s(c),2);v(l,20,()=>n.model.reasoningEfforts,e=>e,(t,c)=>{var l=Oi(),u=s(l);{let t=e(()=>J(`size-4 shrink-0 transition-opacity`,c===r()?`opacity-100`:`opacity-0`));Dt(u,{get class(){return o(t)}})}var d=V(u,2),f=s(d,!0);B(d);var m=V(d,2),h=e=>{var t=Di();i(e,t)};y(m,e=>{c===n.model.defaultReasoningEffort&&e(h)}),B(l),x(e=>{A(l,`aria-pressed`,c===r()),a(f,e)},[()=>xi(c)]),p(`click`,l,()=>D(c)),i(t,l)}),B(l);var u=V(l,6);v(u,21,()=>o(_),e=>e.id,(t,n)=>{let r=e(()=>!!o(n).locked);var c=Ai(),l=s(c),u=e=>{var t=ki();En(s(t),{class:`size-3.5`}),B(t),i(e,t)},f=t=>{{let r=e(()=>J(`size-4 shrink-0 transition-opacity`,o(n).id===d()?`opacity-100`:`opacity-0`));Dt(t,{get class(){return o(r)}})}};y(l,e=>{o(r)?e(u):e(f,-1)});var m=V(l,2),g=e=>{cr(e,{class:`size-3.5 shrink-0 text-amber-400`})};y(m,e=>{o(n).id===`fast`&&e(g)});var _=V(m,2),v=s(_,!0);B(_);var S=V(_,2),C=e=>{var t=Di();i(e,t)};y(S,e=>{!o(r)&&o(n).id===o(b)[0]&&e(C)}),B(c),x((e,t)=>{I(c,1,e),A(c,`aria-pressed`,!o(r)&&o(n).id===d()),A(c,`aria-disabled`,o(r)),A(c,`aria-label`,o(r)&&o(n).lockTooltip?`${o(n).label}. ${o(n).lockTooltip}`:void 0),I(_,1,t),a(v,o(n).label)},[()=>M(J(`focus-visible:ring-ring/60 flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm outline-none focus-visible:ring-2`,o(r)?`cursor-not-allowed opacity-45`:`text-foreground hover:bg-hover-fill`)),()=>M(J(o(r)&&`text-muted-foreground`))]),h(`mouseenter`,c,e=>{o(r)&&o(n).lockTooltip&&E.showLockTooltip(e,o(n).lockTooltip)}),h(`mouseleave`,c,()=>E.hideLockTooltip()),h(`focus`,c,e=>{o(r)&&o(n).lockTooltip&&E.showLockTooltip(e,o(n).lockTooltip)}),h(`blur`,c,()=>E.hideLockTooltip()),p(`click`,c,e=>O(o(n).id,e)),i(t,c)}),B(u),B(c),i(t,c)};y(re,e=>{o(S)&&e(F)}),B(ee),ce(ee,e=>C(w,e),()=>o(w)),Ir(V(ee,2),{get tooltip(){return E.lockTooltip}}),x((e,t,n)=>{I(ee,1,e),A(te,`aria-expanded`,o(S)),te.disabled=f(),a(j,`${t??``} · ${n??``}`)},[()=>M(J(`relative`,m())),()=>xi(r()),()=>Si(d())]),p(`click`,te,()=>{C(S,!o(S))}),i(t,k),R()}f([`click`]);function Pi(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}var Fi=/(^|\s)\$([a-z0-9-]*)$/i;function Ii(e,t){if(t<0||t>e.length)return null;let n=e.slice(0,t).match(Fi);return!n||n.index===void 0?null:{query:n[2].toLowerCase(),tokenStart:n.index+n[1].length}}function Li(e,t){return Ii(e,t)?.query??null}function Ri(e,t){let n=t.toLowerCase(),r=[],i=[];for(let t of e){let e=t.name.toLowerCase();e.startsWith(n)?r.push(t):n.length>0&&e.includes(n)&&i.push(t)}return r.sort((e,t)=>e.name.localeCompare(t.name)),i.sort((e,t)=>e.name.localeCompare(t.name)),[...r,...i]}function zi(e,t,n){let r=Ii(e,t);if(!r)return null;let i=t;for(;i<e.length&&/[a-z0-9-]/i.test(e[i]??``);)i+=1;e[i]===` `&&(i+=1);let a=`$${n} `;return{text:`${e.slice(0,r.tokenStart)}${a}${e.slice(i)}`,caret:r.tokenStart+a.length}}function Bi(e){let t=Math.floor(e/60),n=e%60;return t===0?`${n}s`:`${t}m ${n}s`}function Vi(e){let t=Math.max(0,e),n=Math.ceil(t/36e5);if(n>=24){let e=Math.floor(n/24),t=n%24;return t>0?`${e}d ${t}h`:`${e}d`}return t>=36e5?`${n}h`:`${Math.max(1,Math.ceil(t/6e4))}m`}function Hi(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:`${n}d`:r>0?i>0?`${r}h ${i}m`:`${r}h`:i>0?`${i}m ${a}s`:`${a}s`}var Ui=`agent_decide`;function Wi(e){return!!e.selectedOptionId?.trim()||!!e.text.trim()}function Gi(e){return Object.prototype.toString.call(e)===`[object String]`&&!(e instanceof String)}function Ki(e){return Object.prototype.toString.call(e)===`[object Boolean]`&&!(e instanceof Boolean)}function qi(e){return e!=null&&!Array.isArray(e)&&Object(e)===e}var Ji=Z.union(Z.string(),Z.number(),Z.boolean(),Z.null()),Yi=8;function Xi(e){return e===0?Ji:Z.union(Ji,Z.array(Xi(e-1)),Z.record(Z.string(),Xi(e-1)))}var Zi=Xi(Yi),Qi=[`free`,`pro`,`admin`],$i={free:`Free`,pro:`Pro`,admin:`Admin`},ea={modelUsage:{weekly:5e3,monthly:15e3}};ea.modelUsage.weekly*5,ea.modelUsage.monthly*5;function ta(e){return e.map(e=>Z.literal(e))}Z.union(...ta(ti)),Z.union(...ta(ni)),Z.union(...ta(Qi)),Z.union(Z.literal(`active`),Z.literal(`on_hold`),Z.literal(`cancelled`),Z.literal(`expired`),Z.literal(`failed`));var na=Z.object({path:Z.string(),directory:Z.string(),contents:Z.string(),truncated:Z.boolean()}),ra=Z.object({patch:Z.string()}),ia=Z.object({cmd:Z.string(),workdir:Z.optional(Z.string()),shell:Z.optional(Z.string()),timeoutMs:Z.optional(Z.number()),yieldTimeMs:Z.optional(Z.number()),maxOutputChars:Z.optional(Z.number())}),aa=Z.object({url:Z.string()}),oa=Z.object({query:Z.string(),numResults:Z.optional(Z.number())}),sa=Z.object({sessionId:Z.string(),chars:Z.optional(Z.string()),terminate:Z.optional(Z.boolean()),yieldTimeMs:Z.optional(Z.number())}),ca=Z.union(Z.literal(`markdown`),Z.literal(`html`),Z.literal(`react`)),la=Z.object({title:Z.string(),contentType:ca,content:Z.string()}),ua=Z.object({artifactId:Z.string(),content:Z.string()}),da=Z.object({name:Z.string()}),fa=Z.object({instruction:Z.optional(Z.string()),action:Z.optional(Z.object({selector:Z.string(),description:Z.string(),method:Z.optional(Z.string()),arguments:Z.optional(Z.array(Z.string()))})),startUrl:Z.optional(Z.string())}),pa=Z.union(...ta([`one_time`,`weekly`,`monthly`,`yearly`])),ma=Z.union(Z.literal(`listed`),Z.literal(`any`)),ha=Z.union(...ta([`pending`,`active`,`paused`,`consumed`,`cancelled`,`expired`]));Z.union(Z.literal(`awaiting_result`),Z.literal(`completed`),Z.literal(`declined`),Z.literal(`failed`));var ga=Z.union(Z.literal(`approved`),Z.literal(`declined`)),_a=Z.object({userEmail:Z.optional(Z.string()),merchantName:Z.optional(Z.string()),merchantUrl:Z.optional(Z.string()),countryCode:Z.optional(Z.string()),amountCap:Z.string(),currency:Z.string(),frequency:pa,scope:ma,description:Z.string(),maxCharges:Z.optional(Z.number()),validUntil:Z.optional(Z.string())}),va=Z.object({mandateId:Z.string()}),ya=Z.object({mandateId:Z.string(),amount:Z.string(),currency:Z.string(),description:Z.string(),reference:Z.optional(Z.string())}),ba=Z.object({chargeId:Z.string(),outcome:ga,amountPaid:Z.optional(Z.string())}),xa=Z.object({id:Z.string(),label:Z.string()}),Sa=Z.object({question:Z.string(),options:Z.array(xa),yieldTimeMs:Z.optional(Z.number()),timeoutMs:Z.optional(Z.number())}),Ca=Z.object({questionId:Z.id(`agentQuestions`),yieldTimeMs:Z.optional(Z.number())});Z.union(Z.object({}),ra,Sa,Ca,ia,da,aa,oa,sa,la,ua,fa,_a,va,ya,ba);var wa=Z.object({changes:Z.array(Z.object({path:Z.string(),operation:Z.union(Z.literal(`created`),Z.literal(`updated`),Z.literal(`deleted`),Z.literal(`renamed`),Z.literal(`copied`))}))}),Ta=Z.object({command:Z.string(),cwd:Z.string(),sessionId:Z.optional(Z.string()),exitCode:Z.optional(Z.number()),success:Z.boolean(),running:Z.boolean(),timedOut:Z.boolean(),stdout:Z.string(),stderr:Z.string(),output:Z.string(),truncated:Z.boolean(),error:Z.optional(Z.string())}),Ea=Z.object({url:Z.string(),markdown:Z.string(),truncated:Z.boolean()}),Da=Z.object({results:Z.array(Z.object({title:Z.optional(Z.string()),url:Z.string(),publishedDate:Z.optional(Z.string()),author:Z.optional(Z.string()),text:Z.optional(Z.string())}))}),Oa=Z.object({mandateId:Z.id(`mandates`),approvalUrl:Z.string(),expiresAt:Z.string()}),ka=Z.object({mandateId:Z.id(`mandates`),pravaMandateId:Z.optional(Z.string()),status:ha,description:Z.optional(Z.string()),merchantName:Z.optional(Z.string()),amountCap:Z.string(),remaining:Z.optional(Z.string()),currency:Z.string(),frequency:pa,scope:ma,approvalUrl:Z.optional(Z.string()),validUntil:Z.optional(Z.string()),renewsAt:Z.optional(Z.string())}),Aa=Z.object({mandates:Z.array(Z.object({mandateId:Z.optional(Z.id(`mandates`)),pravaMandateId:Z.string(),status:Z.string(),description:Z.optional(Z.string()),merchantName:Z.optional(Z.string()),approvedAmount:Z.string(),remaining:Z.optional(Z.string()),currency:Z.string(),validUntil:Z.optional(Z.string()),renewsAt:Z.optional(Z.string())}))}),ja=Z.object({chargeId:Z.id(`mandateCharges`),transactionId:Z.string(),token:Z.optional(Z.string()),dynamicCvv:Z.optional(Z.string()),expiryMonth:Z.optional(Z.string()),expiryYear:Z.optional(Z.string())}),Ma=Z.object({reported:Z.boolean(),alreadyReported:Z.optional(Z.boolean()),inFlight:Z.optional(Z.boolean())}),Na=Z.object({text:Z.string(),truncated:Z.boolean()}),Pa=Z.object({selector:Z.string(),description:Z.string(),method:Z.optional(Z.string()),arguments:Z.optional(Z.array(Z.string()))}),Fa=Z.object({actions:Z.array(Pa),text:Z.string(),truncated:Z.boolean()}),Ia=Z.object({name:Z.string(),description:Z.string(),content:Z.string(),dir:Z.optional(Z.string()),truncated:Z.optional(Z.boolean())}),La=Z.object({optionId:Z.optional(Z.string()),optionLabel:Z.optional(Z.string()),text:Z.optional(Z.string())}),Ra=Z.object({questionId:Z.id(`agentQuestions`),question:Z.string(),options:Z.array(xa),pending:Z.boolean(),timedOut:Z.boolean(),answer:Z.optional(La)}),za=Z.object({artifactId:Z.string(),version:Z.number(),title:Z.optional(Z.string()),contentType:Z.optional(ca)});Z.union(Z.string(),Z.array(na),wa,Ra,Ta,Ia,Ea,Da,za,Na,Fa,Oa,ka,Aa,ja,Ma),Z.union(Z.literal(`queued`),Z.literal(`running`),Z.literal(`awaiting_executor`),Z.literal(`completed`),Z.literal(`failed`),Z.literal(`cancelled`));var Ba=[`cancelled`,`completed`,`failed`];Z.union(...ta(Ba));function Va(e){return Ba.some(t=>t===e)}Z.union(Z.literal(`apply_patch`),Z.literal(`ask_question`),Z.literal(`await_question`),Z.literal(`browser_observe`),Z.literal(`browser_act`),Z.literal(`browser_extract`),Z.literal(`exec_command`),Z.literal(`get_workspace_instructions`),Z.literal(`mandate_setup`),Z.literal(`mandate_status`),Z.literal(`mandate_list`),Z.literal(`mandate_charge`),Z.literal(`mandate_report`),Z.literal(`read_skill`),Z.literal(`scrape_url`),Z.literal(`web_search`),Z.literal(`write_stdin`),Z.literal(`create_artifact`),Z.literal(`update_artifact`)),Z.union(Z.literal(`pending`),Z.literal(`answered`),Z.literal(`timedOut`),Z.literal(`cancelled`)),Z.union(Z.literal(`pending`),Z.literal(`claimed`),Z.literal(`completed`),Z.literal(`failed`),Z.literal(`cancelled`)),Z.union(Z.literal(`prompt`),Z.literal(`response`));var Ha=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],Ua=`10 MiB`,Wa=Z.object({type:Z.literal(`text`),id:Z.string(),text:Z.string(),turnId:Z.optional(Z.string()),providerMetadata:Z.optional(Zi)}),Ga=Z.object({type:Z.literal(`reasoning`),id:Z.string(),text:Z.string(),turnId:Z.optional(Z.string()),providerMetadata:Z.optional(Zi)}),Ka=Z.object({type:Z.literal(`tool-call`),partId:Z.optional(Z.string()),callId:Z.string(),name:Z.string(),input:Zi,turnId:Z.optional(Z.string()),providerMetadata:Z.optional(Zi)}),qa=Z.union(...ta([`cancelled`,`failed`]));Z.object({error:Z.string(),status:qa});var Ja=Z.object({type:Z.literal(`tool-result`),callId:Z.string(),name:Z.optional(Z.string()),output:Zi});Z.union(Wa,Ga,Ka,Ja),Z.union(Z.literal(`prompt`),Z.literal(`completion`),Z.literal(`tool`));var Ya=Z.object({imageUploadId:Z.id(`imageUploads`),name:Z.string(),mediaType:Z.string(),size:Z.number(),storageId:Z.id(`_storage`),url:Z.optional(Z.string())}),Xa=Z.union(Wa,Ga,Ka);Z.object({text:Z.string(),imageUploads:Z.array(Ya)}),Z.object({streamId:Z.optional(Z.string()),items:Z.array(Xa)});var Za=Z.union(Z.literal(`completed`),Z.literal(`failed`),Z.literal(`cancelled`));Z.object({jobId:Z.optional(Z.id(`executorJobs`)),callId:Z.string(),name:Z.string(),output:Zi,status:Za});var Qa=Z.union(Z.literal(`system`),Z.literal(`user`),Z.literal(`assistant`)),$a=Z.union(Z.object({type:Z.literal(`text`),text:Z.string()}),Z.object({type:Z.literal(`image`),imageJson:Z.string()})),eo=Z.union(Z.object({type:Z.literal(`text`),text:Z.string(),additionalParamsJson:Z.optional(Z.string())}),Z.object({type:Z.literal(`reasoning`),id:Z.optional(Z.string()),blocksJson:Z.string()}),Z.object({type:Z.literal(`toolCall`),id:Z.string(),callId:Z.optional(Z.string()),name:Z.string(),argumentsJson:Z.string(),signature:Z.optional(Z.string()),additionalParamsJson:Z.optional(Z.string())}),Z.object({type:Z.literal(`toolResult`),id:Z.string(),callId:Z.optional(Z.string()),items:Z.array($a)}),Z.object({type:Z.literal(`image`),imageJson:Z.string()}),Z.object({type:Z.literal(`audio`),audioJson:Z.string()}),Z.object({type:Z.literal(`video`),videoJson:Z.string()}),Z.object({type:Z.literal(`document`),documentJson:Z.string()}));Z.object({role:Qa,assistantId:Z.optional(Z.string()),contents:Z.array(eo)});function to(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>e===r[t])}var no=Ha,ro=new Set(no);function io(e){return ro.has(e)}function ao(e,t){return e>=4?`You can attach up to 4 images.`:io(t.type)?t.size>10485760?`${t.name||`This image`} is larger than ${Ua}.`:null:`${t.name||`This file`} is not a supported image. Use JPEG, PNG, GIF, or WebP.`}var oo=F(`<div class="text-muted-foreground mb-3 flex items-center gap-2 px-4 text-[11px]"><span class="inline-flex items-center gap-0.75"><span class="bg-foreground/28 size-1 animate-pulse rounded-full"></span> <span class="bg-foreground/28 size-1 animate-pulse rounded-full [animation-delay:200ms]"></span> <span class="bg-foreground/28 size-1 animate-pulse rounded-full [animation-delay:400ms]"></span></span> <span> </span></div>`),so=F(`<div class="text-muted-foreground mb-3 flex items-center gap-2 px-4 text-[11px]" role="status" aria-live="polite"><span class="bg-foreground/28 size-1.5 animate-pulse rounded-full"></span> <span> </span></div>`),co=F(`<div class="mb-3 px-4"><button type="button" class="border-border bg-surface/80 text-foreground hover:bg-hover-fill rounded-full border px-3 py-1.5 text-[13px] font-medium transition">Continue working</button></div>`),lo=F(`<div class="mb-3 flex items-start gap-2.5 rounded-xl border border-amber-500/25 bg-amber-500/10 px-3.5 py-3" role="alert"><!> <div class="min-w-0"><p class="text-[13px] leading-5 font-medium text-amber-800 dark:text-amber-200">You're out of usage</p> <p class="text-[12.5px] leading-5 text-amber-800/90 dark:text-amber-200/90"> </p></div></div>`),uo=F(`<li><button type="button"> </button></li>`),fo=F(`<div class="mb-3" role="group" aria-label="Agent question"><p class="text-foreground text-[14px] leading-6 font-medium"> </p> <ul class="mt-2 flex flex-col gap-1.5" aria-label="Answer options"></ul></div>`),po=F(`<span class="absolute inset-0 flex items-center justify-center" role="status"><span class="border-border border-t-foreground/80 size-3.5 animate-spin rounded-full border-2"></span></span>`),mo=F(`<span class="text-destructive absolute inset-x-0 bottom-0 bg-rose-950/80 px-1 py-0.5 text-center text-[9px] leading-3" role="alert">Failed</span>`),ho=F(`<li><img/> <!> <button type="button" class="bg-foreground/70 text-background hover:bg-foreground/90 absolute top-1 right-1 flex size-4.5 cursor-pointer items-center justify-center rounded-full transition disabled:cursor-not-allowed disabled:opacity-40"><!></button></li>`),go=F(`<p class="text-destructive mb-3 text-xs" role="alert"> </p>`),_o=F(`<ul class="mb-3 flex flex-wrap items-center gap-2" aria-label="Attached images"></ul> <!>`,1),vo=F(`<p class="text-muted-foreground px-3 py-2 text-sm">Loading skills…</p>`),yo=F(`<div class="flex items-center justify-between gap-3 px-3 py-2"><p class="text-muted-foreground text-sm">Couldn’t load skills</p> <button type="button" class="text-muted-foreground hover:text-foreground text-sm underline-offset-2 hover:underline">Retry</button></div>`),bo=F(`<p class="text-muted-foreground px-3 py-2 text-sm">No matching skills</p>`),xo=F(`<button type="button" role="option"><span class="text-sm font-medium"> </span> <span class="text-muted-foreground line-clamp-2 text-[12px]"> </span></button>`),So=F(`<div class="border-border bg-popover absolute inset-x-0 bottom-full z-30 mb-2 max-h-56 overflow-y-auto rounded-xl border py-1 shadow-2xl" id="composer-skills-listbox" aria-label="Available skills"><!></div>`),Co=F(`<button type="button" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-full bg-rose-500/90 text-white transition-all duration-150 hover:scale-105 hover:bg-rose-500 disabled:pointer-events-none disabled:opacity-60 disabled:hover:scale-100" aria-label="Stop generation" title="Stop"><!></button>`),wo=F(`<button type="button" class="bg-primary/90 text-primary-foreground hover:bg-primary flex h-10 w-10 items-center justify-center rounded-full transition-all duration-150 hover:scale-105 enabled:cursor-pointer disabled:pointer-events-none disabled:opacity-30 disabled:hover:scale-100"><!></button>`),To=F(`<div class="bg-tooltip text-tooltip-foreground ring-border pointer-events-none fixed z-100 -translate-x-1/2 -translate-y-full rounded-md px-2.5 py-1.5 text-[12px] leading-4 whitespace-nowrap shadow-lg ring-1" role="tooltip"> </div>`),Eo=F(`<footer class="shrink-0 px-6 py-4"><div class="mx-auto max-w-336"><!> <!> <div><div><div class="relative flex min-h-33 flex-col px-4 pt-4 pb-2.5"><!> <!> <!> <div class="relative min-h-0 flex-1"><!> <textarea rows="1" class="text-foreground placeholder:text-muted-foreground field-sizing-content max-h-40 min-h-17 w-full resize-none overflow-y-auto border-0 bg-transparent px-0 py-0 text-[14px] leading-6 outline-none" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" autocomplete="off"></textarea></div> <div class="flex min-w-0 flex-nowrap items-center justify-between gap-3 overflow-visible px-0 pt-2.5 pb-0"><div class="-m-1 flex min-w-0 flex-1 items-center gap-1 overflow-visible p-1"><input type="file" class="hidden" multiple=""/> <button type="button" class="text-muted-foreground enabled:hover:text-foreground flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition enabled:cursor-pointer disabled:opacity-40"><!></button> <div class="bg-hover-fill-strong mx-1 hidden h-4 w-px shrink-0 sm:block"></div> <!> <div class="bg-hover-fill-strong mx-1 hidden h-4 w-px shrink-0 sm:block"></div> <!></div> <div class="flex shrink-0 flex-nowrap items-center justify-end gap-2.5"><div class="group/context relative"><button type="button" class="focus-visible:ring-ring/60 relative flex size-8 cursor-help items-center justify-center rounded-full focus-visible:ring-2 focus-visible:outline-none" aria-describedby="context-window-details"><span class="bg-muted size-5.5 rounded-full"></span></button> <div id="context-window-details" class="border-border bg-popover invisible absolute right-0 bottom-full z-50 mb-3 w-76 translate-y-1 rounded-xl border p-4 opacity-0 shadow-(--composer-shadow) transition duration-150 group-focus-within/context:visible group-focus-within/context:translate-y-0 group-focus-within/context:opacity-100 group-hover/context:visible group-hover/context:translate-y-0 group-hover/context:opacity-100" role="tooltip"><div class="flex items-center justify-between gap-4 text-[13px]"><span class="text-foreground font-medium">Context window</span> <span class="text-muted-foreground"> </span></div> <div class="bg-hover-fill mt-3 h-1.5 overflow-hidden rounded-full"><div class="bg-accent h-full rounded-full transition-[width] duration-300"></div></div> <div class="text-muted-foreground mt-3 flex items-center justify-between text-[12px]"><span>Total processed</span> <span> </span></div> <p class="text-muted-foreground mt-4 text-[12px] leading-5"> </p></div></div> <!> <!></div></div></div></div></div></div></footer> <!>`,1);function Do(t,n){H(n,!0);let r=P(n,`prompt`,15,``),d=P(n,`selectedModel`,31,()=>l(ri)),f=P(n,`selectedReasoningEffort`,31,()=>l(`max`)),_=P(n,`selectedServiceTier`,31,()=>l(ii)),b=P(n,`pendingQuestion`,3,null),S=P(n,`showContinueWorking`,3,!1),w=P(n,`selectedQuestionOptionId`,15,null),T=P(n,`projectSkills`,3,null),E=Me(),D=Ne(G.billing.getMySubscription,()=>E.isAuthenticated&&!E.isLoading?{}:`skip`),O=Ne(G.usage.getMyUsage,()=>E.isAuthenticated&&!E.isLoading?{}:`skip`),k=e(()=>D.data?.tier),ne=e(()=>!!D.error),j=e(()=>n.modelCatalog?bi(n.modelCatalog,o(k)??`free`):[]),N=e(()=>n.modelCatalog?mi(n.modelCatalog,d()):void 0),re=e(()=>n.modelCatalog&&o(N)?yi(n.modelCatalog,o(k)??`free`,o(N)):void 0),F=e(()=>o(N)!==void 0&&(o(ne)||o(k)!==void 0&&n.modelCatalog!==void 0&&hi(n.modelCatalog,o(k),d()))),ie=g(null),oe=g(null),se=g(null),L=g(l([])),le=g(`idle`),ue=g(!1),de=g(0),U=g(0),fe=0,pe,me=l([]),W=e(()=>b()!=null),he=e(()=>n.isRunning&&!o(W)||n.isSubmitting),ge=g(l(Date.now()));c(()=>{let e=setInterval(()=>{C(ge,Date.now(),!0)},1e3);return()=>{clearInterval(e)}});let _e=e(()=>o(N)?.usagePolicy===`unlimited`),ve=e(()=>O.data?.exhausted===!0&&(O.data.resetsAt===null||O.data.resetsAt>o(ge))&&!o(_e)),ye=e(()=>n.modelCatalog?o(j).find(e=>!e.locked&&mi(n.modelCatalog,e.id)?.usagePolicy===`unlimited`)?.label??null:null),be=e(()=>{if(!o(ve)||O.data===void 0)return null;let e=o(ye)===null?`Upgrade your subscription to keep going.`:`Switch to ${o(ye)} or upgrade your subscription to keep going.`;return O.data.resetsAt===null?e:`Your limit resets in ${Hi(O.data.resetsAt-o(ge))}. ${e}`}),xe=e(()=>!!r().trim()||n.attachments.length>0),Se=e(()=>o(N)?.supportsImages===!0),Ce=e(()=>n.attachments.length>0&&o(N)?.supportsImages===!1),we=e(()=>Wi({selectedOptionId:w(),text:r()})),Te=e(()=>o(W)?o(we):o(xe)),Ee=e(()=>n.attachments.some(e=>e.status!==`ready`)),De=e(()=>o(Se)&&n.attachments.length<4&&!o(he)&&!o(W)),K=g(null);c(()=>{let e=b()?.questionId??null;e!==o(K)&&(C(K,e,!0),w(null),r().trim()&&r(``))});let Oe=e(()=>o(N)?.supportsImages===!1?`${o(N).label} does not support image input`:`Attach images (up to 4)`),ke=!!globalThis.CSS?.supports(`field-sizing`,`content`),Ae=e(()=>n.contextUsage.contextWindowTokens>0?Math.min(100,Math.round(n.contextUsage.inputTokens/n.contextUsage.contextWindowTokens*100)):0),je=e(()=>n.contextUsage.contextWindowTokens>0?Math.round(n.contextUsage.autoCompactTokenLimit/n.contextUsage.contextWindowTokens*100):0),q=e(()=>Li(r(),o(U))),Pe=e(()=>o(q)!==null&&!o(ue)&&!o(W)),Fe=e(()=>o(q)===null?[]:Ri(o(L),o(q))),Ie=e(()=>o(Pe)&&o(Fe).length>0?`composer-skill-option-${o(de)}`:void 0);function J(){C(U,o(ie)?.selectionStart??r().length,!0)}function Le(){C(L,[],!0),C(le,`idle`),C(ue,!1),C(de,0),fe+=1}async function Re(e=!1){if(o(le)===`loading`||(o(le)===`ready`||o(le)===`error`)&&!e)return;if(!T()?.load){C(L,[],!0),C(le,`ready`);return}let t=++fe;C(le,`loading`);try{let e=await T().load();if(t!==fe)return;C(L,e,!0),C(le,`ready`)}catch{if(t!==fe)return;C(L,[],!0),C(le,`error`)}}function ze(e){let t=zi(r(),o(U),e.name);t&&(r(t.text),C(U,t.caret,!0),C(ue,!0),queueMicrotask(()=>{o(ie)&&(o(ie).focus(),o(ie).setSelectionRange(t.caret,t.caret),We())}))}function Be(e){let t=e.currentTarget;if(!(t instanceof HTMLInputElement))return;let r=Array.from(t.files??[]);t.value=``,r.length>0&&n.onAttachFiles(r)}function Ve(e){let t=Array.from(e.clipboardData?.files??[]).filter(e=>e.type.startsWith(`image/`));t.length===0||n.isRunning||n.isSubmitting||o(W)||!o(Se)||(e.preventDefault(),n.onAttachFiles(t))}function He(e){let t=e.currentTarget;if(!(t instanceof HTMLButtonElement)||t.disabled&&o(N)?.supportsImages!==!1)return;let n=t.getBoundingClientRect();C(se,{top:n.top-8,left:n.left+n.width/2},!0)}function Ue(){C(se,null)}function We(){if(!o(ie)||ke)return;let e=o(ie);e.style.height=`68px`;let t=Math.min(Math.max(e.scrollHeight,68),160);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`}function Ge(e){if(o(Pe)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),o(Fe).length===0)return;let t=e.key===`ArrowDown`?1:-1;C(de,(o(de)+t+o(Fe).length)%o(Fe).length);return}if(e.key===`Escape`){e.preventDefault(),C(ue,!0);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){e.preventDefault();let t=o(Fe)[o(de)];t&&ze(t);return}}!n.canSend||!o(W)&&!o(F)||!o(W)&&o(ve)||n.isSubmitting||o(he)||!o(Te)||!o(W)&&(o(Ee)||o(Ce))||Pi(e)&&(e.preventDefault(),n.onSubmit())}function Y(e){w(w()===e?null:e)}function Ke(e){if(!n.modelCatalog)return;let t=mi(n.modelCatalog,e);t&&f(t.defaultReasoningEffort)}function X(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1).replace(/\.0$/,``)}m`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}c(()=>{n.modelCatalog&&(!d()||!mi(n.modelCatalog,d()))&&(d(n.modelCatalog.defaultModelId),f(n.modelCatalog.defaultReasoningEffort),_(n.modelCatalog.defaultServiceTier))}),c(()=>{if(!n.modelCatalog||!o(k))return;let e=gi(n.modelCatalog,o(k),d());e!==d()&&(d(e),f(mi(n.modelCatalog,e)?.defaultReasoningEffort??n.modelCatalog.defaultReasoningEffort));let t=mi(n.modelCatalog,e);if(!t)return;let r=vi(n.modelCatalog,o(k),t);r.includes(_())||_(r[0]??n.modelCatalog.defaultServiceTier)}),c(()=>{r(),We()}),c(()=>{let e=T()?.workspacePath??null;if(pe!==e&&(pe=e,Le()),o(q)===null){C(ue,!1);return}o(ue)||Re()}),c(()=>{o(Fe),C(de,0)}),c(()=>{!o(Pe)||o(Fe).length===0||me[o(de)]?.scrollIntoView({block:`nearest`})});var qe=Eo(),Je=u(qe),Ye=s(Je),Xe=s(Ye),Ze=e=>{var t=oo(),r=V(s(t),2),o=s(r);B(r),B(t),x(()=>a(o,`Working for ${n.elapsedLabel??``}`)),i(e,t)},Qe=e=>{var t=so(),r=V(s(t),2),o=s(r,!0);B(r),B(t),x(()=>a(o,n.isStarting?`Starting agent…`:`Sending request…`)),i(e,t)};y(Xe,e=>{n.elapsedLabel?e(Ze):n.isSubmitting&&e(Qe,1)});var $e=V(Xe,2),et=e=>{var t=co(),r=s(t);B(t),x(()=>r.disabled=n.isSubmitting),p(`click`,r,function(...e){n.onContinueWorking?.apply(this,e)}),i(e,t)};y($e,e=>{S()&&n.onContinueWorking&&e(et)});var tt=V($e,2);I(tt,1,M(`composer-shell mx-auto w-full max-w-[48rem] rounded-[28px] p-px transition-colors duration-200`));var nt=s(tt);I(nt,1,M(`composer-inner rounded-[27px] border border-[var(--hairline)] transition-colors duration-200`));var rt=s(nt),it=s(rt),at=e=>{var t=lo(),n=s(t);Nt(n,{class:`mt-0.5 size-4 shrink-0 text-amber-800 dark:text-amber-200`,"aria-hidden":`true`});var r=V(n,2),c=V(s(r),2),l=s(c,!0);B(c),B(r),B(t),x(()=>a(l,o(be))),i(e,t)};y(it,e=>{o(be)&&e(at)});var ot=V(it,2),st=t=>{var n=fo(),r=s(n),c=s(r,!0);B(r);var l=V(r,2);v(l,21,()=>b().options,e=>e.id,(t,n)=>{let r=e(()=>o(n).id===Ui),c=e(()=>w()===o(n).id);var l=uo(),u=s(l),d=s(u,!0);B(u),B(l),x(()=>{I(u,1,`w-full rounded-lg border px-3 py-2 text-left text-[13px] leading-5 transition ${o(c)?`border-foreground/40 bg-hover-fill-strong text-foreground`:o(r)?`border-border/70 text-muted-foreground/80 hover:text-muted-foreground hover:bg-hover-fill`:`border-border text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),A(u,`aria-pressed`,o(c)),a(d,o(n).label)}),p(`click`,u,()=>{Y(o(n).id)}),i(t,l)}),B(l),B(n),x(()=>a(c,b().question)),i(t,n)};y(ot,e=>{b()&&e(st)});var Z=V(ot,2),ct=e=>{var t=_o(),r=u(t);v(r,21,()=>n.attachments,e=>e.localId,(e,t)=>{var r=ho(),a=s(r),c=V(a,2),l=e=>{var n=po();x(()=>A(n,`aria-label`,`Uploading ${o(t).name??``}`)),i(e,n)},u=e=>{var t=mo();i(e,t)};y(c,e=>{o(t).status===`uploading`?e(l):o(t).status===`error`&&e(u,1)});var d=V(c,2);or(s(d),{class:`size-3`,"aria-hidden":`true`}),B(d),B(r),x(()=>{I(r,1,`group relative size-14 overflow-hidden rounded-xl border ${o(t).status===`error`?`border-rose-500/60`:`border-border`}`),A(r,`title`,o(t).error??o(t).name),A(a,`src`,o(t).previewUrl),A(a,`alt`,o(t).name),I(a,1,`size-full object-cover ${o(t).status===`uploading`?`opacity-50`:``}`),A(d,`aria-label`,`Remove ${o(t).name??``}`),d.disabled=o(he)}),p(`click`,d,()=>n.onRemoveAttachment(o(t).localId)),i(e,r)}),B(r);var c=V(r,2),l=e=>{var t=go(),n=s(t);B(t),x(()=>a(n,`${o(N).label??``} does not support image input. Remove the images or choose
2
+ another model.`)),i(e,t)};y(c,e=>{o(Ce)&&o(N)&&e(l)}),i(e,t)};y(Z,e=>{n.attachments.length>0&&!o(W)&&e(ct)});var lt=V(Z,2),ut=s(lt),dt=e=>{var t=So(),n=s(t),r=e=>{var t=vo();i(e,t)},c=e=>{var t=yo(),n=V(s(t),2);B(t),p(`click`,n,()=>{Re(!0)}),i(e,t)},l=e=>{var t=bo();i(e,t)},d=e=>{var t=m(),n=u(t);v(n,19,()=>o(Fe),e=>e.name,(e,t,n)=>{var r=xo(),c=s(r),l=s(c);B(c);var u=V(c,2),d=s(u,!0);B(u),B(r),ce(r,(e,t)=>me[t]=e,e=>me?.[e],()=>[o(n)]),x(()=>{A(r,`id`,`composer-skill-option-${o(n)??``}`),I(r,1,`flex w-full flex-col gap-0.5 px-3 py-2 text-left transition ${o(de)===o(n)?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),A(r,`aria-selected`,o(de)===o(n)),a(l,`$${o(t).name??``}`),a(d,o(t).description)}),h(`pointerenter`,r,()=>{C(de,o(n),!0)}),p(`click`,r,()=>{ze(o(t))}),i(e,r)}),i(e,t)};y(n,e=>{o(le)===`loading`?e(r):o(le)===`error`?e(c,1):o(Fe).length===0?e(l,2):e(d,-1)}),B(t),x(()=>A(t,`role`,o(le)===`ready`&&o(Fe).length>0?`listbox`:`status`)),i(e,t)};y(ut,e=>{o(Pe)&&e(dt)});var ft=V(ut,2);te(ft),ce(ft,e=>C(ie,e),()=>o(ie)),B(lt);var pt=V(lt,2),Q=s(pt),mt=s(Q);ce(mt,e=>C(oe,e),()=>o(oe));var ht=V(mt,2);bn(s(ht),{class:`size-4`,"aria-hidden":`true`}),B(ht);var gt=V(ht,4);{let t=(e,t=ae)=>{ei(e,{get provider(){return t().provider},className:`size-4 shrink-0`})},r=e(()=>o(he)||o(W)||n.modelCatalog===void 0);Gr(gt,{get options(){return o(j)},ariaLabel:`Select model`,menuTitle:`Model`,get disabled(){return o(r)},searchable:!0,onValueChange:Ke,className:`z-20 shrink-0`,triggerClassName:`h-9 border-0 bg-transparent px-2 text-[15px] text-foreground shadow-none hover:bg-transparent focus-visible:ring-0`,get value(){return d()},set value(e){d(e)},optionIcon:t,$$slots:{optionIcon:!0}})}var _t=V(gt,4),vt=t=>{{let n=e(()=>o(he)||o(W));Ni(t,{get model(){return o(N)},get serviceTierOptions(){return o(re)},get disabled(){return o(n)},className:`z-20 shrink-0`,get reasoningEffort(){return f()},set reasoningEffort(e){f(e)},get serviceTier(){return _()},set serviceTier(e){_(e)}})}};y(_t,e=>{o(N)&&e(vt)}),B(Q);var bt=V(Q,2),xt=s(bt),St=s(xt),Ct=V(St,2),wt=s(Ct),Tt=V(s(wt),2),Et=s(Tt);B(Tt),B(wt);var Dt=V(wt,2),Ot=s(Dt);B(Dt);var kt=V(Dt,2),At=V(s(kt),2),jt=s(At,!0);B(At),B(kt);var Mt=V(kt,2),Pt=s(Mt);B(Mt),B(Ct),B(xt);var Ft=V(xt,2),It=e=>{var t=Co();Jn(s(t),{class:`size-3.5 fill-current`}),B(t),p(`click`,t,function(...e){n.onCancel?.apply(this,e)}),i(e,t)};y(Ft,e=>{n.isRunning&&e(It)});var Lt=V(Ft,2),Rt=e=>{var t=wo();yt(s(t),{class:`size-4`}),B(t),x(()=>{t.disabled=!n.canSend||!o(W)&&!o(F)||!o(W)&&o(ve)||n.isSubmitting||!o(Te)||!o(W)&&(o(Ee)||o(Ce)),A(t,`aria-label`,o(W)?`Submit answer`:`Send message`)}),p(`click`,t,function(...e){n.onSubmit?.apply(this,e)}),i(e,t)};y(Lt,e=>{(o(W)||!n.isRunning)&&e(Rt)}),B(bt),B(pt),B(rt),B(nt),B(tt),B(Ye),B(Je);var zt=V(Je,2),Bt=e=>{var t=To(),n=s(t,!0);B(t),x(()=>{z(t,`top: ${o(se).top}px; left: ${o(se).left}px;`),a(n,o(Oe))}),i(e,t)};y(zt,e=>{o(se)&&e(Bt)}),x((e,t,n,r)=>{A(ft,`placeholder`,o(W)?`Add detail, or type a custom answer`:`Ask anything, @tag files/directories, or use $ to show available skills`),ft.disabled=o(he),A(ft,`aria-expanded`,o(Pe)),A(ft,`aria-controls`,o(Pe)?`composer-skills-listbox`:void 0),A(ft,`aria-activedescendant`,o(Ie)),A(mt,`accept`,e),A(ht,`aria-label`,o(Oe)),ht.disabled=!o(De),A(St,`aria-label`,`Context window ${o(Ae)}% full`),z(St,`background: conic-gradient(var(--accent) ${o(Ae)*3.6}deg, var(--hover-fill-strong) 0deg);`),a(Et,`${o(Ae)??``}% · ${t??``}/${n??``}`),z(Ot,`width: ${o(Ae)}%`),a(jt,r),a(Pt,`Sprocket automatically compacts context at about ${o(je)??``}% so
3
+ long-running work can continue.`)},[()=>no.join(`,`),()=>X(n.contextUsage.inputTokens),()=>X(n.contextUsage.contextWindowTokens),()=>X(n.contextUsage.totalTokensProcessed)]),p(`keydown`,ft,Ge),h(`paste`,ft,Ve),h(`focus`,ft,J),p(`input`,ft,()=>{J(),We()}),p(`keyup`,ft,J),p(`click`,ft,J),h(`select`,ft,J),ee(ft,r),p(`change`,mt,Be),h(`mouseenter`,ht,He),h(`mouseleave`,ht,Ue),h(`focus`,ht,He),h(`blur`,ht,Ue),p(`click`,ht,()=>{Ue(),o(oe)?.click()}),p(`keydown`,St,e=>{e.key===`Escape`&&e.currentTarget.blur()}),i(t,qe),R()}f([`click`,`keydown`,`input`,`keyup`,`change`]);var Oo=F(`<p class="text-foreground text-[15px]"> </p>`),ko=F(`<button type="button" class="text-muted-foreground hover:text-foreground block text-left text-sm transition"><span> </span></button>`),Ao=F(`<div class="mt-3 space-y-1"><!> <!></div>`),jo=F(`<p class="text-muted-foreground mt-3 text-sm">You’re signed in to Sprocket.</p>`),Mo=F(`<p class="text-foreground mt-3 text-[15px]"> </p>`),No=F(`<p class="text-muted-foreground mt-3 text-sm">Couldn’t load your subscription right now.</p>`),Po=F(`<div class="bg-hover-fill mt-3.5 h-4 w-16 animate-pulse rounded" aria-hidden="true"></div>`),Fo=F(`<!> Sign Out`,1),Io=F(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Account</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Profile</p> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Spikonado Subscription Tier</p> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Session</p> <p class="text-muted-foreground mt-2 text-sm leading-6">Sign out of this device. You’ll need to authenticate again to open your projects.</p> <div class="mt-4"><!></div></div></div></div></section>`);function Lo(t,n){H(n,!0);let r=g(!1),c=Me(),l=Ne(G.billing.getMySubscription,()=>c.isAuthenticated&&!c.isLoading?{}:`skip`),d=e(()=>[n.user?.firstName,n.user?.lastName].filter(Boolean).join(` `).trim()||null);var f=Io(),m=V(s(f),2),h=s(m),_=s(h),v=V(s(_),2),b=e=>{var t=Ao(),c=s(t),l=e=>{var t=Oo(),n=s(t,!0);B(t),x(()=>a(n,o(d))),i(e,t)};y(c,e=>{o(d)&&e(l)});var u=V(c,2),f=e=>{var t=ko(),c=s(t),l=s(c,!0);B(c),B(t),x(()=>{A(t,`aria-pressed`,o(r)),A(t,`aria-label`,o(r)?`Hide email address`:`Show email address`),I(c,1,M(o(r)?void 0:`blur-[5px] select-none`)),a(l,n.user.email)}),p(`click`,t,()=>{C(r,!o(r))}),i(e,t)};y(u,e=>{n.user?.email&&e(f)}),B(t),i(e,t)},S=e=>{var t=jo();i(e,t)};y(v,e=>{o(d)||n.user?.email?e(b):e(S,-1)}),B(_);var w=V(_,2),T=V(s(w),2),E=e=>{var t=Mo(),n=s(t,!0);B(t),x(()=>a(n,$i[l.data.tier])),i(e,t)},D=e=>{var t=No();i(e,t)},O=e=>{var t=Po();i(e,t)};y(T,e=>{l.data?e(E):l.error?e(D,1):e(O,-1)}),B(w);var k=V(w,2),ee=V(s(k),4);gr(s(ee),{variant:`outline`,get onclick(){return n.onSignOut},children:(e,t)=>{var n=Fo();On(u(n),{class:`mr-2 size-4`,"aria-hidden":`true`}),j(),i(e,n)},$$slots:{default:!0}}),B(ee),B(k),B(h),B(m),B(f),i(t,f),R()}f([`click`]);function Ro(e){return{threadId:e.threadId,repositoryKey:e.repositoryKey??``,title:e.title,selectedModel:li(e.selectedModel),reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,lastMessageAt:e.lastMessageAt,threadStatus:e.threadStatus,latestRunStatus:e.latestRunStatus,latestRunId:e.latestRunId,latestRunStartedAt:e.latestRunStartedAt,latestRunClaimExpiresAt:e.latestRunClaimExpiresAt,hasActiveRun:e.hasActiveRun}}function zo(e,t){return t?e.find(e=>e.repositoryKey===t)??null:null}function Bo(e,t){return t?e.find(e=>e.workspacePath===t)??null:null}function Vo(e){return e.threadStatus!==`archived`}function Ho(e,t){let n=Wo(t);return{project:e,threads:n,activeThreadCount:Go(n)}}function Uo(e,t){let n=new Map;for(let e of t.filter(Vo)){let t=n.get(e.repositoryKey);if(t){t.push(e);continue}n.set(e.repositoryKey,[e])}return e.map(e=>Ho(e,n.get(e.repositoryKey)??[]))}function Wo(e){return[...e].sort((e,t)=>e.hasActiveRun===t.hasActiveRun?t.lastMessageAt-e.lastMessageAt:Number(t.hasActiveRun)-Number(e.hasActiveRun))}function Go(e){return e.filter(e=>e.hasActiveRun).length}function Ko(e,t){return t?e.find(e=>e.threadId===t)??null:null}function qo(e){let t=null;for(let n of e)Vo(n)&&(!t||n.lastMessageAt>t.lastMessageAt)&&(t=n);return t}function Jo(e,t){return t&&(e?.threadId??e?._id)===t?e:null}function Yo(e){let{pendingCreatedThreadId:t,threads:n}=e;return!t||n.some(e=>e.threadId===t)?null:t}function Xo(e){return!e.threadId||e.threadId===e.pendingCreatedThreadId||e.hasLatestRunData}function Zo(e,t){return!!(t&&e[t])}function Qo(e,t,n){return{...e,[t]:n}}function $o(e,t,n){let r=e[t];if(!r||n!==void 0&&r.launchId!==n)return e;let i={...e};return delete i[t],i}function es(e,t,n){return!!(t&&(t!==e.previousRunId||n!=null&&n!==e.previousClaimExpiresAt))}function ts(e,t,n,r){let i=e[t];return!i||!es(i,n,r)?e:$o(e,t,i.launchId)}function ns(e,t){let n=e;for(let e of t)n=ts(n,e.threadId,e.latestRunId,e.latestRunClaimExpiresAt);return n}function rs(e,t,n,r,i,a){let o=e[t];return!o||o.launchId!==n||o.expiresAt>r?{pendingLaunches:e,shouldRecover:!1}:{pendingLaunches:$o(e,t,n),shouldRecover:!es(o,i,a)}}function is(e){let{threads:t,currentThreadId:n,currentWorkspacePath:r,draftWorkspacePath:i,pendingCreatedThreadId:a=null}=e;return r&&i===r?null:n&&(t.some(e=>e.threadId===n)||a&&n===a)?n:t[0]?.threadId??null}var as=F(`<p class="text-muted-foreground max-w-xl text-sm leading-6">No archived threads.</p>`),os=F(`<li class="group flex items-center gap-3 py-2"><div class="min-w-0 flex-1"><p class="text-foreground truncate text-[14px]"> </p> <p class="text-muted-foreground truncate text-[12px]"> </p></div> <button type="button" class="text-muted-foreground hover:text-muted-foreground shrink-0 px-1 text-[12px] opacity-0 transition group-hover:opacity-100 focus-visible:opacity-100">Restore</button></li>`),ss=F(`<ul class="max-w-xl space-y-1"></ul>`),cs=F(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Archived Threads</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><p class="text-muted-foreground mb-6 max-w-xl text-sm leading-6">We may permanently delete archived threads from our database at any time.</p> <!></div></section>`);function ls(t,n){H(n,!0);let r=e(()=>[...n.threads].filter(e=>!Vo(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt));var c=cs(),l=V(s(c),2),u=V(s(l),2),d=e=>{var t=as();i(e,t)},f=t=>{var c=ss();v(c,21,()=>o(r),e=>e.threadId,(t,r)=>{let c=e(()=>zo(n.projects,o(r).repositoryKey));var l=os(),u=s(l),d=s(u),f=s(d,!0);B(d);var m=V(d,2),h=s(m,!0);B(m),B(u);var g=V(u,2);B(l),x(()=>{a(f,o(r).title),a(h,o(c)?.displayName??`Unknown project`)}),p(`click`,g,()=>{n.onRestore(o(r).threadId)}),i(t,l)}),B(c),i(t,c)};y(u,e=>{o(r).length===0?e(d):e(f,-1)}),B(l),B(c),i(t,c),R()}f([`click`]);var us=F(`<div class="max-w-md"><p class="text-foreground text-sm"> </p> <p class="text-muted-foreground mt-0.5 text-xs leading-5">Opens Prava in a new tab so you can confirm with your passkey.</p> <a target="_blank" rel="noopener noreferrer" class="border-border bg-surface/80 text-foreground hover:bg-hover-fill mt-3 inline-flex h-9 items-center rounded-full border px-4 text-xs font-medium transition">Approve mandate</a></div>`);function ds(e,t){H(t,!0);var n=us(),r=s(n),o=s(r);B(r);var c=V(r,4);B(n),x(()=>{a(o,`Approve spending${t.approval.label?` · ${t.approval.label}`:``}`),A(c,`href`,t.approval.approvalUrl)}),i(e,n),R()}var fs=`Uncaught ConvexError: `,ps=`Uncaught Error: `;function ms(e,t){if(!e.startsWith(t))return null;let n=e.slice(t.length),r=n.indexOf(`
4
+ `),i=r===-1?n:n.slice(0,r),a=i.indexOf(`(`);return(a===-1?i:i.slice(0,a)).trim()||null}function hs(e){if(e instanceof Fe){let t=e.data.trim();if(t)return t}let t=e.message.trim();return t?ms(t,fs)??ms(t,ps)??t:null}var gs=F(`<p class="text-destructive text-sm"> </p>`),_s=F(`<div class="mt-4"><!></div>`),vs=F(`<p class="text-destructive mt-3 text-sm"> </p>`),ys=F(`<div class="space-y-2"><div class="bg-hover-fill h-3.5 w-40 rounded"></div> <div class="bg-hover-fill h-3 w-56 rounded"></div></div>`),bs=F(`<div class="mt-4 animate-pulse space-y-4" aria-hidden="true"></div>`),xs=F(`<p class="text-muted-foreground mt-3 text-sm leading-6">No mandates yet.</p>`),Ss=F(`<button type="button"> </button>`),Cs=F(`<div class="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1"></div>`),ws=F(`<li class="py-2"><div class="flex items-baseline justify-between gap-3"><p class="text-foreground truncate text-[14px]"> </p> <p class="text-muted-foreground shrink-0 text-[12px] capitalize"> </p></div> <p class="text-muted-foreground mt-0.5 text-[12px]"> <!> <!> <!></p> <!></li>`),Ts=F(`<ul class="mt-3 space-y-1"></ul>`),Es=F(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Payments</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Set up a spending mandate</p> <p class="text-muted-foreground mt-2 text-sm leading-6">Create a Prava mandate, then approve it in a new tab with your passkey.</p> <form class="mt-4 space-y-3"><div class="grid gap-3 sm:grid-cols-2"><label class="block space-y-1.5"><span>Merchant name</span> <input placeholder="Example Shop"/></label> <label class="block space-y-1.5"><span>Merchant URL</span> <input placeholder="https://example.com"/></label> <label class="block space-y-1.5"><span>Country code</span> <input placeholder="US"/></label> <label class="block space-y-1.5"><span>Amount cap</span> <input placeholder="120.00" required=""/></label> <label class="block space-y-1.5"><span>Currency</span> <input placeholder="USD" required=""/></label> <label class="block space-y-1.5"><span>Frequency</span> <select><option>One time</option><option>Weekly</option><option>Monthly</option><option>Yearly</option></select></label> <label class="block space-y-1.5 sm:col-span-2"><span>Scope</span> <select><option>Listed merchant</option><option>Any merchant</option></select></label> <label class="block space-y-1.5 sm:col-span-2"><span>Description</span> <input placeholder="Agent shopping budget" required=""/></label></div> <!> <!></form> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Your mandates</p> <!> <!></div></div></div></section>`);function Ds(t,n){H(n,!0);let r=Me(),u=Pe(G.payments.listMyMandates),d=Pe(G.payments.setupMyMandate),f=Pe(G.payments.setMyMandateLifecycle);function m(e,t){return hs(e)||t}function _(e,t){return e instanceof Error?m(e,t):t}let b=`border-border bg-hover-fill text-foreground placeholder:text-muted-foreground focus:border-ring h-9 w-full rounded-lg border px-3 text-[13px] outline-none`,S=`text-muted-foreground text-[12px]`,w=g(``),T=g(``),E=g(`US`),D=g(``),O=g(`USD`),k=g(`monthly`),A=g(`listed`),te=g(``),N=g(!1),P=g(null),F=g(null),ie=g(l([])),ae=g(!1),oe=g(null),se=g(null),L=g(null),z={pause:{idle:`Pause`,busy:`Pausing…`},resume:{idle:`Resume`,busy:`Resuming…`},cancel:{idle:`Cancel`,busy:`Cancelling…`}};c(()=>{o(A)===`any`&&o(k)!==`one_time`&&C(k,`one_time`)}),c(()=>{!r.isAuthenticated||r.isLoading||ce()}),c(()=>{if(!o(F)||!r.isAuthenticated)return;let e=()=>{document.visibilityState&&document.visibilityState!==`visible`||ce()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}});async function ce(){C(ae,!0),C(oe,null);try{let e=await u({});C(ie,e.mandates,!0);let t=o(F)?.mandateId;t&&o(ie).some(e=>e.mandateId===t&&(e.status===`active`||e.status===`paused`))&&C(F,null)}catch(e){C(oe,_(e,`Couldn’t load mandates.`),!0)}finally{C(ae,!1)}}async function le(e){e.preventDefault(),C(N,!0),C(P,null),C(F,null);let t=o(A)===`listed`;try{let e=await d({merchantName:t&&o(w).trim()||void 0,merchantUrl:t&&o(T).trim()||void 0,countryCode:t&&o(E).trim()||void 0,amountCap:o(D).trim(),currency:o(O).trim(),frequency:o(k),scope:o(A),description:o(te).trim()});C(F,{mandateId:e.mandateId,approvalUrl:e.approvalUrl,label:o(te).trim()},!0),await ce()}catch(e){C(P,_(e,`Couldn’t set up mandate.`),!0)}finally{C(N,!1)}}async function de(e,t){if(!(!e.mandateId||o(se)!==null)){C(se,e.pravaMandateId,!0),C(L,t,!0),C(oe,null);try{await f({mandateId:e.mandateId,action:t}),await ce()}catch(e){C(oe,_(e,`Couldn’t ${t} mandate.`),!0)}finally{C(se,null),C(L,null)}}}var U=Es(),fe=V(s(U),2),pe=s(fe),me=s(pe),W=V(s(me),4),he=s(W),ge=s(he),_e=s(ge);I(_e,1,M(S));var ve=V(_e,2);ue(ve),I(ve,1,M(b)),B(ge);var ye=V(ge,2),be=s(ye);I(be,1,M(S));var xe=V(be,2);ue(xe),I(xe,1,M(b)),B(ye);var Se=V(ye,2),Ce=s(Se);I(Ce,1,M(S));var we=V(Ce,2);ue(we),I(we,1,M(b)),B(Se);var Te=V(Se,2),Ee=s(Te);I(Ee,1,M(S));var De=V(Ee,2);ue(De),I(De,1,M(b)),B(Te);var K=V(Te,2),Oe=s(K);I(Oe,1,M(S));var ke=V(Oe,2);ue(ke),I(ke,1,M(b)),B(K);var Ae=V(K,2),je=s(Ae);I(je,1,M(S));var q=V(je,2);I(q,1,M(b));var Ne=s(q);Ne.value=Ne.__value=`one_time`;var Fe=V(Ne);Fe.value=Fe.__value=`weekly`;var Ie=V(Fe);Ie.value=Ie.__value=`monthly`;var J=V(Ie);J.value=J.__value=`yearly`,B(q),B(Ae);var Le=V(Ae,2),Re=s(Le);I(Re,1,M(S));var ze=V(Re,2);I(ze,1,M(b));var Be=s(ze);Be.value=Be.__value=`listed`;var Ve=V(Be);Ve.value=Ve.__value=`any`,B(ze),B(Le);var He=V(Le,2),Ue=s(He);I(Ue,1,M(S));var We=V(Ue,2);ue(We),I(We,1,M(b)),B(He),B(he);var Ge=V(he,2),Y=e=>{var t=gs(),n=s(t,!0);B(t),x(()=>a(n,o(P))),i(e,t)};y(Ge,e=>{o(P)&&e(Y)}),gr(V(Ge,2),{type:`submit`,variant:`outline`,get disabled(){return o(N)},children:(e,t)=>{j();var n=re();x(()=>a(n,o(N)?`Setting up…`:`Set up mandate`)),i(e,n)},$$slots:{default:!0}}),B(W);var Ke=V(W,2),X=e=>{var t=_s();ds(s(t),{get approval(){return o(F)}}),B(t),i(e,t)};y(Ke,e=>{o(F)&&e(X)}),B(me);var qe=V(me,2),Je=V(s(qe),2),Ye=e=>{var t=vs(),n=s(t,!0);B(t),x(()=>a(n,o(oe))),i(e,t)};y(Je,e=>{o(oe)&&e(Ye)});var Xe=V(Je,2),Ze=e=>{var t=bs();v(t,20,()=>[0,1],e=>e,(e,t)=>{var n=ys();i(e,n)}),B(t),i(e,t)},Qe=e=>{var t=xs();i(e,t)},$e=t=>{var n=Ts();v(n,21,()=>o(ie),e=>e.pravaMandateId,(t,n)=>{let r=e(()=>o(se)===o(n).pravaMandateId),c=e(()=>o(r)?o(L):null),l=e(()=>!!o(n).mandateId&&o(n).status===`active`),u=e(()=>!!o(n).mandateId&&o(n).status===`paused`);var d=ws(),f=s(d),m=s(f),h=s(m,!0);B(m);var g=V(m,2),_=s(g,!0);B(g),B(f);var b=V(f,2),S=s(b),C=V(S),w=e=>{var t=re();x(()=>a(t,`· ${o(n).remaining??``} remaining`)),i(e,t)};y(C,e=>{o(n).remaining!==void 0&&e(w)});var T=V(C,2),E=e=>{var t=re();x(()=>a(t,`· until ${o(n).validUntil??``}`)),i(e,t)};y(T,e=>{o(n).validUntil&&e(E)});var D=V(T,2),O=e=>{var t=re();x(()=>a(t,`· renews ${o(n).renewsAt??``}`)),i(e,t)};y(D,e=>{o(n).renewsAt&&e(O)}),B(b);var k=V(b,2),ee=t=>{let r=e(()=>[o(l)?`pause`:`resume`,`cancel`]);var u=Cs();v(u,20,()=>o(r),e=>e,(e,t)=>{var r=Ss();I(r,1,M(`text-muted-foreground hover:text-foreground text-[12px] transition disabled:pointer-events-none disabled:opacity-40`));var l=s(r,!0);B(r),x(()=>{r.disabled=o(se)!==null,a(l,o(c)===t?z[t].busy:z[t].idle)}),p(`click`,r,()=>void de(o(n),t)),i(e,r)}),B(u),i(t,u)};y(k,e=>{(o(l)||o(u))&&e(ee)}),B(d),x(e=>{a(h,e),a(_,o(n).status),a(S,`${o(n).approvedAmount??``}
5
+ ${o(n).currency??``} `)},[()=>o(n).description?.trim()||o(n).merchantName?.trim()||`Spending mandate`]),i(t,d)}),B(n),i(t,n)};y(Xe,e=>{o(ae)&&o(ie).length===0?e(Ze):o(ie).length===0?e(Qe,1):e($e,-1)}),B(qe),B(pe),B(fe),B(U),x(()=>{ve.disabled=o(N)||o(A)===`any`,xe.disabled=o(N)||o(A)===`any`,we.disabled=o(N)||o(A)===`any`,De.disabled=o(N),ke.disabled=o(N),q.disabled=o(N)||o(A)===`any`,ze.disabled=o(N),We.disabled=o(N)}),h(`submit`,W,le),ee(ve,()=>o(w),e=>C(w,e)),ee(xe,()=>o(T),e=>C(T,e)),ee(we,()=>o(E),e=>C(E,e)),ee(De,()=>o(D),e=>C(D,e)),ee(ke,()=>o(O),e=>C(O,e)),ne(q,()=>o(k),e=>C(k,e)),ne(ze,()=>o(A),e=>C(A,e)),ee(We,()=>o(te),e=>C(te,e)),i(t,U),R()}f([`click`]);var Os=F(`<button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill inline-flex size-7 shrink-0 items-center justify-center rounded-md transition"><!></button>`);function ks(e,t){H(t,!0);var n=Os(),r=s(n),a=e=>{Xn(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{An(e,{class:`size-3.5`,"aria-hidden":`true`})};y(r,e=>{t.theme===`dark`?e(a):e(o,-1)}),B(n),x(()=>{A(n,`aria-label`,t.theme===`dark`?`Switch to light mode`:`Switch to dark mode`),A(n,`title`,t.theme===`dark`?`Light mode`:`Dark mode`)}),p(`click`,n,()=>t.onThemeChange(t.theme===`dark`?`light`:`dark`)),i(e,n),R()}f([`click`]);var As=F(`<button type="button"><!> <span class="truncate"> </span></button>`),js=F(`<aside class="app-sidebar-panel"><div class="flex h-full min-h-0 flex-col overflow-hidden"><div class="flex items-center justify-between gap-2 px-3.5 pt-3 pb-3"><button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill inline-flex h-8 items-center gap-2 rounded-lg px-2 text-[13px] transition"><!> Back</button> <!></div> <nav class="hide-scrollbar min-h-0 flex-1 space-y-0.5 overflow-y-auto px-2.5 pb-4" aria-label="Settings"></nav></div></aside>`);function Ms(e,t){H(t,!0);let n=[{id:`account`,label:`Account`,icon:er},{id:`usage`,label:`Usage`,icon:Tt},{id:`payments`,label:`Payments`,icon:Gt},{id:`archived`,label:`Archived Threads`,icon:ht}];var r=js(),c=s(r),l=s(c),u=s(l);_t(s(u),{class:`size-3.5`,"aria-hidden":`true`}),j(),B(u),ks(V(u,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),B(l);var d=V(l,2);v(d,21,()=>n,e=>e.id,(e,n)=>{var r=As(),c=s(r);pe(c,()=>o(n).icon,(e,t)=>{t(e,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`})});var l=V(c,2),u=s(l,!0);B(l),B(r),x(()=>{I(r,1,`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-[13px] transition ${t.activePage===o(n).id?`bg-hover-fill-strong text-foreground`:`text-muted-foreground hover:bg-hover-fill hover:text-foreground`}`),A(r,`aria-current`,t.activePage===o(n).id?`page`:void 0),a(u,o(n).label)}),p(`click`,r,()=>{t.onNavigate(o(n).id)}),i(e,r)}),B(d),B(c),B(r),p(`click`,u,function(...e){t.onBack?.apply(this,e)}),i(e,r),R()}f([`click`]);var Ns=[{id:`modelUsage`,label:`Model usage`,noun:`model usage`,description:`More expensive models use up more usage.`}],Ps=[`weekly`,`monthly`],Fs=F(`<p class="text-muted-foreground text-sm leading-6">Couldn’t load your usage right now. Try again in a moment.</p>`),Is=F(`<div class="space-y-2"><div class="bg-hover-fill h-3.5 w-full rounded"></div> <div class="bg-hover-fill h-1.5 w-full rounded-full"></div></div>`),Ls=F(`<div class="space-y-5"><div class="bg-hover-fill h-3 w-28 rounded"></div> <!></div>`),Rs=F(`<div class="animate-pulse space-y-10" aria-hidden="true"><div class="bg-hover-fill h-4 w-24 rounded"></div> <!></div>`),zs=F(`<p class="text-muted-foreground mt-1 text-[12px]"> </p>`),Bs=F(`<p> </p>`),Vs=F(`<p class="text-muted-foreground mt-1.5 text-[12px]"> </p>`),Hs=F(`<div><div class="flex items-baseline justify-between gap-3"><p class="text-muted-foreground text-[13px]"> </p> <!></div> <p class="text-muted-foreground mt-0.5 text-[12px]"> </p> <div class="bg-hover-fill mt-2 h-1.5 overflow-hidden rounded-full" role="progressbar"><div></div></div> <!></div>`),Us=F(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase"> </p> <!> <div class="mt-4 space-y-6"></div></div>`),Ws=F(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase">Subscription Tier</p> <p class="text-foreground mt-3 text-[15px]"> </p></div> <!>`,1),Gs=F(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Usage</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><!></div></div></section>`);function Ks(t,n){H(n,!0);let r=Me(),d=Ne(G.usage.getMyUsage,()=>r.isAuthenticated&&!r.isLoading?{}:`skip`),f=g(l(Date.now()));c(()=>{let e=setInterval(()=>{C(f,Date.now(),!0)},6e4);return()=>{clearInterval(e)}});let p=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),m={weekly:`Weekly`,monthly:`Monthly`};function h(e,t){return e?`bg-rose-400/90`:t?`bg-amber-400/90`:`bg-foreground/25`}var _=Gs(),b=V(s(_),2),S=s(b),w=s(S),T=e=>{var t=Fs();i(e,t)},E=e=>{var t=Rs(),n=V(s(t),2);v(n,17,()=>Ns,e=>e.id,(e,t)=>{var n=Ls(),r=V(s(n),2);v(r,16,()=>Ps,e=>e,(e,t)=>{var n=Is();i(e,n)}),B(n),i(e,n)}),B(t),i(e,t)},D=t=>{var n=Ws(),r=u(n),c=V(s(r),2),l=s(c,!0);B(c),B(r);var g=V(r,2);v(g,17,()=>d.data.meters,e=>e.id,(t,n)=>{var r=Us(),c=s(r),l=s(c,!0);B(c);var u=V(c,2),d=e=>{var t=zs(),r=s(t,!0);B(t),x(()=>a(r,o(n).description)),i(e,t)};y(u,e=>{o(n).description&&e(d)});var g=V(u,2);v(g,21,()=>o(n).windows,e=>e.period,(t,r)=>{let c=e(()=>o(r).limit>0),l=e(()=>o(c)?Math.round(o(r).used/o(r).limit*100):0),u=e(()=>o(c)&&o(r).used>=o(r).limit),d=e(()=>o(c)&&o(r).used>=o(r).limit*.9);var g=Hs(),_=s(g),v=s(_),b=s(v,!0);B(v);var S=V(v,2),C=e=>{var t=Bs(),n=s(t);B(t),x(()=>{I(t,1,`text-[12px] ${o(u)?`text-destructive`:o(d)?`text-amber-800 dark:text-amber-300`:`text-muted-foreground`}`),a(n,`${o(l)??``}% used`)}),i(e,t)};y(S,e=>{o(c)&&e(C)}),B(_);var w=V(_,2),T=s(w);B(w);var E=V(w,2);A(E,`aria-valuemin`,0);var D=s(E);B(E);var O=V(E,2),k=e=>{var t=Vs(),n=s(t);B(t),x(e=>a(n,`Resets in ${e??``}`),[()=>Vi(o(r).resetsAt-o(f))]),i(e,t)};y(O,e=>{o(r).resetsAt!==null&&e(k)}),B(g),x((e,t,i,s,u)=>{a(b,m[o(r).period]),a(T,`${e??``} / ${t??``}`),A(E,`aria-label`,`${o(n).label} — ${m[o(r).period]}`),A(E,`aria-valuemax`,o(c)?o(r).limit:0),A(E,`aria-valuenow`,i),A(E,`aria-valuetext`,o(c)?`${o(l)}% used`:`0 / 0`),I(D,1,s),z(D,u)},[()=>p.format(o(c)?o(r).used:0),()=>p.format(o(c)?o(r).limit:0),()=>o(c)?Math.min(o(r).used,o(r).limit):0,()=>`h-full rounded-full transition-[width] duration-300 ${h(o(u),o(d))}`,()=>`width: ${o(c)?Math.min(100,Math.max(0,o(l))):0}%`]),i(t,g)}),B(g),B(r),x(()=>a(l,o(n).label)),i(t,r)}),x(()=>a(l,$i[d.data.tier])),i(t,n)};y(w,e=>{d.error?e(T):d.isLoading||d.data===void 0?e(E,1):e(D,-1)}),B(S),B(b),B(_),i(t,_),R()}function qs(e){if(!(!qi(e)||!Gi(e.error))&&(e.status===`cancelled`||e.status===`failed`))return{error:e.error,status:e.status}}function Js(e){let t=``,n,r=!1;for(let i of e)i.type===`text`&&i.text.length!==0&&(r&&n!==void 0&&i.turnId!==void 0&&i.turnId!==n&&(t+=`
6
+
7
+ `),t+=i.text,i.turnId!==void 0&&(n=i.turnId),r=!0);return t}function Ys(e,t){let n=new Map,r=new Set,i=t.filter(t=>{if(!t.callId)return!0;let i=e.find(e=>e.callId===t.callId&&!r.has(e.callId));return i?(n.set(t.id,i.callId),r.add(i.callId),!1):!1}),a=t=>{let a=e.filter(e=>!r.has(e.callId)),o=new Map(i.filter(e=>!n.has(e.id)).map(e=>[e.id,a.filter(n=>t(n,e))]));for(let e of i){if(n.has(e.id))continue;let t=o.get(e.id)??[];if(t.length!==1)continue;let[a]=t;i.filter(e=>!n.has(e.id)&&(o.get(e.id)??[]).some(e=>e.callId===a.callId)).length===1&&(n.set(e.id,a.callId),r.add(a.callId))}};return a((e,t)=>e.name===t.kind&&Xs(e.input,t.payload)),a((e,t)=>e.name===t.kind),n}function Xs(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>Xs(e,t[n]));if(!qi(e)||!qi(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&Xs(e[n],t[n]))}function Zs(e){return Gi(e)?e:void 0}function Qs(e){return Ki(e)?e:void 0}function $s(e,t){return qi(e)?Zs(e[t]):void 0}function ec(e){return e.name||e.job?.kind||`tool`}function tc(e){let t=[];for(let n of e){if(n.type===`text`||n.type===`reasoning`){t.push(n);continue}let e=ec(n),r=t.at(-1);if(r?.type===`tool-group`&&r.toolKey===e){r.tools.push(n);continue}t.push({type:`tool-group`,toolKey:e,tools:[n]})}return t}function nc(e){return e.type===`reasoning`?e.id:e.tools[0]?.callId??e.toolKey}function rc(e){let t=[];for(let n of e){if(n.type===`text`){t.push(n);continue}let e=t.at(-1);if(e?.type===`work`){e.blocks.push(n);continue}t.push({type:`work`,key:nc(n),blocks:[n]})}return t}function ic(e,t){for(let n of e)if(n.type===`tool-group`)for(let e of n.tools)e.job&&t(e.job)}function ac(e){let t;return ic(e,e=>{let n=e.claimedAt??e.enqueuedAt;t=t===void 0?n:Math.min(t,n)}),t}function oc(e){let t;return ic(e,e=>{e.completedAt!==void 0&&(t=t===void 0?e.completedAt:Math.max(t,e.completedAt))}),t}function sc(e){let t=[],n=[],r=0,i;for(let a of e){if(a.type!==`work`){t.push(void 0);continue}t.push(r),n.push(i);let e=oc(a.blocks);e!==void 0&&(i=i===void 0?e:Math.max(i,e)),r+=1}return{workIndexBySectionIndex:t,priorCompletedAtByWorkIndex:n}}function cc(e,t){let n=ac(e.blocks),r=t.workSectionIndex===0?t.runStartedAt:n??t.priorWorkCompletedAtMs??t.runStartedAt;return t.inProgress?{startedAtMs:r}:{startedAtMs:r,completedAtMs:oc(e.blocks)??t.runCompletedAt??r}}function lc(e){return e.output===void 0?!e.job||e.job.status===`pending`||e.job.status===`claimed`:!1}function uc(e,t){return t&&lc(e)}function dc(e){return $s(e.output,`sessionId`)??$s(e.input,`sessionId`)??$s(e.job?.payload,`sessionId`)}function fc(e){let t=new Map;for(let n of e){let e=dc(n);if(!e)continue;let r=$s(n.output,`command`)??(ec(n)===`exec_command`?$s(n.input,`cmd`)??$s(n.job?.payload,`cmd`):void 0);r&&t.set(e,r)}return t}function pc(e,t){let n=dc(e);return $s(e.output,`command`)??(n?t.get(n):void 0)}function mc(e,t){if(!t)return new Set;let n=new Map,r=new Set;for(let t of e){let e=dc(t);if(!e)continue;ec(t)===`exec_command`&&r.add(e);let i=qi(t.output)?Qs(t.output.running):void 0;i!==void 0&&n.set(e,i)}return new Set([...r].filter(e=>n.get(e)===!0))}function hc(e,t,n){let r=[],i=[];for(let a of e){if(a.type===`reasoning`){r.push(a);continue}let e=[];for(let r of a.tools){let a=ec(r),o=dc(r),s=o!==void 0&&n.has(o),c=uc(r,t);if(a===`exec_command`&&s){i.push(r);continue}if(a===`write_stdin`){if(c){s||i.push(r);continue}e.push(r);continue}c?i.push(r):e.push(r)}e.length>0&&r.push({type:`tool-group`,toolKey:a.toolKey,tools:e})}return{settledBlocks:r,runningTools:i}}function gc(e,t){return!t&&lc(e)?`interrupted`:e.job?.status===`cancelled`||e.job?.status===`failed`?e.job.status:qs(e.output)?.status}function _c(e,t){if(!t&&lc(e))return`The agent stopped before this tool call finished.`;let n=qs(e.output)?.error;return e.job?e.job.status===`cancelled`?e.job.error??n??`Executor job cancelled before completion.`:e.job.status===`failed`?e.job.error??n??`Executor job failed.`:void 0:n}function vc(e,t){let n=new Map(e.filter(e=>e.type===`tool-result`).map(e=>[e.callId,e])),r=Ys(e.filter(e=>e.type===`tool-call`),t.map(e=>({id:e._id,kind:e.kind,callId:e.callId,payload:e.payload}))),i=new Map;for(let e of t){let t=r.get(e._id);t&&i.set(t,e)}let a=[],o=new Set;for(let t of e){if(t.type===`tool-result`)continue;if(t.type===`text`||t.type===`reasoning`){t.text.trim().length>0&&a.push(t);continue}let e=n.get(t.callId),r=i.get(t.callId);r&&o.add(r._id);let s={type:`tool`,callId:t.callId,name:t.name,input:t.input};e?s.output=e.output:r?.result!==void 0&&(s.output=r.result),r&&(s.job=r),a.push(s)}for(let e of t){if(o.has(e._id))continue;let t={type:`tool`,callId:e.callId??`executor-job:${e._id}`,name:e.kind,input:e.payload,job:e};e.result!==void 0&&(t.output=e.result),a.push(t)}return a}function yc(e){switch(e){case`apply_patch`:return rn;case`ask_question`:return Lt;case`await_question`:return vn;case`check_docs`:return xt;case`create_artifact`:return tn;case`exec_command`:return Qn;case`get_workspace_instructions`:return In;case`mandate_charge`:return Ft;case`mandate_list`:return Sn;case`mandate_report`:return nr;case`mandate_setup`:return Gt;case`mandate_status`:return Sn;case`read_skill`:return Mn;case`scrape_url`:return gn;case`update_artifact`:return on;case`web_search`:return Rn;case`write_stdin`:return Kn;default:return ir}}function bc(e){return yc(e.job?.kind??e.name)}function xc(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Sc(e){switch(e){case`apply_patch`:return`Changed Files`;case`ask_question`:return`Asked Questions`;case`await_question`:return`Waiting for Answers`;case`check_docs`:return`Checked Docs`;case`create_artifact`:return`Created Artifacts`;case`exec_command`:return`Ran Commands`;case`get_workspace_instructions`:return`Read Instructions`;case`mandate_charge`:return`Charged Card`;case`mandate_list`:return`Listed Mandates`;case`mandate_report`:return`Settled Charges`;case`mandate_setup`:return`Set Up Mandate`;case`mandate_status`:return`Checked Mandate`;case`read_skill`:return`Read Skill`;case`scrape_url`:return`Read Pages`;case`update_artifact`:return`Updated Artifacts`;case`web_search`:return`Searched Web`;case`write_stdin`:return`Monitored Commands`;default:return xc(e)}}function Cc(e){if(!qi(e))return``;let t=[],n=Zs(e.workdir);return n&&n.trim().length>0&&n!==`.`&&t.push(`cwd ${n}`),t.length>0?` (${t.join(`, `)})`:``}function wc(e,t){let n=qi(t)?t:void 0;switch(e){case`apply_patch`:return jc(t)??`Patch`;case`ask_question`:return Zs(n?.question)??`Question`;case`await_question`:return`Waiting for answer`;case`check_docs`:return Zs(n?.query)??Zs(n?.path)??`Docs`;case`create_artifact`:return Zs(n?.title)??`Artifact`;case`exec_command`:{let e=Zs(n?.cmd);return e?`${e}${Cc(t)}`:`Command`}case`get_workspace_instructions`:return`Workspace instructions`;case`mandate_charge`:return Dc(n);case`mandate_list`:return`Standing mandates`;case`mandate_report`:return n?.outcome===`approved`?`Charge approved`:`Charge declined`;case`mandate_setup`:return Ec(n);case`mandate_status`:return`Mandate status`;case`read_skill`:{let e=Zs(n?.name);return e?`$${e}`:`Skill`}case`scrape_url`:return Zs(n?.url)??`Web page`;case`update_artifact`:return`Updated artifact`;case`web_search`:return Zs(n?.query)??`Web search`;case`write_stdin`:{let e=Zs(n?.sessionId);return e?`Session ${e}`:`Command session`}default:return xc(e)}}function Tc(e){return(e.job?.kind??e.name)===`apply_patch`?`whitespace-pre-wrap [overflow-wrap:anywhere]`:`truncate`}function Ec(e){let t=Zs(e?.merchantName)??`Any merchant`,n=Zs(e?.amountCap),r=Zs(e?.currency)??``,i=Zs(e?.frequency)??``;return`${t}${n?` · ${n} ${r}`.trimEnd():``}${i&&i!==`one_time`?` ${i}`:``}`}function Dc(e){let t=Zs(e?.description)??`Charge`,n=Zs(e?.amount),r=Zs(e?.currency)??``;return n?`${t} · ${n} ${r}`.trimEnd():t}var Oc=[`*** Add File: `,`*** Copy File: `,`*** Delete File: `,`*** Update File: `],kc=[`*** Copy to: `,`*** Move to: `];function Ac(e){let t=e.lastIndexOf(` "b/`);if(t>=0)return e.slice(t+4).replace(/"$/,``);let n=e.lastIndexOf(` b/`);return n>=0?e.slice(n+3):null}function jc(e){let t=qi(e)?Zs(e.patch):void 0;if(!t)return null;let n=[];for(let e of t.split(`
8
+ `)){if(e.startsWith(`diff --git `)){let t=Ac(e);t!==null&&n.push(t);continue}let t=Oc.find(t=>e.startsWith(t));if(t){n.push(e.slice(t.length).trim());continue}let r=kc.find(t=>e.startsWith(t));r&&n.length>0&&(n[n.length-1]=e.slice(r.length).trim())}let r=[...new Set(n)];return r.length>0?r.join(`
9
+ `):null}function Mc(e){if(!qi(e)||!Array.isArray(e.changes))return null;let t=e.changes.flatMap(e=>{if(!qi(e))return[];let t=Zs(e.path);return t?[t]:[]});return t.length===0?null:[...new Set(t)].join(`
10
+ `)}function Nc(e){return e.job?.kind===`apply_patch`?Mc(e.job.result)??jc(e.job.payload):e.name===`apply_patch`?jc(e.input):null}function Pc(e){return new Set(e.flatMap(e=>Nc(e)?.split(`
11
+ `)??[])).size}function Fc(e,t){if(e===`web_search`&&qi(t)&&Array.isArray(t.results)){let e=t.results.length;return` (${e} result${e===1?``:`s`})`}return e===`scrape_url`&&qi(t)&&t.truncated===!0?` (truncated)`:``}function Ic(e,t){return(e.job?.kind??e.name)===`write_stdin`?pc(e,t)??wc(`write_stdin`,e.job?.payload??e.input):e.job?Nc(e)||wc(e.job.kind,e.job.payload)+Fc(e.job.kind,e.job.result):wc(e.name,e.input)}function Lc(e,t,n){let r=Ic(e,n);if(uc(e,t))return`${r} (running)`;let i=_c(e,t);return i?`${r} (${i})`:r}function Rc(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zc(e){if(Array.isArray(e))return e}function Bc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Vc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
12
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hc(e,t){return zc(e)||Bc(e,t)||Uc(e,t)||Vc()}function Uc(e,t){if(e){if(typeof e==`string`)return Rc(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rc(e,t):void 0}}var Wc=Object.entries,Gc=Object.setPrototypeOf,Kc=Object.isFrozen,qc=Object.getPrototypeOf,Jc=Object.getOwnPropertyDescriptor,Yc=Object.freeze,Xc=Object.seal,Zc=Object.create,Qc=typeof Reflect<`u`&&Reflect,$c=Qc.apply,el=Qc.construct;Yc||=function(e){return e},Xc||=function(e){return e},$c||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},el||=function(e){return new e(...[...arguments].slice(1))};var tl=xl(Array.prototype.forEach),nl=xl(Array.prototype.lastIndexOf),rl=xl(Array.prototype.pop),il=xl(Array.prototype.push),al=xl(Array.prototype.splice),ol=Array.isArray,sl=xl(String.prototype.toLowerCase),cl=xl(String.prototype.toString),ll=xl(String.prototype.match),ul=xl(String.prototype.replace),dl=xl(String.prototype.indexOf),fl=xl(String.prototype.trim),pl=xl(Number.prototype.toString),ml=xl(Boolean.prototype.toString),hl=typeof BigInt>`u`?null:xl(BigInt.prototype.toString),gl=typeof Symbol>`u`?null:xl(Symbol.prototype.toString),_l=xl(Object.prototype.hasOwnProperty),vl=xl(Object.prototype.toString),yl=xl(RegExp.prototype.test),bl=Sl(TypeError);function xl(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return $c(e,t,n)}}function Sl(e){return function(){return el(e,[...arguments])}}function Cl(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sl;if(Gc&&Gc(e,null),!ol(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Kc(t)||(t[r]=e),i=e)}e[i]=!0}return e}function wl(e){for(let t=0;t<e.length;t++)_l(e,t)||(e[t]=null);return e}function Tl(e){let t=Zc(null);for(let r of Wc(e)){var n=Hc(r,2);let i=n[0],a=n[1];_l(e,i)&&(t[i]=ol(a)?wl(a):a&&typeof a==`object`&&a.constructor===Object?Tl(a):a)}return t}function El(e){switch(typeof e){case`string`:return e;case`number`:return pl(e);case`boolean`:return ml(e);case`bigint`:return hl?hl(e):`0`;case`symbol`:return gl?gl(e):`Symbol()`;case`undefined`:return vl(e);case`function`:case`object`:{if(e===null)return vl(e);let t=e,n=Dl(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:vl(e)}return vl(e)}default:return vl(e)}}function Dl(e,t){for(;e!==null;){let n=Jc(e,t);if(n){if(n.get)return xl(n.get);if(typeof n.value==`function`)return xl(n.value)}e=qc(e)}function n(){return null}return n}function Ol(e){try{return yl(e,``),!0}catch{return!1}}var kl=Yc(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Al=Yc(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),jl=Yc([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ml=Yc([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Nl=Yc(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Pl=Yc([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Fl=Yc([`#text`]),Il=Yc(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Ll=Yc(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Rl=Yc(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),zl=Yc([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Bl=Xc(/{{[\w\W]*|^[\w\W]*}}/g),Vl=Xc(/<%[\w\W]*|^[\w\W]*%>/g),Hl=Xc(/\${[\w\W]*/g),Ul=Xc(/^data-[\-\w.\u00B7-\uFFFF]+$/),Wl=Xc(/^aria-[\-\w]+$/),Gl=Xc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Kl=Xc(/^(?:\w+script|data):/i),ql=Xc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jl=Xc(/^html$/i),Yl=Xc(/^[a-z][.\w]*(-[.\w]+)+$/i),Xl=Xc(/<[/\w!]/g),Zl=Xc(/<[/\w]/g),Ql=Xc(/<\/no(script|embed|frames)/i),$l=Xc(/\/>/i),eu={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},tu=function(){return typeof window>`u`?null:window},nu=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ru=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},iu=function(e,t,n,r){return _l(e,t)&&ol(e[t])?Cl(r.base?Tl(r.base):{},e[t],r.transform):n};function au(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tu(),t=e=>au(e);if(t.version=`3.4.13`,t.removed=[],!e||!e.document||e.document.nodeType!==eu.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Dl(d,`cloneNode`),p=Dl(d,`remove`),m=Dl(d,`nextSibling`),h=Dl(d,`childNodes`),g=Dl(d,`parentNode`),_=Dl(d,`shadowRoot`),v=Dl(d,`attributes`),y=o&&o.prototype?Dl(o.prototype,`nodeType`):null,b=o&&o.prototype?Dl(o.prototype,`nodeName`):null,x=o&&o.prototype?Dl(o.prototype,`ownerDocument`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let S,C=``,w,T=!1,E=0,D=function(){if(E>0)throw bl(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},O=function(e){D(),E++;try{return S.createHTML(e)}finally{E--}},k=function(e){D(),E++;try{return S.createScriptURL(e)}finally{E--}},ee=function(){return T||=(w=nu(u,i),!0),w},A=n,te=A.implementation,ne=A.createNodeIterator,j=A.createDocumentFragment,M=A.getElementsByTagName,N=r.importNode,P=ru();t.isSupported=typeof Wc==`function`&&typeof g==`function`&&te&&te.createHTMLDocument!==void 0;let re=Bl,F=Vl,ie=Hl,I=Ul,ae=Wl,oe=Kl,se=ql,L=Yl,R=Gl,z=null,B=Cl({},[...kl,...Al,...jl,...Nl,...Fl]),V=null,ce=Cl({},[...Il,...Ll,...Rl,...zl]),H=Object.seal(Zc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),le=null,ue=null,de=Object.seal(Zc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),U=!0,fe=!0,pe=!1,me=!0,W=!1,he=!0,ge=!1,_e=!1,ve=null,ye=null,be=!1,G=!1,xe=!1,Se=!1,Ce=!0,we=!1,Te=`user-content-`,Ee=!0,De=!1,K={},Oe=null,ke=Cl({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ae=null,je=Cl({},[`audio`,`video`,`img`,`source`,`image`,`track`]),q=null,Me=Cl({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ne=`http://www.w3.org/1998/Math/MathML`,Pe=`http://www.w3.org/2000/svg`,Fe=`http://www.w3.org/1999/xhtml`,Ie=Fe,J=!1,Le=null,Re=Cl({},[Ne,Pe,Fe],cl),ze=Yc([`mi`,`mo`,`mn`,`ms`,`mtext`]),Be=Cl({},ze),Ve=Yc([`annotation-xml`]),He=Cl({},Ve),Ue=Cl({},[`title`,`style`,`font`,`a`,`script`]),We=null,Ge=[`application/xhtml+xml`,`text/html`],Y=null,Ke=null,X=n.createElement(`form`),qe=function(e){return e instanceof RegExp||e instanceof Function},Je=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ke&&Ke===e)return;(!e||typeof e!=`object`)&&(e={}),e=Tl(e),We=Ge.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=We===`application/xhtml+xml`?cl:sl,z=iu(e,`ALLOWED_TAGS`,B,{transform:Y}),V=iu(e,`ALLOWED_ATTR`,ce,{transform:Y}),Le=iu(e,`ALLOWED_NAMESPACES`,Re,{transform:cl}),q=iu(e,`ADD_URI_SAFE_ATTR`,Me,{transform:Y,base:Me}),Ae=iu(e,`ADD_DATA_URI_TAGS`,je,{transform:Y,base:je}),Oe=iu(e,`FORBID_CONTENTS`,ke,{transform:Y}),le=iu(e,`FORBID_TAGS`,Tl({}),{transform:Y}),ue=iu(e,`FORBID_ATTR`,Tl({}),{transform:Y}),K=_l(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Tl(e.USE_PROFILES):e.USE_PROFILES:!1,U=e.ALLOW_ARIA_ATTR!==!1,fe=e.ALLOW_DATA_ATTR!==!1,pe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,me=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,W=e.SAFE_FOR_TEMPLATES||!1,he=e.SAFE_FOR_XML!==!1,ge=e.WHOLE_DOCUMENT||!1,G=e.RETURN_DOM||!1,xe=e.RETURN_DOM_FRAGMENT||!1,Se=e.RETURN_TRUSTED_TYPE||!1,be=e.FORCE_BODY||!1,Ce=e.SANITIZE_DOM!==!1,we=e.SANITIZE_NAMED_PROPS||!1,Ee=e.KEEP_CONTENT!==!1,De=e.IN_PLACE||!1,R=Ol(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Gl,Ie=typeof e.NAMESPACE==`string`?e.NAMESPACE:Fe,Be=_l(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Tl(e.MATHML_TEXT_INTEGRATION_POINTS):Cl({},ze),He=_l(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Tl(e.HTML_INTEGRATION_POINTS):Cl({},Ve);let t=_l(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Tl(e.CUSTOM_ELEMENT_HANDLING):Zc(null);if(H=Zc(null),_l(t,`tagNameCheck`)&&qe(t.tagNameCheck)&&(H.tagNameCheck=t.tagNameCheck),_l(t,`attributeNameCheck`)&&qe(t.attributeNameCheck)&&(H.attributeNameCheck=t.attributeNameCheck),_l(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(H.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Xc(H),W&&(fe=!1),xe&&(G=!0),K&&(z=Cl({},Fl),V=Zc(null),K.html===!0&&(Cl(z,kl),Cl(V,Il)),K.svg===!0&&(Cl(z,Al),Cl(V,Ll),Cl(V,zl)),K.svgFilters===!0&&(Cl(z,jl),Cl(V,Ll),Cl(V,zl)),K.mathMl===!0&&(Cl(z,Nl),Cl(V,Rl),Cl(V,zl))),de.tagCheck=null,de.attributeCheck=null,_l(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?de.tagCheck=e.ADD_TAGS:ol(e.ADD_TAGS)&&(z===B&&(z=Tl(z)),Cl(z,e.ADD_TAGS,Y))),_l(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?de.attributeCheck=e.ADD_ATTR:ol(e.ADD_ATTR)&&(V===ce&&(V=Tl(V)),Cl(V,e.ADD_ATTR,Y))),_l(e,`ADD_URI_SAFE_ATTR`)&&ol(e.ADD_URI_SAFE_ATTR)&&Cl(q,e.ADD_URI_SAFE_ATTR,Y),_l(e,`FORBID_CONTENTS`)&&ol(e.FORBID_CONTENTS)&&(Oe===ke&&(Oe=Tl(Oe)),Cl(Oe,e.FORBID_CONTENTS,Y)),_l(e,`ADD_FORBID_CONTENTS`)&&ol(e.ADD_FORBID_CONTENTS)&&(Oe===ke&&(Oe=Tl(Oe)),Cl(Oe,e.ADD_FORBID_CONTENTS,Y)),Ee&&(z[`#text`]=!0),ge&&Cl(z,[`html`,`head`,`body`]),z.table&&(Cl(z,[`tbody`]),delete le.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw bl(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw bl(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=S;S=e.TRUSTED_TYPES_POLICY;try{C=O(``)}catch(e){throw S=t,e}}else e.TRUSTED_TYPES_POLICY===null?(S=void 0,C=``):(S===void 0&&(S=ee()),S&&typeof C==`string`&&(C=O(``)));Yc&&Yc(e),Ke=e},Ye=Cl({},[...Al,...jl,...Ml]),Xe=Cl({},[...Nl,...Pl]),Ze=function(e,t,n){return t.namespaceURI===Fe?e===`svg`:t.namespaceURI===Ne?e===`svg`&&(n===`annotation-xml`||Be[n]):!!Ye[e]},Qe=function(e,t,n){return t.namespaceURI===Fe?e===`math`:t.namespaceURI===Pe?e===`math`&&He[n]:!!Xe[e]},$e=function(e,t,n){return t.namespaceURI===Pe&&!He[n]||t.namespaceURI===Ne&&!Be[n]?!1:!Xe[e]&&(Ue[e]||!Ye[e])},et=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ie,tagName:`template`});let n=sl(e.tagName),r=sl(t.tagName);return Le[e.namespaceURI]?e.namespaceURI===Pe?Ze(n,t,r):e.namespaceURI===Ne?Qe(n,t,r):e.namespaceURI===Fe?$e(n,t,r):!!(We===`application/xhtml+xml`&&Le[e.namespaceURI]):!1},tt=function(e){il(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw bl(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},nt=function(e){at(e);let t=h(e);if(t){let e=[];tl(t,t=>{il(e,t)}),tl(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},rt=function(e,n){try{il(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{il(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`){if(G||xe)try{tt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},it=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||V[Y(i)]))try{e.removeAttribute(i)}catch{}}},at=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===eu.element&&it(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ot=function(e){if(!he)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===eu.processingInstruction||n===eu.comment&&yl(Zl,e.data)){try{p(e)}catch{}continue}if(n===eu.element){let t=e,n=Y(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},st=function(e){let t=null,r=null;if(be)e=`<remove></remove>`+e;else{let t=ll(e,/^[\r\n\t ]+/);r=t&&t[0]}We===`application/xhtml+xml`&&Ie===Fe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=S?O(e):e;if(Ie===Fe)try{t=new l().parseFromString(i,We)}catch{}if(!t||!t.documentElement){t=te.createDocument(Ie,`template`,null);try{t.documentElement.innerHTML=J?C:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ie===Fe?M.call(t,ge?`html`:`body`)[0]:ge?t.documentElement:a},Z=function(e){let t=x?x(e):e.ownerDocument;return ne.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ct=function(e){return e=ul(e,re,` `),e=ul(e,F,` `),e=ul(e,ie,` `),e},lt=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=ne.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=ct(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&tl(i,e=>{dt(e.content)&&lt(e.content)})},ut=function(e){let t=b?b(e):null;return typeof t!=`string`||Y(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},dt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===eu.documentFragment}catch{return!1}},ft=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function pt(e,n,r){e.length!==0&&tl(e,e=>{e.call(t,n,r,Ke)})}let Q=function(e,t){return!!(he&&e.hasChildNodes()&&!ft(e.firstElementChild)&&yl(Xl,e.textContent)&&yl(Xl,e.innerHTML)||he&&e.namespaceURI===Fe&&t===`style`&&ft(e.firstElementChild)||e.nodeType===eu.processingInstruction||he&&e.nodeType===eu.comment&&yl(Zl,e.data))},mt=function(e,t,n){if(!le[t]&&yt(t)&&(H.tagNameCheck instanceof RegExp&&yl(H.tagNameCheck,t)||H.tagNameCheck instanceof Function&&H.tagNameCheck(t)))return!1;if(Ee&&!Oe[t]){let t=g(e),r=h(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,m(e))}}}return tt(e),!0},ht=function(e,t,n,r){return e.length===0?t:t===n||t===r?Tl(t):t},gt=function(e,n){if(pt(P.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return De&&at(e),!0;if(ut(e))return tt(e),!0;let r=Y(b?b(e):e.nodeName);if(z=ht(P.uponSanitizeElement,z,B,ve),pt(P.uponSanitizeElement,e,{tagName:r,allowedTags:z}),e!==n&&g(e)===null)return De&&at(e),!0;if(Q(e,r))return tt(e),!0;if(le[r]||!(de.tagCheck instanceof Function&&de.tagCheck(r))&&!z[r]){let t=mt(e,r,n);return t===!1&&pt(P.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===eu.element&&!et(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&yl(Ql,e.innerHTML))return tt(e),!0;if(W&&e.nodeType===eu.text){let n=ct(e.textContent);e.textContent!==n&&(il(t.removed,{element:e.cloneNode()}),e.textContent=n)}return pt(P.afterSanitizeElements,e,null),!1},_t=function(e,t,r){if(ue[t]||he&&t===`patchsrc`||he&&t===`for`&&e!==`label`&&e!==`output`||Ce&&(t===`id`||t===`name`)&&(r in n||r in X))return!1;let i=V[t]||de.attributeCheck instanceof Function&&de.attributeCheck(t,e);if(!(fe&&yl(I,t))&&!(U&&yl(ae,t))){if(!i){if(!(yt(e)&&(H.tagNameCheck instanceof RegExp&&yl(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&yl(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t,e))||t===`is`&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&yl(H.tagNameCheck,r)||H.tagNameCheck instanceof Function&&H.tagNameCheck(r))))return!1}else if(!q[t]&&!yl(R,ul(r,se,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&dl(r,`data:`)===0&&Ae[e])&&!(pe&&!yl(oe,ul(r,se,``)))&&r)return!1}return!0},vt=Cl({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),yt=function(e){return!vt[sl(e)]&&yl(L,e)},bt=function(e,t,n,r){if(S&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return O(r);case`TrustedScriptURL`:return k(r)}return r},xt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),ut(e)?tt(e):rl(t.removed)}catch{rt(n,e)}},St=function(e){pt(P.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||ut(e))return;V=ht(P.uponSanitizeAttribute,V,ce,ye);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0},r=t.length,i=Y(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Y(o),u=c,d=o===`value`?u:fl(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,pt(P.uponSanitizeAttribute,e,n),d=n.attrValue,we&&(l===`id`||l===`name`)&&dl(d,Te)!==0&&(rt(o,e),d=Te+d),he&&yl(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){rt(o,e);continue}if(l===`attributename`&&ll(d,`href`)){rt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){rt(o,e);continue}if(!me&&yl($l,d)){rt(o,e);continue}if(W&&(d=ct(d)),!_t(i,l,d)){rt(o,e);continue}d=bt(i,l,s,d),d!==u&&xt(e,o,s,d)}}pt(P.afterSanitizeAttributes,e,null)},Ct=function(e){let t=null,n=Z(e);for(pt(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(pt(P.uponSanitizeShadowNode,t,null),gt(t,e),St(t),dt(t.content)&&Ct(t.content),(y?y(t):t.nodeType)===eu.element){let e=_(t);dt(e)&&(wt(e),Ct(e))}pt(P.afterSanitizeShadowDOM,e,null)},wt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ct(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===eu.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Y(e)===`template`){let e=n.content;dt(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);dt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(J=!e,J&&(e=`<!-->`),typeof e!=`string`&&!ft(e)&&(e=El(e),typeof e!=`string`))throw bl(`dirty is not a string, aborting`);if(!t.isSupported)return e;_e?(z=ve,V=ye):Je(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(z=Tl(z)),P.uponSanitizeAttribute.length>0&&(V=Tl(V)),t.removed=[];let c=De&&typeof e!=`string`&&ft(e);if(c){ot(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=Y(t);if(!z[n]||le[n])throw nt(e),bl(`root node is forbidden and cannot be sanitized in-place`)}if(ut(e))throw nt(e),bl(`root node is clobbered and cannot be sanitized in-place`);try{wt(e)}catch(t){throw nt(e),t}}else if(ft(e))i=st(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===eu.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),wt(a);else{if(!G&&!W&&!ge&&e.indexOf(`<`)===-1)return S&&Se?O(e):e;if(i=st(e),!i)return G?null:Se?C:``}i&&be&&tt(i.firstChild);let l=c?e:i;try{let e=Z(l);for(;o=e.nextNode();)gt(o,l),St(o),dt(o.content)&&Ct(o.content)}catch(n){throw c&&(nt(e),tl(t.removed,e=>{e.element&&at(e.element)})),n}if(c)return tl(t.removed,e=>{e.element&&at(e.element)}),W&&lt(e),e;if(G){if(W&&lt(i),xe)for(s=j.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(V.shadowroot||V.shadowrootmode)&&(s=N.call(r,s,!0)),s}let u=ge?i.outerHTML:i.innerHTML;return ge&&z[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&yl(Jl,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
13
+ `+u),W&&(u=ct(u)),S&&Se?O(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Je(e),_e=!0,ve=z,ye=V},t.clearConfig=function(){Ke=null,_e=!1,ve=null,ye=null,S=w,C=``},t.isValidAttribute=function(e,t,n){Ke||Je({});let r=Y(e),i=Y(t);return _t(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&_l(P,e)&&il(P[e],t)},t.removeHook=function(e,t){if(_l(P,e)){if(t!==void 0){let n=nl(P[e],t);return n===-1?void 0:al(P[e],n,1)[0]}return rl(P[e])}},t.removeHooks=function(e){_l(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=ru()},t}var ou=au(),su=ou;ou.sanitize.bind(ou),ou.isSupported,ou.addHook.bind(ou),ou.removeHook.bind(ou),ou.removeHooks.bind(ou),ou.removeAllHooks.bind(ou),ou.setConfig.bind(ou),ou.clearConfig.bind(ou),ou.isValidAttribute.bind(ou),ou.version,ou.removed;function cu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var lu=cu();function uu(e){lu=e}var du={exec:()=>null};function fu(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function $(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(mu.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var pu=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),mu={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:fu(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:fu(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:fu(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:fu(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:fu(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:fu(e=>RegExp(`^ {0,${e}}>`))},hu=/^(?:[ \t]*(?:\n|$))+/,gu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_u=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Su=$(xu).replace(/bull/g,bu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Cu=$(xu).replace(/bull/g,bu).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),wu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Tu=/^[^\n]+/,Eu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Du=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Eu).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ou=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,bu).getRegex(),ku=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Au=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ju=$(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Au).replace(`tag`,ku).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mu=e=>$(wu).replace(`hr`,vu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ku).getRegex(),Nu=Mu(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Pu=Mu(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Fu={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Pu).getRegex(),code:gu,def:Du,fences:_u,heading:yu,hr:vu,html:ju,lheading:Su,list:Ou,newline:hu,paragraph:Nu,table:du,text:Tu},Iu=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,vu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ku).getRegex(),Lu={...Fu,lheading:Cu,table:Iu,paragraph:$(wu).replace(`hr`,vu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Iu).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,ku).getRegex()},Ru={...Fu,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Au).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:du,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(wu).replace(`hr`,vu).replace(`heading`,` *#{1,6} *[^
14
+ ]`).replace(`lheading`,Su).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},zu=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bu=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Vu=/^( {2,}|\\)\n(?!\s*$)/,Hu=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Uu=/[\p{P}\p{S}]/u,Wu=/[\s\p{P}\p{S}]/u,Gu=/[^\s\p{P}\p{S}]/u,Ku=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Wu).getRegex(),qu=/[\p{Pi}\p{Ps}"']/u,Ju=/(?!~)[\p{P}\p{S}]/u,Yu=/(?!~)[\s\p{P}\p{S}]/u,Xu=/(?:[^\s\p{P}\p{S}]|~)/u,Zu=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,pu?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Qu=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,$u=$(Qu,`u`).replace(/punct/g,Uu).getRegex(),ed=$(Qu,`u`).replace(/punct/g,Ju).getRegex(),td=$(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,qu).replace(/punct/g,Uu).getRegex(),nd=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,rd=$(nd,`gu`).replace(/notPunctSpace/g,Gu).replace(/punctSpace/g,Wu).replace(/punct/g,Uu).getRegex(),id=$(nd,`gu`).replace(/notPunctSpace/g,Xu).replace(/punctSpace/g,Yu).replace(/punct/g,Ju).getRegex(),ad=$(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Gu).replace(/punctSpace/g,Wu).replace(/punct/g,Uu).getRegex(),od=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Gu).replace(/punctSpace/g,Wu).replace(/punct/g,Uu).getRegex(),sd=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Gu).replace(/punctSpace/g,Wu).replace(/punct/g,Uu).getRegex(),cd=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Uu).getRegex(),ld=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Gu).replace(/punctSpace/g,Wu).replace(/punct/g,Uu).getRegex(),ud=$(/\\(punct)/,`gu`).replace(/punct/g,Uu).getRegex(),dd=$(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),fd=$(Au).replace(`(?:-->|$)`,`-->`).getRegex(),pd=$(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,fd).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),md=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,hd=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,md).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gd=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,md).replace(`ref`,Eu).getRegex(),_d=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Eu).getRegex(),vd=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,gd).replace(`nolink`,_d).getRegex(),yd=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bd={_backpedal:du,anyPunctuation:ud,autolink:dd,blockSkip:Zu,br:Vu,code:Bu,del:du,delLDelim:du,delRDelim:du,emStrongLDelim:$u,emStrongRDelimAst:rd,emStrongRDelimUnd:od,escape:zu,link:hd,nolink:_d,punctuation:Ku,reflink:gd,reflinkSearch:vd,tag:pd,text:Hu,url:du},xd={...bd,emStrongLDelim:td,emStrongRDelimAst:ad,emStrongRDelimUnd:sd,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,md).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,md).getRegex()},Sd={...bd,emStrongRDelimAst:id,emStrongLDelim:ed,delLDelim:cd,delRDelim:ld,url:$(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,yd).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,yd).getRegex()},Cd={...Sd,br:$(Vu).replace(`{2,}`,`*`).getRegex(),text:$(Sd.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},wd={normal:Fu,gfm:Lu,pedantic:Ru},Td={normal:bd,gfm:Sd,breaks:Cd,pedantic:xd},Ed={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Dd=e=>Ed[e];function Od(e,t){if(t){if(mu.escapeTest.test(e))return e.replace(mu.escapeReplace,Dd)}else if(mu.escapeTestNoEncode.test(e))return e.replace(mu.escapeReplaceNoEncode,Dd);return e}function kd(e){try{e=encodeURI(e).replace(mu.percentDecode,`%`)}catch{return null}return e}function Ad(e,t){let n=e.replace(mu.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(mu.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(mu.slashPipe,`|`);return n}function jd(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Md(e){let t=e.split(`
15
+ `),n=t.length-1;for(;n>=0&&mu.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
16
+ `)}function Nd(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Pd(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Fd(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Id(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
17
+ `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
18
+ `)}var Ld=class{options;rules;lexer;constructor(e){this.options=e||lu}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Md(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Id(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=jd(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:jd(t[0],`
19
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:jd(t[0],`
20
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=jd(t[0],`
21
+ `).split(`
22
+ `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
23
+ `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
24
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
25
+ ${s}`:s,r=r?`${r}
26
+ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
27
+ `),o=t.raw+`
28
+ `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s,n=`${n}
29
+ ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
30
+ `+e.join(`
31
+ `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
32
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Pd(t[2].split(`
33
+ `,1)[0],t[1].length),l=e.split(`
34
+ `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
35
+ `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
36
+ `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
37
+ `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
38
+ `+l}u=!l.trim(),r+=p+`
39
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Md(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:jd(t[0],`
40
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ad(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
41
+ `):[],a={type:`table`,raw:jd(t[0],`
42
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ad(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:jd(t[0],`
43
+ `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
44
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=jd(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Nd(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),Fd(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Fd(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Rd=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||lu,this.options.tokenizer=this.options.tokenizer||new Ld,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:mu,block:wd.normal,inline:Td.normal};this.options.pedantic?(t.block=wd.pedantic,t.inline=Td.pedantic):this.options.gfm&&(t.block=wd.gfm,t.inline=this.options.breaks?Td.breaks:Td.gfm),this.tokenizer.rules=t}static get rules(){return{block:wd,inline:Td}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(mu.carriageReturn,`
45
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(mu.tabCharGlobal,` `).replace(mu.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
46
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
47
+ `)?``:`
48
+ `)+i.raw,n.text+=`
49
+ `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
50
+ `)?``:`
51
+ `)+i.raw,n.text+=`
52
+ `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
53
+ `)?``:`
54
+ `)+i.raw,r.text+=`
55
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
56
+ `)?``:`
57
+ `)+i.raw,n.text+=`
58
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},zd=class{options;parser;constructor(e){this.options=e||lu}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(mu.notSpaceStart)?.[0],i=e.replace(mu.endingNewline,``)+`
59
+ `;return r?`<pre><code class="language-`+Od(r)+`">`+(n?i:Od(i,!0))+`</code></pre>
60
+ `:`<pre><code>`+(n?i:Od(i,!0))+`</code></pre>
61
+ `}blockquote({tokens:e}){return`<blockquote>
62
+ ${this.parser.parse(e)}</blockquote>
63
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
64
+ `}hr(e){return`<hr>
65
+ `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
66
+ `+r+`</`+i+`>
67
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
68
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
69
+ `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
70
+ <thead>
71
+ `+t+`</thead>
72
+ `+r+`</table>
73
+ `}tablerow({text:e}){return`<tr>
74
+ ${e}</tr>
75
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
76
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Od(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=kd(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Od(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=kd(e);if(i===null)return Od(n);e=i;let a=`<img src="${e}" alt="${Od(n)}"`;return t&&(a+=` title="${Od(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Od(e.text)}},Bd=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Vd=class e{options;renderer;textRenderer;constructor(e){this.options=e||lu,this.options.renderer=this.options.renderer||new zd,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Bd}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Hd=class{options;block;constructor(e){this.options=e||lu}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Rd.lex:Rd.lexInline}provideParser(e=this.block){return e?Vd.parse:Vd.parseInline}},Ud=new class{defaults=cu();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Vd;Renderer=zd;TextRenderer=Bd;Lexer=Rd;Tokenizer=Ld;Hooks=Hd;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new zd(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Ld(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Hd;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Hd.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Hd.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Rd.lex(e,t??this.defaults)}parser(e,t){return Vd.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?Rd.lex:Rd.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Vd.parse:Vd.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?Rd.lex:Rd.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Vd.parse:Vd.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
77
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Od(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Wd(e,t){return Ud.parse(e,t)}Wd.options=Wd.setOptions=function(e){return Ud.setOptions(e),Wd.defaults=Ud.defaults,uu(Wd.defaults),Wd},Wd.getDefaults=cu,Wd.defaults=lu;function Gd(...e){return Ud.use(...e),Wd.defaults=Ud.defaults,uu(Wd.defaults),Wd}Wd.use=Gd,Wd.walkTokens=function(e,t){return Ud.walkTokens(e,t)},Wd.parseInline=Ud.parseInline,Wd.Parser=Vd,Wd.parser=Vd.parse,Wd.Renderer=zd,Wd.TextRenderer=Bd,Wd.Lexer=Rd,Wd.lexer=Rd.lex,Wd.Tokenizer=Ld,Wd.Hooks=Hd,Wd.parse=Wd,Wd.options,Wd.setOptions,Wd.walkTokens,Wd.parseInline,Vd.parse,Rd.lex,Wd.setOptions({gfm:!0,breaks:!0});function Kd(e){let t=Wd.parse(e,{async:!1});return su.sanitize(t,{ADD_ATTR:[`target`,`rel`]})}var qd=F(`<div></div>`);function Jd(t,n){H(n,!0);let r=P(n,`className`,3,``),a=e(()=>Kd(n.content));var s=qd();fe(s,()=>o(a),!0),B(s),x(e=>I(s,1,e),[()=>M(J(`chat-markdown`,r()))]),i(t,s),R()}var Yd=F(`<p class="border-border absolute right-3 bottom-14 max-w-[min(20rem,calc(100%-1.5rem))] rounded-lg border bg-black/80 px-3 py-2 text-xs text-amber-100 shadow-lg backdrop-blur-sm" role="alert"> </p>`),Xd=F(`<div class="bg-background/92 fixed inset-0 z-50 flex items-center justify-center px-3 py-4 sm:px-6 sm:py-12" role="presentation"><div class="relative inline-flex max-h-full max-w-full outline-none" role="dialog" aria-modal="true" tabindex="-1"><img class="border-border block max-h-[calc(100dvh-2rem)] max-w-full rounded-2xl border object-contain sm:max-h-[calc(100dvh-6rem)]"/> <div class="absolute right-3 bottom-3 flex items-center gap-2"><button type="button"><!></button> <button type="button"><!></button></div> <span class="sr-only" aria-live="polite"> </span> <!></div></div>`);function Zd(t,n){H(n,!0);let r=g(null),l=g(!1),f=g(!1),h=g(!1),_=g(null),v=g(null),b=null,S=0;function w(e){switch(e){case`image/jpeg`:return`jpg`;case`image/png`:return`png`;case`image/gif`:return`gif`;case`image/webp`:return`webp`;default:return}}function T(e){let t=e.name.trim()||`image`,n=w(e.mediaType);if(!n)return t;let r=t.match(/\.([a-z0-9]{2,5})$/i);return r?(e.mediaType===`image/jpeg`?[`jpg`,`jpeg`]:[n]).includes(r[1].toLowerCase())?t:`${t.slice(0,-r[0].length)}.${n}`:`${t}.${n}`}c(()=>{if(S+=1,!n.image)return;C(l,!1),C(f,!1),C(h,!1),C(_,null),C(v,null);let e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=!1;d().then(()=>{t||o(r)?.focus()});let i=document.body.style.overflow;document.body.style.overflow=`hidden`;function a(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n.onClose();return}if(e.key!==`Tab`||!o(r))return;let t=Array.from(o(r).querySelectorAll(`button:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`));if(t.length===0){e.preventDefault(),o(r).focus();return}let i=t[0],a=t[t.length-1],s=document.activeElement;e.shiftKey&&(s===o(r)||s===i||!o(r).contains(s))?(e.preventDefault(),a.focus()):!e.shiftKey&&(s===o(r)||s===a||!o(r).contains(s))&&(e.preventDefault(),i.focus())}return window.addEventListener(`keydown`,a,!0),()=>{t=!0,window.removeEventListener(`keydown`,a,!0),document.body.style.overflow=i,b!==null&&(window.clearTimeout(b),b=null),e?.isConnected&&e.focus()}});async function E(e){let t=await fetch(e.url);if(!t.ok)throw Error(`Fetch failed with status ${t.status}`);return t.blob()}async function D(e){if(e.type===`image/png`)return e;let t=await createImageBitmap(e);try{let e=document.createElement(`canvas`);e.width=t.width,e.height=t.height;let n=e.getContext(`2d`);if(!n)throw Error(`Canvas 2D context unavailable`);return n.drawImage(t,0,0),await new Promise((t,n)=>{e.toBlob(e=>e?t(e):n(Error(`PNG encoding failed`)),`image/png`)})}finally{t.close()}}async function O(e){if(o(f))return;let t=S;C(f,!0),C(_,null),C(v,null);try{if(!globalThis.ClipboardItem)throw Error(`Clipboard images unsupported`);let n=E(e).then(D);if(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),t!==S)return;C(l,!0),b!==null&&window.clearTimeout(b),b=window.setTimeout(()=>{C(l,!1),b=null},2e3)}catch{t===S&&(C(l,!1),C(_,`Could not copy the image to the clipboard.`))}finally{t===S&&C(f,!1)}}async function k(e){if(o(h))return;let t=S;C(h,!0),C(_,null),C(v,null);try{let n=await E(e);if(t!==S)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=T(e),document.body.append(i);try{i.click()}finally{i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e4)}}catch{t===S&&C(v,`Could not download the image.`)}finally{t===S&&C(h,!1)}}let ee=`inline-flex size-9 items-center justify-center rounded-lg border border-white/15 bg-black/65 text-white shadow-lg backdrop-blur-sm transition hover:bg-black/80 focus-visible:ring-2 focus-visible:ring-white/50 focus-visible:outline-none aria-disabled:cursor-wait aria-disabled:opacity-60`;var te=m(),ne=u(te),j=t=>{let c=e(()=>n.image);var u=Xd(),d=s(u),m=s(d),g=V(m,2),b=s(g);I(b,1,M(ee));var S=s(b),w=e=>{wn(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},T=e=>{Dt(e,{class:`size-4`,"aria-hidden":`true`})},E=e=>{Vt(e,{class:`size-4`,"aria-hidden":`true`})};y(S,e=>{o(f)?e(w):o(l)?e(T,1):e(E,-1)}),B(b);var D=V(b,2);I(D,1,M(ee));var te=s(D),ne=e=>{wn(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},j=e=>{qt(e,{class:`size-4`,"aria-hidden":`true`})};y(te,e=>{o(h)?e(ne):e(j,-1)}),B(D),B(g);var N=V(g,2),P=s(N,!0);B(N);var re=V(N,2),F=e=>{var t=Yd(),n=s(t,!0);B(t),x(()=>a(n,o(_)??o(v))),i(e,t)};y(re,e=>{(o(_)||o(v))&&e(F)}),B(d),ce(d,e=>C(r,e),()=>o(r)),B(u),x(()=>{A(d,`aria-label`,`Image preview: ${o(c).name??``}`),A(m,`src`,o(c).url),A(m,`alt`,o(c).name),A(b,`aria-disabled`,o(f)),A(b,`aria-label`,o(f)?`Copying image`:o(l)?`Image copied`:`Copy image`),A(b,`title`,o(f)?`Copying image`:o(l)?`Image copied`:`Copy image`),A(D,`aria-disabled`,o(h)),A(D,`aria-label`,o(h)?`Downloading image`:`Download image`),A(D,`title`,o(h)?`Downloading image`:`Download image`),a(P,o(f)?`Copying image`:o(l)?`Image copied`:o(h)?`Downloading image`:``)}),p(`click`,u,e=>{e.target===e.currentTarget&&n.onClose()}),p(`click`,b,()=>void O(o(c))),p(`click`,D,()=>void k(o(c))),i(t,u)};y(ne,e=>{n.image&&e(j)}),i(t,te),R()}f([`click`]);var Qd=F(`<button type="button" class="border-border hover:border-border focus-visible:ring-ring/40 block size-14 cursor-zoom-in overflow-hidden rounded-xl border transition focus-visible:ring-2 focus-visible:outline-none"><img alt="" loading="lazy" class="size-full object-cover"/></button>`),$d=F(`<span class="border-hairline bg-hover-fill inline-flex size-14 animate-pulse rounded-xl border"></span>`),ef=F(`<span class="text-muted-foreground border-hairline bg-hover-fill inline-flex items-center rounded-xl border px-3 py-2 text-xs"> </span>`);function tf(t,n){H(n,!0);let r=g(null),l=g(!1),d=e(()=>o(r)??n.attachment.url);c(()=>{if(n.attachment.url||!n.loadAttachment)return;let e=!1,t=null;return n.loadAttachment(n.attachment.imageUploadId).then(n=>{if(e){n&&URL.revokeObjectURL(n);return}t=n,C(r,n,!0),C(l,n==null)}).catch(()=>{e||C(l,!0)}),()=>{e=!0,t&&URL.revokeObjectURL(t)}});var f=m(),h=u(f),_=e=>{var t=Qd(),r=s(t);B(t),x(()=>{A(t,`aria-label`,`View ${n.attachment.name??``}`),A(t,`title`,n.attachment.name),A(r,`src`,o(d))}),p(`click`,t,()=>{o(d)&&n.onOpen({url:o(d),name:n.attachment.name,mediaType:n.attachment.mediaType})}),i(e,t)},v=e=>{var t=$d();x(()=>A(t,`aria-label`,`Loading ${n.attachment.name??``}`)),i(e,t)},b=e=>{var t=ef(),r=s(t);B(t),x(()=>a(r,`${n.attachment.name??``} (unavailable)`)),i(e,t)};y(h,e=>{o(d)?e(_):n.loadAttachment&&!o(l)?e(v,1):e(b,-1)}),i(t,f),R()}f([`click`]);function nf(t){let n=g(!1),r=g(!1);c(()=>{t()?C(r,!1):C(n,!1)});let i=e(()=>t()?!o(r):o(n));function a(){t()?C(r,!o(r)):C(n,!o(n))}return{get expanded(){return o(i)},toggle:a}}var rf=F(`<div class="text-muted-foreground mt-1.5 text-[13px] leading-6 whitespace-pre-wrap"> </div>`),af=F(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1.5 transition"><!> <span> </span> <!></button> <!></div>`);function of(t,n){H(n,!0);let r=nf(()=>n.inProgress),c=e(()=>n.inProgress?`Reasoning`:`Reasoned`);var l=af(),u=s(l),d=s(u);Ct(d,{class:`size-3.5 shrink-0`,"aria-hidden":`true`});var f=V(d,2),m=s(f,!0);B(f);var h=V(f,2);{let t=e(()=>`size-3.5 shrink-0 transition-transform ${r.expanded?`rotate-90`:``}`);jt(h,{get class(){return o(t)},"aria-hidden":`true`})}B(u);var g=V(u,2),_=e=>{var t=rf(),r=s(t,!0);B(t),x(()=>a(r,n.text)),i(e,t)};y(g,e=>{r.expanded&&e(_)}),B(l),x(()=>{A(u,`aria-expanded`,r.expanded),a(m,o(c))}),p(`click`,u,function(...e){r.toggle?.apply(this,e)}),i(t,l),R()}f([`click`]);var sf=F(`<div class="text-muted-foreground mt-1.5 space-y-1.5 text-[13px] leading-6"></div>`),cf=F(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1.5 transition"><!> <span> </span> <!></button> <!></div>`);function lf(t,n){H(n,!0);let r=g(null),c=e(()=>o(r)??n.defaultExpanded??n.tools.length<=2);function l(){C(r,!o(c))}var d=cf(),f=s(d),h=s(f);{let t=e(()=>`size-3.5 shrink-0 ${n.iconClass??``}`);pe(h,()=>n.icon,(e,n)=>{n(e,{get class(){return o(t)},"aria-hidden":`true`})})}var _=V(h,2),b=s(_,!0);B(_);var S=V(_,2);{let t=e(()=>`size-3.5 shrink-0 transition-transform ${o(c)?`rotate-90`:``}`);jt(S,{get class(){return o(t)},"aria-hidden":`true`})}B(f);var w=V(f,2),T=e=>{var t=sf();v(t,21,()=>n.tools,e=>e.callId,(e,t)=>{var r=m(),a=u(r);k(a,()=>n.toolRow,()=>o(t)),i(e,r)}),B(t),i(e,t)};y(w,e=>{o(c)&&e(T)}),B(d),x(()=>{A(f,`aria-expanded`,o(c)),a(b,n.label)}),p(`click`,f,l),i(t,d),R()}f([`click`]);var uf=F(`<div class="mt-1.5 space-y-2"><!></div>`),df=F(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1 transition"><span> </span> <!></button> <!></div>`);function ff(t,n){H(n,!0);let r=g(0),l=nf(()=>n.inProgress);c(()=>{let e=n.startedAtMs;if(n.inProgress){let t=()=>{C(r,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}let t=n.completedAtMs??Date.now();C(r,Math.max(0,Math.floor((t-e)/1e3)),!0)});let u=e(()=>n.inProgress?`Working for ${Bi(o(r))}`:`Worked for ${Bi(o(r))}`);var d=df(),f=s(d),m=s(f),h=s(m,!0);B(m);var _=V(m,2);{let t=e(()=>`size-3.5 shrink-0 transition-transform ${l.expanded?`rotate-90`:``}`);jt(_,{get class(){return o(t)},"aria-hidden":`true`})}B(f);var v=V(f,2),b=e=>{var t=uf(),r=s(t);k(r,()=>n.children),B(t),i(e,t)};y(v,e=>{l.expanded&&e(b)}),B(d),x(()=>{A(f,`aria-expanded`,l.expanded),a(h,o(u))}),p(`click`,f,function(...e){l.toggle?.apply(this,e)}),i(t,d),R()}f([`click`]);function pf(e){if((e.job?.kind??e.name)!==`mandate_setup`)return;let t=e.output;if(!qi(t))return;let n=Zs(t.mandateId),r=Zs(t.approvalUrl);if(!(!n||!r))return{mandateId:n,approvalUrl:r}}function mf(e){let t=e.job?.payload??e.input;if(!qi(t))return;let n=Zs(t.description)?.trim();if(n)return n;let r=Zs(t.merchantName)?.trim();if(r)return r}function hf(e){return e.flatMap(e=>{let t=pf(e);return t?[{...t,label:mf(e)}]:[]})}var gf=F(`<div role="alert" class="text-destructive mb-6 rounded-2xl border border-rose-500/20 bg-rose-500/10 px-4 py-3 text-sm"> </div>`),_f=F(`<div role="alert" class="mb-6 rounded-2xl border border-amber-500/25 bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200"> </div>`),vf=F(`<div role="status" class="mb-6 rounded-2xl border border-amber-500/25 bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200">Showing a local copy while Sprocket reconnects to history.</div>`),yf=F(`<details class="text-muted-foreground mb-6 rounded-2xl border px-4 py-3 text-sm"><summary class="text-foreground cursor-pointer">Earlier conversation was summarized</summary> <p class="mt-2 whitespace-pre-wrap"> </p></details>`),bf=F(`<div class="text-muted-foreground mb-4 text-center text-xs">Loading earlier messages…</div>`),xf=F(`<div class="flex flex-1 items-center justify-center"><div class="max-w-2xl text-center"><p class="text-muted-foreground text-sm leading-7"> </p></div></div>`),Sf=F(`<li><!></li>`),Cf=F(`<ul class="flex max-w-132 flex-wrap justify-end gap-2" aria-label="Attached images"></ul>`),wf=F(`<div><!></div>`),Tf=F(`<button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex size-6 items-center justify-center rounded-md transition"><!></button>`),Ef=F(`<button type="button" class="shrink-0 text-xs font-medium tracking-[-0.01em] text-amber-800/80 underline-offset-2 hover:text-amber-900 hover:underline dark:text-amber-200/80 dark:hover:text-amber-100">Dismiss</button>`),Df=F(`<div role="status" class="w-full max-w-132 rounded-2xl border border-amber-500/25 bg-amber-500/10 px-4 py-3 text-left text-sm text-amber-800 dark:text-amber-200"><div class="flex items-start justify-between gap-3"><p class="min-w-0 flex-1 leading-6"> </p> <!></div></div>`),Of=F(`<div class="flex flex-col items-end gap-1.5"><!> <!> <!> <!></div>`),kf=F(`<details class="min-w-0"><summary class="min-w-0 cursor-pointer text-left"><span> </span> <span> </span></summary> <p role="status"> </p></details>`),Af=F(`<p> </p>`),jf=F(`<p class="flex min-w-0 items-start gap-1.5"><!> <span> </span></p>`),Mf=F(`<!> <!> <!>`,1),Nf=F(`<p class="text-muted-foreground text-sm"> </p>`),Pf=F(`<div class="w-full min-w-0" aria-atomic="false" aria-relevant="additions text"><div class="space-y-3"><!> <!> <!></div></div>`),Ff=F(`<div class="space-y-8 pb-14"></div>`),If=F(`<div class="relative min-h-0 flex-1"><div class="hide-scrollbar h-full overflow-auto [overflow-anchor:none]"><div class="mx-auto flex min-h-full w-full max-w-5xl flex-col px-4 py-8"><!> <!> <!> <!> <!> <!></div></div> <div class="transcript-fade pointer-events-none absolute inset-x-0 bottom-0 h-16"></div></div> <!>`,1);function Lf(t,n){H(n,!0);let r=P(n,`remoteChangeNotice`,3,null),l=P(n,`emptyStateMessage`,19,()=>n.project?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`),f=P(n,`stale`,3,!1),b=P(n,`contextSummary`,3,null),S=P(n,`loadingOlder`,3,!1),w=P(n,`hasOlder`,3,!1),T=e(()=>n.messages.find(e=>e.type===`prompt`)?._id),E=g(null),D=g(!0),O=g(!1),k=0;function ee(){let e=o(E);if(!e||o(O))return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;C(D,t<=28),w()&&!S()&&n.onLoadOlder&&e.scrollTop<=96&&(k=e.scrollHeight,C(O,!0),n.onLoadOlder())}function te(e){return e.type===`tool-group`&&(e.toolKey===`create_artifact`||e.toolKey===`update_artifact`)}function ne(e){return!te(e)}let N=g(null),re=g(null),F=null;async function ie(e,t){try{await navigator.clipboard.writeText(t),C(re,e,!0),F!==null&&clearTimeout(F),F=setTimeout(()=>{o(re)===e&&C(re,null),F=null},1500)}catch{C(re,null)}}c(()=>()=>{F!==null&&clearTimeout(F)});function oe(){let e=o(E);!e||!o(D)||(e.scrollTop=e.scrollHeight)}c(()=>{n.messages,n.actions;let e=o(E);if(_(()=>o(O))&&e){e.scrollTop+=Math.max(0,e.scrollHeight-k),C(O,!1);return}o(D)&&d().then(oe)}),c(()=>{S()||d().then(()=>{S()||C(O,!1)})}),c(()=>{let e=o(E);if(!e||!globalThis.ResizeObserver)return;let t=new ResizeObserver(()=>{oe()});return t.observe(e),()=>{t.disconnect()}});var se=If(),L=u(se),z=s(L),le=s(z),ue=s(le),de=e=>{var t=gf(),r=s(t,!0);B(t),x(()=>a(r,n.currentError)),i(e,t)};y(ue,e=>{n.currentError&&e(de)});var U=V(ue,2),fe=e=>{var t=_f(),r=s(t,!0);B(t),x(()=>a(r,n.runError)),i(e,t)};y(U,e=>{n.runError&&e(fe)});var me=V(U,2),W=e=>{var t=vf();i(e,t)};y(me,e=>{f()&&e(W)});var he=V(me,2),ge=e=>{var t=yf(),n=V(s(t),2),r=s(n,!0);B(n),B(t),x(()=>a(r,b())),i(e,t)};y(he,e=>{b()&&e(ge)});var _e=V(he,2),ve=e=>{var t=bf();i(e,t)};y(_e,e=>{S()&&e(ve)});var ye=V(_e,2),be=e=>{var t=xf(),n=s(t),r=s(n),o=s(r,!0);B(r),B(n),B(t),x(()=>a(o,l())),i(e,t)},G=t=>{var c=Ff();v(c,21,()=>n.messages,e=>e._id,(t,c)=>{var l=m(),d=u(l),f=t=>{var l=Of(),u=s(l),d=e=>{var t=Cf();v(t,21,()=>o(c).attachments,e=>e.imageUploadId,(e,t)=>{var r=Sf();tf(s(r),{get attachment(){return o(t)},get loadAttachment(){return n.loadAttachment},onOpen:e=>{C(N,e,!0)}}),B(r),i(e,r)}),B(t),i(e,t)};y(u,e=>{o(c).attachments.length&&e(d)});var f=V(u,2),m=t=>{var n=wf();I(n,1,M(`user-bubble w-fit max-w-[33rem] rounded-xl border px-5 py-3.5 text-[15.5px] leading-7 text-foreground`));var r=s(n);{let t=e(()=>o(c).text||` `);Jd(r,{get content(){return o(t)},className:`text-foreground`})}B(n),i(t,n)};y(f,e=>{(o(c).text||!o(c).attachments.length)&&e(m)});var h=V(f,2),g=e=>{var t=Tf(),n=s(t),r=e=>{Dt(e,{class:`size-3.5`,"aria-hidden":`true`})},a=e=>{Vt(e,{class:`size-3.5`,"aria-hidden":`true`})};y(n,e=>{o(re)===o(c)._id?e(r):e(a,-1)}),B(t),x(()=>A(t,`aria-label`,o(re)===o(c)._id?`Copied`:`Copy message`)),p(`click`,t,()=>{ie(o(c)._id,o(c).text)}),i(e,t)};y(h,e=>{o(c).text&&e(g)});var _=V(h,2),b=e=>{var t=Df(),o=s(t),c=s(o),l=s(c,!0);B(c);var u=V(c,2),d=e=>{var t=Ef();p(`click`,t,function(...e){n.onDismissRemoteChangeNotice?.apply(this,e)}),i(e,t)};y(u,e=>{n.onDismissRemoteChangeNotice&&e(d)}),B(o),B(t),x(()=>a(l,r())),i(e,t)};y(_,e=>{r()&&o(c)._id===o(T)&&e(b)}),B(l),i(t,l)},h=t=>{let r=e(()=>n.actions.filter(e=>e.runId===o(c).runId)),l=e(()=>vc(o(c).parts,o(r))),d=e(()=>o(l).filter(e=>e.type===`tool`)),f=e(()=>fc(o(d))),p=e(()=>tc(o(l))),h=e(()=>rc(o(p))),g=e(()=>{let{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}=sc(o(h));return{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}}),_=e(()=>o(c).runId===n.activeRunId&&o(c).runStatus!==`completed`&&o(c).runStatus!==`failed`&&o(c).runStatus!==`cancelled`),b=e(()=>mc(o(d),o(_))),S=e(()=>o(l).some(e=>e.type===`text`||e.type===`reasoning`));var C=Pf(),w=s(C),T=s(w),E=t=>{{let n=e(()=>o(c).text||`...`);Jd(t,{get content(){return o(n)},className:`text-foreground`})}};y(T,e=>{!o(S)&&(o(c).text||o(_)&&o(l).length===0)&&e(E)});var D=V(T,2);v(D,19,()=>o(h),(e,t)=>`${e.type}-${e.type===`work`?e.key:e.id}-${t}`,(t,n,r)=>{var l=m(),d=u(l),p=t=>{{let r=e(()=>o(n).text||` `);Jd(t,{get content(){return o(r)},className:`text-foreground`})}},S=t=>{let l=e(()=>{let{settledBlocks:e,runningTools:t}=hc(o(n).blocks,o(_),o(b));return{settledBlocks:e,runningTools:t}}),d=e(()=>o(l).settledBlocks.filter(ne)),p=e(()=>o(d).flatMap(e=>e.type===`tool-group`?hf(e.tools):[])),S=e(()=>o(_)&&(o(r)===o(h).length-1||o(l).runningTools.length>0)),C=e(()=>o(g).workIndexBySectionIndex[o(r)]??0),w=e(()=>cc(o(n),{inProgress:o(S),workSectionIndex:o(C),runStartedAt:o(c).runStartedAt,runCompletedAt:o(c).runCompletedAt,priorWorkCompletedAtMs:o(g).priorCompletedAtByWorkIndex[o(C)]}));var T=Mf(),E=u(T),D=t=>{ff(t,{get inProgress(){return o(S)},get startedAtMs(){return o(w).startedAtMs},get completedAtMs(){return o(w).completedAtMs},children:(t,n)=>{var r=m(),c=u(r);v(c,19,()=>o(d),(e,t)=>`${e.type}-${e.type===`tool-group`?e.tools.map(e=>e.callId).join(`,`):e.id}-${t}`,(t,n,r)=>{var c=m(),p=u(c),h=t=>{let i=e(()=>o(S)&&o(l).runningTools.length===0&&o(r)===o(d).length-1);of(t,{get text(){return o(n).text},get inProgress(){return o(i)}})},g=t=>{{let r=(t,n=ae)=>{let r=e(()=>_c(n(),o(_))),c=e(()=>gc(n(),o(_))),l=e(()=>Ic(n(),o(f)));var d=m(),p=u(d),h=e=>{var t=kf(),u=s(t),d=s(u),p=s(d,!0);B(d);var m=V(d,2),h=s(m);B(m),B(u);var g=V(u,2),v=s(g,!0);B(g),B(t),x((e,t)=>{A(u,`title`,e),I(d,1,t),a(p,o(l)),I(m,1,M(o(c)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`)),a(h,`(${o(c)??``})`),I(g,1,`mt-1.5 text-xs leading-5 wrap-break-word whitespace-pre-wrap ${o(c)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`}`),a(v,o(r))},[()=>Lc(n(),o(_),o(f)),()=>M(Tc(n()))]),i(e,t)},g=e=>{var t=Af(),r=s(t,!0);B(t),x((e,n)=>{I(t,1,e),A(t,`title`,n),a(r,o(l))},[()=>`min-w-0 ${Tc(n())}`,()=>Lc(n(),o(_),o(f))]),i(e,t)};y(p,e=>{o(r)&&o(c)?e(h):e(g,-1)}),i(t,d)},c=e(()=>Sc(o(n).toolKey)),l=e(()=>yc(o(n).toolKey)),d=e(()=>o(n).toolKey===`apply_patch`?Pc(o(n).tools)<=2:void 0);lf(t,{get label(){return o(c)},get icon(){return o(l)},get tools(){return o(n).tools},get defaultExpanded(){return o(d)},toolRow:r,$$slots:{toolRow:!0}})}};y(p,e=>{o(n).type===`reasoning`?e(h):e(g,-1)}),i(t,c)}),i(t,r)},$$slots:{default:!0}})};y(E,e=>{(o(d).length>0||o(S)||o(l).runningTools.length>0)&&e(D)});var O=V(E,2);v(O,17,()=>o(p),e=>e.mandateId,(e,t)=>{ds(e,{get approval(){return o(t)}})});var k=V(O,2),ee=t=>{lf(t,{label:`Running`,get icon(){return wn},iconClass:`animate-spin`,get tools(){return o(l).runningTools},defaultExpanded:!0,toolRow:(t,n=ae)=>{let r=e(()=>bc(n())),c=e(()=>Ic(n(),o(f)));var l=jf(),u=s(l);pe(u,()=>o(r),(e,t)=>{t(e,{class:`text-muted-foreground mt-1.5 size-3 shrink-0`,"aria-hidden":`true`})});var d=V(u,2),p=s(d,!0);B(d),B(l),x(e=>{A(l,`title`,`${o(c)} (running)`),I(d,1,e),a(p,o(c))},[()=>M(Tc(n()))]),i(t,l)},$$slots:{toolRow:!0}})};y(k,e=>{o(l).runningTools.length>0&&e(ee)}),i(t,T)};y(d,e=>{o(n).type===`text`?e(p):e(S,-1)}),i(t,l)});var O=V(D,2),k=e=>{var t=Nf(),n=s(t);B(t),x(e=>a(n,`Worked for ${e??``}`),[()=>Bi(Math.max(0,Math.floor((o(c).runCompletedAt-o(c).runStartedAt)/1e3)))]),i(e,t)};y(O,e=>{!o(_)&&o(c).runCompletedAt!==void 0&&e(k)}),B(w),B(C),x(()=>{A(C,`role`,o(_)?`log`:void 0),A(C,`aria-live`,o(_)?`polite`:void 0)}),i(t,C)};y(d,e=>{o(c).type===`prompt`?e(f):e(h,-1)}),i(t,l)}),B(c),i(t,c)};y(ye,e=>{n.messages.length===0?e(be):e(G,-1)}),B(le),B(z),ce(z,e=>C(E,e),()=>o(E)),j(2),B(L),Zd(V(L,2),{get image(){return o(N)},onClose:()=>{C(N,null)}}),h(`scroll`,z,ee),i(t,se),R()}f([`click`]),Ae([`markdown`,`html`,`react`]);function Rf(e){return e.replace(/<\/(script)/gi,`<\\/$1`).replace(/<!--/g,`<\\!--`)}function zf(e,t){return`<!DOCTYPE html>
78
+ <html lang="en">
79
+ <head>
80
+ <meta charset="utf-8" />
81
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
82
+ ${e}</head>
83
+ <body>
84
+ ${t}
85
+ </body>
86
+ </html>`}function Bf(e){return zf(`<style>
87
+ html, body, #root { margin: 0; min-height: 100%; }
88
+ body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }
89
+ #artifact-error { margin: 16px; padding: 12px; border: 1px solid #f87171; border-radius: 8px; color: #b91c1c; font: 13px/1.5 ui-monospace, monospace; white-space: pre-wrap; }
90
+ </style>
91
+ <script src="https://unpkg.com/@babel/standalone@7.26.5/babel.min.js"><\/script>
92
+ <script>
93
+ window.addEventListener('error', (event) => {
94
+ const root = document.getElementById('root');
95
+ if (!root || root.hasChildNodes()) return;
96
+ const el = document.createElement('div');
97
+ el.id = 'artifact-error';
98
+ el.textContent = 'Artifact failed to render: ' + (event.message || 'unknown error');
99
+ root.appendChild(el);
100
+ });
101
+ <\/script>
102
+ `,`<div id="root"></div>
103
+ <script type="module">
104
+ import * as React from "https://esm.sh/react@19.1.0";
105
+ import { createRoot } from "https://esm.sh/react-dom@19.1.0/client";
106
+ window.React = React;
107
+ window.createRoot = createRoot;
108
+ window.exports = {};
109
+ window.require = (name) => {
110
+ if (name === 'react') return React;
111
+ if (name === 'react-dom' || name === 'react-dom/client') return { createRoot };
112
+ if (name === 'react/jsx-runtime')
113
+ return { jsx: React.createElement, jsxs: React.createElement, Fragment: React.Fragment };
114
+ throw new Error('Artifact previews cannot import "' + name + '"');
115
+ };
116
+ <\/script>
117
+ <script type="text/babel" data-presets="react" data-plugins="transform-modules-commonjs">
118
+ ${Rf(e.trim())}
119
+
120
+ const __root = document.getElementById('root');
121
+ const __App = typeof App !== 'undefined' ? App : exports.default;
122
+ if (!__App) {
123
+ __root.textContent = 'React artifact must define a function/component named App.';
124
+ } else {
125
+ window.createRoot(__root).render(window.React.createElement(__App));
126
+ }
127
+ <\/script>`)}function Vf(e){let t=e.trim();return/^<!DOCTYPE html>/i.test(t)||/^<html[\s>]/i.test(t)?t:zf(``,t)}function Hf(e,t){return e===`react`?Bf(t):e===`html`?Vf(t):null}var Uf=F(`<iframe sandbox="allow-scripts"></iframe>`),Wf=F(`<pre class="h-full overflow-auto p-3 pr-10 text-[13px] leading-6"><code> </code></pre>`),Gf=F(`<div class="h-full overflow-auto p-3 pr-10"><!></div>`),Kf=F(`<div class="relative min-h-0 flex-1 border-t"><!> <button type="button" class="bg-card text-muted-foreground hover:text-foreground absolute top-2 right-2 rounded-md border p-1 transition"><!></button></div>`),qf=F(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Back to artifacts"><!></button>`),Jf=F(`<!> Preview`,1),Yf=F(`<!> Source`,1),Xf=F(`<button type="button" class="text-muted-foreground hover:text-foreground inline-flex shrink-0 items-center gap-1 rounded-md border px-2 py-1 text-[11px] transition"><!></button>`),Zf=F(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Open fullscreen" title="Open fullscreen"><!></button>`),Qf=F(`<div><div class="flex items-center gap-2 px-3 py-2"><!> <div class="flex min-w-0 flex-1 items-center gap-2"><span class="text-foreground min-w-0 truncate text-sm font-medium"> </span> <span class="text-muted-foreground shrink-0 text-[11px]"> </span></div> <!> <!></div> <!></div>`);function $f(t,n){H(n,!0);let r=P(n,`variant`,3,`card`),l=e(()=>Hf(n.artifactType,n.content)),d=g(!1),f=g(!1),m=null;async function h(){try{await navigator.clipboard.writeText(n.content),C(f,!0),m!==null&&clearTimeout(m),m=setTimeout(()=>{C(f,!1),m=null},1500)}catch{C(f,!1)}}c(()=>()=>{m!==null&&clearTimeout(m)});var _=Qf();{let e=(e,t=ae)=>{var r=Kf(),c=s(r),u=e=>{var r=Uf();x(()=>{A(r,`title`,`${n.title} preview`),A(r,`srcdoc`,o(l)),I(r,1,`block w-full bg-white ${t()}`)}),i(e,r)},m=e=>{var t=Wf(),r=s(t),o=s(r,!0);B(r),B(t),x(()=>a(o,n.content)),i(e,t)},g=e=>{var t=Gf();Jd(s(t),{get content(){return n.content},className:`text-sm text-foreground`}),B(t),i(e,t)};y(c,e=>{o(l)&&!o(d)?e(u):o(l)?e(m,1):e(g,-1)});var _=V(c,2),v=s(_),b=e=>{Dt(e,{class:`size-3.5`,"aria-hidden":`true`})},S=e=>{Vt(e,{class:`size-3.5`,"aria-hidden":`true`})};y(v,e=>{o(f)?e(b):e(S,-1)}),B(_),B(r),x(()=>A(_,`aria-label`,o(f)?`Copied`:`Copy`)),p(`click`,_,h),i(e,r)};var v=s(_),b=s(v),S=e=>{var t=qf();_t(s(t),{class:`size-4`,"aria-hidden":`true`}),B(t),p(`click`,t,function(...e){n.onBack?.apply(this,e)}),i(e,t)};y(b,e=>{n.onBack&&e(S)});var w=V(b,2),T=s(w),E=s(T,!0);B(T);var D=V(T,2),O=s(D,!0);B(D),B(w);var k=V(w,2),ee=e=>{var t=Xf(),n=s(t),r=e=>{var t=Jf();$t(u(t),{class:`size-3.5`,"aria-hidden":`true`}),j(),i(e,t)},a=e=>{var t=Yf();zt(u(t),{class:`size-3.5`,"aria-hidden":`true`}),j(),i(e,t)};y(n,e=>{o(d)?e(r):e(a,-1)}),B(t),x(()=>A(t,`aria-label`,o(d)?`Show preview`:`Show source`)),p(`click`,t,()=>C(d,!o(d))),i(e,t)};y(k,e=>{o(l)&&e(ee)});var te=V(k,2),ne=e=>{var t=Zf();mn(s(t),{class:`size-4`,"aria-hidden":`true`}),B(t),p(`click`,t,function(...e){n.onOpenFullscreen?.apply(this,e)}),i(e,t)};y(te,e=>{n.onOpenFullscreen&&e(ne)}),B(v);var N=V(v,2),re=t=>{e(t,()=>`h-full`)},F=t=>{e(t,()=>`h-64`)};y(N,e=>{r()===`full`?e(re):e(F,-1)}),B(_),x(()=>{a(E,n.title),a(O,n.artifactType)})}x(()=>I(_,1,M(r()===`full`?`bg-card flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border`:`bg-card rounded-lg border`))),i(t,_),R()}f([`click`]);var ep=F(`<span class="absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500 opacity-60"></span> <span class="relative inline-flex size-2 rounded-full bg-emerald-500"></span>`,1),tp=F(`<span class="bg-muted-foreground/40 relative inline-flex size-2 rounded-full"></span>`),np=F(`<iframe title="Agent browser live view" class="min-h-0 w-full flex-1 border-0" allow="clipboard-read; clipboard-write"></iframe>`),rp=F(`<div class="flex items-center gap-2 border-b px-3 py-1.5"><span class="relative flex size-2" aria-hidden="true"><!></span> <span role="status" class="text-muted-foreground text-xs"> </span> <div class="flex-1"></div> <a target="_blank" rel="noopener noreferrer" class="text-muted-foreground hover:text-foreground rounded-md p-1 transition" aria-label="Open live view in a new tab" title="Open live view in a new tab"><!></a></div> <!>`,1),ip=F(`<div class="flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-6 text-center"><!> <p class="text-muted-foreground text-sm">Starting the live view…</p> <p class="text-muted-foreground text-xs">The agent is browsing in the meantime.</p></div>`),ap=F(`<div class="flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-6 text-center"><!> <p class="text-muted-foreground text-sm">No browser session yet. When the agent browses the web, you can watch it here live.</p></div>`),op=F(`<div class="flex min-h-0 flex-1 items-center justify-center"><!></div>`),sp=F(`<div class="flex min-h-0 flex-1 flex-col"><!></div>`);function cp(e,t){H(t,!0);var n=sp(),r=s(n),o=e=>{var n=rp(),r=u(n),o=s(r),c=s(o),l=e=>{var t=ep();j(2),i(e,t)},d=e=>{var t=tp();i(e,t)};y(c,e=>{t.active?e(l):e(d,-1)}),B(o);var f=V(o,2),p=s(f,!0);B(f);var m=V(f,4);Zt(s(m),{class:`size-3.5`,"aria-hidden":`true`}),B(m),B(r);var h=V(r,2);U(h,()=>t.liveView.url,e=>{var n=np();x(()=>A(n,`src`,t.liveView.url)),i(e,n)}),x(()=>{a(p,t.active?`Live — the agent is browsing`:`Browser session`),A(m,`href`,t.liveView.url)}),i(e,n)},c=e=>{var t=ip();wn(s(t),{class:`text-muted-foreground size-5 animate-spin`,"aria-hidden":`true`}),j(4),B(t),i(e,t)},l=e=>{var t=ap();gn(s(t),{class:`text-muted-foreground size-5`,"aria-hidden":`true`}),j(2),B(t),i(e,t)},d=e=>{var t=op();wn(s(t),{class:`text-muted-foreground size-5 animate-spin`,"aria-hidden":`true`}),B(t),i(e,t)};y(r,e=>{t.liveView?.url?e(o):t.liveView?e(c,1):t.liveView===null?e(l,2):e(d,-1)}),B(n),i(e,n),R()}var lp=F(`<span class="size-1.5 animate-pulse rounded-full bg-emerald-500" aria-hidden="true"></span>`),up=F(`<button type="button" role="tab" aria-controls="side-panel-tabpanel"><span class="inline-flex items-center gap-1.5"><!> </span></button>`),dp=F(`<div class="flex min-h-0 flex-1 flex-col p-3"><!></div>`),fp=F(`<div class="group hover:bg-muted focus-within:bg-muted flex items-center gap-2 rounded-md px-2 py-1.5"><button type="button" class="flex min-w-0 flex-1 items-center gap-2 text-left"><!> <span class="text-foreground min-w-0 truncate text-sm"> </span></button> <button type="button" class="text-muted-foreground hover:text-foreground shrink-0 opacity-0 transition group-focus-within:opacity-100 group-hover:opacity-100 focus:opacity-100" title="Open fullscreen"><!></button></div>`),pp=F(`<p class="text-muted-foreground p-3 text-sm">No artifacts yet.</p>`),mp=F(`<div class="min-h-0 flex-1 space-y-0.5 overflow-y-auto p-2"></div>`),hp=F(`<aside><div class="flex items-center gap-1 border-b px-2 py-1.5"><div role="tablist" aria-label="Side panel views" class="flex items-center gap-1"></div> <div class="flex-1"></div> <button type="button" class="text-muted-foreground hover:text-foreground rounded-md p-1 transition"><!></button> <button type="button" class="text-muted-foreground hover:text-foreground rounded-md p-1 transition" aria-label="Close panel"><!></button></div> <div role="tabpanel" id="side-panel-tabpanel" class="flex min-h-0 flex-1 flex-col"><!></div></aside>`);function gp(t,n){H(n,!0);let r=e(()=>n.artifacts.find(e=>e.key===n.selectedKey)??null),l={markdown:on,html:gn,react:tn},u=[{id:`artifacts`,label:`Artifacts`},{id:`live`,label:`Live view`}];function d(e){document.getElementById(`side-panel-tab-${e}`)?.focus()}function f(e){let t=u.findIndex(e=>e.id===n.tab),r=-1;e.key===`ArrowRight`?r=(t+1)%u.length:e.key===`ArrowLeft`?r=(t-1+u.length)%u.length:e.key===`Home`?r=0:e.key===`End`&&(r=u.length-1),r!==-1&&(e.preventDefault(),n.onTabChange(u[r].id),d(u[r].id))}c(()=>{if(!n.expanded)return;let e=e=>{e.key===`Escape`&&(document.fullscreenElement||document.querySelector(`[data-artifact-screen-fullscreen]`)||(e.preventDefault(),n.onToggleExpanded()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});var m=hp(),h=s(m),g=s(h);v(g,21,()=>u,e=>e.id,(e,t)=>{var r=up(),c=s(r),l=s(c),u=e=>{var t=lp();i(e,t)};y(l,e=>{o(t).id===`live`&&n.liveActive&&n.tab!==`live`&&e(u)});var d=V(l);B(c),B(r),x(()=>{A(r,`id`,`side-panel-tab-${o(t).id??``}`),A(r,`aria-selected`,n.tab===o(t).id),A(r,`tabindex`,n.tab===o(t).id?0:-1),I(r,1,`rounded-md px-2.5 py-1 text-xs font-medium transition ${n.tab===o(t).id?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`),a(d,` ${o(t).label??``}`)}),p(`click`,r,()=>n.onTabChange(o(t).id)),p(`keydown`,r,f),i(e,r)}),B(g);var _=V(g,4),b=s(_),S=e=>{Hn(e,{class:`size-4`,"aria-hidden":`true`})},C=e=>{Yt(e,{class:`size-4`,"aria-hidden":`true`})};y(b,e=>{n.expanded?e(S):e(C,-1)}),B(_);var w=V(_,2);or(s(w),{class:`size-4`,"aria-hidden":`true`}),B(w),B(h);var T=V(h,2),E=s(T),D=e=>{cp(e,{get liveView(){return n.liveView},get active(){return n.liveActive}})},O=e=>{var t=dp();$f(s(t),{get title(){return o(r).title},get artifactType(){return o(r).artifactType},get content(){return o(r).content},variant:`full`,onOpenFullscreen:()=>n.onOpenFullscreen(o(r).key),get onBack(){return n.onBack}}),B(t),i(e,t)},k=t=>{var r=mp();v(r,21,()=>n.artifacts,e=>e.key,(t,r)=>{let c=e(()=>l[o(r).artifactType]);var u=fp(),d=s(u),f=s(d);pe(f,()=>o(c),(e,t)=>{t(e,{class:`text-muted-foreground size-3.5 shrink-0`,"aria-hidden":`true`})});var m=V(f,2),h=s(m,!0);B(m),B(d);var g=V(d,2);mn(s(g),{class:`size-3.5`,"aria-hidden":`true`}),B(g),B(u),x(()=>{a(h,o(r).title),A(g,`aria-label`,`Open ${o(r).title} fullscreen`)}),p(`click`,d,()=>n.onSelect(o(r).key)),p(`click`,g,()=>n.onOpenFullscreen(o(r).key)),i(t,u)},e=>{var t=pp();i(e,t)}),B(r),i(t,r)};y(E,e=>{n.tab===`live`?e(D):o(r)?e(O,1):e(k,-1)}),B(T),B(m),x(()=>{I(m,1,`bg-background flex h-full min-h-0 w-full flex-col ${n.expanded?``:`border-l`}`),A(_,`aria-label`,n.expanded?`Exit full workspace`:`Expand to full workspace`),A(_,`title`,n.expanded?`Exit full workspace`:`Expand to full workspace`),A(_,`aria-pressed`,n.expanded),A(T,`aria-labelledby`,`side-panel-tab-${n.tab??``}`)}),p(`click`,_,function(...e){n.onToggleExpanded?.apply(this,e)}),p(`click`,w,function(...e){n.onClose?.apply(this,e)}),i(t,m),R()}f([`click`,`keydown`]);var _p=F(`<iframe sandbox="allow-scripts" class="block h-full w-full flex-1 bg-white"></iframe>`),vp=F(`<div class="min-h-0 flex-1 overflow-auto p-6"><!></div>`),yp=F(`<button type="button" class="bg-background/90 text-muted-foreground hover:text-foreground absolute top-3 right-3 z-10 rounded-md border p-2 transition" aria-label="Exit fullscreen"><!></button>`),bp=F(`<div data-artifact-screen-fullscreen="" class="bg-background fixed inset-0 z-200 flex h-screen w-screen flex-col outline-none" role="dialog" aria-modal="true" tabindex="-1"><!> <!></div>`);function xp(t,n){H(n,!0);let r=e(()=>Hf(n.artifact.artifactType,n.artifact.content)),a=g(null),c=g(!1);oe(()=>{let e=o(a);if(!e)return;let t=!0,r=!!document.fullscreenElement,i=document.activeElement instanceof HTMLElement?document.activeElement:null,s=()=>{t&&(t=!1,_(()=>{n.onClose()}))},l=()=>{if(document.fullscreenElement){r=!0,_(()=>{C(c,!1)});return}r&&s()},u=e=>{e.key===`Escape`&&(e.stopImmediatePropagation(),!(document.fullscreenElement||r)&&(e.preventDefault(),s()))};document.addEventListener(`fullscreenchange`,l),window.addEventListener(`keydown`,u,!0),d().then(()=>{t&&e.focus()});let f=window.setTimeout(()=>{!t||document.fullscreenElement||_(()=>{C(c,!0)})},250);return()=>{t=!1,window.clearTimeout(f),document.removeEventListener(`fullscreenchange`,l),window.removeEventListener(`keydown`,u,!0),document.fullscreenElement&&document.exitFullscreen?.().catch(()=>{});let e=i;d().then(()=>{e?.isConnected&&e.focus()})}});var l=bp(),u=s(l),f=e=>{var t=_p();x(()=>{A(t,`title`,`${n.artifact.title} preview`),A(t,`srcdoc`,o(r))}),i(e,t)},m=e=>{var t=vp();Jd(s(t),{get content(){return n.artifact.content},className:`text-sm text-foreground`}),B(t),i(e,t)};y(u,e=>{o(r)?e(f):e(m,-1)});var h=V(u,2),v=e=>{var t=yp();or(s(t),{class:`size-4`,"aria-hidden":`true`}),B(t),p(`click`,t,()=>n.onClose()),i(e,t)};y(h,e=>{o(c)&&e(v)}),B(l),ce(l,e=>C(a,e),()=>o(a)),x(()=>A(l,`aria-label`,`${n.artifact.title} fullscreen. Press Escape to exit.`)),i(t,l),R()}f([`click`]);function Sp(e,t){let n=new Map(t.map(e=>[e.id,e]));if(e===null)return{revisions:n,changedId:null};let r=null;for(let n of t){let t=e.get(n.id);(!t||t.currentVersion!==n.currentVersion)&&(!r||n.updatedAt>=r.updatedAt)&&(r=n)}return{revisions:n,changedId:r?.id??null}}var Cp={open:!1,expanded:!1,tab:`artifacts`,selectedKey:null};function wp(e){return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`.\\`)||e.startsWith(`..\\`)||e.startsWith(`/`)||e.startsWith(`\\`)||e.startsWith(`~/`)||e===`~`||/^[a-zA-Z]:([\\/]|$)/.test(e)}function Tp(e){if(e.endsWith(`/`)||e.endsWith(`\\`))return e;let t=e.lastIndexOf(`/`),n=e.lastIndexOf(`\\`),r=Math.max(t,n);return r<0?e:e.slice(0,r+1)}function Ep(e){let t=Tp(e);return e.slice(t.length)}function Dp(e){return!e||Ap(e)?e:`${e}${kp(e)}`}function Op(e){let t=e.trim();return t===`/`||t===`\\`||/^[a-zA-Z]:?$/.test(t)||/^[\\/][a-zA-Z]:?$/.test(t)}function kp(e){return e.includes(`\\`)||/^[a-zA-Z]:$/.test(e)?`\\`:`/`}function Ap(e){return/[\\/]$/.test(e)}function jp(e){return e.replace(/[\\/]+$/,``)}function Mp(e){if(!e.leaf)return;let t=e.browseEntries.find(t=>t.name!==`..`&&t.name===e.leaf);if(t)return t.fullPath;if(e.browseParentPath){let t=e.browseParentPath.split(/[/\\]/).filter(Boolean).at(-1);if(t&&t.toLowerCase()===e.leaf.toLowerCase())return e.browseParentPath}}function Np(e){let t=e.query.trim();return t?Ap(t)?e.browseParentPath||jp(t):Mp({leaf:Ep(t),browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})??t:``}function Pp(e){let t=e.query.trim();if(!t||Ap(t))return!1;let n=Ep(t);return n?Mp({leaf:n,browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})===void 0:!1}var Fp=F(`<p class="text-muted-foreground px-2 pb-1 text-[11px]">Reconnect <span class="text-muted-foreground"> </span> to a local directory</p>`),Ip=F(`<button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill rounded-md px-2 py-0.5 text-[11px] transition"> </button>`),Lp=F(`<div class="border-hairline flex flex-wrap gap-1.5 border-b px-3 py-2"></div>`),Rp=F(`<p class="text-muted-foreground px-3 py-8 text-center text-sm"> </p>`),zp=F(`<button type="button" role="option"><!> <span class="truncate"> </span></button>`),Bp=F(`<p class="text-destructive border-t border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"> </p>`),Vp=F(`<div class="bg-overlay fixed inset-0 z-50 flex items-start justify-center px-4 pt-[10vh] backdrop-blur-[2px]" role="presentation"><div class="border-border bg-popover text-foreground flex max-h-[min(32rem,70vh)] w-full max-w-xl min-w-0 flex-col overflow-hidden rounded-2xl border shadow-2xl" role="dialog" aria-modal="true" aria-labelledby="project-picker-title" tabindex="-1"><div class="border-hairline border-b px-2.5 py-1.5"><div class="relative flex items-center"><div class="text-muted-foreground pointer-events-none flex items-center ps-2"><!></div> <input id="project-picker-title" class="text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent py-2 ps-2 pe-28 text-sm outline-none" placeholder="Enter project path (e.g. ~/projects/my-robot)" autocomplete="off"/> <!> <button type="button" class="border-border text-foreground bg-hover-fill hover:bg-hover-fill-strong absolute inset-e-2 top-1/2 -translate-y-1/2 rounded-md border px-2 py-1 text-[12px] transition disabled:cursor-not-allowed disabled:opacity-40"> </button></div> <!></div> <!> <div class="min-h-0 flex-1 overflow-y-auto py-1" role="listbox" aria-label="Directories"><!></div> <!> <footer class="text-muted-foreground border-hairline flex items-center justify-between gap-3 border-t px-3 py-2 text-[11px]"><div class="flex flex-wrap items-center gap-3"><span>↑↓ Navigate</span> <span> </span> <span>Esc Close</span></div> <button type="button" class="text-muted-foreground hover:text-foreground transition">Cancel</button></footer></div></div>`);function Hp(t,n){H(n,!0);let r=P(n,`mode`,3,`add`),d=P(n,`recentProjectPaths`,19,()=>[]),f=g(`~/`),h=g(l([])),_=g(``),b=g(!1),S=g(null),w=g(!1),T=g(!1),E=g(null),D=0,O=g(!1),k=e(()=>Ep(o(f)).toLowerCase()),te=e(()=>{if(o(b)){let e=o(f).trim().replace(/^[\\/]+/,``).toLowerCase();return o(h).filter(t=>t.name.toLowerCase().startsWith(e)||t.fullPath.toLowerCase().startsWith(e))}let e=o(k).startsWith(`.`);return o(h).filter(t=>t.name===`..`?o(k).length===0:t.name.toLowerCase().startsWith(o(k))&&(e||!t.name.startsWith(`.`)))}),ne=e(()=>o(f).trim()),M=e(()=>Np({query:o(f),browseParentPath:o(_),browseEntries:o(h)})),N=e(()=>Pp({query:o(f),browseParentPath:o(_),browseEntries:o(h)})),re=e(()=>!o(b)&&o(M).length>0&&(wp(o(ne))||o(_).length>0)),F=e(()=>r()===`reconnect`?`Reconnect`:o(N)?`Create & add`:`Add`),ie=e(()=>{if(o(te).length>0)return o(te);let e=Ep(o(f)).replace(/[\\/]+$/,``);if(!e||o(k).length===0)return o(te);let t=o(_).split(/[/\\]/).filter(Boolean).at(-1);return t&&t.toLowerCase()===e.toLowerCase()?[{name:t,fullPath:o(_)}]:o(te)}),ae=e(()=>o(w)?`Loading directories…`:o(b)?`Select a drive.`:o(M).length>0&&!o(N)?r()===`reconnect`?`Press Enter to reconnect this directory.`:`Press Enter to add this directory.`:o(N)?r()===`reconnect`?`Press Enter to create and reconnect this directory.`:`Press Enter to create and add this directory.`:`No matching directories in this path.`);c(()=>{if(!n.open){C(O,!1);return}o(O)||(C(O,!0),C(f,`~/`),C(S,null),C(E,null),C(b,!1),oe(o(f)))}),c(()=>{if(!n.open||!o(O))return;let e=o(f),t=window.setTimeout(()=>{o(b)&&Op(e)||oe(e)},180);return()=>{window.clearTimeout(t)}});async function oe(e){let t=++D;C(w,!0);try{let r=await n.desktopApi.browseFilesystem({partialPath:e.trim().length>0?e:`~/`});if(t!==D)return;C(_,r.parentPath,!0),C(h,r.entries,!0),C(b,r.volumeList===!0),C(E,null)}catch(e){if(t!==D)return;C(E,e instanceof Error?e.message:`Failed to browse directories.`,!0)}finally{t===D&&C(w,!1)}}function se(e){C(f,Dp(e.fullPath),!0),C(S,e.fullPath,!0)}function L(e){C(f,Dp(e.workspacePath),!0),C(S,e.workspacePath,!0)}async function z(){if(o(b))return;let e=o(M);if(!e){C(E,`Enter a project directory path.`);return}C(T,!0),C(E,null);try{let t=await n.desktopApi.resolveWorkspacePath({workspacePath:e,createIfMissing:o(N)});await n.onSelect({workspacePath:t.workspacePath,displayName:t.displayName,repositoryKey:t.repositoryKey}),n.onClose()}catch(e){C(E,e instanceof Error?e.message:`Failed to open the selected project.`,!0)}finally{C(T,!1)}}function ce(e){if(e.key===`Escape`){e.preventDefault(),n.onClose();return}e.key===`Enter`&&!e.shiftKey&&o(re)&&!o(T)&&(e.preventDefault(),z())}var le=m(),de=u(le),U=e=>{var t=Vp(),c=s(t),l=s(c),h=s(l),g=s(h);un(s(g),{class:`size-4`}),B(g);var _=V(g,2);ue(_),A(_,`spellcheck`,!1);var b=V(_,2),D=e=>{wn(e,{class:`text-muted-foreground pointer-events-none absolute inset-e-24 top-1/2 size-4 -translate-y-1/2 animate-spin`})};y(b,e=>{o(w)&&e(D)});var O=V(b,2),k=s(O,!0);B(O),B(h);var te=V(h,2),ne=e=>{var t=Fp(),r=V(s(t)),o=s(r,!0);B(r),j(),B(t),x(()=>a(o,n.expectedDisplayName)),i(e,t)};y(te,e=>{r()===`reconnect`&&n.expectedDisplayName&&e(ne)}),B(l);var M=V(l,2),N=e=>{var t=Lp();v(t,21,d,e=>e.workspacePath,(e,t)=>{var n=Ip(),r=s(n,!0);B(n),x(()=>a(r,o(t).displayName)),p(`click`,n,()=>{L(o(t))}),i(e,n)}),B(t),i(e,t)};y(M,e=>{d().length>0&&e(N)});var P=V(M,2),oe=s(P),R=e=>{var t=Rp(),n=s(t,!0);B(t),x(()=>a(n,o(ae))),i(e,t)},H=e=>{var t=m(),n=u(t);v(n,17,()=>o(ie),e=>e.fullPath,(e,t)=>{var n=zp(),r=s(n),c=e=>{Ut(e,{class:`text-muted-foreground size-4 shrink-0`})},l=e=>{fn(e,{class:`text-muted-foreground size-4 shrink-0`})};y(r,e=>{o(t).name===`..`?e(c):e(l,-1)});var u=V(r,2),d=s(u,!0);B(u),B(n),x(()=>{I(n,1,`flex min-h-8 w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition ${o(S)===o(t).fullPath?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),A(n,`aria-selected`,o(S)===o(t).fullPath),a(d,o(t).name)}),p(`click`,n,()=>{se(o(t))}),i(e,n)}),i(e,t)};y(oe,e=>{o(ie).length===0?e(R):e(H,-1)}),B(P);var le=V(P,2),de=e=>{var t=Bp(),n=s(t,!0);B(t),x(()=>a(n,o(E))),i(e,t)};y(le,e=>{o(E)&&e(de)});var U=V(le,2),fe=s(U),pe=V(s(fe),2),me=s(pe);B(pe),j(2),B(fe);var W=V(fe,2);B(U),B(c),B(t),x(()=>{O.disabled=!o(re)||o(T),a(k,o(T)?`Working…`:o(F)),a(me,`Enter ${o(F)??``}`),W.disabled=o(T)}),p(`click`,t,e=>{e.target===e.currentTarget&&n.onClose()}),p(`keydown`,c,ce),ee(_,()=>o(f),e=>C(f,e)),p(`click`,O,()=>{z()}),p(`click`,W,function(...e){n.onClose?.apply(this,e)}),i(e,t)};y(de,e=>{n.open&&e(U)}),i(t,le),R()}f([`click`,`keydown`]);var Up=F(`<div class="text-muted-foreground bg-hover-fill rounded-3xl border border-dashed border-[var(--hairline)] px-4 py-4 text-sm leading-6">Choose a project to start organizing threads.</div>`),Wp=F(`<p class="text-muted-foreground truncate text-[10px] tracking-[-0.01em]"> </p>`),Gp=F(`<span class="rounded-full border border-amber-500/25 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-800 dark:text-amber-200"> </span>`),Kp=F(`<span class="rounded-full border border-emerald-500/25 bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-800 dark:text-emerald-200"> </span>`),qp=F(`<p class="text-muted-foreground pb-2 text-[12px] leading-5"> </p>`),Jp=F(`<p class="text-muted-foreground py-1.5 text-[12px]">No threads yet</p>`),Yp=F(`<form class="px-1"><input class="border-border text-foreground focus:border-ring bg-hover-fill h-9 w-full rounded-lg border px-2 text-[13px] outline-none" aria-label="Rename thread"/></form>`),Xp=F(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-amber-300" aria-label="Starting agent"></span>`),Zp=F(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-emerald-400" aria-label="Thread has an active run"></span>`),Qp=F(`<div class="group/thread relative"><button type="button"><!> <span class="truncate"> </span></button> <button type="button"><!></button></div>`),$p=F(`<button type="button" class="text-muted-foreground hover:text-muted-foreground px-2 py-1 text-[12px] transition"> </button>`),em=F(`<div class="space-y-0.5"><!> <!></div>`),tm=F(`<div class="ml-5 border-l border-[var(--hairline)] pl-3"><!> <!></div>`),nm=F(`<section class="space-y-1.5"><div class="group relative flex items-center px-2"><button type="button" class="text-muted-foreground hover:text-foreground inline-flex h-8 w-7 shrink-0 items-center justify-center rounded-md"><!></button> <button type="button"><!> <div class="min-w-0 flex-1"><p class="truncate text-[0.88rem] font-medium tracking-[-0.02em]"> </p> <!></div> <!> <!></button> <button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill absolute top-0.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md opacity-0 transition group-hover:opacity-100 focus-visible:opacity-100 disabled:cursor-not-allowed disabled:opacity-40"><!></button></div> <!></section>`),rm=F(`<div class="space-y-4"></div>`),im=F(`<div class="bg-tooltip text-tooltip-foreground ring-border pointer-events-none fixed z-100 max-w-64 -translate-y-1/2 rounded-md px-2.5 py-1.5 text-[12px] leading-4 shadow-lg ring-1" role="tooltip"> </div>`),am=F(`<div data-thread-context-menu="" class="bg-popover text-popover-foreground fixed z-110 min-w-36 rounded-lg border border-[var(--hairline)] py-1 shadow-xl" role="menu"><button type="button" class="text-foreground hover:text-foreground hover:bg-hover-fill flex w-full px-3 py-1.5 text-left text-[13px] transition" role="menuitem">Rename</button></div>`),om=F(`<aside class="app-sidebar-panel"><div class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex items-center justify-between gap-2 px-3.5 pt-3 pb-4"><!> <!></header> <div class="px-3.5 pb-1"><button type="button"><!> <span class="truncate">Create/Add Project</span></button></div> <div class="hide-scrollbar min-h-0 flex-1 overflow-y-auto px-2.5 py-3"><div class="mb-3 px-2"><p class="text-muted-foreground text-[10px] tracking-[0.24em] uppercase">Projects</p></div> <!></div> <div class="px-3.5 pt-2 pb-4"><button type="button"><!> Settings</button></div></div></aside> <!> <!>`,1);function sm(t,n){H(n,!0);let r=P(n,`pendingAgentLaunches`,19,()=>({})),d=`flex h-9 w-full min-w-0 items-center gap-2.5 rounded-lg px-2 text-[13px] font-medium tracking-[-0.02em] text-foreground transition hover:bg-hover-fill hover:text-foreground`,f=`size-4 shrink-0 text-muted-foreground`,_=g(l({})),b=g(l({})),S=g(null),w=g(null),T=g(null),E=g(``),D=g(``),O=g(null),k=g(null);c(()=>{!o(T)||!o(O)||(o(O).focus(),o(O).select())}),c(()=>{if(!o(k))return;function e(e){let t=e.target;t instanceof Element&&t.closest(`[data-thread-context-menu]`)||C(k,null)}function t(e){e.key===`Escape`&&C(k,null)}return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t,!0)}});function te(e,t){if(o(T))return;let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let r=n.getBoundingClientRect();C(S,t,!0),C(w,{top:r.top+r.height/2,left:r.right+8},!0)}function ne(){C(S,null),C(w,null)}function N(e){return o(_)[e]??!1}function re(e){C(_,{...o(_),[e]:!N(e)},!0)}function F(e){return o(b)[e]??!1}function ie(e){C(b,{...o(b),[e]:!F(e)},!0)}function ae(e){return e.project.localAttachmentAvailability===`unavailable`?`Missing`:null}function oe(e,t){C(k,null),ne(),C(T,e,!0),C(E,t,!0),C(D,t,!0)}function se(){C(T,null),C(E,``),C(D,``)}function L(){let e=o(T);if(!e)return;let t=o(E).trim();C(T,null),C(E,``);let r=o(D);C(D,``),t.length!==0&&t!==r&&n.onRenameThread(e,t)}function le(e,t){e.preventDefault(),ne(),C(k,{threadId:t.threadId,title:t.title,x:e.clientX,y:e.clientY},!0)}var de=om(),U=u(de),fe=s(U),pe=s(fe),me=s(pe);Le(me,{size:`sm`,class:`min-w-0`}),ks(V(me,2),{get theme(){return n.theme},get onThemeChange(){return n.onThemeChange}}),B(pe);var W=V(pe,2),he=s(W);I(he,1,M(d)),cn(s(he),{class:f,"aria-hidden":`true`}),j(2),B(he),B(W);var ge=V(W,2),_e=V(s(ge),2),ve=e=>{var t=Up();i(e,t)},ye=t=>{var c=rm();v(c,21,()=>n.groups,e=>e.project.workspacePath,(t,c)=>{let l=e(()=>o(c).project),f=e(()=>ae(o(c)));var g=nm(),_=s(g),b=s(_),S=s(b);{let t=e(()=>`size-3 shrink-0 transition-transform ${F(o(l).workspacePath)?``:`rotate-90`}`);jt(S,{get class(){return o(t)}})}B(b);var w=V(b,2),D=s(w);fn(D,{class:`text-muted-foreground size-4 shrink-0`});var k=V(D,2),j=s(k),M=s(j,!0);B(j);var P=V(j,2),oe=e=>{var t=Wp(),n=s(t,!0);B(t),x(()=>a(n,o(l).workspacePath)),i(e,t)};y(P,e=>{o(l).repositoryKey!==o(l).displayName&&e(oe)}),B(k);var R=V(k,2),z=e=>{var t=Gp(),n=s(t,!0);B(t),x(()=>a(n,o(f))),i(e,t)};y(R,e=>{o(f)&&e(z)});var H=V(R,2),de=e=>{var t=Kp(),n=s(t,!0);B(t),x(()=>a(n,o(c).activeThreadCount)),i(e,t)};y(H,e=>{o(c).activeThreadCount>0&&e(de)}),B(w);var U=V(w,2),fe=s(U),pe=e=>{Wn(e,{class:`size-4`})},me=e=>{cn(e,{class:`size-4`})};y(fe,e=>{o(l).localAttachmentAvailability===`available`?e(pe):e(me,-1)}),B(U),B(_);var W=V(_,2),he=t=>{var f=tm(),g=s(f),_=e=>{var t=qp(),n=s(t,!0);B(t),x(()=>a(n,o(l).localAttachmentError??`This project needs to be reconnected.`)),i(e,t)};y(g,e=>{o(l).localAttachmentAvailability===`unavailable`&&e(_)});var b=V(g,2),S=e=>{var t=Jp();i(e,t)},w=t=>{let f=e(()=>N(o(l).workspacePath)),g=e(()=>o(f)?o(c).threads:o(c).threads.slice(0,3)),_=e(()=>o(c).threads.length>3);var b=em(),S=s(b);v(S,17,()=>o(g),e=>e.threadId,(t,c)=>{let f=e(()=>Zo(r(),o(c).threadId)),g=e(()=>o(c).threadId===n.currentThreadId),_=e(()=>o(T)===o(c).threadId);var v=m(),b=u(v),S=e=>{var t=Yp(),n=s(t);ue(n),ce(n,e=>C(O,e),()=>o(O)),B(t),h(`submit`,t,e=>{e.preventDefault(),L()}),p(`keydown`,n,e=>{e.key===`Escape`&&(e.preventDefault(),se())}),h(`blur`,n,()=>{L()}),ee(n,()=>o(E),e=>C(E,e)),i(e,t)},w=e=>{var t=Qp(),r=s(t),u=s(r),m=e=>{var t=Xp();i(e,t)},_=e=>{var t=Zp();i(e,t)};y(u,e=>{o(f)?e(m):o(c).hasActiveRun&&e(_,1)});var v=V(u,2),b=s(v,!0);B(v),B(r);var S=V(r,2);ht(s(S),{class:`size-3.5`,"aria-hidden":`true`}),B(S),B(t),x(()=>{I(r,1,`${d} pr-8 ${o(g)?`text-foreground bg-hover-fill`:`text-muted-foreground`}`),A(r,`aria-current`,o(g)?`page`:void 0),a(b,o(c).title),I(S,1,`text-muted-foreground hover:text-foreground hover:bg-hover-fill absolute top-1.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md transition focus-visible:opacity-100 ${o(g)?`opacity-100`:`opacity-0 group-focus-within/thread:opacity-100 group-hover/thread:opacity-100`}`),A(S,`aria-label`,`Archive ${o(c).title}`)}),h(`mouseenter`,r,e=>{te(e,o(c).title)}),h(`mouseleave`,r,ne),h(`focus`,r,e=>{te(e,o(c).title)}),h(`blur`,r,ne),p(`contextmenu`,r,e=>{le(e,o(c))}),p(`click`,r,()=>{n.onSelectThread(o(c),o(l).workspacePath)}),p(`click`,S,e=>{e.stopPropagation(),ne(),n.onArchiveThread(o(c).threadId)}),i(e,t)};y(b,e=>{o(_)?e(S):e(w,-1)}),i(t,v)});var w=V(S,2),D=e=>{var t=$p(),n=s(t,!0);B(t),x(()=>a(n,o(f)?`Show less`:`Show more`)),p(`click`,t,()=>{re(o(l).workspacePath)}),i(e,t)};y(w,e=>{o(_)&&e(D)}),B(b),i(t,b)};y(b,e=>{o(c).threads.length===0?e(S):e(w,-1)}),B(f),i(t,f)},ge=e(()=>!F(o(l).workspacePath));y(W,e=>{o(ge)&&e(he)}),B(g),x(e=>{A(b,`aria-label`,e),I(w,1,`flex min-w-0 flex-1 items-center gap-2 rounded-xl px-2 py-1 pr-8 text-left transition ${o(l).workspacePath===n.currentWorkspacePath?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),a(M,o(l).displayName),A(U,`aria-label`,o(l).localAttachmentAvailability===`available`?`Create thread in ${o(l).displayName}`:`Reconnect ${o(l).displayName}`)},[()=>F(o(l).workspacePath)?`Expand ${o(l).displayName} threads`:`Collapse ${o(l).displayName} threads`]),p(`click`,b,()=>{ie(o(l).workspacePath)}),p(`click`,w,()=>{n.onSelectProject(o(l).workspacePath)}),p(`click`,U,()=>{if(o(l).localAttachmentAvailability===`available`){n.onStartThreadDraft(o(l).workspacePath);return}n.onReconnectProject(o(l).workspacePath)}),i(t,g)}),B(c),i(t,c)};y(_e,e=>{n.groups.length===0?e(ve):e(ye,-1)}),B(ge);var be=V(ge,2),G=s(be);I(G,1,M(d)),Bn(s(G),{class:f,"aria-hidden":`true`}),j(),B(G),B(be),B(fe),B(U);var xe=V(U,2),Se=e=>{var t=im(),n=s(t,!0);B(t),x(()=>{z(t,`top: ${o(w).top}px; left: ${o(w).left}px;`),a(n,o(S))}),i(e,t)};y(xe,e=>{o(S)&&o(w)&&!o(k)&&!o(T)&&e(Se)});var Ce=V(xe,2),we=e=>{var t=am(),n=s(t);B(t),x(()=>z(t,`top: ${o(k).y}px; left: ${o(k).x}px;`)),p(`click`,n,()=>{oe(o(k).threadId,o(k).title)}),i(e,t)};y(Ce,e=>{o(k)&&e(we)}),p(`click`,he,function(...e){n.onAddProject?.apply(this,e)}),p(`click`,G,function(...e){n.onOpenSettings?.apply(this,e)}),i(t,de),R()}f([`click`,`keydown`,`contextmenu`]);function cm(e){return e===`running`||e===`awaiting_executor`}function lm(e,t){return cm(e.status)?e.claimExpiresAt!==void 0&&e.claimExpiresAt>t:!1}function um(e){return{repositoryKey:e.repositoryKey,displayName:e.displayName,workspacePath:e.workspacePath,localAttachmentAvailability:e.availability,localAttachmentError:e.unavailableReason}}function dm(e){let t=e.recoveredSubmission,n=e.latestRun;return(n===null||n.submissionId===t?.submissionId&&!Va(n.status))&&t?.prompt===e.prompt&&t.selectedModel===e.selectedModel&&t.reasoningEffort===e.reasoningEffort&&t.serviceTier===e.serviceTier&&to(t.imageUploadIds,e.imageUploadIds)?t.submissionId:e.newSubmissionId}function fm(e){return e.submissionRunStatus&&Va(e.submissionRunStatus)?e.freshSubmissionId:e.threadSubmissionId}function pm(e,t){return e?e.status===`queued`||lm(e,t):!1}function mm(e,t){return e?e.status===`cancelled`?`cancelled`:e.status===`failed`?e.lastError===`The local agent stopped responding before this run finished.`?`crash`:`failed`:cm(e.status)&&!lm(e,t)?`crash`:null:null}function hm(e){e.desktopApi.runAgent({authToken:e.authToken,threadId:e.threadId,prompt:e.prompt,imageUploadIds:e.imageUploadIds,selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,submissionId:e.submissionId,workspacePath:e.workspacePath}).then(({runId:t})=>{e.onStarted(t)}).catch(t=>{let n=t instanceof Error?t:Error(String(t));console.error(`Failed to run agent`,n),e.onError(n)})}function gm(e){return Object.fromEntries(e.map(e=>[e.workspacePath,e]))}async function _m(e){return e?gm(await e.listProjectAttachments()):{}}async function vm(e){let t={workspacePath:e.workspacePath};return e.replaceWorkspacePath&&(t.replaceWorkspacePath=e.replaceWorkspacePath),await e.desktopApi.attachProject(t)}async function ym(e){if(e.desktopApi)try{let t=(await e.desktopApi.listProjectAttachments()).find(t=>t.workspacePath===e.workspacePath);if(!t||t.availability!==`available`)throw Error(t?.unavailableReason??`Workspace path is unavailable.`);await e.refreshDesktopProjectAttachments()}catch(t){throw await e.refreshDesktopProjectAttachments(),t}}function bm(e,t){if(e.runStartedAt!==t.runStartedAt)return e.runStartedAt-t.runStartedAt;let n=e._creationTime??0,r=t._creationTime??0;return n===r?e.type===t.type?e._id.localeCompare(t._id):e.type===`prompt`?-1:1:n-r}function xm(e){return`prompt:${e}`}function Sm(e){return`response:${e}`}function Cm(e){if(e.type===`tool-call`||e.type===`tool-result`)return e.callId}function wm(e){return{type:`tool-result`,callId:e.tool?.callId??`tool:${e.number}`,name:e.tool?.name??`tool`,output:e.tool?.output??null}}function Tm(e,t){return(e.prompt?.imageUploads??[]).map(e=>({imageUploadId:e.imageUploadId,name:e.name,mediaType:e.mediaType,size:e.size,url:t.get(e.imageUploadId)??e.url??null}))}function Em(e){let t=e.attachmentUrls??new Map,n=[...e.parts].sort((e,t)=>e.number-t.number),r=[],i=null,a=()=>{i&&=(r.push(i),null)};for(let o of n){if(o.kind===`prompt`){a(),r.push({_id:xm(o.runId),_creationTime:o.number,threadId:e.threadId,runId:o.runId,userId:e.userId,type:`prompt`,text:o.prompt?.text??``,attachments:Tm(o,t),parts:[],runStatus:`completed`,runStartedAt:o.number});continue}if(o.kind===`completion`){let t=o.completion?.items??[],n=t.filter(e=>e.type===`text`).map(e=>e.text).join(``);if(i&&i.runId===o.runId){i.parts=[...i.parts,...t],i.text+=n;continue}a(),i={_id:Sm(o.runId),_creationTime:o.number,threadId:e.threadId,runId:o.runId,userId:e.userId,type:`response`,text:n,attachments:[],parts:t,runStatus:`completed`,runStartedAt:o.number};continue}if(o.kind===`tool`){let t=wm(o);if(i&&i.runId===o.runId)i.parts=[...i.parts,t];else{let n=r.at(-1);n?.type===`response`&&n.runId===o.runId?n.parts=[...n.parts,t]:(a(),i={_id:Sm(o.runId),_creationTime:o.number,threadId:e.threadId,runId:o.runId,userId:e.userId,type:`response`,text:``,attachments:[],parts:[t],runStatus:`completed`,runStartedAt:o.number})}}}return a(),r}function Dm(e,t){return t?e.some(e=>e.kind!==`completion`||e.runId!==t.runId?!1:t.streamId&&e.completion?.streamId?e.completion.streamId===t.streamId:!0):!1}function Om(e){let t=Em({parts:e.parts,userId:e.userId,threadId:e.threadId,attachmentUrls:e.attachmentUrls}),n=e.latestRun;if(n)for(let e of t)e.runId===n._id&&(e.runStatus=n.status,e.runStartedAt=n.startedAt,n.completedAt!==void 0&&(e.runCompletedAt=n.completedAt));n&&e.latestPrompt&&!t.some(e=>e.type===`prompt`&&e.runId===n._id)&&t.push({_id:xm(n._id),_creationTime:n.startedAt,threadId:e.threadId,runId:n._id,userId:e.userId,type:`prompt`,text:e.latestPrompt.text,attachments:e.latestPrompt.imageUploadIds.map(t=>({imageUploadId:t,name:`attachment`,mediaType:`application/octet-stream`,size:0,url:e.attachmentUrls?.get(t)??null})),parts:[],runStatus:n.status,runStartedAt:n.startedAt,runCompletedAt:n.completedAt});let r=e.live;if(r&&!Dm(e.parts,r)){let i=t.findIndex(e=>e.type===`response`&&e.runId===r.runId),a=i>=0?t[i]:void 0,o=new Set(r.parts.flatMap(e=>{let t=Cm(e);return t?[t]:[]})),s=[...(a?.parts??[]).filter(e=>{if(e.type===`tool-result`){let t=Cm(e);return t!==void 0&&!o.has(t)}return r.streamId?!(`turnId`in e&&e.turnId===r.streamId):!1}),...r.parts],c={_id:a?._id??Sm(r.runId),_creationTime:r.runStartedAt,threadId:e.threadId,runId:r.runId,userId:e.userId,type:`response`,text:Js(s),attachments:[],parts:s,runStatus:n&&n._id===r.runId?n.status:r.runStatus,runStartedAt:r.runStartedAt};i>=0?t[i]=c:t.push(c)}return t.sort(bm)}function km(e,t){let n=new Map;for(let t of e)n.set(t.number,t);for(let e of t)n.set(e.number,e);return[...n.values()].sort((e,t)=>e.number-t.number)}var Am=F(`<div class="bg-background h-screen overflow-hidden"><!> <!></div>`),jm=F(`<button type="button" class="text-muted-foreground hover:text-foreground hover:bg-muted absolute top-3 right-3 z-100 inline-flex items-center justify-center rounded-md p-2 transition" aria-label="Open side panel"><!></button>`),Mm=F(`<div role="alert" class="text-destructive mb-3 flex items-center justify-between gap-3 rounded-md border border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"><span> </span> <!></div>`),Nm=F(`<div class="text-muted-foreground mb-3 text-sm">Loading models…</div>`),Pm=F(`<!> <!> <!>`,1),Fm=F(`<div><!></div>`),Im=F(`<div class="relative h-screen overflow-hidden"><div><!> <main class="relative flex h-screen min-h-0 min-w-0 flex-col overflow-hidden"><!> <!></main></div> <!> <!> <!></div>`);function Lm(t,r){H(r,!0);let d=()=>se(be,`$authState`,h),f=()=>se(he,`$convexAuthRetryPending`,h),[h,v]=le(),w=Me(),T=g(!1),D=e(()=>!!d().user),O=e(f),k=e(()=>d().isReady&&!d().isLoading&&o(D)&&!w.isLoading&&w.isAuthenticated),ee=e(()=>o(D)&&d().isReady&&!d().isLoading&&!o(O)&&!w.isLoading&&!w.isAuthenticated);c(()=>{let e=Ce({retryPending:o(O),isAuthenticated:w.isAuthenticated,isLoading:w.isLoading,sawLoadingDuringRetry:o(T)});o(T)!==e.sawLoadingDuringRetry&&C(T,e.sawLoadingDuringRetry,!0),e.clearPending&&he.set(!1)});let A=je(G.threads.create),te=je(G.threads.rekeyRepository),ne=je(G.threads.rename),N=je(G.threads.archive),P=je(G.threads.restore),F=je(G.agentRuntime.finalizeRun),ie=je(G.agentRuntime.reopenRun),ae=je(G.agentQuestions.answer),L=je(G.uiPreferences.setTheme),z=je(G.imageUploads.generateUploadUrl),ce=je(G.imageUploads.register),ue=je(G.imageUploads.discard),de=je(G.billing.ensureMySubscription),U=g(void 0),fe=g(null),pe=g(!0);async function me(){C(pe,!0);try{let e=Ie.data.env.PUBLIC_MODEL_GATEWAY_URL?.trim()??``;C(U,await Ei(e),!0),C(fe,null)}catch{C(fe,pi,!0),C(U,void 0)}finally{C(pe,!1)}}let Te=null;c(()=>{if(!o(k))return;let e=St();!e||Te===e||(Te=e,de({}).catch(()=>{}))});let Ee=`Connect to a running Sprocket server to use this project.`,De=3e4,K=g(null),Oe=g(!1),ke=g(null),Ae=g(null),q=g(null),Pe=g(null),Fe=g(l(ri)),J=g(l(`max`)),Le=g(l(ii)),We=g(``),Ge=g(null),Y=g(!1),Ke=g(l([])),X=g(null),qe=g(0),Je=new pr,Ye=new pr,Xe=new pr,Ze=new pr,Qe=new fr,$e=g(l({})),et=g(0),tt=g(null),nt=0,rt=0,it=g(!1),at=g(null),ot=null,st=g(0),Z=g(null),ct=g(l({})),lt=g(!1),ut=0,dt=g(null),ft=g(!1),pt=g(`add`),Q=g(void 0),mt=g(null),ht=g(!1),gt=g(`account`),_t=g(l([])),vt=g(!1),yt=g(!1),bt=new pr,xt=g(null);function St(){return d().user?.id??null}function Ct(e,t){return o(Ke).find(t=>t.localId===e)?(C(Ke,o(Ke).map(n=>n.localId===e?{...n,...t}:n),!0),!0):!1}async function wt(e,t,n){try{let r=await z({}),i=await fetch(r,{method:`POST`,headers:{"Content-Type":t.type},body:t});if(!i.ok)throw Error(`Upload failed (${i.status}).`);let{storageId:a}=await i.json(),s=await ce({storageId:a,name:n});if(`error`in s)throw Error(s.error);let c=o(Ke).find(t=>t.localId===e);c&&URL.revokeObjectURL(c.previewUrl),Ct(e,{status:`ready`,imageUploadId:s.imageUploadId,previewUrl:s.url})||ue({imageUploadId:s.imageUploadId}).catch(()=>{})}catch(t){let n=t instanceof Error?t.message:`Upload failed.`;Ct(e,{status:`error`,error:n}),C(X,n,!0)}}function Tt(e){for(let t of e){let e=ao(o(Ke).length,t);if(e){C(X,e,!0);continue}let n=crypto.randomUUID(),r=t.name||`Pasted image`;C(Ke,[...o(Ke),{localId:n,name:r,mediaType:t.type,size:t.size,previewUrl:URL.createObjectURL(t),status:`uploading`}],!0),wt(n,t,r)}}function Et(e){let t=o(Ke).find(t=>t.localId===e);t&&(URL.revokeObjectURL(t.previewUrl),C(Ke,o(Ke).filter(t=>t.localId!==e),!0),t.imageUploadId&&ue({imageUploadId:t.imageUploadId}).catch(()=>{}))}function Dt(e){for(let t of o(Ke))URL.revokeObjectURL(t.previewUrl),e.discard&&t.imageUploadId&&ue({imageUploadId:t.imageUploadId}).catch(()=>{});C(Ke,[],!0)}function Ot(e,t){return e?`thread:${e}`:t?`draft:${t}`:null}function kt(e,t){Je.get(e)===t&&Je.delete(e)}function At(e,t){return`${e}\0${t}`}function jt(e,t,n){Ye.set(At(e,t),n)}function Mt(e,t){let n=At(e,t);Ye.delete(n),Xe.delete(n)}function Nt(){return d().user&&w.isAuthenticated&&!w.isLoading?{}:`skip`}let Pt=Ne(G.threads.listMine,Nt),Ft=Ne(G.uiPreferences.getMine,Nt),It=g(l(ze(null))),Lt=!1,Rt,zt=null,Bt=0;c(()=>{if(!o(k)){Lt=!1,Rt=void 0,zt=null,Bt=0;return}let e=Ft.data;if(e===void 0||zt!==null)return;let t=e?.theme;if(Lt&&t===Rt)return;Lt=!0,Rt=t;let n=ze(t);C(It,n,!0),Re(n)});async function Vt(e){let t=o(It),n=++Bt;zt=e,C(It,e,!0),Re(e);try{if(await L({theme:e}),n!==Bt)return;Rt=e}catch(e){if(n!==Bt)return;C(It,t,!0),Re(t),C(X,e instanceof Error?e.message:`Failed to save theme preference.`,!0)}finally{n===Bt&&(zt=null)}}let Ht=()=>o(q)&&Nt()!==`skip`?{threadId:o(q)}:`skip`,Ut=Ne(G.threads.getByThreadId,Ht),Wt=Ne(G.chat.latestRunForThread,Ht),Gt=Ne(G.artifacts.listArtifactsForThread,Ht),Kt=Ne(G.browserSessions.liveViewForThread,Ht),qt=Ne(G.agentQuestions.headPendingForThread,Ht),Jt=e(()=>{for(let e of[Pt,Ft,Ut,Wt,Kt,qt])if(e.error)return e.error;return null}),Yt=e(()=>Object.values(o(ct)).sort((e,t)=>t.lastUsedAt-e.lastUsedAt).map(um)),Xt=e(()=>(Pt.data??[]).map(Ro)),Zt=e(()=>Jo(Ut.data,o(q))),Qt=e(()=>{let e=o(U)?mi(o(U),o(Fe))??mi(o(U),o(U).defaultModelId):void 0;return{inputTokens:o(Zt)?.contextTokens??0,totalTokensProcessed:o(Zt)?o(Zt).totalTokensProcessed:0,contextWindowTokens:e?.contextWindowTokens??0,autoCompactTokenLimit:e?.autoCompactTokenLimit??0}}),$t=e(()=>Jo(Wt.data,o(q))),en=e(()=>Jo(qt.data,o(q))),tn=g(l([])),nn=g(null),rn=g(!1),an=g(null),on=g(!1),sn=g(!1),cn=g(null),ln=g(null),un=g(!1),dn=g(null),fn=new pr;function pn(e){C(on,e==null),C(nn,e??null,!0)}function mn(e){fn.set(e,{parts:o(tn).slice(),nextBefore:o(nn),stale:o(rn),reachedHistoryStart:o(on),contextSummary:o(cn)})}function hn(e){if(o(an)&&o(an)!==e&&mn(o(an)),C(an,e,!0),C(dn,null),C(ln,null),!e){C(tn,[],!0),C(nn,null),C(rn,!1),C(on,!1),C(sn,!1),C(cn,null);return}let t=fn.get(e);if(t){C(tn,t.parts.slice(),!0),C(nn,t.nextBefore,!0),C(rn,t.stale,!0),C(on,t.reachedHistoryStart,!0),C(sn,!1),C(cn,t.contextSummary,!0);return}C(tn,[],!0),C(nn,null),C(rn,!1),C(on,!1),C(sn,!0),C(cn,null)}b(()=>{let e=o(q);o(an)!==e&&_(()=>hn(e))}),c(()=>{let e=o(q),t=o(K);if(!e||!t||!o(D))return;let n=_(()=>d().user?.id??null);if(!n)return;let r=new AbortController,i=e;return(async()=>{try{let e=await t.fetchTranscriptPage({userId:n,threadId:i});if(r.signal.aborted||o(q)!==i)return;C(tn,e.parts,!0),C(rn,e.stale,!0),C(sn,!1),C(ln,null),C(cn,e.contextSummary??null,!0),pn(e.nextBefore),mn(i)}catch{r.signal.aborted||(C(sn,!1),o(tn).length===0?C(ln,`Could not load conversation history.`):C(rn,!0))}try{let e=await Se();if(!e||r.signal.aborted||o(q)!==i)return;await t.watchTranscript({authToken:e,userId:n,threadId:i},{signal:r.signal,onEvent:e=>{C(rn,e.stale,!0),lr(i,n)}})}catch{r.signal.aborted||C(rn,!0)}})(),()=>{r.abort()}}),c(()=>{let e=o(q),t=o(K);if(!e||!t||!o(D))return;let n=_(()=>d().user?.id??null);if(!n)return;let r=new AbortController,i=e;return(async()=>{for(;!r.signal.aborted;){try{let e=await Se();if(r.signal.aborted)return;e&&await t.watchLiveCompletion({authToken:e,userId:n,threadId:i},{signal:r.signal,onEvent:e=>{r.signal.aborted||o(q)!==i||(e.eventType===`updated`?C(dn,e.live,!0):C(dn,null))}})}catch{if(r.signal.aborted)return}if(r.signal.aborted)return;await new Promise(e=>{let t=setTimeout(e,400);r.signal.addEventListener(`abort`,()=>{clearTimeout(t),e()},{once:!0})})}})(),()=>{r.abort()}});let gn=e(()=>{let e=St();if(!o(q)||!e||o(an)!==o(q)||o(sn)&&o(tn).length===0)return[];let t=o(Rn)?null:o(dn),n=o($t)?.run??null;return Om({parts:o(tn),live:t,latestRun:n,latestPrompt:n&&o($t)?.prompt?{text:o($t).prompt,imageUploadIds:o($t).imageUploadIds??[]}:void 0,userId:e,threadId:o(q)})}),_n=e(()=>o(ke)?Bo(o(Yt),o(ke)):o(Ae)?zo(o(Yt),o(Ae)):null),vn=e(()=>o(_n)?.workspacePath??o(ke)),yn=e(()=>{let e=o(_n)?.workspacePath??null,t=o(K);return{workspacePath:e,load:async()=>{if(!t||!e)return[];let n=await t.listWorkspaceSkills({workspacePath:e});for(let e of n.warnings)console.warn(`sprocket skills: ${e}`);return n.skills}}}),bn=e(()=>o(_n)?.repositoryKey?o(Xt).filter(e=>e.repositoryKey===o(_n).repositoryKey&&Vo(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt):[]),xn=e(()=>Uo(o(Yt),o(Xt))),Sn=e(()=>o($t)?.run??null),Cn=e(()=>(o(Rn)?(o($t)?.jobs??[]).filter(e=>!e.hidden&&(e.status===`completed`||e.status===`failed`||e.status===`cancelled`)):o($t)?.jobs??[]).slice(-60)),wn=e(()=>(Gt.data??[]).map(e=>({key:e.artifact._id,title:e.artifact.title,artifactType:e.artifact.type,content:e.currentContent}))),Tn=new pr,En=g(l({...Cp})),Dn=null,On=null,kn=null;c(()=>{let e=o(q);e!==Dn&&(Dn&&Tn.set(Dn,o(En)),Dn=e,C(xt,null),C(En,{...e&&Tn.get(e)||Cp},!0))}),c(()=>{let e=o(q),t=Gt.data;if(!e){On=null;return}if(On&&On.threadId!==e&&(On=null),t===void 0)return;let n=t.map(e=>({id:e.artifact._id,currentVersion:e.artifact.currentVersion,updatedAt:e.artifact.updatedAt})),{revisions:r,changedId:i}=Sp(On?.revisions??null,n);if(On={threadId:e,revisions:r},!i)return;let a=_(()=>o(En));C(En,{...a,open:!0,tab:a.open?a.tab:`artifacts`,selectedKey:!a.open||a.selectedKey===null?i:a.selectedKey},!0)}),c(()=>{let e=o(q),t=Kt.data,n=o(In)?o(Sn)?._id??null:null;if(!e){kn=null;return}if(kn&&kn.threadId!==e&&(kn=null),t===void 0)return;let r=t?.lastUsedRunId??null,i=kn;if(kn={threadId:e,runId:r},r===null||r!==n||i&&i.runId===r)return;let a=_(()=>o(En));a.open&&a.tab===`live`||C(En,{...a,open:!0,tab:`live`},!0)});let An=e(()=>o(wn).find(e=>e.key===o(xt))??null),jn=e(()=>Ot(o(q),o(vn))),Mn=e(()=>o(tt)&&o(tt).runId===(o(Sn)?._id??null)?o(tt).serverNow+Math.max(0,o(et)-o(tt).localObservedAt):o($t)?.serverNow??Date.now()),Nn=e(()=>{let e=St();if(!(!e||!o(jn)))return Xe.get(At(e,o(jn)))}),Fn=e(()=>o(Sn)?.status===`queued`&&o(Nn)?.submissionId===o(Sn).submissionId),In=e(()=>pm(o(Sn),o(Mn))&&!o(Fn)),Ln=e(()=>Zo(o($e),o(q))),Rn=e(()=>o(Ln)||o(In)?null:mm(o(Sn),o(Mn))),zn=e(()=>Xo({threadId:o(q),pendingCreatedThreadId:o(Z),hasLatestRunData:!!o($t)})),Bn=e(()=>!!(o(jn)&&Je.has(o(jn)))),Vn=e(()=>!!(o(vn)&&o(_n)?.localAttachmentAvailability===`available`&&!o(Bn)&&!o(Y)&&!o(Ln)&&(!o(In)&&o(zn)||o(en)))),Hn=e(()=>{let e=new fr,t=[];for(let n of Object.values(o(ct))){if(n.availability!==`available`||e.has(n.workspacePath))continue;e.add(n.workspacePath);let r=n.workspacePath.split(/[/\\]/).filter(Boolean).at(-1)??n.workspacePath;t.push({workspacePath:n.workspacePath,displayName:r})}return t.sort((e,t)=>t.displayName.localeCompare(e.displayName))});async function Un(){let e=++ut,t=await _m(o(K));e===ut&&(C(ct,t,!0),C(lt,!0),await Wn(t))}async function Wn(e){if(Nt()!==`skip`)for(let t of Object.values(e)){let n=t.previousRepositoryKey;!n||n===t.repositoryKey||(!Object.values(e).some(e=>e.workspacePath!==t.workspacePath&&e.repositoryKey===n)&&Nt()!==`skip`&&await te({from:n,to:t.repositoryKey}),o(ke)===t.workspacePath&&C(Ae,t.repositoryKey,!0),await qn(t.workspacePath))}}function Gn(e,t=null,n=!1){let r=Bo(o(Yt),e);C(ke,e,!0),C(Ae,r?.repositoryKey??null,!0),C(q,t,!0),C(Pe,n?e:null,!0),t!==o(Z)&&C(Z,null)}function Kn(e,t=null,n=!1,r=!1){C(st,o(st)+1),r||C(X,null),Gn(e,t,n)}async function qn(e,t){if(!o(K))throw Error(Ee);let n=await vm({desktopApi:o(K),workspacePath:e,replaceWorkspacePath:t});ut+=1;let r={...o(ct),[n.workspacePath]:n};return t&&t!==n.workspacePath&&delete r[t],C(ct,r,!0),C(lt,!0),n}function Jn(e,t={}){let n=Bo(o(Yt),e);if(!n){C(X,`Choose a project first.`);return}Kn(e,t.threadId,t.draft);let r=o(st);nr(n.workspacePath).catch(e=>{r===o(st)&&C(X,e instanceof Error?e.message:`Failed to attach project.`,!0)})}function Yn(e=`add`,t=null){if(!o(K)){C(X,Ee);return}C(pt,e,!0),C(mt,t,!0);let n=e===`reconnect`&&t?Bo(o(Yt),t):void 0;C(Q,n?.displayName,!0),C(ft,!0),C(X,null)}async function Xn(e){if(!o(K)){C(X,Ee);return}let t=St();if(!t){C(X,`User session is not ready.`);return}try{if(o(pt)===`reconnect`&&o(mt)){await Qn(e,o(mt),t);return}await Zn(e,t)}catch(e){if(St()!==t)return;throw C(X,e instanceof Error?e.message:`Failed to attach project.`,!0),e}}async function Zn(e,t){await qn(e.workspacePath),St()===t&&(Kn(e.workspacePath,null,!0),C(X,null))}async function Qn(e,t,n){let r=Bo(o(Yt),t);if(await qn(e.workspacePath,t===e.workspacePath?void 0:t),St()!==n)return;r&&r.repositoryKey!==e.repositoryKey&&Nt()!==`skip`&&!o(Yt).some(t=>t.workspacePath!==e.workspacePath&&t.repositoryKey===r.repositoryKey)&&await te({from:r.repositoryKey,to:e.repositoryKey});let i=r?.repositoryKey===e.repositoryKey?o(q):null;Kn(e.workspacePath,i),C(X,null)}function $n(e){let t=e?.trim();t&&C(_t,[...o(_t),t],!0)}async function er(){let e=window.sprocketDesktopBridge;if(e?.takeWorkspaceLaunch)for(;;){let t=await e.takeWorkspaceLaunch();if(!t)return;$n(t)}}async function tr(e,t,n){let r=await t.resolveWorkspacePath({workspacePath:e});St()===n&&await Zn(r,n)}async function nr(e){await ym({desktopApi:o(K),refreshDesktopProjectAttachments:Un,workspacePath:e})}function rr(e){Yn(`reconnect`,e)}function ir(e){window.setTimeout(()=>{if(St()!==e.userId||o(Z)!==e.threadId||o(q)!==e.threadId||o(ke)!==e.workspacePath||o(Xt).some(t=>t.threadId===e.threadId))return;C(Z,null),Kn(e.workspacePath,null,!0);let t=Ot(null,e.workspacePath);t&&jt(e.userId,t,{message:`The new thread did not appear. Review your prompt and try sending it again.`,prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,selectedModel:e.selectedModel,submissionId:e.submissionId})},De)}async function ar(e){let t=await A({submissionId:e.submissionId,repositoryKey:e.repositoryKey,selectedModel:e.selectedModel,reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier});return e.isSubmissionCurrent()?(e.userId===St()&&e.selectionGeneration===o(st)&&(C(Z,t.threadId,!0),C(st,o(st)+1),C(q,t.threadId,!0),C(Pe,null),ir({prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier,selectedModel:e.selectedModel,submissionId:e.submissionId,threadId:t.threadId,userId:e.userId,repositoryKey:e.repositoryKey,workspacePath:e.workspacePath})),t):null}function or(e){Jn(e,{draft:!0})}function sr(e,t){Jn(t,{threadId:e.threadId})}async function cr(e,t){try{await ne({threadId:e,title:t})}catch(e){C(X,e instanceof Error?e.message:`Failed to rename thread.`,!0)}}async function lr(e,t){let n=o(K);if(!n||o(q)!==e)return;let r=await n.fetchTranscriptPage({userId:t,threadId:e});o(q)===e&&(C(tn,km(o(tn),r.parts),!0),C(rn,r.stale,!0),C(cn,r.contextSummary??o(cn),!0),mn(e))}async function ur(){let e=o(K),t=o(q),n=St();if(!(!e||!t||!n||o(nn)==null||o(un))){C(un,!0);try{let r=await e.fetchTranscriptPage({userId:n,threadId:t,before:o(nn)});if(o(q)!==t)return;C(tn,km(o(tn),r.parts),!0),C(rn,r.stale,!0),pn(r.nextBefore),mn(t)}catch{C(rn,!0)}finally{C(un,!1)}}}async function dr(e){let t=o(K),n=o(q),r=St();if(!t||!n||!r)return null;let i=await Se();if(!i)return null;let a=await t.fetchTranscriptAttachment({authToken:i,userId:r,threadId:n,imageUploadId:e});return a?URL.createObjectURL(a):null}async function mr(e){let t=St();try{if(await N({threadId:e}),t){Mt(t,`thread:${e}`);let n=o(K),r=await Se();n&&r&&await n.clearTranscriptReplica({authToken:r,userId:t,threadId:e})}St()===t&&(o(q)===e&&(C(q,null),C(Z,null),C(st,o(st)+1)),C(X,null))}catch(e){if(St()!==t)return;C(X,e instanceof Error?e.message:`Failed to archive thread.`,!0)}}async function hr(e){try{await P({threadId:e})}catch(e){C(X,e instanceof Error?e.message:`Failed to restore thread.`,!0)}}async function _r(){let e=o(en),t=o(q);if(!e||!t||o(Y)||!o(Ge)&&!o(We).trim())return;C(Y,!0),C(X,null);let n=o(We),r=o(Ge),i=n.trim();C(We,``),C(Ge,null);try{let n={threadId:t,questionId:e.questionId,optionId:r??void 0,text:i||void 0};await ae(n)}catch(i){o(q)===t&&o(en)?.questionId===e.questionId&&(C(We,n,!0),C(Ge,r,!0),C(X,i instanceof Error?i.message:String(i),!0))}finally{C(Y,!1)}}async function vr(){if(o(en)){await _r();return}if(o(Bn)||!o(We).trim()&&o(Ke).length===0)return;if(o(Ke).some(e=>e.status!==`ready`)){C(X,`Wait for image uploads to finish, or remove failed images before sending.`);return}let e=o(vn);if(!e){C(X,`Choose a project first.`);return}if(!o(K)){C(X,Ee);return}if(o(q)&&!o(zn)){C(X,`Loading thread state before sending.`);return}if(!o(Vn)){C(X,o(In)||o(Ln)||o(Bn)?`Wait for the current agent launch or run to finish.`:o(_n)?.localAttachmentAvailability===`available`?`You need an active project before sending.`:`This project needs to be attached before sending.`,!0);return}C(qe,0);let t=o(st),n=o(q),r=o(Ae);if(!r){C(X,`Choose a project first.`);return}let i=!1,a=St();if(!a){C(X,`User session is not ready.`);return}let s=()=>St()===a,c=o(We).trim(),l=o(Ke).map(e=>({...e})),u=l.flatMap(e=>e.imageUploadId?[e.imageUploadId]:[]),d=o(Fe),f=o(J),p=o(Le),m=n?o(Sn)?._id??null:null,h=n?`thread:${n}`:`draft:${e}`,g=h,_=g,v=At(a,g),y=Xe.get(v),b=crypto.randomUUID(),x=dm({latestRun:n?o(Sn):null,newSubmissionId:b,prompt:c,imageUploadIds:u,reasoningEffort:f,serviceTier:p,recoveredSubmission:y?{...y,selectedModel:y.selectedModel}:void 0,selectedModel:d}),S=x;Mt(a,g);let w=null,T=null,E=++rt,D=At(a,g);Ze.set(D,E);let O=()=>Ze.get(D)===E,k=`Your session changed before the agent started. Return to this account and send the prompt again.`,ee=`This request is still preparing. Wait for it to finish before trying again.`,A=e=>{jt(a,_,{message:e,prompt:c,attachments:l,imageUploadIds:u,reasoningEffort:f,serviceTier:p,selectedModel:d,submissionId:!n&&_===g?x:S})},ne=()=>{Mt(a,_),s()&&o(X)===ee&&C(X,null)},j=window.setTimeout(()=>{Ze.get(D)===E&&jt(a,_,{message:ee,prompt:``})},De);C(We,``),C(X,null),Je.set(h,E);try{if(!n){let t=await o(K).resolveWorkspacePath({workspacePath:e});if(!O())return;if(t.repositoryKey!==r){if(await qn(t.workspacePath),!O()||(!o(Yt).some(e=>e.workspacePath!==t.workspacePath&&e.repositoryKey===r)&&Nt()!==`skip`&&await te({from:r,to:t.repositoryKey}),!O()))return;r=t.repositoryKey,C(Ae,t.repositoryKey,!0),i=!0}}let g=n?null:await ar({isSubmissionCurrent:O,prompt:c,attachments:l,imageUploadIds:u,selectionGeneration:t,selectedModel:d,selectedReasoningEffort:f,selectedServiceTier:p,submissionId:x,userId:a,repositoryKey:r,workspacePath:e}),v=n??g?.threadId??null;if(!v||!O())return;if(g&&(S=fm({freshSubmissionId:b,submissionRunStatus:g.submissionRunStatus,threadSubmissionId:x})),!s()){A(k);return}w=v,n||(kt(h,E),h=`thread:${v}`,Je.set(h,E),ne(),Ze.get(D)===E&&Ze.delete(D),_=`thread:${v}`,D=At(a,_),Ze.set(D,E),i&&(Kn(e,v),bt.set(v,`This directory’s git remote changed. Existing threads now follow the new repository.`)));let y=await Se({forceRefreshToken:!0});if(!y){A(`Your session ended before the agent started. Sign in again.`);return}if(!O())return;if(!s()){A(k);return}ne();let ee=++nt;T=ee;let j={expiresAt:Date.now()+De,launchId:ee,previousRunId:m};o(Sn)?.claimExpiresAt&&(j.previousClaimExpiresAt=o(Sn).claimExpiresAt),C($e,Qo(o($e),v,j),!0),window.setTimeout(()=>{let e=o(Xt).find(e=>e.threadId===v)?.latestRunId??null,t=o(q)===v?o(Sn)?._id??null:null,n=[e,t].find(e=>e&&e!==m)??e??t,r=o(q)===v&&o(Sn)?._id===n?o(Sn).claimExpiresAt:o(Xt).find(e=>e.threadId===v)?.latestRunClaimExpiresAt,i=rs(o($e),v,ee,Date.now(),n,r);i.pendingLaunches!==o($e)&&(C($e,i.pendingLaunches,!0),i.shouldRecover&&A(`The local agent did not start. Please try again.`))},De),hm({authToken:y,desktopApi:o(K),onError:e=>{if(!O()||!s())return;let t=$o(o($e),v,ee);t!==o($e)&&C($e,t,!0),A(e instanceof Error?e.message:`Failed to start the local agent run.`)},onStarted:e=>{!O()||!s()||(C($e,ts(o($e),v,e),!0),Dt({discard:!1}))},threadId:v,prompt:c,imageUploadIds:u,selectedModel:d,submissionId:S,reasoningEffort:f,serviceTier:p,workspacePath:e})}catch(e){if(w&&T!==null&&C($e,$o(o($e),w,T),!0),!O())return;if(!s()){A(k);return}A(e instanceof Error?e.message:`Failed to send prompt.`),Un().catch(()=>{})}finally{window.clearTimeout(j),kt(h,E),T===null&&Ze.get(D)===E&&Ze.delete(D)}}async function yr(){if(!(!o(Sn)?._id||!o(In)))try{await F({runId:o(Sn)._id,text:``,status:`cancelled`})}catch(e){C(X,e instanceof Error?e.message:`Failed to cancel run.`,!0)}}async function br(){if(!o(Rn)||!o(Sn)||!o(q)||!o(vn)||o(Ln)||o(Bn))return;if(!o(K)){C(X,Ee);return}let e=o($t)?.prompt??``,t=o($t)?.imageUploadIds??[];if(!e&&t.length===0){C(X,`This run has no prompt to continue.`);return}let n=o(q),r=o(vn);if(!r)return;let i=o(Sn)._id,a=o(Sn).claimExpiresAt,s=++nt,c={expiresAt:Date.now()+De,launchId:s,previousRunId:i};a&&(c.previousClaimExpiresAt=a),C($e,Qo(o($e),n,c),!0);try{await ie({runId:o(Sn)._id});let i=await Se({forceRefreshToken:!0});if(!i)throw Error(`User session is not ready.`);hm({authToken:i,desktopApi:o(K),onError:e=>{C($e,$o(o($e),n,s),!0),C(X,e.message,!0)},onStarted:e=>{C($e,ts(o($e),n,e,Date.now()),!0)},threadId:n,prompt:e,imageUploadIds:t,selectedModel:o(Sn).selectedModel,reasoningEffort:o(Sn).reasoningEffort,serviceTier:o(Sn).serviceTier,submissionId:o(Sn).submissionId,workspacePath:r})}catch(e){C($e,$o(o($e),n,s),!0),C(X,e instanceof Error?e.message:`Failed to continue the run.`,!0)}}c(()=>{let e=o($t);if(!e){C(tt,null);return}(o(tt)?.serverNow!==e.serverNow||o(tt).runId!==(e.run?._id??null))&&C(tt,{localObservedAt:window.performance.now(),runId:e.run?._id??null,serverNow:e.serverNow},!0)}),c(()=>{if(!o(Sn)||!cm(o(Sn).status))return;let e=()=>{C(et,window.performance.now(),!0)};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)}),c(()=>{let e=St(),t=Ot(o(q),o(vn)),n=o(Sn);if(!e||!t||!n||!cm(n.status)||o(In)||o(Bn)||o(Ln)||o(Rn)||o(We)!==``||o(Ke).length>0||!o($t)||!o($t).prompt&&!o($t).imageUploadIds?.length)return;let r=o($t).imageUploadIds??[],i=o($t).prompt??``,a=o(gn).find(e=>e.runId===n._id&&e.type===`prompt`),s=r.flatMap(e=>{let t=a?.attachments.find(t=>t.imageUploadId===e);return t?.url?[t]:[]}),c=r.length-s.length,l=`${e}\0${n._id}\0${n.claimExpiresAt??`none`}`;if(Qe.has(l))return;Qe.add(l);let u=s.map(e=>({localId:e.imageUploadId,name:e.name,mediaType:e.mediaType,size:e.size,previewUrl:e.url,status:`ready`,imageUploadId:e.imageUploadId})),d=ui(n.selectedModel,n.serviceTier);jt(e,t,{message:c>0?`The previous agent stopped responding. ${c} image attachment${c===1?` is`:`s are`} unavailable; review and retry this submission.`:`The previous agent stopped responding. Retry to continue this submission.`,prompt:i,attachments:u,imageUploadIds:r,reasoningEffort:n.reasoningEffort,serviceTier:d.serviceTier,selectedModel:d.modelId,submissionId:n.submissionId})}),c(()=>{let e=St();o(dt)!==e&&(C(dt,e,!0),C(it,!1),C(ke,null),C(Ae,null),C(q,null),C(Pe,null),C(Z,null),C($e,{},!0),C(at,null),Te=null,ot=null,C(st,o(st)+1),C(We,``),Dt({discard:!0}),C(X,null),C(qe,0),C(Fe,o(U)?.defaultModelId??`deepseek-v4-pro-0813`,!0),C(J,o(U)?.defaultReasoningEffort??`max`,!0),C(Le,o(U)?.defaultServiceTier??`standard`,!0),C(ft,!1),C(mt,null),C(Q,void 0))}),c(()=>{let e=o(_t)[0],t=o(K),n=St();!e||o(vt)||!o(k)||!t||!n||!o(lt)||(C(_t,o(_t).slice(1),!0),C(vt,!0),C(it,!0),C(at,null),C(ft,!1),C(ht,!1),C(X,null),tr(e,t,n).catch(e=>{St()===n&&(C(it,!1),C(X,e instanceof Error?e.message:`Failed to open the requested project.`,!0))}).finally(()=>{C(vt,!1)}))}),c(()=>{let e=o(Zt),t=e?._id??null;if(t===ot||(ot=t,!e))return;let n=ui(e.selectedModel,e.serviceTier);C(Fe,n.modelId,!0),C(J,di(n.modelId,e.reasoningEffort),!0),C(Le,n.serviceTier,!0)}),c(()=>{let e=St(),t=Ot(o(q),o(vn));if(!e||!t)return;let n=At(e,t),r=Ye.get(n);if(!r)return;Ye.delete(n);let i=o(We)===``;i&&C(We,r.prompt,!0),o(Ke).length===0&&r.attachments?.length&&(i||o(We)===r.prompt)&&C(Ke,r.attachments.map(e=>({...e})),!0),o(We)===r.prompt&&r.submissionId&&(r.prompt||r.imageUploadIds?.length)&&r.reasoningEffort&&r.selectedModel&&Xe.set(n,{prompt:r.prompt,imageUploadIds:r.imageUploadIds??[],reasoningEffort:r.reasoningEffort,serviceTier:r.serviceTier??o(U)?.defaultServiceTier??`standard`,selectedModel:r.selectedModel,submissionId:r.submissionId}),C(X,r.message,!0)}),c(()=>{if(!o(Z))return;let e=Yo({pendingCreatedThreadId:o(Z),threads:o(Xt)});e!==o(Z)&&C(Z,e,!0)}),c(()=>{if(o(it)||!o(yt)||o(_t).length>0||o(vt)||!o(lt)||!Pt.data)return;C(it,!0);let e=new Set(o(Yt).map(e=>e.repositoryKey)),t=qo(o(Xt).filter(t=>e.has(t.repositoryKey)));if(t){let e=zo(o(Yt),t.repositoryKey);if(e){Kn(e.workspacePath,t.threadId,!1,!0),C(at,e.workspacePath,!0);return}}o(Yt)[0]&&(Kn(o(Yt)[0].workspacePath,null,!1,!0),C(at,o(Yt)[0].workspacePath,!0))}),c(()=>{let e=o(at);if(!e||!o(K)||!o(lt))return;if(!Bo(o(Yt),e)){C(at,null);return}C(at,null);let t=o(st);nr(e).catch(e=>{t===o(st)&&C(X,e instanceof Error?e.message:`Failed to attach project.`,!0)})}),c(()=>{let e=o(q)?Ko(o(Xt),o(q)):null,t=o(_n)?.repositoryKey===e?.repositoryKey?o(_n):zo(o(Yt),e?.repositoryKey);t&&t.workspacePath!==o(ke)&&Kn(t.workspacePath,o(q),o(Pe)===t.workspacePath)}),c(()=>{let e=o(bn);if(!o(it)||!o(ke))return;let t=is({threads:e,currentThreadId:o(q),currentWorkspacePath:o(ke),draftWorkspacePath:o(Pe),pendingCreatedThreadId:o(Z)});t!==o(q)&&Kn(o(ke),t,o(Pe)===o(ke),!0)}),c(()=>{let e=ns(o($e),o(Xt));o(q)&&o(Sn)?._id&&(e=ts(e,o(q),o(Sn)._id,o(Sn).claimExpiresAt)),e!==o($e)&&C($e,e,!0)}),c(()=>{let e=o(Sn)?.startedAt;if(!o(In)||!e){C(qe,0);return}let t=()=>{C(qe,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}),oe(()=>{me();let e=window.sprocketDesktopBridge,t=e?.onWorkspaceLaunch?e.onWorkspaceLaunch(()=>{er()}):void 0,n=Ve();return n&&($n(n),He()),e?.takeWorkspaceLaunch?er().finally(()=>{C(yt,!0)}):C(yt,!0),Ue().then(e=>{C(K,e,!0),C(Oe,!0),Un().catch(e=>{C(X,e instanceof Error?e.message:`Failed to load local project attachments.`,!0)})}).catch(e=>{C(X,e instanceof Error?e.message:`Failed to connect to the Sprocket server.`,!0),C(Oe,!0)}),()=>t?.()});var Sr=m();E(`1uha8ag`,e=>{n(()=>{S.title=`Sprocket`})});var Cr=u(Sr),wr=e=>{Be(e,{title:`Connecting to Sprocket…`,description:`Looking for a running Sprocket server on this machine.`,busy:!0})},Tr=t=>{{let n=t=>{{let n=e(()=>W(`/pair`));gr(t,{get href(){return o(n)},children:(e,t)=>{j();var n=re(`Open pairing`);i(e,n)},$$slots:{default:!0}})}},r=e(()=>o(X)??`Connect to your Sprocket server to continue.`);Be(t,{title:`Connect to Sprocket`,get description(){return o(r)},actions:n,$$slots:{actions:!0}})}},Er=t=>{var n=Am(),r=s(n);{let t=e(()=>({isLoading:!d().isReady||d().isLoading||o(O)||o(D)&&w.isLoading,isConfigured:d().isConfigured,isAuthenticated:o(D),connectionFailed:o(ee),error:d().error}));xr(r,{get authState(){return o(t)},get overlayOpen(){return d().isWaitingForBrowserSignIn},onSignIn:()=>void we(),onSignOut:()=>void ge(),onRetry:()=>void ye(),onSignUp:()=>void _e()})}Mr(V(r,2),{get open(){return d().isWaitingForBrowserSignIn},get signInUrl(){return d().browserSignInUrl},get error(){return d().error},get onCancel(){return xe},get onClearOpenError(){return ve}}),B(n),i(t,n)},Dr=t=>{var n=Im(),r=s(n),c=s(r),l=e=>{Ms(e,{get activePage(){return o(gt)},get theme(){return o(It)},onThemeChange:e=>void Vt(e),onBack:()=>{C(ht,!1),C(gt,`account`)},onNavigate:e=>{C(gt,e,!0)}})},f=e=>{sm(e,{get currentWorkspacePath(){return o(ke)},get currentThreadId(){return o(q)},get groups(){return o(xn)},get pendingAgentLaunches(){return o($e)},get theme(){return o(It)},onThemeChange:e=>void Vt(e),onAddProject:()=>{Yn(`add`)},onReconnectProject:e=>{rr(e)},onOpenSettings:()=>{C(gt,`account`),C(ht,!0)},onStartThreadDraft:or,onSelectThread:sr,onSelectProject:e=>{Jn(e)},onRenameThread:(e,t)=>{cr(e,t)},onArchiveThread:e=>{mr(e)}})};y(c,e=>{o(ht)?e(l):e(f,-1)});var h=V(c,2),g=s(h),_=e=>{var t=jm();Pn(s(t),{class:`size-4`,"aria-hidden":`true`}),B(t),p(`click`,t,()=>{C(En,{...o(En),open:!0},!0)}),i(e,t)};y(g,e=>{!o(ht)&&!o(En).open&&e(_)});var v=V(g,2),b=e=>{var t=m(),n=u(t),r=e=>{ls(e,{get threads(){return o(Xt)},get projects(){return o(Yt)},onRestore:e=>{hr(e)}})},a=e=>{Ks(e,{})},s=e=>{Ds(e,{})},c=e=>{Lo(e,{get user(){return d().user},onSignOut:()=>void ge()})};y(n,e=>{o(gt)===`archived`?e(r):o(gt)===`usage`?e(a,1):o(gt)===`payments`?e(s,2):e(c,-1)}),i(e,t)},S=t=>{var n=Pm(),r=u(n);{let t=e(()=>o(ln)??o(X)??d().error??(o(Jt)instanceof Error?hs(o(Jt)):null)??null),n=e(()=>o(Rn)?null:o(Sn)?.lastError??null),i=e(()=>o(In)?o(Sn)?._id??null:null),a=e(()=>o(q)?bt.get(o(q))??null:null),s=e(()=>o(nn)!=null),c=e(()=>o(q)&&(o(sn)||o(an)!==o(q))?`Loading conversation…`:o(_n)?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`);Lf(r,{get currentError(){return o(t)},get runError(){return o(n)},get messages(){return o(gn)},get actions(){return o(Cn)},get activeRunId(){return o(i)},get project(){return o(_n)},get remoteChangeNotice(){return o(a)},onDismissRemoteChangeNotice:()=>{o(q)&&bt.delete(o(q))},get stale(){return o(rn)},get contextSummary(){return o(cn)},get loadingOlder(){return o(un)},get hasOlder(){return o(s)},get emptyStateMessage(){return o(c)},onLoadOlder:()=>{ur()},loadAttachment:dr})}var c=V(r,2),l=e=>{var t=Mm(),n=s(t),r=s(n,!0);B(n),gr(V(n,2),{variant:`outline`,className:`h-8 px-3`,get disabled(){return o(pe)},onclick:()=>{me()},children:(e,t)=>{j();var n=re();x(()=>a(n,o(pe)?`Retrying…`:`Retry`)),i(e,n)},$$slots:{default:!0}}),B(t),x(()=>a(r,pi)),i(e,t)},f=e=>{var t=Nm();i(e,t)};y(c,e=>{o(fe)?e(l):o(pe)&&!o(U)&&e(f,1)});var p=V(c,2);{let t=e(()=>o(Rn)!=null),n=e(()=>o(Bn)||o(Ln)||o(Y)),r=e(()=>o(In)?Bi(o(qe)):null);Do(p,{get attachments(){return o(Ke)},onAttachFiles:Tt,onRemoveAttachment:Et,get modelCatalog(){return o(U)},get pendingQuestion(){return o(en)},get showContinueWorking(){return o(t)},onContinueWorking:()=>{br()},get canSend(){return o(Vn)},get isSubmitting(){return o(n)},get isStarting(){return o(Ln)},get isRunning(){return o(In)},get elapsedLabel(){return o(r)},get contextUsage(){return o(Qt)},get projectSkills(){return o(yn)},onSubmit:()=>{vr()},onCancel:()=>{yr()},get prompt(){return o(We)},set prompt(e){C(We,e,!0)},get selectedModel(){return o(Fe)},set selectedModel(e){C(Fe,e,!0)},get selectedReasoningEffort(){return o(J)},set selectedReasoningEffort(e){C(J,e,!0)},get selectedServiceTier(){return o(Le)},set selectedServiceTier(e){C(Le,e,!0)},get selectedQuestionOptionId(){return o(Ge)},set selectedQuestionOptionId(e){C(Ge,e,!0)}})}i(t,n)};y(v,e=>{o(ht)?e(b):e(S,-1)}),B(h),B(r);var w=V(r,2),T=t=>{var n=Fm(),r=s(n);{let t=e(()=>o(In)&&Kt.data?.lastUsedRunId===o(Sn)?._id);gp(r,{get artifacts(){return o(wn)},get selectedKey(){return o(En).selectedKey},get tab(){return o(En).tab},get liveView(){return Kt.data},get liveActive(){return o(t)},get expanded(){return o(En).expanded},onSelect:e=>{C(En,{...o(En),selectedKey:e},!0)},onBack:()=>{C(En,{...o(En),selectedKey:null},!0)},onTabChange:e=>{C(En,{...o(En),tab:e},!0)},onOpenFullscreen:e=>{C(xt,e,!0),document.fullscreenElement||document.documentElement.requestFullscreen?.().catch(()=>{})},onToggleExpanded:()=>{C(En,{...o(En),expanded:!o(En).expanded},!0)},onClose:()=>{C(En,{...o(En),open:!1,expanded:!1},!0)}})}B(n),x(()=>{I(n,1,M(o(En).expanded?`bg-background fixed inset-0 z-50`:`absolute inset-y-0 right-0 z-40 w-[20rem]`)),n.inert=o(An)?!0:void 0}),i(t,n)};y(w,e=>{!o(ht)&&o(En).open&&e(T)});var E=V(w,2),D=e=>{xp(e,{get artifact(){return o(An)},onClose:()=>{C(xt,null)}})};y(E,e=>{o(An)&&e(D)});var O=V(E,2),k=e=>{Hp(e,{get open(){return o(ft)},get desktopApi(){return o(K)},get mode(){return o(pt)},get expectedDisplayName(){return o(Q)},get recentProjectPaths(){return o(Hn)},onClose:()=>{C(ft,!1),C(mt,null),C(Q,void 0)},onSelect:async e=>{try{await Xn(e)}catch{await Un()}}})};y(O,e=>{o(K)&&o(ft)&&e(k)}),B(n),x(()=>{I(r,1,`app-workspace-shell grid h-screen grid-cols-[292px_minmax(0,1fr)] overflow-hidden ${!o(ht)&&o(En).open&&!o(En).expanded?`pr-[20rem]`:``}`),r.inert=o(An)||o(En).open&&o(En).expanded?!0:void 0}),i(t,n)};y(Cr,e=>{o(Oe)?o(K)?o(k)?e(Dr,-1):e(Er,2):e(Tr,1):e(wr)}),i(t,Sr),R(),v()}f([`click`]);export{Lm as component};