@spikonado/sprocket 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/package.json +6 -6
- package/web/_app/immutable/assets/0.Btn1dfCy.css +2 -0
- package/web/_app/immutable/chunks/BIoNiaeb.js +1 -0
- package/web/_app/immutable/chunks/{DtbzskMF.js → BcbRJsmf.js} +1 -1
- package/web/_app/immutable/chunks/C6UbJThZ.js +64 -0
- package/web/_app/immutable/chunks/CI5UllIC.js +1 -0
- package/web/_app/immutable/chunks/CZkwsiMM.js +6 -0
- package/web/_app/immutable/chunks/Cq37afw7.js +2 -0
- package/web/_app/immutable/chunks/{C7n7Hkve.js → PSXYTcvE.js} +1 -1
- package/web/_app/immutable/chunks/W58kGv2a.js +7 -0
- package/web/_app/immutable/entry/{app.CeGw4OSi.js → app.SPUDvldn.js} +2 -2
- package/web/_app/immutable/entry/start.C35C-bUa.js +1 -0
- package/web/_app/immutable/nodes/0.BQy7t8ld.js +1 -0
- package/web/_app/immutable/nodes/1.BKmg0DHY.js +1 -0
- package/web/_app/immutable/nodes/2.CW66SnVr.js +127 -0
- package/web/_app/immutable/nodes/{3.D40OcmEn.js → 3.D5e7ydb1.js} +1 -1
- package/web/_app/immutable/nodes/{4.coTLLCMq.js → 4.DAD6I3xt.js} +1 -1
- package/web/_app/version.json +1 -1
- package/web/callback.html +14 -13
- package/web/index.html +11 -10
- package/web/pair.html +15 -14
- package/web/_app/immutable/assets/0.CAFzdT87.css +0 -2
- package/web/_app/immutable/chunks/B2QV2lSm.js +0 -1
- package/web/_app/immutable/chunks/DQzmXkOB.js +0 -1
- package/web/_app/immutable/chunks/DXwWhsEw.js +0 -6
- package/web/_app/immutable/chunks/D_6EnlQE.js +0 -2
- package/web/_app/immutable/entry/start.B77P4R2b.js +0 -1
- package/web/_app/immutable/nodes/0.DmC-g_Lj.js +0 -1
- package/web/_app/immutable/nodes/1.Djk_ySAI.js +0 -1
- 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 A,d as j,et as ee,f as te,ft as ne,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 fe,x as pe,y as me,z as he}from"../chunks/D-3DgMVM.js";import{c as U}from"../chunks/BcbRJsmf.js";import"../chunks/xihTtKlq.js";import{a as ge,d as _e,f as ve,i as ye,l as be,n as xe,p as Se,r as Ce,s as we,t as Te,u as Ee}from"../chunks/CZkwsiMM.js";import{c as W,d as De,i as Oe,l as ke,o as G,r as Ae,s as je,t as Me}from"../chunks/C6UbJThZ.js";import{a as Ne,c as Pe,i as Fe,o as Ie,r as K,s as Le}from"../chunks/Cq37afw7.js";import{t as Re}from"../chunks/BIoNiaeb.js";import{a as q,i as ze,n as Be,r as Ve,t as He}from"../chunks/PSXYTcvE.js";import{a as Ue,n as We,o as Ge}from"../chunks/W58kGv2a.js";var J=Object.defineProperty,Ke=(e,t,n)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>Ke(e,typeof t==`symbol`?t:t+``,n),qe=`https://docs.convex.dev/error#undefined-validator`;function Je(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 ${qe} for details.`)}var Ye=class{constructor({isOptional:e}){Y(this,`type`),Y(this,`fieldPaths`),Y(this,`isOptional`),Y(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},Xe=class e extends Ye{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})}},Ze=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},Qe=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},$e=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`commitTs`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},et=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},tt=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},nt=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},rt=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},it=class e extends Ye{constructor(){super(...arguments),Y(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},at=class e extends Ye{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&&Je(`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}})}},ot=class e extends Ye{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:Pe(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},st=class e extends Ye{constructor({isOptional:e,element:t}){super({isOptional:e}),Y(this,`element`),Y(this,`kind`,`array`),t===void 0&&Je(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},ct=class e extends Ye{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),Y(this,`key`),Y(this,`value`),Y(this,`kind`,`record`),t===void 0&&Je(`v.record()`,`key`),n===void 0&&Je(`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})}},lt=class e extends Ye{constructor({isOptional:e,members:t}){super({isOptional:e}),Y(this,`members`),Y(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&Je(`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})}},X={id:e=>new Xe({isOptional:`required`,tableName:e}),null:()=>new rt({isOptional:`required`}),number:()=>new Ze({isOptional:`required`}),float64:()=>new Ze({isOptional:`required`}),bigint:()=>new Qe({isOptional:`required`}),int64:()=>new Qe({isOptional:`required`}),commitTs:()=>new $e({isOptional:`required`}),boolean:()=>new et({isOptional:`required`}),string:()=>new nt({isOptional:`required`}),bytes:()=>new tt({isOptional:`required`}),literal:e=>new ot({isOptional:`required`,value:e}),array:e=>new st({isOptional:`required`,element:e}),object:e=>new at({isOptional:`required`,fields:e}),record:(e,t)=>new ct({isOptional:`required`,key:e,value:t}),union:(...e)=>new lt({isOptional:`required`,members:e}),any:()=>new it({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>X.union(e,X.null())},ut={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`},dt=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ft=Symbol(`lucide-context`),pt=()=>O(ft),mt=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),ht=t(`<svg><!><!></svg>`);function Z(t,n){H(n,!0);let a=pt()??{},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,mt),g=e(()=>f()?Number(d())*24/Number(l()):d());var _=ht();ie(_,e=>({...ut,...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&&!dt(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 gt=new Set([`$$slots`,`$$events`,`$$legacy`]);function _t(e,t){let n=D(t,gt),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`}]];Z(e,L({name:`archive`},()=>n,{get iconNode(){return r}}))}var vt=new Set([`$$slots`,`$$events`,`$$legacy`]);function yt(e,t){let n=D(t,vt),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];Z(e,L({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var bt=new Set([`$$slots`,`$$events`,`$$legacy`]);function xt(e,t){let n=D(t,bt),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];Z(e,L({name:`arrow-up`},()=>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 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`}]];Z(e,L({name:`book-open`},()=>n,{get iconNode(){return r}}))}var Q=new Set([`$$slots`,`$$events`,`$$legacy`]);function wt(e,t){let n=D(t,Q),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`}]];Z(e,L({name:`brain`},()=>n,{get iconNode(){return r}}))}var Tt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Et(e,t){let n=D(t,Tt),r=[[`path`,{d:`M5 21v-6`}],[`path`,{d:`M12 21V3`}],[`path`,{d:`M19 21V9`}]];Z(e,L({name:`chart-no-axes-column`},()=>n,{get iconNode(){return r}}))}var Dt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ot(e,t){let n=D(t,Dt),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];Z(e,L({name:`check`},()=>n,{get iconNode(){return r}}))}var kt=new Set([`$$slots`,`$$events`,`$$legacy`]);function At(e,t){let n=D(t,kt),r=[[`path`,{d:`m6 9 6 6 6-6`}]];Z(e,L({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var jt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mt(e,t){let n=D(t,jt),r=[[`path`,{d:`m9 18 6-6-6-6`}]];Z(e,L({name:`chevron-right`},()=>n,{get iconNode(){return r}}))}var Nt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pt(e,t){let n=D(t,Nt),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`}]];Z(e,L({name:`circle-alert`},()=>n,{get iconNode(){return r}}))}var Ft=new Set([`$$slots`,`$$events`,`$$legacy`]);function It(e,t){let n=D(t,Ft),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`}]];Z(e,L({name:`circle-dollar-sign`},()=>n,{get iconNode(){return r}}))}var Lt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Rt(e,t){let n=D(t,Lt),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`}]];Z(e,L({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var zt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Bt(e,t){let n=D(t,zt),r=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]];Z(e,L({name:`code-xml`},()=>n,{get iconNode(){return r}}))}var Vt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ht(e,t){let n=D(t,Vt),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`}]];Z(e,L({name:`copy`},()=>n,{get iconNode(){return r}}))}var Ut=new Set([`$$slots`,`$$events`,`$$legacy`]);function Wt(e,t){let n=D(t,Ut),r=[[`path`,{d:`M14 9 9 4 4 9`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`}]];Z(e,L({name:`corner-left-up`},()=>n,{get iconNode(){return r}}))}var Gt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Kt(e,t){let n=D(t,Gt),r=[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`}]];Z(e,L({name:`credit-card`},()=>n,{get iconNode(){return r}}))}var qt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jt(e,t){let n=D(t,qt),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`}]];Z(e,L({name:`download`},()=>n,{get iconNode(){return r}}))}var Yt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xt(e,t){let n=D(t,Yt),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`}]];Z(e,L({name:`expand`},()=>n,{get iconNode(){return r}}))}var Zt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qt(e,t){let n=D(t,Zt),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`}]];Z(e,L({name:`external-link`},()=>n,{get iconNode(){return r}}))}var $t=new Set([`$$slots`,`$$events`,`$$legacy`]);function en(e,t){let n=D(t,$t),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`}]];Z(e,L({name:`eye`},()=>n,{get iconNode(){return r}}))}var tn=new Set([`$$slots`,`$$events`,`$$legacy`]);function nn(e,t){let n=D(t,tn),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`}]];Z(e,L({name:`file-code`},()=>n,{get iconNode(){return r}}))}var rn=new Set([`$$slots`,`$$events`,`$$legacy`]);function an(e,t){let n=D(t,rn),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`}]];Z(e,L({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var on=new Set([`$$slots`,`$$events`,`$$legacy`]);function sn(e,t){let n=D(t,on),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`}]];Z(e,L({name:`file-text`},()=>n,{get iconNode(){return r}}))}var cn=new Set([`$$slots`,`$$events`,`$$legacy`]);function ln(e,t){let n=D(t,cn),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`}]];Z(e,L({name:`folder-open`},()=>n,{get iconNode(){return r}}))}var un=new Set([`$$slots`,`$$events`,`$$legacy`]);function dn(e,t){let n=D(t,un),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`}]];Z(e,L({name:`folder-plus`},()=>n,{get iconNode(){return r}}))}var fn=new Set([`$$slots`,`$$events`,`$$legacy`]);function pn(e,t){let n=D(t,fn),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`}]];Z(e,L({name:`folder`},()=>n,{get iconNode(){return r}}))}var mn=new Set([`$$slots`,`$$events`,`$$legacy`]);function hn(e,t){let n=D(t,mn),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`}]];Z(e,L({name:`fullscreen`},()=>n,{get iconNode(){return r}}))}var gn=new Set([`$$slots`,`$$events`,`$$legacy`]);function _n(e,t){let n=D(t,gn),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`}]];Z(e,L({name:`globe`},()=>n,{get iconNode(){return r}}))}var vn=new Set([`$$slots`,`$$events`,`$$legacy`]);function yn(e,t){let n=D(t,vn),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`}]];Z(e,L({name:`hourglass`},()=>n,{get iconNode(){return r}}))}var bn=new Set([`$$slots`,`$$events`,`$$legacy`]);function xn(e,t){let n=D(t,bn),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`}]];Z(e,L({name:`image-plus`},()=>n,{get iconNode(){return r}}))}var Sn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Cn(e,t){let n=D(t,Sn),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`}]];Z(e,L({name:`list-checks`},()=>n,{get iconNode(){return r}}))}var wn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tn(e,t){let n=D(t,wn),r=[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]];Z(e,L({name:`loader-circle`},()=>n,{get iconNode(){return r}}))}var En=new Set([`$$slots`,`$$events`,`$$legacy`]);function Dn(e,t){let n=D(t,En),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];Z(e,L({name:`lock`},()=>n,{get iconNode(){return r}}))}var On=new Set([`$$slots`,`$$events`,`$$legacy`]);function kn(e,t){let n=D(t,On),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`}]];Z(e,L({name:`log-out`},()=>n,{get iconNode(){return r}}))}var An=new Set([`$$slots`,`$$events`,`$$legacy`]);function jn(e,t){let n=D(t,An),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`}]];Z(e,L({name:`moon`},()=>n,{get iconNode(){return r}}))}var Mn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nn(e,t){let n=D(t,Mn),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`}]];Z(e,L({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var Pn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Fn(e,t){let n=D(t,Pn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}]];Z(e,L({name:`panel-right`},()=>n,{get iconNode(){return r}}))}var In=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ln(e,t){let n=D(t,In),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`}]];Z(e,L({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var Rn=new Set([`$$slots`,`$$events`,`$$legacy`]);function zn(e,t){let n=D(t,Rn),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];Z(e,L({name:`search`},()=>n,{get iconNode(){return r}}))}var Bn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vn(e,t){let n=D(t,Bn),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`}]];Z(e,L({name:`settings`},()=>n,{get iconNode(){return r}}))}var Hn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Un(e,t){let n=D(t,Hn),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`}]];Z(e,L({name:`shrink`},()=>n,{get iconNode(){return r}}))}var Wn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gn(e,t){let n=D(t,Wn),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`}]];Z(e,L({name:`square-pen`},()=>n,{get iconNode(){return r}}))}var Kn=new Set([`$$slots`,`$$events`,`$$legacy`]);function qn(e,t){let n=D(t,Kn),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`}]];Z(e,L({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var Jn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yn(e,t){let n=D(t,Jn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];Z(e,L({name:`square`},()=>n,{get iconNode(){return r}}))}var Xn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zn(e,t){let n=D(t,Xn),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`}]];Z(e,L({name:`sun`},()=>n,{get iconNode(){return r}}))}var Qn=new Set([`$$slots`,`$$events`,`$$legacy`]);function $n(e,t){let n=D(t,Qn),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];Z(e,L({name:`terminal`},()=>n,{get iconNode(){return r}}))}var er=new Set([`$$slots`,`$$events`,`$$legacy`]);function tr(e,t){let n=D(t,er),r=[[`circle`,{cx:`12`,cy:`8`,r:`5`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`}]];Z(e,L({name:`user-round`},()=>n,{get iconNode(){return r}}))}var nr=new Set([`$$slots`,`$$events`,`$$legacy`]);function rr(e,t){let n=D(t,nr),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`}]];Z(e,L({name:`wallet`},()=>n,{get iconNode(){return r}}))}var ir=new Set([`$$slots`,`$$events`,`$$legacy`]);function ar(e,t){let n=D(t,ir),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`}]];Z(e,L({name:`wrench`},()=>n,{get iconNode(){return r}}))}var or=new Set([`$$slots`,`$$events`,`$$legacy`]);function sr(e,t){let n=D(t,or),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];Z(e,L({name:`x`},()=>n,{get iconNode(){return r}}))}var cr=new Set([`$$slots`,`$$events`,`$$legacy`]);function lr(e,t){let n=D(t,cr),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`}]];Z(e,L({name:`zap`},()=>n,{get iconNode(){return r}}))}var ur=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],dr=[`difference`,`intersection`,`symmetricDifference`,`union`],fr=!1,pr=class e extends Set{#e=new Map;#t=g(0);#n=g(0);#r=he||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}fr||this.#a()}#i(e){return he===this.#r?g(e):T(e)}#a(){fr=!0;var t=e.prototype,n=Set.prototype;for(let e of ur)t[e]=function(...t){return o(this.#t),n[e].apply(this,t)};for(let r of dr)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)}},mr=class extends Map{#e=new Map;#t=g(0);#n=g(0);#r=he||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return he===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}},hr=F(`<a><!></a>`),gr=F(`<button><!></button>`);function _r(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(()=>q(`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=hr(),r=s(t);k(r,()=>n.children??ae),B(t),x(()=>{j(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=gr(),a=s(t);k(a,()=>n.children??ae),B(t),x(()=>{j(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 vr=F(`<!> <!>`,1),yr=F(`<p class="text-destructive text-center text-sm" role="alert"> </p>`),br=F(`<div class="text-muted-foreground flex items-center justify-center gap-2 text-sm" aria-live="polite" aria-busy="true"><!> <span> </span></div>`),xr=F(`<div><!></div>`);function Sr(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=xr(),_=s(g);He(_,{get title(){return o(d)},get description(){return o(f)},actions:e=>{var t=m(),r=u(t),a=e=>{var t=vr(),r=u(t),a=e=>{_r(e,{get onclick(){return n.onRetry},get disabled(){return n.authState.isLoading},children:(e,t)=>{ne();var n=re(`Retry`);i(e,n)},$$slots:{default:!0}})};y(r,e=>{n.authState.connectionFailed&&e(a)}),_r(V(r,2),{variant:`outline`,get onclick(){return n.onSignOut},children:(e,t)=>{ne();var n=re(`Sign Out`);i(e,n)},$$slots:{default:!0}}),i(e,t)},o=e=>{var t=vr(),r=u(t);_r(r,{get onclick(){return n.onSignIn},get disabled(){return n.authState.isLoading},children:(e,t)=>{ne();var n=re(`Sign In`);i(e,n)},$$slots:{default:!0}}),_r(V(r,2),{variant:`outline`,get onclick(){return n.onSignUp},get disabled(){return n.authState.isLoading},children:(e,t)=>{ne();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=vr(),c=u(r),l=e=>{var t=yr(),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=br(),n=s(t);Tn(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(),j(g,`aria-hidden`,r()?!0:void 0)}),i(t,g),R()}var Cr=F(`<div class="text-muted-foreground mb-4 flex justify-center" aria-hidden="true"><!></div>`),wr=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>`),Tr=F(`<p class="text-destructive mt-4 text-sm" role="alert"> </p>`),Er=F(`<p class="mt-4 text-sm text-amber-700" role="alert"> </p>`),Dr=F(`<!> Open browser`,1),Or=F(`<!> Copied`,1),kr=F(`<!> Copy link`,1),Ar=F(`<!> <!>`,1),jr=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>`),Mr=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 Nr(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=Mr(),c=s(t),d=s(c),g=e=>{var t=Cr();Tn(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=wr(),r=s(t,!0);B(t),x(()=>{j(t,`title`,n.signInUrl),a(r,n.signInUrl)}),i(e,t)};y(D,e=>{n.signInUrl&&e(O)});var k=V(D,2),A=e=>{var t=Tr(),n=s(t,!0);B(t),x(()=>a(n,r())),i(e,t)};y(k,e=>{r()&&e(A)});var ee=V(k,2),te=e=>{var t=Er(),n=s(t,!0);B(t),x(()=>a(n,o(f))),i(e,t)};y(ee,e=>{o(f)&&e(te)});var M=V(ee,2),N=s(M),P=e=>{var t=Ar(),n=u(t);_r(n,{onclick:b,children:(e,t)=>{var n=Dr();Qt(u(n),{class:`size-4`,"aria-hidden":`true`}),ne(),i(e,n)},$$slots:{default:!0}}),_r(V(n,2),{variant:`outline`,onclick:()=>void v(),children:(e,t)=>{var n=m(),r=u(n),a=e=>{var t=Or();Ot(u(t),{class:`size-4`,"aria-hidden":`true`}),ne(),i(e,t)},s=e=>{var t=kr();Ht(u(t),{class:`size-4`,"aria-hidden":`true`}),ne(),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=jr();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 Pr(){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 Fr(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 Ir=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 Lr(e,t){H(t,!0);var n=m(),r=u(n),o=e=>{var n=Ir(),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 Rr=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>`),zr=F(`<p class="text-muted-foreground px-3 pt-1 pb-2 text-[11px] font-medium"> </p>`),Br=F(`<span><!></span>`),Vr=F(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Hr=F(`<button type="button"><!> <span> </span> <!></button>`),Ur=F(`<p class="text-muted-foreground px-3 py-5 text-center text-sm">No matches found</p>`),Wr=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>`),Gr=F(`<div><button type="button" aria-haspopup="dialog"><!> <span class="truncate"> </span> <!></button> <!></div> <!>`,1);function Kr(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=Pr(),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}),ee=e(()=>_()&&o(S).trim()?n.options.filter(e=>e.label.toLocaleLowerCase().includes(o(S).trim().toLocaleLowerCase())):n.options),te=e(()=>o(ee).filter(e=>!e.locked));function ne(){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(te).length!==0&&(e.preventDefault(),N(o(te)[0].id))}c(()=>{if(!o(b)){C(S,``),D.hideLockTooltip();return}return Fr({getRoot:()=>o(w),onOutside:()=>{C(b,!1)},onEscape:()=>{C(b,!1),o(T)?.focus()}})}),c(()=>{l()&&C(b,!1)});var F=Gr(),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(()=>q(`text-muted-foreground size-3 shrink-0 transition-transform`,o(b)&&`rotate-180`));At(le,{get class(){return o(t)}})}B(ae),ce(ae,e=>C(T,e),()=>o(T));var de=V(ae,2),fe=t=>{var c=Wr(),l=s(c),u=e=>{var t=Rr(),r=s(t);zn(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??``}`),j(u,`placeholder`,t)},[()=>n.menuTitle.toLocaleLowerCase(),()=>`Search ${n.menuTitle.toLocaleLowerCase()}…`]),p(`keydown`,u,re),A(u,()=>o(S),e=>C(S,e)),i(e,t)},d=e=>{var t=zr(),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(ee),e=>e.id,(t,c)=>{let l=e(()=>!!o(c).locked);var u=Hr(),d=s(u),f=e=>{var t=Br(),r=s(t);k(r,()=>n.optionIcon,()=>o(c)),B(t),x(e=>I(t,1,e),[()=>M(q(`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=Vr();Dn(s(t),{class:`size-3.5`}),B(t),i(e,t)},b=t=>{{let n=e(()=>q(`text-accent-strong size-4 shrink-0 transition-opacity`,o(c).id===r()?`opacity-100`:`opacity-0`));Ot(t,{get class(){return o(n)}})}};y(_,e=>{o(l)?e(v):e(b,-1)}),B(u),x((e,t)=>{I(u,1,e),j(u,`aria-pressed`,!o(l)&&o(c).id===r()),j(u,`aria-disabled`,o(l)),j(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(q(`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(q(`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=Ur();i(e,t)};y(g,e=>{o(ee).length===0&&e(b)}),B(f),B(c),x(e=>{j(c,`aria-label`,n.menuTitle),I(f,1,e)},[()=>M(q(`space-y-0.5`,_()&&`pt-1.5`))]),i(t,c)};y(de,e=>{o(b)&&e(fe)}),B(ie),ce(ie,e=>C(w,e),()=>o(w)),Lr(V(ie,2),{get tooltip(){return D.lockTooltip}}),x((e,t)=>{I(ie,1,e),I(ae,1,t),j(ae,`aria-expanded`,o(b)),j(ae,`aria-label`,n.ariaLabel),ae.disabled=l(),a(z,o(O)?.triggerLabel??o(O)?.label??r())},[()=>M(q(`relative`,d())),()=>M(q(`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,ne),i(t,F),R()}f([`click`,`keydown`]);var qr=t(`<title> </title>`),Jr=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 Yr(e,t){H(t,!0);let n=P(t,`className`,3,``),r=P(t,`title`,3,`OpenAI`);var o=Jr(),c=s(o),l=e=>{var t=qr(),n=s(t,!0);B(t),x(()=>a(n,r())),i(e,t)};y(c,e=>{r()&&e(l)}),ne(),B(o),x(e=>{I(o,0,e),j(o,`aria-hidden`,!r()||void 0)},[()=>M(q(`size-4`,n()))]),i(e,o),R()}var Xr=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>`),Zr=t(`<svg viewBox="0 0 24 24" role="img" aria-label="xAI" fill="currentColor"><path d="M6.469 8.776 16.512 23h-4.464L2.005 8.776H6.47Zm-.004 7.9 2.233 3.164L6.467 23H2l4.465-6.324ZM22 2.582V23h-3.659V7.764L22 2.582ZM22 1l-9.952 14.095-2.233-3.163L17.533 1H22Z"></path></svg>`),Qr=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>`),$r=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>`),ei=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>`),ti=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 ni(t,n){H(n,!0);let r=P(n,`className`,3,``);var a=m(),s=u(a),c=t=>{{let n=e(()=>q(`size-4 text-foreground`,r()));Yr(t,{get className(){return o(n)}})}},l=e=>{var t=Xr();x(e=>I(t,0,e),[()=>M(q(`size-4 text-[#D97757]`,r()))]),i(e,t)},d=e=>{var t=Zr();x(e=>I(t,0,e),[()=>M(q(`text-foreground size-4`,r()))]),i(e,t)},f=e=>{var t=Qr();x(e=>I(t,0,e),[()=>M(q(`text-foreground size-4`,r()))]),i(e,t)},p=e=>{var t=$r();x(e=>I(t,0,e),[()=>M(q(`size-4 text-[#4D6BFE]`,r()))]),i(e,t)},h=e=>{var t=ei();x(e=>I(t,0,e),[()=>M(q(`text-foreground size-4`,r()))]),i(e,t)},g=e=>{var t=ti();x(e=>{I(t,0,e),j(t,`aria-label`,n.provider||`Unknown provider`)},[()=>M(q(`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===`xai`?e(d,2):n.provider===`zai`?e(f,3):n.provider===`deepseek`?e(p,4):n.provider===`kimi`?e(h,5):e(g,-1)}),i(t,a),R()}var ri=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],ii=[`standard`,`fast`],ai=`deepseek-v4-pro-0813`,oi=`standard`,si=[`stealth/ox-alpha`,`gpt-5.6-terra`,`gpt-5.6-luna`,`grok-4.5`,`deepseek-v4-pro`,`deepseek-v4-flash`],ci={"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 li(e){return ri.some(t=>t===e)}function ui(e){return ii.some(t=>t===e)}function di(e){for(let t of si)if(t===e)return ci[t]}function fi(e){return di(e)??e}function pi(e,t){return{modelId:fi(e),serviceTier:ui(t)?t:oi}}function mi(e,t){return li(t)?t:`max`}var hi=`/api`,gi=`Model catalog is unavailable.`;function _i(e,t){return e.models.find(e=>e.id===t)}function vi(e,t,n){return(e.tierAllowedModels[t]??[]).includes(n)}function yi(e,t,n){return vi(e,t,n)?n:e.tierAllowedModels[t]?.[0]??e.defaultModelId}function bi(e,t,n){return(e.tierAllowedServiceTiers[t]??[]).includes(n)}function xi(e,t,n){return n.serviceTiers.filter(n=>bi(e,t,n))}function Si(e,t,n){return n.serviceTiers.map(n=>{let r={id:n,label:Ti(n)};return bi(e,t,n)?r:{...r,locked:!0,lockTooltip:e.serviceTierLockUpgradeMessage}})}function Ci(e,t){let n=[],r=[];for(let i of e.models){let a={id:i.id,label:i.label,provider:i.provider};vi(e,t,i.id)?n.push(a):r.push({...a,locked:!0,lockTooltip:e.modelLockUpgradeMessage})}return[...n,...r]}function wi(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 Ti(e){switch(e){case`standard`:return`Standard`;case`fast`:return`Fast`;default:return e}}var Ei=je({id:De().min(1),label:De().min(1),provider:De().min(1),supportsImages:Oe(),contextWindowTokens:W(),autoCompactTokenLimit:W(),reasoningEfforts:Ae(De()).min(1),defaultReasoningEffort:De().min(1),serviceTiers:Ae(De()).min(1),usagePolicy:G(`unlimited`).optional()}),Di=ke({sprocket:ke({protocolVersion:W(),catalogVersion:De().min(1),defaultModelId:De().min(1),defaultReasoningEffort:De().min(1),defaultServiceTier:De().min(1),models:Ae(Ei).min(1),tierAllowedModels:ke({free:Ae(De()),pro:Ae(De()),admin:Ae(De())}),tierAllowedServiceTiers:ke({free:Ae(De()),pro:Ae(De()),admin:Ae(De())}),modelLockUpgradeMessage:De().min(1),serviceTierLockUpgradeMessage:De().min(1)})});function Oi(e){let t=e.sprocket;if(t.protocolVersion!==1)throw Error(`${gi} 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 ki(e){let t=e.replace(/\/+$/,``);if(!t)throw Error(gi);let n=await fetch(`${t}${hi}/v1/models`,{headers:{accept:`application/json`}});if(!n.ok)throw Error(gi);let r=Di.safeParse(await n.json());if(!r.success)throw Error(gi);return Oi(r.data)}var Ai=F(`<span class="text-muted-foreground ml-auto text-xs">Default</span>`),ji=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>`),Mi=F(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Ni=F(`<button type="button"><!> <!> <span> </span> <!></button>`),Pi=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>`),Fi=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 Ii(t,n){H(n,!0);let r=P(n,`reasoningEffort`,31,()=>l(`max`)),d=P(n,`serviceTier`,31,()=>l(oi)),f=P(n,`disabled`,3,!1),m=P(n,`className`,3,``),_=e(()=>n.serviceTierOptions?n.serviceTierOptions:n.model.serviceTiers.map(e=>({id:e,label:Ti(e)}))),b=e(()=>o(_).filter(e=>!e.locked).map(e=>e.id)),S=g(!1),w=g(null),T=g(null),E=Pr();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 Fr({getRoot:()=>o(w),onOutside:()=>{C(S,!1)},onEscape:()=>{C(S,!1),o(T)?.focus()}})}),c(()=>{f()&&C(S,!1)});var k=Fi(),A=u(k),ee=s(A),te=s(ee),ne=s(te);B(te);var N=V(te,2);{let t=e(()=>q(`text-muted-foreground size-3 shrink-0 transition-transform`,o(S)&&`rotate-180`));At(N,{get class(){return o(t)}})}B(ee),ce(ee,e=>C(T,e),()=>o(T));var re=V(ee,2),F=t=>{var c=Pi(),l=V(s(c),2);v(l,20,()=>n.model.reasoningEfforts,e=>e,(t,c)=>{var l=ji(),u=s(l);{let t=e(()=>q(`size-4 shrink-0 transition-opacity`,c===r()?`opacity-100`:`opacity-0`));Ot(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=Ai();i(e,t)};y(m,e=>{c===n.model.defaultReasoningEffort&&e(h)}),B(l),x(e=>{j(l,`aria-pressed`,c===r()),a(f,e)},[()=>wi(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=Ni(),l=s(c),u=e=>{var t=Mi();Dn(s(t),{class:`size-3.5`}),B(t),i(e,t)},f=t=>{{let r=e(()=>q(`size-4 shrink-0 transition-opacity`,o(n).id===d()?`opacity-100`:`opacity-0`));Ot(t,{get class(){return o(r)}})}};y(l,e=>{o(r)?e(u):e(f,-1)});var m=V(l,2),g=e=>{lr(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=Ai();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),j(c,`aria-pressed`,!o(r)&&o(n).id===d()),j(c,`aria-disabled`,o(r)),j(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(q(`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(q(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(A),ce(A,e=>C(w,e),()=>o(w)),Lr(V(A,2),{get tooltip(){return E.lockTooltip}}),x((e,t,n)=>{I(A,1,e),j(ee,`aria-expanded`,o(S)),ee.disabled=f(),a(ne,`${t??``} · ${n??``}`)},[()=>M(q(`relative`,m())),()=>wi(r()),()=>Ti(d())]),p(`click`,ee,()=>{C(S,!o(S))}),i(t,k),R()}f([`click`]);function Li(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}var Ri=/(^|\s)\$([a-z0-9-]*)$/i;function zi(e,t){if(t<0||t>e.length)return null;let n=e.slice(0,t).match(Ri);return!n||n.index===void 0?null:{query:n[2].toLowerCase(),tokenStart:n.index+n[1].length}}function Bi(e,t){return zi(e,t)?.query??null}function Vi(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 Hi(e,t,n){let r=zi(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 Ui(e){let t=Math.floor(e/60),n=e%60;return t===0?`${n}s`:`${t}m ${n}s`}function Wi(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 Gi(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 Ki=`agent_decide`;function qi(e){return!!e.selectedOptionId?.trim()||!!e.text.trim()}function Ji(e){return Object.prototype.toString.call(e)===`[object String]`&&!(e instanceof String)}function Yi(e){return Object.prototype.toString.call(e)===`[object Boolean]`&&!(e instanceof Boolean)}function Xi(e){return e!=null&&!Array.isArray(e)&&Object(e)===e}var Zi=X.union(X.string(),X.number(),X.boolean(),X.null()),Qi=8;function $i(e){return e===0?Zi:X.union(Zi,X.array($i(e-1)),X.record(X.string(),$i(e-1)))}var ea=$i(Qi),ta=[`free`,`pro`,`admin`],na={free:`Free`,pro:`Pro`,admin:`Admin`},ra={modelUsage:{weekly:5e3,monthly:15e3}};ra.modelUsage.weekly*5,ra.modelUsage.monthly*5;function ia(e){return e.map(e=>X.literal(e))}X.union(...ia(ri)),X.union(...ia(ii)),X.union(...ia(ta)),X.union(X.literal(`active`),X.literal(`on_hold`),X.literal(`cancelled`),X.literal(`expired`),X.literal(`failed`));var aa=X.object({path:X.string(),directory:X.string(),contents:X.string(),truncated:X.boolean()}),oa=X.object({patch:X.string()}),sa=X.object({cmd:X.string(),workdir:X.optional(X.string()),shell:X.optional(X.string()),timeoutMs:X.optional(X.number()),yieldTimeMs:X.optional(X.number()),maxOutputChars:X.optional(X.number())}),ca=X.object({url:X.string()}),la=X.object({query:X.string(),numResults:X.optional(X.number())}),ua=X.object({sessionId:X.string(),chars:X.optional(X.string()),terminate:X.optional(X.boolean()),yieldTimeMs:X.optional(X.number())}),da=X.union(X.literal(`markdown`),X.literal(`html`),X.literal(`react`)),fa=X.object({title:X.string(),contentType:da,content:X.string()}),pa=X.object({artifactId:X.string(),content:X.string()}),ma=X.object({name:X.string()}),ha=X.object({instruction:X.optional(X.string()),action:X.optional(X.object({selector:X.string(),description:X.string(),method:X.optional(X.string()),arguments:X.optional(X.array(X.string()))})),startUrl:X.optional(X.string())}),ga=X.union(...ia([`one_time`,`weekly`,`monthly`,`yearly`])),_a=X.union(X.literal(`listed`),X.literal(`any`)),va=X.union(...ia([`pending`,`active`,`paused`,`consumed`,`cancelled`,`expired`]));X.union(X.literal(`awaiting_result`),X.literal(`completed`),X.literal(`declined`),X.literal(`failed`));var ya=X.union(X.literal(`approved`),X.literal(`declined`)),ba=X.object({userEmail:X.optional(X.string()),merchantName:X.optional(X.string()),merchantUrl:X.optional(X.string()),countryCode:X.optional(X.string()),amountCap:X.string(),currency:X.string(),frequency:ga,scope:_a,description:X.string(),maxCharges:X.optional(X.number()),validUntil:X.optional(X.string())}),xa=X.object({mandateId:X.string()}),Sa=X.object({mandateId:X.string(),amount:X.string(),currency:X.string(),description:X.string(),reference:X.optional(X.string())}),Ca=X.object({chargeId:X.string(),outcome:ya,amountPaid:X.optional(X.string())}),wa=X.object({id:X.string(),label:X.string()}),Ta=X.object({question:X.string(),options:X.array(wa),yieldTimeMs:X.optional(X.number()),timeoutMs:X.optional(X.number())}),Ea=X.object({questionId:X.id(`agentQuestions`),yieldTimeMs:X.optional(X.number())});X.union(X.object({}),oa,Ta,Ea,sa,ma,ca,la,ua,fa,pa,ha,ba,xa,Sa,Ca);var Da=X.object({changes:X.array(X.object({path:X.string(),operation:X.union(X.literal(`created`),X.literal(`updated`),X.literal(`deleted`),X.literal(`renamed`),X.literal(`copied`))}))}),Oa=X.object({command:X.string(),cwd:X.string(),output:X.string(),sessionId:X.optional(X.string()),exitCode:X.optional(X.number()),success:X.boolean(),running:X.boolean(),timedOut:X.boolean(),truncated:X.boolean(),error:X.optional(X.string())}),ka=X.object({url:X.string(),markdown:X.string(),truncated:X.boolean()}),Aa=X.object({results:X.array(X.object({title:X.optional(X.string()),url:X.string(),publishedDate:X.optional(X.string()),author:X.optional(X.string()),text:X.optional(X.string())}))}),ja=X.object({mandateId:X.id(`mandates`),approvalUrl:X.string(),expiresAt:X.string()}),Ma=X.object({mandateId:X.id(`mandates`),pravaMandateId:X.optional(X.string()),status:va,description:X.optional(X.string()),merchantName:X.optional(X.string()),amountCap:X.string(),remaining:X.optional(X.string()),currency:X.string(),frequency:ga,scope:_a,approvalUrl:X.optional(X.string()),validUntil:X.optional(X.string()),renewsAt:X.optional(X.string())}),Na=X.object({mandates:X.array(X.object({mandateId:X.optional(X.id(`mandates`)),pravaMandateId:X.string(),status:X.string(),description:X.optional(X.string()),merchantName:X.optional(X.string()),approvedAmount:X.string(),remaining:X.optional(X.string()),currency:X.string(),validUntil:X.optional(X.string()),renewsAt:X.optional(X.string())}))}),Pa=X.object({chargeId:X.id(`mandateCharges`),transactionId:X.string(),token:X.optional(X.string()),dynamicCvv:X.optional(X.string()),expiryMonth:X.optional(X.string()),expiryYear:X.optional(X.string())}),Fa=X.object({reported:X.boolean(),alreadyReported:X.optional(X.boolean()),inFlight:X.optional(X.boolean())}),Ia=X.object({text:X.string(),truncated:X.boolean()}),La=X.object({selector:X.string(),description:X.string(),method:X.optional(X.string()),arguments:X.optional(X.array(X.string()))}),Ra=X.object({actions:X.array(La),text:X.string(),truncated:X.boolean()}),za=X.object({name:X.string(),description:X.string(),content:X.string(),dir:X.optional(X.string()),truncated:X.optional(X.boolean())}),Ba=X.object({optionId:X.optional(X.string()),optionLabel:X.optional(X.string()),text:X.optional(X.string())}),Va=X.object({questionId:X.id(`agentQuestions`),question:X.string(),options:X.array(wa),pending:X.boolean(),timedOut:X.boolean(),answer:X.optional(Ba)}),Ha=X.object({artifactId:X.string(),version:X.number(),title:X.optional(X.string()),contentType:X.optional(da)});X.union(X.string(),X.array(aa),Da,Va,Oa,za,ka,Aa,Ha,Ia,Ra,ja,Ma,Na,Pa,Fa),X.union(X.literal(`queued`),X.literal(`running`),X.literal(`awaiting_executor`),X.literal(`completed`),X.literal(`failed`),X.literal(`cancelled`));var Ua=[`cancelled`,`completed`,`failed`];X.union(...ia(Ua));function Wa(e){return Ua.some(t=>t===e)}X.union(X.literal(`apply_patch`),X.literal(`ask_question`),X.literal(`await_question`),X.literal(`browser_observe`),X.literal(`browser_act`),X.literal(`browser_extract`),X.literal(`exec_command`),X.literal(`get_workspace_instructions`),X.literal(`mandate_setup`),X.literal(`mandate_status`),X.literal(`mandate_list`),X.literal(`mandate_charge`),X.literal(`mandate_report`),X.literal(`read_skill`),X.literal(`scrape_url`),X.literal(`web_search`),X.literal(`write_stdin`),X.literal(`create_artifact`),X.literal(`update_artifact`)),X.union(X.literal(`pending`),X.literal(`answered`),X.literal(`timedOut`),X.literal(`cancelled`)),X.union(X.literal(`pending`),X.literal(`claimed`),X.literal(`completed`),X.literal(`failed`),X.literal(`cancelled`)),X.union(X.literal(`prompt`),X.literal(`response`));var Ga=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],Ka=`10 MiB`,qa=X.object({type:X.literal(`text`),id:X.string(),text:X.string(),turnId:X.optional(X.string()),providerMetadata:X.optional(ea)}),Ja=X.object({type:X.literal(`reasoning`),id:X.string(),text:X.string(),turnId:X.optional(X.string()),providerMetadata:X.optional(ea)}),Ya=X.object({type:X.literal(`tool-call`),partId:X.optional(X.string()),callId:X.string(),name:X.string(),input:ea,turnId:X.optional(X.string()),providerMetadata:X.optional(ea)}),Xa=X.union(...ia([`cancelled`,`failed`]));X.object({error:X.string(),status:Xa});var Za=X.object({type:X.literal(`tool-result`),callId:X.string(),name:X.optional(X.string()),output:ea});X.union(qa,Ja,Ya,Za),X.union(X.literal(`prompt`),X.literal(`completion`),X.literal(`tool`));var Qa=X.object({imageUploadId:X.id(`imageUploads`),name:X.string(),mediaType:X.string(),size:X.number(),storageId:X.id(`_storage`),url:X.optional(X.string())}),$a=X.union(qa,Ja,Ya);X.object({text:X.string(),imageUploads:X.array(Qa)}),X.object({streamId:X.optional(X.string()),items:X.array($a)});var eo=X.union(X.literal(`started`),X.literal(`completed`),X.literal(`failed`),X.literal(`cancelled`));X.object({jobId:X.optional(X.id(`executorJobs`)),toolInvocationId:X.optional(X.string()),callId:X.string(),name:X.string(),output:X.optional(ea),status:eo});var to=X.union(X.literal(`system`),X.literal(`user`),X.literal(`assistant`)),no=X.union(X.object({type:X.literal(`text`),text:X.string()}),X.object({type:X.literal(`image`),imageJson:X.string()})),ro=X.union(X.object({type:X.literal(`text`),text:X.string(),additionalParamsJson:X.optional(X.string())}),X.object({type:X.literal(`reasoning`),id:X.optional(X.string()),blocksJson:X.string()}),X.object({type:X.literal(`toolCall`),id:X.string(),callId:X.optional(X.string()),name:X.string(),argumentsJson:X.string(),signature:X.optional(X.string()),additionalParamsJson:X.optional(X.string())}),X.object({type:X.literal(`toolResult`),id:X.string(),callId:X.optional(X.string()),items:X.array(no)}),X.object({type:X.literal(`image`),imageJson:X.string()}),X.object({type:X.literal(`audio`),audioJson:X.string()}),X.object({type:X.literal(`video`),videoJson:X.string()}),X.object({type:X.literal(`document`),documentJson:X.string()}));X.object({role:to,assistantId:X.optional(X.string()),contents:X.array(ro)});function io(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>e===r[t])}var ao=Ga,oo=new Set(ao);function so(e){return oo.has(e)}function co(e,t){return e>=4?`You can attach up to 4 images.`:so(t.type)?t.size>10485760?`${t.name||`This image`} is larger than ${Ka}.`:null:`${t.name||`This file`} is not a supported image. Use JPEG, PNG, GIF, or WebP.`}var lo=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>`),uo=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>`),fo=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>`),po=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>`),mo=F(`<li><button type="button"> </button></li>`),ho=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>`),go=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>`),_o=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>`),vo=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>`),yo=F(`<p class="text-destructive mb-3 text-xs" role="alert"> </p>`),bo=F(`<ul class="mb-3 flex flex-wrap items-center gap-2" aria-label="Attached images"></ul> <!>`,1),xo=F(`<p class="text-muted-foreground px-3 py-2 text-sm">Loading skills…</p>`),So=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>`),Co=F(`<p class="text-muted-foreground px-3 py-2 text-sm">No matching skills</p>`),wo=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>`),To=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>`),Eo=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>`),Do=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>`),Oo=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>`),ko=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 Ao(t,n){H(n,!0);let r=P(n,`prompt`,15,``),d=P(n,`selectedModel`,31,()=>l(ai)),f=P(n,`selectedReasoningEffort`,31,()=>l(`max`)),_=P(n,`selectedServiceTier`,31,()=>l(oi)),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=Fe(),D=Ie(Se.billing.getMySubscription,()=>E.isAuthenticated&&!E.isLoading?{}:`skip`),O=Ie(Se.usage.getMyUsage,()=>E.isAuthenticated&&!E.isLoading?{}:`skip`),k=e(()=>D.data?.tier),te=e(()=>!!D.error),ne=e(()=>n.modelCatalog?Ci(n.modelCatalog,o(k)??`free`):[]),N=e(()=>n.modelCatalog?_i(n.modelCatalog,d()):void 0),re=e(()=>n.modelCatalog&&o(N)?Si(n.modelCatalog,o(k)??`free`,o(N)):void 0),F=e(()=>o(N)!==void 0&&(o(te)||o(k)!==void 0&&n.modelCatalog!==void 0&&vi(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),fe=g(0),pe=0,me,he=l([]),U=e(()=>b()!=null),ge=e(()=>n.isRunning&&!o(U)||n.isSubmitting),_e=g(l(Date.now()));c(()=>{let e=setInterval(()=>{C(_e,Date.now(),!0)},1e3);return()=>{clearInterval(e)}});let ve=e(()=>o(N)?.usagePolicy===`unlimited`),ye=e(()=>O.data?.exhausted===!0&&(O.data.resetsAt===null||O.data.resetsAt>o(_e))&&!o(ve)),be=e(()=>n.modelCatalog?o(ne).find(e=>!e.locked&&_i(n.modelCatalog,e.id)?.usagePolicy===`unlimited`)?.label??null:null),xe=e(()=>{if(!o(ye)||O.data===void 0)return null;let e=o(be)===null?`Upgrade your subscription to keep going.`:`Switch to ${o(be)} or upgrade your subscription to keep going.`;return O.data.resetsAt===null?e:`Your limit resets in ${Gi(O.data.resetsAt-o(_e))}. ${e}`}),Ce=e(()=>!!r().trim()||n.attachments.length>0),we=e(()=>o(N)?.supportsImages===!0),Te=e(()=>n.attachments.length>0&&o(N)?.supportsImages===!1),Ee=e(()=>qi({selectedOptionId:w(),text:r()})),W=e(()=>o(U)?o(Ee):o(Ce)),De=e(()=>n.attachments.some(e=>e.status!==`ready`)),Oe=e(()=>o(we)&&n.attachments.length<4&&!o(ge)&&!o(U)),ke=g(null);c(()=>{let e=b()?.questionId??null;e!==o(ke)&&(C(ke,e,!0),w(null),r().trim()&&r(``))});let G=e(()=>o(N)?.supportsImages===!1?`${o(N).label} does not support image input`:`Attach images (up to 4)`),Ae=!!globalThis.CSS?.supports(`field-sizing`,`content`),je=e(()=>n.contextUsage.contextWindowTokens>0?Math.min(100,Math.round(n.contextUsage.inputTokens/n.contextUsage.contextWindowTokens*100)):0),Me=e(()=>n.contextUsage.contextWindowTokens>0?Math.round(n.contextUsage.autoCompactTokenLimit/n.contextUsage.contextWindowTokens*100):0),Ne=e(()=>Bi(r(),o(fe))),Pe=e(()=>o(Ne)!==null&&!o(ue)&&!o(U)),K=e(()=>o(Ne)===null?[]:Vi(o(L),o(Ne))),Le=e(()=>o(Pe)&&o(K).length>0?`composer-skill-option-${o(de)}`:void 0);function Re(){C(fe,o(ie)?.selectionStart??r().length,!0)}function q(){C(L,[],!0),C(le,`idle`),C(ue,!1),C(de,0),pe+=1}async function ze(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=++pe;C(le,`loading`);try{let e=await T().load();if(t!==pe)return;C(L,e,!0),C(le,`ready`)}catch{if(t!==pe)return;C(L,[],!0),C(le,`error`)}}function Be(e){let t=Hi(r(),o(fe),e.name);t&&(r(t.text),C(fe,t.caret,!0),C(ue,!0),queueMicrotask(()=>{o(ie)&&(o(ie).focus(),o(ie).setSelectionRange(t.caret,t.caret),Ge())}))}function Ve(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 He(e){let t=Array.from(e.clipboardData?.files??[]).filter(e=>e.type.startsWith(`image/`));t.length===0||n.isRunning||n.isSubmitting||o(U)||!o(we)||(e.preventDefault(),n.onAttachFiles(t))}function Ue(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 We(){C(se,null)}function Ge(){if(!o(ie)||Ae)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 J(e){if(o(Pe)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),o(K).length===0)return;let t=e.key===`ArrowDown`?1:-1;C(de,(o(de)+t+o(K).length)%o(K).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(K)[o(de)];t&&Be(t);return}}!n.canSend||!o(U)&&!o(F)||!o(U)&&o(ye)||n.isSubmitting||o(ge)||!o(W)||!o(U)&&(o(De)||o(Te))||Li(e)&&(e.preventDefault(),n.onSubmit())}function Ke(e){w(w()===e?null:e)}function Y(e){if(!n.modelCatalog)return;let t=_i(n.modelCatalog,e);t&&f(t.defaultReasoningEffort),n.onModelChange?.(e)}function qe(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()||!_i(n.modelCatalog,d()))&&(d(n.modelCatalog.defaultModelId),f(n.modelCatalog.defaultReasoningEffort),_(n.modelCatalog.defaultServiceTier))}),c(()=>{if(!n.modelCatalog||!o(k))return;let e=yi(n.modelCatalog,o(k),d());e!==d()&&(d(e),f(_i(n.modelCatalog,e)?.defaultReasoningEffort??n.modelCatalog.defaultReasoningEffort));let t=_i(n.modelCatalog,e);if(!t)return;let r=xi(n.modelCatalog,o(k),t);r.includes(_())||_(r[0]??n.modelCatalog.defaultServiceTier)}),c(()=>{r(),Ge()}),c(()=>{let e=T()?.workspacePath??null;if(me!==e&&(me=e,q()),o(Ne)===null){C(ue,!1);return}o(ue)||ze()}),c(()=>{o(K),C(de,0)}),c(()=>{!o(Pe)||o(K).length===0||he[o(de)]?.scrollIntoView({block:`nearest`})});var Je=ko(),Ye=u(Je),Xe=s(Ye),Ze=s(Xe),Qe=e=>{var t=lo(),r=V(s(t),2),o=s(r);B(r),B(t),x(()=>a(o,`Working for ${n.elapsedLabel??``}`)),i(e,t)},$e=e=>{var t=uo(),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(Ze,e=>{n.elapsedLabel?e(Qe):n.isSubmitting&&e($e,1)});var et=V(Ze,2),tt=e=>{var t=fo(),r=s(t);B(t),x(()=>r.disabled=n.isSubmitting),p(`click`,r,function(...e){n.onContinueWorking?.apply(this,e)}),i(e,t)};y(et,e=>{S()&&n.onContinueWorking&&e(tt)});var nt=V(et,2);I(nt,1,M(`composer-shell mx-auto w-full max-w-[48rem] rounded-[28px] p-px transition-colors duration-200`));var rt=s(nt);I(rt,1,M(`composer-inner rounded-[27px] border border-[var(--hairline)] transition-colors duration-200`));var it=s(rt),at=s(it),ot=e=>{var t=po(),n=s(t);Pt(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(xe))),i(e,t)};y(at,e=>{o(xe)&&e(ot)});var st=V(at,2),ct=t=>{var n=ho(),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===Ki),c=e(()=>w()===o(n).id);var l=mo(),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`}`),j(u,`aria-pressed`,o(c)),a(d,o(n).label)}),p(`click`,u,()=>{Ke(o(n).id)}),i(t,l)}),B(l),B(n),x(()=>a(c,b().question)),i(t,n)};y(st,e=>{b()&&e(ct)});var lt=V(st,2),X=e=>{var t=bo(),r=u(t);v(r,21,()=>n.attachments,e=>e.localId,(e,t)=>{var r=vo(),a=s(r),c=V(a,2),l=e=>{var n=go();x(()=>j(n,`aria-label`,`Uploading ${o(t).name??``}`)),i(e,n)},u=e=>{var t=_o();i(e,t)};y(c,e=>{o(t).status===`uploading`?e(l):o(t).status===`error`&&e(u,1)});var d=V(c,2);sr(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`}`),j(r,`title`,o(t).error??o(t).name),j(a,`src`,o(t).previewUrl),j(a,`alt`,o(t).name),I(a,1,`size-full object-cover ${o(t).status===`uploading`?`opacity-50`:``}`),j(d,`aria-label`,`Remove ${o(t).name??``}`),d.disabled=o(ge)}),p(`click`,d,()=>n.onRemoveAttachment(o(t).localId)),i(e,r)}),B(r);var c=V(r,2),l=e=>{var t=yo(),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(Te)&&o(N)&&e(l)}),i(e,t)};y(lt,e=>{n.attachments.length>0&&!o(U)&&e(X)});var ut=V(lt,2),dt=s(ut),ft=e=>{var t=To(),n=s(t),r=e=>{var t=xo();i(e,t)},c=e=>{var t=So(),n=V(s(t),2);B(t),p(`click`,n,()=>{ze(!0)}),i(e,t)},l=e=>{var t=Co();i(e,t)},d=e=>{var t=m(),n=u(t);v(n,19,()=>o(K),e=>e.name,(e,t,n)=>{var r=wo(),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)=>he[t]=e,e=>he?.[e],()=>[o(n)]),x(()=>{j(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`}`),j(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,()=>{Be(o(t))}),i(e,r)}),i(e,t)};y(n,e=>{o(le)===`loading`?e(r):o(le)===`error`?e(c,1):o(K).length===0?e(l,2):e(d,-1)}),B(t),x(()=>j(t,`role`,o(le)===`ready`&&o(K).length>0?`listbox`:`status`)),i(e,t)};y(dt,e=>{o(Pe)&&e(ft)});var pt=V(dt,2);ee(pt),ce(pt,e=>C(ie,e),()=>o(ie)),B(ut);var mt=V(ut,2),ht=s(mt),Z=s(ht);ce(Z,e=>C(oe,e),()=>o(oe));var gt=V(Z,2);xn(s(gt),{class:`size-4`,"aria-hidden":`true`}),B(gt);var _t=V(gt,4);{let t=(e,t=ae)=>{ni(e,{get provider(){return t().provider},className:`size-4 shrink-0`})},r=e(()=>o(ge)||o(U)||n.modelCatalog===void 0);Kr(_t,{get options(){return o(ne)},ariaLabel:`Select model`,menuTitle:`Model`,get disabled(){return o(r)},searchable:!0,onValueChange:Y,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 vt=V(_t,4),yt=t=>{{let n=e(()=>o(ge)||o(U));Ii(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(vt,e=>{o(N)&&e(yt)}),B(ht);var bt=V(ht,2),St=s(bt),Ct=s(St),Q=V(Ct,2),wt=s(Q),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),Nt=s(Mt);B(Mt),B(Q),B(St);var Ft=V(St,2),It=e=>{var t=Eo();Yn(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=Do();xt(s(t),{class:`size-4`}),B(t),x(()=>{t.disabled=!n.canSend||!o(U)&&!o(F)||!o(U)&&o(ye)||n.isSubmitting||!o(W)||!o(U)&&(o(De)||o(Te)),j(t,`aria-label`,o(U)?`Submit answer`:`Send message`)}),p(`click`,t,function(...e){n.onSubmit?.apply(this,e)}),i(e,t)};y(Lt,e=>{(o(U)||!n.isRunning)&&e(Rt)}),B(bt),B(mt),B(it),B(rt),B(nt),B(Xe),B(Ye);var zt=V(Ye,2),Bt=e=>{var t=Oo(),n=s(t,!0);B(t),x(()=>{z(t,`top: ${o(se).top}px; left: ${o(se).left}px;`),a(n,o(G))}),i(e,t)};y(zt,e=>{o(se)&&e(Bt)}),x((e,t,n,r)=>{j(pt,`placeholder`,o(U)?`Add detail, or type a custom answer`:`Ask anything, @tag files/directories, or use $ to show available skills`),pt.disabled=o(ge),j(pt,`aria-expanded`,o(Pe)),j(pt,`aria-controls`,o(Pe)?`composer-skills-listbox`:void 0),j(pt,`aria-activedescendant`,o(Le)),j(Z,`accept`,e),j(gt,`aria-label`,o(G)),gt.disabled=!o(Oe),j(Ct,`aria-label`,`Context window ${o(je)}% full`),z(Ct,`background: conic-gradient(var(--accent) ${o(je)*3.6}deg, var(--hover-fill-strong) 0deg);`),a(Et,`${o(je)??``}% · ${t??``}/${n??``}`),z(Ot,`width: ${o(je)}%`),a(jt,r),a(Nt,`Sprocket automatically compacts context at about ${o(Me)??``}% so
|
|
3
|
+
long-running work can continue.`)},[()=>ao.join(`,`),()=>qe(n.contextUsage.inputTokens),()=>qe(n.contextUsage.contextWindowTokens),()=>qe(n.contextUsage.totalTokensProcessed)]),p(`keydown`,pt,J),h(`paste`,pt,He),h(`focus`,pt,Re),p(`input`,pt,()=>{Re(),Ge()}),p(`keyup`,pt,Re),p(`click`,pt,Re),h(`select`,pt,Re),A(pt,r),p(`change`,Z,Ve),h(`mouseenter`,gt,Ue),h(`mouseleave`,gt,We),h(`focus`,gt,Ue),h(`blur`,gt,We),p(`click`,gt,()=>{We(),o(oe)?.click()}),p(`keydown`,Ct,e=>{e.key===`Escape`&&e.currentTarget.blur()}),i(t,Je),R()}f([`click`,`keydown`,`input`,`keyup`,`change`]);var jo=F(`<p class="text-foreground text-[15px]"> </p>`),Mo=F(`<button type="button" class="text-muted-foreground hover:text-foreground block text-left text-sm transition"><span> </span></button>`),No=F(`<div class="mt-3 space-y-1"><!> <!></div>`),Po=F(`<p class="text-muted-foreground mt-3 text-sm">You’re signed in to Sprocket.</p>`),Fo=F(`<p class="text-foreground mt-3 text-[15px]"> </p>`),Io=F(`<p class="text-muted-foreground mt-3 text-sm">Couldn’t load your subscription right now.</p>`),Lo=F(`<div class="bg-hover-fill mt-3.5 h-4 w-16 animate-pulse rounded" aria-hidden="true"></div>`),Ro=F(`<!> Sign Out`,1),zo=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 Bo(t,n){H(n,!0);let r=g(!1),c=Fe(),l=Ie(Se.billing.getMySubscription,()=>c.isAuthenticated&&!c.isLoading?{}:`skip`),d=e(()=>[n.user?.firstName,n.user?.lastName].filter(Boolean).join(` `).trim()||null);var f=zo(),m=V(s(f),2),h=s(m),_=s(h),v=V(s(_),2),b=e=>{var t=No(),c=s(t),l=e=>{var t=jo(),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=Mo(),c=s(t),l=s(c,!0);B(c),B(t),x(()=>{j(t,`aria-pressed`,o(r)),j(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=Po();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=Fo(),n=s(t,!0);B(t),x(()=>a(n,na[l.data.tier])),i(e,t)},D=e=>{var t=Io();i(e,t)},O=e=>{var t=Lo();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),A=V(s(k),4);_r(s(A),{variant:`outline`,get onclick(){return n.onSignOut},children:(e,t)=>{var n=Ro();kn(u(n),{class:`mr-2 size-4`,"aria-hidden":`true`}),ne(),i(e,n)},$$slots:{default:!0}}),B(A),B(k),B(h),B(m),B(f),i(t,f),R()}f([`click`]);function Vo(e){return{threadId:e.threadId,repositoryKey:e.repositoryKey??``,title:e.title,selectedModel:fi(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 Ho(e,t){return t?e.find(e=>e.repositoryKey===t)??null:null}function Uo(e,t){return t?e.find(e=>e.workspacePath===t)??null:null}function Wo(e){return e.threadStatus!==`archived`}function Go(e,t){let n=Jo(t);return{project:e,threads:n,activeThreadCount:Yo(n)}}function Ko(e,t){let n=new Map;for(let e of t.filter(Wo)){let t=n.get(e.repositoryKey);if(t){t.push(e);continue}n.set(e.repositoryKey,[e])}return e.map(e=>Go(e,n.get(e.repositoryKey)??[]))}function qo(e,t,n){return e.map(e=>e.threadId===t&&e.hasActiveRun!==n?{...e,hasActiveRun:n}:e)}function Jo(e){return[...e].sort((e,t)=>e.hasActiveRun===t.hasActiveRun?t.lastMessageAt-e.lastMessageAt:Number(t.hasActiveRun)-Number(e.hasActiveRun))}function Yo(e){return e.filter(e=>e.hasActiveRun).length}function Xo(e,t){return t?e.find(e=>e.threadId===t)??null:null}function Zo(e){let t=null;for(let n of e)Wo(n)&&(!t||n.lastMessageAt>t.lastMessageAt)&&(t=n);return t}function Qo(e,t){return t&&(e?.threadId??e?._id)===t?e:null}function $o(e){let{pendingCreatedThreadId:t,threads:n}=e;return!t||Xo(n,t)?null:t}var es=`New thread`,ts=72;function ns(e){return e.trim().slice(0,ts)||es}function rs(e){let t=e.trim();return t===``||t===es}function is(e){return Vo({threadId:e.threadId,repositoryKey:e.repositoryKey,title:ns(e.title??``),selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,lastMessageAt:e.lastMessageAt??Date.now(),threadStatus:`active`,latestRunStatus:null,latestRunId:null,hasActiveRun:!1})}function as(e,t){return rs(e.title)&&!rs(t.title)}function os(e,t){if(!t)return e;let n=Xo(e,t.threadId);return n?as(n,t)?e.map(e=>e.threadId===n.threadId?{...e,title:t.title}:e):e:[t,...e]}function ss(e,t){if(!t)return!1;let n=Xo(e,t.threadId);return n?!as(n,t):!1}function cs(e,t){return t.filter(t=>!ss(e,t))}function ls(e,t){return t.reduce((e,t)=>os(e,t),e)}function us(e){return!e.threadId||e.threadId===e.pendingCreatedThreadId||e.hasLatestRunData}function ds(e,t){return!!(t&&e[t])}function fs(e,t,n){return{...e,[t]:n}}function ps(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 ms(e,t,n,r){return!!(t&&(t!==e.previousRunId||n!=null&&n!==e.previousClaimExpiresAt||r!=null&&r!==e.previousStartedAt))}function hs(e,t,n,r,i){let a=e[t];return!a||!ms(a,n,r,i)?e:ps(e,t,a.launchId)}function gs(e,t){let n=e;for(let e of t)n=hs(n,e.threadId,e.latestRunId,e.latestRunClaimExpiresAt);return n}function _s(e,t,n,r,i,a,o){let s=e[t];return!s||s.launchId!==n||s.expiresAt>r?{pendingLaunches:e,shouldRecover:!1}:{pendingLaunches:ps(e,t,n),shouldRecover:!ms(s,i,a,o)}}function vs(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 ys=F(`<p class="text-muted-foreground max-w-xl text-sm leading-6">No archived threads.</p>`),bs=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>`),xs=F(`<ul class="max-w-xl space-y-1"></ul>`),Ss=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 Cs(t,n){H(n,!0);let r=e(()=>[...n.threads].filter(e=>!Wo(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt));var c=Ss(),l=V(s(c),2),u=V(s(l),2),d=e=>{var t=ys();i(e,t)},f=t=>{var c=xs();v(c,21,()=>o(r),e=>e.threadId,(t,r)=>{let c=e(()=>Ho(n.projects,o(r).repositoryKey));var l=bs(),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 ws=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 Ts(e,t){H(t,!0);var n=ws(),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}`:``}`),j(c,`href`,t.approval.approvalUrl)}),i(e,n),R()}var Es=`Uncaught ConvexError: `,Ds=`Uncaught Error: `;function Os(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 ks(e){if(e instanceof Le){let t=e.data.trim();if(t)return t}let t=e.message.trim();return t?Os(t,Es)??Os(t,Ds)??t:null}var As=F(`<p class="text-destructive text-sm"> </p>`),js=F(`<div class="mt-4"><!></div>`),Ms=F(`<p class="text-destructive mt-3 text-sm"> </p>`),Ns=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>`),Ps=F(`<div class="mt-4 animate-pulse space-y-4" aria-hidden="true"></div>`),Fs=F(`<p class="text-muted-foreground mt-3 text-sm leading-6">No mandates yet.</p>`),Is=F(`<button type="button"> </button>`),Ls=F(`<div class="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1"></div>`),Rs=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>`),zs=F(`<ul class="mt-3 space-y-1"></ul>`),Bs=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 Vs(t,n){H(n,!0);let r=Fe(),u=K(Se.payments.listMyMandates),d=K(Se.payments.setupMyMandate),f=K(Se.payments.setMyMandateLifecycle);function m(e,t){return ks(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`),j=g(`listed`),ee=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(j)===`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(j)===`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(j),description:o(ee).trim()});C(F,{mandateId:e.mandateId,approvalUrl:e.approvalUrl,label:o(ee).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 fe=Bs(),pe=V(s(fe),2),me=s(pe),he=s(me),U=V(s(he),4),ge=s(U),_e=s(ge),ve=s(_e);I(ve,1,M(S));var ye=V(ve,2);ue(ye),I(ye,1,M(b)),B(_e);var be=V(_e,2),xe=s(be);I(xe,1,M(S));var Ce=V(xe,2);ue(Ce),I(Ce,1,M(b)),B(be);var we=V(be,2),Te=s(we);I(Te,1,M(S));var Ee=V(Te,2);ue(Ee),I(Ee,1,M(b)),B(we);var W=V(we,2),De=s(W);I(De,1,M(S));var Oe=V(De,2);ue(Oe),I(Oe,1,M(b)),B(W);var ke=V(W,2),G=s(ke);I(G,1,M(S));var Ae=V(G,2);ue(Ae),I(Ae,1,M(b)),B(ke);var je=V(ke,2),Me=s(je);I(Me,1,M(S));var Ne=V(Me,2);I(Ne,1,M(b));var Pe=s(Ne);Pe.value=Pe.__value=`one_time`;var Ie=V(Pe);Ie.value=Ie.__value=`weekly`;var Le=V(Ie);Le.value=Le.__value=`monthly`;var Re=V(Le);Re.value=Re.__value=`yearly`,B(Ne),B(je);var q=V(je,2),ze=s(q);I(ze,1,M(S));var Be=V(ze,2);I(Be,1,M(b));var Ve=s(Be);Ve.value=Ve.__value=`listed`;var He=V(Ve);He.value=He.__value=`any`,B(Be),B(q);var Ue=V(q,2),We=s(Ue);I(We,1,M(S));var Ge=V(We,2);ue(Ge),I(Ge,1,M(b)),B(Ue),B(ge);var J=V(ge,2),Ke=e=>{var t=As(),n=s(t,!0);B(t),x(()=>a(n,o(P))),i(e,t)};y(J,e=>{o(P)&&e(Ke)}),_r(V(J,2),{type:`submit`,variant:`outline`,get disabled(){return o(N)},children:(e,t)=>{ne();var n=re();x(()=>a(n,o(N)?`Setting up…`:`Set up mandate`)),i(e,n)},$$slots:{default:!0}}),B(U);var Y=V(U,2),qe=e=>{var t=js();Ts(s(t),{get approval(){return o(F)}}),B(t),i(e,t)};y(Y,e=>{o(F)&&e(qe)}),B(he);var Je=V(he,2),Ye=V(s(Je),2),Xe=e=>{var t=Ms(),n=s(t,!0);B(t),x(()=>a(n,o(oe))),i(e,t)};y(Ye,e=>{o(oe)&&e(Xe)});var Ze=V(Ye,2),Qe=e=>{var t=Ps();v(t,20,()=>[0,1],e=>e,(e,t)=>{var n=Ns();i(e,n)}),B(t),i(e,t)},$e=e=>{var t=Fs();i(e,t)},et=t=>{var n=zs();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=Rs(),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),A=t=>{let r=e(()=>[o(l)?`pause`:`resume`,`cancel`]);var u=Ls();v(u,20,()=>o(r),e=>e,(e,t)=>{var r=Is();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(A)}),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(Ze,e=>{o(ae)&&o(ie).length===0?e(Qe):o(ie).length===0?e($e,1):e(et,-1)}),B(Je),B(me),B(pe),B(fe),x(()=>{ye.disabled=o(N)||o(j)===`any`,Ce.disabled=o(N)||o(j)===`any`,Ee.disabled=o(N)||o(j)===`any`,Oe.disabled=o(N),Ae.disabled=o(N),Ne.disabled=o(N)||o(j)===`any`,Be.disabled=o(N),Ge.disabled=o(N)}),h(`submit`,U,le),A(ye,()=>o(w),e=>C(w,e)),A(Ce,()=>o(T),e=>C(T,e)),A(Ee,()=>o(E),e=>C(E,e)),A(Oe,()=>o(D),e=>C(D,e)),A(Ae,()=>o(O),e=>C(O,e)),te(Ne,()=>o(k),e=>C(k,e)),te(Be,()=>o(j),e=>C(j,e)),A(Ge,()=>o(ee),e=>C(ee,e)),i(t,fe),R()}f([`click`]);var Hs=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 Us(e,t){H(t,!0);var n=Hs(),r=s(n),a=e=>{Zn(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{jn(e,{class:`size-3.5`,"aria-hidden":`true`})};y(r,e=>{t.theme===`dark`?e(a):e(o,-1)}),B(n),x(()=>{j(n,`aria-label`,t.theme===`dark`?`Switch to light mode`:`Switch to dark mode`),j(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 Ws=F(`<button type="button"><!> <span class="truncate"> </span></button>`),Gs=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 Ks(e,t){H(t,!0);let n=[{id:`account`,label:`Account`,icon:tr},{id:`usage`,label:`Usage`,icon:Et},{id:`payments`,label:`Payments`,icon:Kt},{id:`archived`,label:`Archived Threads`,icon:_t}];var r=Gs(),c=s(r),l=s(c),u=s(l);yt(s(u),{class:`size-3.5`,"aria-hidden":`true`}),ne(),B(u),Us(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=Ws(),c=s(r);me(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`}`),j(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 qs=[{id:`modelUsage`,label:`Model usage`,noun:`model usage`,description:`More expensive models use up more usage.`}],Js=[`weekly`,`monthly`],Ys=F(`<p class="text-muted-foreground text-sm leading-6">Couldn’t load your usage right now. Try again in a moment.</p>`),Xs=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>`),Zs=F(`<div class="space-y-5"><div class="bg-hover-fill h-3 w-28 rounded"></div> <!></div>`),Qs=F(`<div class="animate-pulse space-y-10" aria-hidden="true"><div class="bg-hover-fill h-4 w-24 rounded"></div> <!></div>`),$s=F(`<p class="text-muted-foreground mt-1 text-[12px]"> </p>`),ec=F(`<p> </p>`),tc=F(`<p class="text-muted-foreground mt-1.5 text-[12px]"> </p>`),nc=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>`),rc=F(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase"> </p> <!> <div class="mt-4 space-y-6"></div></div>`),ic=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),ac=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 oc(t,n){H(n,!0);let r=Fe(),d=Ie(Se.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 _=ac(),b=V(s(_),2),S=s(b),w=s(S),T=e=>{var t=Ys();i(e,t)},E=e=>{var t=Qs(),n=V(s(t),2);v(n,17,()=>qs,e=>e.id,(e,t)=>{var n=Zs(),r=V(s(n),2);v(r,16,()=>Js,e=>e,(e,t)=>{var n=Xs();i(e,n)}),B(n),i(e,n)}),B(t),i(e,t)},D=t=>{var n=ic(),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=rc(),c=s(r),l=s(c,!0);B(c);var u=V(c,2),d=e=>{var t=$s(),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=nc(),_=s(g),v=s(_),b=s(v,!0);B(v);var S=V(v,2),C=e=>{var t=ec(),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);j(E,`aria-valuemin`,0);var D=s(E);B(E);var O=V(E,2),k=e=>{var t=tc(),n=s(t);B(t),x(e=>a(n,`Resets in ${e??``}`),[()=>Wi(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??``}`),j(E,`aria-label`,`${o(n).label} — ${m[o(r).period]}`),j(E,`aria-valuemax`,o(c)?o(r).limit:0),j(E,`aria-valuenow`,i),j(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,na[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 sc(e){if(!(!Xi(e)||!Ji(e.error))&&(e.status===`cancelled`||e.status===`failed`))return{error:e.error,status:e.status}}function cc(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 lc(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&&uc(e.input,t.payload)),a((e,t)=>e.name===t.kind),n}function uc(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)=>uc(e,t[n]));if(!Xi(e)||!Xi(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&uc(e[n],t[n]))}function dc(e){return Ji(e)?e:void 0}function fc(e){return Yi(e)?e:void 0}function pc(e,t){return Xi(e)?dc(e[t]):void 0}function mc(e,t){return e.runId===t}function hc(e){return e.name||e.job?.kind||`tool`}function gc(e){let t=[];for(let n of e){if(n.type===`text`||n.type===`reasoning`){t.push(n);continue}let e=hc(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 _c(e){return e.type===`reasoning`?e.id:e.tools[0]?.callId??e.toolKey}function vc(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:_c(n),blocks:[n]})}return t}function yc(e,t){for(let n of e)if(n.type===`tool-group`)for(let e of n.tools)e.job&&t(e.job)}function bc(e){let t;return yc(e,e=>{let n=e.claimedAt??e.enqueuedAt;t=t===void 0?n:Math.min(t,n)}),t}function xc(e){let t;return yc(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=xc(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=bc(e.blocks),r=t.workSectionIndex===0?t.runStartedAt:n??t.priorWorkCompletedAtMs??t.runStartedAt;return t.inProgress?{startedAtMs:r}:{startedAtMs:r,completedAtMs:xc(e.blocks)??t.runCompletedAt??r}}function wc(e){return e.output===void 0?!e.job||e.job.status===`pending`||e.job.status===`claimed`:!1}function Tc(e,t){return t&&wc(e)}function Ec(e){return pc(e.output,`sessionId`)??pc(e.input,`sessionId`)??pc(e.job?.payload,`sessionId`)}function Dc(e){let t=new Map;for(let n of e){let e=Ec(n);if(!e)continue;let r=pc(n.output,`command`)??(hc(n)===`exec_command`?pc(n.input,`cmd`)??pc(n.job?.payload,`cmd`):void 0);r&&t.set(e,r)}return t}function Oc(e,t){let n=Ec(e);return pc(e.output,`command`)??(n?t.get(n):void 0)}function kc(e,t){if(!t)return new Set;let n=new Map,r=new Set;for(let t of e){let e=Ec(t);if(!e)continue;hc(t)===`exec_command`&&r.add(e);let i=Xi(t.output)?fc(t.output.running):void 0;i!==void 0&&n.set(e,i)}return new Set([...r].filter(e=>n.get(e)===!0))}function Ac(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=hc(r),o=Ec(r),s=o!==void 0&&n.has(o),c=Tc(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 jc(e,t){return!t&&wc(e)?`interrupted`:e.job?.status===`cancelled`||e.job?.status===`failed`?e.job.status:sc(e.output)?.status}function Mc(e,t){if(!t&&wc(e))return`The agent stopped before this tool call finished.`;let n=sc(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 Nc(e,t){let n=new Map(e.filter(e=>e.type===`tool-result`).map(e=>[e.callId,e])),r=lc(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 Pc(e){switch(e){case`apply_patch`:return an;case`ask_question`:return Rt;case`await_question`:return yn;case`check_docs`:return Ct;case`create_artifact`:return nn;case`exec_command`:return $n;case`get_workspace_instructions`:return Ln;case`mandate_charge`:return It;case`mandate_list`:return Cn;case`mandate_report`:return rr;case`mandate_setup`:return Kt;case`mandate_status`:return Cn;case`read_skill`:return Nn;case`scrape_url`:return _n;case`update_artifact`:return sn;case`web_search`:return zn;case`write_stdin`:return qn;default:return ar}}function Fc(e){return Pc(e.job?.kind??e.name)}function Ic(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function Lc(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 Ic(e)}}function Rc(e){if(!Xi(e))return``;let t=[],n=dc(e.workdir);return n&&n.trim().length>0&&n!==`.`&&t.push(`cwd ${n}`),t.length>0?` (${t.join(`, `)})`:``}function zc(e,t){let n=Xi(t)?t:void 0;switch(e){case`apply_patch`:return Kc(t)??`Patch`;case`ask_question`:return dc(n?.question)??`Question`;case`await_question`:return`Waiting for answer`;case`check_docs`:return dc(n?.query)??dc(n?.path)??`Docs`;case`create_artifact`:return dc(n?.title)??`Artifact`;case`exec_command`:{let e=dc(n?.cmd);return e?`${e}${Rc(t)}`:`Command`}case`get_workspace_instructions`:return`Workspace instructions`;case`mandate_charge`:return Hc(n);case`mandate_list`:return`Standing mandates`;case`mandate_report`:return n?.outcome===`approved`?`Charge approved`:`Charge declined`;case`mandate_setup`:return Vc(n);case`mandate_status`:return`Mandate status`;case`read_skill`:{let e=dc(n?.name);return e?`$${e}`:`Skill`}case`scrape_url`:return dc(n?.url)??`Web page`;case`update_artifact`:return`Updated artifact`;case`web_search`:return dc(n?.query)??`Web search`;case`write_stdin`:{let e=dc(n?.sessionId);return e?`Session ${e}`:`Command session`}default:return Ic(e)}}function Bc(e){return(e.job?.kind??e.name)===`apply_patch`?`whitespace-pre-wrap [overflow-wrap:anywhere]`:`truncate`}function Vc(e){let t=dc(e?.merchantName)??`Any merchant`,n=dc(e?.amountCap),r=dc(e?.currency)??``,i=dc(e?.frequency)??``;return`${t}${n?` · ${n} ${r}`.trimEnd():``}${i&&i!==`one_time`?` ${i}`:``}`}function Hc(e){let t=dc(e?.description)??`Charge`,n=dc(e?.amount),r=dc(e?.currency)??``;return n?`${t} · ${n} ${r}`.trimEnd():t}var Uc=[`*** Add File: `,`*** Copy File: `,`*** Delete File: `,`*** Update File: `],Wc=[`*** Copy to: `,`*** Move to: `];function Gc(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 Kc(e){let t=Xi(e)?dc(e.patch):void 0;if(!t)return null;let n=[];for(let e of t.split(`
|
|
8
|
+
`)){if(e.startsWith(`diff --git `)){let t=Gc(e);t!==null&&n.push(t);continue}let t=Uc.find(t=>e.startsWith(t));if(t){n.push(e.slice(t.length).trim());continue}let r=Wc.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 qc(e){if(!Xi(e)||!Array.isArray(e.changes))return null;let t=e.changes.flatMap(e=>{if(!Xi(e))return[];let t=dc(e.path);return t?[t]:[]});return t.length===0?null:[...new Set(t)].join(`
|
|
10
|
+
`)}function Jc(e){return e.job?.kind===`apply_patch`?qc(e.job.result)??Kc(e.job.payload):e.name===`apply_patch`?Kc(e.input):null}function Yc(e){return new Set(e.flatMap(e=>Jc(e)?.split(`
|
|
11
|
+
`)??[])).size}function Xc(e,t){if(e===`web_search`&&Xi(t)&&Array.isArray(t.results)){let e=t.results.length;return` (${e} result${e===1?``:`s`})`}return e===`scrape_url`&&Xi(t)&&t.truncated===!0?` (truncated)`:``}function Zc(e,t){return(e.job?.kind??e.name)===`write_stdin`?Oc(e,t)??zc(`write_stdin`,e.job?.payload??e.input):e.job?Jc(e)||zc(e.job.kind,e.job.payload)+Xc(e.job.kind,e.job.result):zc(e.name,e.input)}function Qc(e,t,n){let r=Zc(e,n);if(Tc(e,t))return`${r} (running)`;let i=Mc(e,t);return i?`${r} (${i})`:r}function $c(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 el(e){if(Array.isArray(e))return e}function tl(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 nl(){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 rl(e,t){return el(e)||tl(e,t)||il(e,t)||nl()}function il(e,t){if(e){if(typeof e==`string`)return $c(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)?$c(e,t):void 0}}var al=Object.entries,ol=Object.setPrototypeOf,sl=Object.isFrozen,cl=Object.getPrototypeOf,ll=Object.getOwnPropertyDescriptor,ul=Object.freeze,dl=Object.seal,fl=Object.create,pl=typeof Reflect<`u`&&Reflect,ml=pl.apply,hl=pl.construct;ul||=function(e){return e},dl||=function(e){return e},ml||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},hl||=function(e){return new e(...[...arguments].slice(1))};var gl=Il(Array.prototype.forEach),_l=Il(Array.prototype.lastIndexOf),vl=Il(Array.prototype.pop),yl=Il(Array.prototype.push),bl=Il(Array.prototype.splice),xl=Array.isArray,Sl=Il(String.prototype.toLowerCase),Cl=Il(String.prototype.toString),wl=Il(String.prototype.match),Tl=Il(String.prototype.replace),El=Il(String.prototype.indexOf),Dl=Il(String.prototype.trim),Ol=Il(Number.prototype.toString),kl=Il(Boolean.prototype.toString),Al=typeof BigInt>`u`?null:Il(BigInt.prototype.toString),jl=typeof Symbol>`u`?null:Il(Symbol.prototype.toString),Ml=Il(Object.prototype.hasOwnProperty),Nl=Il(Object.prototype.toString),Pl=Il(RegExp.prototype.test),Fl=Ll(TypeError);function Il(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return ml(e,t,n)}}function Ll(e){return function(){return hl(e,[...arguments])}}function Rl(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Sl;if(ol&&ol(e,null),!xl(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(sl(t)||(t[r]=e),i=e)}e[i]=!0}return e}function zl(e){for(let t=0;t<e.length;t++)Ml(e,t)||(e[t]=null);return e}function Bl(e){let t=fl(null);for(let r of al(e)){var n=rl(r,2);let i=n[0],a=n[1];Ml(e,i)&&(t[i]=xl(a)?zl(a):a&&typeof a==`object`&&a.constructor===Object?Bl(a):a)}return t}function Vl(e){switch(typeof e){case`string`:return e;case`number`:return Ol(e);case`boolean`:return kl(e);case`bigint`:return Al?Al(e):`0`;case`symbol`:return jl?jl(e):`Symbol()`;case`undefined`:return Nl(e);case`function`:case`object`:{if(e===null)return Nl(e);let t=e,n=Hl(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Nl(e)}return Nl(e)}default:return Nl(e)}}function Hl(e,t){for(;e!==null;){let n=ll(e,t);if(n){if(n.get)return Il(n.get);if(typeof n.value==`function`)return Il(n.value)}e=cl(e)}function n(){return null}return n}function Ul(e){try{return Pl(e,``),!0}catch{return!1}}var Wl=ul(`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(`.`)),Gl=ul(`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(`.`)),Kl=ul([`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`]),ql=ul([`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`]),Jl=ul(`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(`.`)),Yl=ul([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Xl=ul([`#text`]),Zl=ul(`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(`.`)),Ql=ul(`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(`.`)),$l=ul(`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(`.`)),eu=ul([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),tu=dl(/{{[\w\W]*|^[\w\W]*}}/g),nu=dl(/<%[\w\W]*|^[\w\W]*%>/g),ru=dl(/\${[\w\W]*/g),iu=dl(/^data-[\-\w.\u00B7-\uFFFF]+$/),au=dl(/^aria-[\-\w]+$/),ou=dl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),su=dl(/^(?:\w+script|data):/i),cu=dl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),lu=dl(/^html$/i),uu=dl(/^[a-z][.\w]*(-[.\w]+)+$/i),du=dl(/<[/\w!]/g),fu=dl(/<[/\w]/g),pu=dl(/<\/no(script|embed|frames)/i),mu=dl(/\/>/i),hu={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},gu=function(){return typeof window>`u`?null:window},_u=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}},vu=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},yu=function(e,t,n,r){return Ml(e,t)&&xl(e[t])?Rl(r.base?Bl(r.base):{},e[t],r.transform):n};function bu(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gu(),t=e=>bu(e);if(t.version=`3.4.13`,t.removed=[],!e||!e.document||e.document.nodeType!==hu.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=Hl(d,`cloneNode`),p=Hl(d,`remove`),m=Hl(d,`nextSibling`),h=Hl(d,`childNodes`),g=Hl(d,`parentNode`),_=Hl(d,`shadowRoot`),v=Hl(d,`attributes`),y=o&&o.prototype?Hl(o.prototype,`nodeType`):null,b=o&&o.prototype?Hl(o.prototype,`nodeName`):null,x=o&&o.prototype?Hl(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 Fl(`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--}},A=function(){return T||=(w=_u(u,i),!0),w},j=n,ee=j.implementation,te=j.createNodeIterator,ne=j.createDocumentFragment,M=j.getElementsByTagName,N=r.importNode,P=vu();t.isSupported=typeof al==`function`&&typeof g==`function`&&ee&&ee.createHTMLDocument!==void 0;let re=tu,F=nu,ie=ru,I=iu,ae=au,oe=su,se=cu,L=uu,R=ou,z=null,B=Rl({},[...Wl,...Gl,...Kl,...Jl,...Xl]),V=null,ce=Rl({},[...Zl,...Ql,...$l,...eu]),H=Object.seal(fl(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(fl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),fe=!0,pe=!0,me=!1,he=!0,U=!1,ge=!0,_e=!1,ve=!1,ye=null,be=null,xe=!1,Se=!1,Ce=!1,we=!1,Te=!0,Ee=!1,W=`user-content-`,De=!0,Oe=!1,ke={},G=null,Ae=Rl({},`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(`.`)),je=null,Me=Rl({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ne=null,Pe=Rl({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Fe=`http://www.w3.org/1998/Math/MathML`,Ie=`http://www.w3.org/2000/svg`,K=`http://www.w3.org/1999/xhtml`,Le=K,Re=!1,q=null,ze=Rl({},[Fe,Ie,K],Cl),Be=ul([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ve=Rl({},Be),He=ul([`annotation-xml`]),Ue=Rl({},He),We=Rl({},[`title`,`style`,`font`,`a`,`script`]),Ge=null,J=[`application/xhtml+xml`,`text/html`],Ke=null,Y=null,qe=n.createElement(`form`),Je=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Y&&Y===e)return;(!e||typeof e!=`object`)&&(e={}),e=Bl(e),Ge=J.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Ke=Ge===`application/xhtml+xml`?Cl:Sl,z=yu(e,`ALLOWED_TAGS`,B,{transform:Ke}),V=yu(e,`ALLOWED_ATTR`,ce,{transform:Ke}),q=yu(e,`ALLOWED_NAMESPACES`,ze,{transform:Cl}),Ne=yu(e,`ADD_URI_SAFE_ATTR`,Pe,{transform:Ke,base:Pe}),je=yu(e,`ADD_DATA_URI_TAGS`,Me,{transform:Ke,base:Me}),G=yu(e,`FORBID_CONTENTS`,Ae,{transform:Ke}),le=yu(e,`FORBID_TAGS`,Bl({}),{transform:Ke}),ue=yu(e,`FORBID_ATTR`,Bl({}),{transform:Ke}),ke=Ml(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Bl(e.USE_PROFILES):e.USE_PROFILES:!1,fe=e.ALLOW_ARIA_ATTR!==!1,pe=e.ALLOW_DATA_ATTR!==!1,me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,he=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,U=e.SAFE_FOR_TEMPLATES||!1,ge=e.SAFE_FOR_XML!==!1,_e=e.WHOLE_DOCUMENT||!1,Se=e.RETURN_DOM||!1,Ce=e.RETURN_DOM_FRAGMENT||!1,we=e.RETURN_TRUSTED_TYPE||!1,xe=e.FORCE_BODY||!1,Te=e.SANITIZE_DOM!==!1,Ee=e.SANITIZE_NAMED_PROPS||!1,De=e.KEEP_CONTENT!==!1,Oe=e.IN_PLACE||!1,R=Ul(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ou,Le=typeof e.NAMESPACE==`string`?e.NAMESPACE:K,Ve=Ml(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Bl(e.MATHML_TEXT_INTEGRATION_POINTS):Rl({},Be),Ue=Ml(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Bl(e.HTML_INTEGRATION_POINTS):Rl({},He);let t=Ml(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Bl(e.CUSTOM_ELEMENT_HANDLING):fl(null);if(H=fl(null),Ml(t,`tagNameCheck`)&&Je(t.tagNameCheck)&&(H.tagNameCheck=t.tagNameCheck),Ml(t,`attributeNameCheck`)&&Je(t.attributeNameCheck)&&(H.attributeNameCheck=t.attributeNameCheck),Ml(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(H.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),dl(H),U&&(pe=!1),Ce&&(Se=!0),ke&&(z=Rl({},Xl),V=fl(null),ke.html===!0&&(Rl(z,Wl),Rl(V,Zl)),ke.svg===!0&&(Rl(z,Gl),Rl(V,Ql),Rl(V,eu)),ke.svgFilters===!0&&(Rl(z,Kl),Rl(V,Ql),Rl(V,eu)),ke.mathMl===!0&&(Rl(z,Jl),Rl(V,$l),Rl(V,eu))),de.tagCheck=null,de.attributeCheck=null,Ml(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?de.tagCheck=e.ADD_TAGS:xl(e.ADD_TAGS)&&(z===B&&(z=Bl(z)),Rl(z,e.ADD_TAGS,Ke))),Ml(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?de.attributeCheck=e.ADD_ATTR:xl(e.ADD_ATTR)&&(V===ce&&(V=Bl(V)),Rl(V,e.ADD_ATTR,Ke))),Ml(e,`ADD_URI_SAFE_ATTR`)&&xl(e.ADD_URI_SAFE_ATTR)&&Rl(Ne,e.ADD_URI_SAFE_ATTR,Ke),Ml(e,`FORBID_CONTENTS`)&&xl(e.FORBID_CONTENTS)&&(G===Ae&&(G=Bl(G)),Rl(G,e.FORBID_CONTENTS,Ke)),Ml(e,`ADD_FORBID_CONTENTS`)&&xl(e.ADD_FORBID_CONTENTS)&&(G===Ae&&(G=Bl(G)),Rl(G,e.ADD_FORBID_CONTENTS,Ke)),De&&(z[`#text`]=!0),_e&&Rl(z,[`html`,`head`,`body`]),z.table&&(Rl(z,[`tbody`]),delete le.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Fl(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Fl(`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=A()),S&&typeof C==`string`&&(C=O(``)));ul&&ul(e),Y=e},Xe=Rl({},[...Gl,...Kl,...ql]),Ze=Rl({},[...Jl,...Yl]),Qe=function(e,t,n){return t.namespaceURI===K?e===`svg`:t.namespaceURI===Fe?e===`svg`&&(n===`annotation-xml`||Ve[n]):!!Xe[e]},$e=function(e,t,n){return t.namespaceURI===K?e===`math`:t.namespaceURI===Ie?e===`math`&&Ue[n]:!!Ze[e]},et=function(e,t,n){return t.namespaceURI===Ie&&!Ue[n]||t.namespaceURI===Fe&&!Ve[n]?!1:!Ze[e]&&(We[e]||!Xe[e])},tt=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Le,tagName:`template`});let n=Sl(e.tagName),r=Sl(t.tagName);return q[e.namespaceURI]?e.namespaceURI===Ie?Qe(n,t,r):e.namespaceURI===Fe?$e(n,t,r):e.namespaceURI===K?et(n,t,r):!!(Ge===`application/xhtml+xml`&&q[e.namespaceURI]):!1},nt=function(e){yl(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Fl(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},rt=function(e){ot(e);let t=h(e);if(t){let e=[];gl(t,t=>{yl(e,t)}),gl(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{}}},it=function(e,n){try{yl(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{yl(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`){if(Se||Ce)try{nt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},at=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[Ke(i)]))try{e.removeAttribute(i)}catch{}}},ot=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===hu.element&&at(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},st=function(e){if(!ge)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===hu.processingInstruction||n===hu.comment&&Pl(fu,e.data)){try{p(e)}catch{}continue}if(n===hu.element){let t=e,n=Ke(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])}},ct=function(e){let t=null,r=null;if(xe)e=`<remove></remove>`+e;else{let t=wl(e,/^[\r\n\t ]+/);r=t&&t[0]}Ge===`application/xhtml+xml`&&Le===K&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=S?O(e):e;if(Le===K)try{t=new l().parseFromString(i,Ge)}catch{}if(!t||!t.documentElement){t=ee.createDocument(Le,`template`,null);try{t.documentElement.innerHTML=Re?C:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Le===K?M.call(t,_e?`html`:`body`)[0]:_e?t.documentElement:a},lt=function(e){let t=x?x(e):e.ownerDocument;return te.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},X=function(e){return e=Tl(e,re,` `),e=Tl(e,F,` `),e=Tl(e,ie,` `),e},ut=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=te.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=X(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&gl(i,e=>{ft(e.content)&&ut(e.content)})},dt=function(e){let t=b?b(e):null;return typeof t!=`string`||Ke(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)},ft=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===hu.documentFragment}catch{return!1}},pt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function mt(e,n,r){e.length!==0&&gl(e,e=>{e.call(t,n,r,Y)})}let ht=function(e,t){return!!(ge&&e.hasChildNodes()&&!pt(e.firstElementChild)&&Pl(du,e.textContent)&&Pl(du,e.innerHTML)||ge&&e.namespaceURI===K&&t===`style`&&pt(e.firstElementChild)||e.nodeType===hu.processingInstruction||ge&&e.nodeType===hu.comment&&Pl(fu,e.data))},Z=function(e,t,n){if(!le[t]&&bt(t)&&(H.tagNameCheck instanceof RegExp&&Pl(H.tagNameCheck,t)||H.tagNameCheck instanceof Function&&H.tagNameCheck(t)))return!1;if(De&&!G[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 nt(e),!0},gt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Bl(t):t},_t=function(e,n){if(mt(P.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return Oe&&ot(e),!0;if(dt(e))return nt(e),!0;let r=Ke(b?b(e):e.nodeName);if(z=gt(P.uponSanitizeElement,z,B,ye),mt(P.uponSanitizeElement,e,{tagName:r,allowedTags:z}),e!==n&&g(e)===null)return Oe&&ot(e),!0;if(ht(e,r))return nt(e),!0;if(le[r]||!(de.tagCheck instanceof Function&&de.tagCheck(r))&&!z[r]){let t=Z(e,r,n);return t===!1&&mt(P.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===hu.element&&!tt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Pl(pu,e.innerHTML))return nt(e),!0;if(U&&e.nodeType===hu.text){let n=X(e.textContent);e.textContent!==n&&(yl(t.removed,{element:e.cloneNode()}),e.textContent=n)}return mt(P.afterSanitizeElements,e,null),!1},vt=function(e,t,r){if(ue[t]||ge&&t===`patchsrc`||ge&&t===`for`&&e!==`label`&&e!==`output`||Te&&(t===`id`||t===`name`)&&(r in n||r in qe))return!1;let i=V[t]||de.attributeCheck instanceof Function&&de.attributeCheck(t,e);if(!(pe&&Pl(I,t))&&!(fe&&Pl(ae,t))){if(!i){if(!(bt(e)&&(H.tagNameCheck instanceof RegExp&&Pl(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&Pl(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t,e))||t===`is`&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&Pl(H.tagNameCheck,r)||H.tagNameCheck instanceof Function&&H.tagNameCheck(r))))return!1}else if(!Ne[t]&&!Pl(R,Tl(r,se,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&El(r,`data:`)===0&&je[e])&&!(me&&!Pl(oe,Tl(r,se,``)))&&r)return!1}return!0},yt=Rl({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),bt=function(e){return!yt[Sl(e)]&&Pl(L,e)},xt=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},St=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),dt(e)?nt(e):vl(t.removed)}catch{it(n,e)}},Ct=function(e){mt(P.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||dt(e))return;V=gt(P.uponSanitizeAttribute,V,ce,be);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0},r=t.length,i=Ke(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Ke(o),u=c,d=o===`value`?u:Dl(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,mt(P.uponSanitizeAttribute,e,n),d=n.attrValue,Ee&&(l===`id`||l===`name`)&&El(d,W)!==0&&(it(o,e),d=W+d),ge&&Pl(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){it(o,e);continue}if(l===`attributename`&&wl(d,`href`)){it(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){it(o,e);continue}if(!he&&Pl(mu,d)){it(o,e);continue}if(U&&(d=X(d)),!vt(i,l,d)){it(o,e);continue}d=xt(i,l,s,d),d!==u&&St(e,o,s,d)}}mt(P.afterSanitizeAttributes,e,null)},Q=function(e){let t=null,n=lt(e);for(mt(P.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(mt(P.uponSanitizeShadowNode,t,null),_t(t,e),Ct(t),ft(t.content)&&Q(t.content),(y?y(t):t.nodeType)===hu.element){let e=_(t);ft(e)&&(wt(e),Q(e))}mt(P.afterSanitizeShadowDOM,e,null)},wt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Q(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===hu.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`&&Ke(e)===`template`){let e=n.content;ft(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);ft(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(Re=!e,Re&&(e=`<!-->`),typeof e!=`string`&&!pt(e)&&(e=Vl(e),typeof e!=`string`))throw Fl(`dirty is not a string, aborting`);if(!t.isSupported)return e;ve?(z=ye,V=be):Ye(n),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(z=Bl(z)),P.uponSanitizeAttribute.length>0&&(V=Bl(V)),t.removed=[];let c=Oe&&typeof e!=`string`&&pt(e);if(c){st(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=Ke(t);if(!z[n]||le[n])throw rt(e),Fl(`root node is forbidden and cannot be sanitized in-place`)}if(dt(e))throw rt(e),Fl(`root node is clobbered and cannot be sanitized in-place`);try{wt(e)}catch(t){throw rt(e),t}}else if(pt(e))i=ct(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===hu.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),wt(a);else{if(!Se&&!U&&!_e&&e.indexOf(`<`)===-1)return S&&we?O(e):e;if(i=ct(e),!i)return Se?null:we?C:``}i&&xe&&nt(i.firstChild);let l=c?e:i;try{let e=lt(l);for(;o=e.nextNode();)_t(o,l),Ct(o),ft(o.content)&&Q(o.content)}catch(n){throw c&&(rt(e),gl(t.removed,e=>{e.element&&ot(e.element)})),n}if(c)return gl(t.removed,e=>{e.element&&ot(e.element)}),U&&ut(e),e;if(Se){if(U&&ut(i),Ce)for(s=ne.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=_e?i.outerHTML:i.innerHTML;return _e&&z[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Pl(lu,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
13
|
+
`+u),U&&(u=X(u)),S&&we?O(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(e),ve=!0,ye=z,be=V},t.clearConfig=function(){Y=null,ve=!1,ye=null,be=null,S=w,C=``},t.isValidAttribute=function(e,t,n){Y||Ye({});let r=Ke(e),i=Ke(t);return vt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Ml(P,e)&&yl(P[e],t)},t.removeHook=function(e,t){if(Ml(P,e)){if(t!==void 0){let n=_l(P[e],t);return n===-1?void 0:bl(P[e],n,1)[0]}return vl(P[e])}},t.removeHooks=function(e){Ml(P,e)&&(P[e]=[])},t.removeAllHooks=function(){P=vu()},t}var xu=bu(),Su=xu;xu.sanitize.bind(xu),xu.isSupported,xu.addHook.bind(xu),xu.removeHook.bind(xu),xu.removeHooks.bind(xu),xu.removeAllHooks.bind(xu),xu.setConfig.bind(xu),xu.clearConfig.bind(xu),xu.isValidAttribute.bind(xu),xu.version,xu.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 wu=Cu();function Tu(e){wu=e}var Eu={exec:()=>null};function Du(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(ku.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ou=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),ku={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:Du(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Du(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Du(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Du(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Du(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Du(e=>RegExp(`^ {0,${e}}>`))},Au=/^(?:[ \t]*(?:\n|$))+/,ju=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Mu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Nu=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Pu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Iu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Lu=$(Iu).replace(/bull/g,Fu).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(),Ru=$(Iu).replace(/bull/g,Fu).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(),zu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Bu=/^[^\n]+/,Vu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Hu=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Vu).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Uu=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Fu).getRegex(),Wu=`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`,Gu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ku=$(`^ {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`,Gu).replace(`tag`,Wu).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),qu=e=>$(zu).replace(`hr`,Nu).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`,Wu).getRegex(),Ju=qu(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Yu=qu(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Xu={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Yu).getRegex(),code:ju,def:Hu,fences:Mu,heading:Pu,hr:Nu,html:Ku,lheading:Lu,list:Uu,newline:Au,paragraph:Ju,table:Eu,text:Bu},Zu=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Nu).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`,Wu).getRegex(),Qu={...Xu,lheading:Ru,table:Zu,paragraph:$(zu).replace(`hr`,Nu).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Zu).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`,Wu).getRegex()},$u={...Xu,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Gu).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:Eu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(zu).replace(`hr`,Nu).replace(`heading`,` *#{1,6} *[^
|
|
14
|
+
]`).replace(`lheading`,Lu).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ed=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,td=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,nd=/^( {2,}|\\)\n(?!\s*$)/,rd=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,id=/[\p{P}\p{S}]/u,ad=/[\s\p{P}\p{S}]/u,od=/[^\s\p{P}\p{S}]/u,sd=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ad).getRegex(),cd=/[\p{Pi}\p{Ps}"']/u,ld=/(?!~)[\p{P}\p{S}]/u,ud=/(?!~)[\s\p{P}\p{S}]/u,dd=/(?:[^\s\p{P}\p{S}]|~)/u,fd=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Ou?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),pd=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,md=$(pd,`u`).replace(/punct/g,id).getRegex(),hd=$(pd,`u`).replace(/punct/g,ld).getRegex(),gd=$(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,cd).replace(/punct/g,id).getRegex(),_d=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,vd=$(_d,`gu`).replace(/notPunctSpace/g,od).replace(/punctSpace/g,ad).replace(/punct/g,id).getRegex(),yd=$(_d,`gu`).replace(/notPunctSpace/g,dd).replace(/punctSpace/g,ud).replace(/punct/g,ld).getRegex(),bd=$(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,od).replace(/punctSpace/g,ad).replace(/punct/g,id).getRegex(),xd=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,od).replace(/punctSpace/g,ad).replace(/punct/g,id).getRegex(),Sd=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,od).replace(/punctSpace/g,ad).replace(/punct/g,id).getRegex(),Cd=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,id).getRegex(),wd=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,od).replace(/punctSpace/g,ad).replace(/punct/g,id).getRegex(),Td=$(/\\(punct)/,`gu`).replace(/punct/g,id).getRegex(),Ed=$(/^<(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(),Dd=$(Gu).replace(`(?:-->|$)`,`-->`).getRegex(),Od=$(`^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`,Dd).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),kd=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ad=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,kd).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),jd=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,kd).replace(`ref`,Vu).getRegex(),Md=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Vu).getRegex(),Nd=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,jd).replace(`nolink`,Md).getRegex(),Pd=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Fd={_backpedal:Eu,anyPunctuation:Td,autolink:Ed,blockSkip:fd,br:nd,code:td,del:Eu,delLDelim:Eu,delRDelim:Eu,emStrongLDelim:md,emStrongRDelimAst:vd,emStrongRDelimUnd:xd,escape:ed,link:Ad,nolink:Md,punctuation:sd,reflink:jd,reflinkSearch:Nd,tag:Od,text:rd,url:Eu},Id={...Fd,emStrongLDelim:gd,emStrongRDelimAst:bd,emStrongRDelimUnd:Sd,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,kd).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,kd).getRegex()},Ld={...Fd,emStrongRDelimAst:yd,emStrongLDelim:hd,delLDelim:Cd,delRDelim:wd,url:$(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Pd).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`,Pd).getRegex()},Rd={...Ld,br:$(nd).replace(`{2,}`,`*`).getRegex(),text:$(Ld.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},zd={normal:Xu,gfm:Qu,pedantic:$u},Bd={normal:Fd,gfm:Ld,breaks:Rd,pedantic:Id},Vd={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Hd=e=>Vd[e];function Ud(e,t){if(t){if(ku.escapeTest.test(e))return e.replace(ku.escapeReplace,Hd)}else if(ku.escapeTestNoEncode.test(e))return e.replace(ku.escapeReplaceNoEncode,Hd);return e}function Wd(e){try{e=encodeURI(e).replace(ku.percentDecode,`%`)}catch{return null}return e}function Gd(e,t){let n=e.replace(ku.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(ku.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(ku.slashPipe,`|`);return n}function Kd(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 qd(e){let t=e.split(`
|
|
15
|
+
`),n=t.length-1;for(;n>=0&&ku.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
16
|
+
`)}function Jd(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 Yd(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 Xd(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 Zd(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 Qd=class{options;rules;lexer;constructor(e){this.options=e||wu}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]:qd(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=Zd(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=Kd(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Kd(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:Kd(t[0],`
|
|
20
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Kd(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=Yd(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=qd(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:Kd(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=Gd(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:Kd(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(Gd(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:Kd(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=Kd(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Jd(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)),Xd(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 Xd(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}}}},$d=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||wu,this.options.tokenizer=this.options.tokenizer||new Qd,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:ku,block:zd.normal,inline:Bd.normal};this.options.pedantic?(t.block=zd.pedantic,t.inline=Bd.pedantic):this.options.gfm&&(t.block=zd.gfm,t.inline=this.options.breaks?Bd.breaks:Bd.gfm),this.tokenizer.rules=t}static get rules(){return{block:zd,inline:Bd}}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(ku.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(ku.tabCharGlobal,` `).replace(ku.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)}},ef=class{options;parser;constructor(e){this.options=e||wu}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(ku.notSpaceStart)?.[0],i=e.replace(ku.endingNewline,``)+`
|
|
59
|
+
`;return r?`<pre><code class="language-`+Ud(r)+`">`+(n?i:Ud(i,!0))+`</code></pre>
|
|
60
|
+
`:`<pre><code>`+(n?i:Ud(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>${Ud(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=Wd(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Ud(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=Wd(e);if(i===null)return Ud(n);e=i;let a=`<img src="${e}" alt="${Ud(n)}"`;return t&&(a+=` title="${Ud(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Ud(e.text)}},tf=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}},nf=class e{options;renderer;textRenderer;constructor(e){this.options=e||wu,this.options.renderer=this.options.renderer||new ef,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new tf}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}},rf=class{options;block;constructor(e){this.options=e||wu}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?$d.lex:$d.lexInline}provideParser(e=this.block){return e?nf.parse:nf.parseInline}},af=new class{defaults=Cu();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=nf;Renderer=ef;TextRenderer=tf;Lexer=$d;Tokenizer=Qd;Hooks=rf;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 ef(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 Qd(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 rf;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]=rf.passThroughHooks.has(n)?e=>{if(this.defaults.async&&rf.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 $d.lex(e,t??this.defaults)}parser(e,t){return nf.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?$d.lex:$d.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?nf.parse:nf.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?$d.lex:$d.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?nf.parse:nf.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>`+Ud(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function of(e,t){return af.parse(e,t)}of.options=of.setOptions=function(e){return af.setOptions(e),of.defaults=af.defaults,Tu(of.defaults),of},of.getDefaults=Cu,of.defaults=wu;function sf(...e){return af.use(...e),of.defaults=af.defaults,Tu(of.defaults),of}of.use=sf,of.walkTokens=function(e,t){return af.walkTokens(e,t)},of.parseInline=af.parseInline,of.Parser=nf,of.parser=nf.parse,of.Renderer=ef,of.TextRenderer=tf,of.Lexer=$d,of.lexer=$d.lex,of.Tokenizer=Qd,of.Hooks=rf,of.parse=of,of.options,of.setOptions,of.walkTokens,of.parseInline,nf.parse,$d.lex,of.setOptions({gfm:!0,breaks:!0});function cf(e){let t=of.parse(e,{async:!1});return Su.sanitize(t,{ADD_ATTR:[`target`,`rel`]})}var lf=F(`<div></div>`);function uf(t,n){H(n,!0);let r=P(n,`className`,3,``),a=e(()=>cf(n.content));var s=lf();pe(s,()=>o(a),!0),B(s),x(e=>I(s,1,e),[()=>M(q(`chat-markdown`,r()))]),i(t,s),R()}var df=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>`),ff=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 pf(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 A=`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 ee=m(),te=u(ee),ne=t=>{let c=e(()=>n.image);var u=ff(),d=s(u),m=s(d),g=V(m,2),b=s(g);I(b,1,M(A));var S=s(b),w=e=>{Tn(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},T=e=>{Ot(e,{class:`size-4`,"aria-hidden":`true`})},E=e=>{Ht(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(A));var ee=s(D),te=e=>{Tn(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},ne=e=>{Jt(e,{class:`size-4`,"aria-hidden":`true`})};y(ee,e=>{o(h)?e(te):e(ne,-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=df(),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(()=>{j(d,`aria-label`,`Image preview: ${o(c).name??``}`),j(m,`src`,o(c).url),j(m,`alt`,o(c).name),j(b,`aria-disabled`,o(f)),j(b,`aria-label`,o(f)?`Copying image`:o(l)?`Image copied`:`Copy image`),j(b,`title`,o(f)?`Copying image`:o(l)?`Image copied`:`Copy image`),j(D,`aria-disabled`,o(h)),j(D,`aria-label`,o(h)?`Downloading image`:`Download image`),j(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(te,e=>{n.image&&e(ne)}),i(t,ee),R()}f([`click`]);var mf=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>`),hf=F(`<span class="border-hairline bg-hover-fill inline-flex size-14 animate-pulse rounded-xl border"></span>`),gf=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 _f(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=mf(),r=s(t);B(t),x(()=>{j(t,`aria-label`,`View ${n.attachment.name??``}`),j(t,`title`,n.attachment.name),j(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=hf();x(()=>j(t,`aria-label`,`Loading ${n.attachment.name??``}`)),i(e,t)},b=e=>{var t=gf(),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 vf(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 yf=F(`<div class="text-muted-foreground mt-1.5 text-[13px] leading-6 whitespace-pre-wrap"> </div>`),bf=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 xf(t,n){H(n,!0);let r=vf(()=>n.inProgress),c=e(()=>n.inProgress?`Reasoning`:`Reasoned`);var l=bf(),u=s(l),d=s(u);wt(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`:``}`);Mt(h,{get class(){return o(t)},"aria-hidden":`true`})}B(u);var g=V(u,2),_=e=>{var t=yf(),r=s(t,!0);B(t),x(()=>a(r,n.text)),i(e,t)};y(g,e=>{r.expanded&&e(_)}),B(l),x(()=>{j(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 wf(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??``}`);me(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`:``}`);Mt(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(()=>{j(f,`aria-expanded`,o(c)),a(b,n.label)}),p(`click`,f,l),i(t,d),R()}f([`click`]);var Tf=F(`<div class="mt-1.5 space-y-2"><!></div>`),Ef=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 Df(t,n){H(n,!0);let r=g(0),l=vf(()=>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 ${Ui(o(r))}`:`Worked for ${Ui(o(r))}`);var d=Ef(),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`:``}`);Mt(_,{get class(){return o(t)},"aria-hidden":`true`})}B(f);var v=V(f,2),b=e=>{var t=Tf(),r=s(t);k(r,()=>n.children),B(t),i(e,t)};y(v,e=>{l.expanded&&e(b)}),B(d),x(()=>{j(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 Of(e){if((e.job?.kind??e.name)!==`mandate_setup`)return;let t=e.output;if(!Xi(t))return;let n=dc(t.mandateId),r=dc(t.approvalUrl);if(!(!n||!r))return{mandateId:n,approvalUrl:r}}function kf(e){let t=e.job?.payload??e.input;if(!Xi(t))return;let n=dc(t.description)?.trim();if(n)return n;let r=dc(t.merchantName)?.trim();if(r)return r}function Af(e){return e.flatMap(e=>{let t=Of(e);return t?[{...t,label:kf(e)}]:[]})}var jf=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>`),Mf=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>`),Nf=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>`),Pf=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>`),Ff=F(`<div class="text-muted-foreground mb-4 text-center text-xs">Loading earlier messages…</div>`),If=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>`),Lf=F(`<li><!></li>`),Rf=F(`<ul class="flex max-w-132 flex-wrap justify-end gap-2" aria-label="Attached images"></ul>`),zf=F(`<div><!></div>`),Bf=F(`<button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex size-6 items-center justify-center rounded-md transition"><!></button>`),Vf=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>`),Hf=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>`),Uf=F(`<div class="flex flex-col items-end gap-1.5"><!> <!> <!> <!></div>`),Wf=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>`),Gf=F(`<p> </p>`),Kf=F(`<p class="flex min-w-0 items-start gap-1.5"><!> <span> </span></p>`),qf=F(`<!> <!> <!>`,1),Jf=F(`<p class="text-muted-foreground text-sm"> </p>`),Yf=F(`<div class="w-full min-w-0" aria-atomic="false" aria-relevant="additions text"><div class="space-y-3"><!> <!> <!></div></div>`),Xf=F(`<div class="space-y-8 pb-14"></div>`),Zf=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 Qf(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 A(){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 ee(e){return e.type===`tool-group`&&(e.toolKey===`create_artifact`||e.toolKey===`update_artifact`)}function te(e){return!ee(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=Zf(),L=u(se),z=s(L),le=s(z),ue=s(le),de=e=>{var t=jf(),r=s(t,!0);B(t),x(()=>a(r,n.currentError)),i(e,t)};y(ue,e=>{n.currentError&&e(de)});var fe=V(ue,2),pe=e=>{var t=Mf(),r=s(t,!0);B(t),x(()=>a(r,n.runError)),i(e,t)};y(fe,e=>{n.runError&&e(pe)});var he=V(fe,2),U=e=>{var t=Nf();i(e,t)};y(he,e=>{f()&&e(U)});var ge=V(he,2),_e=e=>{var t=Pf(),n=V(s(t),2),r=s(n,!0);B(n),B(t),x(()=>a(r,b())),i(e,t)};y(ge,e=>{b()&&e(_e)});var ve=V(ge,2),ye=e=>{var t=Ff();i(e,t)};y(ve,e=>{S()&&e(ye)});var be=V(ve,2),xe=e=>{var t=If(),n=s(t),r=s(n),o=s(r,!0);B(r),B(n),B(t),x(()=>a(o,l())),i(e,t)},Se=t=>{var c=Xf();v(c,21,()=>n.messages,e=>e._id,(t,c)=>{var l=m(),d=u(l),f=t=>{var l=Uf(),u=s(l),d=e=>{var t=Rf();v(t,21,()=>o(c).attachments,e=>e.imageUploadId,(e,t)=>{var r=Lf();_f(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=zf();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||` `);uf(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=Bf(),n=s(t),r=e=>{Ot(e,{class:`size-3.5`,"aria-hidden":`true`})},a=e=>{Ht(e,{class:`size-3.5`,"aria-hidden":`true`})};y(n,e=>{o(re)===o(c)._id?e(r):e(a,-1)}),B(t),x(()=>j(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=Hf(),o=s(t),c=s(o),l=s(c,!0);B(c);var u=V(c,2),d=e=>{var t=Vf();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(()=>Nc(o(c).parts,o(r))),d=e(()=>o(l).filter(e=>e.type===`tool`)),f=e(()=>Dc(o(d))),p=e(()=>gc(o(l))),h=e(()=>vc(o(p))),g=e(()=>{let{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}=Sc(o(h));return{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}}),_=e(()=>mc(o(c),n.activeRunId)),b=e(()=>kc(o(d),o(_))),S=e(()=>o(l).some(e=>e.type===`text`||e.type===`reasoning`));var C=Yf(),w=s(C),T=s(w),E=t=>{{let n=e(()=>o(c).text||`...`);uf(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||` `);uf(t,{get content(){return o(r)},className:`text-foreground`})}},S=t=>{let l=e(()=>{let{settledBlocks:e,runningTools:t}=Ac(o(n).blocks,o(_),o(b));return{settledBlocks:e,runningTools:t}}),d=e(()=>o(l).settledBlocks.filter(te)),p=e(()=>o(d).flatMap(e=>e.type===`tool-group`?Af(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=qf(),E=u(T),D=t=>{Df(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);xf(t,{get text(){return o(n).text},get inProgress(){return o(i)}})},g=t=>{{let r=(t,n=ae)=>{let r=e(()=>Mc(n(),o(_))),c=e(()=>jc(n(),o(_))),l=e(()=>Zc(n(),o(f)));var d=m(),p=u(d),h=e=>{var t=Wf(),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)=>{j(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))},[()=>Qc(n(),o(_),o(f)),()=>M(Bc(n()))]),i(e,t)},g=e=>{var t=Gf(),r=s(t,!0);B(t),x((e,n)=>{I(t,1,e),j(t,`title`,n),a(r,o(l))},[()=>`min-w-0 ${Bc(n())}`,()=>Qc(n(),o(_),o(f))]),i(e,t)};y(p,e=>{o(r)&&o(c)?e(h):e(g,-1)}),i(t,d)},c=e(()=>Lc(o(n).toolKey)),l=e(()=>Pc(o(n).toolKey)),d=e(()=>o(n).toolKey===`apply_patch`?Yc(o(n).tools)<=2:void 0);wf(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)=>{Ts(e,{get approval(){return o(t)}})});var k=V(O,2),A=t=>{wf(t,{label:`Running`,get icon(){return Tn},iconClass:`animate-spin`,get tools(){return o(l).runningTools},defaultExpanded:!0,toolRow:(t,n=ae)=>{let r=e(()=>Fc(n())),c=e(()=>Zc(n(),o(f)));var l=Kf(),u=s(l);me(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=>{j(l,`title`,`${o(c)} (running)`),I(d,1,e),a(p,o(c))},[()=>M(Bc(n()))]),i(t,l)},$$slots:{toolRow:!0}})};y(k,e=>{o(l).runningTools.length>0&&e(A)}),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=Jf(),n=s(t);B(t),x(e=>a(n,`Worked for ${e??``}`),[()=>Ui(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(()=>{j(C,`role`,o(_)?`log`:void 0),j(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(be,e=>{n.messages.length===0?e(xe):e(Se,-1)}),B(le),B(z),ce(z,e=>C(E,e),()=>o(E)),ne(2),B(L),pf(V(L,2),{get image(){return o(N)},onClose:()=>{C(N,null)}}),h(`scroll`,z,A),i(t,se),R()}f([`click`]),Me([`markdown`,`html`,`react`]);function $f(e){return e.replace(/<\/(script)/gi,`<\\/$1`).replace(/<!--/g,`<\\!--`)}function ep(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 tp(e){return ep(`<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
|
+
${$f(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 np(e){let t=e.trim();return/^<!DOCTYPE html>/i.test(t)||/^<html[\s>]/i.test(t)?t:ep(``,t)}function rp(e,t){return e===`react`?tp(t):e===`html`?np(t):null}var ip=F(`<iframe sandbox="allow-scripts"></iframe>`),ap=F(`<pre class="h-full overflow-auto p-3 pr-10 text-[13px] leading-6"><code> </code></pre>`),op=F(`<div class="h-full overflow-auto p-3 pr-10"><!></div>`),sp=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>`),cp=F(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Back to artifacts"><!></button>`),lp=F(`<!> Preview`,1),up=F(`<!> Source`,1),dp=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>`),fp=F(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Open fullscreen" title="Open fullscreen"><!></button>`),pp=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 mp(t,n){H(n,!0);let r=P(n,`variant`,3,`card`),l=e(()=>rp(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 _=pp();{let e=(e,t=ae)=>{var r=sp(),c=s(r),u=e=>{var r=ip();x(()=>{j(r,`title`,`${n.title} preview`),j(r,`srcdoc`,o(l)),I(r,1,`block w-full bg-white ${t()}`)}),i(e,r)},m=e=>{var t=ap(),r=s(t),o=s(r,!0);B(r),B(t),x(()=>a(o,n.content)),i(e,t)},g=e=>{var t=op();uf(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=>{Ot(e,{class:`size-3.5`,"aria-hidden":`true`})},S=e=>{Ht(e,{class:`size-3.5`,"aria-hidden":`true`})};y(v,e=>{o(f)?e(b):e(S,-1)}),B(_),B(r),x(()=>j(_,`aria-label`,o(f)?`Copied`:`Copy`)),p(`click`,_,h),i(e,r)};var v=s(_),b=s(v),S=e=>{var t=cp();yt(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),A=e=>{var t=dp(),n=s(t),r=e=>{var t=lp();en(u(t),{class:`size-3.5`,"aria-hidden":`true`}),ne(),i(e,t)},a=e=>{var t=up();Bt(u(t),{class:`size-3.5`,"aria-hidden":`true`}),ne(),i(e,t)};y(n,e=>{o(d)?e(r):e(a,-1)}),B(t),x(()=>j(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(A)});var ee=V(k,2),te=e=>{var t=fp();hn(s(t),{class:`size-4`,"aria-hidden":`true`}),B(t),p(`click`,t,function(...e){n.onOpenFullscreen?.apply(this,e)}),i(e,t)};y(ee,e=>{n.onOpenFullscreen&&e(te)}),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 hp=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),gp=F(`<span class="bg-muted-foreground/40 relative inline-flex size-2 rounded-full"></span>`),_p=F(`<iframe title="Agent browser live view" class="min-h-0 w-full flex-1 border-0" allow="clipboard-read; clipboard-write"></iframe>`),vp=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),yp=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>`),bp=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>`),xp=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=vp(),r=u(n),o=s(r),c=s(o),l=e=>{var t=hp();ne(2),i(e,t)},d=e=>{var t=gp();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);Qt(s(m),{class:`size-3.5`,"aria-hidden":`true`}),B(m),B(r);var h=V(r,2);fe(h,()=>t.liveView.url,e=>{var n=_p();x(()=>j(n,`src`,t.liveView.url)),i(e,n)}),x(()=>{a(p,t.active?`Live — the agent is browsing`:`Browser session`),j(m,`href`,t.liveView.url)}),i(e,n)},c=e=>{var t=yp();Tn(s(t),{class:`text-muted-foreground size-5 animate-spin`,"aria-hidden":`true`}),ne(4),B(t),i(e,t)},l=e=>{var t=bp();_n(s(t),{class:`text-muted-foreground size-5`,"aria-hidden":`true`}),ne(2),B(t),i(e,t)},d=e=>{var t=xp();Tn(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 wp=F(`<span class="size-1.5 animate-pulse rounded-full bg-emerald-500" aria-hidden="true"></span>`),Tp=F(`<button type="button" role="tab" aria-controls="side-panel-tabpanel"><span class="inline-flex items-center gap-1.5"><!> </span></button>`),Ep=F(`<div class="flex min-h-0 flex-1 flex-col p-3"><!></div>`),Dp=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>`),Op=F(`<p class="text-muted-foreground p-3 text-sm">No artifacts yet.</p>`),kp=F(`<div class="min-h-0 flex-1 space-y-0.5 overflow-y-auto p-2"></div>`),Ap=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 jp(t,n){H(n,!0);let r=e(()=>n.artifacts.find(e=>e.key===n.selectedKey)??null),l={markdown:sn,html:_n,react:nn},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=Ap(),h=s(m),g=s(h);v(g,21,()=>u,e=>e.id,(e,t)=>{var r=Tp(),c=s(r),l=s(c),u=e=>{var t=wp();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(()=>{j(r,`id`,`side-panel-tab-${o(t).id??``}`),j(r,`aria-selected`,n.tab===o(t).id),j(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=>{Un(e,{class:`size-4`,"aria-hidden":`true`})},C=e=>{Xt(e,{class:`size-4`,"aria-hidden":`true`})};y(b,e=>{n.expanded?e(S):e(C,-1)}),B(_);var w=V(_,2);sr(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=Ep();mp(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=kp();v(r,21,()=>n.artifacts,e=>e.key,(t,r)=>{let c=e(()=>l[o(r).artifactType]);var u=Dp(),d=s(u),f=s(d);me(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);hn(s(g),{class:`size-3.5`,"aria-hidden":`true`}),B(g),B(u),x(()=>{a(h,o(r).title),j(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=Op();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`}`),j(_,`aria-label`,n.expanded?`Exit full workspace`:`Expand to full workspace`),j(_,`title`,n.expanded?`Exit full workspace`:`Expand to full workspace`),j(_,`aria-pressed`,n.expanded),j(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 Mp=F(`<iframe sandbox="allow-scripts" class="block h-full w-full flex-1 bg-white"></iframe>`),Np=F(`<div class="min-h-0 flex-1 overflow-auto p-6"><!></div>`),Pp=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>`),Fp=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 Ip(t,n){H(n,!0);let r=e(()=>rp(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=Fp(),u=s(l),f=e=>{var t=Mp();x(()=>{j(t,`title`,`${n.artifact.title} preview`),j(t,`srcdoc`,o(r))}),i(e,t)},m=e=>{var t=Np();uf(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=Pp();sr(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(()=>j(l,`aria-label`,`${n.artifact.title} fullscreen. Press Escape to exit.`)),i(t,l),R()}f([`click`]);function Lp(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 Rp={open:!1,expanded:!1,tab:`artifacts`,selectedKey:null};function zp(e){return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`.\\`)||e.startsWith(`..\\`)||e.startsWith(`/`)||e.startsWith(`\\`)||e.startsWith(`~/`)||e===`~`||/^[a-zA-Z]:([\\/]|$)/.test(e)}function Bp(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 Vp(e){let t=Bp(e);return e.slice(t.length)}function Hp(e){return!e||Gp(e)?e:`${e}${Wp(e)}`}function Up(e){let t=e.trim();return t===`/`||t===`\\`||/^[a-zA-Z]:?$/.test(t)||/^[\\/][a-zA-Z]:?$/.test(t)}function Wp(e){return e.includes(`\\`)||/^[a-zA-Z]:$/.test(e)?`\\`:`/`}function Gp(e){return/[\\/]$/.test(e)}function Kp(e){return e.replace(/[\\/]+$/,``)}function qp(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 Jp(e){let t=e.query.trim();return t?Gp(t)?e.browseParentPath||Kp(t):qp({leaf:Vp(t),browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})??t:``}function Yp(e){let t=e.query.trim();if(!t||Gp(t))return!1;let n=Vp(t);return n?qp({leaf:n,browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})===void 0:!1}var Xp=F(`<p class="text-muted-foreground px-2 pb-1 text-[11px]">Reconnect <span class="text-muted-foreground"> </span> to a local directory</p>`),Zp=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>`),Qp=F(`<div class="border-hairline flex flex-wrap gap-1.5 border-b px-3 py-2"></div>`),$p=F(`<p class="text-muted-foreground px-3 py-8 text-center text-sm"> </p>`),em=F(`<button type="button" role="option"><!> <span class="truncate"> </span></button>`),tm=F(`<p class="text-destructive border-t border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"> </p>`),nm=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 rm(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(()=>Vp(o(f)).toLowerCase()),ee=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(`.`)))}),te=e(()=>o(f).trim()),M=e(()=>Jp({query:o(f),browseParentPath:o(_),browseEntries:o(h)})),N=e(()=>Yp({query:o(f),browseParentPath:o(_),browseEntries:o(h)})),re=e(()=>!o(b)&&o(M).length>0&&(zp(o(te))||o(_).length>0)),F=e(()=>r()===`reconnect`?`Reconnect`:o(N)?`Create & add`:`Add`),ie=e(()=>{if(o(ee).length>0)return o(ee);let e=Vp(o(f)).replace(/[\\/]+$/,``);if(!e||o(k).length===0)return o(ee);let t=o(_).split(/[/\\]/).filter(Boolean).at(-1);return t&&t.toLowerCase()===e.toLowerCase()?[{name:t,fullPath:o(_)}]:o(ee)}),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)&&Up(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,Hp(e.fullPath),!0),C(S,e.fullPath,!0)}function L(e){C(f,Hp(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),fe=e=>{var t=nm(),c=s(t),l=s(c),h=s(l),g=s(h);dn(s(g),{class:`size-4`}),B(g);var _=V(g,2);ue(_),j(_,`spellcheck`,!1);var b=V(_,2),D=e=>{Tn(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 ee=V(h,2),te=e=>{var t=Xp(),r=V(s(t)),o=s(r,!0);B(r),ne(),B(t),x(()=>a(o,n.expectedDisplayName)),i(e,t)};y(ee,e=>{r()===`reconnect`&&n.expectedDisplayName&&e(te)}),B(l);var M=V(l,2),N=e=>{var t=Qp();v(t,21,d,e=>e.workspacePath,(e,t)=>{var n=Zp(),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=$p(),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=em(),r=s(n),c=e=>{Wt(e,{class:`text-muted-foreground size-4 shrink-0`})},l=e=>{pn(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`}`),j(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=tm(),n=s(t,!0);B(t),x(()=>a(n,o(E))),i(e,t)};y(le,e=>{o(E)&&e(de)});var fe=V(le,2),pe=s(fe),me=V(s(pe),2),he=s(me);B(me),ne(2),B(pe);var U=V(pe,2);B(fe),B(c),B(t),x(()=>{O.disabled=!o(re)||o(T),a(k,o(T)?`Working…`:o(F)),a(he,`Enter ${o(F)??``}`),U.disabled=o(T)}),p(`click`,t,e=>{e.target===e.currentTarget&&n.onClose()}),p(`keydown`,c,ce),A(_,()=>o(f),e=>C(f,e)),p(`click`,O,()=>{z()}),p(`click`,U,function(...e){n.onClose?.apply(this,e)}),i(e,t)};y(de,e=>{n.open&&e(fe)}),i(t,le),R()}f([`click`,`keydown`]);var im=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>`),am=F(`<p class="text-muted-foreground truncate text-[10px] tracking-[-0.01em]"> </p>`),om=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>`),sm=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>`),cm=F(`<p class="text-muted-foreground pb-2 text-[12px] leading-5"> </p>`),lm=F(`<p class="text-muted-foreground py-1.5 text-[12px]">No threads yet</p>`),um=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>`),dm=F(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-amber-300" aria-label="Starting agent"></span>`),fm=F(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-emerald-400" aria-label="Thread has an active run"></span>`),pm=F(`<div class="group/thread relative"><button type="button"><!> <span class="truncate"> </span></button> <button type="button"><!></button></div>`),mm=F(`<button type="button" class="text-muted-foreground hover:text-muted-foreground px-2 py-1 text-[12px] transition"> </button>`),hm=F(`<div class="space-y-0.5"><!> <!></div>`),gm=F(`<div class="ml-5 border-l border-[var(--hairline)] pl-3"><!> <!></div>`),_m=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>`),vm=F(`<div class="space-y-4"></div>`),ym=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>`),bm=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>`),xm=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 ee(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 te(){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),te(),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(),te(),C(k,{threadId:t.threadId,title:t.title,x:e.clientX,y:e.clientY},!0)}var de=xm(),fe=u(de),pe=s(fe),me=s(pe),he=s(me);ze(he,{size:`sm`,class:`min-w-0`}),Us(V(he,2),{get theme(){return n.theme},get onThemeChange(){return n.onThemeChange}}),B(me);var U=V(me,2),ge=s(U);I(ge,1,M(d)),ln(s(ge),{class:f,"aria-hidden":`true`}),ne(2),B(ge),B(U);var _e=V(U,2),ve=V(s(_e),2),ye=e=>{var t=im();i(e,t)},be=t=>{var c=vm();v(c,21,()=>n.groups,e=>e.project.workspacePath,(t,c)=>{let l=e(()=>o(c).project),f=e(()=>ae(o(c)));var g=_m(),_=s(g),b=s(_),S=s(b);{let t=e(()=>`size-3 shrink-0 transition-transform ${F(o(l).workspacePath)?``:`rotate-90`}`);Mt(S,{get class(){return o(t)}})}B(b);var w=V(b,2),D=s(w);pn(D,{class:`text-muted-foreground size-4 shrink-0`});var k=V(D,2),ne=s(k),M=s(ne,!0);B(ne);var P=V(ne,2),oe=e=>{var t=am(),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=om(),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=sm(),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 fe=V(w,2),pe=s(fe),me=e=>{Gn(e,{class:`size-4`})},he=e=>{ln(e,{class:`size-4`})};y(pe,e=>{o(l).localAttachmentAvailability===`available`?e(me):e(he,-1)}),B(fe),B(_);var U=V(_,2),ge=t=>{var f=gm(),g=s(f),_=e=>{var t=cm(),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=lm();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=hm(),S=s(b);v(S,17,()=>o(g),e=>e.threadId,(t,c)=>{let f=e(()=>ds(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=um(),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()}),A(n,()=>o(E),e=>C(E,e)),i(e,t)},w=e=>{var t=pm(),r=s(t),u=s(r),m=e=>{var t=dm();i(e,t)},_=e=>{var t=fm();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);_t(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`}`),j(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`}`),j(S,`aria-label`,`Archive ${o(c).title}`)}),h(`mouseenter`,r,e=>{ee(e,o(c).title)}),h(`mouseleave`,r,te),h(`focus`,r,e=>{ee(e,o(c).title)}),h(`blur`,r,te),p(`contextmenu`,r,e=>{le(e,o(c))}),p(`click`,r,()=>{n.onSelectThread(o(c),o(l).workspacePath)}),p(`click`,S,e=>{e.stopPropagation(),te(),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=mm(),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)},_e=e(()=>!F(o(l).workspacePath));y(U,e=>{o(_e)&&e(ge)}),B(g),x(e=>{j(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),j(fe,`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`,fe,()=>{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(ve,e=>{n.groups.length===0?e(ye):e(be,-1)}),B(_e);var xe=V(_e,2),Se=s(xe);I(Se,1,M(d)),Vn(s(Se),{class:f,"aria-hidden":`true`}),ne(),B(Se),B(xe),B(pe),B(fe);var Ce=V(fe,2),we=e=>{var t=ym(),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(Ce,e=>{o(S)&&o(w)&&!o(k)&&!o(T)&&e(we)});var Te=V(Ce,2),Ee=e=>{var t=bm(),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(Te,e=>{o(k)&&e(Ee)}),p(`click`,ge,function(...e){n.onAddProject?.apply(this,e)}),p(`click`,Se,function(...e){n.onOpenSettings?.apply(this,e)}),i(t,de),R()}f([`click`,`keydown`,`contextmenu`]);function Cm(e){return{repositoryKey:e.repositoryKey,displayName:e.displayName,workspacePath:e.workspacePath,localAttachmentAvailability:e.availability,localAttachmentError:e.unavailableReason}}function wm(e){let t=e.recoveredSubmission,n=e.latestRun;return(n===null||n.submissionId===t?.submissionId&&!Wa(n.status))&&t?.prompt===e.prompt&&t.selectedModel===e.selectedModel&&t.reasoningEffort===e.reasoningEffort&&t.serviceTier===e.serviceTier&&io(t.imageUploadIds,e.imageUploadIds)?t.submissionId:e.newSubmissionId}function Tm(e){return e.submissionRunStatus&&Wa(e.submissionRunStatus)?e.freshSubmissionId:e.threadSubmissionId}function Em(e,t){return e===`cancelled`?`cancelled`:e===`failed`?t===`The local agent stopped responding before this run finished.`?`crash`:`failed`:null}function Dm(e){let t={userId:e.userId,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};e.continuationOfRunId&&(t.continuationOfRunId=e.continuationOfRunId),e.desktopApi.runAgent(t).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 Om(e){return Object.fromEntries(e.map(e=>[e.workspacePath,e]))}async function km(e){return e?Om(await e.listProjectAttachments()):{}}async function Am(e){let t={workspacePath:e.workspacePath};return e.replaceWorkspacePath&&(t.replaceWorkspacePath=e.replaceWorkspacePath),await e.desktopApi.attachProject(t)}async function jm(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}}var Mm=X.union(X.literal(`idle`),X.literal(`queued`),X.literal(`running`),X.literal(`waiting_for_input`),X.literal(`cancellation_requested`),X.literal(`completed`),X.literal(`failed`),X.literal(`cancelled`)),Nm=X.object({runId:X.id(`runs`),startedAt:X.number(),completedAt:X.optional(X.number()),lastError:X.optional(X.string()),executorFriendlyName:X.optional(X.string())});X.object({threadId:X.id(`threadRecords`),phase:Mm,run:X.union(Nm,X.null())});var Pm=new Set([`queued`,`running`,`waiting_for_input`,`cancellation_requested`]);function Fm(e){return Pm.has(e)}function Im(e){return`prompt:${e}`}function Lm(e){return`response:${e}`}function Rm(e){if(e.type===`tool-call`||e.type===`tool-result`)return e.callId}function zm(e){return e.toolInvocationId??e.jobId??e.callId}function Bm(e){return e===`completed`||e===`failed`||e===`cancelled`}function Vm(e){return{type:`tool-result`,callId:e.tool?.callId??`tool:${e.number}`,name:e.tool?.name??`tool`,output:e.tool?.output??null}}function Hm(e,t){let n=[...e];for(let e of t){if(e.type!==`tool-call`){n.push(e);continue}let t=n.findIndex(t=>t.type===`tool-call`&&t.callId===e.callId);if(t>=0){n[t]=e;continue}n.push(e)}return n}function Um(e,t,n){let r=t.tool;if(!r)return e;let i=r.callId,a=zm(r),o=[...e];if(o.findIndex(e=>e.type===`tool-call`&&e.callId===i)<0&&o.push({type:`tool-call`,callId:i,name:r.name,input:{}}),r.status===`started`||!Bm(r.status)||n.has(a))return o;n.add(a);let s=Vm(t),c=o.findIndex(e=>e.type===`tool-result`&&e.callId===i);if(c>=0)return o[c]=s,o;let l=o.findIndex(e=>e.type===`tool-call`&&e.callId===i);return l>=0?(o.splice(l+1,0,s),o):(o.push(s),o)}function Wm(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 Gm(e){let t=e.attachmentUrls??new Map,n=[...e.parts].sort((e,t)=>e.number-t.number),r=[],i=null,a=new Set,o=()=>{i&&=(r.push(i),null)},s=(t,n)=>{if(i&&i.runId===t)return i;let a=r.at(-1);return a?.type===`response`&&a.runId===t?(r.pop(),i=a,a):(o(),i={_id:Lm(t),_creationTime:n,threadId:e.threadId,runId:t,userId:e.userId,type:`response`,text:``,attachments:[],parts:[],runStatus:`completed`,runStartedAt:n},i)};for(let i of n){if(i.kind===`prompt`){o(),r.push({_id:Im(i.runId),_creationTime:i.number,threadId:e.threadId,runId:i.runId,userId:e.userId,type:`prompt`,text:i.prompt?.text??``,attachments:Wm(i,t),parts:[],runStatus:`completed`,runStartedAt:i.number});continue}if(i.kind===`completion`){let e=i.completion?.items??[],t=e.filter(e=>e.type===`text`).map(e=>e.text).join(``),n=s(i.runId,i.number);n.parts=Hm(n.parts,e),n.text+=t;continue}if(i.kind===`tool`){let e=s(i.runId,i.number);e.parts=Um(e.parts,i,a)}}return o(),r}function Km(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 qm(e){let t=Gm({parts:e.parts,userId:e.userId,threadId:e.threadId,attachmentUrls:e.attachmentUrls}),n=e.live?.threadId===e.threadId?e.live:null;if(n&&!Km(e.parts,n)){let r=t.findIndex(e=>e.type===`response`&&e.runId===n.runId),i=r>=0?t[r]:void 0,a=new Set(n.parts.flatMap(e=>{let t=Rm(e);return t?[t]:[]})),o=[...(i?.parts??[]).filter(e=>{let t=Rm(e);return e.type===`tool-call`&&t!==void 0&&a.has(t)?!1:e.type===`tool-result`?!0:n.streamId?!(`turnId`in e&&e.turnId===n.streamId):!1}),...n.parts],s={_id:i?._id??Lm(n.runId),_creationTime:n.runStartedAt,threadId:e.threadId,runId:n.runId,userId:e.userId,type:`response`,text:cc(o),attachments:[],parts:o,runStatus:n.runStatus,runStartedAt:n.runStartedAt};r>=0?t[r]=s:t.push(s)}return t}function Jm(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 Ym=F(`<div class="bg-background h-screen overflow-hidden"><!> <!></div>`),Xm=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>`),Zm=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>`),Qm=F(`<div class="text-muted-foreground mb-3 text-sm">Loading models…</div>`),$m=F(`<!> <!> <!>`,1),eh=F(`<div><!></div>`),th=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 nh(t,r){H(r,!0);let d=()=>se(xe,`$authState`,h),f=()=>se(ge,`$convexAuthRetryPending`,h),[h,v]=le(),w=Fe(),T=g(!1),D=e(()=>!!d().user),O=e(()=>d().user?.id??null),k=e(f),A=e(()=>d().isReady&&!d().isLoading&&o(D)&&!w.isLoading&&w.isAuthenticated),j=e(()=>o(D)&&d().isReady&&!d().isLoading&&!o(k)&&!w.isLoading&&!w.isAuthenticated);c(()=>{let e=Te({retryPending:o(k),isAuthenticated:w.isAuthenticated,isLoading:w.isLoading,sawLoadingDuringRetry:o(T)});o(T)!==e.sawLoadingDuringRetry&&C(T,e.sawLoadingDuringRetry,!0),e.clearPending&&ge.set(!1)});let ee=Ne(Se.threads.create),te=Ne(Se.threads.setSelectedModel),N=Ne(Se.agentQuestions.answer),P=Ne(Se.uiPreferences.setTheme),F=Ne(Se.imageUploads.generateUploadUrl),ie=Ne(Se.imageUploads.register),ae=Ne(Se.imageUploads.discard),L=Ne(Se.billing.ensureMySubscription),z=g(void 0),ce=g(null),ue=g(!0);async function de(){C(ue,!0);try{let e=Re.data.env.PUBLIC_MODEL_GATEWAY_URL?.trim()??``;C(z,await ki(e),!0),C(ce,null)}catch{C(ce,gi,!0),C(z,void 0)}finally{C(ue,!1)}}let pe=null;c(()=>{if(!o(A))return;let e=Q();!e||pe===e||(pe=e,L({}).catch(()=>{}))});let me=`Connect to a running Sprocket server to use this project.`,he=3e4,W=g(null),De=g(!1),Oe=g(null),ke=g(null),G=g(null),Ae=g(null),je=g(l(ai)),Me=g(l(`max`)),Pe=g(l(oi)),K=g(``),Le=g(null),q=g(!1),ze=g(l([])),J=g(null),Ke=g(0),Y=new mr,qe=new mr,Je=new mr,Ye=new mr,Xe=g(l({})),Ze=0,Qe=0,$e=g(!1),et=g(null),tt=null,nt=g(0),rt=g(null),it=g(l([])),at=g(l({})),ot=g(!1),st=0,ct=g(!1),lt=g(`loading`),X=g(l([])),ut=0,dt=0,ft=0,pt=g(null),mt=g(!1),ht=g(`add`),Z=g(void 0),gt=g(null),_t=g(!1),vt=g(`account`),yt=g(l([])),bt=g(!1),xt=g(!1),St=new mr,Ct=g(null);function Q(){return o(O)}function wt(e,t){return o(ze).find(t=>t.localId===e)?(C(ze,o(ze).map(n=>n.localId===e?{...n,...t}:n),!0),!0):!1}async function Tt(e,t,n){try{let r=await F({}),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 ie({storageId:a,name:n});if(`error`in s)throw Error(s.error);let c=o(ze).find(t=>t.localId===e);c&&URL.revokeObjectURL(c.previewUrl),wt(e,{status:`ready`,imageUploadId:s.imageUploadId,previewUrl:s.url})||ae({imageUploadId:s.imageUploadId}).catch(()=>{})}catch(t){let n=t instanceof Error?t.message:`Upload failed.`;wt(e,{status:`error`,error:n}),C(J,n,!0)}}function Et(e){for(let t of e){let e=co(o(ze).length,t);if(e){C(J,e,!0);continue}let n=crypto.randomUUID(),r=t.name||`Pasted image`;C(ze,[...o(ze),{localId:n,name:r,mediaType:t.type,size:t.size,previewUrl:URL.createObjectURL(t),status:`uploading`}],!0),Tt(n,t,r)}}function Dt(e){let t=o(ze).find(t=>t.localId===e);t&&(URL.revokeObjectURL(t.previewUrl),C(ze,o(ze).filter(t=>t.localId!==e),!0),t.imageUploadId&&ae({imageUploadId:t.imageUploadId}).catch(()=>{}))}function Ot(e){for(let t of o(ze))URL.revokeObjectURL(t.previewUrl),e.discard&&t.imageUploadId&&ae({imageUploadId:t.imageUploadId}).catch(()=>{});C(ze,[],!0)}function kt(e,t){return e?`thread:${e}`:t?`draft:${t}`:null}function At(e,t){Y.get(e)===t&&Y.delete(e)}function jt(e,t){return`${e}\0${t}`}function Mt(e,t,n){qe.set(jt(e,t),n)}function Nt(e,t){let n=jt(e,t);qe.delete(n),Je.delete(n)}function Pt(){return d().user&&w.isAuthenticated&&!w.isLoading?{}:`skip`}let Ft=Ie(Se.uiPreferences.getMine,Pt),It=g(l(Ve(null))),Lt=!1,Rt,zt=null,Bt=0;c(()=>{if(!o(A)){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=Ve(t);C(It,n,!0),Be(n)});async function Vt(e){let t=o(It),n=++Bt;zt=e,C(It,e,!0),Be(e);try{if(await P({theme:e}),n!==Bt)return;Rt=e}catch(e){if(n!==Bt)return;C(It,t,!0),Be(t),C(J,e instanceof Error?e.message:`Failed to save theme preference.`,!0)}finally{n===Bt&&(zt=null)}}let Ht=()=>o(G)&&Pt()!==`skip`?{threadId:o(G)}:`skip`,Ut=Ie(Se.threads.getByThreadId,Ht),Wt=Ie(Se.chat.selectedThreadLifecycle,Ht),Gt=Ie(Se.artifacts.listArtifactsForThread,Ht),Kt=Ie(Se.browserSessions.liveViewForThread,Ht),qt=Ie(Se.agentQuestions.headPendingForThread,Ht),Jt=e(()=>{for(let e of[Ft,Ut,Wt,Kt,qt])if(e.error)return e.error;return null}),Yt=e(()=>Object.values(o(at)).sort((e,t)=>t.lastUsedAt-e.lastUsedAt).map(Cm)),Xt=e(()=>ls(o(X).map(Vo),o(it))),Zt=e(()=>Qo(Ut.data,o(G))),Qt=e(()=>{let e=o(z)?_i(o(z),o(je))??_i(o(z),o(z).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(()=>Qo(Wt.data,o(G))),en=e(()=>Qo(qt.data,o(G))),tn=g(l([])),nn=g(null),rn=g(!1),an=g(null),on=g(!1),sn=g(null),cn=g(null),ln=0,un=g(null),dn=g(null),fn=e(()=>o(un)===ln);function pn(e){C(nn,e??null,!0)}function mn(e){ln+=1,C(an,e,!0),C(dn,null),C(cn,null),C(tn,[],!0),C(nn,null),C(rn,!1),C(on,e!==null),C(sn,null)}b(()=>{let e=o(G);o(an)!==e&&_(()=>mn(e))}),c(()=>{let e=o(G),t=o(W);if(!e||!t||!o(D))return;let n=_(()=>Q());if(!n)return;let r=new AbortController,i=e,a=ln;return(async()=>{try{let e=await t.fetchTranscriptPage({userId:n,threadId:i});if(r.signal.aborted||o(G)!==i||ln!==a)return;C(tn,e.parts,!0),C(rn,e.stale,!0),C(on,!1),C(cn,null),C(sn,e.contextSummary??null,!0),pn(e.nextBefore)}catch{!r.signal.aborted&&ln===a&&(C(on,!1),o(tn).length===0?C(cn,`Could not load conversation history.`):C(rn,!0))}try{let e=await we();if(!e||r.signal.aborted||o(G)!==i)return;await t.watchTranscript({authToken:e,userId:n,threadId:i},{signal:r.signal,onEvent:e=>{r.signal.aborted||o(G)!==i||(C(rn,e.stale,!0),gr(i,n))}})}catch{r.signal.aborted||C(rn,!0)}})(),()=>{r.abort()}}),c(()=>{let e=o(G),t=o(W);if(!e||!t||!o(D))return;let n=_(()=>Q());if(!n)return;let r=new AbortController,i=e;return(async()=>{for(;!r.signal.aborted;){try{let e=await we();if(r.signal.aborted)return;e&&await t.watchLiveCompletion({authToken:e,userId:n,threadId:i},{signal:r.signal,onEvent:e=>{r.signal.aborted||o(G)!==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 hn=e(()=>{let e=Q();if(!o(G)||!e||o(an)!==o(G)||o(on)&&o(tn).length===0)return[];let t=o(Ln)?null:o(dn);return qm({parts:o(tn),live:t,userId:e,threadId:o(G)})}),gn=e(()=>o(Oe)?Uo(o(Yt),o(Oe)):o(ke)?Ho(o(Yt),o(ke)):null),_n=e(()=>o(gn)?.workspacePath??o(Oe)),vn=e(()=>{let e=o(gn)?.workspacePath??null,t=o(W);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}}}),yn=e(()=>o(gn)?.repositoryKey?o(Xt).filter(e=>e.repositoryKey===o(gn).repositoryKey&&Wo(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt):[]),bn=e(()=>o($t)?.run??null),xn=[],Sn=e(()=>(Gt.data??[]).map(e=>({key:e.artifact._id,title:e.artifact.title,artifactType:e.artifact.type,content:e.currentContent}))),Cn=new mr,wn=g(l({...Rp})),Tn=null,En=null,Dn=null;c(()=>{let e=o(G);e!==Tn&&(Tn&&Cn.set(Tn,o(wn)),Tn=e,C(Ct,null),C(wn,{...e&&Cn.get(e)||Rp},!0))}),c(()=>{let e=o(G),t=Gt.data;if(!e){En=null;return}if(En&&En.threadId!==e&&(En=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}=Lp(En?.revisions??null,n);if(En={threadId:e,revisions:r},!i)return;let a=_(()=>o(wn));C(wn,{...a,open:!0,tab:a.open?a.tab:`artifacts`,selectedKey:!a.open||a.selectedKey===null?i:a.selectedKey},!0)}),c(()=>{let e=o(G),t=Kt.data,n=o(Nn)?o(bn)?.runId??null:null;if(!e){Dn=null;return}if(Dn&&Dn.threadId!==e&&(Dn=null),t===void 0)return;let r=t?.lastUsedRunId??null,i=Dn;if(Dn={threadId:e,runId:r},r===null||r!==n||i&&i.runId===r)return;let a=_(()=>o(wn));a.open&&a.tab===`live`||C(wn,{...a,open:!0,tab:`live`},!0)});let On=e(()=>o(Sn).find(e=>e.key===o(Ct))??null),kn=e(()=>kt(o(G),o(_n))),An=e(()=>{let e=Q();if(!(!e||!o(kn)))return Je.get(jt(e,o(kn)))}),jn=e(()=>o($t)?.phase===`queued`&&o(An)!=null),Mn=e(()=>o($t)!=null&&Fm(o($t).phase)&&!o(jn)),Nn=e(()=>o(Mn)&&o($t)?.phase!==`cancellation_requested`),Pn=e(()=>{let e=o(G)&&o($t)?qo(o(Xt),o(G),o(Mn)):o(Xt);return Ko(o(Yt),e)}),In=e(()=>ds(o(Xe),o(G))),Ln=e(()=>o(In)||o(Mn)?null:Em(o($t)?.phase??`idle`,o($t)?.run?.lastError)),Rn=e(()=>us({threadId:o(G),pendingCreatedThreadId:o(rt),hasLatestRunData:!!o($t)})),zn=e(()=>!!(o(kn)&&Y.has(o(kn)))),Bn=e(()=>!!(o(_n)&&o(gn)?.localAttachmentAvailability===`available`&&!o(zn)&&!o(q)&&!o(In)&&(!o(Mn)&&o(Rn)||o(en)))),Vn=e(()=>{let e=new pr,t=[];for(let n of Object.values(o(at))){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 Hn(){let e=++st,t=await km(o(W));e===st&&(C(at,t,!0),C(ot,!0),await Un(t),await Yn())}async function Un(e){if(Pt()!==`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)&&Pt()!==`skip`&&await Kn(n,t.repositoryKey),o(Oe)===t.workspacePath&&C(ke,t.repositoryKey,!0),await Qn(t.workspacePath))}}async function Wn(){let e=o(W),t=Q(),n=await we();if(!e||!t||!n)throw Error(`The local Sprocket service is not ready.`);return{api:e,userId:t,authToken:n}}async function Gn(){let e=o(W),t=Q();e&&t&&await e.endAccountSession({userId:t}).catch(()=>{}),await _e()}async function Kn(e,t){let{api:n,userId:r,authToken:i}=await Wn();await n.rekeyRepository({userId:r,authToken:i,from:e,to:t}),await Jn(r)}function qn(e){C(lt,e.status,!0),e.status!==`loading`&&C(ct,!0)}async function Jn(e){let t=o(W);if(!t)return;let n=++dt,r=await t.fetchThreadSnapshot({userId:e});n===dt&&Q()===e&&(C(X,r.threads,!0),C(it,cs(r.threads,o(it)),!0),qn(r))}async function Yn(){let e=o(W),t=Q();if(!e||!t)return;let n=await we();if(!n||Q()!==t)return;let r=await e.registerThreadCache({userId:t,authToken:n});Q()===t&&(qn(r),await Jn(t))}c(()=>{let e=o(W),t=o(O);if(!e||!t)return;let n=++ut,r=new AbortController;return(async()=>{try{try{await Yn()}catch{await Jn(t)}if(n!==ut||r.signal.aborted)return;await e.watchThreadCache({userId:t},{signal:r.signal,onEvent:e=>{n===ut&&Q()===t&&(qn(e),(e.status===`live`||e.status===`reconnecting`)&&Jn(t))}})}catch(e){if(n!==ut||Q()!==t)return;C(lt,`error`),C(ct,!0),C(J,e instanceof Error?e.message:`Could not sync threads.`,!0)}})(),()=>{r.abort()}}),c(()=>{let e=o(W),t=o(O);!e||!t||!o(A)||Yn().catch(()=>{})}),c(()=>{let e=o(W),t=Q();if(!e||!t||!o(A)||!o(_t)||o(vt)!==`archived`)return;let n=++ft;e.syncArchivedThreads({userId:t}).then(async e=>{n===ft&&Q()===t&&(qn(e),await Jn(t))}).catch(e=>{n===ft&&Q()===t&&C(J,e instanceof Error?e.message:`Could not sync archived threads.`,!0)})});function Xn(e,t=null,n=!1){let r=Uo(o(Yt),e);C(Oe,e,!0),C(ke,r?.repositoryKey??null,!0),C(G,t,!0),C(Ae,n?e:null,!0),t!==o(rt)&&C(rt,null)}function Zn(e,t=null,n=!1,r=!1){C(nt,o(nt)+1),r||C(J,null),Xn(e,t,n)}async function Qn(e,t){if(!o(W))throw Error(me);let n=await Am({desktopApi:o(W),workspacePath:e,replaceWorkspacePath:t});st+=1;let r={...o(at),[n.workspacePath]:n};return t&&t!==n.workspacePath&&delete r[t],C(at,r,!0),C(ot,!0),n}function $n(e,t={}){let n=Uo(o(Yt),e);if(!n){C(J,`Choose a project first.`);return}Zn(e,t.threadId,t.draft);let r=o(nt);sr(n.workspacePath).catch(e=>{r===o(nt)&&C(J,e instanceof Error?e.message:`Failed to attach project.`,!0)})}function er(e=`add`,t=null){if(!o(W)){C(J,me);return}C(ht,e,!0),C(gt,t,!0);let n=e===`reconnect`&&t?Uo(o(Yt),t):void 0;C(Z,n?.displayName,!0),C(mt,!0),C(J,null)}async function tr(e){if(!o(W)){C(J,me);return}let t=Q();if(!t){C(J,`User session is not ready.`);return}try{if(o(ht)===`reconnect`&&o(gt)){await rr(e,o(gt),t);return}await nr(e,t)}catch(e){if(Q()!==t)return;throw C(J,e instanceof Error?e.message:`Failed to attach project.`,!0),e}}async function nr(e,t){await Qn(e.workspacePath),Q()===t&&(Zn(e.workspacePath,null,!0),C(J,null))}async function rr(e,t,n){let r=Uo(o(Yt),t);if(await Qn(e.workspacePath,t===e.workspacePath?void 0:t),Q()!==n)return;r&&r.repositoryKey!==e.repositoryKey&&Pt()!==`skip`&&!o(Yt).some(t=>t.workspacePath!==e.workspacePath&&t.repositoryKey===r.repositoryKey)&&await Kn(r.repositoryKey,e.repositoryKey);let i=r?.repositoryKey===e.repositoryKey?o(G):null;Zn(e.workspacePath,i),C(J,null)}function ir(e){let t=e?.trim();t&&C(yt,[...o(yt),t],!0)}async function ar(){let e=window.sprocketDesktopBridge;if(e?.takeWorkspaceLaunch)for(;;){let t=await e.takeWorkspaceLaunch();if(!t)return;ir(t)}}async function or(e,t,n){let r=await t.resolveWorkspacePath({workspacePath:e});Q()===n&&await nr(r,n)}async function sr(e){await jm({desktopApi:o(W),refreshDesktopProjectAttachments:Hn,workspacePath:e})}function cr(e){er(`reconnect`,e)}async function lr(e){let t=await ee({submissionId:e.submissionId,repositoryKey:e.repositoryKey,selectedModel:e.selectedModel,reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier});return e.isSubmissionCurrent()?(e.userId===Q()&&(C(it,[...o(it).filter(e=>e.threadId!==t.threadId),is({threadId:t.threadId,repositoryKey:e.repositoryKey,selectedModel:e.selectedModel,reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier,title:ns(e.prompt)})],!0),Jn(e.userId),e.selectionGeneration===o(nt)&&(C(rt,t.threadId,!0),C(nt,o(nt)+1),C(G,t.threadId,!0),C(Ae,null))),t):null}async function ur(e){let t=o(G),n=Q();if(!(!t||!n)){C(it,o(it).map(n=>n.threadId===t?{...n,selectedModel:e}:n),!0);try{await te({threadId:t,selectedModel:e}),Q()===n&&Jn(n)}catch(e){o(G)===t&&Q()===n&&C(J,e instanceof Error?e.message:`Failed to save the selected model.`,!0)}}}function dr(e){$n(e,{draft:!0})}function fr(e,t){$n(t,{threadId:e.threadId})}async function hr(e,t){try{let{api:n,userId:r,authToken:i}=await Wn();await n.renameThread({userId:r,authToken:i,threadId:e,title:t})||C(lt,`reconnecting`),C(it,o(it).map(n=>n.threadId===e?{...n,title:t}:n),!0),await Jn(r)}catch(e){C(J,e instanceof Error?e.message:`Failed to rename thread.`,!0)}}async function gr(e,t){let n=o(W);if(!n||o(G)!==e)return;let r=ln,i=await n.fetchTranscriptPage({userId:t,threadId:e});o(G)===e&&ln===r&&(C(tn,Jm(o(tn),i.parts),!0),C(rn,i.stale,!0),C(sn,i.contextSummary??o(sn),!0),o(tn).length===i.parts.length?pn(i.nextBefore):o(nn)!=null&&i.nextBefore!=null&&C(nn,Math.min(o(nn),i.nextBefore),!0))}async function vr(){let e=o(W),t=o(G),n=Q(),r=o(nn),i=ln;if(!(!e||!t||!n||r==null||o(un)===i)){C(un,i,!0);try{let a=await we();if(!a||o(G)!==t||ln!==i)return;let s=await e.fetchTranscriptPage({authToken:a,userId:n,threadId:t,before:r,limit:100});if(o(G)!==t||ln!==i)return;C(tn,Jm(o(tn),s.parts),!0),C(rn,s.stale,!0),pn(s.nextBefore)}catch{o(G)===t&&ln===i&&C(rn,!0)}finally{o(un)===i&&C(un,null)}}}async function yr(e){let t=o(W),n=o(G),r=Q();if(!t||!n||!r)return null;let i=await we();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 br(e){let t=Q();try{let{api:n,userId:r,authToken:i}=await Wn();if(await n.archiveThread({userId:r,authToken:i,threadId:e})||C(lt,`reconnecting`),await Jn(r),t){Nt(t,`thread:${e}`);let n=o(W),r=await we();n&&r&&await n.clearTranscriptReplica({authToken:r,userId:t,threadId:e})}Q()===t&&(o(G)===e&&(C(G,null),C(rt,null),C(it,o(it).filter(t=>t.threadId!==e),!0),C(nt,o(nt)+1)),C(J,null))}catch(e){if(Q()!==t)return;C(J,e instanceof Error?e.message:`Failed to archive thread.`,!0)}}async function xr(e){try{let{api:t,userId:n,authToken:r}=await Wn();await t.restoreThread({userId:n,authToken:r,threadId:e})||C(lt,`reconnecting`),await Jn(n)}catch(e){C(J,e instanceof Error?e.message:`Failed to restore thread.`,!0)}}async function Cr(){let e=o(en),t=o(G);if(!e||!t||o(q)||!o(Le)&&!o(K).trim())return;C(q,!0),C(J,null);let n=o(K),r=o(Le),i=n.trim();C(K,``),C(Le,null);try{let n={threadId:t,questionId:e.questionId,optionId:r??void 0,text:i||void 0};await N(n)}catch(i){o(G)===t&&o(en)?.questionId===e.questionId&&(C(K,n,!0),C(Le,r,!0),C(J,i instanceof Error?i.message:String(i),!0))}finally{C(q,!1)}}async function wr(){if(o(en)){await Cr();return}if(o(zn)||!o(K).trim()&&o(ze).length===0)return;if(o(ze).some(e=>e.status!==`ready`)){C(J,`Wait for image uploads to finish, or remove failed images before sending.`);return}let e=o(_n);if(!e){C(J,`Choose a project first.`);return}if(!o(W)){C(J,me);return}if(o(G)&&!o(Rn)){C(J,`Loading thread state before sending.`);return}if(!o(Bn)){C(J,o(Mn)||o(In)||o(zn)?`Wait for the current agent launch or run to finish.`:o(gn)?.localAttachmentAvailability===`available`?`You need an active project before sending.`:`This project needs to be attached before sending.`,!0);return}C(Ke,0);let t=o(nt),n=o(G),r=o(ke);if(!r){C(J,`Choose a project first.`);return}let i=!1,a=Q();if(!a){C(J,`User session is not ready.`);return}let s=()=>Q()===a,c=o(K).trim(),l=o(ze).map(e=>({...e})),u=l.flatMap(e=>e.imageUploadId?[e.imageUploadId]:[]),d=o(je),f=o(Me),p=o(Pe),m=n?o(bn)?.runId??null:null,h=n?`thread:${n}`:`draft:${e}`,g=h,_=g,v=jt(a,g),y=Je.get(v),b=crypto.randomUUID(),x=wm({latestRun:!n||!o($t)||o($t).phase===`idle`?null:{status:Fm(o($t).phase)?`queued`:`completed`,submissionId:o(An)?.submissionId??``},newSubmissionId:b,prompt:c,imageUploadIds:u,reasoningEffort:f,serviceTier:p,recoveredSubmission:y?{...y,selectedModel:y.selectedModel}:void 0,selectedModel:d}),S=x;Nt(a,g);let w=null,T=null,E=++Qe,D=jt(a,g);Ye.set(D,E);let O=()=>Ye.get(D)===E,k=`Your session changed before the agent started. Return to this account and send the prompt again.`,A=`This request is still preparing. Wait for it to finish before trying again.`,j=e=>{Mt(a,_,{message:e,prompt:c,attachments:l,imageUploadIds:u,reasoningEffort:f,serviceTier:p,selectedModel:d,submissionId:!n&&_===g?x:S})},ee=()=>{Nt(a,_),s()&&o(J)===A&&C(J,null)},te=window.setTimeout(()=>{Ye.get(D)===E&&Mt(a,_,{message:A,prompt:``})},he);C(K,``),C(J,null),Y.set(h,E);try{if(!n){let t=await o(W).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)&&Pt()!==`skip`&&await Kn(r,t.repositoryKey),!O()))return;r=t.repositoryKey,C(ke,t.repositoryKey,!0),i=!0}}let l=n?null:await lr({isSubmissionCurrent:O,prompt:c,selectionGeneration:t,selectedModel:d,selectedReasoningEffort:f,selectedServiceTier:p,submissionId:x,userId:a,repositoryKey:r}),g=n??l?.threadId??null;if(!g||!O())return;if(l&&(S=Tm({freshSubmissionId:b,submissionRunStatus:l.submissionRunStatus,threadSubmissionId:x})),!s()){j(k);return}w=g,n||(At(h,E),h=`thread:${g}`,Y.set(h,E),ee(),Ye.get(D)===E&&Ye.delete(D),_=`thread:${g}`,D=jt(a,_),Ye.set(D,E),i&&(Zn(e,g),St.set(g,`This directory’s git remote changed. Existing threads now follow the new repository.`)));let v=await we({forceRefreshToken:!0});if(!v){j(`Your session ended before the agent started. Sign in again.`);return}if(!O())return;if(!s()){j(k);return}ee();let y=++Ze;T=y;let A={expiresAt:Date.now()+he,launchId:y,previousRunId:m};o(bn)?.startedAt&&(A.previousStartedAt=o(bn).startedAt),C(Xe,fs(o(Xe),g,A),!0),window.setTimeout(()=>{let e=o(Xt).find(e=>e.threadId===g)?.latestRunId??null,t=o(G)===g?o(bn)?.runId??null:null,n=[e,t].find(e=>e&&e!==m)??e??t,r=o(G)===g&&o(bn)?.runId===n?o(bn).startedAt:void 0,i=_s(o(Xe),g,y,Date.now(),n,void 0,r);i.pendingLaunches!==o(Xe)&&(C(Xe,i.pendingLaunches,!0),i.shouldRecover&&j(`The local agent did not start. Please try again.`))},he),Dm({userId:a,authToken:v,desktopApi:o(W),onError:e=>{if(!O()||!s())return;let t=ps(o(Xe),g,y);t!==o(Xe)&&C(Xe,t,!0),j(e instanceof Error?e.message:`Failed to start the local agent run.`)},onStarted:()=>{!O()||!s()||Ot({discard:!1})},threadId:g,prompt:c,imageUploadIds:u,selectedModel:d,submissionId:S,reasoningEffort:f,serviceTier:p,workspacePath:e})}catch(e){if(w&&T!==null&&C(Xe,ps(o(Xe),w,T),!0),!O())return;if(!s()){j(k);return}j(e instanceof Error?e.message:`Failed to send prompt.`),Hn().catch(()=>{})}finally{window.clearTimeout(te),At(h,E),T===null&&Ye.get(D)===E&&Ye.delete(D)}}async function Tr(){if(!(!o(bn)?.runId||!o(Mn)))try{let{api:e,authToken:t}=await Wn();await e.requestRunCancellation({authToken:t,runId:o(bn).runId})}catch(e){C(J,e instanceof Error?e.message:`Failed to cancel run.`,!0)}}async function Er(){if(!o(Ln)||!o(bn)||!o(G)||!o(_n)||o(In)||o(zn))return;if(!o(W)){C(J,me);return}let e=o(G),t=o(_n),n=Q();if(!t||!n)return;let r=o(bn).runId,i=o(bn).startedAt,a=++Ze,s={expiresAt:Date.now()+he,launchId:a,previousRunId:r,previousStartedAt:i};C(Xe,fs(o(Xe),e,s),!0);try{let i=await we({forceRefreshToken:!0});if(!i||Q()!==n)throw Error(`User session is not ready.`);Dm({userId:n,authToken:i,desktopApi:o(W),onError:t=>{C(Xe,ps(o(Xe),e,a),!0),C(J,t.message,!0)},onStarted:()=>{},threadId:e,prompt:``,imageUploadIds:[],selectedModel:o(je),reasoningEffort:o(Me),serviceTier:o(Pe),submissionId:crypto.randomUUID(),workspacePath:t,continuationOfRunId:r})}catch(t){C(Xe,ps(o(Xe),e,a),!0),C(J,t instanceof Error?t.message:`Failed to continue the run.`,!0)}}c(()=>{let e=Q();o(pt)!==e&&(C(pt,e,!0),C($e,!1),C(Oe,null),C(ke,null),C(G,null),C(Ae,null),C(rt,null),C(it,[],!0),C(Xe,{},!0),C(et,null),pe=null,tt=null,C(ct,!1),C(lt,`loading`),C(X,[],!0),dt+=1,C(nt,o(nt)+1),C(K,``),Ot({discard:!0}),C(J,null),C(Ke,0),C(je,o(z)?.defaultModelId??`deepseek-v4-pro-0813`,!0),C(Me,o(z)?.defaultReasoningEffort??`max`,!0),C(Pe,o(z)?.defaultServiceTier??`standard`,!0),C(mt,!1),C(gt,null),C(Z,void 0))}),c(()=>{let e=o(yt)[0],t=o(W),n=Q();!e||o(bt)||!o(A)||!t||!n||!o(ot)||(C(yt,o(yt).slice(1),!0),C(bt,!0),C($e,!0),C(et,null),C(mt,!1),C(_t,!1),C(J,null),or(e,t,n).catch(e=>{Q()===n&&(C($e,!1),C(J,e instanceof Error?e.message:`Failed to open the requested project.`,!0))}).finally(()=>{C(bt,!1)}))}),c(()=>{let e=o(Zt),t=e?._id??null;if(t===tt||(tt=t,!e))return;let n=pi(e.selectedModel,e.serviceTier);C(je,n.modelId,!0),C(Me,mi(n.modelId,e.reasoningEffort),!0),C(Pe,n.serviceTier,!0)}),c(()=>{let e=Q(),t=kt(o(G),o(_n));if(!e||!t)return;let n=jt(e,t),r=qe.get(n);if(!r)return;qe.delete(n);let i=o(K)===``;i&&C(K,r.prompt,!0),o(ze).length===0&&r.attachments?.length&&(i||o(K)===r.prompt)&&C(ze,r.attachments.map(e=>({...e})),!0),o(K)===r.prompt&&r.submissionId&&(r.prompt||r.imageUploadIds?.length)&&r.reasoningEffort&&r.selectedModel&&Je.set(n,{prompt:r.prompt,imageUploadIds:r.imageUploadIds??[],reasoningEffort:r.reasoningEffort,serviceTier:r.serviceTier??o(z)?.defaultServiceTier??`standard`,selectedModel:r.selectedModel,submissionId:r.submissionId}),C(J,r.message,!0)}),c(()=>{if(!o(rt))return;let e=$o({pendingCreatedThreadId:o(rt),threads:o(X)});e!==o(rt)&&C(rt,e,!0)}),c(()=>{if(o($e)||!o(xt)||o(yt).length>0||o(bt)||!o(ot)||!o(ct))return;C($e,!0);let e=new Set(o(Yt).map(e=>e.repositoryKey)),t=Zo(o(Xt).filter(t=>e.has(t.repositoryKey)));if(t){let e=Ho(o(Yt),t.repositoryKey);if(e){Zn(e.workspacePath,t.threadId,!1,!0),C(et,e.workspacePath,!0);return}}o(Yt)[0]&&(Zn(o(Yt)[0].workspacePath,null,!1,!0),C(et,o(Yt)[0].workspacePath,!0))}),c(()=>{let e=o(et);if(!e||!o(W)||!o(ot))return;if(!Uo(o(Yt),e)){C(et,null);return}C(et,null);let t=o(nt);sr(e).catch(e=>{t===o(nt)&&C(J,e instanceof Error?e.message:`Failed to attach project.`,!0)})}),c(()=>{let e=o(G)?Xo(o(Xt),o(G)):null,t=o(gn)?.repositoryKey===e?.repositoryKey?o(gn):Ho(o(Yt),e?.repositoryKey);t&&t.workspacePath!==o(Oe)&&Zn(t.workspacePath,o(G),o(Ae)===t.workspacePath)}),c(()=>{let e=o(yn);if(!o($e)||!o(Oe))return;let t=vs({threads:e,currentThreadId:o(G),currentWorkspacePath:o(Oe),draftWorkspacePath:o(Ae),pendingCreatedThreadId:o(rt)});t!==o(G)&&Zn(o(Oe),t,o(Ae)===o(Oe),!0)}),c(()=>{let e=gs(o(Xe),o(Xt));o(G)&&o(bn)?.runId&&(e=hs(e,o(G),o(bn).runId,void 0,o(bn).startedAt)),e!==o(Xe)&&C(Xe,e,!0)}),c(()=>{let e=o(bn)?.startedAt;if(!o(Nn)||!e){C(Ke,0);return}let t=()=>{C(Ke,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}),oe(()=>{de();let e=window.sprocketDesktopBridge,t=e?.onWorkspaceLaunch?e.onWorkspaceLaunch(()=>{ar()}):void 0,n=Ue();return n&&(ir(n),We()),e?.takeWorkspaceLaunch?ar().finally(()=>{C(xt,!0)}):C(xt,!0),Ge().then(e=>{C(W,e,!0),C(De,!0),Hn().catch(e=>{C(J,e instanceof Error?e.message:`Failed to load local project attachments.`,!0)})}).catch(e=>{C(J,e instanceof Error?e.message:`Failed to connect to the Sprocket server.`,!0),C(De,!0)}),()=>t?.()});var Dr=m();E(`1uha8ag`,e=>{n(()=>{S.title=`Sprocket`})});var Or=u(Dr),kr=e=>{He(e,{title:`Connecting to Sprocket…`,description:`Looking for a running Sprocket server on this machine.`,busy:!0})},Ar=t=>{{let n=t=>{{let n=e(()=>U(`/pair`));_r(t,{get href(){return o(n)},children:(e,t)=>{ne();var n=re(`Open pairing`);i(e,n)},$$slots:{default:!0}})}},r=e(()=>o(J)??`Connect to your Sprocket server to continue.`);He(t,{title:`Connect to Sprocket`,get description(){return o(r)},actions:n,$$slots:{actions:!0}})}},jr=t=>{var n=Ym(),r=s(n);{let t=e(()=>({isLoading:!d().isReady||d().isLoading||o(k)||o(D)&&w.isLoading,isConfigured:d().isConfigured,isAuthenticated:o(D),connectionFailed:o(j),error:d().error}));Sr(r,{get authState(){return o(t)},get overlayOpen(){return d().isWaitingForBrowserSignIn},onSignIn:()=>void Ee(),onSignOut:()=>void Gn(),onRetry:()=>void be(),onSignUp:()=>void ve()})}Nr(V(r,2),{get open(){return d().isWaitingForBrowserSignIn},get signInUrl(){return d().browserSignInUrl},get error(){return d().error},get onCancel(){return Ce},get onClearOpenError(){return ye}}),B(n),i(t,n)},Mr=t=>{var n=th(),r=s(n),c=s(r),l=e=>{Ks(e,{get activePage(){return o(vt)},get theme(){return o(It)},onThemeChange:e=>void Vt(e),onBack:()=>{C(_t,!1),C(vt,`account`)},onNavigate:e=>{C(vt,e,!0)}})},f=e=>{Sm(e,{get currentWorkspacePath(){return o(Oe)},get currentThreadId(){return o(G)},get groups(){return o(Pn)},get pendingAgentLaunches(){return o(Xe)},get theme(){return o(It)},onThemeChange:e=>void Vt(e),onAddProject:()=>{er(`add`)},onReconnectProject:e=>{cr(e)},onOpenSettings:()=>{C(vt,`account`),C(_t,!0)},onStartThreadDraft:dr,onSelectThread:fr,onSelectProject:e=>{$n(e)},onRenameThread:(e,t)=>{hr(e,t)},onArchiveThread:e=>{br(e)}})};y(c,e=>{o(_t)?e(l):e(f,-1)});var h=V(c,2),g=s(h),_=e=>{var t=Xm();Fn(s(t),{class:`size-4`,"aria-hidden":`true`}),B(t),p(`click`,t,()=>{C(wn,{...o(wn),open:!0},!0)}),i(e,t)};y(g,e=>{!o(_t)&&!o(wn).open&&e(_)});var v=V(g,2),b=e=>{var t=m(),n=u(t),r=e=>{Cs(e,{get threads(){return o(Xt)},get projects(){return o(Yt)},onRestore:e=>{xr(e)}})},a=e=>{oc(e,{})},s=e=>{Vs(e,{})},c=e=>{Bo(e,{get user(){return d().user},onSignOut:()=>void Gn()})};y(n,e=>{o(vt)===`archived`?e(r):o(vt)===`usage`?e(a,1):o(vt)===`payments`?e(s,2):e(c,-1)}),i(e,t)},S=t=>{var n=$m(),r=u(n);fe(r,()=>o(G),t=>{{let n=e(()=>o(cn)??o(J)??d().error??(o(Jt)instanceof Error?ks(o(Jt)):null)??(o(lt)===`error`?`Could not sync threads.`:null)??(o(lt)===`offline`?`Thread sync is offline.`:null)??null),r=e(()=>o(Ln)?null:o(bn)?.lastError??null),i=e(()=>o(Nn)?o(bn)?.runId??null:null),a=e(()=>o(G)?St.get(o(G))??null:null),s=e(()=>o(nn)!=null),c=e(()=>o(G)&&(o(on)||o(an)!==o(G))?`Loading conversation…`:o(gn)?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`);Qf(t,{get currentError(){return o(n)},get runError(){return o(r)},get messages(){return o(hn)},get actions(){return xn},get activeRunId(){return o(i)},get project(){return o(gn)},get remoteChangeNotice(){return o(a)},onDismissRemoteChangeNotice:()=>{o(G)&&St.delete(o(G))},get stale(){return o(rn)},get contextSummary(){return o(sn)},get loadingOlder(){return o(fn)},get hasOlder(){return o(s)},get emptyStateMessage(){return o(c)},onLoadOlder:()=>{vr()},loadAttachment:yr})}});var c=V(r,2),l=e=>{var t=Zm(),n=s(t),r=s(n,!0);B(n),_r(V(n,2),{variant:`outline`,className:`h-8 px-3`,get disabled(){return o(ue)},onclick:()=>{de()},children:(e,t)=>{ne();var n=re();x(()=>a(n,o(ue)?`Retrying…`:`Retry`)),i(e,n)},$$slots:{default:!0}}),B(t),x(()=>a(r,gi)),i(e,t)},f=e=>{var t=Qm();i(e,t)};y(c,e=>{o(ce)?e(l):o(ue)&&!o(z)&&e(f,1)});var p=V(c,2);{let t=e(()=>o(Ln)!=null),n=e(()=>o(zn)||o(In)||o(q)),r=e(()=>o(Nn)?Ui(o(Ke)):null);Ao(p,{get attachments(){return o(ze)},onAttachFiles:Et,onRemoveAttachment:Dt,get modelCatalog(){return o(z)},onModelChange:e=>{ur(e)},get pendingQuestion(){return o(en)},get showContinueWorking(){return o(t)},onContinueWorking:()=>{Er()},get canSend(){return o(Bn)},get isSubmitting(){return o(n)},get isStarting(){return o(In)},get isRunning(){return o(Nn)},get elapsedLabel(){return o(r)},get contextUsage(){return o(Qt)},get projectSkills(){return o(vn)},onSubmit:()=>{wr()},onCancel:()=>{Tr()},get prompt(){return o(K)},set prompt(e){C(K,e,!0)},get selectedModel(){return o(je)},set selectedModel(e){C(je,e,!0)},get selectedReasoningEffort(){return o(Me)},set selectedReasoningEffort(e){C(Me,e,!0)},get selectedServiceTier(){return o(Pe)},set selectedServiceTier(e){C(Pe,e,!0)},get selectedQuestionOptionId(){return o(Le)},set selectedQuestionOptionId(e){C(Le,e,!0)}})}i(t,n)};y(v,e=>{o(_t)?e(b):e(S,-1)}),B(h),B(r);var w=V(r,2),T=t=>{var n=eh(),r=s(n);{let t=e(()=>o(Nn)&&Kt.data?.lastUsedRunId===o(bn)?.runId);jp(r,{get artifacts(){return o(Sn)},get selectedKey(){return o(wn).selectedKey},get tab(){return o(wn).tab},get liveView(){return Kt.data},get liveActive(){return o(t)},get expanded(){return o(wn).expanded},onSelect:e=>{C(wn,{...o(wn),selectedKey:e},!0)},onBack:()=>{C(wn,{...o(wn),selectedKey:null},!0)},onTabChange:e=>{C(wn,{...o(wn),tab:e},!0)},onOpenFullscreen:e=>{C(Ct,e,!0),document.fullscreenElement||document.documentElement.requestFullscreen?.().catch(()=>{})},onToggleExpanded:()=>{C(wn,{...o(wn),expanded:!o(wn).expanded},!0)},onClose:()=>{C(wn,{...o(wn),open:!1,expanded:!1},!0)}})}B(n),x(()=>{I(n,1,M(o(wn).expanded?`bg-background fixed inset-0 z-50`:`absolute inset-y-0 right-0 z-40 w-[20rem]`)),n.inert=o(On)?!0:void 0}),i(t,n)};y(w,e=>{!o(_t)&&o(wn).open&&e(T)});var E=V(w,2),D=e=>{Ip(e,{get artifact(){return o(On)},onClose:()=>{C(Ct,null)}})};y(E,e=>{o(On)&&e(D)});var O=V(E,2),k=e=>{rm(e,{get open(){return o(mt)},get desktopApi(){return o(W)},get mode(){return o(ht)},get expectedDisplayName(){return o(Z)},get recentProjectPaths(){return o(Vn)},onClose:()=>{C(mt,!1),C(gt,null),C(Z,void 0)},onSelect:async e=>{try{await tr(e)}catch{await Hn()}}})};y(O,e=>{o(W)&&o(mt)&&e(k)}),B(n),x(()=>{I(r,1,`app-workspace-shell grid h-screen grid-cols-[292px_minmax(0,1fr)] overflow-hidden ${!o(_t)&&o(wn).open&&!o(wn).expanded?`pr-[20rem]`:``}`),r.inert=o(On)||o(wn).open&&o(wn).expanded?!0:void 0}),i(t,n)};y(Or,e=>{o(De)?o(W)?o(A)?e(Mr,-1):e(jr,2):e(Ar,1):e(kr)}),i(t,Dr),R(),v()}f([`click`]);export{nh as component};
|