@spikonado/sprocket 0.2.1 → 0.2.2
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/package.json +6 -6
- package/web/_app/immutable/assets/0.D2EsWSqR.css +2 -0
- package/web/_app/immutable/chunks/BDPHK7W1.js +1 -0
- package/web/_app/immutable/chunks/{oeLdRRxz.js → xdbz0AN7.js} +1 -1
- package/web/_app/immutable/entry/{app.Db38mZEd.js → app.vgNX-yg1.js} +2 -2
- package/web/_app/immutable/entry/start.Bqs6UEQ0.js +1 -0
- package/web/_app/immutable/nodes/{1.BjRhqcf3.js → 1.rGk9AD5i.js} +1 -1
- package/web/_app/immutable/nodes/2.D6G-En7z.js +121 -0
- package/web/_app/immutable/nodes/{3.CXSe3vNq.js → 3.BSzRfijR.js} +1 -1
- package/web/_app/immutable/nodes/{4.DUhF2sk4.js → 4.Zvlrjxxf.js} +1 -1
- package/web/_app/version.json +1 -1
- package/web/callback.html +10 -10
- package/web/index.html +8 -8
- package/web/pair.html +10 -10
- package/web/_app/immutable/assets/0.CA8CRw5u.css +0 -2
- package/web/_app/immutable/chunks/DxoYRmC6.js +0 -1
- package/web/_app/immutable/entry/start.Bgl6O8TM.js +0 -1
- package/web/_app/immutable/nodes/2.D9M51kgP.js +0 -71
- /package/web/_app/immutable/nodes/{0.j0F6hNbB.js → 0.DkSNvmi3.js} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
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,Q as h,R as g,S as _,T as v,U as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,at as E,b as D,c as ee,d as O,dt as k,et as te,f as A,ft as ne,g as re,i as j,it as M,j as N,k as ie,l as ae,m as P,n as oe,o as F,p as I,pt as se,q as ce,rt as L,s as le,u as R,ut as z,v as B,w as V,x as ue,y as H,z as U}from"../chunks/BrZMY0Kx.js";import{c as de}from"../chunks/xdbz0AN7.js";import"../chunks/xihTtKlq.js";import{a as fe,d as pe,f as me,i as he,l as ge,n as _e,p as W,r as ve,s as ye,t as be,u as xe}from"../chunks/tqyHaQv_.js";import{a as Se,i as Ce,o as we,r as Te}from"../chunks/YGmybFhl.js";import{a as G,i as Ee,n as De,r as Oe,t as ke}from"../chunks/CBOYsvSw.js";import{a as Ae,n as je,o as Me}from"../chunks/B2QV2lSm.js";var Ne=Object.defineProperty,Pe=(e,t,n)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t,n)=>Pe(e,typeof t==`symbol`?t:t+``,n),Fe=`https://docs.convex.dev/error#undefined-validator`;function q(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 ${Fe} for details.`)}var Ie=class{constructor({isOptional:e}){K(this,`type`),K(this,`fieldPaths`),K(this,`isOptional`),K(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},Le=class e extends Ie{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),K(this,`tableName`),K(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})}},Re=class e extends Ie{constructor(){super(...arguments),K(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},ze=class e extends Ie{constructor(){super(...arguments),K(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},Be=class e extends Ie{constructor(){super(...arguments),K(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Ve=class e extends Ie{constructor(){super(...arguments),K(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},He=class e extends Ie{constructor(){super(...arguments),K(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Ue=class e extends Ie{constructor(){super(...arguments),K(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},J=class e extends Ie{constructor(){super(...arguments),K(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},We=class e extends Ie{constructor({isOptional:e,fields:t}){super({isOptional:e}),K(this,`fields`),K(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&q(`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}})}},Y=class e extends Ie{constructor({isOptional:e,value:t}){if(super({isOptional:e}),K(this,`value`),K(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:we(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},Ge=class e extends Ie{constructor({isOptional:e,element:t}){super({isOptional:e}),K(this,`element`),K(this,`kind`,`array`),t===void 0&&q(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},Ke=class e extends Ie{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),K(this,`key`),K(this,`value`),K(this,`kind`,`record`),t===void 0&&q(`v.record()`,`key`),n===void 0&&q(`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})}},qe=class e extends Ie{constructor({isOptional:e,members:t}){super({isOptional:e}),K(this,`members`),K(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&q(`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 Le({isOptional:`required`,tableName:e}),null:()=>new Ue({isOptional:`required`}),number:()=>new Re({isOptional:`required`}),float64:()=>new Re({isOptional:`required`}),bigint:()=>new ze({isOptional:`required`}),int64:()=>new ze({isOptional:`required`}),boolean:()=>new Be({isOptional:`required`}),string:()=>new He({isOptional:`required`}),bytes:()=>new Ve({isOptional:`required`}),literal:e=>new Y({isOptional:`required`,value:e}),array:e=>new Ge({isOptional:`required`,element:e}),object:e=>new We({isOptional:`required`,fields:e}),record:(e,t)=>new Ke({isOptional:`required`,key:e,value:t}),union:(...e)=>new qe({isOptional:`required`,members:e}),any:()=>new J({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>X.union(e,X.null())},Je={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`},Ye=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Xe=Symbol(`lucide-context`),Ze=()=>L(Xe),Qe=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),$e=m(`<svg><!><!></svg>`);function Z(e,t){E(t,!0);let n=Ze()??{},r=j(t,`color`,19,()=>n.color??`currentColor`),i=j(t,`size`,19,()=>n.size??24),o=j(t,`strokeWidth`,19,()=>n.strokeWidth??2),c=j(t,`absoluteStrokeWidth`,19,()=>n.absoluteStrokeWidth??!1),l=j(t,`iconNode`,19,()=>[]),u=T(t,Qe),d=C(()=>c()?Number(o())*24/Number(i()):o());var f=$e();ae(f,e=>({...Je,...e,...u,width:i(),height:i(),stroke:r(),"stroke-width":p(d),class:[`lucide-icon lucide`,n.class,t.name&&`lucide-${t.name}`,t.class]}),[()=>!t.children&&!Ye(u)&&{"aria-hidden":`true`}]);var m=y(f);ue(m,17,l,_,(e,t)=>{var n=C(()=>se(p(t),2));let r=()=>p(n)[0],i=()=>p(n)[1];var o=a();w(b(o),r,!0,(e,t)=>{ae(e,()=>({...i()}))}),v(e,o)}),H(s(m),()=>t.children??ne),k(f),v(e,f),M()}var et=new Set([`$$slots`,`$$events`,`$$legacy`]);function tt(e,t){let n=T(t,et),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,F({name:`archive`},()=>n,{get iconNode(){return r}}))}var nt=new Set([`$$slots`,`$$events`,`$$legacy`]);function rt(e,t){let n=T(t,nt),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];Z(e,F({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var it=new Set([`$$slots`,`$$events`,`$$legacy`]);function at(e,t){let n=T(t,it),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];Z(e,F({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function st(e,t){let n=T(t,ot),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,F({name:`book-open`},()=>n,{get iconNode(){return r}}))}var ct=new Set([`$$slots`,`$$events`,`$$legacy`]);function lt(e,t){let n=T(t,ct),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,F({name:`brain`},()=>n,{get iconNode(){return r}}))}var ut=new Set([`$$slots`,`$$events`,`$$legacy`]);function dt(e,t){let n=T(t,ut),r=[[`path`,{d:`M5 21v-6`}],[`path`,{d:`M12 21V3`}],[`path`,{d:`M19 21V9`}]];Z(e,F({name:`chart-no-axes-column`},()=>n,{get iconNode(){return r}}))}var ft=new Set([`$$slots`,`$$events`,`$$legacy`]);function pt(e,t){let n=T(t,ft),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];Z(e,F({name:`check`},()=>n,{get iconNode(){return r}}))}var mt=new Set([`$$slots`,`$$events`,`$$legacy`]);function ht(e,t){let n=T(t,mt),r=[[`path`,{d:`m6 9 6 6 6-6`}]];Z(e,F({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var gt=new Set([`$$slots`,`$$events`,`$$legacy`]);function _t(e,t){let n=T(t,gt),r=[[`path`,{d:`m9 18 6-6-6-6`}]];Z(e,F({name:`chevron-right`},()=>n,{get iconNode(){return r}}))}var vt=new Set([`$$slots`,`$$events`,`$$legacy`]);function yt(e,t){let n=T(t,vt),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,F({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var bt=new Set([`$$slots`,`$$events`,`$$legacy`]);function xt(e,t){let n=T(t,bt),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,F({name:`code-xml`},()=>n,{get iconNode(){return r}}))}var St=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ct(e,t){let n=T(t,St),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,F({name:`copy`},()=>n,{get iconNode(){return r}}))}var wt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tt(e,t){let n=T(t,wt),r=[[`path`,{d:`M14 9 9 4 4 9`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`}]];Z(e,F({name:`corner-left-up`},()=>n,{get iconNode(){return r}}))}var Et=new Set([`$$slots`,`$$events`,`$$legacy`]);function Dt(e,t){let n=T(t,Et),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,F({name:`download`},()=>n,{get iconNode(){return r}}))}var Ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function kt(e,t){let n=T(t,Ot),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,F({name:`external-link`},()=>n,{get iconNode(){return r}}))}var At=new Set([`$$slots`,`$$events`,`$$legacy`]);function jt(e,t){let n=T(t,At),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,F({name:`eye`},()=>n,{get iconNode(){return r}}))}var Mt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nt(e,t){let n=T(t,Mt),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,F({name:`file-code`},()=>n,{get iconNode(){return r}}))}var Pt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ft(e,t){let n=T(t,Pt),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,F({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var It=new Set([`$$slots`,`$$events`,`$$legacy`]);function Lt(e,t){let n=T(t,It),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,F({name:`file-text`},()=>n,{get iconNode(){return r}}))}var Rt=new Set([`$$slots`,`$$events`,`$$legacy`]);function zt(e,t){let n=T(t,Rt),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,F({name:`folder-open`},()=>n,{get iconNode(){return r}}))}var Bt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vt(e,t){let n=T(t,Bt),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,F({name:`folder-plus`},()=>n,{get iconNode(){return r}}))}var Ht=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ut(e,t){let n=T(t,Ht),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,F({name:`folder`},()=>n,{get iconNode(){return r}}))}var Wt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gt(e,t){let n=T(t,Wt),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,F({name:`globe`},()=>n,{get iconNode(){return r}}))}var Kt=new Set([`$$slots`,`$$events`,`$$legacy`]);function qt(e,t){let n=T(t,Kt),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,F({name:`hourglass`},()=>n,{get iconNode(){return r}}))}var Jt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yt(e,t){let n=T(t,Jt),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,F({name:`image-plus`},()=>n,{get iconNode(){return r}}))}var Xt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zt(e,t){let n=T(t,Xt),r=[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]];Z(e,F({name:`loader-circle`},()=>n,{get iconNode(){return r}}))}var Qt=new Set([`$$slots`,`$$events`,`$$legacy`]);function $t(e,t){let n=T(t,Qt),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,F({name:`lock`},()=>n,{get iconNode(){return r}}))}var en=new Set([`$$slots`,`$$events`,`$$legacy`]);function tn(e,t){let n=T(t,en),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,F({name:`log-out`},()=>n,{get iconNode(){return r}}))}var nn=new Set([`$$slots`,`$$events`,`$$legacy`]);function rn(e,t){let n=T(t,nn),r=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`m21 3-7 7`}],[`path`,{d:`m3 21 7-7`}],[`path`,{d:`M9 21H3v-6`}]];Z(e,F({name:`maximize-2`},()=>n,{get iconNode(){return r}}))}var an=new Set([`$$slots`,`$$events`,`$$legacy`]);function on(e,t){let n=T(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,F({name:`moon`},()=>n,{get iconNode(){return r}}))}var sn=new Set([`$$slots`,`$$events`,`$$legacy`]);function cn(e,t){let n=T(t,sn),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,F({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var ln=new Set([`$$slots`,`$$events`,`$$legacy`]);function un(e,t){let n=T(t,ln),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}]];Z(e,F({name:`panel-right`},()=>n,{get iconNode(){return r}}))}var dn=new Set([`$$slots`,`$$events`,`$$legacy`]);function fn(e,t){let n=T(t,dn),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,F({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var pn=new Set([`$$slots`,`$$events`,`$$legacy`]);function mn(e,t){let n=T(t,pn),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];Z(e,F({name:`search`},()=>n,{get iconNode(){return r}}))}var hn=new Set([`$$slots`,`$$events`,`$$legacy`]);function gn(e,t){let n=T(t,hn),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,F({name:`settings`},()=>n,{get iconNode(){return r}}))}var _n=new Set([`$$slots`,`$$events`,`$$legacy`]);function vn(e,t){let n=T(t,_n),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,F({name:`square-pen`},()=>n,{get iconNode(){return r}}))}var yn=new Set([`$$slots`,`$$events`,`$$legacy`]);function bn(e,t){let n=T(t,yn),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,F({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var xn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sn(e,t){let n=T(t,xn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];Z(e,F({name:`square`},()=>n,{get iconNode(){return r}}))}var Cn=new Set([`$$slots`,`$$events`,`$$legacy`]);function wn(e,t){let n=T(t,Cn),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,F({name:`sun`},()=>n,{get iconNode(){return r}}))}var Tn=new Set([`$$slots`,`$$events`,`$$legacy`]);function En(e,t){let n=T(t,Tn),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];Z(e,F({name:`terminal`},()=>n,{get iconNode(){return r}}))}var Dn=new Set([`$$slots`,`$$events`,`$$legacy`]);function On(e,t){let n=T(t,Dn),r=[[`circle`,{cx:`12`,cy:`8`,r:`5`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`}]];Z(e,F({name:`user-round`},()=>n,{get iconNode(){return r}}))}var kn=new Set([`$$slots`,`$$events`,`$$legacy`]);function An(e,t){let n=T(t,kn),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,F({name:`wrench`},()=>n,{get iconNode(){return r}}))}var jn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mn(e,t){let n=T(t,jn),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];Z(e,F({name:`x`},()=>n,{get iconNode(){return r}}))}var Nn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pn(e,t){let n=T(t,Nn),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,F({name:`zap`},()=>n,{get iconNode(){return r}}))}var Fn=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],In=[`difference`,`intersection`,`symmetricDifference`,`union`],Ln=!1,Rn=class e extends Set{#e=new Map;#t=x(0);#n=x(0);#r=d||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}Ln||this.#a()}#i(e){return d===this.#r?x(e):S(e)}#a(){Ln=!0;var t=e.prototype,n=Set.prototype;for(let e of Fn)t[e]=function(...t){return p(this.#t),n[e].apply(this,t)};for(let r of In)t[r]=function(...t){p(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 p(this.#t),!1;r=this.#i(!0),n.set(e,r)}return p(r),t}add(e){return super.has(e)||(super.add(e),l(this.#n,super.size),ce(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),l(r,!1)),t&&(l(this.#n,super.size),ce(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())l(t,!1);e.clear(),l(this.#n,0),ce(this.#t)}}keys(){return this.values()}values(){return p(this.#t),super.values()}entries(){return p(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return p(this.#n)}},zn=class extends Map{#e=new Map;#t=x(0);#n=x(0);#r=d||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return d===this.#r?x(e):S(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 p(this.#t),!1;return p(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{p(this.#t);return}return p(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),l(this.#n,super.size),ce(o);else if(i!==t){ce(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&ce(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),l(n,-1)),r&&(l(this.#n,super.size),ce(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;l(this.#n,0);for(var t of e.values())l(t,-1);ce(this.#t),e.clear()}}#a(){p(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)p(n)}keys(){return p(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return p(this.#n),super.size}},Bn=2e4,Vn=i(`<a><!></a>`),Hn=i(`<button><!></button>`);function Un(e,t){E(t,!0);let n=j(t,`type`,3,`button`),i=j(t,`variant`,3,`default`),o=j(t,`className`,3,``),s=j(t,`disabled`,3,!1),c=C(()=>i()===`outline`?`border-border bg-surface/80 text-foreground hover:bg-hover-fill`:`bg-primary text-primary-foreground hover:opacity-90`),l=C(()=>G(`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`,p(c),o()));var u=a(),d=b(u),f=e=>{var n=Vn();H(y(n),()=>t.children??ne),k(n),U(()=>{O(n,`href`,t.href),I(n,1,P(p(l)))}),N(`click`,n,function(...e){t.onclick?.apply(this,e)}),v(e,n)},m=e=>{var r=Hn();H(y(r),()=>t.children??ne),k(r),U(()=>{O(r,`type`,n()),r.disabled=s(),I(r,1,P(p(l)))}),N(`click`,r,function(...e){t.onclick?.apply(this,e)}),v(e,r)};r(d,e=>{t.href&&!s()?e(f):e(m,-1)}),v(e,u),M()}t([`click`]);var Wn=i(`<!> <!>`,1),Gn=i(`<p class="text-destructive text-center text-sm" role="alert"> </p>`),Kn=i(`<div class="text-muted-foreground flex items-center justify-center gap-2 text-sm" aria-live="polite" aria-busy="true"><!> <span> </span></div>`),qn=i(`<div><!></div>`);function Jn(e,t){E(t,!0);let n=j(t,`overlayOpen`,3,!1),i=C(()=>t.authState.isAuthenticated&&(t.authState.isLoading||!t.authState.connectionFailed)),o=C(()=>!t.authState.isAuthenticated&&t.authState.isLoading),c=C(()=>t.authState.isConfigured?p(i)?`Confirming your session`:t.authState.connectionFailed?`Couldn’t connect your account`:p(o)?`Preparing sign-in`:`Sign in to continue`:`Sign-in unavailable`),l=C(()=>t.authState.isConfigured?p(i)?`Verifying your secure connection before opening your projects.`:t.authState.connectionFailed?`You’re signed in, but the secure connection could not be confirmed. Retry or sign out and sign in again.`:p(o)?`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.`),u=C(()=>t.authState.isAuthenticated?`Almost there`:`One moment`),d=C(()=>!!(t.authState.isConfigured&&t.authState.error&&!n()));var f=qn();ke(y(f),{get title(){return p(c)},get description(){return p(l)},actions:e=>{var n=a(),i=b(n),o=e=>{var n=Wn(),i=b(n),a=e=>{Un(e,{get onclick(){return t.onRetry},get disabled(){return t.authState.isLoading},children:(e,t)=>{z(),v(e,ie(`Retry`))},$$slots:{default:!0}})};r(i,e=>{t.authState.connectionFailed&&e(a)}),Un(s(i,2),{variant:`outline`,get onclick(){return t.onSignOut},children:(e,t)=>{z(),v(e,ie(`Sign Out`))},$$slots:{default:!0}}),v(e,n)},c=e=>{var n=Wn(),r=b(n);Un(r,{get onclick(){return t.onSignIn},get disabled(){return t.authState.isLoading},children:(e,t)=>{z(),v(e,ie(`Sign In`))},$$slots:{default:!0}}),Un(s(r,2),{variant:`outline`,get onclick(){return t.onSignUp},get disabled(){return t.authState.isLoading},children:(e,t)=>{z(),v(e,ie(`Create Account`))},$$slots:{default:!0}}),v(e,n)};r(i,e=>{t.authState.isAuthenticated?e(o):t.authState.isConfigured&&e(c,1)}),v(e,n)},children:(e,n)=>{var i=Wn(),a=b(i),o=e=>{var n=Gn(),r=y(n,!0);k(n),U(()=>V(r,t.authState.error)),v(e,n)};r(a,e=>{p(d)&&e(o)});var c=s(a,2),l=e=>{var t=Kn(),n=y(t);Zt(n,{class:`size-3.5 animate-spin`,"aria-hidden":`true`});var r=s(n,2),i=y(r,!0);k(r),k(t),U(()=>V(i,p(u))),v(e,t)};r(c,e=>{t.authState.isLoading&&e(l)}),v(e,i)},$$slots:{actions:!0,default:!0}}),k(f),U(()=>{f.inert=n(),O(f,`aria-hidden`,n()?!0:void 0)}),v(e,f),M()}var Yn=i(`<div class="text-muted-foreground mb-4 flex justify-center" aria-hidden="true"><!></div>`),Xn=i(`<p class="text-muted-foreground mt-6 max-h-24 overflow-y-auto font-mono text-[11px] leading-5 break-all select-all"> </p>`),Zn=i(`<p class="text-destructive mt-4 text-sm" role="alert"> </p>`),Qn=i(`<p class="mt-4 text-sm text-amber-700" role="alert"> </p>`),$n=i(`<!> Open browser`,1),er=i(`<!> Copied`,1),tr=i(`<!> Copy link`,1),nr=i(`<!> <!>`,1),rr=i(`<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>`),ir=i(`<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 ar(e,t){E(t,!0);let i=j(t,`error`,3,null),c=x(!1),u=x(null),d=x(null),f=null;n(()=>{if(!t.open){l(c,!1),l(u,null);return}let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=!1;o().then(()=>{n||p(d)?.focus()});function r(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onCancel();return}if(e.key!==`Tab`||!p(d))return;let n=Array.from(p(d).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(n.length===0){e.preventDefault(),p(d).focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===p(d)||a===r||!p(d).contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===p(d)||a===i||!p(d).contains(a))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,r,!0),()=>{n=!0,window.removeEventListener(`keydown`,r,!0),f!==null&&(window.clearTimeout(f),f=null),e?.isConnected&&e.focus()}});async function m(){if(t.signInUrl)try{await navigator.clipboard.writeText(t.signInUrl),l(c,!0),l(u,null),f!==null&&window.clearTimeout(f),f=window.setTimeout(()=>{l(c,!1),f=null},2e3)}catch{l(c,!1),l(u,`Could not copy the sign-in link. Select it above and copy manually.`)}}function h(){if(!t.signInUrl)return;let e=window.open(t.signInUrl,`_blank`);if(e){try{e.opener=null}catch{}t.onClearOpenError?.()}}let g=C(()=>t.signInUrl?i()?{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 _=a(),S=b(_),w=e=>{var n=ir(),o=y(n),f=y(o),_=e=>{var t=Yn();Zt(y(t),{class:`size-5 animate-spin`}),k(t),v(e,t)};r(f,e=>{t.signInUrl||e(_)});var x=s(f,2),S=y(x,!0);k(x);var C=s(x,2),w=y(C,!0);k(C);var T=s(C,2),E=e=>{var n=Xn(),r=y(n,!0);k(n),U(()=>{O(n,`title`,t.signInUrl),V(r,t.signInUrl)}),v(e,n)};r(T,e=>{t.signInUrl&&e(E)});var D=s(T,2),ee=e=>{var t=Zn(),n=y(t,!0);k(t),U(()=>V(n,i())),v(e,t)};r(D,e=>{i()&&e(ee)});var te=s(D,2),A=e=>{var t=Qn(),n=y(t,!0);k(t),U(()=>V(n,p(u))),v(e,t)};r(te,e=>{p(u)&&e(A)});var ne=s(te,2),re=y(ne),j=e=>{var t=nr(),n=b(t);Un(n,{onclick:h,children:(e,t)=>{var n=$n();kt(b(n),{class:`size-4`,"aria-hidden":`true`}),z(),v(e,n)},$$slots:{default:!0}}),Un(s(n,2),{variant:`outline`,onclick:()=>void m(),children:(e,t)=>{var n=a(),i=b(n),o=e=>{var t=er();pt(b(t),{class:`size-4`,"aria-hidden":`true`}),z(),v(e,t)},s=e=>{var t=tr();Ct(b(t),{class:`size-4`,"aria-hidden":`true`}),z(),v(e,t)};r(i,e=>{p(c)?e(o):e(s,-1)}),v(e,n)},$$slots:{default:!0}}),v(e,t)},M=e=>{v(e,rr())};r(re,e=>{t.signInUrl?e(j):e(M,-1)}),k(ne);var ie=s(ne,2),ae=y(ie);k(ie),k(o),le(o,e=>l(d,e),()=>p(d)),k(n),U(()=>{V(S,p(g).title),V(w,p(g).description)}),N(`click`,n,e=>{e.target===e.currentTarget&&t.onCancel()}),N(`click`,ae,function(...e){t.onCancel?.apply(this,e)}),v(e,n)};r(S,e=>{t.open&&e(w)}),v(e,_),M()}t([`click`]);function or(){let e=x(null),t=x(!1),r=null;function i(){r&&=(clearTimeout(r),null)}function a(n,a,o=!1){let s=n.currentTarget;if(!(s instanceof HTMLElement))return;let c=s.getBoundingClientRect();i(),l(t,o,!0),l(e,{top:c.top-8,left:c.left+c.width/2,label:a},!0),o&&(r=setTimeout(()=>{l(t,!1),r=null,l(e,null)},2500))}function o(n=!1){p(t)&&!n||(i(),l(t,!1),l(e,null))}return n(()=>i),{get lockTooltip(){return p(e)},showLockTooltip:a,hideLockTooltip:o}}function sr(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 cr=i(`<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){E(t,!0);var n=a(),i=b(n),o=e=>{var n=cr(),r=y(n,!0);k(n),U(()=>{A(n,`top: ${t.tooltip.top}px; left: ${t.tooltip.left}px;`),V(r,t.tooltip.label)}),v(e,n)};r(i,e=>{t.tooltip&&e(o)}),v(e,n),M()}var ur=i(`<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>`),dr=i(`<p class="text-muted-foreground px-3 pt-1 pb-2 text-[11px] font-medium"> </p>`),fr=i(`<span><!></span>`),pr=i(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),mr=i(`<button type="button"><!> <span> </span> <!></button>`),hr=i(`<p class="text-muted-foreground px-3 py-5 text-center text-sm">No matches found</p>`),gr=i(`<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>`),_r=i(`<div><button type="button" aria-haspopup="dialog"><!> <span class="truncate"> </span> <!></button> <!></div> <!>`,1);function vr(e,t){E(t,!0);let i=j(t,`value`,15,``),o=j(t,`disabled`,3,!1),c=j(t,`className`,3,``),u=j(t,`triggerClassName`,3,``),d=j(t,`searchable`,3,!1),m=x(!1),h=x(``),g=x(null),_=x(null),S=x(null),w=or(),T=C(()=>{let e=t.options.find(e=>e.id===i());return e&&!e.locked?e:t.options.find(e=>!e.locked)??e??t.options[0]??null}),D=C(()=>d()&&p(h).trim()?t.options.filter(e=>e.label.toLocaleLowerCase().includes(p(h).trim().toLocaleLowerCase())):t.options),te=C(()=>p(D).filter(e=>!e.locked));function A(){o()||(l(m,!p(m)),p(m)&&d()?queueMicrotask(()=>p(S)?.focus()):l(h,``))}function ne(e,n){let r=t.options.find(t=>t.id===e);if(r){if(r.locked){n&&r.lockTooltip&&w.showLockTooltip(n,r.lockTooltip,!0);return}e!==i()&&(i(e),t.onValueChange?.(e)),l(m,!1),l(h,``),w.hideLockTooltip(!0),p(_)?.focus()}}function re(e){e.key!==`Enter`||p(te).length===0||(e.preventDefault(),ne(p(te)[0].id))}n(()=>{if(!p(m)){l(h,``),w.hideLockTooltip();return}return sr({getRoot:()=>p(g),onOutside:()=>{l(m,!1)},onEscape:()=>{l(m,!1),p(_)?.focus()}})}),n(()=>{o()&&l(m,!1)});var ie=_r(),ae=b(ie),oe=y(ae),F=y(oe),se=e=>{var n=a();H(b(n),()=>t.optionIcon,()=>p(T)),v(e,n)};r(F,e=>{t.optionIcon&&p(T)&&e(se)});var ce=s(F,2),L=y(ce,!0);k(ce);var z=s(ce,2);{let e=C(()=>G(`text-muted-foreground size-3 shrink-0 transition-transform`,p(m)&&`rotate-180`));ht(z,{get class(){return p(e)}})}k(oe),le(oe,e=>l(_,e),()=>p(_));var B=s(oe,2),de=e=>{var n=gr(),a=y(n),o=e=>{var n=ur(),r=y(n);mn(r,{class:`size-4 shrink-0`});var i=s(r,2),a=y(i);k(i);var o=s(i,2);R(o),le(o,e=>l(S,e),()=>p(S)),k(n),U((e,t)=>{V(a,`Search ${e??``}`),O(o,`placeholder`,t)},[()=>t.menuTitle.toLocaleLowerCase(),()=>`Search ${t.menuTitle.toLocaleLowerCase()}…`]),N(`keydown`,o,re),ee(o,()=>p(h),e=>l(h,e)),v(e,n)},c=e=>{var n=dr(),r=y(n,!0);k(n),U(()=>V(r,t.menuTitle)),v(e,n)};r(a,e=>{d()?e(o):e(c,-1)});var u=s(a,2),m=y(u);ue(m,17,()=>p(D),e=>e.id,(e,n)=>{let a=C(()=>!!p(n).locked);var o=mr(),c=y(o),l=e=>{var r=fr();H(y(r),()=>t.optionIcon,()=>p(n)),k(r),U(e=>I(r,1,e),[()=>P(G(`flex size-7 shrink-0 items-center justify-center`,(p(a),`text-muted-foreground`)))]),v(e,r)};r(c,e=>{t.optionIcon&&e(l)});var u=s(c,2),d=y(u,!0);k(u);var m=s(u,2),h=e=>{var t=pr();$t(y(t),{class:`size-3.5`}),k(t),v(e,t)},g=e=>{{let t=C(()=>G(`text-accent-strong size-4 shrink-0 transition-opacity`,p(n).id===i()?`opacity-100`:`opacity-0`));pt(e,{get class(){return p(t)}})}};r(m,e=>{p(a)?e(h):e(g,-1)}),k(o),U((e,t)=>{I(o,1,e),O(o,`aria-pressed`,!p(a)&&p(n).id===i()),O(o,`aria-disabled`,p(a)),O(o,`aria-label`,p(a)&&p(n).lockTooltip?`${p(n).label}. ${p(n).lockTooltip}`:void 0),I(u,1,t),V(d,p(n).label)},[()=>P(G(`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`,p(a)?`cursor-not-allowed opacity-45`:`hover:bg-hover-fill`,!p(a)&&p(n).id===i()&&`bg-hover-fill`)),()=>P(G(`min-w-0 flex-1 truncate text-sm font-medium`,p(a)?`text-muted-foreground`:`text-foreground`))]),f(`mouseenter`,o,e=>{p(a)&&p(n).lockTooltip&&w.showLockTooltip(e,p(n).lockTooltip)}),f(`mouseleave`,o,()=>w.hideLockTooltip()),f(`focus`,o,e=>{p(a)&&p(n).lockTooltip&&w.showLockTooltip(e,p(n).lockTooltip)}),f(`blur`,o,()=>w.hideLockTooltip()),N(`click`,o,e=>{ne(p(n).id,e)}),v(e,o)});var g=s(m,2),_=e=>{v(e,hr())};r(g,e=>{p(D).length===0&&e(_)}),k(u),k(n),U(e=>{O(n,`aria-label`,t.menuTitle),I(u,1,e)},[()=>P(G(`space-y-0.5`,d()&&`pt-1.5`))]),v(e,n)};r(B,e=>{p(m)&&e(de)}),k(ae),le(ae,e=>l(g,e),()=>p(g)),lr(s(ae,2),{get tooltip(){return w.lockTooltip}}),U((e,n)=>{I(ae,1,e),I(oe,1,n),O(oe,`aria-expanded`,p(m)),O(oe,`aria-label`,t.ariaLabel),oe.disabled=o(),V(L,p(T)?.triggerLabel??p(T)?.label??i())},[()=>P(G(`relative`,c())),()=>P(G(`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`,!t.optionIcon&&`gap-1`,u()))]),N(`click`,oe,A),v(e,ie),M()}t([`click`,`keydown`]);var yr=m(`<title> </title>`),br=m(`<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 xr(e,t){E(t,!0);let n=j(t,`className`,3,``),i=j(t,`title`,3,`OpenAI`);var a=br(),o=y(a),s=e=>{var t=yr(),n=y(t,!0);k(t),U(()=>V(n,i())),v(e,t)};r(o,e=>{i()&&e(s)}),z(),k(a),U(e=>{I(a,0,e),O(a,`aria-hidden`,!i()||void 0)},[()=>P(G(`size-4`,n()))]),v(e,a),M()}var Sr=m(`<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>`),Cr=m(`<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>`),wr=m(`<svg viewBox="0 0 24 24" role="img" aria-label="Moonshot" fill="currentColor" fill-rule="evenodd"><path d="M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"></path></svg>`),Tr=m(`<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 Er(e,t){E(t,!0);let n=j(t,`className`,3,``);var i=a(),o=b(i),s=e=>{{let t=C(()=>G(`size-4 text-foreground`,n()));xr(e,{get className(){return p(t)}})}},c=e=>{var t=Sr();U(e=>I(t,0,e),[()=>P(G(`size-4 text-[#D97757]`,n()))]),v(e,t)},l=e=>{var t=Cr();U(e=>I(t,0,e),[()=>P(G(`text-foreground size-4`,n()))]),v(e,t)},u=e=>{var t=wr();U(e=>I(t,0,e),[()=>P(G(`text-foreground size-4`,n()))]),v(e,t)},d=e=>{var r=Tr();U(e=>{I(r,0,e),O(r,`aria-label`,t.provider||`Unknown provider`)},[()=>P(G(`text-muted-foreground size-4`,n()))]),v(e,r)};r(o,e=>{t.provider===`openai`?e(s):t.provider===`anthropic`?e(c,1):t.provider===`xai`?e(l,2):t.provider===`fireworks`?e(u,3):e(d,-1)}),v(e,i),M()}var Dr=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],Or=[`standard`,`fast`],kr=[`gpt-5.6-sol`,`gpt-5.6-terra`,`gpt-5.6-luna`,`claude-opus-5`,`claude-fable-5`,`grok-4.5`,`kimi-k3`],Ar=[{id:`gpt-5.6-sol`,label:`GPT-5.6 Sol`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:Dr,defaultReasoningEffort:`medium`,serviceTiers:Or,usageWeights:{input:.005,cacheRead:5e-4,cacheWrite:.00625,output:.03,fastMultiplier:2}},{id:`gpt-5.6-terra`,label:`GPT-5.6 Terra`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:Dr,defaultReasoningEffort:`medium`,serviceTiers:Or,usageWeights:{input:.0025,cacheRead:25e-5,cacheWrite:.003125,output:.015,fastMultiplier:2}},{id:`gpt-5.6-luna`,label:`GPT-5.6 Luna`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:Dr,defaultReasoningEffort:`medium`,serviceTiers:Or,usageWeights:{input:.001,cacheRead:1e-4,cacheWrite:.00125,output:.006,fastMultiplier:2}},{id:`claude-opus-5`,label:`Claude Opus 5`,provider:`anthropic`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`medium`,`high`,`xhigh`,`max`],defaultReasoningEffort:`high`,serviceTiers:Or,usageWeights:{input:.005,cacheRead:5e-4,cacheWrite:.00625,output:.025,fastMultiplier:2}},{id:`claude-fable-5`,label:`Claude Fable 5`,provider:`anthropic`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`medium`,`high`,`xhigh`,`max`],defaultReasoningEffort:`high`,serviceTiers:Or,usageWeights:{input:.01,cacheRead:.001,cacheWrite:.0125,output:.05,fastMultiplier:1}},{id:`grok-4.5`,label:`Grok 4.5`,provider:`xai`,contextWindowTokens:5e5,autoCompactTokenLimit:4e5,reasoningEfforts:[`low`,`medium`,`high`],defaultReasoningEffort:`high`,serviceTiers:Or,usageWeights:{input:.002,cacheRead:5e-4,cacheWrite:.002,output:.006,fastMultiplier:2}},{id:`kimi-k3`,label:`Kimi K3`,provider:`fireworks`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`high`,`max`],defaultReasoningEffort:`max`,serviceTiers:Or,usageWeights:{input:.003,cacheRead:3e-4,cacheWrite:.003,output:.015,fastMultiplier:1.5}}],jr=`gpt-5.6-sol`,Mr=Pr(jr).defaultReasoningEffort,Nr=`standard`;function Pr(e){let t=Ar.find(t=>t.id===e);if(!t)throw Error(`Unsupported model: ${e}`);return t}function Fr(e){return e}function Ir(e,t){return e.models.find(e=>e.id===t)}function Lr(e,t,n){return(e.tierAllowedModels[t]??[]).includes(n)}function Rr(e,t,n){return Lr(e,t,n)?n:e.tierAllowedModels[t]?.[0]??e.defaultModelId}function zr(e,t,n){return(e.tierAllowedServiceTiers[t]??[]).includes(n)}function Br(e,t,n){return n.serviceTiers.filter(n=>zr(e,t,n))}function Vr(e,t,n){return n.serviceTiers.map(n=>{let r={id:n,label:Kr(n)};return zr(e,t,n)?r:{...r,locked:!0,lockTooltip:e.serviceTierLockUpgradeMessage}})}function Hr(e,t){let n=[],r=[];for(let i of e.models){let a={id:i.id,label:i.label,provider:i.provider};Lr(e,t,i.id)?n.push(a):r.push({...a,locked:!0,lockTooltip:e.modelLockUpgradeMessage})}return[...n,...r]}var Ur={none:`None`,low:`Low`,medium:`Medium`,high:`High`,xhigh:`Extra High`,max:`Max`},Wr={standard:`Standard`,fast:`Fast`};function Gr(e){return Ur[e]??e}function Kr(e){return Wr[e]??e}var qr=i(`<span class="text-muted-foreground ml-auto text-xs">Default</span>`),Jr=i(`<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>`),Yr=i(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Xr=i(`<button type="button"><!> <!> <span> </span> <!></button>`),Zr=i(`<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>`),Qr=i(`<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 $r(e,t){E(t,!0);let i=j(t,`reasoningEffort`,31,()=>u(Mr)),a=j(t,`serviceTier`,31,()=>u(Nr)),o=j(t,`disabled`,3,!1),c=j(t,`className`,3,``),d=C(()=>t.serviceTierOptions?t.serviceTierOptions:t.model.serviceTiers.map(e=>({id:e,label:Kr(e)}))),m=C(()=>p(d).filter(e=>!e.locked).map(e=>e.id)),h=x(!1),g=x(null),_=x(null),S=or();function w(e){i(e)}function T(e,t){let n=p(d).find(t=>t.id===e);if(n){if(n.locked){t&&n.lockTooltip&&S.showLockTooltip(t,n.lockTooltip,!0);return}a(e)}}n(()=>{t.model.reasoningEfforts.includes(i())||i(t.model.defaultReasoningEffort),p(m).includes(a())||a(p(m)[0]??`standard`)}),n(()=>{if(!p(h)){S.hideLockTooltip();return}return sr({getRoot:()=>p(g),onOutside:()=>{l(h,!1)},onEscape:()=>{l(h,!1),p(_)?.focus()}})}),n(()=>{o()&&l(h,!1)});var D=Qr(),ee=b(D),te=y(ee),A=y(te),ne=y(A);k(A);var re=s(A,2);{let e=C(()=>G(`text-muted-foreground size-3 shrink-0 transition-transform`,p(h)&&`rotate-180`));ht(re,{get class(){return p(e)}})}k(te),le(te,e=>l(_,e),()=>p(_));var ie=s(te,2),ae=e=>{var n=Zr(),o=s(y(n),2);ue(o,20,()=>t.model.reasoningEfforts,e=>e,(e,n)=>{var a=Jr(),o=y(a);{let e=C(()=>G(`size-4 shrink-0 transition-opacity`,n===i()?`opacity-100`:`opacity-0`));pt(o,{get class(){return p(e)}})}var c=s(o,2),l=y(c,!0);k(c);var u=s(c,2),d=e=>{v(e,qr())};r(u,e=>{n===t.model.defaultReasoningEffort&&e(d)}),k(a),U(e=>{O(a,`aria-pressed`,n===i()),V(l,e)},[()=>Gr(n)]),N(`click`,a,()=>w(n)),v(e,a)}),k(o);var c=s(o,6);ue(c,21,()=>p(d),e=>e.id,(e,t)=>{let n=C(()=>!!p(t).locked);var i=Xr(),o=y(i),c=e=>{var t=Yr();$t(y(t),{class:`size-3.5`}),k(t),v(e,t)},l=e=>{{let n=C(()=>G(`size-4 shrink-0 transition-opacity`,p(t).id===a()?`opacity-100`:`opacity-0`));pt(e,{get class(){return p(n)}})}};r(o,e=>{p(n)?e(c):e(l,-1)});var u=s(o,2),d=e=>{Pn(e,{class:`size-3.5 shrink-0 text-amber-400`})};r(u,e=>{p(t).id===`fast`&&e(d)});var h=s(u,2),g=y(h,!0);k(h);var _=s(h,2),b=e=>{v(e,qr())};r(_,e=>{!p(n)&&p(t).id===p(m)[0]&&e(b)}),k(i),U((e,r)=>{I(i,1,e),O(i,`aria-pressed`,!p(n)&&p(t).id===a()),O(i,`aria-disabled`,p(n)),O(i,`aria-label`,p(n)&&p(t).lockTooltip?`${p(t).label}. ${p(t).lockTooltip}`:void 0),I(h,1,r),V(g,p(t).label)},[()=>P(G(`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`,p(n)?`cursor-not-allowed opacity-45`:`text-foreground hover:bg-hover-fill`)),()=>P(G(p(n)&&`text-muted-foreground`))]),f(`mouseenter`,i,e=>{p(n)&&p(t).lockTooltip&&S.showLockTooltip(e,p(t).lockTooltip)}),f(`mouseleave`,i,()=>S.hideLockTooltip()),f(`focus`,i,e=>{p(n)&&p(t).lockTooltip&&S.showLockTooltip(e,p(t).lockTooltip)}),f(`blur`,i,()=>S.hideLockTooltip()),N(`click`,i,e=>T(p(t).id,e)),v(e,i)}),k(c),k(n),v(e,n)};r(ie,e=>{p(h)&&e(ae)}),k(ee),le(ee,e=>l(g,e),()=>p(g)),lr(s(ee,2),{get tooltip(){return S.lockTooltip}}),U((e,t,n)=>{I(ee,1,e),O(te,`aria-expanded`,p(h)),te.disabled=o(),V(ne,`${t??``} · ${n??``}`)},[()=>P(G(`relative`,c())),()=>Gr(i()),()=>Kr(a())]),N(`click`,te,()=>{l(h,!p(h))}),v(e,D),M()}t([`click`]);function ei(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}var ti=/(^|\s)\$([a-z0-9-]*)$/i;function ni(e,t){if(t<0||t>e.length)return null;let n=e.slice(0,t).match(ti);return!n||n.index===void 0?null:{query:n[2].toLowerCase(),tokenStart:n.index+n[1].length}}function ri(e,t){return ni(e,t)?.query??null}function ii(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 ai(e,t,n){let r=ni(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}}var oi=`agent_decide`;function si(e){return!!e.selectedOptionId?.trim()||!!e.text.trim()}function ci(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}var li=X.union(X.string(),X.number(),X.boolean(),X.null()),ui=8;function di(e){return e===0?li:X.union(li,X.array(di(e-1)),X.record(X.string(),di(e-1)))}var fi=di(ui),pi=[`free`,`pro`,`admin`],mi={free:`Free`,pro:`Pro`,admin:`Admin`},hi={modelUsage:{weekly:5e3,monthly:15e3},webTools:{weekly:500,monthly:1500}};hi.modelUsage.weekly*5,hi.modelUsage.monthly*5,hi.webTools.weekly*5,hi.webTools.monthly*5;function gi(e){return e.map(e=>X.literal(e))}X.union(...gi(Dr)),X.union(...gi(Or)),X.union(...gi(kr)),X.union(...gi(pi)),X.union(X.literal(`active`),X.literal(`on_hold`),X.literal(`cancelled`),X.literal(`expired`),X.literal(`failed`));var _i=X.object({path:X.string(),directory:X.string(),contents:X.string(),truncated:X.boolean()}),vi=X.object({patch:X.string()}),yi=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())}),bi=X.object({url:X.string()}),xi=X.object({query:X.string(),numResults:X.optional(X.number())}),Si=X.object({sessionId:X.string(),chars:X.optional(X.string()),terminate:X.optional(X.boolean()),yieldTimeMs:X.optional(X.number())}),Ci=X.union(X.literal(`markdown`),X.literal(`html`),X.literal(`react`)),wi=X.object({title:X.string(),contentType:Ci,content:X.string()}),Ti=X.object({artifactId:X.string(),content:X.string()}),Ei=X.object({name:X.string()}),Di=X.object({id:X.string(),label:X.string()}),Oi=X.object({question:X.string(),options:X.array(Di),yieldTimeMs:X.optional(X.number()),timeoutMs:X.optional(X.number())}),ki=X.object({questionId:X.id(`agentQuestions`),yieldTimeMs:X.optional(X.number())});X.union(X.object({}),vi,Oi,ki,yi,Ei,bi,xi,Si,wi,Ti);var Ai=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`))}))}),ji=X.object({command:X.string(),cwd:X.string(),sessionId:X.optional(X.string()),exitCode:X.optional(X.number()),success:X.boolean(),running:X.boolean(),timedOut:X.boolean(),stdout:X.string(),stderr:X.string(),output:X.string(),truncated:X.boolean(),error:X.optional(X.string())}),Mi=X.object({url:X.string(),markdown:X.string(),truncated:X.boolean()}),Ni=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())}))}),Pi=X.object({name:X.string(),description:X.string(),content:X.string(),dir:X.optional(X.string()),truncated:X.optional(X.boolean())}),Fi=X.object({optionId:X.optional(X.string()),optionLabel:X.optional(X.string()),text:X.optional(X.string())}),Ii=X.object({questionId:X.id(`agentQuestions`),question:X.string(),options:X.array(Di),pending:X.boolean(),timedOut:X.boolean(),answer:X.optional(Fi)}),Li=X.object({artifactId:X.string(),version:X.number(),title:X.optional(X.string()),contentType:X.optional(Ci)});X.union(X.string(),X.array(_i),Ai,Ii,ji,Pi,Mi,Ni,Li),X.union(X.literal(`disconnected`),X.literal(`connected`)),X.union(X.literal(`queued`),X.literal(`running`),X.literal(`awaiting_executor`),X.literal(`completed`),X.literal(`failed`),X.literal(`cancelled`));var Ri=[`cancelled`,`completed`,`failed`];X.union(...gi(Ri));function zi(e){return Ri.includes(e)}X.union(X.literal(`apply_patch`),X.literal(`ask_question`),X.literal(`await_question`),X.literal(`exec_command`),X.literal(`get_workspace_instructions`),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 Bi=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],Vi=`10 MiB`,Hi=X.object({type:X.literal(`text`),id:X.string(),text:X.string(),turnId:X.optional(X.string()),providerMetadata:X.optional(fi)}),Ui=X.object({type:X.literal(`reasoning`),id:X.string(),text:X.string(),turnId:X.optional(X.string()),providerMetadata:X.optional(fi)}),Wi=X.object({type:X.literal(`tool-call`),partId:X.optional(X.string()),callId:X.string(),name:X.string(),input:fi,turnId:X.optional(X.string()),providerMetadata:X.optional(fi)}),Gi=X.union(...gi([`cancelled`,`failed`]));X.object({error:X.string(),status:Gi});var Ki=X.object({type:X.literal(`tool-result`),callId:X.string(),name:X.optional(X.string()),output:fi});X.union(Hi,Ui,Wi,Ki);var qi=X.union(X.literal(`system`),X.literal(`user`),X.literal(`assistant`)),Ji=X.union(X.object({type:X.literal(`text`),text:X.string()}),X.object({type:X.literal(`image`),imageJson:X.string()})),Yi=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(Ji)}),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:qi,assistantId:X.optional(X.string()),contents:X.array(Yi)});function Xi(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>e===r[t])}var Zi=Bi;function Qi(e){return Zi.includes(e)}function $i(e,t){return e>=4?`You can attach up to 4 images.`:Qi(t.type)?t.size>10485760?`${t.name||`This image`} is larger than ${Vi}.`:null:`${t.name||`This file`} is not a supported image. Use JPEG, PNG, GIF, or WebP.`}var ea=i(`<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>`),ta=i(`<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>`),na=i(`<li><button type="button"> </button></li>`),ra=i(`<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>`),ia=i(`<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>`),aa=i(`<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>`),oa=i(`<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>`),sa=i(`<ul class="mb-3 flex flex-wrap items-center gap-2" aria-label="Attached images"></ul>`),ca=i(`<p class="text-muted-foreground px-3 py-2 text-sm">Loading skills…</p>`),la=i(`<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>`),ua=i(`<p class="text-muted-foreground px-3 py-2 text-sm">No matching skills</p>`),da=i(`<button type="button" role="option"><span class="text-sm font-medium"> </span> <span class="text-muted-foreground line-clamp-2 text-[12px]"> </span></button>`),fa=i(`<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>`),pa=i(`<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>`),ma=i(`<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>`),ha=i(`<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>`),ga=i(`<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 _a(e,t){E(t,!0);let i=j(t,`prompt`,15,``),o=j(t,`selectedModel`,31,()=>u(jr)),c=j(t,`selectedReasoningEffort`,31,()=>u(Mr)),d=j(t,`selectedServiceTier`,31,()=>u(Nr)),m=j(t,`pendingQuestion`,3,null),g=j(t,`selectedQuestionOptionId`,15,null),_=j(t,`projectSkills`,3,null),S=Te(),w=Se(W.billing.getMySubscription,()=>S.isAuthenticated&&!S.isLoading?{}:`skip`),T=C(()=>w.data?.tier),D=C(()=>!!w.error),te=C(()=>t.modelCatalog?Hr(t.modelCatalog,p(T)??`free`):[]),re=C(()=>t.modelCatalog?Ir(t.modelCatalog,o()):void 0),ie=C(()=>t.modelCatalog&&p(re)?Vr(t.modelCatalog,p(T)??`free`,p(re)):void 0),ae=C(()=>p(re)!==void 0&&(p(D)||p(T)!==void 0&&t.modelCatalog!==void 0&&Lr(t.modelCatalog,p(T),o()))),oe=x(null),F=x(null),se=x(null),ce=x(u([])),L=x(`idle`),R=x(!1),z=x(0),B=x(0),H=0,de,fe=u([]),pe=C(()=>m()!=null),me=C(()=>t.isRunning&&!p(pe)||t.isSubmitting),he=C(()=>!!i().trim()||t.attachments.length>0),ge=C(()=>si({selectedOptionId:g(),text:i()})),_e=C(()=>p(pe)?p(ge):p(he)),ve=C(()=>t.attachments.some(e=>e.status!==`ready`)),ye=C(()=>t.attachments.length<4&&!p(me)&&!p(pe)),be=x(null);n(()=>{let e=m()?.questionId??null;e!==p(be)&&(l(be,e,!0),g(null),i().trim()&&i(``))});let xe=`Attach images (up to 4)`,Ce=typeof CSS<`u`&&CSS.supports(`field-sizing`,`content`),we=C(()=>t.contextUsage.contextWindowTokens>0?Math.min(100,Math.round(t.contextUsage.inputTokens/t.contextUsage.contextWindowTokens*100)):0),G=C(()=>t.contextUsage.contextWindowTokens>0?Math.round(t.contextUsage.autoCompactTokenLimit/t.contextUsage.contextWindowTokens*100):0),Ee=C(()=>ri(i(),p(B))),De=C(()=>p(Ee)!==null&&!p(R)&&!p(pe)),Oe=C(()=>p(Ee)===null?[]:ii(p(ce),p(Ee))),ke=C(()=>p(De)&&p(Oe).length>0?`composer-skill-option-${p(z)}`:void 0);function Ae(){l(B,p(oe)?.selectionStart??i().length,!0)}function je(){l(ce,[],!0),l(L,`idle`),l(R,!1),l(z,0),H+=1}async function Me(e=!1){if(p(L)===`loading`||(p(L)===`ready`||p(L)===`error`)&&!e)return;if(!_()?.load){l(ce,[],!0),l(L,`ready`);return}let t=++H;l(L,`loading`);try{let e=await _().load();if(t!==H)return;l(ce,e,!0),l(L,`ready`)}catch{if(t!==H)return;l(ce,[],!0),l(L,`error`)}}function Ne(e){let t=ai(i(),p(B),e.name);t&&(i(t.text),l(B,t.caret,!0),l(R,!0),queueMicrotask(()=>{p(oe)&&(p(oe).focus(),p(oe).setSelectionRange(t.caret,t.caret),Ie())}))}function Pe(e){let n=e.currentTarget,r=Array.from(n.files??[]);n.value=``,r.length>0&&t.onAttachFiles(r)}function K(e){let n=Array.from(e.clipboardData?.files??[]).filter(e=>e.type.startsWith(`image/`));n.length===0||t.isRunning||t.isSubmitting||p(pe)||(e.preventDefault(),t.onAttachFiles(n))}function Fe(e){let t=e.currentTarget;if(!(t instanceof HTMLButtonElement)||t.disabled)return;let n=t.getBoundingClientRect();l(se,{top:n.top-8,left:n.left+n.width/2},!0)}function q(){l(se,null)}function Ie(){if(!p(oe)||Ce)return;let e=p(oe);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 Le(e){if(p(De)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),p(Oe).length===0)return;let t=e.key===`ArrowDown`?1:-1;l(z,(p(z)+t+p(Oe).length)%p(Oe).length);return}if(e.key===`Escape`){e.preventDefault(),l(R,!0);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){e.preventDefault();let t=p(Oe)[p(z)];t&&Ne(t);return}}!t.canSend||!p(pe)&&!p(ae)||t.isSubmitting||p(me)||!p(_e)||!p(pe)&&p(ve)||ei(e)&&(e.preventDefault(),t.onSubmit())}function Re(e){g(g()===e?null:e)}function ze(e){if(!t.modelCatalog)return;let n=Ir(t.modelCatalog,e);n&&c(n.defaultReasoningEffort)}function Be(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1).replace(/\.0$/,``)}m`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}n(()=>{t.modelCatalog&&(!o()||!Ir(t.modelCatalog,o()))&&(o(t.modelCatalog.defaultModelId),c(t.modelCatalog.defaultReasoningEffort),d(t.modelCatalog.defaultServiceTier))}),n(()=>{if(!t.modelCatalog||!p(T))return;let e=Rr(t.modelCatalog,p(T),o());e!==o()&&(o(e),c(Ir(t.modelCatalog,e)?.defaultReasoningEffort??t.modelCatalog.defaultReasoningEffort));let n=Ir(t.modelCatalog,e);if(!n)return;let r=Br(t.modelCatalog,p(T),n);r.includes(d())||d(r[0]??t.modelCatalog.defaultServiceTier)}),n(()=>{i(),Ie()}),n(()=>{let e=_()?.workspacePath??null;if(de!==e&&(de=e,je()),p(Ee)===null){l(R,!1);return}p(R)||Me()}),n(()=>{p(Oe),l(z,0)}),n(()=>{!p(De)||p(Oe).length===0||fe[p(z)]?.scrollIntoView({block:`nearest`})});var Ve=ga(),He=b(Ve),Ue=y(He),J=y(Ue),We=e=>{var n=ea(),r=s(y(n),2),i=y(r);k(r),k(n),U(()=>V(i,`Working for ${t.elapsedLabel??``}`)),v(e,n)},Y=e=>{var n=ta(),r=s(y(n),2),i=y(r,!0);k(r),k(n),U(()=>V(i,t.isStarting?`Starting agent…`:`Sending request…`)),v(e,n)};r(J,e=>{t.elapsedLabel?e(We):t.isSubmitting&&e(Y,1)});var Ge=s(J,2);I(Ge,1,P(`composer-shell mx-auto w-full max-w-[48rem] rounded-[28px] p-px transition-colors duration-200`));var Ke=y(Ge);I(Ke,1,P(`composer-inner rounded-[27px] border border-[var(--hairline)] transition-colors duration-200`));var qe=y(Ke),X=y(qe),Je=e=>{var t=ra(),n=y(t),r=y(n,!0);k(n);var i=s(n,2);ue(i,21,()=>m().options,e=>e.id,(e,t)=>{let n=C(()=>p(t).id===oi),r=C(()=>g()===p(t).id);var i=na(),a=y(i),o=y(a,!0);k(a),k(i),U(()=>{I(a,1,`w-full rounded-lg border px-3 py-2 text-left text-[13px] leading-5 transition ${p(r)?`border-foreground/40 bg-hover-fill-strong text-foreground`:p(n)?`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`}`),O(a,`aria-pressed`,p(r)),V(o,p(t).label)}),N(`click`,a,()=>{Re(p(t).id)}),v(e,i)}),k(i),k(t),U(()=>V(r,m().question)),v(e,t)};r(X,e=>{m()&&e(Je)});var Ye=s(X,2),Xe=e=>{var n=sa();ue(n,21,()=>t.attachments,e=>e.localId,(e,n)=>{var i=oa(),a=y(i),o=s(a,2),c=e=>{var t=ia();U(()=>O(t,`aria-label`,`Uploading ${p(n).name??``}`)),v(e,t)},l=e=>{v(e,aa())};r(o,e=>{p(n).status===`uploading`?e(c):p(n).status===`error`&&e(l,1)});var u=s(o,2);Mn(y(u),{class:`size-3`,"aria-hidden":`true`}),k(u),k(i),U(()=>{I(i,1,`group relative size-14 overflow-hidden rounded-xl border ${p(n).status===`error`?`border-rose-500/60`:`border-border`}`),O(i,`title`,p(n).error??p(n).name),O(a,`src`,p(n).previewUrl),O(a,`alt`,p(n).name),I(a,1,`size-full object-cover ${p(n).status===`uploading`?`opacity-50`:``}`),O(u,`aria-label`,`Remove ${p(n).name??``}`),u.disabled=p(me)}),N(`click`,u,()=>t.onRemoveAttachment(p(n).localId)),v(e,i)}),k(n),v(e,n)};r(Ye,e=>{t.attachments.length>0&&!p(pe)&&e(Xe)});var Ze=s(Ye,2),Qe=y(Ze),$e=e=>{var t=fa(),n=y(t),i=e=>{v(e,ca())},o=e=>{var t=la(),n=s(y(t),2);k(t),N(`click`,n,()=>{Me(!0)}),v(e,t)},c=e=>{v(e,ua())},u=e=>{var t=a();ue(b(t),19,()=>p(Oe),e=>e.name,(e,t,n)=>{var r=da(),i=y(r),a=y(i);k(i);var o=s(i,2),c=y(o,!0);k(o),k(r),le(r,(e,t)=>fe[t]=e,e=>fe?.[e],()=>[p(n)]),U(()=>{O(r,`id`,`composer-skill-option-${p(n)??``}`),I(r,1,`flex w-full flex-col gap-0.5 px-3 py-2 text-left transition ${p(z)===p(n)?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),O(r,`aria-selected`,p(z)===p(n)),V(a,`$${p(t).name??``}`),V(c,p(t).description)}),f(`pointerenter`,r,()=>{l(z,p(n),!0)}),N(`click`,r,()=>{Ne(p(t))}),v(e,r)}),v(e,t)};r(n,e=>{p(L)===`loading`?e(i):p(L)===`error`?e(o,1):p(Oe).length===0?e(c,2):e(u,-1)}),k(t),U(()=>O(t,`role`,p(L)===`ready`&&p(Oe).length>0?`listbox`:`status`)),v(e,t)};r(Qe,e=>{p(De)&&e($e)});var Z=s(Qe,2);h(Z),le(Z,e=>l(oe,e),()=>p(oe)),k(Ze);var et=s(Ze,2),tt=y(et),nt=y(tt);le(nt,e=>l(F,e),()=>p(F));var rt=s(nt,2);Yt(y(rt),{class:`size-4`,"aria-hidden":`true`}),k(rt);var it=s(rt,4);{let e=(e,t=ne)=>{Er(e,{get provider(){return t().provider},className:`size-4 shrink-0`})},n=C(()=>p(me)||p(pe)||t.modelCatalog===void 0);vr(it,{get options(){return p(te)},ariaLabel:`Select model`,menuTitle:`Model`,get disabled(){return p(n)},searchable:!0,onValueChange:ze,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 o()},set value(e){o(e)},optionIcon:e,$$slots:{optionIcon:!0}})}var ot=s(it,4),st=e=>{{let t=C(()=>p(me)||p(pe));$r(e,{get model(){return p(re)},get serviceTierOptions(){return p(ie)},get disabled(){return p(t)},className:`z-20 shrink-0`,get reasoningEffort(){return c()},set reasoningEffort(e){c(e)},get serviceTier(){return d()},set serviceTier(e){d(e)}})}};r(ot,e=>{p(re)&&e(st)}),k(tt);var ct=s(tt,2),lt=y(ct),ut=y(lt),dt=s(ut,2),ft=y(dt),pt=s(y(ft),2),mt=y(pt);k(pt),k(ft);var ht=s(ft,2),gt=y(ht);k(ht);var _t=s(ht,2),vt=s(y(_t),2),yt=y(vt,!0);k(vt),k(_t);var bt=s(_t,2),xt=y(bt);k(bt),k(dt),k(lt);var St=s(lt,2),Ct=e=>{var n=pa();Sn(y(n),{class:`size-3.5 fill-current`}),k(n),N(`click`,n,function(...e){t.onCancel?.apply(this,e)}),v(e,n)};r(St,e=>{t.isRunning&&e(Ct)});var wt=s(St,2),Tt=e=>{var n=ma();at(y(n),{class:`size-4`}),k(n),U(()=>{n.disabled=!t.canSend||!p(pe)&&!p(ae)||t.isSubmitting||!p(_e)||!p(pe)&&p(ve),O(n,`aria-label`,p(pe)?`Submit answer`:`Send message`)}),N(`click`,n,function(...e){t.onSubmit?.apply(this,e)}),v(e,n)};r(wt,e=>{(p(pe)||!t.isRunning)&&e(Tt)}),k(ct),k(et),k(qe),k(Ke),k(Ge),k(Ue),k(He);var Et=s(He,2),Dt=e=>{var t=ha(),n=y(t,!0);k(t),U(()=>{A(t,`top: ${p(se).top}px; left: ${p(se).left}px;`),V(n,xe)}),v(e,t)};r(Et,e=>{p(se)&&e(Dt)}),U((e,t,n,r)=>{O(Z,`placeholder`,p(pe)?`Add detail, or type a custom answer`:`Ask anything, @tag files/directories, or use $ to show available skills`),Z.disabled=p(me),O(Z,`aria-expanded`,p(De)),O(Z,`aria-controls`,p(De)?`composer-skills-listbox`:void 0),O(Z,`aria-activedescendant`,p(ke)),O(nt,`accept`,e),O(rt,`aria-label`,xe),rt.disabled=!p(ye),O(ut,`aria-label`,`Context window ${p(we)}% full`),A(ut,`background: conic-gradient(var(--accent) ${p(we)*3.6}deg, var(--hover-fill-strong) 0deg);`),V(mt,`${p(we)??``}% · ${t??``}/${n??``}`),A(gt,`width: ${p(we)}%`),V(yt,r),V(xt,`Sprocket automatically compacts context at about ${p(G)??``}% so
|
|
2
|
+
long-running work can continue.`)},[()=>Zi.join(`,`),()=>Be(t.contextUsage.inputTokens),()=>Be(t.contextUsage.contextWindowTokens),()=>Be(t.contextUsage.totalTokensProcessed)]),N(`keydown`,Z,Le),f(`paste`,Z,K),f(`focus`,Z,Ae),N(`input`,Z,()=>{Ae(),Ie()}),N(`keyup`,Z,Ae),N(`click`,Z,Ae),f(`select`,Z,Ae),ee(Z,i),N(`change`,nt,Pe),f(`mouseenter`,rt,Fe),f(`mouseleave`,rt,q),f(`focus`,rt,Fe),f(`blur`,rt,q),N(`click`,rt,()=>{q(),p(F)?.click()}),N(`keydown`,ut,e=>{e.key===`Escape`&&e.currentTarget.blur()}),v(e,Ve),M()}t([`click`,`keydown`,`input`,`keyup`,`change`]);var va=i(`<p class="text-foreground text-[15px]"> </p>`),ya=i(`<button type="button" class="text-muted-foreground hover:text-foreground block text-left text-sm transition"><span> </span></button>`),ba=i(`<div class="mt-3 space-y-1"><!> <!></div>`),xa=i(`<p class="text-muted-foreground mt-3 text-sm">You’re signed in to Sprocket.</p>`),Sa=i(`<p class="text-foreground mt-3 text-[15px]"> </p>`),Ca=i(`<p class="text-muted-foreground mt-3 text-sm">Couldn’t load your subscription right now.</p>`),wa=i(`<div class="bg-hover-fill mt-3.5 h-4 w-16 animate-pulse rounded" aria-hidden="true"></div>`),Ta=i(`<!> Sign Out`,1),Ea=i(`<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 Da(e,t){E(t,!0);let n=x(!1),i=Te(),a=Se(W.billing.getMySubscription,()=>i.isAuthenticated&&!i.isLoading?{}:`skip`),o=C(()=>[t.user?.firstName,t.user?.lastName].filter(Boolean).join(` `).trim()||null);var c=Ea(),u=s(y(c),2),d=y(u),f=y(d),m=s(y(f),2),h=e=>{var i=ba(),a=y(i),c=e=>{var t=va(),n=y(t,!0);k(t),U(()=>V(n,p(o))),v(e,t)};r(a,e=>{p(o)&&e(c)});var u=s(a,2),d=e=>{var r=ya(),i=y(r),a=y(i,!0);k(i),k(r),U(()=>{O(r,`aria-pressed`,p(n)),O(r,`aria-label`,p(n)?`Hide email address`:`Show email address`),I(i,1,P(p(n)?void 0:`blur-[5px] select-none`)),V(a,t.user.email)}),N(`click`,r,()=>{l(n,!p(n))}),v(e,r)};r(u,e=>{t.user?.email&&e(d)}),k(i),v(e,i)},g=e=>{v(e,xa())};r(m,e=>{p(o)||t.user?.email?e(h):e(g,-1)}),k(f);var _=s(f,2),S=s(y(_),2),w=e=>{var t=Sa(),n=y(t,!0);k(t),U(()=>V(n,mi[a.data.tier])),v(e,t)},T=e=>{v(e,Ca())},D=e=>{v(e,wa())};r(S,e=>{a.data?e(w):a.error?e(T,1):e(D,-1)}),k(_);var ee=s(_,2),te=s(y(ee),4);Un(y(te),{variant:`outline`,get onclick(){return t.onSignOut},children:(e,t)=>{var n=Ta();tn(b(n),{class:`mr-2 size-4`,"aria-hidden":`true`}),z(),v(e,n)},$$slots:{default:!0}}),k(te),k(ee),k(d),k(u),k(c),v(e,c),M()}t([`click`]);function Oa(e,t){return e.find(e=>e.repositoryKey===t)??null}function ka(e,t){return t?e.find(e=>e._id===t)??null:null}function Aa(e,t){return e.trim().length>0&&t.trim().length>0&&e!==t}function ja(e){return e.threadStatus!==`archived`}function Ma(e){return{_id:e,userId:``,repositoryKey:`unknown`,displayName:`Unknown project`,executorStatus:`disconnected`,lastSeenAt:0,localAttachmentAvailability:`unlinked`}}function Na(e,t){let n=Fa(t);return{project:e,threads:n,latestThreadAt:n.reduce((e,t)=>Math.max(e,t.lastMessageAt),0),activeThreadCount:Ia(n)}}function Pa(e,t){let n=new Map;for(let e of t.filter(ja)){let t=n.get(e.projectId);if(t){t.push(e);continue}n.set(e.projectId,[e])}let r=[];for(let t of e)r.push(Na(t,n.get(t._id)??[])),n.delete(t._id);for(let[e,t]of n)r.push(Na(Ma(e),t));return r.sort((e,t)=>{let n=e.latestThreadAt||e.project.lastSeenAt,r=t.latestThreadAt||t.project.lastSeenAt;return r===n?e.project.displayName.localeCompare(t.project.displayName):r-n})}function Fa(e){return[...e].sort((e,t)=>e.hasActiveRun===t.hasActiveRun?t.lastMessageAt-e.lastMessageAt:Number(t.hasActiveRun)-Number(e.hasActiveRun))}function Ia(e){return e.filter(e=>e.hasActiveRun).length}function La(e,t){return t?e.find(e=>e.threadId===t)??null:null}function Ra(e,t){return t&&(e?.threadId??e?._id)===t?e:null}function za(e){let{pendingCreatedThreadId:t,threads:n}=e;return!t||n.some(e=>e.threadId===t)?null:t}function Ba(e){return!e.threadId||e.threadId===e.pendingCreatedThreadId||e.hasLatestRunData}function Va(e,t){return!!(t&&e[t])}function Ha(e,t,n){return{...e,[t]:n}}function Ua(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 Wa(e,t,n){return!!(t&&(t!==e.previousRunId||n!==e.previousClaimExpiresAt))}function Ga(e,t,n,r){let i=e[t];return!i||!Wa(i,n,r)?e:Ua(e,t,i.launchId)}function Ka(e,t){let n=e;for(let e of t)n=Ga(n,e.threadId,e.latestRunId,e.latestRunClaimExpiresAt);return n}function qa(e,t,n,r,i,a){let o=e[t];return!o||o.launchId!==n||o.expiresAt>r?{pendingLaunches:e,shouldRecover:!1}:{pendingLaunches:Ua(e,t,n),shouldRecover:!Wa(o,i,a)}}function Ja(e){let{threads:t,currentThreadId:n,currentRepositoryKey:r,draftRepositoryKey: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 Ya=i(`<p class="text-muted-foreground max-w-xl text-sm leading-6">No archived threads.</p>`),Xa=i(`<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>`),Za=i(`<ul class="max-w-xl space-y-1"></ul>`),Qa=i(`<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 $a(e,t){E(t,!0);let n=C(()=>[...t.threads].filter(e=>!ja(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt));var i=Qa(),a=s(y(i),2),o=s(y(a),2),c=e=>{v(e,Ya())},l=e=>{var r=Za();ue(r,21,()=>p(n),e=>e.threadId,(e,n)=>{let r=C(()=>ka(t.projects,p(n).projectId));var i=Xa(),a=y(i),o=y(a),c=y(o,!0);k(o);var l=s(o,2),u=y(l,!0);k(l),k(a);var d=s(a,2);k(i),U(()=>{V(c,p(n).title),V(u,p(r)?.displayName??`Unknown project`)}),N(`click`,d,()=>{t.onRestore(p(n).threadId)}),v(e,i)}),k(r),v(e,r)};r(o,e=>{p(n).length===0?e(c):e(l,-1)}),k(a),k(i),v(e,i),M()}t([`click`]);var eo=i(`<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 to(e,t){E(t,!0);var n=eo(),i=y(n),a=e=>{wn(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{on(e,{class:`size-3.5`,"aria-hidden":`true`})};r(i,e=>{t.theme===`dark`?e(a):e(o,-1)}),k(n),U(()=>{O(n,`aria-label`,t.theme===`dark`?`Switch to light mode`:`Switch to dark mode`),O(n,`title`,t.theme===`dark`?`Light mode`:`Dark mode`)}),N(`click`,n,()=>t.onThemeChange(t.theme===`dark`?`light`:`dark`)),v(e,n),M()}t([`click`]);var no=i(`<button type="button"><!> <span class="truncate"> </span></button>`),ro=i(`<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 io(e,t){E(t,!0);let n=[{id:`account`,label:`Account`,icon:On},{id:`usage`,label:`Usage`,icon:dt},{id:`archived`,label:`Archived Threads`,icon:tt}];var r=ro(),i=y(r),a=y(i),o=y(a);rt(y(o),{class:`size-3.5`,"aria-hidden":`true`}),z(),k(o),to(s(o,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),k(a);var c=s(a,2);ue(c,21,()=>n,e=>e.id,(e,n)=>{var r=no(),i=y(r);B(i,()=>p(n).icon,(e,t)=>{t(e,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`})});var a=s(i,2),o=y(a,!0);k(a),k(r),U(()=>{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===p(n).id?`bg-hover-fill-strong text-foreground`:`text-muted-foreground hover:bg-hover-fill hover:text-foreground`}`),O(r,`aria-current`,t.activePage===p(n).id?`page`:void 0),V(o,p(n).label)}),N(`click`,r,()=>{t.onNavigate(p(n).id)}),v(e,r)}),k(c),k(i),k(r),N(`click`,o,function(...e){t.onBack?.apply(this,e)}),v(e,r),M()}t([`click`]);var ao=[{id:`modelUsage`,label:`Model usage`,noun:`model usage`,description:`More expensive models use up more usage.`},{id:`webTools`,label:`Web tools`,noun:`web tools`,description:`Web search and URL scrape share this quota.`}],oo=[`weekly`,`monthly`],so=i(`<p class="text-muted-foreground text-sm leading-6">Couldn’t load your usage right now. Try again in a moment.</p>`),co=i(`<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>`),lo=i(`<div class="space-y-5"><div class="bg-hover-fill h-3 w-28 rounded"></div> <!></div>`),uo=i(`<div class="animate-pulse space-y-10" aria-hidden="true"><div class="bg-hover-fill h-4 w-24 rounded"></div> <!></div>`),fo=i(`<p class="text-muted-foreground mt-1 text-[12px]"> </p>`),po=i(`<p> </p>`),mo=i(`<p class="text-muted-foreground mt-1.5 text-[12px]"> </p>`),ho=i(`<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>`),go=i(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase"> </p> <!> <div class="mt-4 space-y-6"></div></div>`),_o=i(`<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),vo=i(`<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 yo(e,t){E(t,!0);let i=Te(),a=Se(W.usage.getMyUsage,()=>i.isAuthenticated&&!i.isLoading?{}:`skip`),o=x(u(Date.now()));n(()=>{let e=setInterval(()=>{l(o,Date.now(),!0)},6e4);return()=>{clearInterval(e)}});let c=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),d={weekly:`Weekly`,monthly:`Monthly`};function f(e){let t=Math.max(0,e-p(o)),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 m(e,t){return e?`bg-rose-400/90`:t?`bg-amber-400/90`:`bg-foreground/25`}var h=vo(),g=s(y(h),2),_=y(g),S=y(_),w=e=>{v(e,so())},T=e=>{var t=uo();ue(s(y(t),2),17,()=>ao,e=>e.id,(e,t)=>{var n=lo();ue(s(y(n),2),16,()=>oo,e=>e,(e,t)=>{v(e,co())}),k(n),v(e,n)}),k(t),v(e,t)},D=e=>{var t=_o(),n=b(t),i=s(y(n),2),o=y(i,!0);k(i),k(n),ue(s(n,2),17,()=>a.data.meters,e=>e.id,(e,t)=>{var n=go(),i=y(n),a=y(i,!0);k(i);var o=s(i,2),l=e=>{var n=fo(),r=y(n,!0);k(n),U(()=>V(r,p(t).description)),v(e,n)};r(o,e=>{p(t).description&&e(l)});var u=s(o,2);ue(u,21,()=>p(t).windows,e=>e.period,(e,n)=>{let i=C(()=>p(n).limit>0),a=C(()=>p(i)?Math.round(p(n).used/p(n).limit*100):0),o=C(()=>p(i)&&p(n).used>=p(n).limit),l=C(()=>p(i)&&p(n).used>=p(n).limit*.9);var u=ho(),h=y(u),g=y(h),_=y(g,!0);k(g);var b=s(g,2),x=e=>{var t=po(),n=y(t);k(t),U(()=>{I(t,1,`text-[12px] ${p(o)?`text-destructive`:p(l)?`text-amber-800 dark:text-amber-300`:`text-muted-foreground`}`),V(n,`${p(a)??``}% used`)}),v(e,t)};r(b,e=>{p(i)&&e(x)}),k(h);var S=s(h,2),w=y(S);k(S);var T=s(S,2);O(T,`aria-valuemin`,0);var E=y(T);k(T);var D=s(T,2),ee=e=>{var t=mo(),r=y(t);k(t),U(e=>V(r,`Resets in ${e??``}`),[()=>f(p(n).resetsAt)]),v(e,t)};r(D,e=>{p(n).resetsAt!==null&&e(ee)}),k(u),U((e,r,o,s,c)=>{V(_,d[p(n).period]),V(w,`${e??``} / ${r??``}`),O(T,`aria-label`,`${p(t).label} — ${d[p(n).period]}`),O(T,`aria-valuemax`,p(i)?p(n).limit:0),O(T,`aria-valuenow`,o),O(T,`aria-valuetext`,p(i)?`${p(a)}% used`:`0 / 0`),I(E,1,s),A(E,c)},[()=>c.format(p(i)?p(n).used:0),()=>c.format(p(i)?p(n).limit:0),()=>p(i)?Math.min(p(n).used,p(n).limit):0,()=>`h-full rounded-full transition-[width] duration-300 ${m(p(o),p(l))}`,()=>`width: ${p(i)?Math.min(100,Math.max(0,p(a))):0}%`]),v(e,u)}),k(u),k(n),U(()=>V(a,p(t).label)),v(e,n)}),U(()=>V(o,mi[a.data.tier])),v(e,t)};r(S,e=>{a.error?e(w):a.isLoading||a.data===void 0?e(T,1):e(D,-1)}),k(_),k(g),k(h),v(e,h),M()}function bo(e){if(!(!ci(e)||typeof e.error!=`string`)&&!(e.status!==`cancelled`&&e.status!==`failed`))return{error:e.error,status:e.status}}function xo(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&&So(e.input,t.payload)),a((e,t)=>e.name===t.kind),n}function So(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)=>So(e,t[n]));if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&So(e[n],t[n]))}function Co(e){return e.name||e.job?.kind||`tool`}function wo(e){let t=[];for(let n of e){if(n.type===`text`||n.type===`reasoning`){t.push(n);continue}let e=Co(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 To(e){return e.type===`reasoning`?e.id:e.tools[0]?.callId??e.toolKey}function Eo(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:To(n),blocks:[n]})}return t}function Do(e,t){for(let n of e)if(n.type===`tool-group`)for(let e of n.tools)e.job&&t(e.job)}function Oo(e){let t;return Do(e,e=>{let n=e.claimedAt??e.enqueuedAt;t=t===void 0?n:Math.min(t,n)}),t}function ko(e){let t;return Do(e,e=>{e.completedAt!==void 0&&(t=t===void 0?e.completedAt:Math.max(t,e.completedAt))}),t}function Ao(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=ko(a.blocks);e!==void 0&&(i=i===void 0?e:Math.max(i,e)),r+=1}return{workIndexBySectionIndex:t,priorCompletedAtByWorkIndex:n}}function jo(e,t){let n=Oo(e.blocks),r=t.workSectionIndex===0?t.runStartedAt:n??t.priorWorkCompletedAtMs??t.runStartedAt;return t.inProgress?{startedAtMs:r}:{startedAtMs:r,completedAtMs:ko(e.blocks)??t.runCompletedAt??r}}function Mo(e){return e.output===void 0?!e.job||e.job.status===`pending`||e.job.status===`claimed`:!1}function No(e,t){return t&&Mo(e)}function Po(e,t){return ci(e)&&typeof e[t]==`string`?e[t]:void 0}function Fo(e){return Po(e.output,`sessionId`)??Po(e.input,`sessionId`)??Po(e.job?.payload,`sessionId`)}function Io(e){let t=new Map;for(let n of e){let e=Fo(n);if(!e)continue;let r=Po(n.output,`command`)??(Co(n)===`exec_command`?Po(n.input,`cmd`)??Po(n.job?.payload,`cmd`):void 0);r&&t.set(e,r)}return t}function Lo(e,t){let n=Fo(e);return Po(e.output,`command`)??(n?t.get(n):void 0)}function Ro(e,t){if(!t)return new Set;let n=new Map,r=new Set;for(let t of e){let e=Fo(t);e&&(Co(t)===`exec_command`&&r.add(e),ci(t.output)&&typeof t.output.running==`boolean`&&n.set(e,t.output.running))}return new Set([...r].filter(e=>n.get(e)===!0))}function zo(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=Co(r),o=Fo(r),s=o!==void 0&&n.has(o),c=No(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 Bo(e,t){return!t&&Mo(e)?`interrupted`:e.job?.status===`cancelled`||e.job?.status===`failed`?e.job.status:bo(e.output)?.status}function Vo(e,t){if(!t&&Mo(e))return`The agent stopped before this tool call finished.`;let n=bo(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 Ho(e,t){let n=new Map(e.filter(e=>e.type===`tool-result`).map(e=>[e.callId,e])),r=xo(e.filter(e=>e.type===`tool-call`),t.map(e=>({id:e._id,kind:e.kind,...e.callId?{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),a.push({type:`tool`,callId:t.callId,name:t.name,input:t.input,...e?{output:e.output}:r?.result===void 0?{}:{output:r.result},...r?{job:r}:{}})}for(let e of t)o.has(e._id)||a.push({type:`tool`,callId:e.callId??`executor-job:${e._id}`,name:e.kind,input:e.payload,...e.result===void 0?{}:{output:e.result},job:e});return a}var Uo={apply_patch:Ft,ask_question:yt,await_question:qt,check_docs:st,create_artifact:Nt,exec_command:En,get_workspace_instructions:fn,read_skill:cn,scrape_url:Gt,update_artifact:Lt,web_search:mn,write_stdin:bn};function Wo(e){return Uo[e]??An}function Go(e){return Wo(e.job?.kind??e.name)}function Ko(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function qo(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`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 Ko(e)}}function Jo(e){if(!ci(e))return``;let t=[];return typeof e.workdir==`string`&&e.workdir.trim().length>0&&e.workdir!==`.`&&t.push(`cwd ${e.workdir}`),t.length>0?` (${t.join(`, `)})`:``}function Yo(e,t){let n=ci(t)?t:void 0;switch(e){case`apply_patch`:return es(t)??`Patch`;case`ask_question`:return typeof n?.question==`string`?n.question:`Question`;case`await_question`:return`Waiting for answer`;case`check_docs`:return typeof n?.query==`string`?n.query:typeof n?.path==`string`?n.path:`Docs`;case`create_artifact`:return typeof n?.title==`string`?n.title:`Artifact`;case`exec_command`:return typeof n?.cmd==`string`?`${n.cmd}${Jo(t)}`:`Command`;case`get_workspace_instructions`:return`Workspace instructions`;case`read_skill`:return typeof n?.name==`string`?`$${n.name}`:`Skill`;case`scrape_url`:return typeof n?.url==`string`?n.url:`Web page`;case`update_artifact`:return`Updated artifact`;case`web_search`:return typeof n?.query==`string`?n.query:`Web search`;case`write_stdin`:return typeof n?.sessionId==`string`?`Session ${n.sessionId}`:`Command session`;default:return Ko(e)}}function Xo(e){return(e.job?.kind??e.name)===`apply_patch`?`whitespace-pre-wrap [overflow-wrap:anywhere]`:`truncate`}var Zo=[`*** Add File: `,`*** Copy File: `,`*** Delete File: `,`*** Update File: `],Qo=[`*** Copy to: `,`*** Move to: `];function $o(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 es(e){if(!ci(e)||typeof e.patch!=`string`)return null;let t=[];for(let n of e.patch.split(`
|
|
3
|
+
`)){if(n.startsWith(`diff --git `)){let e=$o(n);e!==null&&t.push(e);continue}let e=Zo.find(e=>n.startsWith(e));if(e){t.push(n.slice(e.length).trim());continue}let r=Qo.find(e=>n.startsWith(e));r&&t.length>0&&(t[t.length-1]=n.slice(r.length).trim())}let n=[...new Set(t)];return n.length>0?n.join(`
|
|
4
|
+
`):null}function ts(e){if(!ci(e)||!Array.isArray(e.changes))return null;let t=e.changes.flatMap(e=>ci(e)&&typeof e.path==`string`?[e.path]:[]);return t.length===0?null:[...new Set(t)].join(`
|
|
5
|
+
`)}function ns(e){return e.job?.kind===`apply_patch`?ts(e.job.result)??es(e.job.payload):e.name===`apply_patch`?es(e.input):null}function rs(e){return new Set(e.flatMap(e=>ns(e)?.split(`
|
|
6
|
+
`)??[])).size}function is(e,t){if(e===`web_search`&&ci(t)&&Array.isArray(t.results)){let e=t.results.length;return` (${e} result${e===1?``:`s`})`}return e===`scrape_url`&&ci(t)&&t.truncated===!0?` (truncated)`:``}function as(e,t){return(e.job?.kind??e.name)===`write_stdin`?Lo(e,t)??Yo(`write_stdin`,e.job?.payload??e.input):e.job?ns(e)||Yo(e.job.kind,e.job.payload)+is(e.job.kind,e.job.result):Yo(e.name,e.input)}function os(e,t,n){let r=as(e,n);if(No(e,t))return`${r} (running)`;let i=Vo(e,t);return i?`${r} (${i})`:r}function ss(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 cs(e){if(Array.isArray(e))return e}function ls(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 us(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ds(e,t){return cs(e)||ls(e,t)||fs(e,t)||us()}function fs(e,t){if(e){if(typeof e==`string`)return ss(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)?ss(e,t):void 0}}var ps=Object.entries,ms=Object.setPrototypeOf,hs=Object.isFrozen,gs=Object.getPrototypeOf,_s=Object.getOwnPropertyDescriptor,vs=Object.freeze,ys=Object.seal,bs=Object.create,xs=typeof Reflect<`u`&&Reflect,Ss=xs.apply,Cs=xs.construct;vs||=function(e){return e},ys||=function(e){return e},Ss||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Cs||=function(e){return new e(...[...arguments].slice(1))};var ws=Ws(Array.prototype.forEach),Ts=Ws(Array.prototype.lastIndexOf),Es=Ws(Array.prototype.pop),Ds=Ws(Array.prototype.push),Os=Ws(Array.prototype.splice),ks=Array.isArray,As=Ws(String.prototype.toLowerCase),js=Ws(String.prototype.toString),Ms=Ws(String.prototype.match),Ns=Ws(String.prototype.replace),Ps=Ws(String.prototype.indexOf),Fs=Ws(String.prototype.trim),Is=Ws(Number.prototype.toString),Ls=Ws(Boolean.prototype.toString),Rs=typeof BigInt>`u`?null:Ws(BigInt.prototype.toString),zs=typeof Symbol>`u`?null:Ws(Symbol.prototype.toString),Bs=Ws(Object.prototype.hasOwnProperty),Vs=Ws(Object.prototype.toString),Hs=Ws(RegExp.prototype.test),Us=Gs(TypeError);function Ws(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ss(e,t,n)}}function Gs(e){return function(){return Cs(e,[...arguments])}}function Q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:As;if(ms&&ms(e,null),!ks(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(hs(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Ks(e){for(let t=0;t<e.length;t++)Bs(e,t)||(e[t]=null);return e}function qs(e){let t=bs(null);for(let r of ps(e)){var n=ds(r,2);let i=n[0],a=n[1];Bs(e,i)&&(ks(a)?t[i]=Ks(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=qs(a):t[i]=a)}return t}function Js(e){switch(typeof e){case`string`:return e;case`number`:return Is(e);case`boolean`:return Ls(e);case`bigint`:return Rs?Rs(e):`0`;case`symbol`:return zs?zs(e):`Symbol()`;case`undefined`:return Vs(e);case`function`:case`object`:{if(e===null)return Vs(e);let t=e,n=Ys(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Vs(e)}return Vs(e)}default:return Vs(e)}}function Ys(e,t){for(;e!==null;){let n=_s(e,t);if(n){if(n.get)return Ws(n.get);if(typeof n.value==`function`)return Ws(n.value)}e=gs(e)}function n(){return null}return n}function Xs(e){try{return Hs(e,``),!0}catch{return!1}}var Zs=vs(`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(`.`)),Qs=vs(`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(`.`)),$s=vs([`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`]),ec=vs([`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`]),tc=vs(`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(`.`)),nc=vs([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),rc=vs([`#text`]),ic=vs(`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(`.`)),ac=vs(`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(`.`)),oc=vs(`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(`.`)),sc=vs([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),cc=ys(/{{[\w\W]*|^[\w\W]*}}/g),lc=ys(/<%[\w\W]*|^[\w\W]*%>/g),uc=ys(/\${[\w\W]*/g),dc=ys(/^data-[\-\w.\u00B7-\uFFFF]+$/),fc=ys(/^aria-[\-\w]+$/),pc=ys(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),mc=ys(/^(?:\w+script|data):/i),hc=ys(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gc=ys(/^html$/i),_c=ys(/^[a-z][.\w]*(-[.\w]+)+$/i),vc=ys(/<[/\w!]/g),yc=ys(/<[/\w]/g),bc=ys(/<\/no(script|embed|frames)/i),xc=ys(/\/>/i),Sc={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Cc=function(){return typeof window>`u`?null:window},wc=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}},Tc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Ec=function(e,t,n,r){return Bs(e,t)&&ks(e[t])?Q(r.base?qs(r.base):{},e[t],r.transform):n};function Dc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Cc(),t=e=>Dc(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==Sc.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=Ys(d,`cloneNode`),p=Ys(d,`remove`),m=Ys(d,`nextSibling`),h=Ys(d,`childNodes`),g=Ys(d,`parentNode`),_=Ys(d,`shadowRoot`),v=Ys(d,`attributes`),y=o&&o.prototype?Ys(o.prototype,`nodeType`):null,b=o&&o.prototype?Ys(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw Us(`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.`)},D=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},ee=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},O=function(){return w||=(C=wc(u,i),!0),C},k=n,te=k.implementation,A=k.createNodeIterator,ne=k.createDocumentFragment,re=k.getElementsByTagName,j=r.importNode,M=Tc();t.isSupported=typeof ps==`function`&&typeof g==`function`&&te&&te.createHTMLDocument!==void 0;let N=cc,ie=lc,ae=uc,P=dc,oe=fc,F=mc,I=hc,se=_c,ce=pc,L=null,le=Q({},[...Zs,...Qs,...$s,...tc,...rc]),R=null,z=Q({},[...ic,...ac,...oc,...sc]),B=Object.seal(bs(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}})),V=null,ue=null,H=Object.seal(bs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),U=!0,de=!0,fe=!1,pe=!0,me=!1,he=!0,ge=!1,_e=!1,W=null,ve=null,ye=!1,be=!1,xe=!1,Se=!1,Ce=!0,we=!1,Te=`user-content-`,G=!0,Ee=!1,De={},Oe=null,ke=Q({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ae=null,je=Q({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Me=null,Ne=Q({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Pe=`http://www.w3.org/1998/Math/MathML`,K=`http://www.w3.org/2000/svg`,Fe=`http://www.w3.org/1999/xhtml`,q=Fe,Ie=!1,Le=null,Re=Q({},[Pe,K,Fe],js),ze=vs([`mi`,`mo`,`mn`,`ms`,`mtext`]),Be=Q({},ze),Ve=vs([`annotation-xml`]),He=Q({},Ve),Ue=Q({},[`title`,`style`,`font`,`a`,`script`]),J=null,We=[`application/xhtml+xml`,`text/html`],Y=null,Ge=null,Ke=n.createElement(`form`),qe=function(e){return e instanceof RegExp||e instanceof Function},X=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ge&&Ge===e)return;(!e||typeof e!=`object`)&&(e={}),e=qs(e),J=We.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=J===`application/xhtml+xml`?js:As,L=Ec(e,`ALLOWED_TAGS`,le,{transform:Y}),R=Ec(e,`ALLOWED_ATTR`,z,{transform:Y}),Le=Ec(e,`ALLOWED_NAMESPACES`,Re,{transform:js}),Me=Ec(e,`ADD_URI_SAFE_ATTR`,Ne,{transform:Y,base:Ne}),Ae=Ec(e,`ADD_DATA_URI_TAGS`,je,{transform:Y,base:je}),Oe=Ec(e,`FORBID_CONTENTS`,ke,{transform:Y}),V=Ec(e,`FORBID_TAGS`,qs({}),{transform:Y}),ue=Ec(e,`FORBID_ATTR`,qs({}),{transform:Y}),De=Bs(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?qs(e.USE_PROFILES):e.USE_PROFILES:!1,U=e.ALLOW_ARIA_ATTR!==!1,de=e.ALLOW_DATA_ATTR!==!1,fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,me=e.SAFE_FOR_TEMPLATES||!1,he=e.SAFE_FOR_XML!==!1,ge=e.WHOLE_DOCUMENT||!1,be=e.RETURN_DOM||!1,xe=e.RETURN_DOM_FRAGMENT||!1,Se=e.RETURN_TRUSTED_TYPE||!1,ye=e.FORCE_BODY||!1,Ce=e.SANITIZE_DOM!==!1,we=e.SANITIZE_NAMED_PROPS||!1,G=e.KEEP_CONTENT!==!1,Ee=e.IN_PLACE||!1,ce=Xs(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:pc,q=typeof e.NAMESPACE==`string`?e.NAMESPACE:Fe,Be=Bs(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?qs(e.MATHML_TEXT_INTEGRATION_POINTS):Q({},ze),He=Bs(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?qs(e.HTML_INTEGRATION_POINTS):Q({},Ve);let t=Bs(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?qs(e.CUSTOM_ELEMENT_HANDLING):bs(null);if(B=bs(null),Bs(t,`tagNameCheck`)&&qe(t.tagNameCheck)&&(B.tagNameCheck=t.tagNameCheck),Bs(t,`attributeNameCheck`)&&qe(t.attributeNameCheck)&&(B.attributeNameCheck=t.attributeNameCheck),Bs(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ys(B),me&&(de=!1),xe&&(be=!0),De&&(L=Q({},rc),R=bs(null),De.html===!0&&(Q(L,Zs),Q(R,ic)),De.svg===!0&&(Q(L,Qs),Q(R,ac),Q(R,sc)),De.svgFilters===!0&&(Q(L,$s),Q(R,ac),Q(R,sc)),De.mathMl===!0&&(Q(L,tc),Q(R,oc),Q(R,sc))),H.tagCheck=null,H.attributeCheck=null,Bs(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?H.tagCheck=e.ADD_TAGS:ks(e.ADD_TAGS)&&(L===le&&(L=qs(L)),Q(L,e.ADD_TAGS,Y))),Bs(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?H.attributeCheck=e.ADD_ATTR:ks(e.ADD_ATTR)&&(R===z&&(R=qs(R)),Q(R,e.ADD_ATTR,Y))),Bs(e,`ADD_URI_SAFE_ATTR`)&&ks(e.ADD_URI_SAFE_ATTR)&&Q(Me,e.ADD_URI_SAFE_ATTR,Y),Bs(e,`FORBID_CONTENTS`)&&ks(e.FORBID_CONTENTS)&&(Oe===ke&&(Oe=qs(Oe)),Q(Oe,e.FORBID_CONTENTS,Y)),Bs(e,`ADD_FORBID_CONTENTS`)&&ks(e.ADD_FORBID_CONTENTS)&&(Oe===ke&&(Oe=qs(Oe)),Q(Oe,e.ADD_FORBID_CONTENTS,Y)),G&&(L[`#text`]=!0),ge&&Q(L,[`html`,`head`,`body`]),L.table&&(Q(L,[`tbody`]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Us(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Us(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=D(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=O()),x&&typeof S==`string`&&(S=D(``)));vs&&vs(e),Ge=e},Je=Q({},[...Qs,...$s,...ec]),Ye=Q({},[...tc,...nc]),Xe=function(e,t,n){return t.namespaceURI===Fe?e===`svg`:t.namespaceURI===Pe?e===`svg`&&(n===`annotation-xml`||Be[n]):!!Je[e]},Ze=function(e,t,n){return t.namespaceURI===Fe?e===`math`:t.namespaceURI===K?e===`math`&&He[n]:!!Ye[e]},Qe=function(e,t,n){return t.namespaceURI===K&&!He[n]||t.namespaceURI===Pe&&!Be[n]?!1:!Ye[e]&&(Ue[e]||!Je[e])},$e=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:q,tagName:`template`});let n=As(e.tagName),r=As(t.tagName);return Le[e.namespaceURI]?e.namespaceURI===K?Xe(n,t,r):e.namespaceURI===Pe?Ze(n,t,r):e.namespaceURI===Fe?Qe(n,t,r):!!(J===`application/xhtml+xml`&&Le[e.namespaceURI]):!1},Z=function(e){Ds(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Us(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},et=function(e){rt(e);let t=h(e);if(t){let e=[];ws(t,t=>{Ds(e,t)}),ws(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{}}},tt=function(e,n){try{Ds(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Ds(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(be||xe)try{Z(n)}catch{}else try{n.setAttribute(e,``)}catch{}},nt=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`||R[Y(i)]))try{e.removeAttribute(i)}catch{}}},rt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===Sc.element&&nt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},it=function(e){if(!he)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===Sc.processingInstruction||n===Sc.comment&&Hs(yc,e.data)){try{p(e)}catch{}continue}if(n===Sc.element){let t=e,n=Y(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},at=function(e){let t=null,r=null;if(ye)e=`<remove></remove>`+e;else{let t=Ms(e,/^[\r\n\t ]+/);r=t&&t[0]}J===`application/xhtml+xml`&&q===Fe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(q===Fe)try{t=new l().parseFromString(i,J)}catch{}if(!t||!t.documentElement){t=te.createDocument(q,`template`,null);try{t.documentElement.innerHTML=Ie?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),q===Fe?re.call(t,ge?`html`:`body`)[0]:ge?t.documentElement:a},ot=function(e){return A.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},st=function(e){return e=Ns(e,N,` `),e=Ns(e,ie,` `),e=Ns(e,ae,` `),e},ct=function(e){e.normalize();let t=A.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=st(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&ws(r,e=>{ut(e.content)&&ct(e.content)})},lt=function(e){let t=b?b(e):null;return typeof t!=`string`||Y(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},ut=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===Sc.documentFragment}catch{return!1}},dt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function ft(e,n,r){e.length!==0&&ws(e,e=>{e.call(t,n,r,Ge)})}let pt=function(e,t){return!!(he&&e.hasChildNodes()&&!dt(e.firstElementChild)&&Hs(vc,e.textContent)&&Hs(vc,e.innerHTML)||he&&e.namespaceURI===Fe&&t===`style`&&dt(e.firstElementChild)||e.nodeType===Sc.processingInstruction||he&&e.nodeType===Sc.comment&&Hs(yc,e.data))},mt=function(e,t){if(!V[t]&&vt(t)&&(B.tagNameCheck instanceof RegExp&&Hs(B.tagNameCheck,t)||B.tagNameCheck instanceof Function&&B.tagNameCheck(t)))return!1;if(G&&!Oe[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Ee?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return Z(e),!0},ht=function(e,n){if(ft(M.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(lt(e))return Z(e),!0;let r=Y(b?b(e):e.nodeName);if(ft(M.uponSanitizeElement,e,{tagName:r,allowedTags:L}),e!==n&&g(e)===null)return!0;if(pt(e,r))return Z(e),!0;if(V[r]||!(H.tagCheck instanceof Function&&H.tagCheck(r))&&!L[r]){let t=mt(e,r);return t===!1&&ft(M.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===Sc.element&&!$e(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Hs(bc,e.innerHTML))return Z(e),!0;if(me&&e.nodeType===Sc.text){let n=st(e.textContent);e.textContent!==n&&(Ds(t.removed,{element:e.cloneNode()}),e.textContent=n)}return ft(M.afterSanitizeElements,e,null),!1},gt=function(e,t,r){if(ue[t]||he&&t===`patchsrc`||he&&t===`for`&&e!==`label`&&e!==`output`||Ce&&(t===`id`||t===`name`)&&(r in n||r in Ke))return!1;let i=R[t]||H.attributeCheck instanceof Function&&H.attributeCheck(t,e);if(!(de&&Hs(P,t))&&!(U&&Hs(oe,t))){if(!i){if(!(vt(e)&&(B.tagNameCheck instanceof RegExp&&Hs(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&Hs(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||t===`is`&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&Hs(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r))))return!1}else if(!Me[t]&&!Hs(ce,Ns(r,I,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ps(r,`data:`)===0&&Ae[e])&&!(fe&&!Hs(F,Ns(r,I,``)))&&r)return!1}return!0},_t=Q({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),vt=function(e){return!_t[As(e)]&&Hs(se,e)},yt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return ee(r)}return r},bt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),lt(e)?Z(e):Es(t.removed)}catch{tt(n,e)}},xt=function(e){ft(M.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||lt(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},r=t.length,i=Y(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Y(o),u=c,d=o===`value`?u:Fs(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,ft(M.uponSanitizeAttribute,e,n),d=n.attrValue,we&&(l===`id`||l===`name`)&&Ps(d,Te)!==0&&(tt(o,e),d=Te+d),he&&Hs(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){tt(o,e);continue}if(l===`attributename`&&Ms(d,`href`)){tt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){tt(o,e);continue}if(!pe&&Hs(xc,d)){tt(o,e);continue}if(me&&(d=st(d)),!gt(i,l,d)){tt(o,e);continue}d=yt(i,l,s,d),d!==u&&bt(e,o,s,d)}}ft(M.afterSanitizeAttributes,e,null)},St=function(e){let t=null,n=ot(e);for(ft(M.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(ft(M.uponSanitizeShadowNode,t,null),ht(t,e),xt(t),ut(t.content)&&St(t.content),(y?y(t):t.nodeType)===Sc.element){let e=_(t);ut(e)&&(Ct(e),St(e))}ft(M.afterSanitizeShadowDOM,e,null)},Ct=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){St(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===Sc.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Y(e)===`template`){let e=n.content;ut(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);ut(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(Ie=!e,Ie&&(e=`<!-->`),typeof e!=`string`&&!dt(e)&&(e=Js(e),typeof e!=`string`))throw Us(`dirty is not a string, aborting`);if(!t.isSupported)return e;_e?(L=W,R=ve):X(n),(M.uponSanitizeElement.length>0||M.uponSanitizeAttribute.length>0)&&(L=qs(L)),M.uponSanitizeAttribute.length>0&&(R=qs(R)),t.removed=[];let c=Ee&&typeof e!=`string`&&dt(e);if(c){it(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=Y(t);if(!L[n]||V[n])throw et(e),Us(`root node is forbidden and cannot be sanitized in-place`)}if(lt(e))throw et(e),Us(`root node is clobbered and cannot be sanitized in-place`);try{Ct(e)}catch(t){throw et(e),t}}else if(dt(e))i=at(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Sc.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Ct(a);else{if(!be&&!me&&!ge&&e.indexOf(`<`)===-1)return x&&Se?D(e):e;if(i=at(e),!i)return be?null:Se?S:``}i&&ye&&Z(i.firstChild);let l=c?e:i,u=ot(l);try{for(;o=u.nextNode();)ht(o,l),xt(o),ut(o.content)&&St(o.content)}catch(n){throw c&&(et(e),ws(t.removed,e=>{e.element&&rt(e.element)})),n}if(c)return ws(t.removed,e=>{e.element&&rt(e.element)}),me&&ct(e),e;if(be){if(me&&ct(i),xe)for(s=ne.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(R.shadowroot||R.shadowrootmode)&&(s=j.call(r,s,!0)),s}let d=ge?i.outerHTML:i.innerHTML;return ge&&L[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Hs(gc,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
8
|
+
`+d),me&&(d=st(d)),x&&Se?D(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};X(e),_e=!0,W=L,ve=R},t.clearConfig=function(){Ge=null,_e=!1,W=null,ve=null,x=C,S=``},t.isValidAttribute=function(e,t,n){Ge||X({});let r=Y(e),i=Y(t);return gt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Bs(M,e)&&Ds(M[e],t)},t.removeHook=function(e,t){if(Bs(M,e)){if(t!==void 0){let n=Ts(M[e],t);return n===-1?void 0:Os(M[e],n,1)[0]}return Es(M[e])}},t.removeHooks=function(e){Bs(M,e)&&(M[e]=[])},t.removeAllHooks=function(){M=Tc()},t}var Oc=Dc(),kc=Oc;Oc.sanitize.bind(Oc),Oc.isSupported,Oc.addHook.bind(Oc),Oc.removeHook.bind(Oc),Oc.removeHooks.bind(Oc),Oc.removeAllHooks.bind(Oc),Oc.setConfig.bind(Oc),Oc.clearConfig.bind(Oc),Oc.isValidAttribute.bind(Oc),Oc.version,Oc.removed;function Ac(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var jc=Ac();function Mc(e){jc=e}var Nc={exec:()=>null};function Pc(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(Ic.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Fc=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Ic={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:Pc(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Pc(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Pc(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Pc(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Pc(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Pc(e=>RegExp(`^ {0,${e}}>`))},Lc=/^(?:[ \t]*(?:\n|$))+/,Rc=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Bc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Hc=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Uc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Wc=$(Uc).replace(/bull/g,Hc).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(),Gc=$(Uc).replace(/bull/g,Hc).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(),Kc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,qc=/^[^\n]+/,Jc=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Yc=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Jc).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xc=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Hc).getRegex(),Zc=`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`,Qc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,$c=$(`^ {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`,Qc).replace(`tag`,Zc).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),el=e=>$(Kc).replace(`hr`,Bc).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`,Zc).getRegex(),tl=el(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),nl=el(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),rl={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,nl).getRegex(),code:Rc,def:Yc,fences:zc,heading:Vc,hr:Bc,html:$c,lheading:Wc,list:Xc,newline:Lc,paragraph:tl,table:Nc,text:qc},il=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Bc).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`,Zc).getRegex(),al={...rl,lheading:Gc,table:il,paragraph:$(Kc).replace(`hr`,Bc).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,il).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`,Zc).getRegex()},ol={...rl,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Qc).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:Nc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(Kc).replace(`hr`,Bc).replace(`heading`,` *#{1,6} *[^
|
|
9
|
+
]`).replace(`lheading`,Wc).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},sl=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,cl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ll=/^( {2,}|\\)\n(?!\s*$)/,ul=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,dl=/[\p{P}\p{S}]/u,fl=/[\s\p{P}\p{S}]/u,pl=/[^\s\p{P}\p{S}]/u,ml=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,fl).getRegex(),hl=/(?!~)[\p{P}\p{S}]/u,gl=/(?!~)[\s\p{P}\p{S}]/u,_l=/(?:[^\s\p{P}\p{S}]|~)/u,vl=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Fc?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),yl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,bl=$(yl,`u`).replace(/punct/g,dl).getRegex(),xl=$(yl,`u`).replace(/punct/g,hl).getRegex(),Sl=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Cl=$(Sl,`gu`).replace(/notPunctSpace/g,pl).replace(/punctSpace/g,fl).replace(/punct/g,dl).getRegex(),wl=$(Sl,`gu`).replace(/notPunctSpace/g,_l).replace(/punctSpace/g,gl).replace(/punct/g,hl).getRegex(),Tl=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,pl).replace(/punctSpace/g,fl).replace(/punct/g,dl).getRegex(),El=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,dl).getRegex(),Dl=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,pl).replace(/punctSpace/g,fl).replace(/punct/g,dl).getRegex(),Ol=$(/\\(punct)/,`gu`).replace(/punct/g,dl).getRegex(),kl=$(/^<(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(),Al=$(Qc).replace(`(?:-->|$)`,`-->`).getRegex(),jl=$(`^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`,Al).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ml=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Nl=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Ml).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pl=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ml).replace(`ref`,Jc).getRegex(),Fl=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Jc).getRegex(),Il=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Pl).replace(`nolink`,Fl).getRegex(),Ll=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Rl={_backpedal:Nc,anyPunctuation:Ol,autolink:kl,blockSkip:vl,br:ll,code:cl,del:Nc,delLDelim:Nc,delRDelim:Nc,emStrongLDelim:bl,emStrongRDelimAst:Cl,emStrongRDelimUnd:Tl,escape:sl,link:Nl,nolink:Fl,punctuation:ml,reflink:Pl,reflinkSearch:Il,tag:jl,text:ul,url:Nc},zl={...Rl,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Ml).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Ml).getRegex()},Bl={...Rl,emStrongRDelimAst:wl,emStrongLDelim:xl,delLDelim:El,delRDelim:Dl,url:$(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Ll).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`,Ll).getRegex()},Vl={...Bl,br:$(ll).replace(`{2,}`,`*`).getRegex(),text:$(Bl.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Hl={normal:rl,gfm:al,pedantic:ol},Ul={normal:Rl,gfm:Bl,breaks:Vl,pedantic:zl},Wl={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Gl=e=>Wl[e];function Kl(e,t){if(t){if(Ic.escapeTest.test(e))return e.replace(Ic.escapeReplace,Gl)}else if(Ic.escapeTestNoEncode.test(e))return e.replace(Ic.escapeReplaceNoEncode,Gl);return e}function ql(e){try{e=encodeURI(e).replace(Ic.percentDecode,`%`)}catch{return null}return e}function Jl(e,t){let n=e.replace(Ic.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Ic.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(Ic.slashPipe,`|`);return n}function Yl(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 Xl(e){let t=e.split(`
|
|
10
|
+
`),n=t.length-1;for(;n>=0&&Ic.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
11
|
+
`)}function Zl(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 Ql(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 $l(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 eu(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
12
|
+
`).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(`
|
|
13
|
+
`)}var tu=class{options;rules;lexer;constructor(e){this.options=e||jc}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]:Xl(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=eu(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=Yl(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Yl(t[0],`
|
|
14
|
+
`),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:Yl(t[0],`
|
|
15
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Yl(t[0],`
|
|
16
|
+
`).split(`
|
|
17
|
+
`),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(`
|
|
18
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
19
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
20
|
+
${s}`:s,r=r?`${r}
|
|
21
|
+
${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=t.raw+`
|
|
22
|
+
`+e.join(`
|
|
23
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
24
|
+
`+e.join(`
|
|
25
|
+
`),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(`
|
|
26
|
+
`);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=Ql(t[2].split(`
|
|
27
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
28
|
+
`,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+`
|
|
29
|
+
`,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(`
|
|
30
|
+
`,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+=`
|
|
31
|
+
`+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+=`
|
|
32
|
+
`+l}u=!l.trim(),r+=p+`
|
|
33
|
+
`,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){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);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){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}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=Xl(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:Yl(t[0],`
|
|
34
|
+
`),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=Jl(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
35
|
+
`):[],a={type:`table`,raw:Yl(t[0],`
|
|
36
|
+
`),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(Jl(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:Yl(t[0],`
|
|
37
|
+
`),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)===`
|
|
38
|
+
`?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=Yl(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Zl(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)),$l(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 $l(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 n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,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}}}},nu=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||jc,this.options.tokenizer=this.options.tokenizer||new tu,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:Ic,block:Hl.normal,inline:Ul.normal};this.options.pedantic?(t.block=Hl.pedantic,t.inline=Ul.pedantic):this.options.gfm&&(t.block=Hl.gfm,this.options.breaks?t.inline=Ul.breaks:t.inline=Ul.gfm),this.tokenizer.rules=t}static get rules(){return{block:Hl,inline:Ul}}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(Ic.carriageReturn,`
|
|
39
|
+
`),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(Ic.tabCharGlobal,` `).replace(Ic.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+=`
|
|
40
|
+
`: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(`
|
|
41
|
+
`)?``:`
|
|
42
|
+
`)+i.raw,n.text+=`
|
|
43
|
+
`+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(`
|
|
44
|
+
`)?``:`
|
|
45
|
+
`)+i.raw,n.text+=`
|
|
46
|
+
`+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(`
|
|
47
|
+
`)?``:`
|
|
48
|
+
`)+i.raw,r.text+=`
|
|
49
|
+
`+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(`
|
|
50
|
+
`)?``:`
|
|
51
|
+
`)+i.raw,n.text+=`
|
|
52
|
+
`+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,`++`),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)}},ru=class{options;parser;constructor(e){this.options=e||jc}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Ic.notSpaceStart)?.[0],i=e.replace(Ic.endingNewline,``)+`
|
|
53
|
+
`;return r?`<pre><code class="language-`+Kl(r)+`">`+(n?i:Kl(i,!0))+`</code></pre>
|
|
54
|
+
`:`<pre><code>`+(n?i:Kl(i,!0))+`</code></pre>
|
|
55
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
56
|
+
${this.parser.parse(e)}</blockquote>
|
|
57
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
58
|
+
`}hr(e){return`<hr>
|
|
59
|
+
`}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+`>
|
|
60
|
+
`+r+`</`+i+`>
|
|
61
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
62
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
63
|
+
`}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>
|
|
64
|
+
<thead>
|
|
65
|
+
`+t+`</thead>
|
|
66
|
+
`+r+`</table>
|
|
67
|
+
`}tablerow({text:e}){return`<tr>
|
|
68
|
+
${e}</tr>
|
|
69
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
70
|
+
`}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>${Kl(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=ql(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Kl(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=ql(e);if(i===null)return Kl(n);e=i;let a=`<img src="${e}" alt="${Kl(n)}"`;return t&&(a+=` title="${Kl(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Kl(e.text)}},iu=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}},au=class e{options;renderer;textRenderer;constructor(e){this.options=e||jc,this.options.renderer=this.options.renderer||new ru,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new iu}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`,`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`,`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}},ou=class{options;block;constructor(e){this.options=e||jc}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?nu.lex:nu.lexInline}provideParser(e=this.block){return e?au.parse:au.parseInline}},su=new class{defaults=Ac();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=au;Renderer=ru;TextRenderer=iu;Lexer=nu;Tokenizer=tu;Hooks=ou;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 ru(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 tu(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 ou;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];ou.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&ou.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)}: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 nu.lex(e,t??this.defaults)}parser(e,t){return au.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?nu.lex:nu.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?au.parse:au.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?nu.lex:nu.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?au.parse:au.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+=`
|
|
71
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Kl(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function cu(e,t){return su.parse(e,t)}cu.options=cu.setOptions=function(e){return su.setOptions(e),cu.defaults=su.defaults,Mc(cu.defaults),cu},cu.getDefaults=Ac,cu.defaults=jc,cu.use=function(...e){return su.use(...e),cu.defaults=su.defaults,Mc(cu.defaults),cu},cu.walkTokens=function(e,t){return su.walkTokens(e,t)},cu.parseInline=su.parseInline,cu.Parser=au,cu.parser=au.parse,cu.Renderer=ru,cu.TextRenderer=iu,cu.Lexer=nu,cu.lexer=nu.lex,cu.Tokenizer=tu,cu.Hooks=ou,cu.parse=cu,cu.options,cu.setOptions,cu.use,cu.walkTokens,cu.parseInline,au.parse,nu.lex,cu.setOptions({gfm:!0,breaks:!0});function lu(e){let t=cu.parse(e,{async:!1});return kc.sanitize(t,{ADD_ATTR:[`target`,`rel`]})}var uu=i(`<div></div>`);function du(e,t){E(t,!0);let n=j(t,`className`,3,``),r=C(()=>lu(t.content));var i=uu();D(i,()=>p(r),!0),k(i),U(e=>I(i,1,e),[()=>P(G(`chat-markdown`,n()))]),v(e,i),M()}var fu=i(`<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>`),pu=i(`<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 mu(e,t){E(t,!0);let i=x(null),c=x(!1),u=x(!1),d=x(!1),f=x(null),m=x(null),h=null,g=0,_={"image/jpeg":`jpg`,"image/png":`png`,"image/gif":`gif`,"image/webp":`webp`};function S(e){let t=e.name.trim()||`image`,n=_[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}`}n(()=>{if(g+=1,!t.image)return;l(c,!1),l(u,!1),l(d,!1),l(f,null),l(m,null);let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=!1;o().then(()=>{n||p(i)?.focus()});let r=document.body.style.overflow;document.body.style.overflow=`hidden`;function a(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onClose();return}if(e.key!==`Tab`||!p(i))return;let n=Array.from(p(i).querySelectorAll(`button:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`));if(n.length===0){e.preventDefault(),p(i).focus();return}let r=n[0],a=n[n.length-1],o=document.activeElement;e.shiftKey&&(o===p(i)||o===r||!p(i).contains(o))?(e.preventDefault(),a.focus()):!e.shiftKey&&(o===p(i)||o===a||!p(i).contains(o))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,a,!0),()=>{n=!0,window.removeEventListener(`keydown`,a,!0),document.body.style.overflow=r,h!==null&&(window.clearTimeout(h),h=null),e?.isConnected&&e.focus()}});async function w(e){let t=await fetch(e.url);if(!t.ok)throw Error(`Fetch failed with status ${t.status}`);return t.blob()}async function T(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 D(e){if(p(u))return;let t=g;l(u,!0),l(f,null),l(m,null);try{if(typeof ClipboardItem>`u`)throw Error(`Clipboard images unsupported`);let n=w(e).then(T);if(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),t!==g)return;l(c,!0),h!==null&&window.clearTimeout(h),h=window.setTimeout(()=>{l(c,!1),h=null},2e3)}catch{t===g&&(l(c,!1),l(f,`Could not copy the image to the clipboard.`))}finally{t===g&&l(u,!1)}}async function ee(e){if(p(d))return;let t=g;l(d,!0),l(f,null),l(m,null);try{let n=await w(e);if(t!==g)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=S(e),document.body.append(i);try{i.click()}finally{i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e4)}}catch{t===g&&l(m,`Could not download the image.`)}finally{t===g&&l(d,!1)}}let te=`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 A=a(),ne=b(A),re=e=>{let n=C(()=>t.image);var a=pu(),o=y(a),h=y(o),g=s(h,2),_=y(g);I(_,1,P(te));var b=y(_),x=e=>{Zt(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},S=e=>{pt(e,{class:`size-4`,"aria-hidden":`true`})},w=e=>{Ct(e,{class:`size-4`,"aria-hidden":`true`})};r(b,e=>{p(u)?e(x):p(c)?e(S,1):e(w,-1)}),k(_);var T=s(_,2);I(T,1,P(te));var E=y(T),A=e=>{Zt(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},ne=e=>{Dt(e,{class:`size-4`,"aria-hidden":`true`})};r(E,e=>{p(d)?e(A):e(ne,-1)}),k(T),k(g);var re=s(g,2),j=y(re,!0);k(re);var M=s(re,2),ie=e=>{var t=fu(),n=y(t,!0);k(t),U(()=>V(n,p(f)??p(m))),v(e,t)};r(M,e=>{(p(f)||p(m))&&e(ie)}),k(o),le(o,e=>l(i,e),()=>p(i)),k(a),U(()=>{O(o,`aria-label`,`Image preview: ${p(n).name??``}`),O(h,`src`,p(n).url),O(h,`alt`,p(n).name),O(_,`aria-disabled`,p(u)),O(_,`aria-label`,p(u)?`Copying image`:p(c)?`Image copied`:`Copy image`),O(_,`title`,p(u)?`Copying image`:p(c)?`Image copied`:`Copy image`),O(T,`aria-disabled`,p(d)),O(T,`aria-label`,p(d)?`Downloading image`:`Download image`),O(T,`title`,p(d)?`Downloading image`:`Download image`),V(j,p(u)?`Copying image`:p(c)?`Image copied`:p(d)?`Downloading image`:``)}),N(`click`,a,e=>{e.target===e.currentTarget&&t.onClose()}),N(`click`,_,()=>void D(p(n))),N(`click`,T,()=>void ee(p(n))),v(e,a)};r(ne,e=>{t.image&&e(re)}),v(e,A),M()}t([`click`]);function hu(e){let t=x(!1),r=x(!1);n(()=>{e()?l(r,!1):l(t,!1)});let i=C(()=>e()?!p(r):p(t));function a(){e()?l(r,!p(r)):l(t,!p(t))}return{get expanded(){return p(i)},toggle:a}}var gu=i(`<div class="text-muted-foreground mt-1.5 text-[13px] leading-6 whitespace-pre-wrap"> </div>`),_u=i(`<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 vu(e,t){E(t,!0);let n=hu(()=>t.inProgress),i=C(()=>t.inProgress?`Reasoning`:`Reasoned`);var a=_u(),o=y(a),c=y(o);lt(c,{class:`size-3.5 shrink-0`,"aria-hidden":`true`});var l=s(c,2),u=y(l,!0);k(l);var d=s(l,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${n.expanded?`rotate-90`:``}`);_t(d,{get class(){return p(e)},"aria-hidden":`true`})}k(o);var f=s(o,2),m=e=>{var n=gu(),r=y(n,!0);k(n),U(()=>V(r,t.text)),v(e,n)};r(f,e=>{n.expanded&&e(m)}),k(a),U(()=>{O(o,`aria-expanded`,n.expanded),V(u,p(i))}),N(`click`,o,function(...e){n.toggle?.apply(this,e)}),v(e,a),M()}t([`click`]);var yu=i(`<div class="text-muted-foreground mt-1.5 space-y-1.5 text-[13px] leading-6"></div>`),bu=i(`<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 xu(e,t){E(t,!0);let n=x(null),i=C(()=>p(n)??t.defaultExpanded??t.tools.length<=2);function o(){l(n,!p(i))}var c=bu(),u=y(c),d=y(u);{let e=C(()=>`size-3.5 shrink-0 ${t.iconClass??``}`);B(d,()=>t.icon,(t,n)=>{n(t,{get class(){return p(e)},"aria-hidden":`true`})})}var f=s(d,2),m=y(f,!0);k(f);var h=s(f,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${p(i)?`rotate-90`:``}`);_t(h,{get class(){return p(e)},"aria-hidden":`true`})}k(u);var g=s(u,2),_=e=>{var n=yu();ue(n,21,()=>t.tools,e=>e.callId,(e,n)=>{var r=a();H(b(r),()=>t.toolRow,()=>p(n)),v(e,r)}),k(n),v(e,n)};r(g,e=>{p(i)&&e(_)}),k(c),U(()=>{O(u,`aria-expanded`,p(i)),V(m,t.label)}),N(`click`,u,o),v(e,c),M()}t([`click`]);function Su(e){let t=Math.floor(e/60),n=e%60;return t===0?`${n}s`:`${t}m ${n}s`}var Cu=i(`<div class="mt-1.5 space-y-2"><!></div>`),wu=i(`<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 Tu(e,t){E(t,!0);let i=x(0),a=hu(()=>t.inProgress);n(()=>{let e=t.startedAtMs;if(t.inProgress){let t=()=>{l(i,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}let n=t.completedAtMs??Date.now();l(i,Math.max(0,Math.floor((n-e)/1e3)),!0)});let o=C(()=>t.inProgress?`Working for ${Su(p(i))}`:`Worked for ${Su(p(i))}`);var c=wu(),u=y(c),d=y(u),f=y(d,!0);k(d);var m=s(d,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${a.expanded?`rotate-90`:``}`);_t(m,{get class(){return p(e)},"aria-hidden":`true`})}k(u);var h=s(u,2),g=e=>{var n=Cu();H(y(n),()=>t.children),k(n),v(e,n)};r(h,e=>{a.expanded&&e(g)}),k(c),U(()=>{O(u,`aria-expanded`,a.expanded),V(f,p(o))}),N(`click`,u,function(...e){a.toggle?.apply(this,e)}),v(e,c),M()}t([`click`]);var Eu=i(`<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>`),Du=i(`<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>`),Ou=i(`<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>`),ku=i(`<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>`),Au=i(`<span class="text-muted-foreground border-hairline bg-hover-fill inline-flex items-center rounded-xl border px-3 py-2 text-xs"> </span>`),ju=i(`<li><!></li>`),Mu=i(`<ul class="flex max-w-132 flex-wrap justify-end gap-2" aria-label="Attached images"></ul>`),Nu=i(`<div><!></div>`),Pu=i(`<button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex size-6 items-center justify-center rounded-md transition"><!></button>`),Fu=i(`<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>`),Iu=i(`<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>`),Lu=i(`<div class="flex flex-col items-end gap-1.5"><!> <!> <!> <!></div>`),Ru=i(`<details class="min-w-0"><summary class="min-w-0 cursor-pointer text-left"><span> </span> <span> </span></summary> <p role="status"> </p></details>`),zu=i(`<p> </p>`),Bu=i(`<p class="flex min-w-0 items-start gap-1.5"><!> <span> </span></p>`),Vu=i(`<!> <!>`,1),Hu=i(`<p class="text-muted-foreground text-sm"> </p>`),Uu=i(`<div class="w-full min-w-0" aria-atomic="false" aria-relevant="additions text"><div class="space-y-3"><!> <!> <!></div></div>`),Wu=i(`<div class="space-y-8 pb-14"></div>`),Gu=i(`<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 Ku(e,t){E(t,!0);let i=j(t,`remoteChangeNotice`,3,null),c=j(t,`emptyStateMessage`,19,()=>t.project?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`),u=C(()=>t.messages.find(e=>e.type===`prompt`)?._id),d=x(null),m=x(!0);function h(){let e=p(d);if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;l(m,t<=28)}function g(e){return e.type===`tool-group`&&(e.toolKey===`create_artifact`||e.toolKey===`update_artifact`)}function _(e){return!g(e)}let S=x(null),w=x(null),T=null;async function D(e,t){try{await navigator.clipboard.writeText(t),l(w,e,!0),T!==null&&clearTimeout(T),T=setTimeout(()=>{p(w)===e&&l(w,null),T=null},1500)}catch{l(w,null)}}n(()=>()=>{T!==null&&clearTimeout(T)});function ee(){let e=p(d);!e||!p(m)||(e.scrollTop=e.scrollHeight)}n(()=>{t.messages,t.actions,p(m)&&o().then(ee)}),n(()=>{let e=p(d);if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{ee()});return t.observe(e),()=>{t.disconnect()}});var te=Gu(),A=b(te),re=y(A),ie=y(re),ae=y(ie),oe=e=>{var n=Eu(),r=y(n,!0);k(n),U(()=>V(r,t.currentError)),v(e,n)};r(ae,e=>{t.currentError&&e(oe)});var F=s(ae,2),se=e=>{var n=Du(),r=y(n,!0);k(n),U(()=>V(r,t.runError)),v(e,n)};r(F,e=>{t.runError&&e(se)});var ce=s(F,2),L=e=>{var t=Ou(),n=y(t),r=y(n),i=y(r,!0);k(r),k(n),k(t),U(()=>V(i,c())),v(e,t)},R=e=>{var n=Wu();ue(n,21,()=>t.messages,e=>e._id,(e,n)=>{var o=a(),c=b(o),d=e=>{var a=Lu(),o=y(a),c=e=>{var t=Mu();ue(t,21,()=>p(n).attachments,e=>e.imageUploadId,(e,t)=>{var n=ju(),i=y(n),a=e=>{let n=C(()=>p(t).url);var r=ku(),i=y(r);k(r),U(()=>{O(r,`aria-label`,`View ${p(t).name??``}`),O(r,`title`,p(t).name),O(i,`src`,p(n))}),N(`click`,r,()=>{l(S,{url:p(n),name:p(t).name,mediaType:p(t).mediaType},!0)}),v(e,r)},o=e=>{var n=Au(),r=y(n);k(n),U(()=>V(r,`${p(t).name??``} (unavailable)`)),v(e,n)};r(i,e=>{p(t).url?e(a):e(o,-1)}),k(n),v(e,n)}),k(t),v(e,t)};r(o,e=>{p(n).attachments.length&&e(c)});var d=s(o,2),f=e=>{var t=Nu();I(t,1,P(`user-bubble w-fit max-w-[33rem] rounded-xl border px-5 py-3.5 text-[15.5px] leading-7 text-foreground`));var r=y(t);{let e=C(()=>p(n).text||` `);du(r,{get content(){return p(e)},className:`text-foreground`})}k(t),v(e,t)};r(d,e=>{(p(n).text||!p(n).attachments.length)&&e(f)});var m=s(d,2),h=e=>{var t=Pu(),i=y(t),a=e=>{pt(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{Ct(e,{class:`size-3.5`,"aria-hidden":`true`})};r(i,e=>{p(w)===p(n)._id?e(a):e(o,-1)}),k(t),U(()=>O(t,`aria-label`,p(w)===p(n)._id?`Copied`:`Copy message`)),N(`click`,t,()=>{D(p(n)._id,p(n).text)}),v(e,t)};r(m,e=>{p(n).text&&e(h)});var g=s(m,2),_=e=>{var n=Iu(),a=y(n),o=y(a),c=y(o,!0);k(o);var l=s(o,2),u=e=>{var n=Fu();N(`click`,n,function(...e){t.onDismissRemoteChangeNotice?.apply(this,e)}),v(e,n)};r(l,e=>{t.onDismissRemoteChangeNotice&&e(u)}),k(a),k(n),U(()=>V(c,i())),v(e,n)};r(g,e=>{i()&&p(n)._id===p(u)&&e(_)}),k(a),v(e,a)},f=e=>{let i=C(()=>t.actions.filter(e=>e.runId===p(n).runId)),o=C(()=>Ho(p(n).parts,p(i))),c=C(()=>p(o).filter(e=>e.type===`tool`)),l=C(()=>Io(p(c))),u=C(()=>wo(p(o))),d=C(()=>Eo(p(u))),f=C(()=>{let{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}=Ao(p(d));return{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}}),m=C(()=>p(n).runId===t.activeRunId&&p(n).runStatus!==`completed`&&p(n).runStatus!==`failed`&&p(n).runStatus!==`cancelled`),h=C(()=>Ro(p(c),p(m))),g=C(()=>p(o).some(e=>e.type===`text`||e.type===`reasoning`));var x=Uu(),S=y(x),w=y(S),T=e=>{{let t=C(()=>p(n).text||`...`);du(e,{get content(){return p(t)},className:`text-foreground`})}};r(w,e=>{!p(g)&&(p(n).text||p(m)&&p(o).length===0)&&e(T)});var E=s(w,2);ue(E,19,()=>p(d),(e,t)=>`${e.type}-${e.type===`work`?e.key:e.id}-${t}`,(e,t,i)=>{var o=a(),c=b(o),u=e=>{{let n=C(()=>p(t).text||` `);du(e,{get content(){return p(n)},className:`text-foreground`})}},g=e=>{let o=C(()=>{let{settledBlocks:e,runningTools:n}=zo(p(t).blocks,p(m),p(h));return{settledBlocks:e,runningTools:n}}),c=C(()=>p(o).settledBlocks.filter(_)),u=C(()=>p(m)&&(p(i)===p(d).length-1||p(o).runningTools.length>0)),g=C(()=>p(f).workIndexBySectionIndex[p(i)]??0),x=C(()=>jo(p(t),{inProgress:p(u),workSectionIndex:p(g),runStartedAt:p(n).runStartedAt,runCompletedAt:p(n).runCompletedAt,priorWorkCompletedAtMs:p(f).priorCompletedAtByWorkIndex[p(g)]}));var S=Vu(),w=b(S),T=e=>{Tu(e,{get inProgress(){return p(u)},get startedAtMs(){return p(x).startedAtMs},get completedAtMs(){return p(x).completedAtMs},children:(e,t)=>{var n=a();ue(b(n),19,()=>p(c),(e,t)=>`${e.type}-${e.type===`tool-group`?e.tools.map(e=>e.callId).join(`,`):e.id}-${t}`,(e,t,n)=>{var i=a(),d=b(i),f=e=>{let r=C(()=>p(u)&&p(o).runningTools.length===0&&p(n)===p(c).length-1);vu(e,{get text(){return p(t).text},get inProgress(){return p(r)}})},h=e=>{{let n=(e,t=ne)=>{let n=C(()=>Vo(t(),p(m))),i=C(()=>Bo(t(),p(m))),o=C(()=>as(t(),p(l)));var c=a(),u=b(c),d=e=>{var r=Ru(),a=y(r),c=y(a),u=y(c,!0);k(c);var d=s(c,2),f=y(d);k(d),k(a);var h=s(a,2),g=y(h,!0);k(h),k(r),U((e,t)=>{O(a,`title`,e),I(c,1,t),V(u,p(o)),I(d,1,P(p(i)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`)),V(f,`(${p(i)??``})`),I(h,1,`mt-1.5 text-xs leading-5 wrap-break-word whitespace-pre-wrap ${p(i)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`}`),V(g,p(n))},[()=>os(t(),p(m),p(l)),()=>P(Xo(t()))]),v(e,r)},f=e=>{var n=zu(),r=y(n,!0);k(n),U((e,t)=>{I(n,1,e),O(n,`title`,t),V(r,p(o))},[()=>`min-w-0 ${Xo(t())}`,()=>os(t(),p(m),p(l))]),v(e,n)};r(u,e=>{p(n)&&p(i)?e(d):e(f,-1)}),v(e,c)},i=C(()=>qo(p(t).toolKey)),o=C(()=>Wo(p(t).toolKey)),c=C(()=>p(t).toolKey===`apply_patch`?rs(p(t).tools)<=2:void 0);xu(e,{get label(){return p(i)},get icon(){return p(o)},get tools(){return p(t).tools},get defaultExpanded(){return p(c)},toolRow:n,$$slots:{toolRow:!0}})}};r(d,e=>{p(t).type===`reasoning`?e(f):e(h,-1)}),v(e,i)}),v(e,n)},$$slots:{default:!0}})};r(w,e=>{(p(c).length>0||p(u)||p(o).runningTools.length>0)&&e(T)});var E=s(w,2),D=e=>{xu(e,{label:`Running`,get icon(){return Zt},iconClass:`animate-spin`,get tools(){return p(o).runningTools},defaultExpanded:!0,toolRow:(e,t=ne)=>{let n=C(()=>Go(t())),r=C(()=>as(t(),p(l)));var i=Bu(),a=y(i);B(a,()=>p(n),(e,t)=>{t(e,{class:`text-muted-foreground mt-1.5 size-3 shrink-0`,"aria-hidden":`true`})});var o=s(a,2),c=y(o,!0);k(o),k(i),U(e=>{O(i,`title`,`${p(r)} (running)`),I(o,1,e),V(c,p(r))},[()=>P(Xo(t()))]),v(e,i)},$$slots:{toolRow:!0}})};r(E,e=>{p(o).runningTools.length>0&&e(D)}),v(e,S)};r(c,e=>{p(t).type===`text`?e(u):e(g,-1)}),v(e,o)});var D=s(E,2),ee=e=>{var t=Hu(),r=y(t);k(t),U(e=>V(r,`Worked for ${e??``}`),[()=>Su(Math.max(0,Math.floor((p(n).runCompletedAt-p(n).runStartedAt)/1e3)))]),v(e,t)};r(D,e=>{!p(m)&&p(n).runCompletedAt!==void 0&&e(ee)}),k(S),k(x),U(()=>{O(x,`role`,p(m)?`log`:void 0),O(x,`aria-live`,p(m)?`polite`:void 0)}),v(e,x)};r(c,e=>{p(n).type===`prompt`?e(d):e(f,-1)}),v(e,o)}),k(n),v(e,n)};r(ce,e=>{t.messages.length===0?e(L):e(R,-1)}),k(ie),k(re),le(re,e=>l(d,e),()=>p(d)),z(2),k(A),mu(s(A,2),{get image(){return p(S)},onClose:()=>{l(S,null)}}),f(`scroll`,re,h),v(e,te),M()}t([`click`]);function qu(e){return e.replace(/<\/(script)/gi,`<\\/$1`).replace(/<!--/g,`<\\!--`)}function Ju(e,t){return`<!DOCTYPE html>
|
|
72
|
+
<html lang="en">
|
|
73
|
+
<head>
|
|
74
|
+
<meta charset="utf-8" />
|
|
75
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
76
|
+
${e}</head>
|
|
77
|
+
<body>
|
|
78
|
+
${t}
|
|
79
|
+
</body>
|
|
80
|
+
</html>`}function Yu(e){return Ju(`<style>
|
|
81
|
+
html, body, #root { margin: 0; min-height: 100%; }
|
|
82
|
+
body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }
|
|
83
|
+
#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; }
|
|
84
|
+
</style>
|
|
85
|
+
<script src="https://unpkg.com/@babel/standalone@7.26.5/babel.min.js"><\/script>
|
|
86
|
+
<script>
|
|
87
|
+
window.addEventListener('error', (event) => {
|
|
88
|
+
const root = document.getElementById('root');
|
|
89
|
+
if (!root || root.hasChildNodes()) return;
|
|
90
|
+
const el = document.createElement('div');
|
|
91
|
+
el.id = 'artifact-error';
|
|
92
|
+
el.textContent = 'Artifact failed to render: ' + (event.message || 'unknown error');
|
|
93
|
+
root.appendChild(el);
|
|
94
|
+
});
|
|
95
|
+
<\/script>
|
|
96
|
+
`,`<div id="root"></div>
|
|
97
|
+
<script type="module">
|
|
98
|
+
import * as React from "https://esm.sh/react@19.1.0";
|
|
99
|
+
import { createRoot } from "https://esm.sh/react-dom@19.1.0/client";
|
|
100
|
+
window.React = React;
|
|
101
|
+
window.createRoot = createRoot;
|
|
102
|
+
window.exports = {};
|
|
103
|
+
window.require = (name) => {
|
|
104
|
+
if (name === 'react') return React;
|
|
105
|
+
if (name === 'react-dom' || name === 'react-dom/client') return { createRoot };
|
|
106
|
+
if (name === 'react/jsx-runtime')
|
|
107
|
+
return { jsx: React.createElement, jsxs: React.createElement, Fragment: React.Fragment };
|
|
108
|
+
throw new Error('Artifact previews cannot import "' + name + '"');
|
|
109
|
+
};
|
|
110
|
+
<\/script>
|
|
111
|
+
<script type="text/babel" data-presets="react" data-plugins="transform-modules-commonjs">
|
|
112
|
+
${qu(e.trim())}
|
|
113
|
+
|
|
114
|
+
const __root = document.getElementById('root');
|
|
115
|
+
const __App = typeof App !== 'undefined' ? App : exports.default;
|
|
116
|
+
if (!__App) {
|
|
117
|
+
__root.textContent = 'React artifact must define a function/component named App.';
|
|
118
|
+
} else {
|
|
119
|
+
window.createRoot(__root).render(window.React.createElement(__App));
|
|
120
|
+
}
|
|
121
|
+
<\/script>`)}function Xu(e){let t=e.trim();return/^<!DOCTYPE html>/i.test(t)||/^<html[\s>]/i.test(t)?t:Ju(``,t)}function Zu(e,t){return e===`react`?Yu(t):e===`html`?Xu(t):null}var Qu=i(`<iframe sandbox="allow-scripts"></iframe>`),$u=i(`<pre class="h-full overflow-auto p-3 pr-10 text-[13px] leading-6"><code> </code></pre>`),ed=i(`<div class="h-full overflow-auto p-3 pr-10"><!></div>`),td=i(`<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>`),nd=i(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Back to artifacts"><!></button>`),rd=i(`<!> Preview`,1),id=i(`<!> Source`,1),ad=i(`<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>`),od=i(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Open fullscreen"><!></button>`),sd=i(`<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 cd(e,t){E(t,!0);let i=j(t,`variant`,3,`card`),a=C(()=>Zu(t.artifactType,t.content)),o=x(!1),c=x(!1),u=null;async function d(){try{await navigator.clipboard.writeText(t.content),l(c,!0),u!==null&&clearTimeout(u),u=setTimeout(()=>{l(c,!1),u=null},1500)}catch{l(c,!1)}}n(()=>()=>{u!==null&&clearTimeout(u)});var f=sd();{let e=(e,n=ne)=>{var i=td(),l=y(i),u=e=>{var r=Qu();U(()=>{O(r,`title`,`${t.title} preview`),O(r,`srcdoc`,p(a)),I(r,1,`block w-full bg-white ${n()}`)}),v(e,r)},f=e=>{var n=$u(),r=y(n),i=y(r,!0);k(r),k(n),U(()=>V(i,t.content)),v(e,n)},m=e=>{var n=ed();du(y(n),{get content(){return t.content},className:`text-sm text-foreground`}),k(n),v(e,n)};r(l,e=>{p(a)&&!p(o)?e(u):p(a)?e(f,1):e(m,-1)});var h=s(l,2),g=y(h),_=e=>{pt(e,{class:`size-3.5`,"aria-hidden":`true`})},b=e=>{Ct(e,{class:`size-3.5`,"aria-hidden":`true`})};r(g,e=>{p(c)?e(_):e(b,-1)}),k(h),k(i),U(()=>O(h,`aria-label`,p(c)?`Copied`:`Copy`)),N(`click`,h,d),v(e,i)};var m=y(f),h=y(m),g=e=>{var n=nd();rt(y(n),{class:`size-4`,"aria-hidden":`true`}),k(n),N(`click`,n,function(...e){t.onBack?.apply(this,e)}),v(e,n)};r(h,e=>{t.onBack&&e(g)});var _=s(h,2),S=y(_),w=y(S,!0);k(S);var T=s(S,2),D=y(T,!0);k(T),k(_);var ee=s(_,2),te=e=>{var t=ad(),n=y(t),i=e=>{var t=rd();jt(b(t),{class:`size-3.5`,"aria-hidden":`true`}),z(),v(e,t)},a=e=>{var t=id();xt(b(t),{class:`size-3.5`,"aria-hidden":`true`}),z(),v(e,t)};r(n,e=>{p(o)?e(i):e(a,-1)}),k(t),U(()=>O(t,`aria-label`,p(o)?`Show preview`:`Show source`)),N(`click`,t,()=>l(o,!p(o))),v(e,t)};r(ee,e=>{p(a)&&e(te)});var A=s(ee,2),re=e=>{var n=od();rn(y(n),{class:`size-4`,"aria-hidden":`true`}),k(n),N(`click`,n,function(...e){t.onExpand?.apply(this,e)}),v(e,n)};r(A,e=>{t.onExpand&&e(re)}),k(m);var ie=s(m,2),ae=t=>{e(t,()=>`h-full`)},oe=t=>{e(t,()=>`h-64`)};r(ie,e=>{i()===`full`?e(ae):e(oe,-1)}),k(f),U(()=>{V(w,t.title),V(D,t.artifactType)})}U(()=>I(f,1,P(i()===`full`?`bg-card flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border`:`bg-card rounded-lg border`))),v(e,f),M()}t([`click`]);var ld=i(`<div class="flex min-h-0 flex-1 flex-col p-3"><!></div>`),ud=i(`<div><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-hover:opacity-100"><!></button></div>`),dd=i(`<p class="text-muted-foreground p-3 text-sm">No artifacts yet.</p>`),fd=i(`<div class="min-h-0 flex-1 space-y-0.5 overflow-y-auto p-2"></div>`),pd=i(`<aside class="flex h-screen min-h-0 w-full flex-col border-l"><div class="flex items-center gap-1 border-b px-2 py-1.5"><span class="bg-muted text-foreground rounded-md px-2.5 py-1 text-xs font-medium" aria-current="page">Artifacts</span> <div class="flex-1"></div> <button type="button" class="text-muted-foreground hover:text-foreground transition" aria-label="Close panel"><!></button></div> <!></aside>`);function md(e,t){E(t,!0);let n=C(()=>t.artifacts.find(e=>e.key===t.selectedKey)??null),i={markdown:Lt,html:Gt,react:Nt};var a=pd(),o=y(a),c=s(y(o),4);Mn(y(c),{class:`size-4`,"aria-hidden":`true`}),k(c),k(o);var l=s(o,2),u=e=>{var r=ld();cd(y(r),{get title(){return p(n).title},get artifactType(){return p(n).artifactType},get content(){return p(n).content},variant:`full`,onExpand:()=>t.onExpand(p(n).key),get onBack(){return t.onBack}}),k(r),v(e,r)},d=e=>{var n=fd();ue(n,21,()=>t.artifacts,e=>e.key,(e,n)=>{let r=C(()=>i[p(n).artifactType]);var a=ud(),o=y(a),c=y(o);B(c,()=>p(r),(e,t)=>{t(e,{class:`text-muted-foreground size-3.5 shrink-0`,"aria-hidden":`true`})});var l=s(c,2),u=y(l,!0);k(l),k(o);var d=s(o,2);rn(y(d),{class:`size-3.5`,"aria-hidden":`true`}),k(d),k(a),U(()=>{I(a,1,`group hover:bg-muted flex items-center gap-2 rounded-md px-2 py-1.5 ${t.selectedKey===p(n).key?`bg-muted`:``}`),V(u,p(n).title),O(d,`aria-label`,`Open ${p(n).title} fullscreen`)}),N(`click`,o,()=>t.onSelect(p(n).key)),N(`click`,d,()=>t.onExpand(p(n).key)),v(e,a)},e=>{v(e,dd())}),k(n),v(e,n)};r(l,e=>{p(n)?e(u):e(d,-1)}),k(a),N(`click`,c,function(...e){t.onClose?.apply(this,e)}),v(e,a),M()}t([`click`]);function hd(e){return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`.\\`)||e.startsWith(`..\\`)||e.startsWith(`/`)||e.startsWith(`~/`)||e===`~`||/^[a-zA-Z]:[\\/]/.test(e)}function gd(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 _d(e){let t=gd(e);return e.slice(t.length)}function vd(e,t){let n=e.includes(`\\`)?`\\`:`/`;return`${gd(e)}${t}${n}`}function yd(e){return/[\\/]$/.test(e)}function bd(e){return e.replace(/[\\/]+$/,``)}function xd(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 Sd(e){let t=e.query.trim();return t?yd(t)?e.browseParentPath||bd(t):xd({leaf:_d(t),browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})??t:``}function Cd(e){let t=e.query.trim();if(!t||yd(t))return!1;let n=_d(t);return n?xd({leaf:n,browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})===void 0:!1}var wd=i(`<p class="text-muted-foreground px-2 pb-1 text-[11px]">Reconnect <span class="text-muted-foreground"> </span> to a local directory</p>`),Td=i(`<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>`),Ed=i(`<div class="border-hairline flex flex-wrap gap-1.5 border-b px-3 py-2"></div>`),Dd=i(`<p class="text-muted-foreground px-3 py-8 text-center text-sm"> </p>`),Od=i(`<button type="button" role="option"><!> <span class="truncate"> </span></button>`),kd=i(`<p class="text-destructive border-t border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"> </p>`),Ad=i(`<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 jd(e,t){E(t,!0);let i=j(t,`mode`,3,`add`),o=j(t,`recentProjectPaths`,19,()=>[]),c=x(`~/`),d=x(u([])),f=x(``),m=x(null),h=x(!1),g=x(!1),_=x(null),S=0,w=x(!1),T=C(()=>_d(p(c)).toLowerCase()),D=C(()=>{let e=p(T).startsWith(`.`);return p(d).filter(t=>t.name.toLowerCase().startsWith(p(T))&&(e||!t.name.startsWith(`.`)))}),te=C(()=>p(c).trim()),A=C(()=>Sd({query:p(c),browseParentPath:p(f),browseEntries:p(d)})),ne=C(()=>Cd({query:p(c),browseParentPath:p(f),browseEntries:p(d)})),re=C(()=>p(A).length>0&&(hd(p(te))||p(f).length>0)),ie=C(()=>i()===`reconnect`?`Reconnect`:p(ne)?`Create & add`:`Add`),ae=C(()=>{if(p(D).length>0)return p(D);let e=_d(p(c)).replace(/[\\/]+$/,``);if(!e||p(T).length===0)return p(D);let t=p(f).split(/[/\\]/).filter(Boolean).at(-1);return t&&t.toLowerCase()===e.toLowerCase()?[{name:t,fullPath:p(f)}]:p(D)}),P=C(()=>p(h)?`Loading directories…`:p(A).length>0&&!p(ne)?i()===`reconnect`?`Press Enter to reconnect this directory.`:`Press Enter to add this directory.`:p(ne)?i()===`reconnect`?`Press Enter to create and reconnect this directory.`:`Press Enter to create and add this directory.`:`No matching directories in this path.`);n(()=>{if(!t.open){l(w,!1);return}p(w)||(l(w,!0),l(c,`~/`),l(m,null),l(_,null),oe(p(c)))}),n(()=>{if(!t.open||!p(w))return;let e=p(c),n=window.setTimeout(()=>{oe(e)},180);return()=>{window.clearTimeout(n)}});async function oe(e){let n=++S;l(h,!0);try{let r=await t.desktopApi.browseFilesystem({partialPath:e.trim().length>0?e:`~/`});if(n!==S)return;l(f,r.parentPath,!0),l(d,r.entries,!0),l(_,null)}catch(e){if(n!==S)return;l(_,e instanceof Error?e.message:`Failed to browse directories.`,!0)}finally{n===S&&l(h,!1)}}function F(e){if(e.name===`..`){l(c,`${e.fullPath}/`),l(m,e.fullPath,!0);return}l(c,vd(p(f).endsWith(`/`)||p(f).endsWith(`\\`)?p(f):`${p(f)}/`,e.name),!0),l(m,e.fullPath,!0)}function se(e){l(c,`${e.workspacePath}/`),l(m,e.workspacePath,!0)}async function ce(){let e=p(A);if(!e){l(_,`Enter a project directory path.`);return}l(g,!0),l(_,null);try{let n=await t.desktopApi.resolveWorkspacePath({workspacePath:e,createIfMissing:p(ne)});await t.onSelect({workspacePath:n.workspacePath,displayName:n.displayName,repositoryKey:n.repositoryKey}),t.onClose()}catch(e){l(_,e instanceof Error?e.message:`Failed to open the selected project.`,!0)}finally{l(g,!1)}}function L(e){if(e.key===`Escape`){e.preventDefault(),t.onClose();return}e.key===`Enter`&&!e.shiftKey&&p(re)&&!p(g)&&(e.preventDefault(),ce())}var le=a(),B=b(le),H=e=>{var n=Ad(),u=y(n),d=y(u),f=y(d),x=y(f);Vt(y(x),{class:`size-4`}),k(x);var S=s(x,2);R(S),O(S,`spellcheck`,!1);var C=s(S,2),w=e=>{Zt(e,{class:`text-muted-foreground pointer-events-none absolute inset-e-24 top-1/2 size-4 -translate-y-1/2 animate-spin`})};r(C,e=>{p(h)&&e(w)});var T=s(C,2),E=y(T,!0);k(T),k(f);var D=s(f,2),te=e=>{var n=wd(),r=s(y(n)),i=y(r,!0);k(r),z(),k(n),U(()=>V(i,t.expectedDisplayName)),v(e,n)};r(D,e=>{i()===`reconnect`&&t.expectedDisplayName&&e(te)}),k(d);var A=s(d,2),ne=e=>{var t=Ed();ue(t,21,o,e=>e.workspacePath,(e,t)=>{var n=Td(),r=y(n,!0);k(n),U(()=>V(r,p(t).displayName)),N(`click`,n,()=>{se(p(t))}),v(e,n)}),k(t),v(e,t)};r(A,e=>{o().length>0&&e(ne)});var j=s(A,2),M=y(j),oe=e=>{var t=Dd(),n=y(t,!0);k(t),U(()=>V(n,p(P))),v(e,t)},le=e=>{var t=a();ue(b(t),17,()=>p(ae),e=>e.fullPath,(e,t)=>{var n=Od(),i=y(n),a=e=>{Tt(e,{class:`text-muted-foreground size-4 shrink-0`})},o=e=>{Ut(e,{class:`text-muted-foreground size-4 shrink-0`})};r(i,e=>{p(t).name===`..`?e(a):e(o,-1)});var c=s(i,2),l=y(c,!0);k(c),k(n),U(()=>{I(n,1,`flex min-h-8 w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition ${p(m)===p(t).fullPath?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),O(n,`aria-selected`,p(m)===p(t).fullPath),V(l,p(t).name)}),N(`click`,n,()=>{F(p(t))}),v(e,n)}),v(e,t)};r(M,e=>{p(ae).length===0?e(oe):e(le,-1)}),k(j);var B=s(j,2),H=e=>{var t=kd(),n=y(t,!0);k(t),U(()=>V(n,p(_))),v(e,t)};r(B,e=>{p(_)&&e(H)});var de=s(B,2),fe=y(de),pe=s(y(fe),2),me=y(pe);k(pe),z(2),k(fe);var he=s(fe,2);k(de),k(u),k(n),U(()=>{T.disabled=!p(re)||p(g),V(E,p(g)?`Working…`:p(ie)),V(me,`Enter ${p(ie)??``}`),he.disabled=p(g)}),N(`click`,n,e=>{e.target===e.currentTarget&&t.onClose()}),N(`keydown`,u,L),ee(S,()=>p(c),e=>l(c,e)),N(`click`,T,()=>{ce()}),N(`click`,he,function(...e){t.onClose?.apply(this,e)}),v(e,n)};r(B,e=>{t.open&&e(H)}),v(e,le),M()}t([`click`,`keydown`]);var Md=i(`<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>`),Nd=i(`<p class="text-muted-foreground truncate text-[10px] tracking-[-0.01em]"> </p>`),Pd=i(`<span> </span>`),Fd=i(`<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>`),Id=i(`<p class="text-muted-foreground pb-2 text-[12px] leading-5"> </p>`),Ld=i(`<p class="text-muted-foreground py-1.5 text-[12px]">No threads yet</p>`),Rd=i(`<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>`),zd=i(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-amber-300" aria-label="Starting agent"></span>`),Bd=i(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-emerald-400" aria-label="Thread has an active run"></span>`),Vd=i(`<div class="group/thread relative"><button type="button"><!> <span class="truncate"> </span></button> <button type="button"><!></button></div>`),Hd=i(`<button type="button" class="text-muted-foreground hover:text-muted-foreground px-2 py-1 text-[12px] transition"> </button>`),Ud=i(`<div class="space-y-0.5"><!> <!></div>`),Wd=i(`<div class="ml-5 border-l border-[var(--hairline)] pl-3"><!> <!></div>`),Gd=i(`<section class="space-y-1.5"><div class="group relative flex items-center px-2"><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>`),Kd=i(`<div class="space-y-4"></div>`),qd=i(`<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>`),Jd=i(`<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>`),Yd=i(`<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">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 Xd(e,t){E(t,!0);let i=j(t,`pendingAgentLaunches`,19,()=>({})),o=`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`,c=`size-4 shrink-0 text-muted-foreground`,d=x(u({})),m=x(u({})),h=x(null),g=x(null),_=x(null),S=x(``),w=x(``),T=x(null),D=x(null);n(()=>{!p(_)||!p(T)||(p(T).focus(),p(T).select())}),n(()=>{if(!p(D))return;function e(e){let t=e.target;t instanceof Element&&t.closest(`[data-thread-context-menu]`)||l(D,null)}function t(e){e.key===`Escape`&&l(D,null)}return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t,!0)}});function te(e,t){if(p(_))return;let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let r=n.getBoundingClientRect();l(h,t,!0),l(g,{top:r.top+r.height/2,left:r.right+8},!0)}function ne(){l(h,null),l(g,null)}function re(e){return p(d)[e]??!1}function ie(e){l(d,{...p(d),[e]:!re(e)},!0)}function ae(e){return p(m)[e]??!1}function oe(e){l(m,{...p(m),[e]:!ae(e)},!0)}function F(e){return e.project.localAttachmentAvailability===`unavailable`?`Missing`:e.project.localAttachmentAvailability===`unlinked`?`Link`:null}function se(e,t){l(D,null),ne(),l(_,e,!0),l(S,t,!0),l(w,t,!0)}function ce(){l(_,null),l(S,``),l(w,``)}function L(){let e=p(_);if(!e)return;let n=p(S).trim();l(_,null),l(S,``);let r=p(w);l(w,``),!(n.length===0||n===r)&&t.onRenameThread(e,n)}function B(e,t){e.preventDefault(),ne(),l(D,{threadId:t.threadId,title:t.title,x:e.clientX,y:e.clientY},!0)}var H=Yd(),de=b(H),fe=y(de),pe=y(fe),me=y(pe);Ee(me,{size:`sm`,class:`min-w-0`}),to(s(me,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),k(pe);var he=s(pe,2),ge=y(he);I(ge,1,P(o)),zt(y(ge),{class:c,"aria-hidden":`true`}),z(2),k(ge),k(he);var _e=s(he,2),W=s(y(_e),2),ve=e=>{v(e,Md())},ye=e=>{var n=Kd();ue(n,21,()=>t.groups,e=>e.project._id,(e,n)=>{let c=C(()=>p(n).project),u=C(()=>F(p(n)));var d=Gd(),m=y(d),h=y(m),g=y(h);{let e=C(()=>`text-muted-foreground size-3 shrink-0 transition-transform ${ae(p(c).repositoryKey)?``:`rotate-90`}`);_t(g,{get class(){return p(e)}})}var x=s(g,2);Ut(x,{class:`text-muted-foreground size-4 shrink-0`});var w=s(x,2),E=y(w),D=y(E,!0);k(E);var A=s(E,2),j=e=>{var t=Nd(),n=y(t,!0);k(t),U(()=>V(n,p(c).workspacePath??p(c).repositoryKey)),v(e,t)};r(A,e=>{p(c).repositoryKey!==p(c).displayName&&e(j)}),k(w);var M=s(w,2),P=e=>{var t=Pd(),n=y(t,!0);k(t),U(()=>{I(t,1,`rounded-full px-1.5 py-0.5 text-[10px] ${p(c).localAttachmentAvailability===`unavailable`?`border border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200`:`border border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200`}`),V(n,p(u))}),v(e,t)};r(M,e=>{p(u)&&e(P)});var se=s(M,2),z=e=>{var t=Fd(),r=y(t,!0);k(t),U(()=>V(r,p(n).activeThreadCount)),v(e,t)};r(se,e=>{p(n).activeThreadCount>0&&e(z)}),k(h);var H=s(h,2),de=y(H),fe=e=>{vn(e,{class:`size-4`})},pe=e=>{zt(e,{class:`size-4`})};r(de,e=>{p(c).localAttachmentAvailability===`available`?e(fe):e(pe,-1)}),k(H),k(m);var me=s(m,2),he=e=>{var u=Wd(),d=y(u),m=e=>{var t=Id(),n=y(t,!0);k(t),U(()=>V(n,p(c).localAttachmentError??(p(c).localAttachmentAvailability===`unlinked`?`This project needs a local directory attached before you can use it.`:`This project needs to be reconnected.`))),v(e,t)};r(d,e=>{(p(c).localAttachmentAvailability===`unavailable`||p(c).localAttachmentAvailability===`unlinked`)&&e(m)});var h=s(d,2),g=e=>{v(e,Ld())},x=e=>{let u=C(()=>re(p(c).repositoryKey)),d=C(()=>p(u)?p(n).threads:p(n).threads.slice(0,3)),m=C(()=>p(n).threads.length>3);var h=Ud(),g=y(h);ue(g,17,()=>p(d),e=>e.threadId,(e,n)=>{let c=C(()=>Va(i(),p(n).threadId)),u=C(()=>p(n).threadId===t.currentThreadId),d=C(()=>p(_)===p(n).threadId);var m=a(),h=b(m),g=e=>{var t=Rd(),n=y(t);R(n),le(n,e=>l(T,e),()=>p(T)),k(t),f(`submit`,t,e=>{e.preventDefault(),L()}),N(`keydown`,n,e=>{e.key===`Escape`&&(e.preventDefault(),ce())}),f(`blur`,n,()=>{L()}),ee(n,()=>p(S),e=>l(S,e)),v(e,t)},x=e=>{var i=Vd(),a=y(i),l=y(a),d=e=>{v(e,zd())},m=e=>{v(e,Bd())};r(l,e=>{p(c)?e(d):p(n).hasActiveRun&&e(m,1)});var h=s(l,2),g=y(h,!0);k(h),k(a);var _=s(a,2);tt(y(_),{class:`size-3.5`,"aria-hidden":`true`}),k(_),k(i),U(()=>{I(a,1,`${o} pr-8 ${p(u)?`text-foreground bg-hover-fill`:`text-muted-foreground`}`),O(a,`aria-current`,p(u)?`page`:void 0),V(g,p(n).title),I(_,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 ${p(u)?`opacity-100`:`opacity-0 group-focus-within/thread:opacity-100 group-hover/thread:opacity-100`}`),O(_,`aria-label`,`Archive ${p(n).title}`)}),f(`mouseenter`,a,e=>{te(e,p(n).title)}),f(`mouseleave`,a,ne),f(`focus`,a,e=>{te(e,p(n).title)}),f(`blur`,a,ne),N(`contextmenu`,a,e=>{B(e,p(n))}),N(`click`,a,()=>{t.onSelectThread(p(n))}),N(`click`,_,e=>{e.stopPropagation(),ne(),t.onArchiveThread(p(n).threadId)}),v(e,i)};r(h,e=>{p(d)?e(g):e(x,-1)}),v(e,m)});var x=s(g,2),w=e=>{var t=Hd(),n=y(t,!0);k(t),U(()=>V(n,p(u)?`Show less`:`Show more`)),N(`click`,t,()=>{ie(p(c).repositoryKey)}),v(e,t)};r(x,e=>{p(m)&&e(w)}),k(h),v(e,h)};r(h,e=>{p(n).threads.length===0?e(g):e(x,-1)}),k(u),v(e,u)},ge=C(()=>!ae(p(c).repositoryKey));r(me,e=>{p(ge)&&e(he)}),k(d),U(e=>{I(h,1,`flex min-w-0 flex-1 items-center gap-2 rounded-xl px-2 py-1 pr-8 text-left transition ${p(c).repositoryKey===t.currentRepositoryKey?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),O(h,`aria-label`,e),V(D,p(c).displayName),O(H,`aria-label`,p(c).localAttachmentAvailability===`available`?`Create thread in ${p(c).displayName}`:`Reconnect ${p(c).displayName}`)},[()=>ae(p(c).repositoryKey)?`Expand ${p(c).displayName} threads`:`Collapse ${p(c).displayName} threads`]),N(`click`,h,()=>{oe(p(c).repositoryKey)}),N(`click`,H,()=>{if(p(c).localAttachmentAvailability===`available`){t.onStartThreadDraft(p(c).repositoryKey);return}t.onReconnectProject(p(c)._id)}),v(e,d)}),k(n),v(e,n)};r(W,e=>{t.groups.length===0?e(ve):e(ye,-1)}),k(_e);var be=s(_e,2),xe=y(be);I(xe,1,P(o)),gn(y(xe),{class:c,"aria-hidden":`true`}),z(),k(xe),k(be),k(fe),k(de);var Se=s(de,2),Ce=e=>{var t=qd(),n=y(t,!0);k(t),U(()=>{A(t,`top: ${p(g).top}px; left: ${p(g).left}px;`),V(n,p(h))}),v(e,t)};r(Se,e=>{p(h)&&p(g)&&!p(D)&&!p(_)&&e(Ce)});var we=s(Se,2),Te=e=>{var t=Jd(),n=y(t);k(t),U(()=>A(t,`top: ${p(D).y}px; left: ${p(D).x}px;`)),N(`click`,n,()=>{se(p(D).threadId,p(D).title)}),v(e,t)};r(we,e=>{p(D)&&e(Te)}),N(`click`,ge,function(...e){t.onAddProject?.apply(this,e)}),N(`click`,xe,function(...e){t.onOpenSettings?.apply(this,e)}),v(e,H),M()}t([`click`,`keydown`,`contextmenu`]);function Zd(e){return e===`running`||e===`awaiting_executor`}function Qd(e,t){return Zd(e.status)?e.claimExpiresAt!==void 0&&e.claimExpiresAt>t:!1}function $d(e){let t=e.recoveredSubmission,n=e.latestRun;return(n===null||n.submissionId===t?.submissionId&&!zi(n.status))&&t?.prompt===e.prompt&&t.selectedModel===e.selectedModel&&t.reasoningEffort===e.reasoningEffort&&t.serviceTier===e.serviceTier&&Xi(t.imageUploadIds,e.imageUploadIds)?t.submissionId:e.newSubmissionId}function ef(e){return e.submissionRunStatus&&zi(e.submissionRunStatus)?e.freshSubmissionId:e.threadSubmissionId}function tf(e,t){return e?e.status===`queued`||Qd(e,t):!1}function nf(e){e.desktopApi.runAgent({authToken:e.authToken,threadId:e.threadId,prompt:e.prompt,imageUploadIds:e.imageUploadIds,selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,submissionId:e.submissionId,projectId:e.projectId}).then(({runId:t})=>{e.onStarted(t)}).catch(t=>{console.error(`Failed to run agent`,t),e.onError(t)})}function rf(e){return Object.fromEntries(e.map(e=>[e.projectId,e]))}async function af(e){return e?rf(await e.listProjectAttachments()):{}}async function of(e){return await e.desktopApi.attachProject({projectId:e.projectId,workspacePath:e.workspacePath})}function sf(e,t){let n=new Set(t);return e.filter(e=>e.availability===`available`&&n.has(e.projectId)).map(e=>e.projectId)}var cf=class extends Error{constructor(){super(`Pending task was canceled.`),this.name=`LatestTaskQueueCancelledError`}};function lf(e){let t=null,n=!1;async function r(){if(!n){n=!0;try{for(;t;){let n=t;t=null;try{await e(n.value),n.resolve()}catch(e){n.reject(e)}}}finally{n=!1,t&&r()}}}return{enqueue(e){if(t)return t.value=e,t.promise;let n,i,a=new Promise((e,t)=>{n=e,i=t});return t={value:e,promise:a,resolve:n,reject:i},r(),a},cancelPending(){if(!t)return;let e=t;t=null,e.reject(new cf)}}}async function uf(e){if(e.desktopApi)try{let t=(await e.desktopApi.listProjectAttachments()).find(t=>t.projectId===e.projectId);if(!t||t.availability!==`available`)throw Error(t?.unavailableReason??`Workspace path is unavailable.`);await e.refreshDesktopProjectAttachments()}catch(t){throw await e.refreshDesktopProjectAttachments(),t}}var df=40;function ff(e,t){if(e.runStartedAt!==t.runStartedAt)return e.runStartedAt-t.runStartedAt;let n=e._creationTime??0,r=t._creationTime??0;return n===r?e.type===t.type?e._id.localeCompare(t._id):e.type===`prompt`?-1:1:n-r}function pf(e,t=df){if(e.length<=t)return e;let n=0;for(;e.length-n>t;){let t=e[n]?.runId;if(!t){n+=1;continue}for(;n<e.length&&e[n]?.runId===t;)n+=1}let r=e.slice(n);return r.length>t?r.slice(-t):r}function mf(e){let t=new Map;for(let n of e.historyMessages??[])t.set(n._id,n);for(let n of e.liveMessages??[])t.set(n._id,n);return pf([...t.values()].sort(ff))}var hf=i(`<div class="bg-background h-screen overflow-hidden"><!> <!></div>`),gf=i(`<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"><!></button>`),_f=i(`<!> <!>`,1),vf=i(`<div class="bg-background/95 fixed inset-0 z-100 flex flex-col p-4"><!></div>`),yf=i(`<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 bf(t,i){E(i,!0);let o=()=>te(_e,`$authState`,f),d=()=>te(fe,`$convexAuthRetryPending`,f),[f,m]=e(),h=Te(),_=x(!1),S=C(()=>!!o().user),w=C(d),T=C(()=>o().isReady&&!o().isLoading&&p(S)&&!h.isLoading&&h.isAuthenticated),D=C(()=>p(S)&&o().isReady&&!o().isLoading&&!p(w)&&!h.isLoading&&!h.isAuthenticated);n(()=>{let e=be({retryPending:p(w),isAuthenticated:h.isAuthenticated,isLoading:h.isLoading,sawLoadingDuringRetry:p(_)});p(_)!==e.sawLoadingDuringRetry&&l(_,e.sawLoadingDuringRetry,!0),e.clearPending&&fe.set(!1)});let ee=Ce(W.projects.upsertSelected),A=Ce(W.threads.create),ne=Ce(W.threads.rename),j=Ce(W.threads.archive),ae=Ce(W.threads.restore),P=Ce(W.agentRuntime.finalizeRun),F=Ce(W.agentQuestions.answer),se=Ce(W.uiPreferences.setLastThread),ce=Ce(W.uiPreferences.setTheme),L=Ce(W.imageUploads.generateUploadUrl),le=Ce(W.imageUploads.register),R=Ce(W.imageUploads.discard),B=Ce(W.projects.heartbeatAttached),V=Ce(W.billing.ensureMySubscription),ue=Se(W.modelCatalog.get,()=>({})),H=C(()=>ue.data),we=null;n(()=>{if(!p(T))return;let e=bt();!e||we===e||(we=e,V({}).catch(()=>{}))});let G=`Connect to a running Sprocket server to use this project.`,Ee=3e4,Ne=lf(async e=>{await B({clientId:e.clientId,projectIds:e.projectIds})}),Pe=x(null),K=x(!1),Fe=x(null),q=x(null),Ie=x(null),Le=x(u(jr)),Re=x(u(Mr)),ze=x(u(Nr)),Be=x(``),Ve=x(null),He=x(!1),Ue=x(u([])),J=x(null),We=x(null),Y=x(0),Ge=new zn,Ke=new zn,qe=new zn,X=new zn,Je=new Rn,Ye=x(u({})),Xe=x(0),Ze=x(null),Qe=0,$e=0,Z=x(!1),et=x(null),tt=x(null),nt=null,rt=x(0),it=x(null),at=x(u({})),ot=x(!1),st=0,ct=x(null),lt=x(!1),ut=x(`add`),dt=x(void 0),ft=x(null),pt=x(!1),mt=x(`account`),ht=x(u([])),gt=x(!1),_t=x(!1),vt=new zn,yt=x(null);function bt(){return o().user?.id??null}function xt(e,t){return p(Ue).find(t=>t.localId===e)?(l(Ue,p(Ue).map(n=>n.localId===e?{...n,...t}:n),!0),!0):!1}async function St(e,t,n){try{let r=await L({}),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(),o=await le({storageId:a,name:n});if(`error`in o)throw Error(o.error);let s=p(Ue).find(t=>t.localId===e);s&&URL.revokeObjectURL(s.previewUrl),xt(e,{status:`ready`,imageUploadId:o.imageUploadId,previewUrl:o.url})||R({imageUploadId:o.imageUploadId}).catch(()=>{})}catch(t){let n=t instanceof Error?t.message:`Upload failed.`;xt(e,{status:`error`,error:n}),l(J,n,!0)}}function Ct(e){for(let t of e){let e=$i(p(Ue).length,t);if(e){l(J,e,!0);continue}let n=crypto.randomUUID(),r=t.name||`Pasted image`;l(Ue,[...p(Ue),{localId:n,name:r,mediaType:t.type,size:t.size,previewUrl:URL.createObjectURL(t),status:`uploading`}],!0),St(n,t,r)}}function wt(e){let t=p(Ue).find(t=>t.localId===e);t&&(URL.revokeObjectURL(t.previewUrl),l(Ue,p(Ue).filter(t=>t.localId!==e),!0),t.imageUploadId&&R({imageUploadId:t.imageUploadId}).catch(()=>{}))}function Tt(e){for(let t of p(Ue))URL.revokeObjectURL(t.previewUrl),e.discard&&t.imageUploadId&&R({imageUploadId:t.imageUploadId}).catch(()=>{});l(Ue,[],!0)}function Et(e,t){return e?`thread:${e}`:t?`draft:${t}`:null}function Dt(e,t){Ge.get(e)===t&&Ge.delete(e)}function Ot(e,t){return`${e}\0${t}`}function kt(e,t,n){Ke.set(Ot(e,t),n)}function At(e,t){let n=Ot(e,t);Ke.delete(n),qe.delete(n)}function jt(){return o().user&&h.isAuthenticated&&!h.isLoading?{}:`skip`}let Mt=Se(W.projects.listMine,jt),Nt=Se(W.threads.listMine,jt),Pt=Se(W.uiPreferences.getMine,jt),Ft=x(u(Oe(null))),It=!1,Lt,Rt=null,zt=0;n(()=>{if(!p(T)){It=!1,Lt=void 0,Rt=null,zt=0;return}let e=Pt.data;if(e===void 0||Rt!==null)return;let t=e?.theme;if(It&&t===Lt)return;It=!0,Lt=t;let n=Oe(t);l(Ft,n,!0),De(n)});async function Bt(e){let t=p(Ft),n=++zt;Rt=e,l(Ft,e,!0),De(e);try{if(await ce({theme:e}),n!==zt)return;Lt=e}catch(e){if(n!==zt)return;l(Ft,t,!0),De(t),l(J,e instanceof Error?e.message:`Failed to save theme preference.`,!0)}finally{n===zt&&(Rt=null)}}let Vt=()=>p(q)&&jt()!==`skip`?{threadId:p(q)}:`skip`,Ht=Se(W.threads.getByThreadId,Vt),Ut=Se(W.messages.listHistoryForThread,Vt),Wt=Se(W.messages.listLiveForThread,Vt),Gt=Se(W.chat.latestRunForThread,Vt),Kt=Se(W.artifacts.listArtifactsForThread,Vt),qt=Se(W.agentQuestions.headPendingForThread,Vt),Jt=C(()=>{for(let e of[ue,Mt,Nt,Pt,Ht,Ut,Wt,Gt,qt])if(e.error)return e.error;return null}),Yt=C(()=>(Mt.data??[]).map(e=>{let t=p(at)[e._id];return{...e,workspacePath:t?.workspacePath,localAttachmentAvailability:t?t.availability:`unlinked`,localAttachmentError:t?.unavailableReason}})),Xt=C(()=>Nt.data??[]),Zt=C(()=>Ra(Ht.data,p(q))),Qt=C(()=>{let e=p(H)?Ir(p(H),p(Le))??Ir(p(H),p(H).defaultModelId):void 0;return{inputTokens:p(Zt)?.contextTokens??0,totalTokensProcessed:p(Zt)?p(Zt).totalTokensProcessed:0,contextWindowTokens:e?.contextWindowTokens??0,autoCompactTokenLimit:e?.autoCompactTokenLimit??0}}),$t=C(()=>Ra(Gt.data,p(q))),en=C(()=>Ra(qt.data,p(q))),tn=C(()=>Ra(Ut.data,p(q))),nn=C(()=>Ra(Wt.data,p(q))),rn=C(()=>!p(tn)||!p(nn)?[]:mf({historyMessages:p(tn).messages,liveMessages:p(nn).messages})),an=C(()=>p(Fe)?Oa(p(Yt),p(Fe)):null),on=C(()=>p(an)?._id??null),sn=C(()=>{let e=p(an)?.workspacePath??null,t=p(Pe);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}}}),cn=C(()=>p(on)?p(Xt).filter(e=>e.projectId===p(on)&&ja(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt):[]),ln=C(()=>Pa(p(Yt),p(Xt))),dn=C(()=>p($t)?.run??null),fn=C(()=>(p($t)?.jobs??[]).slice(-60)),pn=C(()=>(Kt.data??[]).map(e=>({key:e.artifact._id,title:e.artifact.title,artifactType:e.artifact.type,content:e.currentContent}))),mn=new zn,hn=x(u({open:!1,selectedKey:null})),gn=null;n(()=>{let e=p(q);e!==gn&&(gn&&mn.set(gn,p(hn)),gn=e,l(hn,e&&mn.get(e)||{open:!1,selectedKey:null},!0))});let _n=C(()=>p(hn).selectedKey),vn=C(()=>p(pn).find(e=>e.key===p(yt))??null),yn=new Rn;n(()=>{let e=p(pn).at(-1);if(!e||!p(wn)){yn=new Rn(p(pn).map(e=>e.key));return}yn.has(e.key)||(yn.add(e.key),l(hn,{open:!0,selectedKey:e.key},!0))});let bn=C(()=>Et(p(q),p(on))),xn=C(()=>p(Ze)&&p(Ze).runId===(p(dn)?._id??null)?p(Ze).serverNow+Math.max(0,p(Xe)-p(Ze).localObservedAt):p($t)?.serverNow??Date.now()),Sn=C(()=>{let e=bt();if(!(!e||!p(bn)))return qe.get(Ot(e,p(bn)))}),Cn=C(()=>p(dn)?.status===`queued`&&p(Sn)?.submissionId===p(dn).submissionId),wn=C(()=>tf(p(dn),p(xn))&&!p(Cn)),Tn=C(()=>Va(p(Ye),p(q))),En=C(()=>Ba({threadId:p(q),pendingCreatedThreadId:p(it),hasLatestRunData:!!p($t)})),Dn=C(()=>!!(p(bn)&&Ge.has(p(bn)))),On=C(()=>!!(p(on)&&p(an)?.localAttachmentAvailability===`available`&&!p(Dn)&&!p(He)&&!p(Tn)&&(!p(wn)&&p(En)||p(en)))),kn=C(()=>sf(Object.values(p(at)),p(Yt).map(e=>e._id))),An=C(()=>[...p(kn)].sort().join(`\0`)),jn=C(()=>{let e=new Rn,t=[];for(let n of Object.values(p(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 Mn(){let e=++st,t=await af(p(Pe));e===st&&(l(at,t,!0),l(ot,!0))}function Nn(e,t=null,n=!1){l(Fe,e,!0),l(q,t,!0),l(Ie,n?e:null,!0),t!==p(it)&&l(it,null)}function Pn(e,t=null,n=!1,r=!1){l(rt,p(rt)+1),r||l(J,null),Nn(e,t,n)}async function Fn(e,t){if(!p(Pe))throw Error(G);let n=await of({desktopApi:p(Pe),projectId:e,workspacePath:t});return st+=1,l(at,{...p(at),[n.projectId]:n},!0),l(ot,!0),n}function In(e,t={}){let n=Oa(p(Yt),e);if(!n){l(J,`Choose a project first.`);return}Pn(e,t.threadId,t.draft);let r=p(rt);Xn(n._id).catch(e=>{r===p(rt)&&l(J,e instanceof Error?e.message:`Failed to attach project.`,!0)})}function Ln(e=`add`,t=null){if(!p(Pe)||!p(We)){l(J,G);return}l(ut,e,!0),l(ft,t,!0);let n=e===`reconnect`&&t?p(Yt).find(e=>e._id===t):void 0;l(dt,n?.displayName,!0),l(lt,!0),l(J,null)}async function Vn(e){if(!p(Pe)||!p(We)){l(J,G);return}let t=bt(),n=p(We);if(!t){l(J,`User session is not ready.`);return}try{if(p(ut)===`reconnect`&&p(ft)){await Gn(e,p(ft),t,n);return}await Wn(e,t,n)}catch(e){if(bt()!==t)return;throw l(J,e instanceof Error?e.message:`Failed to attach project.`,!0),e}}async function Hn(e,t){let n=await ee({repositoryKey:e.repositoryKey,displayName:e.displayName,connectedClientId:t});if(!n)throw Error(`Failed to create or update the project.`);return n}async function Wn(e,t,n){let r=await Hn(e,n);bt()===t&&(await Fn(r._id,e.workspacePath),bt()===t&&(Pn(e.repositoryKey,null,!0),l(J,null)))}async function Gn(e,t,n,r){let i=p(Yt).find(e=>e._id===t),a=await Hn(e,r);if(bt()!==n||(await Fn(a._id,e.workspacePath),bt()!==n))return;let o=i?.repositoryKey===e.repositoryKey?p(q):null;Pn(e.repositoryKey,o),l(J,null)}function Kn(e){let t=e?.trim();t&&l(ht,[...p(ht),t],!0)}async function qn(){let e=window.sprocketDesktopBridge;if(e?.takeWorkspaceLaunch)for(;;){let t=await e.takeWorkspaceLaunch();if(!t)return;Kn(t)}}async function Yn(e,t,n,r){let i=await t.resolveWorkspacePath({workspacePath:e});bt()===n&&await Wn(i,n,r)}async function Xn(e){await uf({desktopApi:p(Pe),refreshDesktopProjectAttachments:Mn,projectId:e})}function Zn(e){Ln(`reconnect`,e)}function Qn(e){window.setTimeout(()=>{if(bt()!==e.userId||p(it)!==e.threadId||p(q)!==e.threadId||p(Fe)!==e.repositoryKey||p(Xt).some(t=>t.threadId===e.threadId))return;l(it,null),Pn(e.repositoryKey,null,!0);let t=Et(null,e.projectId);t&&kt(e.userId,t,{message:`The new thread did not appear. Review your prompt and try sending it again.`,prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,selectedModel:e.selectedModel,submissionId:e.submissionId})},Ee)}async function $n(e){let t=await A({submissionId:e.submissionId,projectId:e.projectId,selectedModel:Fr(e.selectedModel),reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier});return e.isSubmissionCurrent()?(e.userId===bt()&&e.selectionGeneration===p(rt)&&(l(it,t.threadId,!0),l(rt,p(rt)+1),l(q,t.threadId,!0),l(Ie,null),Qn({prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier,selectedModel:e.selectedModel,submissionId:e.submissionId,threadId:t.threadId,userId:e.userId,repositoryKey:e.repositoryKey,projectId:e.projectId})),t):null}function er(e){In(e,{draft:!0})}function tr(e){let t=ka(p(Yt),e.projectId);if(!t){l(J,`Choose a project first.`);return}In(t.repositoryKey,{threadId:e.threadId})}async function nr(e,t){try{await ne({threadId:e,title:t})}catch(e){l(J,e instanceof Error?e.message:`Failed to rename thread.`,!0)}}async function rr(e){let t=bt();try{await j({threadId:e}),t&&At(t,`thread:${e}`),bt()===t&&(p(q)===e&&(l(q,null),l(it,null),l(rt,p(rt)+1)),p(tt)===e&&l(tt,null),l(J,null))}catch(e){if(bt()!==t)return;l(J,e instanceof Error?e.message:`Failed to archive thread.`,!0)}}async function ir(e){try{await ae({threadId:e})}catch(e){l(J,e instanceof Error?e.message:`Failed to restore thread.`,!0)}}async function or(){let e=p(en),t=p(q);if(!e||!t||p(He)||!p(Ve)&&!p(Be).trim())return;l(He,!0),l(J,null);let n=p(Be),r=p(Ve),i=n.trim();l(Be,``),l(Ve,null);try{await F({threadId:t,questionId:e.questionId,...r?{optionId:r}:{},...i?{text:i}:{}})}catch(i){p(q)===t&&p(en)?.questionId===e.questionId&&(l(Be,n,!0),l(Ve,r,!0),l(J,i instanceof Error?i.message:String(i),!0))}finally{l(He,!1)}}async function sr(){if(p(en)){await or();return}if(p(Dn)||!p(Be).trim()&&p(Ue).length===0)return;if(p(Ue).some(e=>e.status!==`ready`)){l(J,`Wait for image uploads to finish, or remove failed images before sending.`);return}let e=p(on);if(!e){l(J,`Choose a project first.`);return}if(!p(Pe)){l(J,G);return}if(p(q)&&!p(En)){l(J,`Loading thread state before sending.`);return}if(!p(On)){l(J,p(wn)||p(Tn)||p(Dn)?`Wait for the current agent launch or run to finish.`:p(an)?.localAttachmentAvailability===`available`?`You need an active project before sending.`:`This project needs to be attached before sending.`,!0);return}l(Y,0);let t=p(rt),n=p(q),r=p(Fe);if(!r){l(J,`Choose a project first.`);return}let i=e,a=!1,o=bt();if(!o){l(J,`User session is not ready.`);return}let s=()=>bt()===o,c=p(Be).trim(),u=p(Ue).map(e=>({...e})),d=u.flatMap(e=>e.imageUploadId?[e.imageUploadId]:[]),f=p(Le),m=p(Re),h=p(ze),g=n?p(dn)?._id??null:null,_=n?`thread:${n}`:`draft:${e}`,v=_,y=v,b=Ot(o,v),x=qe.get(b),S=crypto.randomUUID(),C=$d({latestRun:n?p(dn):null,newSubmissionId:S,prompt:c,imageUploadIds:d,reasoningEffort:m,serviceTier:h,recoveredSubmission:x?{...x,selectedModel:Fr(x.selectedModel)}:void 0,selectedModel:Fr(f)}),w=C;At(o,v);let T=null,E=null,D=++$e,ee=Ot(o,v);X.set(ee,D);let O=()=>X.get(ee)===D,k=`Your session changed before the agent started. Return to this account and send the prompt again.`,te=`This request is still preparing. Wait for it to finish before trying again.`,A=e=>{kt(o,y,{message:e,prompt:c,attachments:u,imageUploadIds:d,reasoningEffort:m,serviceTier:h,selectedModel:f,submissionId:!n&&y===v?C:w})},ne=()=>{At(o,y),s()&&p(J)===te&&l(J,null)},re=window.setTimeout(()=>{X.get(ee)===D&&kt(o,y,{message:te,prompt:``})},Ee);l(Be,``),l(J,null),Ge.set(_,D);try{if(!n){let e=p(an)?.workspacePath;if(!e)throw Error(`This project needs to be attached before sending.`);let t=await p(Pe).resolveWorkspacePath({workspacePath:e});if(!O())return;if(Aa(r,t.repositoryKey)){if(!p(We))throw Error(G);let e=await Hn({workspacePath:t.workspacePath,displayName:t.displayName,repositoryKey:t.repositoryKey},p(We));if(!O()||(await Fn(e._id,t.workspacePath),!O()))return;i=e._id,r=t.repositoryKey,a=!0,Dt(_,D),_=`draft:${i}`,Ge.set(_,D)}}let e=n?null:await $n({isSubmissionCurrent:O,prompt:c,attachments:u,imageUploadIds:d,selectionGeneration:t,selectedModel:f,selectedReasoningEffort:m,selectedServiceTier:h,submissionId:C,userId:o,repositoryKey:r,projectId:i}),v=n??e?.threadId??null;if(!v||!O())return;if(e&&(w=ef({freshSubmissionId:S,submissionRunStatus:e.submissionRunStatus,threadSubmissionId:C})),!s()){A(k);return}T=v,n||(Dt(_,D),_=`thread:${v}`,Ge.set(_,D),ne(),X.get(ee)===D&&X.delete(ee),y=`thread:${v}`,ee=Ot(o,y),X.set(ee,D),a&&(Pn(r,v),vt.set(v,`A new project was created because this directory’s git remote changed. Earlier threads stay on the previous project.`)));let b=await ye({forceRefreshToken:!0});if(!b){A(`Your session ended before the agent started. Sign in again.`);return}if(!O())return;if(!s()){A(k);return}ne();let x=++Qe;E=x,l(Ye,Ha(p(Ye),v,{expiresAt:Date.now()+Ee,launchId:x,...p(dn)?.claimExpiresAt?{previousClaimExpiresAt:p(dn).claimExpiresAt}:{},previousRunId:g}),!0),window.setTimeout(()=>{let e=p(Xt).find(e=>e.threadId===v)?.latestRunId??null,t=p(q)===v?p(dn)?._id??null:null,n=[e,t].find(e=>e&&e!==g)??e??t,r=p(q)===v&&p(dn)?._id===n?p(dn).claimExpiresAt:p(Xt).find(e=>e.threadId===v)?.latestRunClaimExpiresAt,i=qa(p(Ye),v,x,Date.now(),n,r);i.pendingLaunches!==p(Ye)&&(l(Ye,i.pendingLaunches,!0),i.shouldRecover&&A(`The local agent did not start. Please try again.`))},Ee),nf({authToken:b,desktopApi:p(Pe),onError:e=>{if(!O()||!s())return;let t=Ua(p(Ye),v,x);t!==p(Ye)&&l(Ye,t,!0),A(e instanceof Error?e.message:`Failed to start the local agent run.`)},onStarted:e=>{!O()||!s()||(l(Ye,Ga(p(Ye),v,e),!0),Tt({discard:!1}))},threadId:v,prompt:c,imageUploadIds:d,selectedModel:Fr(f),submissionId:w,reasoningEffort:m,serviceTier:h,projectId:i})}catch(e){if(T&&E!==null&&l(Ye,Ua(p(Ye),T,E),!0),!O())return;if(!s()){A(k);return}A(e instanceof Error?e.message:`Failed to send prompt.`),Mn().catch(()=>{})}finally{window.clearTimeout(re),Dt(_,D),E===null&&X.get(ee)===D&&X.delete(ee)}}async function cr(){if(!(!p(dn)?._id||!p(wn)))try{await P({runId:p(dn)._id,text:``,status:`cancelled`})}catch(e){l(J,e instanceof Error?e.message:`Failed to cancel run.`,!0)}}n(()=>{let e=p($t);if(!e){l(Ze,null);return}p(Ze)?.serverNow===e.serverNow&&p(Ze).runId===(e.run?._id??null)||l(Ze,{localObservedAt:window.performance.now(),runId:e.run?._id??null,serverNow:e.serverNow},!0)}),n(()=>{if(!p(dn)||!Zd(p(dn).status))return;let e=()=>{l(Xe,window.performance.now(),!0)};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)}),n(()=>{let e=bt(),t=Et(p(q),p(on)),n=p(dn);if(!e||!t||!n||!Zd(n.status)||p(wn)||p(Dn)||p(Tn)||p(Be)!==``||p(Ue).length>0||!p($t)||!p($t).prompt&&!p($t).imageUploadIds?.length)return;let r=p($t).imageUploadIds??[],i=p($t).prompt??``,a=p(rn).find(e=>e.runId===n._id&&e.type===`prompt`),o=r.flatMap(e=>{let t=a?.attachments.find(t=>t.imageUploadId===e);return t?.url?[t]:[]}),s=r.length-o.length,c=`${e}\0${n._id}\0${n.claimExpiresAt??`none`}`;if(Je.has(c))return;Je.add(c);let l=o.map(e=>({localId:e.imageUploadId,name:e.name,mediaType:e.mediaType,size:e.size,previewUrl:e.url,status:`ready`,imageUploadId:e.imageUploadId}));kt(e,t,{message:s>0?`The previous agent stopped responding. ${s} image attachment${s===1?` is`:`s are`} unavailable; review and retry this submission.`:`The previous agent stopped responding. Retry to continue this submission.`,prompt:i,attachments:l,imageUploadIds:r,reasoningEffort:n.reasoningEffort,serviceTier:n.serviceTier,selectedModel:n.selectedModel,submissionId:n.submissionId})}),n(()=>{let e=bt();p(ct)!==e&&(l(ct,e,!0),l(Z,!1),l(Fe,null),l(q,null),l(Ie,null),l(it,null),l(Ye,{},!0),l(et,null),l(tt,null),we=null,nt=null,l(rt,p(rt)+1),l(Be,``),Tt({discard:!0}),l(J,null),l(Y,0),l(Le,p(H)?.defaultModelId??`gpt-5.6-sol`,!0),l(Re,p(H)?.defaultReasoningEffort??Mr,!0),l(ze,p(H)?.defaultServiceTier??`standard`,!0),l(lt,!1),l(ft,null),l(dt,void 0))}),n(()=>{let e=p(ht)[0],t=p(Pe),n=bt(),r=p(We);!e||p(gt)||!p(T)||!t||!n||!r||Mt.data===void 0||(l(ht,p(ht).slice(1),!0),l(gt,!0),l(Z,!0),l(et,null),l(lt,!1),l(pt,!1),l(J,null),Yn(e,t,n,r).catch(e=>{bt()===n&&(l(Z,!1),l(J,e instanceof Error?e.message:`Failed to open the requested project.`,!0))}).finally(()=>{l(gt,!1)}))}),n(()=>{let e=p(Zt),t=e?._id??null;t!==nt&&(nt=t,e&&(l(Le,e.selectedModel,!0),l(Re,e.reasoningEffort,!0),l(ze,e.serviceTier,!0)))}),n(()=>{let e=bt(),t=Et(p(q),p(on));if(!e||!t)return;let n=Ot(e,t),r=Ke.get(n);if(!r)return;Ke.delete(n);let i=p(Be)===``;i&&l(Be,r.prompt,!0),p(Ue).length===0&&r.attachments?.length&&(i||p(Be)===r.prompt)&&l(Ue,r.attachments.map(e=>({...e})),!0),p(Be)===r.prompt&&r.submissionId&&(r.prompt||r.imageUploadIds?.length)&&r.reasoningEffort&&r.selectedModel&&qe.set(n,{prompt:r.prompt,imageUploadIds:r.imageUploadIds??[],reasoningEffort:r.reasoningEffort,serviceTier:r.serviceTier??p(H)?.defaultServiceTier??`standard`,selectedModel:r.selectedModel,submissionId:r.submissionId}),l(J,r.message,!0)}),n(()=>{if(!p(it))return;let e=za({pendingCreatedThreadId:p(it),threads:p(Xt)});e!==p(it)&&l(it,e,!0)}),n(()=>{let e=Pt.data;if(p(Z)||!p(_t)||p(ht).length>0||p(gt)||!Mt.data||!Nt.data||e===void 0)return;l(Z,!0);let t=La(p(Xt),e?.lastThreadId??null);if(t&&ja(t)){let e=ka(p(Yt),t.projectId);if(e){Pn(e.repositoryKey,t.threadId,!1,!0),l(et,e._id,!0),l(tt,t.threadId,!0);return}}p(Yt)[0]&&(Pn(p(Yt)[0].repositoryKey,null,!1,!0),l(et,p(Yt)[0]._id,!0))}),n(()=>{let e=p(et);if(!e||!p(Pe)||!p(ot))return;if(!p(Yt).find(t=>t._id===e)){l(et,null);return}l(et,null);let t=p(rt);Xn(e).catch(e=>{t===p(rt)&&l(J,e instanceof Error?e.message:`Failed to attach project.`,!0)})}),n(()=>{let e=p(q)?La(p(Xt),p(q)):null,t=ka(p(Yt),e?.projectId);t&&t.repositoryKey!==p(Fe)&&Pn(t.repositoryKey,p(q),p(Ie)===t.repositoryKey)}),n(()=>{let e=p(cn);if(!p(Z)||!p(Fe))return;let t=Ja({threads:e,currentThreadId:p(q),currentRepositoryKey:p(Fe),draftRepositoryKey:p(Ie),pendingCreatedThreadId:p(it)});t!==p(q)&&Pn(p(Fe),t,p(Ie)===p(Fe),!0)}),n(()=>{!p(Z)||!p(q)||p(q)!==p(tt)&&(l(tt,p(q),!0),se({threadId:p(q)}))}),n(()=>{let e=Ka(p(Ye),p(Xt));p(q)&&p(dn)?._id&&(e=Ga(e,p(q),p(dn)._id,p(dn).claimExpiresAt)),e!==p(Ye)&&l(Ye,e,!0)}),n(()=>{let e=p(dn)?.startedAt;if(!p(wn)||!e){l(Y,0);return}let t=()=>{l(Y,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}),n(()=>{let e=p(We),t=p(An);if(!e||!p(Pe)||!p(ot)||Mt.data===void 0||jt()===`skip`)return;let n={clientId:e,projectIds:t?t.split(`\0`):[]};Ne.enqueue(n).catch(()=>{});let r=window.setInterval(()=>{Ne.enqueue(n).catch(()=>{})},Bn);return()=>{window.clearInterval(r),Ne.cancelPending()}}),oe(()=>{l(We,crypto.randomUUID(),!0);let e=window.sprocketDesktopBridge,t=e?.onWorkspaceLaunch?e.onWorkspaceLaunch(()=>{qn()}):void 0,n=Ae();return n&&(Kn(n),je()),e?.takeWorkspaceLaunch?qn().finally(()=>{l(_t,!0)}):l(_t,!0),Me().then(e=>{l(Pe,e,!0),l(K,!0),Mn().catch(e=>{l(J,e instanceof Error?e.message:`Failed to load local project attachments.`,!0)})}).catch(e=>{l(J,e instanceof Error?e.message:`Failed to connect to the Sprocket server.`,!0),l(K,!0)}),()=>t?.()});var lr=a();re(`1uha8ag`,e=>{g(()=>{c.title=`Sprocket`})});var ur=b(lr),dr=e=>{ke(e,{title:`Connecting to Sprocket…`,description:`Looking for a running Sprocket server on this machine.`,busy:!0})},fr=e=>{{let t=e=>{{let t=C(()=>de(`/pair`));Un(e,{get href(){return p(t)},children:(e,t)=>{z(),v(e,ie(`Open pairing`))},$$slots:{default:!0}})}},n=C(()=>p(J)??`Connect to your Sprocket server to continue.`);ke(e,{title:`Connect to Sprocket`,get description(){return p(n)},actions:t,$$slots:{actions:!0}})}},pr=e=>{var t=hf(),n=y(t);{let e=C(()=>({isLoading:!o().isReady||o().isLoading||p(w)||p(S)&&h.isLoading,isConfigured:o().isConfigured,isAuthenticated:p(S),connectionFailed:p(D),error:o().error}));Jn(n,{get authState(){return p(e)},get overlayOpen(){return o().isWaitingForBrowserSignIn},onSignIn:()=>void xe(),onSignOut:()=>void pe(),onRetry:()=>void ge(),onSignUp:()=>void me()})}ar(s(n,2),{get open(){return o().isWaitingForBrowserSignIn},get signInUrl(){return o().browserSignInUrl},get error(){return o().error},get onCancel(){return ve},get onClearOpenError(){return he}}),k(t),v(e,t)},mr=e=>{var t=yf(),n=y(t),i=y(n),c=e=>{io(e,{get activePage(){return p(mt)},get theme(){return p(Ft)},onThemeChange:e=>void Bt(e),onBack:()=>{l(pt,!1),l(mt,`account`)},onNavigate:e=>{l(mt,e,!0)}})},u=e=>{Xd(e,{get currentRepositoryKey(){return p(Fe)},get currentThreadId(){return p(q)},get groups(){return p(ln)},get pendingAgentLaunches(){return p(Ye)},get theme(){return p(Ft)},onThemeChange:e=>void Bt(e),onAddProject:()=>{Ln(`add`)},onReconnectProject:e=>{Zn(e)},onOpenSettings:()=>{l(mt,`account`),l(pt,!0)},onStartThreadDraft:er,onSelectThread:tr,onRenameThread:(e,t)=>{nr(e,t)},onArchiveThread:e=>{rr(e)}})};r(i,e=>{p(pt)?e(c):e(u,-1)});var d=s(i,2),f=y(d),m=e=>{var t=gf();un(y(t),{class:`size-4`,"aria-hidden":`true`}),k(t),U(()=>{O(t,`aria-label`,p(hn).open?`Close artifacts panel`:`Open artifacts panel`),O(t,`aria-pressed`,p(hn).open)}),N(`click`,t,()=>{l(hn,{...p(hn),open:!p(hn).open},!0)}),v(e,t)};r(f,e=>{p(pt)||e(m)});var h=s(f,2),g=e=>{var t=a(),n=b(t),i=e=>{$a(e,{get threads(){return p(Xt)},get projects(){return p(Yt)},onRestore:e=>{ir(e)}})},s=e=>{yo(e,{})},c=e=>{Da(e,{get user(){return o().user},onSignOut:()=>void pe()})};r(n,e=>{p(mt)===`archived`?e(i):p(mt)===`usage`?e(s,1):e(c,-1)}),v(e,t)},_=e=>{var t=_f(),n=b(t);{let e=C(()=>p(J)??o().error??p(Jt)?.message??null),t=C(()=>p(dn)?.lastError??null),r=C(()=>p(wn)?p(dn)?._id??null:null),i=C(()=>p(q)?vt.get(p(q))??null:null);Ku(n,{get currentError(){return p(e)},get runError(){return p(t)},get messages(){return p(rn)},get actions(){return p(fn)},get activeRunId(){return p(r)},get project(){return p(an)},get remoteChangeNotice(){return p(i)},onDismissRemoteChangeNotice:()=>{p(q)&&vt.delete(p(q))}})}var r=s(n,2);{let e=C(()=>p(Dn)||p(Tn)||p(He)),t=C(()=>p(wn)?Su(p(Y)):null);_a(r,{get attachments(){return p(Ue)},onAttachFiles:Ct,onRemoveAttachment:wt,get modelCatalog(){return p(H)},get pendingQuestion(){return p(en)},get canSend(){return p(On)},get isSubmitting(){return p(e)},get isStarting(){return p(Tn)},get isRunning(){return p(wn)},get elapsedLabel(){return p(t)},get contextUsage(){return p(Qt)},get projectSkills(){return p(sn)},onSubmit:()=>{sr()},onCancel:()=>{cr()},get prompt(){return p(Be)},set prompt(e){l(Be,e,!0)},get selectedModel(){return p(Le)},set selectedModel(e){l(Le,e,!0)},get selectedReasoningEffort(){return p(Re)},set selectedReasoningEffort(e){l(Re,e,!0)},get selectedServiceTier(){return p(ze)},set selectedServiceTier(e){l(ze,e,!0)},get selectedQuestionOptionId(){return p(Ve)},set selectedQuestionOptionId(e){l(Ve,e,!0)}})}v(e,t)};r(h,e=>{p(pt)?e(g):e(_,-1)}),k(d);var x=s(d,2),S=e=>{md(e,{get artifacts(){return p(pn)},get selectedKey(){return p(_n)},onSelect:e=>{l(hn,{...p(hn),selectedKey:e},!0)},onBack:()=>{l(hn,{...p(hn),selectedKey:null},!0)},onExpand:e=>{l(yt,e,!0)},onClose:()=>{l(hn,{...p(hn),open:!1},!0)}})};r(x,e=>{!p(pt)&&p(hn).open&&e(S)}),k(n);var w=s(n,2),T=e=>{var t=vf();cd(y(t),{get title(){return p(vn).title},get artifactType(){return p(vn).artifactType},get content(){return p(vn).content},variant:`full`,onBack:()=>{l(yt,null)}}),k(t),v(e,t)};r(w,e=>{p(vn)&&e(T)});var E=s(w,2),D=e=>{jd(e,{get open(){return p(lt)},get desktopApi(){return p(Pe)},get mode(){return p(ut)},get expectedDisplayName(){return p(dt)},get recentProjectPaths(){return p(jn)},onClose:()=>{l(lt,!1),l(ft,null),l(dt,void 0)},onSelect:async e=>{try{await Vn(e)}catch{await Mn()}}})};r(E,e=>{p(Pe)&&p(lt)&&e(D)}),k(t),U(()=>I(n,1,`app-workspace-shell grid h-screen overflow-hidden ${p(pt)||!p(hn).open?`grid-cols-[292px_minmax(0,1fr)]`:`grid-cols-[292px_minmax(0,1fr)_26rem]`}`)),v(e,t)};r(ur,e=>{p(K)?p(Pe)?p(T)?e(mr,-1):e(pr,2):e(fr,1):e(dr)}),v(t,lr),M(),m()}t([`click`]);export{bf as component};
|