@spikonado/sprocket 0.3.6 → 0.3.7
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.uuS2feYC.css +2 -0
- package/web/_app/immutable/assets/2.TF_ZlfD9.css +1 -0
- package/web/_app/immutable/chunks/{B3_FWG8N.js → BVPvmVXQ.js} +2 -2
- package/web/_app/immutable/chunks/C_wyipFZ.js +1 -0
- package/web/_app/immutable/chunks/{BS_wiDNx.js → CcS926TY.js} +1 -1
- package/web/_app/immutable/chunks/{CU6m3OBu.js → Ch1scEjX.js} +1 -1
- package/web/_app/immutable/chunks/DXrJmceD.js +1 -0
- package/web/_app/immutable/chunks/{DZvbIz22.js → DjxnDyxT.js} +1 -1
- package/web/_app/immutable/entry/{app.B9ssF-vY.js → app.DjIwt1mA.js} +2 -2
- package/web/_app/immutable/entry/start.CykVHArZ.js +1 -0
- package/web/_app/immutable/nodes/{0.DyTUEcgT.js → 0.DJra_MUP.js} +1 -1
- package/web/_app/immutable/nodes/{1.0Sp3BLHM.js → 1.AaeFkx35.js} +1 -1
- package/web/_app/immutable/nodes/2.CL3tTr-I.js +129 -0
- package/web/_app/immutable/nodes/{3.CTqAObMQ.js → 3.CtfToCj8.js} +1 -1
- package/web/_app/immutable/nodes/{4.BPSJjhC0.js → 4.BcdvHjG_.js} +1 -1
- package/web/_app/version.json +1 -1
- package/web/callback.html +13 -13
- package/web/index.html +11 -11
- package/web/pair.html +13 -13
- package/web/_app/immutable/assets/0.B8qIzvu4.css +0 -2
- package/web/_app/immutable/chunks/BAh8Fpli.js +0 -1
- package/web/_app/immutable/chunks/CRHDxlx_.js +0 -1
- package/web/_app/immutable/entry/start.Cno7DLMd.js +0 -1
- package/web/_app/immutable/nodes/2.BkRttGcw.js +0 -129
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,J as l,K as u,L as d,M as f,N as p,O as m,P as h,Q as g,R as _,S as v,T as y,U as b,V as x,W as S,X as C,Y as w,Z as T,_ as E,_t as D,a as O,b as k,c as A,ct as j,d as M,et as N,f as ee,gt as P,h as F,ht as I,i as L,j as te,k as R,l as ne,lt as z,m as B,mt as V,n as re,nt as ie,o as H,p as ae,q as U,rt as oe,s as W,st as se,tt as ce,u as le,v as ue,w as de,x as fe,y as pe,z as G}from"../chunks/CirtoWSJ.js";import{c as me}from"../chunks/C_wyipFZ.js";import"../chunks/xihTtKlq.js";import{c as he,d as ge,f as _e,g as ve,h as ye,i as be,m as xe,n as Se,o as Ce,p as we,r as Te,t as Ee}from"../chunks/CcS926TY.js";import{S as K,_ as q,b as De,c as Oe,d as ke,f as Ae,g as J,l as je,n as Me,p as Ne,s as Pe,v as Fe,y as Ie}from"../chunks/BVPvmVXQ.js";import{a as Le,c as Re,i as ze,l as Be,o as Ve,r as He,s as Ue}from"../chunks/DjxnDyxT.js";import{t as We}from"../chunks/Ch1scEjX.js";import{a as Y,i as Ge,n as Ke,r as qe,t as Je}from"../chunks/VSK6LhsJ.js";var Ye=Object.defineProperty,X=(e,t,n)=>t in e?Ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xe=(e,t,n)=>X(e,typeof t==`symbol`?t:t+``,n),Ze=`https://docs.convex.dev/error#undefined-validator`;function Qe(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 ${Ze} for details.`)}var $e=class{constructor({isOptional:e}){Xe(this,`type`),Xe(this,`fieldPaths`),Xe(this,`isOptional`),Xe(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},et=class e extends $e{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),Xe(this,`tableName`),Xe(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})}},tt=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},nt=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},rt=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`commitTs`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},it=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},at=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},ot=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},st=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},ct=class e extends $e{constructor(){super(...arguments),Xe(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},lt=class e extends $e{constructor({isOptional:e,fields:t}){super({isOptional:e}),Xe(this,`fields`),Xe(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&Qe(`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}})}},ut=class e extends $e{constructor({isOptional:e,value:t}){if(super({isOptional:e}),Xe(this,`value`),Xe(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:Be(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},dt=class e extends $e{constructor({isOptional:e,element:t}){super({isOptional:e}),Xe(this,`element`),Xe(this,`kind`,`array`),t===void 0&&Qe(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},ft=class e extends $e{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),Xe(this,`key`),Xe(this,`value`),Xe(this,`kind`,`record`),t===void 0&&Qe(`v.record()`,`key`),n===void 0&&Qe(`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})}},pt=class e extends $e{constructor({isOptional:e,members:t}){super({isOptional:e}),Xe(this,`members`),Xe(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&Qe(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},Z={id:e=>new et({isOptional:`required`,tableName:e}),null:()=>new st({isOptional:`required`}),number:()=>new tt({isOptional:`required`}),float64:()=>new tt({isOptional:`required`}),bigint:()=>new nt({isOptional:`required`}),int64:()=>new nt({isOptional:`required`}),commitTs:()=>new rt({isOptional:`required`}),boolean:()=>new it({isOptional:`required`}),string:()=>new ot({isOptional:`required`}),bytes:()=>new at({isOptional:`required`}),literal:e=>new ut({isOptional:`required`,value:e}),array:e=>new dt({isOptional:`required`,element:e}),object:e=>new lt({isOptional:`required`,fields:e}),record:(e,t)=>new ft({isOptional:`required`,key:e,value:t}),union:(...e)=>new pt({isOptional:`required`,members:e}),any:()=>new ct({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>Z.union(e,Z.null())},mt=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],ht=[`difference`,`intersection`,`symmetricDifference`,`union`],gt=!1,_t=class e extends Set{#e=new Map;#t=g(0);#n=g(0);#r=G||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}gt||this.#a()}#i(e){return G===this.#r?g(e):T(e)}#a(){gt=!0;var t=e.prototype,n=Set.prototype;for(let e of mt)t[e]=function(...t){return o(this.#t),n[e].apply(this,t)};for(let r of ht)t[r]=function(...t){o(this.#t);var i=n[r].apply(this,t);return new e(i)}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return o(this.#t),!1;r=this.#i(!0),n.set(e,r)}return o(r),t}add(e){return super.has(e)||(super.add(e),C(this.#n,super.size),w(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),C(r,!1)),t&&(C(this.#n,super.size),w(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())C(t,!1);e.clear(),C(this.#n,0),w(this.#t)}}keys(){return this.values()}values(){return o(this.#t),super.values()}entries(){return o(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return o(this.#n)}},vt=class extends Map{#e=new Map;#t=g(0);#n=g(0);#r=G||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return G===this.#r?g(e):T(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else return o(this.#t),!1}return o(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0){if(super.has(e))n=this.#i(0),t.set(e,n);else{o(this.#t);return}}return o(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),C(this.#n,super.size),w(o);else if(i!==t){w(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&w(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),C(n,-1)),r&&(C(this.#n,super.size),w(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;C(this.#n,0);for(var t of e.values())C(t,-1);w(this.#t),e.clear()}}#a(){o(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)o(n)}keys(){return o(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return o(this.#n),super.size}},yt=N(e=>{let t=setInterval(e,1e3);return()=>clearInterval(t)});function bt(){return yt(),Date.now()}function xt(e,t){if(!(e===void 0||e<=0||t===void 0||!Number.isFinite(e)||!Number.isFinite(t)))return Math.max(0,Math.floor((t-e)/1e3))}var St={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`},Ct=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},wt=Symbol(`lucide-context`),Tt=()=>se(wt),Et=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),Dt=t(`<svg><!><!></svg>`);function Q(t,n){z(n,!0);let a=Tt()??{},c=L(n,`color`,19,()=>a.color??`currentColor`),l=L(n,`size`,19,()=>a.size??24),d=L(n,`strokeWidth`,19,()=>a.strokeWidth??2),f=L(n,`absoluteStrokeWidth`,19,()=>a.absoluteStrokeWidth??!1),p=L(n,`iconNode`,19,()=>[]),h=O(n,Et),g=e(()=>f()?Number(d())*24/Number(l()):d());var _=Dt();ne(_,e=>({...St,...e,...h,width:l(),height:l(),stroke:c(),"stroke-width":o(g),class:[`lucide-icon lucide`,a.class,n.name&&`lucide-${n.name}`,n.class]}),[()=>!n.children&&!Ct(h)&&{"aria-hidden":`true`}]);var y=s(_);v(y,17,p,r,(t,n)=>{var r=e(()=>D(o(n),2));let a=()=>o(r)[0],s=()=>o(r)[1];var c=m(),l=u(c);ue(l,a,!0,(e,t)=>{ne(e,()=>({...s()}))}),i(t,c)});var b=U(y);k(b,()=>n.children??P),I(_),i(t,_),j()}var Ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function kt(e,t){let n=O(t,Ot),r=[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`}],[`path`,{d:`M10 12h4`}]];Q(e,H({name:`archive`},()=>n,{get iconNode(){return r}}))}var $=new Set([`$$slots`,`$$events`,`$$legacy`]);function At(e,t){let n=O(t,$),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];Q(e,H({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var jt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mt(e,t){let n=O(t,jt),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];Q(e,H({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var Nt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pt(e,t){let n=O(t,Nt),r=[[`path`,{d:`M12 5v16`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`}]];Q(e,H({name:`book-open`},()=>n,{get iconNode(){return r}}))}var Ft=new Set([`$$slots`,`$$events`,`$$legacy`]);function It(e,t){let n=O(t,Ft),r=[[`path`,{d:`M12 18V5`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`}]];Q(e,H({name:`brain`},()=>n,{get iconNode(){return r}}))}var Lt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Rt(e,t){let n=O(t,Lt),r=[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`}],[`circle`,{cx:`12`,cy:`13`,r:`3`}]];Q(e,H({name:`camera`},()=>n,{get iconNode(){return r}}))}var zt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Bt(e,t){let n=O(t,zt),r=[[`path`,{d:`M5 21v-6`}],[`path`,{d:`M12 21V3`}],[`path`,{d:`M19 21V9`}]];Q(e,H({name:`chart-no-axes-column`},()=>n,{get iconNode(){return r}}))}var Vt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ht(e,t){let n=O(t,Vt),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];Q(e,H({name:`check`},()=>n,{get iconNode(){return r}}))}var Ut=new Set([`$$slots`,`$$events`,`$$legacy`]);function Wt(e,t){let n=O(t,Ut),r=[[`path`,{d:`m6 9 6 6 6-6`}]];Q(e,H({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var Gt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Kt(e,t){let n=O(t,Gt),r=[[`path`,{d:`m9 18 6-6-6-6`}]];Q(e,H({name:`chevron-right`},()=>n,{get iconNode(){return r}}))}var qt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jt(e,t){let n=O(t,qt),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`}]];Q(e,H({name:`circle-alert`},()=>n,{get iconNode(){return r}}))}var Yt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xt(e,t){let n=O(t,Yt),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`}],[`path`,{d:`M12 18V6`}]];Q(e,H({name:`circle-dollar-sign`},()=>n,{get iconNode(){return r}}))}var Zt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qt(e,t){let n=O(t,Zt),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]];Q(e,H({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var $t=new Set([`$$slots`,`$$events`,`$$legacy`]);function en(e,t){let n=O(t,$t),r=[[`path`,{d:`m18 16 4-4-4-4`}],[`path`,{d:`m6 8-4 4 4 4`}],[`path`,{d:`m14.5 4-5 16`}]];Q(e,H({name:`code-xml`},()=>n,{get iconNode(){return r}}))}var tn=new Set([`$$slots`,`$$events`,`$$legacy`]);function nn(e,t){let n=O(t,tn),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];Q(e,H({name:`copy`},()=>n,{get iconNode(){return r}}))}var rn=new Set([`$$slots`,`$$events`,`$$legacy`]);function an(e,t){let n=O(t,rn),r=[[`path`,{d:`M14 9 9 4 4 9`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`}]];Q(e,H({name:`corner-left-up`},()=>n,{get iconNode(){return r}}))}var on=new Set([`$$slots`,`$$events`,`$$legacy`]);function sn(e,t){let n=O(t,on),r=[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`}]];Q(e,H({name:`credit-card`},()=>n,{get iconNode(){return r}}))}var cn=new Set([`$$slots`,`$$events`,`$$legacy`]);function ln(e,t){let n=O(t,cn),r=[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]];Q(e,H({name:`download`},()=>n,{get iconNode(){return r}}))}var un=new Set([`$$slots`,`$$events`,`$$legacy`]);function dn(e,t){let n=O(t,un),r=[[`path`,{d:`m15 15 6 6`}],[`path`,{d:`m15 9 6-6`}],[`path`,{d:`M21 16v5h-5`}],[`path`,{d:`M21 8V3h-5`}],[`path`,{d:`M3 16v5h5`}],[`path`,{d:`m3 21 6-6`}],[`path`,{d:`M3 8V3h5`}],[`path`,{d:`M9 9 3 3`}]];Q(e,H({name:`expand`},()=>n,{get iconNode(){return r}}))}var fn=new Set([`$$slots`,`$$events`,`$$legacy`]);function pn(e,t){let n=O(t,fn),r=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`M10 14 21 3`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}]];Q(e,H({name:`external-link`},()=>n,{get iconNode(){return r}}))}var mn=new Set([`$$slots`,`$$events`,`$$legacy`]);function hn(e,t){let n=O(t,mn),r=[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];Q(e,H({name:`eye`},()=>n,{get iconNode(){return r}}))}var gn=new Set([`$$slots`,`$$events`,`$$legacy`]);function _n(e,t){let n=O(t,gn),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 12.5 8 15l2 2.5`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`}]];Q(e,H({name:`file-code`},()=>n,{get iconNode(){return r}}))}var vn=new Set([`$$slots`,`$$events`,`$$legacy`]);function yn(e,t){let n=O(t,vn),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M9 10h6`}],[`path`,{d:`M12 13V7`}],[`path`,{d:`M9 17h6`}]];Q(e,H({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var bn=new Set([`$$slots`,`$$events`,`$$legacy`]);function xn(e,t){let n=O(t,bn),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]];Q(e,H({name:`file-text`},()=>n,{get iconNode(){return r}}))}var Sn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Cn(e,t){let n=O(t,Sn),r=[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}]];Q(e,H({name:`folder-open`},()=>n,{get iconNode(){return r}}))}var wn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tn(e,t){let n=O(t,wn),r=[[`path`,{d:`M12 10v6`}],[`path`,{d:`M9 13h6`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];Q(e,H({name:`folder-plus`},()=>n,{get iconNode(){return r}}))}var En=new Set([`$$slots`,`$$events`,`$$legacy`]);function Dn(e,t){let n=O(t,En),r=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];Q(e,H({name:`folder`},()=>n,{get iconNode(){return r}}))}var On=new Set([`$$slots`,`$$events`,`$$legacy`]);function kn(e,t){let n=O(t,On),r=[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`}],[`rect`,{width:`10`,height:`8`,x:`7`,y:`8`,rx:`1`}]];Q(e,H({name:`fullscreen`},()=>n,{get iconNode(){return r}}))}var An=new Set([`$$slots`,`$$events`,`$$legacy`]);function jn(e,t){let n=O(t,An),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}],[`path`,{d:`M2 12h20`}]];Q(e,H({name:`globe`},()=>n,{get iconNode(){return r}}))}var Mn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nn(e,t){let n=O(t,Mn),r=[[`path`,{d:`M5 22h14`}],[`path`,{d:`M5 2h14`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`}]];Q(e,H({name:`hourglass`},()=>n,{get iconNode(){return r}}))}var Pn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Fn(e,t){let n=O(t,Pn),r=[[`path`,{d:`M13 5h8`}],[`path`,{d:`M13 12h8`}],[`path`,{d:`M13 19h8`}],[`path`,{d:`m3 17 2 2 4-4`}],[`path`,{d:`m3 7 2 2 4-4`}]];Q(e,H({name:`list-checks`},()=>n,{get iconNode(){return r}}))}var In=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ln(e,t){let n=O(t,In),r=[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]];Q(e,H({name:`loader-circle`},()=>n,{get iconNode(){return r}}))}var Rn=new Set([`$$slots`,`$$events`,`$$legacy`]);function zn(e,t){let n=O(t,Rn),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];Q(e,H({name:`lock`},()=>n,{get iconNode(){return r}}))}var Bn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vn(e,t){let n=O(t,Bn),r=[[`path`,{d:`m16 17 5-5-5-5`}],[`path`,{d:`M21 12H9`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}]];Q(e,H({name:`log-out`},()=>n,{get iconNode(){return r}}))}var Hn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Un(e,t){let n=O(t,Hn),r=[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]];Q(e,H({name:`moon`},()=>n,{get iconNode(){return r}}))}var Wn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gn(e,t){let n=O(t,Wn),r=[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`}],[`path`,{d:`M2 6h4`}],[`path`,{d:`M2 10h4`}],[`path`,{d:`M2 14h4`}],[`path`,{d:`M2 18h4`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`}]];Q(e,H({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var Kn=new Set([`$$slots`,`$$events`,`$$legacy`]);function qn(e,t){let n=O(t,Kn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M15 3v18`}]];Q(e,H({name:`panel-right`},()=>n,{get iconNode(){return r}}))}var Jn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yn(e,t){let n=O(t,Jn),r=[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`}]];Q(e,H({name:`paperclip`},()=>n,{get iconNode(){return r}}))}var Xn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zn(e,t){let n=O(t,Xn),r=[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]];Q(e,H({name:`refresh-cw`},()=>n,{get iconNode(){return r}}))}var Qn=new Set([`$$slots`,`$$events`,`$$legacy`]);function $n(e,t){let n=O(t,Qn),r=[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`}]];Q(e,H({name:`save`},()=>n,{get iconNode(){return r}}))}var er=new Set([`$$slots`,`$$events`,`$$legacy`]);function tr(e,t){let n=O(t,er),r=[[`path`,{d:`M15 12h-5`}],[`path`,{d:`M15 8h-5`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`}]];Q(e,H({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var nr=new Set([`$$slots`,`$$events`,`$$legacy`]);function rr(e,t){let n=O(t,nr),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];Q(e,H({name:`search`},()=>n,{get iconNode(){return r}}))}var ir=new Set([`$$slots`,`$$events`,`$$legacy`]);function ar(e,t){let n=O(t,ir),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];Q(e,H({name:`settings`},()=>n,{get iconNode(){return r}}))}var or=new Set([`$$slots`,`$$events`,`$$legacy`]);function sr(e,t){let n=O(t,or),r=[[`path`,{d:`m15 15 6 6m-6-6v4.8m0-4.8h4.8`}],[`path`,{d:`M9 19.8V15m0 0H4.2M9 15l-6 6`}],[`path`,{d:`M15 4.2V9m0 0h4.8M15 9l6-6`}],[`path`,{d:`M9 4.2V9m0 0H4.2M9 9 3 3`}]];Q(e,H({name:`shrink`},()=>n,{get iconNode(){return r}}))}var cr=new Set([`$$slots`,`$$events`,`$$legacy`]);function lr(e,t){let n=O(t,cr),r=[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`}]];Q(e,H({name:`square-pen`},()=>n,{get iconNode(){return r}}))}var ur=new Set([`$$slots`,`$$events`,`$$legacy`]);function dr(e,t){let n=O(t,ur),r=[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]];Q(e,H({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var fr=new Set([`$$slots`,`$$events`,`$$legacy`]);function pr(e,t){let n=O(t,fr),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];Q(e,H({name:`square`},()=>n,{get iconNode(){return r}}))}var mr=new Set([`$$slots`,`$$events`,`$$legacy`]);function hr(e,t){let n=O(t,mr),r=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]];Q(e,H({name:`sun`},()=>n,{get iconNode(){return r}}))}var gr=new Set([`$$slots`,`$$events`,`$$legacy`]);function _r(e,t){let n=O(t,gr),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];Q(e,H({name:`terminal`},()=>n,{get iconNode(){return r}}))}var vr=new Set([`$$slots`,`$$events`,`$$legacy`]);function yr(e,t){let n=O(t,vr),r=[[`circle`,{cx:`12`,cy:`8`,r:`5`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`}]];Q(e,H({name:`user-round`},()=>n,{get iconNode(){return r}}))}var br=new Set([`$$slots`,`$$events`,`$$legacy`]);function xr(e,t){let n=O(t,br),r=[[`path`,{d:`M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1`}],[`path`,{d:`M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4`}]];Q(e,H({name:`wallet`},()=>n,{get iconNode(){return r}}))}var Sr=new Set([`$$slots`,`$$events`,`$$legacy`]);function Cr(e,t){let n=O(t,Sr),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];Q(e,H({name:`wrench`},()=>n,{get iconNode(){return r}}))}var wr=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tr(e,t){let n=O(t,wr),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];Q(e,H({name:`x`},()=>n,{get iconNode(){return r}}))}var Er=new Set([`$$slots`,`$$events`,`$$legacy`]);function Dr(e,t){let n=O(t,Er),r=[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`}]];Q(e,H({name:`zap`},()=>n,{get iconNode(){return r}}))}function Or(e,t,n){let{userId:r,...i}=t,a=!1,o=0,s,c=[];async function l(t){try{let s=[],l=null,u;for(;;){let n=await e.query(ve.artifacts.listArtifacts,{...i,cursor:l});if(a||o!==t)return;if(u!==void 0&&u!==n.revision)throw Error(`Artifact registry changed during loading; retrying.`);if(u=n.revision,s.push(...n.page.filter(e=>e.userId===r)),n.isDone)break;if(l===n.continueCursor)throw Error(`Artifact page cursor did not advance.`);l=n.continueCursor}c=s,n({artifacts:s,stale:!1,error:null})}catch(e){if(a||o!==t)return;n({artifacts:c,stale:!0,error:e instanceof Error?e.message:`Unable to load artifacts.`}),s=setTimeout(()=>{l(t)},2e3)}}let u=e.onUpdate(ve.artifacts.getArtifactState,{repositoryKey:t.repositoryKey},()=>{clearTimeout(s),l(++o)},e=>{o++,clearTimeout(s),c=[],n({artifacts:[],stale:!0,error:e.message})});return()=>{a=!0,clearTimeout(s),u()}}var kr=R(`<a><!></a>`),Ar=R(`<button><!></button>`);function jr(t,n){z(n,!0);let r=L(n,`type`,3,`button`),a=L(n,`variant`,3,`default`),c=L(n,`className`,3,``),l=L(n,`disabled`,3,!1),d=e(()=>a()===`outline`?`border-border bg-surface/80 text-foreground hover:bg-hover-fill`:`bg-primary text-primary-foreground hover:opacity-90`),f=e(()=>Y(`focus-visible:ring-ring/50 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-transparent px-5 py-2 text-sm font-medium transition-opacity focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50`,o(d),c()));var h=m(),g=u(h),_=e=>{var t=kr(),r=s(t);k(r,()=>n.children??P),I(t),x(()=>{M(t,`href`,n.href),B(t,1,F(o(f)))}),p(`click`,t,function(...e){n.onclick?.apply(this,e)}),i(e,t)},v=e=>{var t=Ar(),a=s(t);k(a,()=>n.children??P),I(t),x(()=>{M(t,`type`,r()),t.disabled=l(),B(t,1,F(o(f)))}),p(`click`,t,function(...e){n.onclick?.apply(this,e)}),i(e,t)};y(g,e=>{n.href&&!l()?e(_):e(v,-1)}),i(t,h),j()}f([`click`]);var Mr=R(`<!> <!>`,1),Nr=R(`<p class="text-destructive text-center text-sm" role="alert"> </p>`),Pr=R(`<div class="text-muted-foreground flex items-center justify-center gap-2 text-sm" aria-live="polite" aria-busy="true"><!> <span> </span></div>`),Fr=R(`<div><!></div>`);function Ir(t,n){z(n,!0);let r=L(n,`overlayOpen`,3,!1),c=L(n,`retryLabel`,3,`Retry`),l=e(()=>n.authState.isAuthenticated&&(n.authState.isLoading||!n.authState.connectionFailed)),d=e(()=>!n.authState.isAuthenticated&&n.authState.isLoading),f=e(()=>n.authState.isConfigured?o(l)?`Confirming your session`:n.authState.connectionFailed?`Couldn’t connect your account`:o(d)?`Preparing sign-in`:`Sign in to continue`:`Sign-in unavailable`),p=e(()=>n.authState.isConfigured?o(l)?`Verifying your secure connection before opening your projects.`:n.authState.connectionFailed?`Your session could not be confirmed. Retry when the connection is available.`:o(d)?`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.`),m=e(()=>n.authState.isAuthenticated?`Almost there`:`One moment`),h=e(()=>!!(n.authState.isConfigured&&n.authState.error&&!r()));var g=Fr(),_=s(g);Je(_,{get title(){return o(f)},get description(){return o(p)},actions:e=>{var t=Mr(),r=u(t),o=e=>{jr(e,{get onclick(){return n.onRetry},get disabled(){return n.authState.isLoading},children:(e,t)=>{V();var n=te();x(()=>a(n,c())),i(e,n)},$$slots:{default:!0}})};y(r,e=>{n.authState.connectionFailed&&n.authState.isConfigured&&e(o)});var s=U(r,2),l=e=>{jr(e,{variant:`outline`,get onclick(){return n.onSignOut},children:(e,t)=>{V();var n=te(`Sign Out`);i(e,n)},$$slots:{default:!0}})},d=e=>{var t=Mr(),r=u(t);jr(r,{get onclick(){return n.onSignIn},get disabled(){return n.authState.isLoading},children:(e,t)=>{V();var n=te(`Sign In`);i(e,n)},$$slots:{default:!0}}),jr(U(r,2),{variant:`outline`,get onclick(){return n.onSignUp},get disabled(){return n.authState.isLoading},children:(e,t)=>{V();var n=te(`Create Account`);i(e,n)},$$slots:{default:!0}}),i(e,t)};y(s,e=>{n.authState.isAuthenticated?e(l):n.authState.isConfigured&&!n.authState.connectionFailed&&e(d,1)}),i(e,t)},children:(e,t)=>{var r=Mr(),c=u(r),l=e=>{var t=Nr(),r=s(t,!0);I(t),x(()=>a(r,n.authState.error)),i(e,t)};y(c,e=>{o(h)&&e(l)});var d=U(c,2),f=e=>{var t=Pr(),n=s(t);Ln(n,{class:`size-3.5 animate-spin`,"aria-hidden":`true`});var r=U(n,2),c=s(r,!0);I(r),I(t),x(()=>a(c,o(m))),i(e,t)};y(d,e=>{n.authState.isLoading&&e(f)}),i(e,r)},$$slots:{actions:!0,default:!0}}),I(g),x(()=>{g.inert=r(),M(g,`aria-hidden`,r()?!0:void 0)}),i(t,g),j()}var Lr=R(`<div class="text-muted-foreground mb-4 flex justify-center" aria-hidden="true"><!></div>`),Rr=R(`<p class="text-muted-foreground mt-6 max-h-24 overflow-y-auto font-mono text-[11px] leading-5 break-all select-all"> </p>`),zr=R(`<p class="text-destructive mt-4 text-sm" role="alert"> </p>`),Br=R(`<p class="mt-4 text-sm text-amber-700" role="alert"> </p>`),Vr=R(`<!> Open browser`,1),Hr=R(`<!> Copied`,1),Ur=R(`<!> Copy link`,1),Wr=R(`<!> <!>`,1),Gr=R(`<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>`),Kr=R(`<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 qr(t,n){z(n,!0);let r=L(n,`error`,3,null),l=g(!1),f=g(null),h=g(null),_=null;c(()=>{if(!n.open){C(l,!1),C(f,null);return}let e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=!1;d().then(()=>{t||o(h)?.focus()});function r(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n.onCancel();return}if(e.key!==`Tab`||!o(h))return;let t=Array.from(o(h).querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`)&&e.offsetParent!==null);if(t.length===0){e.preventDefault(),o(h).focus();return}let r=t[0],i=t[t.length-1],a=document.activeElement;e.shiftKey&&(a===o(h)||a===r||!o(h).contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===o(h)||a===i||!o(h).contains(a))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,r,!0),()=>{t=!0,window.removeEventListener(`keydown`,r,!0),_!==null&&(window.clearTimeout(_),_=null),e?.isConnected&&e.focus()}});async function v(){if(n.signInUrl)try{await navigator.clipboard.writeText(n.signInUrl),C(l,!0),C(f,null),_!==null&&window.clearTimeout(_),_=window.setTimeout(()=>{C(l,!1),_=null},2e3)}catch{C(l,!1),C(f,`Could not copy the sign-in link. Select it above and copy manually.`)}}function b(){if(!n.signInUrl)return;let e=window.open(n.signInUrl,`_blank`);if(e){try{e.opener=null}catch{}n.onClearOpenError?.()}}let S=e(()=>n.signInUrl?r()?{title:`Open the sign-in link`,description:`Your browser didn’t open automatically. Continue with the options below.`}:{title:`Finish signing in`,description:`We opened your browser to complete sign-in. Waiting for you to finish there.`}:{title:`Preparing sign-in`,description:`Preparing a secure sign-in link. This usually takes a moment.`});var w=m(),T=u(w),E=e=>{var t=Kr(),c=s(t),d=s(c),g=e=>{var t=Lr();Ln(s(t),{class:`size-5 animate-spin`}),I(t),i(e,t)};y(d,e=>{n.signInUrl||e(g)});var _=U(d,2),w=s(_,!0);I(_);var T=U(_,2),E=s(T,!0);I(T);var D=U(T,2),O=e=>{var t=Rr(),r=s(t,!0);I(t),x(()=>{M(t,`title`,n.signInUrl),a(r,n.signInUrl)}),i(e,t)};y(D,e=>{n.signInUrl&&e(O)});var k=U(D,2),A=e=>{var t=zr(),n=s(t,!0);I(t),x(()=>a(n,r())),i(e,t)};y(k,e=>{r()&&e(A)});var j=U(k,2),N=e=>{var t=Br(),n=s(t,!0);I(t),x(()=>a(n,o(f))),i(e,t)};y(j,e=>{o(f)&&e(N)});var ee=U(j,2),P=s(ee),F=e=>{var t=Wr(),n=u(t);jr(n,{onclick:b,children:(e,t)=>{var n=Vr();pn(u(n),{class:`size-4`,"aria-hidden":`true`}),V(),i(e,n)},$$slots:{default:!0}}),jr(U(n,2),{variant:`outline`,onclick:()=>void v(),children:(e,t)=>{var n=m(),r=u(n),a=e=>{var t=Hr();Ht(u(t),{class:`size-4`,"aria-hidden":`true`}),V(),i(e,t)},s=e=>{var t=Ur();nn(u(t),{class:`size-4`,"aria-hidden":`true`}),V(),i(e,t)};y(r,e=>{o(l)?e(a):e(s,-1)}),i(e,n)},$$slots:{default:!0}}),i(e,t)},L=e=>{var t=Gr();i(e,t)};y(P,e=>{n.signInUrl?e(F):e(L,-1)}),I(ee);var te=U(ee,2),R=s(te);I(te),I(c),W(c,e=>C(h,e),()=>o(h)),I(t),x(()=>{a(w,o(S).title),a(E,o(S).description)}),p(`click`,t,e=>{e.target===e.currentTarget&&n.onCancel()}),p(`click`,R,function(...e){n.onCancel?.apply(this,e)}),i(e,t)};y(T,e=>{n.open&&e(E)}),i(t,w),j()}f([`click`]);function Jr(){let e=g(null),t=g(!1),n=null;function r(){n&&=(clearTimeout(n),null)}function i(i,a,o=!1){let s=i.currentTarget;if(!(s instanceof HTMLElement))return;let c=s.getBoundingClientRect();r(),C(t,o,!0),C(e,{top:c.top-8,left:c.left+c.width/2,label:a},!0),o&&(n=setTimeout(()=>{C(t,!1),n=null,C(e,null)},2500))}function a(n=!1){o(t)&&!n||(r(),C(t,!1),C(e,null))}return c(()=>r),{get lockTooltip(){return o(e)},showLockTooltip:i,hideLockTooltip:a}}function Yr(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 Xr=R(`<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 Zr(e,t){z(t,!0);var n=m(),r=u(n),o=e=>{var n=Xr(),r=s(n,!0);I(n),x(()=>{ae(n,`top: ${t.tooltip.top}px; left: ${t.tooltip.left}px;`),a(r,t.tooltip.label)}),i(e,n)};y(r,e=>{t.tooltip&&e(o)}),i(e,n),j()}var Qr=R(`<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>`),$r=R(`<p class="text-muted-foreground px-3 pt-1 pb-2 text-[11px] font-medium"> </p>`),ei=R(`<span><!></span>`),ti=R(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),ni=R(`<button type="button"><!> <span> </span> <!></button>`),ri=R(`<p class="text-muted-foreground px-3 py-5 text-center text-sm">No matches found</p>`),ii=R(`<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>`),ai=R(`<div><button type="button" aria-haspopup="dialog"><!> <span class="truncate"> </span> <!></button> <!></div> <!>`,1);function oi(t,n){z(n,!0);let r=L(n,`value`,15,``),l=L(n,`disabled`,3,!1),d=L(n,`className`,3,``),f=L(n,`triggerClassName`,3,``),_=L(n,`searchable`,3,!1),b=g(!1),S=g(``),w=g(null),T=g(null),E=g(null),D=Jr(),O=e(()=>{let e=n.options.find(e=>e.id===r());return e&&!e.locked?e:n.options.find(e=>!e.locked)??e??n.options[0]??null}),N=e(()=>_()&&o(S).trim()?n.options.filter(e=>e.label.toLocaleLowerCase().includes(o(S).trim().toLocaleLowerCase())):n.options),ee=e(()=>o(N).filter(e=>!e.locked));function P(){l()||(C(b,!o(b)),o(b)&&_()?queueMicrotask(()=>o(E)?.focus()):C(S,``))}function te(e,t){let i=n.options.find(t=>t.id===e);if(i){if(i.locked){t&&i.lockTooltip&&D.showLockTooltip(t,i.lockTooltip,!0);return}e!==r()&&(r(e),n.onValueChange?.(e)),C(b,!1),C(S,``),D.hideLockTooltip(!0),o(T)?.focus()}}function R(e){e.key===`Enter`&&o(ee).length!==0&&(e.preventDefault(),te(o(ee)[0].id))}c(()=>{if(!o(b)){C(S,``),D.hideLockTooltip();return}return Yr({getRoot:()=>o(w),onOutside:()=>{C(b,!1)},onEscape:()=>{C(b,!1),o(T)?.focus()}})}),c(()=>{l()&&C(b,!1)});var ne=ai(),V=u(ne),re=s(V),ie=s(re),H=e=>{var t=m(),r=u(t);k(r,()=>n.optionIcon,()=>o(O)),i(e,t)};y(ie,e=>{n.optionIcon&&o(O)&&e(H)});var ae=U(ie,2),oe=s(ae,!0);I(ae);var se=U(ae,2);{let t=e(()=>Y(`text-muted-foreground size-3 shrink-0 transition-transform`,o(b)&&`rotate-180`));Wt(se,{get class(){return o(t)}})}I(re),W(re,e=>C(T,e),()=>o(T));var ce=U(re,2),ue=t=>{var c=ii(),l=s(c),u=e=>{var t=Qr(),r=s(t);rr(r,{class:`size-4 shrink-0`});var c=U(r,2),l=s(c);I(c);var u=U(c,2);le(u),W(u,e=>C(E,e),()=>o(E)),I(t),x((e,t)=>{a(l,`Search ${e??``}`),M(u,`placeholder`,t)},[()=>n.menuTitle.toLocaleLowerCase(),()=>`Search ${n.menuTitle.toLocaleLowerCase()}…`]),p(`keydown`,u,R),A(u,()=>o(S),e=>C(S,e)),i(e,t)},d=e=>{var t=$r(),r=s(t,!0);I(t),x(()=>a(r,n.menuTitle)),i(e,t)};y(l,e=>{_()?e(u):e(d,-1)});var f=U(l,2),m=s(f);v(m,17,()=>o(N),e=>e.id,(t,c)=>{let l=e(()=>!!o(c).locked);var u=ni(),d=s(u),f=e=>{var t=ei(),r=s(t);k(r,()=>n.optionIcon,()=>o(c)),I(t),x(e=>B(t,1,e),[()=>F(Y(`flex size-7 shrink-0 items-center justify-center`,(o(l),`text-muted-foreground`)))]),i(e,t)};y(d,e=>{n.optionIcon&&e(f)});var m=U(d,2),g=s(m,!0);I(m);var _=U(m,2),v=e=>{var t=ti();zn(s(t),{class:`size-3.5`}),I(t),i(e,t)},b=t=>{{let n=e(()=>Y(`text-accent-strong size-4 shrink-0 transition-opacity`,o(c).id===r()?`opacity-100`:`opacity-0`));Ht(t,{get class(){return o(n)}})}};y(_,e=>{o(l)?e(v):e(b,-1)}),I(u),x((e,t)=>{B(u,1,e),M(u,`aria-pressed`,!o(l)&&o(c).id===r()),M(u,`aria-disabled`,o(l)),M(u,`aria-label`,o(l)&&o(c).lockTooltip?`${o(c).label}. ${o(c).lockTooltip}`:void 0),B(m,1,t),a(g,o(c).label)},[()=>F(Y(`focus-visible:ring-ring/60 flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left outline-none focus-visible:ring-2`,o(l)?`cursor-not-allowed opacity-45`:`hover:bg-hover-fill`,!o(l)&&o(c).id===r()&&`bg-hover-fill`)),()=>F(Y(`min-w-0 flex-1 truncate text-sm font-medium`,o(l)?`text-muted-foreground`:`text-foreground`))]),h(`mouseenter`,u,e=>{o(l)&&o(c).lockTooltip&&D.showLockTooltip(e,o(c).lockTooltip)}),h(`mouseleave`,u,()=>D.hideLockTooltip()),h(`focus`,u,e=>{o(l)&&o(c).lockTooltip&&D.showLockTooltip(e,o(c).lockTooltip)}),h(`blur`,u,()=>D.hideLockTooltip()),p(`click`,u,e=>{te(o(c).id,e)}),i(t,u)});var g=U(m,2),b=e=>{var t=ri();i(e,t)};y(g,e=>{o(N).length===0&&e(b)}),I(f),I(c),x(e=>{M(c,`aria-label`,n.menuTitle),B(f,1,e)},[()=>F(Y(`space-y-0.5`,_()&&`pt-1.5`))]),i(t,c)};y(ce,e=>{o(b)&&e(ue)}),I(V),W(V,e=>C(w,e),()=>o(w)),Zr(U(V,2),{get tooltip(){return D.lockTooltip}}),x((e,t)=>{B(V,1,e),B(re,1,t),M(re,`aria-expanded`,o(b)),M(re,`aria-label`,n.ariaLabel),re.disabled=l(),a(oe,o(O)?.triggerLabel??o(O)?.label??r())},[()=>F(Y(`relative`,d())),()=>F(Y(`focus-visible:ring-ring/60 text-muted-foreground hover:bg-hover-fill inline-flex h-8 shrink-0 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-sm font-medium transition outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50`,!n.optionIcon&&`gap-1`,f()))]),p(`click`,re,P),i(t,ne),j()}f([`click`,`keydown`]);var si=t(`<title> </title>`),ci=t(`<svg viewBox="146.694 227.042 267.198 264.812" xmlns="http://www.w3.org/2000/svg" role="img" fill="none"><!><path d="M249.176 323.434V298.276C249.176 296.158 249.971 294.569 251.825 293.509L302.406 264.381C309.29 260.409 317.5 258.555 325.973 258.555C357.75 258.555 377.877 283.185 377.877 309.399C377.877 311.253 377.877 313.371 377.611 315.49L325.178 284.771C322.001 282.919 318.822 282.919 315.645 284.771L249.176 323.434ZM367.283 421.415V361.301C367.283 357.592 365.694 354.945 362.516 353.092L296.048 314.43L317.763 301.982C319.617 300.925 321.206 300.925 323.058 301.982L373.639 331.112C388.205 339.586 398.003 357.592 398.003 375.069C398.003 395.195 386.087 413.733 367.283 421.412V421.415ZM233.553 368.452L211.838 355.742C209.986 354.684 209.19 353.095 209.19 350.975V292.718C209.19 264.383 230.905 242.932 260.301 242.932C271.423 242.932 281.748 246.641 290.49 253.26L238.321 283.449C235.146 285.303 233.555 287.951 233.555 291.659V368.455L233.553 368.452ZM280.292 395.462L249.176 377.985V340.913L280.292 323.436L311.407 340.913V377.985L280.292 395.462ZM300.286 475.968C289.163 475.968 278.837 472.259 270.097 465.64L322.264 435.449C325.441 433.597 327.03 430.949 327.03 427.239V350.445L349.011 363.155C350.865 364.213 351.66 365.802 351.66 367.922V426.179C351.66 454.514 329.679 475.965 300.286 475.965V475.968ZM237.525 416.915L186.944 387.785C172.378 379.31 162.582 361.305 162.582 343.827C162.582 323.436 174.763 305.164 193.563 297.485V357.861C193.563 361.571 195.154 364.217 198.33 366.071L264.535 404.467L242.82 416.915C240.967 417.972 239.377 417.972 237.525 416.915ZM234.614 460.343C204.689 460.343 182.71 437.833 182.71 410.028C182.71 407.91 182.976 405.792 183.238 403.672L235.405 433.863C238.582 435.715 241.763 435.715 244.938 433.863L311.407 395.466V420.622C311.407 422.742 310.612 424.331 308.758 425.389L258.179 454.519C251.293 458.491 243.083 460.343 234.611 460.343H234.614ZM300.286 491.854C332.329 491.854 359.073 469.082 365.167 438.892C394.825 431.211 413.892 403.406 413.892 375.073C413.892 356.535 405.948 338.529 391.648 325.552C392.972 319.991 393.766 314.43 393.766 308.87C393.766 271.003 363.048 242.666 327.562 242.666C320.413 242.666 313.528 243.723 306.644 246.109C294.725 234.457 278.307 227.042 260.301 227.042C228.258 227.042 201.513 249.815 195.42 280.004C165.761 287.685 146.694 315.49 146.694 343.824C146.694 362.362 154.638 380.368 168.938 393.344C167.613 398.906 166.819 404.467 166.819 410.027C166.819 447.894 197.538 476.231 233.024 476.231C240.172 476.231 247.058 475.173 253.943 472.788C265.859 484.441 282.278 491.854 300.286 491.854Z" fill="currentColor"></path></svg>`);function li(e,t){z(t,!0);let n=L(t,`className`,3,``),r=L(t,`title`,3,`OpenAI`);var o=ci(),c=s(o),l=e=>{var t=si(),n=s(t,!0);I(t),x(()=>a(n,r())),i(e,t)};y(c,e=>{r()&&e(l)}),V(),I(o),x(e=>{B(o,0,e),M(o,`aria-hidden`,!r()||void 0)},[()=>F(Y(`size-4`,n()))]),i(e,o),j()}var ui=t(`<svg viewBox="0 0 24 24" role="img" aria-label="Anthropic" fill="currentColor"><path d="M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223 2.291-5.945 2.292 5.945Z"></path></svg>`),di=t(`<svg viewBox="0 0 24 24" role="img" aria-label="xAI" fill="currentColor"><path d="M6.469 8.776 16.512 23h-4.464L2.005 8.776H6.47Zm-.004 7.9 2.233 3.164L6.467 23H2l4.465-6.324ZM22 2.582V23h-3.659V7.764L22 2.582ZM22 1l-9.952 14.095-2.233-3.163L17.533 1H22Z"></path></svg>`),fi=t(`<svg viewBox="0 0 24 24" role="img" aria-label="Z.AI" fill="currentColor"><path d="M12.606 1.806l-1.677 2.388c-0.258 0.374-0.697 0.606-1.161 0.606h-9.162V1.794C0.594 1.806 12.606 1.806 12.606 1.806zM24 1.806L9.6 22.206 0 22.206 14.4 1.806zM11.394 22.206l1.69-2.4c0.258-0.374 0.697-0.606 1.161-0.606h9.149v3.006H11.394z"></path></svg>`),pi=t(`<svg viewBox="0 0 24 24" role="img" aria-label="DeepSeek" fill="currentColor"><path d="M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45"></path></svg>`),mi=t(`<svg viewBox="0 0 465 465" role="img" aria-label="Moonshot AI" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M418.766 93.78C388.626 53.17 345.086 22.07 292.446 7.97C239.806 -6.13 186.536 -0.97 140.136 19.13L418.766 93.78ZM40.7758 100.85C61.3758 70.84 88.5858 46.43 119.776 29.15L325.036 84.15C311.566 91.92 297.136 105.31 285.966 120.03L454.736 165.25C459.526 181.08 462.646 197.49 463.956 214.24L40.7758 100.85ZM456.686 292.45C454.306 301.35 451.436 309.99 448.116 318.34L2.44584 198.93C3.74584 190.03 5.58584 181.12 7.96584 172.22C13.5658 151.31 21.8458 131.84 32.3458 114.08L250.436 172.52C241.706 185 233.756 198.56 226.756 213.07L460.516 275.71C459.446 281.3 458.166 286.88 456.676 292.47L456.686 292.45ZM13.4858 310.23C2.67584 279.96 -1.93416 247.22 0.745843 213.95L206.426 269.06C204.946 273.74 203.556 278.48 202.266 283.29C199.646 293.08 197.506 302.85 195.846 312.55L417.946 372.06C407.606 385.79 395.826 398.23 382.896 409.21L13.4858 310.23ZM172.206 456.69C102.096 437.9 48.1158 388.98 20.4758 327.59L187.846 372.44C187.576 388.05 188.546 403.26 190.676 417.85L312.286 450.43C268.876 466.39 220.286 469.57 172.206 456.69Z"></path></svg>`),hi=t(`<svg viewBox="0 0 24 24" role="img" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="9"></circle><path d="M12 8v4l2.5 1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);function gi(t,n){z(n,!0);let r=L(n,`className`,3,``);var a=m(),s=u(a),c=t=>{{let n=e(()=>Y(`size-4 text-foreground`,r()));li(t,{get className(){return o(n)}})}},l=e=>{var t=ui();x(e=>B(t,0,e),[()=>F(Y(`size-4 text-[#D97757]`,r()))]),i(e,t)},d=e=>{var t=di();x(e=>B(t,0,e),[()=>F(Y(`text-foreground size-4`,r()))]),i(e,t)},f=e=>{var t=fi();x(e=>B(t,0,e),[()=>F(Y(`text-foreground size-4`,r()))]),i(e,t)},p=e=>{var t=pi();x(e=>B(t,0,e),[()=>F(Y(`size-4 text-[#4D6BFE]`,r()))]),i(e,t)},h=e=>{var t=mi();x(e=>B(t,0,e),[()=>F(Y(`text-foreground size-4`,r()))]),i(e,t)},g=e=>{var t=hi();x(e=>{B(t,0,e),M(t,`aria-label`,n.provider||`Unknown provider`)},[()=>F(Y(`text-muted-foreground size-4`,r()))]),i(e,t)};y(s,e=>{n.provider===`openai`?e(c):n.provider===`anthropic`?e(l,1):n.provider===`xai`?e(d,2):n.provider===`zai`?e(f,3):n.provider===`deepseek`?e(p,4):n.provider===`kimi`?e(h,5):e(g,-1)}),i(t,a),j()}var _i=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],vi=`gpt-5.6-sol`,yi=`high`,bi=`/api`,xi=`Model catalog is unavailable.`;function Si(e,t){return e.models.find(e=>e.id===t)}function Ci(e,t,n){return(e.tierAllowedModels[t]??[]).includes(n)}function wi(e,t,n){return Ci(e,t,n)?n:e.tierAllowedModels[t]?.[0]??e.defaultModelId}function Ti(e,t,n){return n.supportsFastMode?e.tierAllowsFastMode[t]?`available`:`locked`:`unsupported`}function Ei(e,t){let n=[],r=[];for(let i of e.models){let a={id:i.id,label:i.label,provider:i.provider};Ci(e,t,i.id)?n.push(a):r.push({...a,locked:!0,lockTooltip:e.modelLockUpgradeMessage})}return[...n,...r]}function Di(e){switch(e){case`none`:return`None`;case`low`:return`Low`;case`medium`:return`Medium`;case`high`:return`High`;case`xhigh`:return`Extra High`;case`max`:return`Max`;default:return e}}var Oi=Fe({id:K().min(1),label:K().min(1),provider:K().min(1),supportsImages:Ne(),contextWindowTokens:J(),autoCompactTokenLimit:J(),reasoningEfforts:Ae(K()).min(1),defaultReasoningEffort:K().min(1),serviceTiers:Ae(K()).min(1),usagePolicy:q(`unlimited`).optional()}),ki=De({sprocket:De({protocolVersion:J(),catalogVersion:K().min(1),defaultModelId:K().min(1),defaultReasoningEffort:K().min(1),defaultServiceTier:K().min(1),models:Ae(Oi).min(1),tierAllowedModels:De({free:Ae(K()),pro:Ae(K()),admin:Ae(K())}),tierAllowedServiceTiers:De({free:Ae(K()),pro:Ae(K()),admin:Ae(K())}),modelLockUpgradeMessage:K().min(1),serviceTierLockUpgradeMessage:K().min(1)})});function Ai(e){let t=e.sprocket;if(t.protocolVersion!==1)throw Error(`${xi} Unsupported protocol version ${t.protocolVersion}.`);return{protocolVersion:t.protocolVersion,catalogVersion:t.catalogVersion,defaultModelId:t.defaultModelId,defaultReasoningEffort:t.defaultReasoningEffort,models:t.models.map(e=>({id:e.id,label:e.label,provider:e.provider,supportsImages:e.supportsImages,contextWindowTokens:e.contextWindowTokens,autoHandoffTokenLimit:e.autoCompactTokenLimit,reasoningEfforts:e.reasoningEfforts,defaultReasoningEffort:e.defaultReasoningEffort,supportsFastMode:e.serviceTiers.includes(`fast`),usagePolicy:e.usagePolicy})),tierAllowedModels:t.tierAllowedModels,tierAllowsFastMode:{free:t.tierAllowedServiceTiers.free.includes(`fast`),pro:t.tierAllowedServiceTiers.pro.includes(`fast`),admin:t.tierAllowedServiceTiers.admin.includes(`fast`)},modelLockUpgradeMessage:t.modelLockUpgradeMessage,fastModeLockUpgradeMessage:t.serviceTierLockUpgradeMessage}}async function ji(e){let t=e.replace(/\/+$/,``);if(!t)throw Error(xi);let n=await fetch(`${t}${bi}/v1/models`,{headers:{accept:`application/json`}});if(!n.ok)throw Error(xi);let r=ki.safeParse(await n.json());if(!r.success)throw Error(xi);return Ai(r.data)}var Mi=R(`<span class="text-muted-foreground ml-auto text-xs">Default</span>`),Ni=R(`<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>`),Pi=R(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Fi=R(`<span class="size-3.5 shrink-0" aria-hidden="true"></span>`),Ii=R(`<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">Speed</p> <div class="space-y-0.5"><button type="button" role="switch"><!> <!> <span>Fast</span> <span aria-hidden="true"><span></span></span></button></div>`,1),Li=R(`<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"><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>`),Ri=R(`<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"><span> </span> <!></button> <!></div> <!>`,1);function zi(t,n){z(n,!0);let r=L(n,`reasoningEffort`,31,()=>l(yi)),d=L(n,`fastMode`,15,!1),f=L(n,`disabled`,3,!1),m=L(n,`className`,3,``),_=g(!1),b=g(null),S=g(null),w=Jr();function T(e){r(e)}function E(e){if(n.fastModeAccess===`locked`){n.fastModeLockTooltip&&w.showLockTooltip(e,n.fastModeLockTooltip,!0);return}n.fastModeAccess===`available`&&d(!d())}c(()=>{n.model.reasoningEfforts.includes(r())||r(n.model.defaultReasoningEffort),(n.fastModeAccess===`unsupported`||n.fastModeAccess===`locked`)&&d(!1)}),c(()=>{if(!o(_)){w.hideLockTooltip();return}return Yr({getRoot:()=>o(b),onOutside:()=>{C(_,!1)},onEscape:()=>{C(_,!1),o(S)?.focus()}})}),c(()=>{f()&&C(_,!1)});var D=Ri(),O=u(D),k=s(O),A=s(k),N=s(A);I(A);var ee=U(A,2);{let t=e(()=>Y(`text-muted-foreground size-3 shrink-0 transition-transform`,o(_)&&`rotate-180`));Wt(ee,{get class(){return o(t)}})}I(k),W(k,e=>C(S,e),()=>o(S));var P=U(k,2),te=t=>{var c=Li(),l=U(s(c),2);v(l,20,()=>n.model.reasoningEfforts,e=>e,(t,c)=>{var l=Ni(),u=s(l);{let t=e(()=>Y(`size-4 shrink-0 transition-opacity`,c===r()?`opacity-100`:`opacity-0`));Ht(u,{get class(){return o(t)}})}var d=U(u,2),f=s(d,!0);I(d);var m=U(d,2),h=e=>{var t=Mi();i(e,t)};y(m,e=>{c===n.model.defaultReasoningEffort&&e(h)}),I(l),x(e=>{M(l,`aria-pressed`,c===r()),a(f,e)},[()=>Di(c)]),p(`click`,l,()=>T(c)),i(t,l)}),I(l);var f=U(l,2),m=t=>{let r=e(()=>n.fastModeAccess===`locked`);var a=Ii(),c=U(u(a),4),l=s(c),f=s(l),m=e=>{var t=Pi();zn(s(t),{class:`size-3.5`}),I(t),i(e,t)},g=e=>{var t=Fi();i(e,t)};y(f,e=>{o(r)?e(m):e(g,-1)});var _=U(f,2);Dr(_,{class:`size-3.5 shrink-0 text-amber-400`});var v=U(_,2),b=U(v,2),S=s(b);I(b),I(l),I(c),x((e,t,i,a)=>{B(l,1,e),M(l,`aria-checked`,!o(r)&&d()),M(l,`aria-disabled`,o(r)),M(l,`aria-label`,o(r)&&n.fastModeLockTooltip?`Fast mode. ${n.fastModeLockTooltip}`:void 0),B(v,1,t),B(b,1,i),B(S,1,a)},[()=>F(Y(`focus-visible:ring-ring/60 flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm outline-none focus-visible:ring-2`,o(r)?`cursor-not-allowed opacity-45`:`text-foreground hover:bg-hover-fill`)),()=>F(Y(o(r)&&`text-muted-foreground`)),()=>F(Y(`relative ml-auto inline-flex h-5 w-9 shrink-0 items-center rounded-full transition`,d()&&!o(r)?`bg-foreground`:`bg-hover-fill-strong`)),()=>F(Y(`bg-background inline-block size-3.5 rounded-full transition`,d()&&!o(r)?`translate-x-[18px]`:`translate-x-[3px]`))]),h(`mouseenter`,l,e=>{o(r)&&n.fastModeLockTooltip&&w.showLockTooltip(e,n.fastModeLockTooltip)}),h(`mouseleave`,l,()=>w.hideLockTooltip()),h(`focus`,l,e=>{o(r)&&n.fastModeLockTooltip&&w.showLockTooltip(e,n.fastModeLockTooltip)}),h(`blur`,l,()=>w.hideLockTooltip()),p(`click`,l,E),i(t,a)};y(f,e=>{(n.fastModeAccess===`available`||n.fastModeAccess===`locked`)&&e(m)}),I(c),x(()=>M(c,`aria-label`,n.fastModeAccess===`available`||n.fastModeAccess===`locked`?`Reasoning and Fast mode`:`Reasoning`)),i(t,c)};y(P,e=>{o(_)&&e(te)}),I(O),W(O,e=>C(b,e),()=>o(b)),Zr(U(O,2),{get tooltip(){return w.lockTooltip}}),x((e,t)=>{B(O,1,e),M(k,`aria-expanded`,o(_)),M(k,`aria-label`,n.fastModeAccess===`available`||n.fastModeAccess===`locked`?`Select reasoning effort and Fast mode`:`Select reasoning effort`),k.disabled=f(),a(N,`${t??``}${d()&&n.model.supportsFastMode?` · Fast`:``}`)},[()=>F(Y(`relative`,m())),()=>Di(r())]),p(`click`,k,()=>{C(_,!o(_))}),i(t,D),j()}f([`click`]);function Bi(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}var Vi=/(^|\s)\$([a-z0-9-]*)$/i;function Hi(e,t){if(t<0||t>e.length)return null;let n=e.slice(0,t).match(Vi);return!n||n.index===void 0?null:{query:n[2].toLowerCase(),tokenStart:n.index+n[1].length}}function Ui(e,t){return Hi(e,t)?.query??null}function Wi(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 Gi(e,t,n){let r=Hi(e,t);if(!r)return null;let i=t;for(;i<e.length&&/[a-z0-9-]/i.test(e[i]??``);)i+=1;e[i]===` `&&(i+=1);let a=`$${n} `;return{text:`${e.slice(0,r.tokenStart)}${a}${e.slice(i)}`,caret:r.tokenStart+a.length}}function Ki(e){let t=Math.floor(e/60),n=e%60;return t===0?`${n}s`:`${t}m ${n}s`}function qi(e){let t=Math.max(0,e),n=Math.ceil(t/36e5);if(n>=24){let e=Math.floor(n/24),t=n%24;return t>0?`${e}d ${t}h`:`${e}d`}return t>=36e5?`${n}h`:`${Math.max(1,Math.ceil(t/6e4))}m`}function Ji(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return n>0?r>0?`${n}d ${r}h`:`${n}d`:r>0?i>0?`${r}h ${i}m`:`${r}h`:i>0?`${i}m ${a}s`:`${a}s`}var Yi=`agent_decide`;function Xi(e){return!!e.selectedOptionId?.trim()||!!e.text.trim()}function Zi(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>e===r[t])}var Qi=new Set([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]);function $i(e){return Qi.has(e.toLowerCase())}function ea(e){let t=e.trim();return t.length>0?t:`application/octet-stream`}function ta(e){let t=e.name.trim();return t.length>0?t:`Attached file`}function na(e){return e<1024?`${e} B`:e<1048576?`${Math.max(1,Math.round(e/1024))} KiB`:`${(e/1048576).toFixed(1).replace(/\.0$/,``)} MiB`}function ra(e){e?.startsWith(`blob:`)&&URL.revokeObjectURL(e)}function ia(e){return!e.url&&$i(e.mediaType)}function aa(e,t){let n=document.createElement(`a`);n.href=e,n.download=t,n.rel=`noopener`,document.body.append(n),n.click(),n.remove()}var oa=R(`<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>`),sa=R(`<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>`),ca=R(`<div class="mb-3 px-4"><button type="button" class="border-border bg-surface/80 text-foreground hover:bg-hover-fill rounded-full border px-3 py-1.5 text-[13px] font-medium transition">Continue working</button></div>`),la=R(`<div class="mb-3 flex items-start gap-2.5 rounded-xl border border-amber-500/25 bg-amber-500/10 px-3.5 py-3" role="alert"><!> <div class="min-w-0"><p class="text-[13px] leading-5 font-medium text-amber-800 dark:text-amber-200">You're out of usage</p> <p class="text-[12.5px] leading-5 text-amber-800/90 dark:text-amber-200/90"> </p></div></div>`),ua=R(`<li><button type="button"> </button></li>`),da=R(`<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>`),fa=R(`<img/>`),pa=R(`<!> <span class="min-w-0 text-[12px] leading-4"><span class="text-foreground block truncate"> </span> <span class="text-muted-foreground block"> </span></span>`,1),ma=R(`<span role="status"><span class="border-border border-t-foreground/80 size-3.5 animate-spin rounded-full border-2"></span></span>`),ha=R(`<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>`),ga=R(`<li><!> <!> <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>`),_a=R(`<ul class="mb-3 flex max-h-36 flex-wrap items-center gap-2 overflow-y-auto" aria-label="Attached files"></ul>`),va=R(`<p class="text-muted-foreground px-3 py-2 text-sm">Loading skills…</p>`),ya=R(`<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>`),ba=R(`<p class="text-muted-foreground px-3 py-2 text-sm">No matching skills</p>`),xa=R(`<button type="button" role="option"><span class="text-sm font-medium"> </span> <span class="text-muted-foreground line-clamp-2 text-[12px]"> </span></button>`),Sa=R(`<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>`),Ca=R(`<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>`),wa=R(`<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>`),Ta=R(`<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>`),Ea=R(`<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 Da(t,n){z(n,!0);let r=L(n,`prompt`,15,``),d=L(n,`selectedModel`,31,()=>l(vi)),f=L(n,`selectedReasoningEffort`,31,()=>l(yi)),_=L(n,`fastMode`,15,!1),b=L(n,`pendingQuestion`,3,null),S=L(n,`showContinueWorking`,3,!1),w=L(n,`selectedQuestionOptionId`,15,null),T=L(n,`projectSkills`,3,null),E=ze(),D=Ue(ve.usage.getMyUsage,()=>E.isAuthenticated&&!E.isLoading?{}:`skip`),O=e(()=>D.data?.tier),k=e(()=>!!D.error),N=e(()=>n.modelCatalog?Ei(n.modelCatalog,o(O)??`free`):[]),ee=e(()=>n.modelCatalog?Si(n.modelCatalog,d()):void 0),te=e(()=>{if(!(!n.modelCatalog||!o(ee))){if(!o(ee).supportsFastMode)return`unsupported`;if(o(O))return Ti(n.modelCatalog,o(O),o(ee))}}),R=e(()=>o(ee)!==void 0&&(o(k)||o(O)!==void 0&&n.modelCatalog!==void 0&&Ci(n.modelCatalog,o(O),d()))),ne=g(null),V=g(null),re=g(null),ie=g(l([])),H=g(`idle`),oe=g(!1),se=g(0),le=g(0),ue=0,de,fe=l([]),pe=e(()=>b()!=null),G=e(()=>n.isRunning&&!o(pe)||n.isSubmitting),me=g(l(Date.now()));c(()=>{let e=setInterval(()=>{C(me,Date.now(),!0)},1e3);return()=>{clearInterval(e)}});let he=e(()=>o(ee)?.usagePolicy===`unlimited`),ge=e(()=>D.data?.exhausted===!0&&(D.data.resetsAt===null||D.data.resetsAt>o(me))&&!o(he)),_e=e(()=>n.modelCatalog?o(N).find(e=>!e.locked&&Si(n.modelCatalog,e.id)?.usagePolicy===`unlimited`)?.label??null:null),ye=e(()=>{if(!o(ge)||D.data===void 0)return null;let e=o(_e)===null?`Upgrade your subscription to keep going.`:`Switch to ${o(_e)} or upgrade your subscription to keep going.`;return D.data.resetsAt===null?e:`Your limit resets in ${Ji(D.data.resetsAt-o(me))}. ${e}`}),be=e(()=>!!r().trim()||n.attachments.length>0),xe=e(()=>Xi({selectedOptionId:w(),text:r()})),Se=e(()=>o(pe)?o(xe):o(be)),Ce=e(()=>n.attachments.some(e=>e.status!==`ready`)),we=e(()=>!o(G)&&!o(pe)),Te=g(null);c(()=>{let e=b()?.questionId??null;e!==o(Te)&&(C(Te,e,!0),w(null),r().trim()&&r(``))});let Ee=!!globalThis.CSS?.supports(`field-sizing`,`content`),K=e(()=>n.contextUsage.contextWindowTokens>0?Math.min(100,Math.round(n.contextUsage.inputTokens/n.contextUsage.contextWindowTokens*100)):0),q=e(()=>n.contextUsage.contextWindowTokens>0?Math.round(n.contextUsage.autoHandoffTokenLimit/n.contextUsage.contextWindowTokens*100):0),De=e(()=>Ui(r(),o(le))),Oe=e(()=>o(De)!==null&&!o(oe)&&!o(pe)),ke=e(()=>o(De)===null?[]:Wi(o(ie),o(De))),Ae=e(()=>o(Oe)&&o(ke).length>0?`composer-skill-option-${o(se)}`:void 0);function J(){C(le,o(ne)?.selectionStart??r().length,!0)}function je(){C(ie,[],!0),C(H,`idle`),C(oe,!1),C(se,0),ue+=1}async function Me(e=!1){if(o(H)===`loading`||(o(H)===`ready`||o(H)===`error`)&&!e)return;if(!T()?.load){C(ie,[],!0),C(H,`ready`);return}let t=++ue;C(H,`loading`);try{let e=await T().load();if(t!==ue)return;C(ie,e,!0),C(H,`ready`)}catch{if(t!==ue)return;C(ie,[],!0),C(H,`error`)}}function Ne(e){let t=Gi(r(),o(le),e.name);t&&(r(t.text),C(le,t.caret,!0),C(oe,!0),queueMicrotask(()=>{o(ne)&&(o(ne).focus(),o(ne).setSelectionRange(t.caret,t.caret),Re())}))}function Pe(e){let t=e.currentTarget;if(!(t instanceof HTMLInputElement))return;let r=Array.from(t.files??[]);t.value=``,r.length>0&&n.onAttachFiles(r)}function Fe(e){let t=Array.from(e.clipboardData?.files??[]);t.length===0||n.isRunning||n.isSubmitting||o(pe)||(e.clipboardData?.getData(`text/plain`)||e.preventDefault(),n.onAttachFiles(t))}function Ie(e){let t=e.currentTarget;if(!(t instanceof HTMLButtonElement)||t.disabled)return;let n=t.getBoundingClientRect();C(re,{top:n.top-8,left:n.left+n.width/2},!0)}function Le(){C(re,null)}function Re(){if(!o(ne)||Ee)return;let e=o(ne);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 Be(e){if(o(Oe)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),o(ke).length===0)return;let t=e.key===`ArrowDown`?1:-1;C(se,(o(se)+t+o(ke).length)%o(ke).length);return}if(e.key===`Escape`){e.preventDefault(),C(oe,!0);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){e.preventDefault();let t=o(ke)[o(se)];t&&Ne(t);return}}!n.canSend||!o(pe)&&!o(R)||!o(pe)&&o(ge)||n.isSubmitting||o(G)||!o(Se)||!o(pe)&&o(Ce)||Bi(e)&&(e.preventDefault(),n.onSubmit())}function Ve(e){w(w()===e?null:e)}function He(e){if(!n.modelCatalog)return;d(e);let t=Si(n.modelCatalog,e);t&&f(t.defaultReasoningEffort),n.onModelChange?.(e)}function We(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1).replace(/\.0$/,``)}m`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}c(()=>{n.modelCatalog&&(!d()||!Si(n.modelCatalog,d()))&&(d(n.modelCatalog.defaultModelId),f(n.modelCatalog.defaultReasoningEffort),_(!1))}),c(()=>{if(!n.modelCatalog||!o(O))return;let e=wi(n.modelCatalog,o(O),d());e!==d()&&(d(e),f(Si(n.modelCatalog,e)?.defaultReasoningEffort??n.modelCatalog.defaultReasoningEffort));let t=Si(n.modelCatalog,e);t&&Ti(n.modelCatalog,o(O),t)!==`available`&&_(!1)}),c(()=>{r(),Re()}),c(()=>{let e=T()?.workspacePath??null;if(de!==e&&(de=e,je()),o(De)===null){C(oe,!1);return}o(oe)||Me()}),c(()=>{o(ke),C(se,0)}),c(()=>{!o(Oe)||o(ke).length===0||fe[o(se)]?.scrollIntoView({block:`nearest`})});var Y=Ea(),Ge=u(Y),Ke=s(Ge),qe=s(Ke),Je=e=>{var t=oa(),r=U(s(t),2),o=s(r);I(r),I(t),x(()=>a(o,`Working for ${n.elapsedLabel??``}`)),i(e,t)},Ye=e=>{var t=sa(),r=U(s(t),2),o=s(r,!0);I(r),I(t),x(()=>a(o,n.isStarting?`Starting agent…`:`Sending request…`)),i(e,t)};y(qe,e=>{n.elapsedLabel?e(Je):n.isSubmitting&&e(Ye,1)});var X=U(qe,2),Xe=e=>{var t=ca(),r=s(t);I(t),x(()=>r.disabled=n.isSubmitting),p(`click`,r,function(...e){n.onContinueWorking?.apply(this,e)}),i(e,t)};y(X,e=>{S()&&n.onContinueWorking&&e(Xe)});var Ze=U(X,2);B(Ze,1,F(`composer-shell mx-auto w-full max-w-[48rem] rounded-[28px] p-px transition-colors duration-200`));var Qe=s(Ze);B(Qe,1,F(`composer-inner rounded-[27px] border border-[var(--hairline)] transition-colors duration-200`));var $e=s(Qe),et=s($e),tt=e=>{var t=la(),n=s(t);Jt(n,{class:`mt-0.5 size-4 shrink-0 text-amber-800 dark:text-amber-200`,"aria-hidden":`true`});var r=U(n,2),c=U(s(r),2),l=s(c,!0);I(c),I(r),I(t),x(()=>a(l,o(ye))),i(e,t)};y(et,e=>{o(ye)&&e(tt)});var nt=U(et,2),rt=t=>{var n=da(),r=s(n),c=s(r,!0);I(r);var l=U(r,2);v(l,21,()=>b().options,e=>e.id,(t,n)=>{let r=e(()=>o(n).id===Yi),c=e(()=>w()===o(n).id);var l=ua(),u=s(l),d=s(u,!0);I(u),I(l),x(()=>{B(u,1,`w-full rounded-lg border px-3 py-2 text-left text-[13px] leading-5 transition ${o(c)?`border-foreground/40 bg-hover-fill-strong text-foreground`:o(r)?`border-border/70 text-muted-foreground/80 hover:text-muted-foreground hover:bg-hover-fill`:`border-border text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),M(u,`aria-pressed`,o(c)),a(d,o(n).label)}),p(`click`,u,()=>{Ve(o(n).id)}),i(t,l)}),I(l),I(n),x(()=>a(c,b().question)),i(t,n)};y(nt,e=>{b()&&e(rt)});var it=U(nt,2),at=t=>{var r=_a();v(r,21,()=>n.attachments,e=>e.localId,(t,r)=>{let c=e(()=>$i(o(r).mediaType)&&!!o(r).previewUrl);var l=ga(),d=s(l),f=e=>{var t=fa();x(()=>{M(t,`src`,o(r).previewUrl),M(t,`alt`,o(r).name),B(t,1,`size-full object-cover ${o(r).status===`uploading`?`opacity-50`:``}`)}),i(e,t)},m=e=>{var t=pa(),n=u(t);xn(n,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`});var c=U(n,2),l=s(c),d=s(l,!0);I(l);var f=U(l,2),p=s(f,!0);I(f),I(c),x(e=>{a(d,o(r).name),a(p,e)},[()=>na(o(r).size)]),i(e,t)};y(d,e=>{o(c)?e(f):e(m,-1)});var h=U(d,2),g=e=>{var t=ma();x(()=>{B(t,1,`absolute inset-0 flex items-center justify-center ${o(c)?``:`bg-background/60`}`),M(t,`aria-label`,`Uploading ${o(r).name??``}`)}),i(e,t)},_=e=>{var t=ha();i(e,t)};y(h,e=>{o(r).status===`uploading`?e(g):o(r).status===`error`&&e(_,1)});var v=U(h,2);Tr(s(v),{class:`size-3`,"aria-hidden":`true`}),I(v),I(l),x(e=>{B(l,1,F(o(c)?`group relative size-14 overflow-hidden rounded-xl border ${o(r).status===`error`?`border-rose-500/60`:`border-border`}`:`group relative flex h-14 max-w-56 items-center gap-2 overflow-hidden rounded-xl border pr-7 pl-2 ${o(r).status===`error`?`border-rose-500/60`:`border-border`}`)),M(l,`title`,e),M(v,`aria-label`,`Remove ${o(r).name??``}`),v.disabled=o(G)},[()=>o(r).error??`${o(r).name} · ${na(o(r).size)}`]),p(`click`,v,()=>n.onRemoveAttachment(o(r).localId)),i(t,l)}),I(r),i(t,r)};y(it,e=>{n.attachments.length>0&&!o(pe)&&e(at)});var ot=U(it,2),st=s(ot),ct=e=>{var t=Sa(),n=s(t),r=e=>{var t=va();i(e,t)},c=e=>{var t=ya(),n=U(s(t),2);I(t),p(`click`,n,()=>{Me(!0)}),i(e,t)},l=e=>{var t=ba();i(e,t)},d=e=>{var t=m(),n=u(t);v(n,19,()=>o(ke),e=>e.name,(e,t,n)=>{var r=xa(),c=s(r),l=s(c);I(c);var u=U(c,2),d=s(u,!0);I(u),I(r),W(r,(e,t)=>fe[t]=e,e=>fe?.[e],()=>[o(n)]),x(()=>{M(r,`id`,`composer-skill-option-${o(n)??``}`),B(r,1,`flex w-full flex-col gap-0.5 px-3 py-2 text-left transition ${o(se)===o(n)?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),M(r,`aria-selected`,o(se)===o(n)),a(l,`$${o(t).name??``}`),a(d,o(t).description)}),h(`pointerenter`,r,()=>{C(se,o(n),!0)}),p(`click`,r,()=>{Ne(o(t))}),i(e,r)}),i(e,t)};y(n,e=>{o(H)===`loading`?e(r):o(H)===`error`?e(c,1):o(ke).length===0?e(l,2):e(d,-1)}),I(t),x(()=>M(t,`role`,o(H)===`ready`&&o(ke).length>0?`listbox`:`status`)),i(e,t)};y(st,e=>{o(Oe)&&e(ct)});var lt=U(st,2);ce(lt),W(lt,e=>C(ne,e),()=>o(ne)),I(ot);var ut=U(ot,2),dt=s(ut),ft=s(dt);W(ft,e=>C(V,e),()=>o(V));var pt=U(ft,2);M(pt,`aria-label`,`Attach files`),Yn(s(pt),{class:`size-4`,"aria-hidden":`true`}),I(pt);var Z=U(pt,4);{let t=(e,t=P)=>{gi(e,{get provider(){return t().provider},className:`size-4 shrink-0`})},r=e(()=>o(G)||o(pe)||n.modelCatalog===void 0);oi(Z,{get value(){return d()},get options(){return o(N)},ariaLabel:`Select model`,menuTitle:`Model`,get disabled(){return o(r)},searchable:!0,onValueChange:He,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`,optionIcon:t,$$slots:{optionIcon:!0}})}var mt=U(Z,4),ht=t=>{{let r=e(()=>n.modelCatalog?.fastModeLockUpgradeMessage),i=e(()=>o(G)||o(pe));zi(t,{get model(){return o(ee)},get fastModeAccess(){return o(te)},get fastModeLockTooltip(){return o(r)},get disabled(){return o(i)},className:`z-20 shrink-0`,get reasoningEffort(){return f()},set reasoningEffort(e){f(e)},get fastMode(){return _()},set fastMode(e){_(e)}})}};y(mt,e=>{o(ee)&&e(ht)}),I(dt);var gt=U(dt,2),_t=s(gt),vt=s(_t),yt=U(vt,2),bt=s(yt),xt=U(s(bt),2),St=s(xt);I(xt),I(bt);var Ct=U(bt,2),wt=s(Ct);I(Ct);var Tt=U(Ct,2),Et=U(s(Tt),2),Dt=s(Et,!0);I(Et),I(Tt);var Q=U(Tt,2),Ot=s(Q);I(Q),I(yt),I(_t);var kt=U(_t,2),$=e=>{var t=Ca();pr(s(t),{class:`size-3.5 fill-current`}),I(t),p(`click`,t,function(...e){n.onCancel?.apply(this,e)}),i(e,t)};y(kt,e=>{n.isRunning&&e($)});var At=U(kt,2),jt=e=>{var t=wa();Mt(s(t),{class:`size-4`}),I(t),x(()=>{t.disabled=!n.canSend||!o(pe)&&!o(R)||!o(pe)&&o(ge)||n.isSubmitting||!o(Se)||!o(pe)&&o(Ce),M(t,`aria-label`,o(pe)?`Submit answer`:`Send message`)}),p(`click`,t,function(...e){n.onSubmit?.apply(this,e)}),i(e,t)};y(At,e=>{(o(pe)||!n.isRunning)&&e(jt)}),I(gt),I(ut),I($e),I(Qe),I(Ze),I(Ke),I(Ge);var Nt=U(Ge,2),Pt=e=>{var t=Ta();t.textContent=`Attach files`,x(()=>ae(t,`top: ${o(re).top}px; left: ${o(re).left}px;`)),i(e,t)};y(Nt,e=>{o(re)&&e(Pt)}),x((e,t,n)=>{M(lt,`placeholder`,o(pe)?`Add detail, or type a custom answer`:`Ask anything, @tag files/directories, or use $ to show available skills`),lt.disabled=o(G),M(lt,`aria-expanded`,o(Oe)),M(lt,`aria-controls`,o(Oe)?`composer-skills-listbox`:void 0),M(lt,`aria-activedescendant`,o(Ae)),pt.disabled=!o(we),M(vt,`aria-label`,`Context window ${o(K)}% full`),ae(vt,`background: conic-gradient(var(--accent) ${o(K)*3.6}deg, var(--hover-fill-strong) 0deg);`),a(St,`${o(K)??``}% · ${e??``}/${t??``}`),ae(wt,`width: ${o(K)}%`),a(Dt,n),a(Ot,`At about ${o(q)??``}% of the context window, Sprocket writes a
|
|
2
|
+
handoff document and continues the work in a fresh context.`)},[()=>We(n.contextUsage.inputTokens),()=>We(n.contextUsage.contextWindowTokens),()=>We(n.contextUsage.totalTokensProcessed)]),p(`keydown`,lt,Be),h(`paste`,lt,Fe),h(`focus`,lt,J),p(`input`,lt,()=>{J(),Re()}),p(`keyup`,lt,J),p(`click`,lt,J),h(`select`,lt,J),A(lt,r),p(`change`,ft,Pe),h(`mouseenter`,pt,Ie),h(`mouseleave`,pt,Le),h(`focus`,pt,Ie),h(`blur`,pt,Le),p(`click`,pt,()=>{Le(),o(V)?.click()}),p(`keydown`,vt,e=>{e.key===`Escape`&&e.currentTarget.blur()}),i(t,Y),j()}f([`click`,`keydown`,`input`,`keyup`,`change`]);var Oa=[`free`,`pro`,`admin`],ka={free:`Free`,pro:`Pro`,admin:`Admin`},Aa={modelUsage:{weekly:5e3,monthly:15e3}};Aa.modelUsage.weekly*5,Aa.modelUsage.monthly*5;var ja=R(`<p class="text-foreground text-[15px]"> </p>`),Ma=R(`<button type="button" class="text-muted-foreground hover:text-foreground block text-left text-sm transition"><span> </span></button>`),Na=R(`<div class="mt-3 space-y-1"><!> <!></div>`),Pa=R(`<p class="text-muted-foreground mt-3 text-sm">You’re signed in to Sprocket.</p>`),Fa=R(`<p class="text-foreground mt-3 text-[15px]"> </p>`),Ia=R(`<p class="text-muted-foreground mt-3 text-sm">Couldn’t load your subscription right now.</p>`),La=R(`<div class="bg-hover-fill mt-3.5 h-4 w-16 animate-pulse rounded" aria-hidden="true"></div>`),Ra=R(`<!> Sign Out`,1),za=R(`<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><!></div></div></div></section>`);function Ba(t,n){z(n,!0);let r=g(!1),c=ze(),l=Ue(ve.billing.getMySubscription,()=>c.isAuthenticated&&!c.isLoading?{}:`skip`),d=e(()=>[n.user?.firstName,n.user?.lastName].filter(Boolean).join(` `).trim()||null);var f=za(),m=U(s(f),2),h=s(m),_=s(h),v=U(s(_),2),b=e=>{var t=Na(),c=s(t),l=e=>{var t=ja(),n=s(t,!0);I(t),x(()=>a(n,o(d))),i(e,t)};y(c,e=>{o(d)&&e(l)});var u=U(c,2),f=e=>{var t=Ma(),c=s(t),l=s(c,!0);I(c),I(t),x(()=>{M(t,`aria-pressed`,o(r)),M(t,`aria-label`,o(r)?`Hide email address`:`Show email address`),B(c,1,F(o(r)?void 0:`blur-[5px] select-none`)),a(l,n.user.email)}),p(`click`,t,()=>{C(r,!o(r))}),i(e,t)};y(u,e=>{n.user?.email&&e(f)}),I(t),i(e,t)},S=e=>{var t=Pa();i(e,t)};y(v,e=>{o(d)||n.user?.email?e(b):e(S,-1)}),I(_);var w=U(_,2),T=U(s(w),2),E=e=>{var t=Fa(),n=s(t,!0);I(t),x(()=>a(n,ka[l.data.tier])),i(e,t)},D=e=>{var t=Ia();i(e,t)},O=e=>{var t=La();i(e,t)};y(T,e=>{l.data?e(E):l.error?e(D,1):e(O,-1)}),I(w);var k=U(w,2);jr(s(k),{variant:`outline`,get onclick(){return n.onSignOut},children:(e,t)=>{var n=Ra();Vn(u(n),{class:`mr-2 size-4`,"aria-hidden":`true`}),V(),i(e,n)},$$slots:{default:!0}}),I(k),I(h),I(m),I(f),i(t,f),j()}f([`click`]);var Va=`Uncaught ConvexError: `,Ha=`Uncaught Error: `;function Ua(e,t){if(!e.startsWith(t))return null;let n=e.slice(t.length),r=n.indexOf(`
|
|
3
|
+
`),i=r===-1?n:n.slice(0,r),a=i.indexOf(`(`);return(a===-1?i:i.slice(0,a)).trim()||null}function Wa(e){if(e instanceof Re){let t=e.data.trim();if(t)return t}let t=e.message.trim();return t?Ua(t,Va)??Ua(t,Ha)??t:null}var Ga=R(`<p class="text-destructive text-sm" role="alert">Couldn't load your browser settings right now.</p>`),Ka=R(`<p class="text-destructive text-sm" role="alert"> </p>`),qa=R(`<p class="text-muted-foreground text-sm leading-6">This reset closes your current browser sessions, signs future sessions out, and starts
|
|
4
|
+
fresh.</p> <div class="mt-4 flex flex-wrap items-center gap-3"><!> <!></div>`,1),Ja=R(`<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]">Agent's Browser</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-8"><div class="flex items-center justify-between gap-4"><p class="text-foreground text-[15px]">Save cookies and login state</p> <button type="button" role="switch" aria-label="Save cookies and login state"><span aria-hidden="true"></span></button></div> <!> <!> <div><!></div></div></div></section>`);function Ya(t,n){z(n,!0);let r=ze(),c=Ue(ve.browserProfiles.getMine,()=>r.isAuthenticated&&!r.isLoading?{}:`skip`),l=Ve(ve.browserProfiles.setSaving),d=Ve(ve.browserProfiles.reset),f=g(!1),m=g(!1),h=g(null),_=e(()=>c.data!==void 0),v=e(()=>c.data?.savingEnabled??!0),b=e(()=>!o(_)||o(f));function S(e,t){return e instanceof Error&&Wa(e)||t}async function w(){if(!o(b)){C(f,!0),C(h,null);try{await l({enabled:!o(v)})}catch(e){C(h,S(e,`Couldn’t update browser saving.`),!0)}finally{C(f,!1)}}}async function T(){if(!o(b)){C(f,!0),C(h,null);try{await d({}),C(m,!1)}catch(e){C(h,S(e,`Couldn’t reset browser profile.`),!0)}finally{C(f,!1)}}}var E=Ja(),D=U(s(E),2),O=s(D),k=s(O),A=U(s(k),2),N=s(A);I(A),I(k);var ee=U(k,2),P=e=>{var t=Ga();i(e,t)};y(ee,e=>{c.error&&e(P)});var F=U(ee,2),L=e=>{var t=Ka(),n=s(t,!0);I(t),x(()=>a(n,o(h))),i(e,t)};y(F,e=>{o(h)&&e(L)});var R=U(F,2),ne=s(R),re=e=>{var t=qa(),n=U(u(t),2),r=s(n);jr(r,{onclick:()=>void T(),get disabled(){return o(b)},children:(e,t)=>{V();var n=te();x(()=>a(n,o(f)?`Resetting…`:`Confirm reset`)),i(e,n)},$$slots:{default:!0}}),jr(U(r,2),{variant:`outline`,get disabled(){return o(f)},onclick:()=>{C(m,!1)},children:(e,t)=>{V();var n=te(`Cancel`);i(e,n)},$$slots:{default:!0}}),I(n),i(e,t)},ie=e=>{jr(e,{variant:`outline`,get disabled(){return o(b)},onclick:()=>{C(m,!0),C(h,null)},children:(e,t)=>{V();var n=te(`Reset browser profile`);i(e,n)},$$slots:{default:!0}})};y(ne,e=>{o(m)?e(re):e(ie,-1)}),I(R),I(O),I(D),I(E),x(()=>{M(A,`aria-checked`,o(v)),M(A,`aria-busy`,!o(_)||o(f)),A.disabled=o(b),B(A,1,`focus-visible:ring-ring/50 relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 ${o(v)?`bg-foreground`:`bg-hover-fill-strong`}`),B(N,1,`bg-background inline-block size-3.5 rounded-full transition ${o(v)?`translate-x-[18px]`:`translate-x-[3px]`}`)}),p(`click`,A,()=>void w()),i(t,E),j()}f([`click`]);function Xa(e){return{threadId:e.threadId,repositoryKey:e.repositoryKey,title:e.title,selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,fastMode:e.fastMode,lastMessageAt:e.lastMessageAt,threadStatus:e.threadStatus,status:e.status}}function Za(e){return Xa({threadId:e._id,repositoryKey:e.repositoryKey,title:e.title??`New thread`,selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,fastMode:e.fastMode??!1,lastMessageAt:e.lastMessageAt,threadStatus:e.archivedAt===void 0?`active`:`archived`,status:e.status??`completed`})}function Qa(e,t){return t?e.find(e=>e.repositoryKey===t)??null:null}function $a(e,t){return t?e.find(e=>e.workspacePath===t)??null:null}function eo(e){return e.threadStatus!==`archived`}function to(e,t){let n=io(t);return{project:e,threads:n,activeThreadCount:ao(n)}}function no(e,t){let n=new Map;for(let e of t.filter(eo)){let t=n.get(e.repositoryKey);if(t){t.push(e);continue}n.set(e.repositoryKey,[e])}return e.map(e=>to(e,n.get(e.repositoryKey)??[]))}function ro(e){return e.status===`queued`||e.status===`running`||e.status===`awaiting_executor`}function io(e){return[...e].sort((e,t)=>ro(e)===ro(t)?t.lastMessageAt-e.lastMessageAt:Number(ro(t))-Number(ro(e)))}function ao(e){return e.filter(ro).length}function oo(e,t){return t?e.find(e=>e.threadId===t)??null:null}function so(e){let t=null;for(let n of e)eo(n)&&(!t||n.lastMessageAt>t.lastMessageAt)&&(t=n);return t}function co(e,t){return t&&(e?.threadId??e?._id)===t?e:null}function lo(e){let{pendingCreatedThreadId:t,threads:n}=e;return!t||oo(n,t)?null:t}function uo(e){return!e.threadId||e.threadId===e.pendingCreatedThreadId||e.hasLatestRunData}function fo(e,t){return!!(t&&e[t])}function po(e,t,n){return{...e,[t]:n}}function mo(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 ho(e,t,n,r){return!!(t&&(t!==e.previousRunId||n!=null&&n!==e.previousClaimExpiresAt||r!=null&&r!==e.previousStartedAt))}function go(e,t,n,r,i){let a=e[t];return!a||!ho(a,n,r,i)?e:mo(e,t,a.launchId)}function _o(e,t,n,r,i,a,o){let s=e[t];return!s||s.launchId!==n||s.expiresAt>r?{pendingLaunches:e,shouldRecover:!1}:{pendingLaunches:mo(e,t,n),shouldRecover:!ho(s,i,a,o)}}function vo(e){let{threads:t,currentThreadId:n,currentWorkspacePath:r,draftWorkspacePath:i}=e;return r&&i===r?null:n||(t[0]?.threadId??null)}var yo=R(`<p class="text-muted-foreground max-w-xl text-sm leading-6">No archived threads.</p>`),bo=R(`<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>`),xo=R(`<ul class="max-w-xl space-y-1"></ul>`),So=R(`<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 Co(t,n){z(n,!0);let r=e(()=>[...n.threads].filter(e=>!eo(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt));var c=So(),l=U(s(c),2),u=U(s(l),2),d=e=>{var t=yo();i(e,t)},f=t=>{var c=xo();v(c,21,()=>o(r),e=>e.threadId,(t,r)=>{let c=e(()=>Qa(n.projects,o(r).repositoryKey));var l=bo(),u=s(l),d=s(u),f=s(d,!0);I(d);var m=U(d,2),h=s(m,!0);I(m),I(u);var g=U(u,2);I(l),x(()=>{a(f,o(r).title),a(h,o(c)?.displayName??`Unknown project`)}),p(`click`,g,()=>{n.onRestore(o(r).threadId)}),i(t,l)}),I(c),i(t,c)};y(u,e=>{o(r).length===0?e(d):e(f,-1)}),I(l),I(c),i(t,c),j()}f([`click`]);var wo=R(`<div class="max-w-md"><p class="text-foreground text-sm"> </p> <p class="text-muted-foreground mt-0.5 text-xs leading-5">Opens Prava in a new tab so you can confirm with your passkey.</p> <a target="_blank" rel="noopener noreferrer" class="border-border bg-surface/80 text-foreground hover:bg-hover-fill mt-3 inline-flex h-9 items-center rounded-full border px-4 text-xs font-medium transition">Approve mandate</a></div>`);function To(e,t){z(t,!0);var n=wo(),r=s(n),o=s(r);I(r);var c=U(r,4);I(n),x(()=>{a(o,`Approve spending${t.approval.label?` · ${t.approval.label}`:``}`),M(c,`href`,t.approval.approvalUrl)}),i(e,n),j()}var Eo=R(`<p class="text-destructive text-sm"> </p>`),Do=R(`<div class="mt-4"><!></div>`),Oo=R(`<p class="text-destructive mt-3 text-sm"> </p>`),ko=R(`<div class="space-y-2"><div class="bg-hover-fill h-3.5 w-40 rounded"></div> <div class="bg-hover-fill h-3 w-56 rounded"></div></div>`),Ao=R(`<div class="mt-4 animate-pulse space-y-4" aria-hidden="true"></div>`),jo=R(`<p class="text-muted-foreground mt-3 text-sm leading-6">No mandates yet.</p>`),Mo=R(`<button type="button"> </button>`),No=R(`<div class="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1"></div>`),Po=R(`<li class="py-2"><div class="flex items-baseline justify-between gap-3"><p class="text-foreground truncate text-[14px]"> </p> <p class="text-muted-foreground shrink-0 text-[12px] capitalize"> </p></div> <p class="text-muted-foreground mt-0.5 text-[12px]"> <!> <!> <!></p> <!></li>`),Fo=R(`<ul class="mt-3 space-y-1"></ul>`),Io=R(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Payments</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Set up a spending mandate</p> <p class="text-muted-foreground mt-2 text-sm leading-6">Create a Prava mandate, then approve it in a new tab with your passkey.</p> <form class="mt-4 space-y-3"><div class="grid gap-3 sm:grid-cols-2"><label class="block space-y-1.5"><span>Merchant name</span> <input placeholder="Example Shop"/></label> <label class="block space-y-1.5"><span>Merchant URL</span> <input placeholder="https://example.com"/></label> <label class="block space-y-1.5"><span>Country code</span> <input placeholder="US"/></label> <label class="block space-y-1.5"><span>Amount cap</span> <input placeholder="120.00" required=""/></label> <label class="block space-y-1.5"><span>Currency</span> <input placeholder="USD" required=""/></label> <label class="block space-y-1.5"><span>Frequency</span> <select><option>One time</option><option>Weekly</option><option>Monthly</option><option>Yearly</option></select></label> <label class="block space-y-1.5 sm:col-span-2"><span>Scope</span> <select><option>Listed merchant</option><option>Any merchant</option></select></label> <label class="block space-y-1.5 sm:col-span-2"><span>Description</span> <input placeholder="Agent shopping budget" required=""/></label></div> <!> <!></form> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Your mandates</p> <!> <!></div></div></div></section>`);function Lo(t,n){z(n,!0);let r=ze(),u=He(ve.payments.listMyMandates),d=He(ve.payments.setupMyMandate),f=He(ve.payments.setMyMandateLifecycle);function m(e,t){return Wa(e)||t}function _(e,t){return e instanceof Error?m(e,t):t}let b=`border-border bg-hover-fill text-foreground placeholder:text-muted-foreground focus:border-ring h-9 w-full rounded-lg border px-3 text-[13px] outline-none`,S=`text-muted-foreground text-[12px]`,w=g(``),T=g(``),E=g(`US`),D=g(``),O=g(`USD`),k=g(`monthly`),M=g(`listed`),N=g(``),P=g(!1),L=g(null),R=g(null),ne=g(l([])),re=g(!1),ie=g(null),H=g(null),ae=g(null),oe={pause:{idle:`Pause`,busy:`Pausing…`},resume:{idle:`Resume`,busy:`Resuming…`},cancel:{idle:`Cancel`,busy:`Cancelling…`}};c(()=>{o(M)===`any`&&o(k)!==`one_time`&&C(k,`one_time`)}),c(()=>{!r.isAuthenticated||r.isLoading||W()}),c(()=>{if(!o(R)||!r.isAuthenticated)return;let e=()=>{document.visibilityState&&document.visibilityState!==`visible`||W()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}});async function W(){C(re,!0),C(ie,null);try{let e=await u({});C(ne,e.mandates,!0);let t=o(R)?.mandateId;t&&o(ne).some(e=>e.mandateId===t&&(e.status===`active`||e.status===`paused`))&&C(R,null)}catch(e){C(ie,_(e,`Couldn’t load mandates.`),!0)}finally{C(re,!1)}}async function se(e){e.preventDefault(),C(P,!0),C(L,null),C(R,null);let t=o(M)===`listed`;try{let e=await d({merchantName:t&&o(w).trim()||void 0,merchantUrl:t&&o(T).trim()||void 0,countryCode:t&&o(E).trim()||void 0,amountCap:o(D).trim(),currency:o(O).trim(),frequency:o(k),scope:o(M),description:o(N).trim()});C(R,{mandateId:e.mandateId,approvalUrl:e.approvalUrl,label:o(N).trim()},!0),await W()}catch(e){C(L,_(e,`Couldn’t set up mandate.`),!0)}finally{C(P,!1)}}async function ce(e,t){if(!(!e.mandateId||o(H)!==null)){C(H,e.pravaMandateId,!0),C(ae,t,!0),C(ie,null);try{await f({mandateId:e.mandateId,action:t}),await W()}catch(e){C(ie,_(e,`Couldn’t ${t} mandate.`),!0)}finally{C(H,null),C(ae,null)}}}var ue=Io(),de=U(s(ue),2),fe=s(de),pe=s(fe),G=U(s(pe),4),me=s(G),he=s(me),ge=s(he);B(ge,1,F(S));var _e=U(ge,2);le(_e),B(_e,1,F(b)),I(he);var ye=U(he,2),be=s(ye);B(be,1,F(S));var xe=U(be,2);le(xe),B(xe,1,F(b)),I(ye);var Se=U(ye,2),Ce=s(Se);B(Ce,1,F(S));var we=U(Ce,2);le(we),B(we,1,F(b)),I(Se);var Te=U(Se,2),Ee=s(Te);B(Ee,1,F(S));var K=U(Ee,2);le(K),B(K,1,F(b)),I(Te);var q=U(Te,2),De=s(q);B(De,1,F(S));var Oe=U(De,2);le(Oe),B(Oe,1,F(b)),I(q);var ke=U(q,2),Ae=s(ke);B(Ae,1,F(S));var J=U(Ae,2);B(J,1,F(b));var je=s(J);je.value=je.__value=`one_time`;var Me=U(je);Me.value=Me.__value=`weekly`;var Ne=U(Me);Ne.value=Ne.__value=`monthly`;var Pe=U(Ne);Pe.value=Pe.__value=`yearly`,I(J),I(ke);var Fe=U(ke,2),Ie=s(Fe);B(Ie,1,F(S));var Le=U(Ie,2);B(Le,1,F(b));var Re=s(Le);Re.value=Re.__value=`listed`;var Be=U(Re);Be.value=Be.__value=`any`,I(Le),I(Fe);var Ve=U(Fe,2),Ue=s(Ve);B(Ue,1,F(S));var We=U(Ue,2);le(We),B(We,1,F(b)),I(Ve),I(me);var Y=U(me,2),Ge=e=>{var t=Eo(),n=s(t,!0);I(t),x(()=>a(n,o(L))),i(e,t)};y(Y,e=>{o(L)&&e(Ge)}),jr(U(Y,2),{type:`submit`,variant:`outline`,get disabled(){return o(P)},children:(e,t)=>{V();var n=te();x(()=>a(n,o(P)?`Setting up…`:`Set up mandate`)),i(e,n)},$$slots:{default:!0}}),I(G);var Ke=U(G,2),qe=e=>{var t=Do();To(s(t),{get approval(){return o(R)}}),I(t),i(e,t)};y(Ke,e=>{o(R)&&e(qe)}),I(pe);var Je=U(pe,2),Ye=U(s(Je),2),X=e=>{var t=Oo(),n=s(t,!0);I(t),x(()=>a(n,o(ie))),i(e,t)};y(Ye,e=>{o(ie)&&e(X)});var Xe=U(Ye,2),Ze=e=>{var t=Ao();v(t,20,()=>[0,1],e=>e,(e,t)=>{var n=ko();i(e,n)}),I(t),i(e,t)},Qe=e=>{var t=jo();i(e,t)},$e=t=>{var n=Fo();v(n,21,()=>o(ne),e=>e.pravaMandateId,(t,n)=>{let r=e(()=>o(H)===o(n).pravaMandateId),c=e(()=>o(r)?o(ae):null),l=e(()=>!!o(n).mandateId&&o(n).status===`active`),u=e(()=>!!o(n).mandateId&&o(n).status===`paused`);var d=Po(),f=s(d),m=s(f),h=s(m,!0);I(m);var g=U(m,2),_=s(g,!0);I(g),I(f);var b=U(f,2),S=s(b),C=U(S),w=e=>{var t=te();x(()=>a(t,`· ${o(n).remaining??``} remaining`)),i(e,t)};y(C,e=>{o(n).remaining!==void 0&&e(w)});var T=U(C,2),E=e=>{var t=te();x(()=>a(t,`· until ${o(n).validUntil??``}`)),i(e,t)};y(T,e=>{o(n).validUntil&&e(E)});var D=U(T,2),O=e=>{var t=te();x(()=>a(t,`· renews ${o(n).renewsAt??``}`)),i(e,t)};y(D,e=>{o(n).renewsAt&&e(O)}),I(b);var k=U(b,2),A=t=>{let r=e(()=>[o(l)?`pause`:`resume`,`cancel`]);var u=No();v(u,20,()=>o(r),e=>e,(e,t)=>{var r=Mo();B(r,1,F(`text-muted-foreground hover:text-foreground text-[12px] transition disabled:pointer-events-none disabled:opacity-40`));var l=s(r,!0);I(r),x(()=>{r.disabled=o(H)!==null,a(l,o(c)===t?oe[t].busy:oe[t].idle)}),p(`click`,r,()=>void ce(o(n),t)),i(e,r)}),I(u),i(t,u)};y(k,e=>{(o(l)||o(u))&&e(A)}),I(d),x(e=>{a(h,e),a(_,o(n).status),a(S,`${o(n).approvedAmount??``}
|
|
5
|
+
${o(n).currency??``} `)},[()=>o(n).description?.trim()||o(n).merchantName?.trim()||`Spending mandate`]),i(t,d)}),I(n),i(t,n)};y(Xe,e=>{o(re)&&o(ne).length===0?e(Ze):o(ne).length===0?e(Qe,1):e($e,-1)}),I(Je),I(fe),I(de),I(ue),x(()=>{_e.disabled=o(P)||o(M)===`any`,xe.disabled=o(P)||o(M)===`any`,we.disabled=o(P)||o(M)===`any`,K.disabled=o(P),Oe.disabled=o(P),J.disabled=o(P)||o(M)===`any`,Le.disabled=o(P),We.disabled=o(P)}),h(`submit`,G,se),A(_e,()=>o(w),e=>C(w,e)),A(xe,()=>o(T),e=>C(T,e)),A(we,()=>o(E),e=>C(E,e)),A(K,()=>o(D),e=>C(D,e)),A(Oe,()=>o(O),e=>C(O,e)),ee(J,()=>o(k),e=>C(k,e)),ee(Le,()=>o(M),e=>C(M,e)),A(We,()=>o(N),e=>C(N,e)),i(t,ue),j()}f([`click`]);var Ro=R(`<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 zo(e,t){z(t,!0);var n=Ro(),r=s(n),a=e=>{hr(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{Un(e,{class:`size-3.5`,"aria-hidden":`true`})};y(r,e=>{t.theme===`dark`?e(a):e(o,-1)}),I(n),x(()=>{M(n,`aria-label`,t.theme===`dark`?`Switch to light mode`:`Switch to dark mode`),M(n,`title`,t.theme===`dark`?`Light mode`:`Dark mode`)}),p(`click`,n,()=>t.onThemeChange(t.theme===`dark`?`light`:`dark`)),i(e,n),j()}f([`click`]);var Bo=R(`<button type="button"><!> <span class="truncate"> </span></button>`),Vo=R(`<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 Ho(e,t){z(t,!0);let n=[{id:`account`,label:`Account`,icon:yr},{id:`usage`,label:`Usage`,icon:Bt},{id:`browser`,label:`Agent's Browser`,icon:jn},{id:`payments`,label:`Payments`,icon:sn},{id:`archived`,label:`Archived Threads`,icon:kt}];var r=Vo(),c=s(r),l=s(c),u=s(l);At(s(u),{class:`size-3.5`,"aria-hidden":`true`}),V(),I(u),zo(U(u,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),I(l);var d=U(l,2);v(d,21,()=>n,e=>e.id,(e,n)=>{var r=Bo(),c=s(r);pe(c,()=>o(n).icon,(e,t)=>{t(e,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`})});var l=U(c,2),u=s(l,!0);I(l),I(r),x(()=>{B(r,1,`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-[13px] transition ${t.activePage===o(n).id?`bg-hover-fill-strong text-foreground`:`text-muted-foreground hover:bg-hover-fill hover:text-foreground`}`),M(r,`aria-current`,t.activePage===o(n).id?`page`:void 0),a(u,o(n).label)}),p(`click`,r,()=>{t.onNavigate(o(n).id)}),i(e,r)}),I(d),I(c),I(r),p(`click`,u,function(...e){t.onBack?.apply(this,e)}),i(e,r),j()}f([`click`]);var Uo=[{id:`modelUsage`,label:`Model usage`,noun:`model usage`,description:`More expensive models use up more usage.`}],Wo=[`weekly`,`monthly`],Go=R(`<p class="text-muted-foreground text-sm leading-6">Couldn’t load your usage right now. Try again in a moment.</p>`),Ko=R(`<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>`),qo=R(`<div class="space-y-5"><div class="bg-hover-fill h-3 w-28 rounded"></div> <!></div>`),Jo=R(`<div class="animate-pulse space-y-10" aria-hidden="true"><div class="bg-hover-fill h-4 w-24 rounded"></div> <!></div>`),Yo=R(`<p class="text-muted-foreground mt-1 text-[12px]"> </p>`),Xo=R(`<p> </p>`),Zo=R(`<p class="text-muted-foreground mt-1.5 text-[12px]"> </p>`),Qo=R(`<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>`),$o=R(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase"> </p> <!> <div class="mt-4 space-y-6"></div></div>`),es=R(`<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),ts=R(`<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 ns(t,n){z(n,!0);let r=ze(),d=Ue(ve.usage.getMyUsage,()=>r.isAuthenticated&&!r.isLoading?{}:`skip`),f=g(l(Date.now()));c(()=>{let e=setInterval(()=>{C(f,Date.now(),!0)},6e4);return()=>{clearInterval(e)}});let p=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),m={weekly:`Weekly`,monthly:`Monthly`};function h(e,t){return e?`bg-rose-400/90`:t?`bg-amber-400/90`:`bg-foreground/25`}var _=ts(),b=U(s(_),2),S=s(b),w=s(S),T=e=>{var t=Go();i(e,t)},E=e=>{var t=Jo(),n=U(s(t),2);v(n,17,()=>Uo,e=>e.id,(e,t)=>{var n=qo(),r=U(s(n),2);v(r,16,()=>Wo,e=>e,(e,t)=>{var n=Ko();i(e,n)}),I(n),i(e,n)}),I(t),i(e,t)},D=t=>{var n=es(),r=u(n),c=U(s(r),2),l=s(c,!0);I(c),I(r);var g=U(r,2);v(g,17,()=>d.data.meters,e=>e.id,(t,n)=>{var r=$o(),c=s(r),l=s(c,!0);I(c);var u=U(c,2),d=e=>{var t=Yo(),r=s(t,!0);I(t),x(()=>a(r,o(n).description)),i(e,t)};y(u,e=>{o(n).description&&e(d)});var g=U(u,2);v(g,21,()=>o(n).windows,e=>e.period,(t,r)=>{let c=e(()=>o(r).limit>0),l=e(()=>o(c)?Math.round(o(r).used/o(r).limit*100):0),u=e(()=>o(c)&&o(r).used>=o(r).limit),d=e(()=>o(c)&&o(r).used>=o(r).limit*.9);var g=Qo(),_=s(g),v=s(_),b=s(v,!0);I(v);var S=U(v,2),C=e=>{var t=Xo(),n=s(t);I(t),x(()=>{B(t,1,`text-[12px] ${o(u)?`text-destructive`:o(d)?`text-amber-800 dark:text-amber-300`:`text-muted-foreground`}`),a(n,`${o(l)??``}% used`)}),i(e,t)};y(S,e=>{o(c)&&e(C)}),I(_);var w=U(_,2),T=s(w);I(w);var E=U(w,2);M(E,`aria-valuemin`,0);var D=s(E);I(E);var O=U(E,2),k=e=>{var t=Zo(),n=s(t);I(t),x(e=>a(n,`Resets in ${e??``}`),[()=>qi(o(r).resetsAt-o(f))]),i(e,t)};y(O,e=>{o(r).resetsAt!==null&&e(k)}),I(g),x((e,t,i,s,u)=>{a(b,m[o(r).period]),a(T,`${e??``} / ${t??``}`),M(E,`aria-label`,`${o(n).label} — ${m[o(r).period]}`),M(E,`aria-valuemax`,o(c)?o(r).limit:0),M(E,`aria-valuenow`,i),M(E,`aria-valuetext`,o(c)?`${o(l)}% used`:`0 / 0`),B(D,1,s),ae(D,u)},[()=>p.format(o(c)?o(r).used:0),()=>p.format(o(c)?o(r).limit:0),()=>o(c)?Math.min(o(r).used,o(r).limit):0,()=>`h-full rounded-full transition-[width] duration-300 ${h(o(u),o(d))}`,()=>`width: ${o(c)?Math.min(100,Math.max(0,o(l))):0}%`]),i(t,g)}),I(g),I(r),x(()=>a(l,o(n).label)),i(t,r)}),x(()=>a(l,ka[d.data.tier])),i(t,n)};y(w,e=>{d.error?e(T):d.isLoading||d.data===void 0?e(E,1):e(D,-1)}),I(S),I(b),I(_),i(t,_),j()}function rs(e){return Object.prototype.toString.call(e)===`[object String]`&&!(e instanceof String)}function is(e){return Object.prototype.toString.call(e)===`[object Boolean]`&&!(e instanceof Boolean)}function as(e){return e!=null&&!Array.isArray(e)&&Object(e)===e}var os=Z.union(Z.string(),Z.number(),Z.boolean(),Z.null()),ss=8;function cs(e){return e===0?os:Z.union(os,Z.array(cs(e-1)),Z.record(Z.string(),cs(e-1)))}var ls=cs(ss);function us(e){if(!(!as(e)||!rs(e.error))&&(e.status===`cancelled`||e.status===`failed`))return{error:e.error,status:e.status}}function ds(e){let t=``,n,r=!1;for(let i of e)i.type===`text`&&i.text.length!==0&&(r&&n!==void 0&&i.turnId!==void 0&&i.turnId!==n&&(t+=`
|
|
6
|
+
|
|
7
|
+
`),t+=i.text,i.turnId!==void 0&&(n=i.turnId),r=!0);return t}function fs(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&&ps(e.input,t.payload)),a((e,t)=>e.name===t.kind),n}function ps(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)=>ps(e,t[n]));if(!as(e)||!as(t))return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&ps(e[n],t[n]))}function ms(e){return rs(e)?e:void 0}function hs(e){return is(e)?e:void 0}function gs(e,t){return as(e)?ms(e[t]):void 0}function _s(e,t){return e.runId===t}function vs(e){return e.name||e.job?.kind||`tool`}function ys(e){let t=[];for(let n of e){if(n.type===`text`||n.type===`reasoning`){t.push(n);continue}let e=vs(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 bs(e){return`${e.type}:${e.turnId??``}:${e.id}`}function xs(e){return e.type===`reasoning`?bs(e):e.tools[0]?.callId??e.toolKey}function Ss(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:xs(n),blocks:[n]})}return t}function Cs(e,t){let n,r=t.endedAt;for(let i of e.blocks){let e=i.type===`tool-group`?i.tools:[i];for(let i of e){if(i.startedAt==null)return{};if(n=Math.min(n??i.startedAt,i.startedAt),!t.inProgress){let e=i.completedAt??t.endedAt;if(e===void 0)return{};r=Math.max(r??e,e)}}}return t.inProgress?{startedAtMs:n}:{startedAtMs:n,completedAtMs:r}}function ws(e){return e.output===void 0?!e.job||e.job.status===`pending`||e.job.status===`claimed`:!1}function Ts(e,t){return t&&ws(e)}function Es(e){return gs(e.output,`sessionId`)??gs(e.input,`sessionId`)??gs(e.job?.payload,`sessionId`)}function Ds(e){let t=new Map;for(let n of e){let e=Es(n);if(!e)continue;let r=gs(n.output,`command`)??(vs(n)===`exec_command`?gs(n.input,`cmd`)??gs(n.job?.payload,`cmd`):void 0);r&&t.set(e,r)}return t}function Os(e,t){let n=Es(e);return gs(e.output,`command`)??(n?t.get(n):void 0)}function ks(e,t){if(!t)return new Set;let n=new Map,r=new Set;for(let t of e){let e=Es(t);if(!e)continue;vs(t)===`exec_command`&&r.add(e);let i=as(t.output)?hs(t.output.running):void 0;i!==void 0&&n.set(e,i)}return new Set([...r].filter(e=>n.get(e)===!0))}function As(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=vs(r),o=Es(r),s=o!==void 0&&n.has(o),c=Ts(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 js(e,t){return!t&&ws(e)?`interrupted`:e.job?.status===`cancelled`||e.job?.status===`failed`?e.job.status:us(e.output)?.status}function Ms(e,t){if(!t&&ws(e))return`The agent stopped before this tool call finished.`;let n=us(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 Ns(e,t){let n=new Map(e.filter(e=>e.type===`tool-result`).map(e=>[e.callId,e])),r=fs(e.filter(e=>e.type===`tool-call`),t.map(e=>({id:e._id,kind:e.kind,callId:e.callId,payload:e.payload}))),i=new Map;for(let e of t){let t=r.get(e._id);t&&i.set(t,e)}let a=[],o=new Set;for(let t of e){if(t.type===`tool-result`)continue;if(t.type===`reasoning`||t.type===`text`){t.text.trim().length>0&&a.push(t);continue}let e=n.get(t.callId),r=i.get(t.callId);r&&o.add(r._id);let s={type:`tool`,callId:t.callId,name:t.name,input:t.input,startedAt:t.startedAt??r?.enqueuedAt,completedAt:e?.completedAt??r?.completedAt};e?s.output=e.output:r?.result!==void 0&&(s.output=r.result),r&&(s.job=r),a.push(s)}for(let e of t){if(o.has(e._id))continue;let t={type:`tool`,callId:e.callId??`executor-job:${e._id}`,name:e.kind,input:e.payload,startedAt:e.enqueuedAt,completedAt:e.completedAt,job:e};e.result!==void 0&&(t.output=e.result),a.push(t)}return a}function Ps(e){return e.type===`reasoning`?[bs(e)]:e.tools.map(e=>`tool:${e.callId}`)}var Fs=class{messages=new Map;nextId=0;retain(e){let t=new Set(e);for(let e of this.messages.keys())t.has(e)||this.messages.delete(e)}reconcile(e,t){let n=this.reconcileMembers(e,t.map(e=>e.type===`text`?[bs(e)]:e.blocks.flatMap(Ps)));return t.map((e,t)=>({...e,renderKey:e.type===`text`?bs(e):n[t]}))}reconcileBlocks(e,t){let n=this.reconcileMembers(e,t.map(Ps));return t.map((e,t)=>({block:e,renderKey:n[t]}))}reconcileMembers(e,t){let n=this.messages.get(e),r=new Map,i=new Set,a=t.map(e=>{let t=e.map(e=>n?.get(e)).find(e=>e!==void 0&&!i.has(e))??`work:${this.nextId++}`;i.add(t);for(let n of e)r.set(n,t);return t});return this.messages.set(e,r),a}};function Is(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 Ls(e){if(Array.isArray(e))return e}function Rs(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 zs(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bs(e,t){return Ls(e)||Rs(e,t)||Vs(e,t)||zs()}function Vs(e,t){if(e){if(typeof e==`string`)return Is(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)?Is(e,t):void 0}}var Hs=Object.entries,Us=Object.setPrototypeOf,Ws=Object.isFrozen,Gs=Object.getPrototypeOf,Ks=Object.getOwnPropertyDescriptor,qs=Object.freeze,Js=Object.seal,Ys=Object.create,Xs=typeof Reflect<`u`&&Reflect,Zs=Xs.apply,Qs=Xs.construct;qs||=function(e){return e},Js||=function(e){return e},Zs||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Qs||=function(e){return new e(...[...arguments].slice(1))};var $s=yc(Array.prototype.forEach),ec=yc(Array.prototype.lastIndexOf),tc=yc(Array.prototype.pop),nc=yc(Array.prototype.push),rc=yc(Array.prototype.splice),ic=Array.isArray,ac=yc(String.prototype.toLowerCase),oc=yc(String.prototype.toString),sc=yc(String.prototype.match),cc=yc(String.prototype.replace),lc=yc(String.prototype.indexOf),uc=yc(String.prototype.trim),dc=yc(Number.prototype.toString),fc=yc(Boolean.prototype.toString),pc=typeof BigInt>`u`?null:yc(BigInt.prototype.toString),mc=typeof Symbol>`u`?null:yc(Symbol.prototype.toString),hc=yc(Object.prototype.hasOwnProperty),gc=yc(Object.prototype.toString),_c=yc(RegExp.prototype.test),vc=bc(TypeError);function yc(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Zs(e,t,n)}}function bc(e){return function(){return Qs(e,[...arguments])}}function xc(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ac;if(Us&&Us(e,null),!ic(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Ws(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Sc(e){for(let t=0;t<e.length;t++)hc(e,t)||(e[t]=null);return e}function Cc(e){let t=Ys(null);for(let r of Hs(e)){var n=Bs(r,2);let i=n[0],a=n[1];hc(e,i)&&(t[i]=ic(a)?Sc(a):a&&typeof a==`object`&&a.constructor===Object?Cc(a):a)}return t}function wc(e){switch(typeof e){case`string`:return e;case`number`:return dc(e);case`boolean`:return fc(e);case`bigint`:return pc?pc(e):`0`;case`symbol`:return mc?mc(e):`Symbol()`;case`undefined`:return gc(e);case`function`:case`object`:{if(e===null)return gc(e);let t=e,n=Tc(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:gc(e)}return gc(e)}default:return gc(e)}}function Tc(e,t){for(;e!==null;){let n=Ks(e,t);if(n){if(n.get)return yc(n.get);if(typeof n.value==`function`)return yc(n.value)}e=Gs(e)}function n(){return null}return n}function Ec(e){try{return _c(e,``),!0}catch{return!1}}var Dc=qs(`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(`.`)),Oc=qs(`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(`.`)),kc=qs([`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`]),Ac=qs([`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`]),jc=qs(`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(`.`)),Mc=qs([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Nc=qs([`#text`]),Pc=qs(`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(`.`)),Fc=qs(`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(`.`)),Ic=qs(`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(`.`)),Lc=qs([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Rc=Js(/{{[\w\W]*|^[\w\W]*}}/g),zc=Js(/<%[\w\W]*|^[\w\W]*%>/g),Bc=Js(/\${[\w\W]*/g),Vc=Js(/^data-[\-\w.\u00B7-\uFFFF]+$/),Hc=Js(/^aria-[\-\w]+$/),Uc=Js(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wc=Js(/^(?:\w+script|data):/i),Gc=Js(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Kc=Js(/^html$/i),qc=Js(/^[a-z][.\w]*(-[.\w]+)+$/i),Jc=Js(/<[/\w!]/g),Yc=Js(/<[/\w]/g),Xc=Js(/<\/no(script|embed|frames)/i),Zc=Js(/\/>/i),Qc={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$c=function(){return typeof window>`u`?null:window},el=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}},tl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},nl=function(e,t,n,r){return hc(e,t)&&ic(e[t])?xc(r.base?Cc(r.base):{},e[t],r.transform):n};function rl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$c(),t=e=>rl(e);if(t.version=`3.4.13`,t.removed=[],!e||!e.document||e.document.nodeType!==Qc.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=Tc(d,`cloneNode`),p=Tc(d,`remove`),m=Tc(d,`nextSibling`),h=Tc(d,`childNodes`),g=Tc(d,`parentNode`),_=Tc(d,`shadowRoot`),v=Tc(d,`attributes`),y=o&&o.prototype?Tc(o.prototype,`nodeType`):null,b=o&&o.prototype?Tc(o.prototype,`nodeName`):null,x=o&&o.prototype?Tc(o.prototype,`ownerDocument`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let S,C=``,w,T=!1,E=0,D=function(){if(E>0)throw vc(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},O=function(e){D(),E++;try{return S.createHTML(e)}finally{E--}},k=function(e){D(),E++;try{return S.createScriptURL(e)}finally{E--}},A=function(){return T||=(w=el(u,i),!0),w},j=n,M=j.implementation,N=j.createNodeIterator,ee=j.createDocumentFragment,P=j.getElementsByTagName,F=r.importNode,I=tl();t.isSupported=typeof Hs==`function`&&typeof g==`function`&&M&&M.createHTMLDocument!==void 0;let L=Rc,te=zc,R=Bc,ne=Vc,z=Hc,B=Wc,V=Gc,re=qc,ie=Uc,H=null,ae=xc({},[...Dc,...Oc,...kc,...jc,...Nc]),U=null,oe=xc({},[...Pc,...Fc,...Ic,...Lc]),W=Object.seal(Ys(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}})),se=null,ce=null,le=Object.seal(Ys(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ue=!0,de=!0,fe=!1,pe=!0,G=!1,me=!0,he=!1,ge=!1,_e=null,ve=null,ye=!1,be=!1,xe=!1,Se=!1,Ce=!0,we=!1,Te=`user-content-`,Ee=!0,K=!1,q={},De=null,Oe=xc({},`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(`.`)),ke=null,Ae=xc({},[`audio`,`video`,`img`,`source`,`image`,`track`]),J=null,je=xc({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Me=`http://www.w3.org/1998/Math/MathML`,Ne=`http://www.w3.org/2000/svg`,Pe=`http://www.w3.org/1999/xhtml`,Fe=Pe,Ie=!1,Le=null,Re=xc({},[Me,Ne,Pe],oc),ze=qs([`mi`,`mo`,`mn`,`ms`,`mtext`]),Be=xc({},ze),Ve=qs([`annotation-xml`]),He=xc({},Ve),Ue=xc({},[`title`,`style`,`font`,`a`,`script`]),We=null,Y=[`application/xhtml+xml`,`text/html`],Ge=null,Ke=null,qe=n.createElement(`form`),Je=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ke&&Ke===e)return;(!e||typeof e!=`object`)&&(e={}),e=Cc(e),We=Y.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Ge=We===`application/xhtml+xml`?oc:ac,H=nl(e,`ALLOWED_TAGS`,ae,{transform:Ge}),U=nl(e,`ALLOWED_ATTR`,oe,{transform:Ge}),Le=nl(e,`ALLOWED_NAMESPACES`,Re,{transform:oc}),J=nl(e,`ADD_URI_SAFE_ATTR`,je,{transform:Ge,base:je}),ke=nl(e,`ADD_DATA_URI_TAGS`,Ae,{transform:Ge,base:Ae}),De=nl(e,`FORBID_CONTENTS`,Oe,{transform:Ge}),se=nl(e,`FORBID_TAGS`,Cc({}),{transform:Ge}),ce=nl(e,`FORBID_ATTR`,Cc({}),{transform:Ge}),q=hc(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Cc(e.USE_PROFILES):e.USE_PROFILES:!1,ue=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,G=e.SAFE_FOR_TEMPLATES||!1,me=e.SAFE_FOR_XML!==!1,he=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,Ee=e.KEEP_CONTENT!==!1,K=e.IN_PLACE||!1,ie=Ec(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Uc,Fe=typeof e.NAMESPACE==`string`?e.NAMESPACE:Pe,Be=hc(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Cc(e.MATHML_TEXT_INTEGRATION_POINTS):xc({},ze),He=hc(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Cc(e.HTML_INTEGRATION_POINTS):xc({},Ve);let t=hc(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Cc(e.CUSTOM_ELEMENT_HANDLING):Ys(null);if(W=Ys(null),hc(t,`tagNameCheck`)&&Je(t.tagNameCheck)&&(W.tagNameCheck=t.tagNameCheck),hc(t,`attributeNameCheck`)&&Je(t.attributeNameCheck)&&(W.attributeNameCheck=t.attributeNameCheck),hc(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(W.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Js(W),G&&(de=!1),xe&&(be=!0),q&&(H=xc({},Nc),U=Ys(null),q.html===!0&&(xc(H,Dc),xc(U,Pc)),q.svg===!0&&(xc(H,Oc),xc(U,Fc),xc(U,Lc)),q.svgFilters===!0&&(xc(H,kc),xc(U,Fc),xc(U,Lc)),q.mathMl===!0&&(xc(H,jc),xc(U,Ic),xc(U,Lc))),le.tagCheck=null,le.attributeCheck=null,hc(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?le.tagCheck=e.ADD_TAGS:ic(e.ADD_TAGS)&&(H===ae&&(H=Cc(H)),xc(H,e.ADD_TAGS,Ge))),hc(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?le.attributeCheck=e.ADD_ATTR:ic(e.ADD_ATTR)&&(U===oe&&(U=Cc(U)),xc(U,e.ADD_ATTR,Ge))),hc(e,`ADD_URI_SAFE_ATTR`)&&ic(e.ADD_URI_SAFE_ATTR)&&xc(J,e.ADD_URI_SAFE_ATTR,Ge),hc(e,`FORBID_CONTENTS`)&&ic(e.FORBID_CONTENTS)&&(De===Oe&&(De=Cc(De)),xc(De,e.FORBID_CONTENTS,Ge)),hc(e,`ADD_FORBID_CONTENTS`)&&ic(e.ADD_FORBID_CONTENTS)&&(De===Oe&&(De=Cc(De)),xc(De,e.ADD_FORBID_CONTENTS,Ge)),Ee&&(H[`#text`]=!0),he&&xc(H,[`html`,`head`,`body`]),H.table&&(xc(H,[`tbody`]),delete se.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw vc(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw vc(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=S;S=e.TRUSTED_TYPES_POLICY;try{C=O(``)}catch(e){throw S=t,e}}else e.TRUSTED_TYPES_POLICY===null?(S=void 0,C=``):(S===void 0&&(S=A()),S&&typeof C==`string`&&(C=O(``)));qs&&qs(e),Ke=e},X=xc({},[...Oc,...kc,...Ac]),Xe=xc({},[...jc,...Mc]),Ze=function(e,t,n){return t.namespaceURI===Pe?e===`svg`:t.namespaceURI===Me?e===`svg`&&(n===`annotation-xml`||Be[n]):!!X[e]},Qe=function(e,t,n){return t.namespaceURI===Pe?e===`math`:t.namespaceURI===Ne?e===`math`&&He[n]:!!Xe[e]},$e=function(e,t,n){return t.namespaceURI===Ne&&!He[n]||t.namespaceURI===Me&&!Be[n]?!1:!Xe[e]&&(Ue[e]||!X[e])},et=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Fe,tagName:`template`});let n=ac(e.tagName),r=ac(t.tagName);return Le[e.namespaceURI]?e.namespaceURI===Ne?Ze(n,t,r):e.namespaceURI===Me?Qe(n,t,r):e.namespaceURI===Pe?$e(n,t,r):!!(We===`application/xhtml+xml`&&Le[e.namespaceURI]):!1},tt=function(e){nc(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw vc(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},nt=function(e){at(e);let t=h(e);if(t){let e=[];$s(t,t=>{nc(e,t)}),$s(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},rt=function(e,n){try{nc(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{nc(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`){if(be||xe)try{tt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},it=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||U[Ge(i)]))try{e.removeAttribute(i)}catch{}}},at=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===Qc.element&&it(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ot=function(e){if(!me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===Qc.processingInstruction||n===Qc.comment&&_c(Yc,e.data)){try{p(e)}catch{}continue}if(n===Qc.element){let t=e,n=Ge(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},st=function(e){let t=null,r=null;if(ye)e=`<remove></remove>`+e;else{let t=sc(e,/^[\r\n\t ]+/);r=t&&t[0]}We===`application/xhtml+xml`&&Fe===Pe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=S?O(e):e;if(Fe===Pe)try{t=new l().parseFromString(i,We)}catch{}if(!t||!t.documentElement){t=M.createDocument(Fe,`template`,null);try{t.documentElement.innerHTML=Ie?C:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Fe===Pe?P.call(t,he?`html`:`body`)[0]:he?t.documentElement:a},ct=function(e){let t=x?x(e):e.ownerDocument;return N.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},lt=function(e){return e=cc(e,L,` `),e=cc(e,te,` `),e=cc(e,R,` `),e},ut=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=N.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=lt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&$s(i,e=>{ft(e.content)&&ut(e.content)})},dt=function(e){let t=b?b(e):null;return typeof t!=`string`||Ge(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},ft=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===Qc.documentFragment}catch{return!1}},pt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function Z(e,n,r){e.length!==0&&$s(e,e=>{e.call(t,n,r,Ke)})}let mt=function(e,t){return!!(me&&e.hasChildNodes()&&!pt(e.firstElementChild)&&_c(Jc,e.textContent)&&_c(Jc,e.innerHTML)||me&&e.namespaceURI===Pe&&t===`style`&&pt(e.firstElementChild)||e.nodeType===Qc.processingInstruction||me&&e.nodeType===Qc.comment&&_c(Yc,e.data))},ht=function(e,t,n){if(!se[t]&&bt(t)&&(W.tagNameCheck instanceof RegExp&&_c(W.tagNameCheck,t)||W.tagNameCheck instanceof Function&&W.tagNameCheck(t)))return!1;if(Ee&&!De[t]){let t=g(e),r=h(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,m(e))}}}return tt(e),!0},gt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Cc(t):t},_t=function(e,n){if(Z(I.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return K&&at(e),!0;if(dt(e))return tt(e),!0;let r=Ge(b?b(e):e.nodeName);if(H=gt(I.uponSanitizeElement,H,ae,_e),Z(I.uponSanitizeElement,e,{tagName:r,allowedTags:H}),e!==n&&g(e)===null)return K&&at(e),!0;if(mt(e,r))return tt(e),!0;if(se[r]||!(le.tagCheck instanceof Function&&le.tagCheck(r))&&!H[r]){let t=ht(e,r,n);return t===!1&&Z(I.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===Qc.element&&!et(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&_c(Xc,e.innerHTML))return tt(e),!0;if(G&&e.nodeType===Qc.text){let n=lt(e.textContent);e.textContent!==n&&(nc(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Z(I.afterSanitizeElements,e,null),!1},vt=function(e,t,r){if(ce[t]||me&&t===`patchsrc`||me&&t===`for`&&e!==`label`&&e!==`output`||Ce&&(t===`id`||t===`name`)&&(r in n||r in qe))return!1;let i=U[t]||le.attributeCheck instanceof Function&&le.attributeCheck(t,e);if(!(de&&_c(ne,t))&&!(ue&&_c(z,t))){if(!i){if(!(bt(e)&&(W.tagNameCheck instanceof RegExp&&_c(W.tagNameCheck,e)||W.tagNameCheck instanceof Function&&W.tagNameCheck(e))&&(W.attributeNameCheck instanceof RegExp&&_c(W.attributeNameCheck,t)||W.attributeNameCheck instanceof Function&&W.attributeNameCheck(t,e))||t===`is`&&W.allowCustomizedBuiltInElements&&(W.tagNameCheck instanceof RegExp&&_c(W.tagNameCheck,r)||W.tagNameCheck instanceof Function&&W.tagNameCheck(r))))return!1}else if(!J[t]&&!_c(ie,cc(r,V,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&lc(r,`data:`)===0&&ke[e])&&!(fe&&!_c(B,cc(r,V,``)))&&r)return!1}return!0},yt=xc({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),bt=function(e){return!yt[ac(e)]&&_c(re,e)},xt=function(e,t,n,r){if(S&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return O(r);case`TrustedScriptURL`:return k(r)}return r},St=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),dt(e)?tt(e):tc(t.removed)}catch{rt(n,e)}},Ct=function(e){Z(I.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||dt(e))return;U=gt(I.uponSanitizeAttribute,U,oe,ve);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:U,forceKeepAttr:void 0},r=t.length,i=Ge(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Ge(o),u=c,d=o===`value`?u:uc(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Z(I.uponSanitizeAttribute,e,n),d=n.attrValue,we&&(l===`id`||l===`name`)&&lc(d,Te)!==0&&(rt(o,e),d=Te+d),me&&_c(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){rt(o,e);continue}if(l===`attributename`&&sc(d,`href`)){rt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){rt(o,e);continue}if(!pe&&_c(Zc,d)){rt(o,e);continue}if(G&&(d=lt(d)),!vt(i,l,d)){rt(o,e);continue}d=xt(i,l,s,d),d!==u&&St(e,o,s,d)}}Z(I.afterSanitizeAttributes,e,null)},wt=function(e){let t=null,n=ct(e);for(Z(I.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Z(I.uponSanitizeShadowNode,t,null),_t(t,e),Ct(t),ft(t.content)&&wt(t.content),(y?y(t):t.nodeType)===Qc.element){let e=_(t);ft(e)&&(Tt(e),wt(e))}Z(I.afterSanitizeShadowDOM,e,null)},Tt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){wt(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===Qc.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`&&Ge(e)===`template`){let e=n.content;ft(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);ft(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Ie=!e,Ie&&(e=`<!-->`),typeof e!=`string`&&!pt(e)&&(e=wc(e),typeof e!=`string`))throw vc(`dirty is not a string, aborting`);if(!t.isSupported)return e;ge?(H=_e,U=ve):Ye(n),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(H=Cc(H)),I.uponSanitizeAttribute.length>0&&(U=Cc(U)),t.removed=[];let c=K&&typeof e!=`string`&&pt(e);if(c){ot(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=Ge(t);if(!H[n]||se[n])throw nt(e),vc(`root node is forbidden and cannot be sanitized in-place`)}if(dt(e))throw nt(e),vc(`root node is clobbered and cannot be sanitized in-place`);try{Tt(e)}catch(t){throw nt(e),t}}else if(pt(e))i=st(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Qc.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Tt(a);else{if(!be&&!G&&!he&&e.indexOf(`<`)===-1)return S&&Se?O(e):e;if(i=st(e),!i)return be?null:Se?C:``}i&&ye&&tt(i.firstChild);let l=c?e:i;try{let e=ct(l);for(;o=e.nextNode();)_t(o,l),Ct(o),ft(o.content)&&wt(o.content)}catch(n){throw c&&(nt(e),$s(t.removed,e=>{e.element&&at(e.element)})),n}if(c)return $s(t.removed,e=>{e.element&&at(e.element)}),G&&ut(e),e;if(be){if(G&&ut(i),xe)for(s=ee.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(U.shadowroot||U.shadowrootmode)&&(s=F.call(r,s,!0)),s}let u=he?i.outerHTML:i.innerHTML;return he&&H[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&_c(Kc,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
9
|
+
`+u),G&&(u=lt(u)),S&&Se?O(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(e),ge=!0,_e=H,ve=U},t.clearConfig=function(){Ke=null,ge=!1,_e=null,ve=null,S=w,C=``},t.isValidAttribute=function(e,t,n){Ke||Ye({});let r=Ge(e),i=Ge(t);return vt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&hc(I,e)&&nc(I[e],t)},t.removeHook=function(e,t){if(hc(I,e)){if(t!==void 0){let n=ec(I[e],t);return n===-1?void 0:rc(I[e],n,1)[0]}return tc(I[e])}},t.removeHooks=function(e){hc(I,e)&&(I[e]=[])},t.removeAllHooks=function(){I=tl()},t}var il=rl(),al=il;il.sanitize.bind(il),il.isSupported,il.addHook.bind(il),il.removeHook.bind(il),il.removeHooks.bind(il),il.removeAllHooks.bind(il),il.setConfig.bind(il),il.clearConfig.bind(il),il.isValidAttribute.bind(il),il.version,il.removed;function ol(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var sl=ol();function cl(e){sl=e}var ll={exec:()=>null};function ul(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 dl(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(pl.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var fl=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),pl={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:ul(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ul(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:ul(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ul(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ul(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:ul(e=>RegExp(`^ {0,${e}}>`))},ml=/^(?:[ \t]*(?:\n|$))+/,hl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,gl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_l=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,vl=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yl=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,bl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,xl=dl(bl).replace(/bull/g,yl).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(),Sl=dl(bl).replace(/bull/g,yl).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(),Cl=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,wl=/^[^\n]+/,Tl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,El=dl(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Tl).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Dl=dl(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,yl).getRegex(),Ol=`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`,kl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Al=dl(`^ {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`,kl).replace(`tag`,Ol).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),jl=e=>dl(Cl).replace(`hr`,_l).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`,Ol).getRegex(),Ml=jl(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Nl=jl(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Pl={blockquote:dl(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Nl).getRegex(),code:hl,def:El,fences:gl,heading:vl,hr:_l,html:Al,lheading:xl,list:Dl,newline:ml,paragraph:Ml,table:ll,text:wl},Fl=dl(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,_l).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`,Ol).getRegex(),Il={...Pl,lheading:Sl,table:Fl,paragraph:dl(Cl).replace(`hr`,_l).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Fl).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`,Ol).getRegex()},Ll={...Pl,html:dl(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,kl).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:ll,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:dl(Cl).replace(`hr`,_l).replace(`heading`,` *#{1,6} *[^
|
|
10
|
+
]`).replace(`lheading`,xl).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Rl=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zl=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Bl=/^( {2,}|\\)\n(?!\s*$)/,Vl=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Hl=/[\p{P}\p{S}]/u,Ul=/[\s\p{P}\p{S}]/u,Wl=/[^\s\p{P}\p{S}]/u,Gl=dl(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Ul).getRegex(),Kl=/[\p{Pi}\p{Ps}"']/u,ql=/(?!~)[\p{P}\p{S}]/u,Jl=/(?!~)[\s\p{P}\p{S}]/u,Yl=/(?:[^\s\p{P}\p{S}]|~)/u,Xl=dl(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,fl?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Zl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ql=dl(Zl,`u`).replace(/punct/g,Hl).getRegex(),$l=dl(Zl,`u`).replace(/punct/g,ql).getRegex(),eu=dl(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Kl).replace(/punct/g,Hl).getRegex(),tu=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,nu=dl(tu,`gu`).replace(/notPunctSpace/g,Wl).replace(/punctSpace/g,Ul).replace(/punct/g,Hl).getRegex(),ru=dl(tu,`gu`).replace(/notPunctSpace/g,Yl).replace(/punctSpace/g,Jl).replace(/punct/g,ql).getRegex(),iu=dl(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Wl).replace(/punctSpace/g,Ul).replace(/punct/g,Hl).getRegex(),au=dl(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Wl).replace(/punctSpace/g,Ul).replace(/punct/g,Hl).getRegex(),ou=dl(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Wl).replace(/punctSpace/g,Ul).replace(/punct/g,Hl).getRegex(),su=dl(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Hl).getRegex(),cu=dl(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Wl).replace(/punctSpace/g,Ul).replace(/punct/g,Hl).getRegex(),lu=dl(/\\(punct)/,`gu`).replace(/punct/g,Hl).getRegex(),uu=dl(/^<(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(),du=dl(kl).replace(`(?:-->|$)`,`-->`).getRegex(),fu=dl(`^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`,du).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pu=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,mu=dl(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,pu).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),hu=dl(/^!?\[(label)\]\[(ref)\]/).replace(`label`,pu).replace(`ref`,Tl).getRegex(),gu=dl(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Tl).getRegex(),_u=dl(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,hu).replace(`nolink`,gu).getRegex(),vu=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,yu={_backpedal:ll,anyPunctuation:lu,autolink:uu,blockSkip:Xl,br:Bl,code:zl,del:ll,delLDelim:ll,delRDelim:ll,emStrongLDelim:Ql,emStrongRDelimAst:nu,emStrongRDelimUnd:au,escape:Rl,link:mu,nolink:gu,punctuation:Gl,reflink:hu,reflinkSearch:_u,tag:fu,text:Vl,url:ll},bu={...yu,emStrongLDelim:eu,emStrongRDelimAst:iu,emStrongRDelimUnd:ou,link:dl(/^!?\[(label)\]\((.*?)\)/).replace(`label`,pu).getRegex(),reflink:dl(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,pu).getRegex()},xu={...yu,emStrongRDelimAst:ru,emStrongLDelim:$l,delLDelim:su,delRDelim:cu,url:dl(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,vu).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:dl(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,vu).getRegex()},Su={...xu,br:dl(Bl).replace(`{2,}`,`*`).getRegex(),text:dl(xu.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Cu={normal:Pl,gfm:Il,pedantic:Ll},wu={normal:yu,gfm:xu,breaks:Su,pedantic:bu},Tu={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Eu=e=>Tu[e];function Du(e,t){if(t){if(pl.escapeTest.test(e))return e.replace(pl.escapeReplace,Eu)}else if(pl.escapeTestNoEncode.test(e))return e.replace(pl.escapeReplaceNoEncode,Eu);return e}function Ou(e){try{e=encodeURI(e).replace(pl.percentDecode,`%`)}catch{return null}return e}function ku(e,t){let n=e.replace(pl.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(pl.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(pl.slashPipe,`|`);return n}function Au(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 ju(e){let t=e.split(`
|
|
11
|
+
`),n=t.length-1;for(;n>=0&&pl.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
12
|
+
`)}function Mu(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 Nu(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 Pu(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 Fu(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
13
|
+
`).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(`
|
|
14
|
+
`)}var Iu=class{options;rules;lexer;constructor(e){this.options=e||sl}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]:ju(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=Fu(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=Au(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Au(t[0],`
|
|
15
|
+
`),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:Au(t[0],`
|
|
16
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Au(t[0],`
|
|
17
|
+
`).split(`
|
|
18
|
+
`),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(`
|
|
19
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
20
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
21
|
+
${s}`:s,r=r?`${r}
|
|
22
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
23
|
+
`),o=t.raw+`
|
|
24
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s,n=`${n}
|
|
25
|
+
${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
26
|
+
`+e.join(`
|
|
27
|
+
`),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(`
|
|
28
|
+
`);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=Nu(t[2].split(`
|
|
29
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
30
|
+
`,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+`
|
|
31
|
+
`,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(`
|
|
32
|
+
`,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+=`
|
|
33
|
+
`+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+=`
|
|
34
|
+
`+l}u=!l.trim(),r+=p+`
|
|
35
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=ju(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:Au(t[0],`
|
|
36
|
+
`),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=ku(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
37
|
+
`):[],a={type:`table`,raw:Au(t[0],`
|
|
38
|
+
`),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(ku(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:Au(t[0],`
|
|
39
|
+
`),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)===`
|
|
40
|
+
`?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=Au(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Mu(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)),Pu(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 Pu(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Lu=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||sl,this.options.tokenizer=this.options.tokenizer||new Iu,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:pl,block:Cu.normal,inline:wu.normal};this.options.pedantic?(t.block=Cu.pedantic,t.inline=wu.pedantic):this.options.gfm&&(t.block=Cu.gfm,t.inline=this.options.breaks?wu.breaks:wu.gfm),this.tokenizer.rules=t}static get rules(){return{block:Cu,inline:wu}}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(pl.carriageReturn,`
|
|
41
|
+
`),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(pl.tabCharGlobal,` `).replace(pl.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+=`
|
|
42
|
+
`: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(`
|
|
43
|
+
`)?``:`
|
|
44
|
+
`)+i.raw,n.text+=`
|
|
45
|
+
`+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(`
|
|
46
|
+
`)?``:`
|
|
47
|
+
`)+i.raw,n.text+=`
|
|
48
|
+
`+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(`
|
|
49
|
+
`)?``:`
|
|
50
|
+
`)+i.raw,r.text+=`
|
|
51
|
+
`+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(`
|
|
52
|
+
`)?``:`
|
|
53
|
+
`)+i.raw,n.text+=`
|
|
54
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Ru=class{options;parser;constructor(e){this.options=e||sl}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(pl.notSpaceStart)?.[0],i=e.replace(pl.endingNewline,``)+`
|
|
55
|
+
`;return r?`<pre><code class="language-`+Du(r)+`">`+(n?i:Du(i,!0))+`</code></pre>
|
|
56
|
+
`:`<pre><code>`+(n?i:Du(i,!0))+`</code></pre>
|
|
57
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
58
|
+
${this.parser.parse(e)}</blockquote>
|
|
59
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
60
|
+
`}hr(e){return`<hr>
|
|
61
|
+
`}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+`>
|
|
62
|
+
`+r+`</`+i+`>
|
|
63
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
64
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
65
|
+
`}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>
|
|
66
|
+
<thead>
|
|
67
|
+
`+t+`</thead>
|
|
68
|
+
`+r+`</table>
|
|
69
|
+
`}tablerow({text:e}){return`<tr>
|
|
70
|
+
${e}</tr>
|
|
71
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
72
|
+
`}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>${Du(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=Ou(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Du(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=Ou(e);if(i===null)return Du(n);e=i;let a=`<img src="${e}" alt="${Du(n)}"`;return t&&(a+=` title="${Du(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Du(e.text)}},zu=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}},Bu=class e{options;renderer;textRenderer;constructor(e){this.options=e||sl,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 zu}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Vu=class{options;block;constructor(e){this.options=e||sl}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?Lu.lex:Lu.lexInline}provideParser(e=this.block){return e?Bu.parse:Bu.parseInline}},Hu=new class{defaults=ol();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Bu;Renderer=Ru;TextRenderer=zu;Lexer=Lu;Tokenizer=Iu;Hooks=Vu;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 Iu(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 Vu;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Vu.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Vu.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Lu.lex(e,t??this.defaults)}parser(e,t){return Bu.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?Lu.lex:Lu.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?Bu.parse:Bu.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?Lu.lex:Lu.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?Bu.parse:Bu.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+=`
|
|
73
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Du(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Uu(e,t){return Hu.parse(e,t)}Uu.options=Uu.setOptions=function(e){return Hu.setOptions(e),Uu.defaults=Hu.defaults,cl(Uu.defaults),Uu},Uu.getDefaults=ol,Uu.defaults=sl;function Wu(...e){return Hu.use(...e),Uu.defaults=Hu.defaults,cl(Uu.defaults),Uu}Uu.use=Wu,Uu.walkTokens=function(e,t){return Hu.walkTokens(e,t)},Uu.parseInline=Hu.parseInline,Uu.Parser=Bu,Uu.parser=Bu.parse,Uu.Renderer=Ru,Uu.TextRenderer=zu,Uu.Lexer=Lu,Uu.lexer=Lu.lex,Uu.Tokenizer=Iu,Uu.Hooks=Vu,Uu.parse=Uu,Uu.options,Uu.setOptions,Uu.walkTokens,Uu.parseInline,Bu.parse,Lu.lex,Uu.setOptions({gfm:!0,breaks:!0});function Gu(e){let t=Uu.parse(e,{async:!1});return al.sanitize(t,{ADD_ATTR:[`target`,`rel`]})}var Ku=R(`<div></div>`);function qu(t,n){z(n,!0);let r=L(n,`className`,3,``),a=e(()=>Gu(n.content));var s=Ku();fe(s,()=>o(a),!0),I(s),x(e=>B(s,1,e),[()=>F(Y(`chat-markdown`,r()))]),i(t,s),j()}var Ju=R(`<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>`),Yu=R(`<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 Xu(t,n){z(n,!0);let r=g(null),l=g(!1),f=g(!1),h=g(!1),_=g(null),v=g(null),b=null,S=0;function w(e){switch(e){case`image/jpeg`:return`jpg`;case`image/png`:return`png`;case`image/gif`:return`gif`;case`image/webp`:return`webp`;default:return}}function T(e){let t=e.name.trim()||`image`,n=w(e.mediaType);if(!n)return t;let r=t.match(/\.([a-z0-9]{2,5})$/i);return r?(e.mediaType===`image/jpeg`?[`jpg`,`jpeg`]:[n]).includes(r[1].toLowerCase())?t:`${t.slice(0,-r[0].length)}.${n}`:`${t}.${n}`}c(()=>{if(S+=1,!n.image)return;C(l,!1),C(f,!1),C(h,!1),C(_,null),C(v,null);let e=document.activeElement instanceof HTMLElement?document.activeElement:null,t=!1;d().then(()=>{t||o(r)?.focus()});let i=document.body.style.overflow;document.body.style.overflow=`hidden`;function a(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n.onClose();return}if(e.key!==`Tab`||!o(r))return;let t=Array.from(o(r).querySelectorAll(`button:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`));if(t.length===0){e.preventDefault(),o(r).focus();return}let i=t[0],a=t[t.length-1],s=document.activeElement;e.shiftKey&&(s===o(r)||s===i||!o(r).contains(s))?(e.preventDefault(),a.focus()):!e.shiftKey&&(s===o(r)||s===a||!o(r).contains(s))&&(e.preventDefault(),i.focus())}return window.addEventListener(`keydown`,a,!0),()=>{t=!0,window.removeEventListener(`keydown`,a,!0),document.body.style.overflow=i,b!==null&&(window.clearTimeout(b),b=null),e?.isConnected&&e.focus()}});async function E(e){let t=await fetch(e.url);if(!t.ok)throw Error(`Fetch failed with status ${t.status}`);return t.blob()}async function D(e){if(e.type===`image/png`)return e;let t=await createImageBitmap(e);try{let e=document.createElement(`canvas`);e.width=t.width,e.height=t.height;let n=e.getContext(`2d`);if(!n)throw Error(`Canvas 2D context unavailable`);return n.drawImage(t,0,0),await new Promise((t,n)=>{e.toBlob(e=>e?t(e):n(Error(`PNG encoding failed`)),`image/png`)})}finally{t.close()}}async function O(e){if(o(f))return;let t=S;C(f,!0),C(_,null),C(v,null);try{if(!globalThis.ClipboardItem)throw Error(`Clipboard images unsupported`);let n=E(e).then(D);if(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),t!==S)return;C(l,!0),b!==null&&window.clearTimeout(b),b=window.setTimeout(()=>{C(l,!1),b=null},2e3)}catch{t===S&&(C(l,!1),C(_,`Could not copy the image to the clipboard.`))}finally{t===S&&C(f,!1)}}async function k(e){if(o(h))return;let t=S;C(h,!0),C(_,null),C(v,null);try{let n=await E(e);if(t!==S)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=T(e),document.body.append(i);try{i.click()}finally{i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e4)}}catch{t===S&&C(v,`Could not download the image.`)}finally{t===S&&C(h,!1)}}let A=`inline-flex size-9 items-center justify-center rounded-lg border border-white/15 bg-black/65 text-white shadow-lg backdrop-blur-sm transition hover:bg-black/80 focus-visible:ring-2 focus-visible:ring-white/50 focus-visible:outline-none aria-disabled:cursor-wait aria-disabled:opacity-60`;var N=m(),ee=u(N),P=t=>{let c=e(()=>n.image);var u=Yu(),d=s(u),m=s(d),g=U(m,2),b=s(g);B(b,1,F(A));var S=s(b),w=e=>{Ln(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},T=e=>{Ht(e,{class:`size-4`,"aria-hidden":`true`})},E=e=>{nn(e,{class:`size-4`,"aria-hidden":`true`})};y(S,e=>{o(f)?e(w):o(l)?e(T,1):e(E,-1)}),I(b);var D=U(b,2);B(D,1,F(A));var j=s(D),N=e=>{Ln(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},ee=e=>{ln(e,{class:`size-4`,"aria-hidden":`true`})};y(j,e=>{o(h)?e(N):e(ee,-1)}),I(D),I(g);var P=U(g,2),L=s(P,!0);I(P);var te=U(P,2),R=e=>{var t=Ju(),n=s(t,!0);I(t),x(()=>a(n,o(_)??o(v))),i(e,t)};y(te,e=>{(o(_)||o(v))&&e(R)}),I(d),W(d,e=>C(r,e),()=>o(r)),I(u),x(()=>{M(d,`aria-label`,`Image preview: ${o(c).name??``}`),M(m,`src`,o(c).url),M(m,`alt`,o(c).name),M(b,`aria-disabled`,o(f)),M(b,`aria-label`,o(f)?`Copying image`:o(l)?`Image copied`:`Copy image`),M(b,`title`,o(f)?`Copying image`:o(l)?`Image copied`:`Copy image`),M(D,`aria-disabled`,o(h)),M(D,`aria-label`,o(h)?`Downloading image`:`Download image`),M(D,`title`,o(h)?`Downloading image`:`Download image`),a(L,o(f)?`Copying image`:o(l)?`Image copied`:o(h)?`Downloading image`:``)}),p(`click`,u,e=>{e.target===e.currentTarget&&n.onClose()}),p(`click`,b,()=>void O(o(c))),p(`click`,D,()=>void k(o(c))),i(t,u)};y(ee,e=>{n.image&&e(P)}),i(t,N),j()}f([`click`]);var Zu=R(`<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>`),Qu=R(`<span class="border-hairline bg-hover-fill inline-flex size-14 animate-pulse rounded-xl border"></span>`),$u=R(`<span class="text-muted-foreground border-hairline bg-hover-fill inline-flex items-center rounded-xl border px-3 py-2 text-xs"> </span>`),ed=R(`<span role="status"><!> <span class="min-w-0 truncate"> </span></span>`),td=R(`<button type="button"><!> <span class="min-w-0 truncate"> </span></button>`);function nd(t,n){z(n,!0);let r=g(null),l=g(!1),d=g(!1),f=0,h=e(()=>o(r)??n.attachment.url),v=e(()=>$i(n.attachment.mediaType)),b=`border-border hover:border-border focus-visible:ring-ring/40 text-foreground inline-flex h-14 max-w-56 items-center gap-2 rounded-xl border px-3 py-2 text-xs transition focus-visible:ring-2 focus-visible:outline-none`;c(()=>{let e=o(r);return()=>{ra(e??void 0)}}),c(()=>{let e=n.attachment.storageId,t=n.attachment.mediaType,i=n.attachment.url;if(!ia({mediaType:t,url:i}))return;let a=_(()=>n.loadAttachment);if(!a)return;let o=!1;return C(l,!1),a(e).then(e=>{if(o){ra(e??void 0);return}C(r,e,!0),C(l,e==null)}).catch(()=>{o||C(l,!0)}),()=>{o=!0}}),c(()=>()=>{f+=1});async function S(){if(o(d))return;let e=o(h);if(e?.startsWith(`blob:`)){aa(e,n.attachment.name);return}if(!n.loadAttachment&&!e){C(l,!0);return}let t=f;C(d,!0),C(l,!1);try{let i=null;if(n.loadAttachment)i=await n.loadAttachment(n.attachment.storageId);else if(e){let t=await fetch(e);if(!t.ok)throw Error(`Download failed`);i=URL.createObjectURL(await t.blob())}if(t!==f){ra(i??void 0);return}if(!i){C(l,!0);return}C(r,i,!0),aa(i,n.attachment.name)}catch{t===f&&C(l,!0)}finally{t===f&&C(d,!1)}}var w=m(),T=u(w),E=e=>{var t=Zu(),r=s(t);I(t),x(()=>{M(t,`aria-label`,`View ${n.attachment.name??``}`),M(t,`title`,n.attachment.name),M(r,`src`,o(h))}),p(`click`,t,()=>{o(h)&&n.onOpen({url:o(h),name:n.attachment.name,mediaType:n.attachment.mediaType})}),i(e,t)},D=e=>{var t=Qu();x(()=>M(t,`aria-label`,`Loading ${n.attachment.name??``}`)),i(e,t)},O=e=>{var t=$u(),r=s(t);I(t),x(()=>a(r,`${n.attachment.name??``} (unavailable)`)),i(e,t)},k=e=>{var t=ed();B(t,1,`${b} pointer-events-none animate-pulse`);var r=s(t);xn(r,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`});var o=U(r,2),c=s(o,!0);I(o),I(t),x(()=>{M(t,`aria-label`,`Downloading ${n.attachment.name??``}`),a(c,n.attachment.name)}),i(e,t)},A=e=>{var t=td();B(t,1,`${b} cursor-pointer`);var r=s(t);xn(r,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`});var o=U(r,2),c=s(o);I(o),I(t),x(()=>{M(t,`aria-label`,`Retry download of ${n.attachment.name??``}`),M(t,`title`,n.attachment.name),a(c,`${n.attachment.name??``} (unavailable)`)}),p(`click`,t,()=>{S()}),i(e,t)},N=e=>{var t=td();B(t,1,`${b} cursor-pointer`);var r=s(t);xn(r,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`});var o=U(r,2),c=s(o,!0);I(o),I(t),x(()=>{M(t,`aria-label`,`Download ${n.attachment.name??``}`),M(t,`title`,n.attachment.name),a(c,n.attachment.name)}),p(`click`,t,()=>{S()}),i(e,t)},ee=e=>{var t=$u(),r=s(t);I(t),x(()=>a(r,`${n.attachment.name??``} (unavailable)`)),i(e,t)};y(T,e=>{o(h)&&o(v)?e(E):o(v)&&n.loadAttachment&&!o(l)?e(D,1):o(v)?e(O,2):o(d)?e(k,3):o(l)?e(A,4):n.loadAttachment||o(h)?e(N,5):e(ee,-1)}),i(t,w),j()}f([`click`]);function rd(t){let n=g(!1),r=g(!1);c(()=>{t()?C(r,!1):C(n,!1)});let i=e(()=>t()?!o(r):o(n));function a(){t()?C(r,!o(r)):C(n,!o(n))}return{get expanded(){return o(i)},toggle:a}}var id=R(`<div class="text-muted-foreground mt-1.5 text-[13px] leading-6 whitespace-pre-wrap"> </div>`),ad=R(`<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 od(t,n){z(n,!0);let r=rd(()=>n.inProgress),c=e(()=>n.inProgress?`Reasoning`:`Reasoned`);var l=ad(),u=s(l),d=s(u);It(d,{class:`size-3.5 shrink-0`,"aria-hidden":`true`});var f=U(d,2),m=s(f,!0);I(f);var h=U(f,2);{let t=e(()=>`size-3.5 shrink-0 transition-transform ${r.expanded?`rotate-90`:``}`);Kt(h,{get class(){return o(t)},"aria-hidden":`true`})}I(u);var g=U(u,2),_=e=>{var t=id(),r=s(t,!0);I(t),x(()=>a(r,n.text)),i(e,t)};y(g,e=>{r.expanded&&e(_)}),I(l),x(()=>{M(u,`aria-expanded`,r.expanded),a(m,o(c))}),p(`click`,u,function(...e){r.toggle?.apply(this,e)}),i(t,l),j()}f([`click`]);function sd(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function cd(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`add_artifact`:case`create_artifact`:return`Created Artifacts`;case`edit_artifact`:case`update_artifact`:return`Updated Artifacts`;case`list_artifacts`:return`Listed Artifacts`;case`save_artifact`:return`Saved Artifacts`;case`exec_command`:return`Ran Commands`;case`get_workspace_instructions`:return`Read Instructions`;case`mandate_charge`:return`Charged Card`;case`mandate_list`:return`Listed Mandates`;case`mandate_report`:return`Settled Charges`;case`mandate_setup`:return`Set Up Mandate`;case`mandate_status`:return`Checked Mandate`;case`read_skill`:return`Read Skill`;case`parse_file`:return`Parsed Files`;case`scrape_url`:return`Read URLs`;case`screenshot_url`:return`Captured Screenshots`;case`web_search`:return`Searched Web`;case`write_stdin`:return`Monitored Commands`;default:return sd(e)}}function ld(e){if(!as(e))return``;let t=[],n=ms(e.workdir);return n&&n.trim().length>0&&n!==`.`&&t.push(`cwd ${n}`),t.length>0?` (${t.join(`, `)})`:``}function ud(e,t){let n=as(t)?t:void 0;switch(e){case`apply_patch`:return yd(t)??`Patch`;case`ask_question`:return ms(n?.question)??`Question`;case`await_question`:return`Waiting for answer`;case`check_docs`:return ms(n?.query)??ms(n?.path)??`Docs`;case`add_artifact`:case`create_artifact`:case`edit_artifact`:case`save_artifact`:return _d(t);case`list_artifacts`:return`Artifacts`;case`exec_command`:{let e=ms(n?.cmd);return e?`${e}${ld(t)}`:`Command`}case`get_workspace_instructions`:return`Workspace instructions`;case`mandate_charge`:return pd(n);case`mandate_list`:return`Standing mandates`;case`mandate_report`:return n?.outcome===`approved`?`Charge approved`:`Charge declined`;case`mandate_setup`:return fd(n);case`mandate_status`:return`Mandate status`;case`read_skill`:{let e=ms(n?.name);return e?`$${e}`:`Skill`}case`scrape_url`:case`screenshot_url`:return ms(n?.url)??`URL`;case`parse_file`:return ms(n?.path)??ms(n?.url)??`File`;case`update_artifact`:return ms(n?.title)??`Updated artifact`;case`web_search`:return ms(n?.query)??`Web search`;case`write_stdin`:{let e=ms(n?.sessionId);return e?`Session ${e}`:`Command session`}default:return sd(e)}}function dd(e){return(e.job?.kind??e.name)===`apply_patch`?`whitespace-pre-wrap [overflow-wrap:anywhere]`:`truncate`}function fd(e){let t=ms(e?.merchantName)??`Any merchant`,n=ms(e?.amountCap),r=ms(e?.currency)??``,i=ms(e?.frequency)??``;return`${t}${n?` · ${n} ${r}`.trimEnd():``}${i&&i!==`one_time`?` ${i}`:``}`}function pd(e){let t=ms(e?.description)??`Charge`,n=ms(e?.amount),r=ms(e?.currency)??``;return n?`${t} · ${n} ${r}`.trimEnd():t}var md=[`*** Add File: `,`*** Copy File: `,`*** Delete File: `,`*** Update File: `],hd=[`*** Copy to: `,`*** Move to: `];function gd(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 _d(e,t){let n=as(e)?e:void 0,r=as(t)?t:void 0;return ms(n?.path)??ms(n?.localPath)??ms(r?.localPath)??ms(r?.path)??ms(r?.title)??ms(n?.title)??ms(n?.artifactId)??`Artifact`}function vd(e){let t=Array.isArray(e)?e:as(e)&&Array.isArray(e.artifacts)?e.artifacts:void 0;if(t===void 0)return`Artifacts`;let n=t.length;return n===1?`1 artifact`:`${n} artifacts`}function yd(e){let t=as(e)?ms(e.patch):void 0;if(!t)return null;let n=[];for(let e of t.split(`
|
|
74
|
+
`)){if(e.startsWith(`diff --git `)){let t=gd(e);t!==null&&n.push(t);continue}let t=md.find(t=>e.startsWith(t));if(t){n.push(e.slice(t.length).trim());continue}let r=hd.find(t=>e.startsWith(t));r&&n.length>0&&(n[n.length-1]=e.slice(r.length).trim())}let r=[...new Set(n)];return r.length>0?r.join(`
|
|
75
|
+
`):null}function bd(e){if(!as(e)||!Array.isArray(e.changes))return null;let t=e.changes.flatMap(e=>{if(!as(e))return[];let t=ms(e.path);return t?[t]:[]});return t.length===0?null:[...new Set(t)].join(`
|
|
76
|
+
`)}function xd(e){return e.job?.kind===`apply_patch`?bd(e.job.result)??yd(e.job.payload):e.name===`apply_patch`?yd(e.input):null}function Sd(e){return new Set(e.flatMap(e=>xd(e)?.split(`
|
|
77
|
+
`)??[])).size}function Cd(e,t){if(e===`web_search`&&as(t)&&Array.isArray(t.results)){let e=t.results.length;return` (${e} result${e===1?``:`s`})`}return``}function wd(e,t){let n=e.job?.kind??e.name;return n===`write_stdin`?Os(e,t)??ud(`write_stdin`,e.job?.payload??e.input):n===`list_artifacts`?vd(e.job?.result??e.output):n===`add_artifact`||n===`edit_artifact`||n===`save_artifact`||n===`create_artifact`?_d(e.job?.payload??e.input,e.job?.result??e.output):e.job?xd(e)||ud(e.job.kind,e.job.payload)+Cd(e.job.kind,e.job.result):ud(e.name,e.input)}function Td(e,t,n){let r=wd(e,n);if(Ts(e,t))return`${r} (running)`;let i=Ms(e,t);return i?`${r} (${i})`:r}function Ed(e){switch(e){case`apply_patch`:return yn;case`ask_question`:return Qt;case`await_question`:return Nn;case`check_docs`:return Pt;case`add_artifact`:case`create_artifact`:return _n;case`save_artifact`:return $n;case`exec_command`:return _r;case`get_workspace_instructions`:return tr;case`mandate_charge`:return Xt;case`mandate_list`:return Fn;case`mandate_report`:return xr;case`mandate_setup`:return sn;case`mandate_status`:return Fn;case`read_skill`:return Gn;case`scrape_url`:return jn;case`screenshot_url`:return Rt;case`edit_artifact`:case`list_artifacts`:case`update_artifact`:case`parse_file`:return xn;case`web_search`:return rr;case`write_stdin`:return dr;default:return Cr}}function Dd(e){return Ed(e.job?.kind??e.name)}var Od=R(`<div data-work-detail=""><!></div>`),kd=R(`<div class="text-muted-foreground mt-1.5 space-y-1.5 text-[13px] leading-6"></div>`),Ad=R(`<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 jd(t,n){z(n,!0);let r=L(n,`preserveExpansion`,3,!1),c=g(null),l=_(()=>n.defaultExpanded??n.tools.length<=2),u=e(()=>o(c)??(r()?l:n.defaultExpanded??n.tools.length<=2));function d(){C(c,!o(u))}var f=Ad(),m=s(f),h=s(m);{let t=e(()=>`size-3.5 shrink-0 ${n.iconClass??``}`);pe(h,()=>n.icon,(e,n)=>{n(e,{get class(){return o(t)},"aria-hidden":`true`})})}var b=U(h,2),S=s(b,!0);I(b);var w=U(b,2);{let t=e(()=>`size-3.5 shrink-0 transition-transform ${o(u)?`rotate-90`:``}`);Kt(w,{get class(){return o(t)},"aria-hidden":`true`})}I(m);var T=U(m,2),E=e=>{var t=kd();v(t,21,()=>n.tools,e=>e.callId,(e,t)=>{var r=Od(),a=s(r);k(a,()=>n.toolRow,()=>o(t)),I(r),i(e,r)}),I(t),i(e,t)};y(T,e=>{o(u)&&e(E)}),I(f),x(()=>{M(m,`aria-expanded`,o(u)),a(S,n.label)}),p(`click`,m,d),i(t,f),j()}f([`click`]);var Md=R(`<p class="flex min-w-0 items-start gap-1.5"><!> <span> </span></p>`),Nd=R(`<details class="min-w-0"><summary class="min-w-0 cursor-pointer text-left"><span> </span> <span> </span></summary> <p role="status"> </p></details>`),Pd=R(`<p> </p>`);function Fd(t,n){z(n,!0);let r=L(n,`toolKey`,3,``),c=L(n,`running`,3,!1),l=L(n,`preserveExpansion`,3,!1);{let d=(t,r=P)=>{let l=e(()=>wd(r(),n.commands));var d=m(),f=u(d),p=t=>{let n=e(()=>Dd(r()));var c=Md(),u=s(c);pe(u,()=>o(n),(e,t)=>{t(e,{class:`text-muted-foreground mt-1.5 size-3 shrink-0`,"aria-hidden":`true`})});var d=U(u,2),f=s(d,!0);I(d),I(c),x(e=>{M(c,`title`,`${o(l)} (running)`),B(d,1,e),a(f,o(l))},[()=>F(dd(r()))]),i(t,c)},h=t=>{let c=e(()=>Ms(r(),n.inProgress)),d=e(()=>js(r(),n.inProgress));var f=m(),p=u(f),h=t=>{let u=e(()=>o(d)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`);var f=Nd(),p=s(f),m=s(p),h=s(m,!0);I(m);var g=U(m,2),_=s(g);I(g),I(p);var v=U(p,2),y=s(v,!0);I(v),I(f),x((e,t)=>{M(p,`title`,e),B(m,1,t),a(h,o(l)),B(g,1,F(o(u))),a(_,`(${o(d)??``})`),B(v,1,`mt-1.5 text-xs leading-5 wrap-break-word whitespace-pre-wrap ${o(u)??``}`),a(y,o(c))},[()=>Td(r(),n.inProgress,n.commands),()=>F(dd(r()))]),i(t,f)},g=e=>{var t=Pd(),c=s(t,!0);I(t),x((e,n)=>{B(t,1,e),M(t,`title`,n),a(c,o(l))},[()=>`min-w-0 ${dd(r())}`,()=>Td(r(),n.inProgress,n.commands)]),i(e,t)};y(p,e=>{o(c)&&o(d)?e(h):e(g,-1)}),i(t,f)};y(f,e=>{c()?e(p):e(h,-1)}),i(t,d)},f=e(()=>c()?`Running`:cd(r())),p=e(()=>c()?Ln:Ed(r())),h=e(()=>c()?`animate-spin`:void 0),g=e(()=>c()?!0:r()===`apply_patch`?Sd(n.tools)<=2:void 0);jd(t,{get label(){return o(f)},get icon(){return o(p)},get iconClass(){return o(h)},get tools(){return n.tools},get preserveExpansion(){return l()},get defaultExpanded(){return o(g)},toolRow:d,$$slots:{toolRow:!0}})}j()}var Id=R(`<div class="mt-1.5 space-y-2"><!></div>`),Ld=R(`<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 Rd(t,n){z(n,!0);function r(){l.toggle()}let c=e(()=>xt(n.startedAtMs,n.inProgress?bt():n.completedAtMs)),l=rd(()=>n.inProgress),u=e(()=>`${n.inProgress?`Working`:`Worked`}${o(c)===void 0?``:` for ${Ki(o(c))}`}`);var d=Ld(),f=s(d),m=s(f),h=s(m,!0);I(m);var g=U(m,2);{let t=e(()=>`size-3.5 shrink-0 transition-transform ${l.expanded?`rotate-90`:``}`);Kt(g,{get class(){return o(t)},"aria-hidden":`true`})}I(f);var _=U(f,2),v=e=>{var t=Id(),r=s(t);k(r,()=>n.children),I(t),i(e,t)};y(_,e=>{l.expanded&&e(v)}),I(d),x(()=>{M(f,`aria-expanded`,l.expanded),a(h,o(u))}),p(`click`,f,r),i(t,d),j()}f([`click`]);function zd(e){return e.type===`tool-call`||e.type===`tool-result`?`${e.type}:${e.callId}`:`${e.type}:${e.turnId??``}:${e.id}`}var Bd=class{load;changed;commit;parts=[];previousBefore;nextAfter;loading=!1;indexing=!1;stale=!1;error=!1;start;initialized=!1;stopped=!1;refreshPending=!1;failedDirection;request;retry;constructor(e,t,n,r){this.load=t,this.changed=n,this.commit=r,this.start=e?{latest:!0}:{}}stop(){this.stopped=!0,this.request?.abort(),clearTimeout(this.retry)}refresh(){if(this.loading){this.refreshPending=!0;return}return this.fetch()}more(e){if(!(!this.initialized||this.loading||this.error||this.indexing)&&(e===`older`?this.previousBefore:this.nextAfter)!==void 0)return this.fetch(e)}retryFailed(){if(!this.loading)return this.fetch(this.failedDirection)}async fetch(e){if(this.stopped)return;clearTimeout(this.retry);let t=new AbortController;this.request=t,this.loading=!0,this.indexing=!1,this.error=!1,this.failedDirection=e,this.changed();try{let n=e===`older`?{before:this.previousBefore}:e===`newer`?{after:this.nextAfter}:this.start,r=this.parts.length?zd(this.parts[this.parts.length-1]):void 0,i=[];for(;;){let a=await this.load(n,t.signal);if(t.signal.aborted)return;if(a.indexing||a.stale&&!a.parts.length||i.length&&a.revision<i[i.length-1].revision){this.stale=a.stale,this.indexing=!0,this.retry=setTimeout(()=>void this.fetch(e),500);return}if(n.after!==void 0&&a.nextAfter!==void 0&&a.nextAfter<=n.after||n.before!==void 0&&a.previousBefore!==void 0&&a.previousBefore>=n.before)throw Error(`Work detail cursor did not advance.`);if(i.push(a),e||!r||a.parts.some(e=>zd(e)===r)||a.nextAfter===void 0||this.nextAfter!==void 0&&a.nextAfter>=this.nextAfter)break;if(i.length>this.parts.length)throw Error(`Work detail range changed too much.`);n={after:a.nextAfter}}let a=i[0],o=i[i.length-1],s=i.flatMap(e=>e.parts);await this.commit(()=>{if(t.signal.aborted)return;let n=e===`older`?[...s,...this.parts]:e===`newer`?[...this.parts,...s]:s,r=new Map(s.map(e=>[zd(e),e]));this.parts=[...new Map(n.map(e=>[zd(e),r.get(zd(e))??e])).values()],e!==`newer`&&(this.previousBefore=a.previousBefore,this.start=a.previousBefore===void 0?{}:{after:a.previousBefore-1}),e!==`older`&&(this.nextAfter=o.nextAfter),this.initialized=!0,this.stale=i.some(e=>e.stale),this.changed()},e),!this.stopped&&this.stale&&(this.retry=setTimeout(()=>void this.refresh(),2e3))}catch{t.signal.aborted||(this.error=!0)}finally{this.loading=!1,this.stopped||(this.changed(),this.refreshPending&&(this.refreshPending=!1,this.refresh()))}}},Vd=R(`<p class="text-xs">Scroll up for earlier work.</p>`),Hd=R(`<p role="status">Showing saved details while reconnecting.</p>`),Ud=R(`<div data-work-detail=""><!></div>`),Wd=R(`<p role="status">Could not load these details. <button class="underline">Retry</button></p>`),Gd=R(`<p role="status">Loading details...</p>`),Kd=R(`<p class="text-xs">Scroll down for more work.</p>`),qd=R(`<div><div data-work-edge="older" class="h-px" aria-hidden="true"></div> <!> <!> <div class="space-y-2"><!> <!></div> <!> <div data-work-edge="newer" class="h-px" aria-hidden="true"></div></div>`);function Jd(t,n){z(n,!0);let r=g(0),a=g(void 0),l=g(void 0),u=0,f=2,m=`newer`,h=new Bd(_(()=>n.inProgress),(e,t)=>n.load(n.row,e,t),()=>{C(r,o(r)+1)},async(e,t)=>{let r=n.beforeChange(n.inProgress&&t!==`older`);e(),await d(),r(),u=n.viewport?.scrollTop??0}),b=e(()=>(o(r),{parts:h.parts,loading:h.loading,indexing:h.indexing,error:h.error,stale:h.stale,previousBefore:h.previousBefore,nextAfter:h.nextAfter})),S=e(()=>Ns(o(b).parts,[])),w=e(()=>o(S).filter(e=>e.type===`tool`)),T=e(()=>ys(o(S)).filter(e=>e.type!==`text`)),E=e(()=>As(o(T),n.inProgress,ks(o(w),n.inProgress))),D=e(()=>Ds(o(w))),O=new Fs,k=e(()=>O.reconcileBlocks(n.row.id,o(E).settledBlocks));function A(){if(!n.viewport||n.viewport.clientHeight<=0||f<=0||h.loading||h.error||h.indexing)return;let e=o(m===`older`?a:l),t=m===`older`?h.previousBefore:h.nextAfter;if(!e||t===void 0)return;let r=n.viewport.getBoundingClientRect(),i=e.getBoundingClientRect();i.bottom<r.top-160||i.top>r.bottom+160||(--f,h.more(m))}c(()=>{n.row.revision,n.inProgress&&m===`newer`&&(f=2),_(()=>void h.refresh())}),c(()=>()=>h.stop()),c(()=>{o(r),_(A)}),c(()=>{let e=n.viewport;if(!e||!o(a)||!o(l))return;u=e.scrollTop;function t(e){m=e,f=2,A()}function r(){if(!e||e.scrollTop===u)return;let n=e.scrollTop<u?`older`:`newer`;u=e.scrollTop,t(n)}function i(e){e.deltaY&&t(e.deltaY<0?`older`:`newer`)}function s(e){e.target instanceof Element&&e.target.closest(`input, textarea, button, [contenteditable="true"]`)||(([`ArrowUp`,`PageUp`,`Home`].includes(e.key)||e.key===` `&&e.shiftKey)&&t(`older`),([`ArrowDown`,`PageDown`,`End`].includes(e.key)||e.key===` `&&!e.shiftKey)&&t(`newer`))}let c;function d(e){let n=e.touches[0]?.clientY;e.type===`touchmove`&&n!==void 0&&c!==void 0&&n!==c&&t(n>c?`older`:`newer`),c=n}let p=globalThis.IntersectionObserver?new IntersectionObserver(A,{root:e,rootMargin:`160px 0px`}):void 0;return p?.observe(o(a)),p?.observe(o(l)),e.addEventListener(`scroll`,r),e.addEventListener(`wheel`,i,{passive:!0}),e.addEventListener(`keydown`,s),e.addEventListener(`touchstart`,d,{passive:!0}),e.addEventListener(`touchmove`,d,{passive:!0}),()=>{p?.disconnect(),e.removeEventListener(`scroll`,r),e.removeEventListener(`wheel`,i),e.removeEventListener(`keydown`,s),e.removeEventListener(`touchstart`,d),e.removeEventListener(`touchmove`,d)}});var N=qd(),ee=s(N);W(ee,e=>C(a,e),()=>o(a));var P=U(ee,2),F=e=>{var t=Vd();i(e,t)};y(P,e=>{o(b).previousBefore!==void 0&&e(F)});var L=U(P,2),te=e=>{var t=Hd();i(e,t)};y(L,e=>{o(b).stale&&e(te)});var R=U(L,2),ne=s(R);v(ne,17,()=>o(k),({block:e,renderKey:t})=>t,(e,t)=>{let r=()=>o(t).block;var a=Ud(),c=s(a),l=e=>{od(e,{get text(){return r().text},inProgress:!1})},u=e=>{Fd(e,{get tools(){return r().tools},get toolKey(){return r().toolKey},preserveExpansion:!0,get inProgress(){return n.inProgress},get commands(){return o(D)}})};y(c,e=>{r().type===`reasoning`?e(l):r().type===`tool-group`&&e(u,1)}),I(a),i(e,a)});var B=U(ne,2),V=e=>{var t=Ud();Fd(s(t),{get tools(){return o(E).runningTools},running:!0,get inProgress(){return n.inProgress},get commands(){return o(D)}}),I(t),i(e,t)};y(B,e=>{o(E).runningTools.length&&e(V)}),I(R);var re=U(R,2),ie=e=>{var t=Wd(),n=U(s(t));I(t),p(`click`,n,()=>{f=2,h.retryFailed()}),i(e,t)},H=e=>{var t=Gd();i(e,t)},ae=e=>{var t=Kd();i(e,t)};y(re,e=>{o(b).error?e(ie):o(b).loading||o(b).indexing?e(H,1):o(b).nextAfter!==void 0&&e(ae,2)});var oe=U(re,2);W(oe,e=>C(l,e),()=>o(l)),I(N),x(()=>M(N,`aria-busy`,o(b).loading||o(b).indexing)),i(t,N),j()}f([`click`]);function Yd(e){if((e.job?.kind??e.name)!==`mandate_setup`)return;let t=e.output;if(!as(t))return;let n=ms(t.mandateId),r=ms(t.approvalUrl);if(!(!n||!r))return{mandateId:n,approvalUrl:r}}function Xd(e){let t=e.job?.payload??e.input;if(!as(t))return;let n=ms(t.description)?.trim();if(n)return n;let r=ms(t.merchantName)?.trim();if(r)return r}function Zd(e){return e.flatMap(e=>{let t=Yd(e);return t?[{...t,label:Xd(e)}]:[]})}var Qd=R(`<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>`),$d=R(`<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>`),ef=R(`<div role="status" class="mb-6 rounded-2xl border border-amber-500/25 bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200">Showing a local copy while Sprocket reconnects to history.</div>`),tf=R(`<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>`),nf=R(`<li><!></li>`),rf=R(`<ul class="flex max-w-132 flex-wrap justify-end gap-2" aria-label="Attached files"></ul>`),af=R(`<div><!></div>`),of=R(`<button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex size-6 items-center justify-center rounded-md transition"><!></button>`),sf=R(`<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>`),cf=R(`<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>`),lf=R(`<div class="flex flex-col items-end gap-1.5"><!> <!> <!> <!></div>`),uf=R(`<div data-message-kind="work" class="svelte-rveqwn"><!></div>`),df=R(`<div data-message-kind="text" class="svelte-rveqwn"><!></div>`),ff=R(`<div class="space-y-3"><!> <!> <!></div>`),pf=R(`<p class="text-muted-foreground text-sm"> </p>`),mf=R(`<div class="w-full min-w-0" aria-atomic="false" aria-relevant="additions text"><div class="space-y-3"><!> <!> <!></div></div>`),hf=R(`<div class="transcript-messages space-y-8 pb-14 svelte-rveqwn"></div>`),gf=R(`<div class="relative min-h-0 flex-1"><div class="hide-scrollbar h-full overflow-x-hidden overflow-y-auto" role="region" aria-label="Conversation history" tabindex="0"><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 _f(t,n){z(n,!0);let r=L(n,`remoteChangeNotice`,3,null),l=L(n,`emptyStateMessage`,19,()=>n.project?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`),f=L(n,`stale`,3,!1),S=L(n,`loadingOlder`,3,!1),w=e(()=>n.messages.find(e=>e.kind===`prompt`)?.id),T=g(null),E=g(null),D=g(!0),O=0,k,A=2,N;function ee(){let e=o(T);if(!e||e.scrollTop===O)return;let t=Math.max(0,e.scrollHeight-e.clientHeight),n=e.scrollTop<O,r=O>t&&Math.abs(e.scrollTop-t)<1;if(O=e.scrollTop,r)return;let i=t-e.scrollTop;C(D,!n&&i<=28,!0),n&&P()}function P(){C(D,!1);let e=o(T);e&&n.nextBefore!==void 0&&!S()&&e.clientHeight>0&&e.scrollTop<=e.clientHeight&&n.onLoadOlder?.()}function te(){let e=o(T);e&&n.nextBefore!==void 0&&n.nextBefore!==N&&!S()&&n.onLoadOlder&&A>0&&e.clientHeight>0&&e.scrollHeight<=e.clientHeight+28&&(--A,N=n.nextBefore,n.onLoadOlder())}c(()=>{n.messages,n.nextBefore,S(),o(T),_(te)});function R(e){e.target instanceof Element&&e.target.closest(`input, textarea, button, [contenteditable="true"]`)||(e.key===`ArrowUp`||e.key===`PageUp`||e.key===`Home`||e.key===` `&&e.shiftKey)&&P()}function ne(e){return e.type===`tool-group`&&(e.toolKey===`add_artifact`||e.toolKey===`list_artifacts`||e.toolKey===`edit_artifact`||e.toolKey===`create_artifact`||e.toolKey===`update_artifact`)}function re(e){return!ne(e)}let ie=new Fs;b(()=>ie.retain(n.messages.filter(e=>e.kind===`live`).map(e=>e.id)));let H=g(null),ae=g(null),oe=null;async function se(e,t){try{await navigator.clipboard.writeText(t),C(ae,e,!0),oe!==null&&clearTimeout(oe),oe=setTimeout(()=>{o(ae)===e&&C(ae,null),oe=null},1500)}catch{C(ae,null)}}c(()=>()=>{oe!==null&&clearTimeout(oe)});function ce(){let e=o(T);if(!e||!o(D))return;let t=Math.max(0,e.scrollHeight-e.clientHeight);if(e.scrollTop+1<Math.min(O,t)){C(D,!1);return}le(e,t)}function le(e,t){e.scrollTop!==t&&(e.scrollTop=t),O=e.scrollTop}function ue(e){let t=[...e.querySelectorAll(`[data-transcript-anchor], [data-work-detail]`)].filter(e=>!e.querySelector(`[data-work-detail]`)),n=e.getBoundingClientRect().top,r=0,i=t.length;for(;r<i;){let e=Math.floor((r+i)/2);t[e].getBoundingClientRect().bottom<=n?r=e+1:i=e}return t[r]}function de(e){e||C(D,!1);let t=o(T),n=t&&!o(D)?ue(t):void 0,r=n?.getBoundingClientRect().top,i=t?.scrollTop;return()=>{!t||t!==o(T)||(o(D)?ce():n?.isConnected&&r!==void 0&&t.scrollTop===i&&le(t,t.scrollTop+n.getBoundingClientRect().top-r))}}b(()=>{n.messages,n.actions,o(T),_(()=>{let e=o(T);if(!e)return;let t=o(D)?void 0:ue(e),n=t?.getBoundingClientRect().top,r=e.scrollTop,i=e.scrollHeight;d().then(()=>{e===o(T)&&(o(D)?ce():t?.isConnected&&n!==void 0&&e.scrollTop===r?le(e,r+t.getBoundingClientRect().top-n):t&&!t.isConnected&&e.scrollTop===r&&le(e,r+e.scrollHeight-i))})})}),c(()=>{let e=o(T),t=o(E);if(!e||!t||!globalThis.ResizeObserver)return;let n=new ResizeObserver(()=>{ce(),te()});return n.observe(e),n.observe(t),()=>{n.disconnect()}});var fe=gf(),pe=u(fe),G=s(pe),me=s(G),he=s(me),ge=e=>{var t=Qd(),r=s(t,!0);I(t),x(()=>a(r,n.currentError)),i(e,t)};y(he,e=>{n.currentError&&e(ge)});var _e=U(he,2),ve=e=>{var t=$d(),r=s(t,!0);I(t),x(()=>a(r,n.runError)),i(e,t)};y(_e,e=>{n.runError&&e(ve)});var ye=U(_e,2),be=e=>{var t=ef();i(e,t)};y(ye,e=>{f()&&e(be)});var xe=U(ye,2),Se=e=>{var t=m(),n=u(t),r=e=>{var t=tf(),n=s(t),r=s(n),o=s(r,!0);I(r),I(n),I(t),x(()=>a(o,l())),i(e,t)};y(n,e=>{l()&&e(r)}),i(e,t)},Ce=t=>{var c=hf();v(c,21,()=>n.messages,e=>e.id,(t,c)=>{var l=m(),d=u(l),f=t=>{var l=lf(),u=s(l),d=t=>{var r=rf();v(r,21,()=>o(c).attachments??[],e=>e.storageId,(t,r)=>{var a=nf(),c=s(a);{let t=e(()=>({...o(r),url:null}));nd(c,{get attachment(){return o(t)},get loadAttachment(){return n.loadAttachment},onOpen:e=>{C(H,e,!0)}})}I(a),i(t,a)}),I(r),i(t,r)};y(u,e=>{(o(c).attachments??[]).length&&e(d)});var f=U(u,2),m=t=>{var n=af();B(n,1,F(`user-bubble w-fit max-w-[33rem] rounded-xl border px-5 py-3.5 text-[15.5px] leading-7 text-foreground`));var r=s(n);{let t=e(()=>o(c).text||` `);qu(r,{get content(){return o(t)},className:`text-foreground`})}I(n),i(t,n)};y(f,e=>{(o(c).text||!(o(c).attachments??[]).length)&&e(m)});var h=U(f,2),g=e=>{var t=of(),n=s(t),r=e=>{Ht(e,{class:`size-3.5`,"aria-hidden":`true`})},a=e=>{nn(e,{class:`size-3.5`,"aria-hidden":`true`})};y(n,e=>{o(ae)===o(c).id?e(r):e(a,-1)}),I(t),x(()=>M(t,`aria-label`,o(ae)===o(c).id?`Copied`:`Copy message`)),p(`click`,t,()=>{se(o(c).id,o(c).text??``)}),i(e,t)};y(h,e=>{o(c).text&&e(g)});var _=U(h,2),b=e=>{var t=cf(),o=s(t),c=s(o),l=s(c,!0);I(c);var u=U(c,2),d=e=>{var t=sf();p(`click`,t,function(...e){n.onDismissRemoteChangeNotice?.apply(this,e)}),i(e,t)};y(u,e=>{n.onDismissRemoteChangeNotice&&e(d)}),I(o),I(t),x(()=>a(l,r())),i(e,t)};y(_,e=>{r()&&o(c).id===o(w)&&e(b)}),I(l),x(()=>{M(l,`data-message-id`,o(c).id),M(l,`data-transcript-anchor`,o(c).id)}),i(t,l)},h=t=>{let r=e(()=>o(c)),a=e(()=>o(r).runId===n.activeRunId&&(!o(r).closed||o(r).pendingTools>0));var l=uf();Rd(s(l),{get inProgress(){return o(a)},get startedAtMs(){return o(r).startedAt},get completedAtMs(){return o(r).completedAt},children:(e,t)=>{var s=m(),c=u(s),l=e=>{Jd(e,{get row(){return o(r)},get load(){return n.loadSectionDetails},get inProgress(){return o(a)},get viewport(){return o(T)},beforeChange:de})};y(c,e=>{n.loadSectionDetails&&e(l)}),i(e,s)},$$slots:{default:!0}}),I(l),x(()=>{M(l,`data-message-id`,o(c).id),M(l,`data-transcript-anchor`,o(c).id)}),i(t,l)},g=t=>{let n=e(()=>o(c));var r=m(),a=u(r),l=t=>{var r=af(),a=s(r);{let t=e(()=>({mandateId:o(n).mandateId,approvalUrl:o(n).approvalUrl}));To(a,{get approval(){return o(t)}})}I(r),x(()=>M(r,`data-transcript-anchor`,o(c).id)),i(t,r)};y(a,e=>{o(n).mandateId&&o(n).approvalUrl&&e(l)}),i(t,r)},_=t=>{var n=df(),r=s(n);{let t=e(()=>o(c).text||` `);qu(r,{get content(){return o(t)},className:`text-foreground`})}I(n),x(()=>{M(n,`data-message-id`,o(c).id),M(n,`data-transcript-anchor`,o(c).id)}),i(t,n)},b=t=>{let r=e(()=>n.actions.filter(e=>e.runId===o(c).runId&&o(c).parts.some(t=>t.type===`tool-call`&&t.callId===e.callId))),l=e(()=>Ns(o(c).parts,o(r))),d=e(()=>o(l).filter(e=>e.type===`tool`)),f=e(()=>Ds(o(d))),p=e(()=>ys(o(l))),h=e(()=>ie.reconcile(o(c).id,Ss(o(p)))),g=e(()=>_s(o(c),n.activeRunId)),_=e(()=>ks(o(d),o(g))),b=e(()=>o(l).some(e=>e.type===`text`||e.type===`reasoning`));var S=mf(),C=s(S),w=s(C),T=t=>{{let n=e(()=>o(c).text||`...`);qu(t,{get content(){return o(n)},className:`text-foreground`})}};y(w,e=>{!o(b)&&(o(c).text||o(g)&&o(l).length===0)&&e(T)});var E=U(w,2);v(E,19,()=>o(h),e=>e.renderKey,(t,n,r)=>{var a=m(),l=u(a),d=t=>{var r=af(),a=s(r);{let t=e(()=>o(n).text||` `);qu(a,{get content(){return o(t)},className:`text-foreground`})}I(r),x(e=>M(r,`data-transcript-anchor`,e),[()=>`${o(c).id}:${bs(o(n))}`]),i(t,r)},p=t=>{let a=e(()=>{let{settledBlocks:e,runningTools:t}=As(o(n).blocks,o(g),o(_));return{settledBlocks:e,runningTools:t}}),l=e(()=>o(a).settledBlocks.filter(re)),d=e(()=>o(l).flatMap(e=>e.type===`tool-group`?Zd(e.tools):[])),p=e(()=>o(g)&&(o(r)===o(h).length-1||o(a).runningTools.length>0)),b=e(()=>o(h)[o(r)+1]),S=e(()=>Cs(o(n),{inProgress:o(p),endedAt:o(b)?.type===`text`?o(b).startedAt??void 0:void 0}));var C=m(),w=u(C),T=t=>{var r=ff(),h=s(r);Rd(h,{get inProgress(){return o(p)},get startedAtMs(){return o(S).startedAtMs},get completedAtMs(){return o(S).completedAtMs},children:(t,n)=>{var r=m(),s=u(r);v(s,19,()=>o(l),(e,t)=>`${e.type}-${e.type===`tool-group`?e.tools.map(e=>e.callId).join(`,`):e.id}-${t}`,(t,n,r)=>{var s=m(),c=u(s),d=t=>{let i=e(()=>o(p)&&o(a).runningTools.length===0&&o(r)===o(l).length-1);od(t,{get text(){return o(n).text},get inProgress(){return o(i)}})},h=e=>{Fd(e,{get tools(){return o(n).tools},get toolKey(){return o(n).toolKey},get inProgress(){return o(g)},get commands(){return o(f)}})};y(c,e=>{o(n).type===`reasoning`?e(d):e(h,-1)}),i(t,s)}),i(t,r)},$$slots:{default:!0}});var _=U(h,2);v(_,17,()=>o(d),e=>e.mandateId,(e,t)=>{To(e,{get approval(){return o(t)}})});var b=U(_,2),C=e=>{Fd(e,{get tools(){return o(a).runningTools},running:!0,get inProgress(){return o(g)},get commands(){return o(f)}})};y(b,e=>{o(a).runningTools.length>0&&e(C)}),I(r),x(()=>M(r,`data-transcript-anchor`,`${o(c).id}:${o(n).renderKey}`)),i(t,r)};y(w,e=>{(o(l).length>0||o(p)||o(a).runningTools.length>0)&&e(T)}),i(t,C)};y(l,e=>{o(n).type===`text`?e(d):e(p,-1)}),i(t,a)});var D=U(E,2),O=e=>{var t=pf(),n=s(t);I(t),x(e=>a(n,`Worked for ${e??``}`),[()=>Ki(Math.max(0,Math.floor((o(c).runCompletedAt-o(c).runStartedAt)/1e3)))]),i(e,t)};y(D,e=>{!o(g)&&o(c).runStartedAt>0&&o(c).runCompletedAt!==void 0&&e(O)}),I(C),I(S),x(()=>{M(S,`data-message-id`,o(c).id),M(S,`role`,o(g)?`log`:void 0),M(S,`aria-live`,o(g)?`polite`:void 0)}),i(t,S)};y(d,e=>{o(c).kind===`prompt`?e(f):o(c).kind===`work`?e(h,1):o(c).kind===`approval`?e(g,2):o(c).kind===`text`?e(_,3):o(c).kind===`live`&&e(b,4)}),i(t,l)}),I(c),i(t,c)};y(xe,e=>{n.messages.length===0?e(Se):e(Ce,-1)}),I(me),W(me,e=>C(E,e),()=>o(E)),I(G),W(G,e=>C(T,e),()=>o(T)),V(2),I(pe),Xu(U(pe,2),{get image(){return o(H)},onClose:()=>{C(H,null)}}),h(`scroll`,G,ee),h(`wheel`,G,e=>{e.deltaY<0&&P()}),p(`keydown`,G,R),p(`touchstart`,G,e=>{k=e.touches[0]?.clientY},void 0,!0),p(`touchmove`,G,e=>{let t=e.touches[0]?.clientY;t!==void 0&&k!==void 0&&t>k&&P(),k=t},void 0,!0),i(t,fe),j()}f([`keydown`,`touchstart`,`touchmove`,`click`]),ke([`markdown`,`html`,`react`]);function vf(e){return e.replace(/<\/(script)/gi,`<\\/$1`).replace(/<!--/g,`<\\!--`)}function yf(e,t){return`<!DOCTYPE html>
|
|
78
|
+
<html lang="en">
|
|
79
|
+
<head>
|
|
80
|
+
<meta charset="utf-8" />
|
|
81
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
82
|
+
${e}</head>
|
|
83
|
+
<body>
|
|
84
|
+
${t}
|
|
85
|
+
</body>
|
|
86
|
+
</html>`}function bf(e){return yf(`<style>
|
|
87
|
+
html, body, #root { margin: 0; min-height: 100%; }
|
|
88
|
+
body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; }
|
|
89
|
+
#artifact-error { margin: 16px; padding: 12px; border: 1px solid #f87171; border-radius: 8px; color: #b91c1c; font: 13px/1.5 ui-monospace, monospace; white-space: pre-wrap; }
|
|
90
|
+
</style>
|
|
91
|
+
<script src="https://unpkg.com/@babel/standalone@7.26.5/babel.min.js"><\/script>
|
|
92
|
+
<script>
|
|
93
|
+
window.addEventListener('error', (event) => {
|
|
94
|
+
const root = document.getElementById('root');
|
|
95
|
+
if (!root || root.hasChildNodes()) return;
|
|
96
|
+
const el = document.createElement('div');
|
|
97
|
+
el.id = 'artifact-error';
|
|
98
|
+
el.textContent = 'Artifact failed to render: ' + (event.message || 'unknown error');
|
|
99
|
+
root.appendChild(el);
|
|
100
|
+
});
|
|
101
|
+
<\/script>
|
|
102
|
+
`,`<div id="root"></div>
|
|
103
|
+
<script type="module">
|
|
104
|
+
import * as React from "https://esm.sh/react@19.1.0";
|
|
105
|
+
import { createRoot } from "https://esm.sh/react-dom@19.1.0/client";
|
|
106
|
+
window.React = React;
|
|
107
|
+
window.createRoot = createRoot;
|
|
108
|
+
window.exports = {};
|
|
109
|
+
window.require = (name) => {
|
|
110
|
+
if (name === 'react') return React;
|
|
111
|
+
if (name === 'react-dom' || name === 'react-dom/client') return { createRoot };
|
|
112
|
+
if (name === 'react/jsx-runtime')
|
|
113
|
+
return { jsx: React.createElement, jsxs: React.createElement, Fragment: React.Fragment };
|
|
114
|
+
throw new Error('Artifact previews cannot import "' + name + '"');
|
|
115
|
+
};
|
|
116
|
+
<\/script>
|
|
117
|
+
<script type="text/babel" data-presets="react" data-plugins="transform-modules-commonjs">
|
|
118
|
+
${vf(e.trim())}
|
|
119
|
+
|
|
120
|
+
const __root = document.getElementById('root');
|
|
121
|
+
const __App = typeof App !== 'undefined' ? App : exports.default;
|
|
122
|
+
if (!__App) {
|
|
123
|
+
__root.textContent = 'React artifact must define a function/component named App.';
|
|
124
|
+
} else {
|
|
125
|
+
window.createRoot(__root).render(window.React.createElement(__App));
|
|
126
|
+
}
|
|
127
|
+
<\/script>`)}function xf(e){let t=e.trim();return/^<!DOCTYPE html>/i.test(t)||/^<html[\s>]/i.test(t)?t:yf(``,t)}function Sf(e,t){return e===`react`?bf(t):e===`html`?xf(t):null}var Cf=R(`<iframe sandbox="allow-scripts"></iframe>`),wf=R(`<pre class="h-full overflow-auto p-3 pr-10 text-[13px] leading-6"><code> </code></pre>`),Tf=R(`<div class="h-full overflow-auto p-3 pr-10"><!></div>`),Ef=R(`<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>`),Df=R(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Back to artifacts"><!></button>`),Of=R(`<span class="text-muted-foreground shrink-0 text-[11px]"> </span>`),kf=R(`<span class="text-muted-foreground min-w-0 truncate text-[11px]"> </span>`),Af=R(`<!> Preview`,1),jf=R(`<!> Source`,1),Mf=R(`<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>`),Nf=R(`<button type="button" class="text-muted-foreground hover:text-foreground shrink-0 transition" aria-label="Open fullscreen" title="Open fullscreen"><!></button>`),Pf=R(`<p role="alert" class="px-3 pb-2 text-[11px] text-amber-800 dark:text-amber-200"> </p>`),Ff=R(`<div><div class="flex items-center gap-2 px-3 py-2"><!> <div class="flex min-w-0 flex-1 flex-col gap-0.5"><div class="flex min-w-0 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> <!> <!></div>`);function If(t,n){z(n,!0);let r=L(n,`variant`,3,`card`),l=e(()=>Sf(n.artifactType,n.content)),d=g(!1),f=g(!1),m=null;async function h(){try{await navigator.clipboard.writeText(n.content),C(f,!0),m!==null&&clearTimeout(m),m=setTimeout(()=>{C(f,!1),m=null},1500)}catch{C(f,!1)}}c(()=>()=>{m!==null&&clearTimeout(m)});var _=Ff();{let e=(e,t=P)=>{var r=Ef(),c=s(r),u=e=>{var r=Cf();x(()=>{M(r,`title`,`${n.title} preview`),M(r,`srcdoc`,o(l)),B(r,1,`block w-full bg-white ${t()}`)}),i(e,r)},m=e=>{var t=wf(),r=s(t),o=s(r,!0);I(r),I(t),x(()=>a(o,n.content)),i(e,t)},g=e=>{var t=Tf();qu(s(t),{get content(){return n.content},className:`text-sm text-foreground`}),I(t),i(e,t)};y(c,e=>{o(l)&&!o(d)?e(u):o(l)?e(m,1):e(g,-1)});var _=U(c,2),v=s(_),b=e=>{Ht(e,{class:`size-3.5`,"aria-hidden":`true`})},S=e=>{nn(e,{class:`size-3.5`,"aria-hidden":`true`})};y(v,e=>{o(f)?e(b):e(S,-1)}),I(_),I(r),x(()=>M(_,`aria-label`,o(f)?`Copied`:`Copy`)),p(`click`,_,h),i(e,r)};var v=s(_),b=s(v),S=e=>{var t=Df();At(s(t),{class:`size-4`,"aria-hidden":`true`}),I(t),p(`click`,t,function(...e){n.onBack?.apply(this,e)}),i(e,t)};y(b,e=>{n.onBack&&e(S)});var w=U(b,2),T=s(w),E=s(T),D=s(E,!0);I(E);var O=U(E,2),k=s(O,!0);I(O);var A=U(O,2),N=e=>{var t=Of(),r=s(t,!0);I(t),x(()=>a(r,n.scope===`project`?`Project`:`Thread`)),i(e,t)};y(A,e=>{n.scope&&e(N)}),I(T);var ee=U(T,2),te=e=>{var t=kf(),r=s(t,!0);I(t),x(()=>a(r,n.localPath)),i(e,t)};y(ee,e=>{n.localPath&&e(te)}),I(w);var R=U(w,2),ne=e=>{var t=Mf(),n=s(t),r=e=>{var t=Af();hn(u(t),{class:`size-3.5`,"aria-hidden":`true`}),V(),i(e,t)},a=e=>{var t=jf();en(u(t),{class:`size-3.5`,"aria-hidden":`true`}),V(),i(e,t)};y(n,e=>{o(d)?e(r):e(a,-1)}),I(t),x(()=>M(t,`aria-label`,o(d)?`Show preview`:`Show source`)),p(`click`,t,()=>C(d,!o(d))),i(e,t)};y(R,e=>{o(l)&&e(ne)});var re=U(R,2),ie=e=>{var t=Nf();kn(s(t),{class:`size-4`,"aria-hidden":`true`}),I(t),p(`click`,t,function(...e){n.onOpenFullscreen?.apply(this,e)}),i(e,t)};y(re,e=>{n.onOpenFullscreen&&e(ie)}),I(v);var H=U(v,2),ae=e=>{var t=Pf(),r=s(t,!0);I(t),x(()=>a(r,n.localError)),i(e,t)};y(H,e=>{n.localError&&e(ae)});var oe=U(H,2),W=t=>{e(t,()=>`h-full`)},se=t=>{e(t,()=>`h-64`)};y(oe,e=>{r()===`full`?e(W):e(se,-1)}),I(_),x(()=>{a(D,n.title),a(k,n.artifactType)})}x(()=>B(_,1,F(r()===`full`?`bg-card flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border`:`bg-card rounded-lg border`))),i(t,_),j()}f([`click`]);var Lf=R(`<span class="relative inline-flex size-2 rounded-full bg-amber-500"></span>`),Rf=R(`<span class="absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500 opacity-60"></span> <span class="relative inline-flex size-2 rounded-full bg-emerald-500"></span>`,1),zf=R(`<span class="bg-muted-foreground/40 relative inline-flex size-2 rounded-full"></span>`),Bf=R(`<p class="text-muted-foreground text-[10px]"> </p>`),Vf=R(`<button type="button" class="text-foreground hover:bg-muted rounded-md px-2 py-0.5 text-xs font-medium transition disabled:pointer-events-none disabled:opacity-50"><!></button>`),Hf=R(`<a target="_blank" rel="noopener noreferrer" class="text-muted-foreground hover:text-foreground rounded-md p-1 transition" aria-label="Open watch-only live view in a new tab" title="Open watch-only live view in a new tab"><!></a>`),Uf=R(`<p class="text-destructive border-b px-3 py-1.5 text-xs" role="alert"> </p>`),Wf=R(`<iframe class="min-h-0 w-full flex-1 border-0" allow="clipboard-read; clipboard-write"></iframe>`),Gf=R(`<div class="flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-6 text-center"><!> <p class="text-muted-foreground text-sm">Starting the live view…</p> <p class="text-muted-foreground text-xs">The agent is browsing in the meantime.</p></div>`),Kf=R(`<div class="flex flex-wrap items-center gap-x-2 gap-y-1 border-b px-3 py-1.5"><span class="relative flex size-2 shrink-0" aria-hidden="true"><!></span> <div class="min-w-0 flex-1"><span role="status" class="text-muted-foreground text-xs"> </span> <!></div> <!> <!> <button type="button" class="flex size-7 shrink-0 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 browser session" title="Stop browser session"><!></button></div> <!> <!>`,1),qf=R(`<div class="flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-6 text-center"><!> <p class="text-muted-foreground text-sm" role="status"> </p></div>`),Jf=R(`<div class="flex min-h-0 flex-1 items-center justify-center"><!></div>`),Yf=R(`<div class="flex min-h-0 flex-1 flex-col"><!></div>`);function Xf(t,n){z(n,!0);let r=Ve(ve.browserProfiles.setHumanControl),l=Ve(ve.browserSessions.stop),d=g(null),f=g(null),h=e(()=>n.liveView?.threadId),_=e(()=>n.liveView?.id),v=e(()=>n.liveView?.providerSessionId??null),b=e(()=>n.liveView?.humanControl===!0),S=e(()=>n.liveView?.url??null),w=e(()=>n.liveView?.interactiveUrl??null),T=e(()=>o(b)&&o(w)!==null),E=e(()=>o(T)?o(w):o(S)),D=e(()=>n.liveView?.ended===!0),O=e(()=>o(h)!=null),k=e(()=>o(d)!==null||o(D)||o(w)==null&&!o(b)),A=e(()=>n.liveView==null?null:F(n.liveView.expiresAt)),N=e(()=>{let e=[];return o(A)&&e.push(o(A)),o(b)&&!o(T)&&e.push(`Waiting for the interactive view`),e.join(` · `)||null}),ee=e(()=>o(b)?`You have control`:n.active?`The agent is browsing`:`Browser session`);c(()=>{o(_),o(v),C(f,null)});function P(e,t){return e instanceof Error&&Wa(e)||t}function F(e){return`Closes by ${new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}`}async function L(e){if(o(h)==null||o(k))return;let t=o(_),n=o(v);C(d,`control`),C(f,null);try{await r({threadId:o(h),enabled:e})}catch(r){o(_)===t&&o(v)===n&&C(f,P(r,e?`Couldn’t take control.`:`Couldn’t give control back.`),!0)}finally{C(d,null)}}async function R(){if(o(_)==null||o(D)||o(d)!==null)return;let e=o(_),t=o(v);C(d,`stop`),C(f,null);try{await l({id:e,providerSessionId:t})}catch(n){o(_)===e&&o(v)===t&&C(f,P(n,`Couldn’t stop the browser session.`),!0)}finally{C(d,null)}}var ne=Yf(),B=s(ne),re=e=>{var t=Kf(),r=u(t),c=s(r),l=s(c),h=e=>{var t=Lf();i(e,t)},g=e=>{var t=Rf();V(2),i(e,t)},_=e=>{var t=zf();i(e,t)};y(l,e=>{o(b)?e(h):n.active?e(g,1):e(_,-1)}),I(c);var v=U(c,2),C=s(v),w=s(C,!0);I(C);var D=U(C,2),A=e=>{var t=Bf(),n=s(t,!0);I(t),x(()=>a(n,o(N))),i(e,t)};y(D,e=>{o(N)&&e(A)}),I(v);var j=U(v,2),P=e=>{var t=Vf(),n=s(t),r=e=>{var t=te();x(()=>a(t,o(b)?`Giving control back…`:`Taking control…`)),i(e,t)},c=e=>{var t=te(`Give control back`);i(e,t)},l=e=>{var t=te(`Take control`);i(e,t)};y(n,e=>{o(d)===`control`?e(r):o(b)?e(c,1):e(l,-1)}),I(t),x(()=>{t.disabled=o(k),M(t,`aria-busy`,o(d)===`control`)}),p(`click`,t,()=>{L(!o(b))}),i(e,t)};y(j,e=>{o(O)&&e(P)});var F=U(j,2),ne=e=>{var t=Hf();pn(s(t),{class:`size-3.5`,"aria-hidden":`true`}),I(t),x(()=>M(t,`href`,o(S))),i(e,t)};y(F,e=>{o(S)&&e(ne)});var z=U(F,2),B=s(z),re=e=>{Ln(e,{class:`size-3.5 animate-spin`,"aria-hidden":`true`})},ie=e=>{pr(e,{class:`size-3 fill-current`,"aria-hidden":`true`})};y(B,e=>{o(d)===`stop`?e(re):e(ie,-1)}),I(z),I(r);var H=U(r,2),ae=e=>{var t=Uf(),n=s(t,!0);I(t),x(()=>a(n,o(f))),i(e,t)};y(H,e=>{o(f)&&e(ae)});var oe=U(H,2),W=e=>{var t=m(),n=u(t);de(n,()=>o(E),e=>{var t=Wf();x(()=>{M(t,`src`,o(E)),M(t,`title`,o(T)?`Agent browser (interactive)`:`Agent browser`)}),i(e,t)}),i(e,t)},se=e=>{var t=Gf();Ln(s(t),{class:`text-muted-foreground size-5 animate-spin`,"aria-hidden":`true`}),V(4),I(t),i(e,t)};y(oe,e=>{o(E)?e(W):e(se,-1)}),x(()=>{a(w,o(ee)),M(z,`aria-busy`,o(d)===`stop`),z.disabled=o(d)!==null}),p(`click`,z,()=>{R()}),i(e,t)},ie=e=>{var t=qf(),n=s(t);jn(n,{class:`text-muted-foreground size-5`,"aria-hidden":`true`});var r=U(n,2),c=s(r);I(r),I(t),x(()=>a(c,`${o(D)?`Browser session ended.`:`No active browser session.`}
|
|
128
|
+
When the agent browses again, a new session will appear here.`)),i(e,t)},H=e=>{var t=Jf();Ln(s(t),{class:`text-muted-foreground size-5 animate-spin`,"aria-hidden":`true`}),I(t),i(e,t)};y(B,e=>{n.liveView&&!o(D)?e(re):o(D)||n.liveView===null?e(ie,1):e(H,-1)}),I(ne),i(t,ne),j()}f([`click`]);var Zf=R(`<span class="size-1.5 animate-pulse rounded-full bg-emerald-500" aria-hidden="true"></span>`),Qf=R(`<button type="button" role="tab" aria-controls="side-panel-tabpanel"><span class="inline-flex items-center gap-1.5"><!> </span></button>`),$f=R(`<p role="alert" class="text-xs text-amber-800 dark:text-amber-200"> </p>`),ep=R(`<p role="status" class="text-muted-foreground text-xs">Showing last known artifacts while Sprocket reconnects.</p>`),tp=R(`<div class="space-y-1 border-b px-3 py-2"><!> <!></div>`),np=R(`<div class="flex min-h-0 flex-1 flex-col p-3"><!></div>`),rp=R(`<span class="text-[11px] text-amber-800 dark:text-amber-200"> </span>`),ip=R(`<div class="group hover:bg-muted focus-within:bg-muted flex items-center gap-2 rounded-md px-2 py-1.5"><button type="button" class="flex min-w-0 flex-1 items-center gap-2 text-left"><!> <span class="flex min-w-0 flex-1 flex-col"><span class="flex min-w-0 items-center gap-2"><span class="text-foreground min-w-0 truncate text-sm"> </span> <span class="text-muted-foreground shrink-0 text-[11px]"> </span></span> <span class="text-muted-foreground min-w-0 truncate text-[11px]"> </span> <!></span></button> <button type="button" class="text-muted-foreground hover:text-foreground shrink-0 opacity-0 transition group-focus-within:opacity-100 group-hover:opacity-100 focus:opacity-100" title="Open fullscreen"><!></button></div>`),ap=R(`<p class="text-muted-foreground p-3 text-sm">No artifacts yet.</p>`),op=R(`<div class="min-h-0 flex-1 space-y-0.5 overflow-y-auto p-2"></div>`),sp=R(`<!> <!>`,1),cp=R(`<aside><div class="flex items-center gap-1 border-b px-2 py-1.5"><div role="tablist" aria-label="Side panel views" class="flex items-center gap-1"></div> <div class="flex-1"></div> <button type="button" class="text-muted-foreground hover:text-foreground rounded-md p-1 transition"><!></button> <button type="button" class="text-muted-foreground hover:text-foreground rounded-md p-1 transition" aria-label="Close panel"><!></button></div> <div role="tabpanel" id="side-panel-tabpanel" class="flex min-h-0 flex-1 flex-col"><!></div></aside>`);function lp(t,n){z(n,!0);let r=L(n,`stale`,3,!1),l=L(n,`error`,3,null),d=e(()=>n.artifacts.find(e=>e.key===n.selectedKey)??null),f={markdown:xn,html:jn,react:_n},m=[{id:`artifacts`,label:`Artifacts`},{id:`live`,label:`Live view`}];function h(e){document.getElementById(`side-panel-tab-${e}`)?.focus()}function g(e){let t=m.findIndex(e=>e.id===n.tab),r=-1;e.key===`ArrowRight`?r=(t+1)%m.length:e.key===`ArrowLeft`?r=(t-1+m.length)%m.length:e.key===`Home`?r=0:e.key===`End`&&(r=m.length-1),r!==-1&&(e.preventDefault(),n.onTabChange(m[r].id),h(m[r].id))}c(()=>{if(!n.expanded)return;let e=e=>{e.key===`Escape`&&(document.fullscreenElement||document.querySelector(`[data-artifact-screen-fullscreen]`)||(e.preventDefault(),n.onToggleExpanded()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});var _=cp(),b=s(_),S=s(b);v(S,21,()=>m,e=>e.id,(e,t)=>{var r=Qf(),c=s(r),l=s(c),u=e=>{var t=Zf();i(e,t)};y(l,e=>{o(t).id===`live`&&n.liveActive&&n.tab!==`live`&&e(u)});var d=U(l);I(c),I(r),x(()=>{M(r,`id`,`side-panel-tab-${o(t).id??``}`),M(r,`aria-selected`,n.tab===o(t).id),M(r,`tabindex`,n.tab===o(t).id?0:-1),B(r,1,`rounded-md px-2.5 py-1 text-xs font-medium transition ${n.tab===o(t).id?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`}`),a(d,` ${o(t).label??``}`)}),p(`click`,r,()=>n.onTabChange(o(t).id)),p(`keydown`,r,g),i(e,r)}),I(S);var C=U(S,4),w=s(C),T=e=>{sr(e,{class:`size-4`,"aria-hidden":`true`})},E=e=>{dn(e,{class:`size-4`,"aria-hidden":`true`})};y(w,e=>{n.expanded?e(T):e(E,-1)}),I(C);var D=U(C,2);Tr(s(D),{class:`size-4`,"aria-hidden":`true`}),I(D),I(b);var O=U(b,2),k=s(O),A=e=>{Xf(e,{get liveView(){return n.liveView},get active(){return n.liveActive}})},N=t=>{var c=sp(),m=u(c),h=e=>{var t=tp(),n=s(t),o=e=>{var t=$f(),n=s(t,!0);I(t),x(()=>a(n,l())),i(e,t)};y(n,e=>{l()&&e(o)});var c=U(n,2),u=e=>{var t=ep();i(e,t)};y(c,e=>{r()&&e(u)}),I(t),i(e,t)};y(m,e=>{(l()||r())&&e(h)});var g=U(m,2),_=e=>{var t=np();If(s(t),{get title(){return o(d).title},get artifactType(){return o(d).artifactType},get content(){return o(d).content},get localPath(){return o(d).localPath},get scope(){return o(d).scope},get localError(){return o(d).localError},variant:`full`,onOpenFullscreen:()=>n.onOpenFullscreen(o(d).key),get onBack(){return n.onBack}}),I(t),i(e,t)},b=t=>{var r=op();v(r,21,()=>n.artifacts,e=>e.key,(t,r)=>{let c=e(()=>f[o(r).artifactType]);var l=ip(),u=s(l),d=s(u);pe(d,()=>o(c),(e,t)=>{t(e,{class:`text-muted-foreground size-3.5 shrink-0`,"aria-hidden":`true`})});var m=U(d,2),h=s(m),g=s(h),_=s(g,!0);I(g);var v=U(g,2),b=s(v,!0);I(v),I(h);var S=U(h,2),C=s(S,!0);I(S);var w=U(S,2),T=e=>{var t=rp(),n=s(t,!0);I(t),x(()=>a(n,o(r).localError)),i(e,t)};y(w,e=>{o(r).localError&&e(T)}),I(m),I(u);var E=U(u,2);kn(s(E),{class:`size-3.5`,"aria-hidden":`true`}),I(E),I(l),x(()=>{a(_,o(r).title),a(b,o(r).scope===`project`?`Project`:`Thread`),a(C,o(r).localPath??`Stored in cloud`),M(E,`aria-label`,`Open ${o(r).title} fullscreen`)}),p(`click`,u,()=>n.onSelect(o(r).key)),p(`click`,E,()=>n.onOpenFullscreen(o(r).key)),i(t,l)},e=>{var t=ap();i(e,t)}),I(r),i(t,r)};y(g,e=>{o(d)?e(_):e(b,-1)}),i(t,c)};y(k,e=>{n.tab===`live`?e(A):e(N,-1)}),I(O),I(_),x(()=>{B(_,1,`bg-background flex h-full min-h-0 w-full flex-col ${n.expanded?``:`border-l`}`),M(C,`aria-label`,n.expanded?`Exit full workspace`:`Expand to full workspace`),M(C,`title`,n.expanded?`Exit full workspace`:`Expand to full workspace`),M(C,`aria-pressed`,n.expanded),M(O,`aria-labelledby`,`side-panel-tab-${n.tab??``}`)}),p(`click`,C,function(...e){n.onToggleExpanded?.apply(this,e)}),p(`click`,D,function(...e){n.onClose?.apply(this,e)}),i(t,_),j()}f([`click`,`keydown`]);var up=R(`<iframe sandbox="allow-scripts" class="block h-full w-full flex-1 bg-white"></iframe>`),dp=R(`<div class="min-h-0 flex-1 overflow-auto p-6"><!></div>`),fp=R(`<button type="button" class="bg-background/90 text-muted-foreground hover:text-foreground absolute top-3 right-3 z-10 rounded-md border p-2 transition" aria-label="Exit fullscreen"><!></button>`),pp=R(`<div data-artifact-screen-fullscreen="" class="bg-background fixed inset-0 z-200 flex h-screen w-screen flex-col outline-none" role="dialog" aria-modal="true" tabindex="-1"><!> <!></div>`);function mp(t,n){z(n,!0);let r=e(()=>Sf(n.artifact.artifactType,n.artifact.content)),a=g(null),c=g(!1);re(()=>{let e=o(a);if(!e)return;let t=!0,r=!!document.fullscreenElement,i=document.activeElement instanceof HTMLElement?document.activeElement:null,s=()=>{t&&(t=!1,_(()=>{n.onClose()}))},l=()=>{if(document.fullscreenElement){r=!0,_(()=>{C(c,!1)});return}r&&s()},u=e=>{e.key===`Escape`&&(e.stopImmediatePropagation(),!(document.fullscreenElement||r)&&(e.preventDefault(),s()))};document.addEventListener(`fullscreenchange`,l),window.addEventListener(`keydown`,u,!0),d().then(()=>{t&&e.focus()});let f=window.setTimeout(()=>{!t||document.fullscreenElement||_(()=>{C(c,!0)})},250);return()=>{t=!1,window.clearTimeout(f),document.removeEventListener(`fullscreenchange`,l),window.removeEventListener(`keydown`,u,!0),document.fullscreenElement&&document.exitFullscreen?.().catch(()=>{});let e=i;d().then(()=>{e?.isConnected&&e.focus()})}});var l=pp(),u=s(l),f=e=>{var t=up();x(()=>{M(t,`title`,`${n.artifact.title} preview`),M(t,`srcdoc`,o(r))}),i(e,t)},m=e=>{var t=dp();qu(s(t),{get content(){return n.artifact.content},className:`text-sm text-foreground`}),I(t),i(e,t)};y(u,e=>{o(r)?e(f):e(m,-1)});var h=U(u,2),v=e=>{var t=fp();Tr(s(t),{class:`size-4`,"aria-hidden":`true`}),I(t),p(`click`,t,()=>n.onClose()),i(e,t)};y(h,e=>{o(c)&&e(v)}),I(l),W(l,e=>C(a,e),()=>o(a)),x(()=>M(l,`aria-label`,`${n.artifact.title} fullscreen. Press Escape to exit.`)),i(t,l),j()}f([`click`]);var hp={artifacts:[],stale:!1,error:null};function gp(e){return[e.userId,e.repositoryKey,e.workspacePath,e.threadId??``].join(`\0`)}function _p(e){let t={userId:e.userId,repositoryKey:e.repositoryKey,workspacePath:e.workspacePath};return e.threadId&&(t.threadId=e.threadId),t}function vp(e){return{key:e._id,title:e.title,artifactType:e.type,content:e.content,localPath:e.localPath,scope:e.scope,localError:e.localError}}function yp(e){return{id:e._id,currentVersion:e.revision,updatedAt:e.updatedAt,content:e.content,localPath:e.localPath}}function bp(e,t){return e.content!==t.content||e.localPath!==t.localPath}function xp(e,t){let n=new Map(t.map(e=>[e.id,e]));if(e===null)return{revisions:n,changedId:null};let r=null;for(let n of t){let t=e.get(n.id);(!t||bp(t,n))&&(!r||n.updatedAt>=r.updatedAt)&&(r=n)}return{revisions:n,changedId:r?.id??null}}function Sp(e){return!e.aborted&&e.generation===e.currentGeneration&&e.currentScopeKey===e.eventScopeKey}function Cp(e){return{artifacts:e.artifacts,stale:e.stale,error:e.error??null}}function wp(e,t){let n=new Map(e.artifacts.map(e=>[e._id,e]));for(let e of t?.artifacts??[])(e.localPath||!n.has(e._id))&&n.set(e._id,e);return{artifacts:[...n.values()],stale:e.stale&&(!t||t.stale),error:t?.error??e.error}}var Tp={open:!1,expanded:!1,tab:`artifacts`,selectedKey:null};function Ep(e){return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`.\\`)||e.startsWith(`..\\`)||e.startsWith(`/`)||e.startsWith(`\\`)||e.startsWith(`~/`)||e===`~`||/^[a-zA-Z]:([\\/]|$)/.test(e)}function Dp(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 Op(e){let t=Dp(e);return e.slice(t.length)}function kp(e){return!e||Mp(e)?e:`${e}${jp(e)}`}function Ap(e){let t=e.trim();return t===`/`||t===`\\`||/^[a-zA-Z]:?$/.test(t)||/^[\\/][a-zA-Z]:?$/.test(t)}function jp(e){return e.includes(`\\`)||/^[a-zA-Z]:$/.test(e)?`\\`:`/`}function Mp(e){return/[\\/]$/.test(e)}function Np(e){return e.replace(/[\\/]+$/,``)}function Pp(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 Fp(e){let t=e.query.trim();return t?Mp(t)?e.browseParentPath||Np(t):Pp({leaf:Op(t),browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})??t:``}function Ip(e){let t=e.query.trim();if(!t||Mp(t))return!1;let n=Op(t);return n?Pp({leaf:n,browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})===void 0:!1}var Lp=R(`<p class="text-muted-foreground px-2 pb-1 text-[11px]">Reconnect <span class="text-muted-foreground"> </span> to a local directory</p>`),Rp=R(`<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>`),zp=R(`<div class="border-hairline flex flex-wrap gap-1.5 border-b px-3 py-2"></div>`),Bp=R(`<p class="text-muted-foreground px-3 py-8 text-center text-sm"> </p>`),Vp=R(`<button type="button" role="option"><!> <span class="truncate"> </span></button>`),Hp=R(`<p class="text-destructive border-t border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"> </p>`),Up=R(`<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 Wp(t,n){z(n,!0);let r=L(n,`mode`,3,`add`),d=L(n,`recentProjectPaths`,19,()=>[]),f=g(`~/`),h=g(l([])),_=g(``),b=g(!1),S=g(null),w=g(!1),T=g(!1),E=g(null),D=0,O=g(!1),k=e(()=>Op(o(f)).toLowerCase()),N=e(()=>{if(o(b)){let e=o(f).trim().replace(/^[\\/]+/,``).toLowerCase();return o(h).filter(t=>t.name.toLowerCase().startsWith(e)||t.fullPath.toLowerCase().startsWith(e))}let e=o(k).startsWith(`.`);return o(h).filter(t=>t.name===`..`?o(k).length===0:t.name.toLowerCase().startsWith(o(k))&&(e||!t.name.startsWith(`.`)))}),ee=e(()=>o(f).trim()),P=e(()=>Fp({query:o(f),browseParentPath:o(_),browseEntries:o(h)})),F=e(()=>Ip({query:o(f),browseParentPath:o(_),browseEntries:o(h)})),te=e(()=>!o(b)&&o(P).length>0&&(Ep(o(ee))||o(_).length>0)),R=e(()=>r()===`reconnect`?`Reconnect`:o(F)?`Create & add`:`Add`),ne=e(()=>{if(o(N).length>0)return o(N);let e=Op(o(f)).replace(/[\\/]+$/,``);if(!e||o(k).length===0)return o(N);let t=o(_).split(/[/\\]/).filter(Boolean).at(-1);return t&&t.toLowerCase()===e.toLowerCase()?[{name:t,fullPath:o(_)}]:o(N)}),re=e(()=>o(w)?`Loading directories…`:o(b)?`Select a drive.`:o(P).length>0&&!o(F)?r()===`reconnect`?`Press Enter to reconnect this directory.`:`Press Enter to add this directory.`:o(F)?r()===`reconnect`?`Press Enter to create and reconnect this directory.`:`Press Enter to create and add this directory.`:`No matching directories in this path.`);c(()=>{if(!n.open){C(O,!1);return}o(O)||(C(O,!0),C(f,`~/`),C(S,null),C(E,null),C(b,!1),ie(o(f)))}),c(()=>{if(!n.open||!o(O))return;let e=o(f),t=window.setTimeout(()=>{o(b)&&Ap(e)||ie(e)},180);return()=>{window.clearTimeout(t)}});async function ie(e){let t=++D;C(w,!0);try{let r=await n.desktopApi.browseFilesystem({partialPath:e.trim().length>0?e:`~/`});if(t!==D)return;C(_,r.parentPath,!0),C(h,r.entries,!0),C(b,r.volumeList===!0),C(E,null)}catch(e){if(t!==D)return;C(E,e instanceof Error?e.message:`Failed to browse directories.`,!0)}finally{t===D&&C(w,!1)}}function H(e){C(f,kp(e.fullPath),!0),C(S,e.fullPath,!0)}function ae(e){C(f,kp(e.workspacePath),!0),C(S,e.workspacePath,!0)}async function oe(){if(o(b))return;let e=o(P);if(!e){C(E,`Enter a project directory path.`);return}C(T,!0),C(E,null);try{let t=await n.desktopApi.resolveWorkspacePath({workspacePath:e,createIfMissing:o(F)});await n.onSelect({workspacePath:t.workspacePath,displayName:t.displayName,repositoryKey:t.repositoryKey}),n.onClose()}catch(e){C(E,e instanceof Error?e.message:`Failed to open the selected project.`,!0)}finally{C(T,!1)}}function W(e){if(e.key===`Escape`){e.preventDefault(),n.onClose();return}e.key===`Enter`&&!e.shiftKey&&o(te)&&!o(T)&&(e.preventDefault(),oe())}var se=m(),ce=u(se),ue=e=>{var t=Up(),c=s(t),l=s(c),h=s(l),g=s(h);Tn(s(g),{class:`size-4`}),I(g);var _=U(g,2);le(_),M(_,`spellcheck`,!1);var b=U(_,2),D=e=>{Ln(e,{class:`text-muted-foreground pointer-events-none absolute inset-e-24 top-1/2 size-4 -translate-y-1/2 animate-spin`})};y(b,e=>{o(w)&&e(D)});var O=U(b,2),k=s(O,!0);I(O),I(h);var j=U(h,2),N=e=>{var t=Lp(),r=U(s(t)),o=s(r,!0);I(r),V(),I(t),x(()=>a(o,n.expectedDisplayName)),i(e,t)};y(j,e=>{r()===`reconnect`&&n.expectedDisplayName&&e(N)}),I(l);var ee=U(l,2),P=e=>{var t=zp();v(t,21,d,e=>e.workspacePath,(e,t)=>{var n=Rp(),r=s(n,!0);I(n),x(()=>a(r,o(t).displayName)),p(`click`,n,()=>{ae(o(t))}),i(e,n)}),I(t),i(e,t)};y(ee,e=>{d().length>0&&e(P)});var F=U(ee,2),L=s(F),z=e=>{var t=Bp(),n=s(t,!0);I(t),x(()=>a(n,o(re))),i(e,t)},ie=e=>{var t=m(),n=u(t);v(n,17,()=>o(ne),e=>e.fullPath,(e,t)=>{var n=Vp(),r=s(n),c=e=>{an(e,{class:`text-muted-foreground size-4 shrink-0`})},l=e=>{Dn(e,{class:`text-muted-foreground size-4 shrink-0`})};y(r,e=>{o(t).name===`..`?e(c):e(l,-1)});var u=U(r,2),d=s(u,!0);I(u),I(n),x(()=>{B(n,1,`flex min-h-8 w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition ${o(S)===o(t).fullPath?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),M(n,`aria-selected`,o(S)===o(t).fullPath),a(d,o(t).name)}),p(`click`,n,()=>{H(o(t))}),i(e,n)}),i(e,t)};y(L,e=>{o(ne).length===0?e(z):e(ie,-1)}),I(F);var se=U(F,2),ce=e=>{var t=Hp(),n=s(t,!0);I(t),x(()=>a(n,o(E))),i(e,t)};y(se,e=>{o(E)&&e(ce)});var ue=U(se,2),de=s(ue),fe=U(s(de),2),pe=s(fe);I(fe),V(2),I(de);var G=U(de,2);I(ue),I(c),I(t),x(()=>{O.disabled=!o(te)||o(T),a(k,o(T)?`Working…`:o(R)),a(pe,`Enter ${o(R)??``}`),G.disabled=o(T)}),p(`click`,t,e=>{e.target===e.currentTarget&&n.onClose()}),p(`keydown`,c,W),A(_,()=>o(f),e=>C(f,e)),p(`click`,O,()=>{oe()}),p(`click`,G,function(...e){n.onClose?.apply(this,e)}),i(e,t)};y(ce,e=>{n.open&&e(ue)}),i(t,se),j()}f([`click`,`keydown`]);var Gp=De({method:ke([`desktop`,`package`]),status:ke([`unavailable`,`idle`,`checking`,`available`,`downloading`,`downloaded`,`installing`,`installed`,`error`]),currentVersion:K(),version:K().nullable(),progress:Ie().nullable().optional(),error:K().nullable(),message:K().nullable().optional()});function Kp(e){switch(e.status){case`available`:return`Update available`;case`downloading`:return e.progress==null?`Downloading update…`:`Downloading… ${e.progress}%`;case`downloaded`:return`Restart to update`;case`installing`:return`Installing update…`;case`installed`:return`Update installed`;case`error`:return e.version?`Retry update`:null;default:return null}}async function qp(e){let t=je();if(!t)return null;let n=await fetch(`${t}/api/update${e?`/install`:``}`,{method:e?`POST`:`GET`,credentials:`include`,headers:{"content-type":`application/json`},signal:AbortSignal.timeout(3e4)});if(!n.ok){let e=De({error:K()}).safeParse(await n.json().catch(()=>null));throw Error(e.success?e.data.error:`Update request failed (${n.status}). Try again.`)}return Gp.parse(await n.json())}var Jp=R(`<div class="text-muted-foreground px-2 pb-2 text-xs"><p> </p> <p class="mt-1">On Windows, a locked executable may require stopping Sprocket and running <code>sprocket update</code> instead.</p> <div class="mt-2 flex gap-3"><button type="button" class="text-foreground underline">Install update</button> <button type="button" class="underline">Cancel</button></div></div>`),Yp=R(`<p class="text-muted-foreground px-2 pb-2 text-xs">Wait for active agents to finish, then stop Sprocket in your terminal and launch it again.</p>`),Xp=R(`<p class="text-destructive px-2 pb-2 text-xs break-words" role="alert"> </p>`),Zp=R(`<div class="mb-1" aria-live="polite"><button type="button" class="text-foreground hover:bg-hover-fill flex min-h-9 w-full min-w-0 items-center gap-2.5 rounded-lg px-2 py-1.5 text-left text-[13px] font-medium tracking-[-0.02em] transition disabled:cursor-default disabled:opacity-70"><!> <span> </span></button> <!> <!> <!></div>`);function Qp(t,n){z(n,!0);let r=g(null),c=g(null),l=g(!1),d=g(!1),f=0,h=e(()=>o(r)?Kp(o(r)):null),_=e(()=>o(l)||o(r)?.status===`downloading`||o(r)?.status===`installing`);function v(e){C(r,e,!0),e&&[`downloading`,`downloaded`,`installing`,`installed`].includes(e.status)&&C(c,null)}re(()=>{let e=!1,t=!1,n=!1,r=window.sprocketDesktopBridge?.updates,i=r?.onState(e=>{f+=1,v(e)});async function a(){if(t||e||o(l)||n)return;t=!0;let i=f;try{let t=r?await r.getState():await qp(!1);!e&&f===i&&(v(t),n=t===null||t.status===`unavailable`)}catch{}finally{t=!1}}a();let s=setInterval(()=>void a(),5e3);return()=>{e=!0,clearInterval(s),i?.()}});async function b(){if(!o(r)||o(_))return;if(o(r).method===`package`&&!o(d)){C(d,!0);return}C(d,!1);let e=++f;C(l,!0),C(c,null);try{let t=window.sprocketDesktopBridge?.updates;if(o(r).method===`desktop`&&t){let n=await(o(r).status===`downloaded`?t.install():t.download());f===e&&v(n)}else o(r).method===`package`&&v(await qp(!0))}catch(e){C(c,e instanceof Error?e.message:String(e),!0)}finally{C(l,!1)}}var S=m(),w=u(S),T=e=>{var t=Zp(),n=s(t),l=s(n),u=e=>{Ln(e,{class:`size-4 shrink-0 animate-spin`,"aria-hidden":`true`})},f=e=>{Zn(e,{class:`size-4 shrink-0`,"aria-hidden":`true`})},m=e=>{ln(e,{class:`size-4 shrink-0`,"aria-hidden":`true`})};y(l,e=>{o(_)?e(u):o(r).status===`downloaded`?e(f,1):e(m,-1)});var g=U(l,2),v=s(g,!0);I(g),I(n);var S=U(n,2),w=e=>{var t=Jp(),n=s(t),c=s(n);I(n);var l=U(n,4),u=s(l),f=U(u,2);I(l),I(t),x(()=>a(c,`Install ${o(r).version??``} using your package manager? Restart Sprocket from your terminal
|
|
129
|
+
afterward to use the new version.`)),p(`click`,u,()=>void b()),p(`click`,f,()=>C(d,!1)),i(e,t)};y(S,e=>{o(d)&&e(w)});var T=U(S,2),E=e=>{var t=Yp();i(e,t)};y(T,e=>{o(r).status===`installed`&&e(E)});var D=U(T,2),O=e=>{var t=Xp(),n=s(t,!0);I(t),x(()=>a(n,o(c)||o(r).error)),i(e,t)};y(D,e=>{(o(c)||o(r).error)&&e(O)}),I(t),x(()=>{n.disabled=o(_)||o(r).status===`installed`,M(n,`title`,o(r).version?`Sprocket ${o(r).version}`:void 0),M(n,`aria-busy`,o(_)),a(v,o(h))}),p(`click`,n,()=>void b()),i(e,t)};y(w,e=>{o(h)&&o(r)&&e(T)}),i(t,S),j()}f([`click`]);var $p=R(`<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>`),em=R(`<p class="text-muted-foreground truncate text-[10px] tracking-[-0.01em]"> </p>`),tm=R(`<span class="rounded-full border border-amber-500/25 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-800 dark:text-amber-200"> </span>`),nm=R(`<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>`),rm=R(`<p class="text-muted-foreground pb-2 text-[12px] leading-5"> </p>`),im=R(`<p class="text-muted-foreground py-1.5 text-[12px]">No threads yet</p>`),am=R(`<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>`),om=R(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-amber-300" aria-label="Starting agent"></span>`),sm=R(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-emerald-400" aria-label="Thread has an active run"></span>`),cm=R(`<div class="group/thread relative"><button type="button"><!> <span class="truncate"> </span></button> <button type="button"><!></button></div>`),lm=R(`<button type="button" class="text-muted-foreground hover:text-muted-foreground px-2 py-1 text-[12px] transition"> </button>`),um=R(`<div class="space-y-0.5"><!> <!></div>`),dm=R(`<div class="ml-5 border-l border-[var(--hairline)] pl-3"><!> <!></div>`),fm=R(`<section class="space-y-1.5"><div class="group relative flex items-center px-2"><button type="button" class="text-muted-foreground hover:text-foreground inline-flex h-8 w-7 shrink-0 items-center justify-center rounded-md"><!></button> <button type="button"><!> <div class="min-w-0 flex-1"><p class="truncate text-[0.88rem] font-medium tracking-[-0.02em]"> </p> <!></div> <!> <!></button> <button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill absolute top-0.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md opacity-0 transition group-hover:opacity-100 focus-visible:opacity-100 disabled:cursor-not-allowed disabled:opacity-40"><!></button></div> <!></section>`),pm=R(`<div class="space-y-4"></div>`),mm=R(`<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>`),hm=R(`<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>`),gm=R(`<aside class="app-sidebar-panel"><div class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex items-center justify-between gap-2 px-3.5 pt-3 pb-4"><!> <!></header> <div class="px-3.5 pb-1"><button type="button"><!> <span class="truncate">Create/Add Project</span></button></div> <div class="hide-scrollbar min-h-0 flex-1 overflow-y-auto px-2.5 py-3"><div class="mb-3 px-2"><p class="text-muted-foreground text-[10px] tracking-[0.24em] uppercase">Projects</p></div> <!></div> <div class="px-3.5 pt-2 pb-4"><!> <button type="button"><!> Settings</button></div></div></aside> <!> <!>`,1);function _m(t,n){z(n,!0);let r=L(n,`pendingAgentLaunches`,19,()=>({})),d=`flex h-9 w-full min-w-0 items-center gap-2.5 rounded-lg px-2 text-[13px] font-medium tracking-[-0.02em] text-foreground transition hover:bg-hover-fill hover:text-foreground`,f=`size-4 shrink-0 text-muted-foreground`,_=g(l({})),b=g(l({})),S=g(null),w=g(null),T=g(null),E=g(``),D=g(``),O=g(null),k=g(null);c(()=>{!o(T)||!o(O)||(o(O).focus(),o(O).select())}),c(()=>{if(!o(k))return;function e(e){let t=e.target;t instanceof Element&&t.closest(`[data-thread-context-menu]`)||C(k,null)}function t(e){e.key===`Escape`&&C(k,null)}return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t,!0)}});function N(e,t){if(o(T))return;let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let r=n.getBoundingClientRect();C(S,t,!0),C(w,{top:r.top+r.height/2,left:r.right+8},!0)}function ee(){C(S,null),C(w,null)}function P(e){return o(_)[e]??!1}function te(e){C(_,{...o(_),[e]:!P(e)},!0)}function R(e){return o(b)[e]??!1}function ne(e){C(b,{...o(b),[e]:!R(e)},!0)}function re(e){return e.project.localAttachmentAvailability===`unavailable`?`Missing`:null}function ie(e,t){C(k,null),ee(),C(T,e,!0),C(E,t,!0),C(D,t,!0)}function H(){C(T,null),C(E,``),C(D,``)}function oe(){let e=o(T);if(!e)return;let t=o(E).trim();C(T,null),C(E,``);let r=o(D);C(D,``),t.length!==0&&t!==r&&n.onRenameThread(e,t)}function se(e,t){e.preventDefault(),ee(),C(k,{threadId:t.threadId,title:t.title,x:e.clientX,y:e.clientY},!0)}var ce=gm(),ue=u(ce),de=s(ue),fe=s(de),pe=s(fe);Ge(pe,{size:`sm`,class:`min-w-0`}),zo(U(pe,2),{get theme(){return n.theme},get onThemeChange(){return n.onThemeChange}}),I(fe);var G=U(fe,2),me=s(G);B(me,1,F(d)),Cn(s(me),{class:f,"aria-hidden":`true`}),V(2),I(me),I(G);var he=U(G,2),ge=U(s(he),2),_e=e=>{var t=$p();i(e,t)},ve=t=>{var c=pm();v(c,21,()=>n.groups,e=>e.project.workspacePath,(t,c)=>{let l=e(()=>o(c).project),f=e(()=>re(o(c)));var g=fm(),_=s(g),b=s(_),S=s(b);{let t=e(()=>`size-3 shrink-0 transition-transform ${R(o(l).workspacePath)?``:`rotate-90`}`);Kt(S,{get class(){return o(t)}})}I(b);var w=U(b,2),D=s(w);Dn(D,{class:`text-muted-foreground size-4 shrink-0`});var k=U(D,2),j=s(k),F=s(j,!0);I(j);var L=U(j,2),z=e=>{var t=em(),n=s(t,!0);I(t),x(()=>a(n,o(l).workspacePath)),i(e,t)};y(L,e=>{o(l).repositoryKey!==o(l).displayName&&e(z)}),I(k);var V=U(k,2),ie=e=>{var t=tm(),n=s(t,!0);I(t),x(()=>a(n,o(f))),i(e,t)};y(V,e=>{o(f)&&e(ie)});var ae=U(V,2),ce=e=>{var t=nm(),n=s(t,!0);I(t),x(()=>a(n,o(c).activeThreadCount)),i(e,t)};y(ae,e=>{o(c).activeThreadCount>0&&e(ce)}),I(w);var ue=U(w,2),de=s(ue),fe=e=>{lr(e,{class:`size-4`})},pe=e=>{Cn(e,{class:`size-4`})};y(de,e=>{o(l).localAttachmentAvailability===`available`?e(fe):e(pe,-1)}),I(ue),I(_);var G=U(_,2),me=t=>{var f=dm(),g=s(f),_=e=>{var t=rm(),n=s(t,!0);I(t),x(()=>a(n,o(l).localAttachmentError??`This project needs to be reconnected.`)),i(e,t)};y(g,e=>{o(l).localAttachmentAvailability===`unavailable`&&e(_)});var b=U(g,2),S=e=>{var t=im();i(e,t)},w=t=>{let f=e(()=>P(o(l).workspacePath)),g=e(()=>o(f)?o(c).threads:o(c).threads.slice(0,3)),_=e(()=>o(c).threads.length>3);var b=um(),S=s(b);v(S,17,()=>o(g),e=>e.threadId,(t,c)=>{let f=e(()=>fo(r(),o(c).threadId)),g=e(()=>o(c).threadId===n.currentThreadId),_=e(()=>o(T)===o(c).threadId);var v=m(),b=u(v),S=e=>{var t=am(),n=s(t);le(n),W(n,e=>C(O,e),()=>o(O)),I(t),h(`submit`,t,e=>{e.preventDefault(),oe()}),p(`keydown`,n,e=>{e.key===`Escape`&&(e.preventDefault(),H())}),h(`blur`,n,()=>{oe()}),A(n,()=>o(E),e=>C(E,e)),i(e,t)},w=e=>{var t=cm(),r=s(t),u=s(r),m=e=>{var t=om();i(e,t)},_=e=>{var t=sm();i(e,t)};y(u,e=>{o(f)?e(m):(o(c).status===`queued`||o(c).status===`running`||o(c).status===`awaiting_executor`)&&e(_,1)});var v=U(u,2),b=s(v,!0);I(v),I(r);var S=U(r,2);kt(s(S),{class:`size-3.5`,"aria-hidden":`true`}),I(S),I(t),x(()=>{B(r,1,`${d} pr-8 ${o(g)?`text-foreground bg-hover-fill`:`text-muted-foreground`}`),M(r,`aria-current`,o(g)?`page`:void 0),a(b,o(c).title),B(S,1,`text-muted-foreground hover:text-foreground hover:bg-hover-fill absolute top-1.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md transition focus-visible:opacity-100 ${o(g)?`opacity-100`:`opacity-0 group-focus-within/thread:opacity-100 group-hover/thread:opacity-100`}`),M(S,`aria-label`,`Archive ${o(c).title}`)}),h(`mouseenter`,r,e=>{N(e,o(c).title)}),h(`mouseleave`,r,ee),h(`focus`,r,e=>{N(e,o(c).title)}),h(`blur`,r,ee),p(`contextmenu`,r,e=>{se(e,o(c))}),p(`click`,r,()=>{n.onSelectThread(o(c),o(l).workspacePath)}),p(`click`,S,e=>{e.stopPropagation(),ee(),n.onArchiveThread(o(c).threadId)}),i(e,t)};y(b,e=>{o(_)?e(S):e(w,-1)}),i(t,v)});var w=U(S,2),D=e=>{var t=lm(),n=s(t,!0);I(t),x(()=>a(n,o(f)?`Show less`:`Show more`)),p(`click`,t,()=>{te(o(l).workspacePath)}),i(e,t)};y(w,e=>{o(_)&&e(D)}),I(b),i(t,b)};y(b,e=>{o(c).threads.length===0?e(S):e(w,-1)}),I(f),i(t,f)},he=e(()=>!R(o(l).workspacePath));y(G,e=>{o(he)&&e(me)}),I(g),x(e=>{M(b,`aria-label`,e),B(w,1,`flex min-w-0 flex-1 items-center gap-2 rounded-xl px-2 py-1 pr-8 text-left transition ${o(l).workspacePath===n.currentWorkspacePath?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),a(F,o(l).displayName),M(ue,`aria-label`,o(l).localAttachmentAvailability===`available`?`Create thread in ${o(l).displayName}`:`Reconnect ${o(l).displayName}`)},[()=>R(o(l).workspacePath)?`Expand ${o(l).displayName} threads`:`Collapse ${o(l).displayName} threads`]),p(`click`,b,()=>{ne(o(l).workspacePath)}),p(`click`,w,()=>{n.onSelectProject(o(l).workspacePath)}),p(`click`,ue,()=>{if(o(l).localAttachmentAvailability===`available`){n.onStartThreadDraft(o(l).workspacePath);return}n.onReconnectProject(o(l).workspacePath)}),i(t,g)}),I(c),i(t,c)};y(ge,e=>{n.groups.length===0?e(_e):e(ve,-1)}),I(he);var ye=U(he,2),be=s(ye);Qp(be,{});var xe=U(be,2);B(xe,1,F(d)),ar(s(xe),{class:f,"aria-hidden":`true`}),V(),I(xe),I(ye),I(de),I(ue);var Se=U(ue,2),Ce=e=>{var t=mm(),n=s(t,!0);I(t),x(()=>{ae(t,`top: ${o(w).top}px; left: ${o(w).left}px;`),a(n,o(S))}),i(e,t)};y(Se,e=>{o(S)&&o(w)&&!o(k)&&!o(T)&&e(Ce)});var we=U(Se,2),Te=e=>{var t=hm(),n=s(t);I(t),x(()=>ae(t,`top: ${o(k).y}px; left: ${o(k).x}px;`)),p(`click`,n,()=>{ie(o(k).threadId,o(k).title)}),i(e,t)};y(we,e=>{o(k)&&e(Te)}),p(`click`,me,function(...e){n.onAddProject?.apply(this,e)}),p(`click`,xe,function(...e){n.onOpenSettings?.apply(this,e)}),i(t,ce),j()}f([`click`,`keydown`,`contextmenu`]);function vm(e){return e.map(e=>Z.literal(e))}Z.union(...vm(_i)),Z.union(...vm(Oa)),Z.union(Z.literal(`active`),Z.literal(`on_hold`),Z.literal(`cancelled`),Z.literal(`expired`),Z.literal(`failed`));var ym=Z.object({path:Z.string(),directory:Z.string(),contents:Z.string(),truncated:Z.boolean()}),bm=Z.object({patch:Z.string()}),xm=Z.object({cmd:Z.string(),workdir:Z.optional(Z.string()),shell:Z.optional(Z.string()),timeoutMs:Z.optional(Z.number()),yieldTimeMs:Z.optional(Z.number()),maxOutputChars:Z.optional(Z.number())}),Sm=Z.object({url:Z.string()}),Cm=Sm.pick(`url`),wm=Z.object({query:Z.string(),numResults:Z.optional(Z.number())}),Tm=Z.object({sessionId:Z.string(),chars:Z.optional(Z.string()),terminate:Z.optional(Z.boolean()),yieldTimeMs:Z.optional(Z.number())}),Em=Z.union(Z.literal(`markdown`),Z.literal(`html`),Z.literal(`react`)),Dm=Z.union(Z.literal(`thread`),Z.literal(`project`)),Om=Z.object({scope:Dm}),km=Z.object({artifactId:Z.string()}),Am=Z.object({title:Z.string(),contentType:Em,content:Z.string()}),jm=Z.object({artifactId:Z.string(),content:Z.string()}),Mm=Z.object({name:Z.string()}),Nm=Z.object({instruction:Z.optional(Z.string()),action:Z.optional(Z.object({selector:Z.string(),description:Z.string(),method:Z.optional(Z.string()),arguments:Z.optional(Z.array(Z.string()))})),startUrl:Z.optional(Z.string())}),Pm=Z.object({command:Z.string(),enforce_saving:Z.optional(Z.boolean())}),Fm=Z.union(...vm([`one_time`,`weekly`,`monthly`,`yearly`])),Im=Z.union(Z.literal(`listed`),Z.literal(`any`)),Lm=Z.union(...vm([`pending`,`active`,`paused`,`consumed`,`cancelled`,`expired`]));Z.union(Z.literal(`awaiting_result`),Z.literal(`completed`),Z.literal(`declined`),Z.literal(`failed`));var Rm=Z.union(Z.literal(`approved`),Z.literal(`declined`)),zm=Z.object({userEmail:Z.optional(Z.string()),merchantName:Z.optional(Z.string()),merchantUrl:Z.optional(Z.string()),countryCode:Z.optional(Z.string()),amountCap:Z.string(),currency:Z.string(),frequency:Fm,scope:Im,description:Z.string(),maxCharges:Z.optional(Z.number()),validUntil:Z.optional(Z.string())}),Bm=Z.object({mandateId:Z.string()}),Vm=Z.object({mandateId:Z.string(),amount:Z.string(),currency:Z.string(),description:Z.string(),reference:Z.optional(Z.string())}),Hm=Z.object({chargeId:Z.string(),outcome:Rm,amountPaid:Z.optional(Z.string())}),Um=Z.object({id:Z.string(),label:Z.string()}),Wm=Z.object({question:Z.string(),options:Z.array(Um),yieldTimeMs:Z.optional(Z.number()),timeoutMs:Z.optional(Z.number())}),Gm=Z.object({questionId:Z.id(`agentQuestions`),yieldTimeMs:Z.optional(Z.number())}),Km=Z.union(Z.object({path:Z.string()}),Z.object({url:Z.string()})),qm=Z.union(Z.object({}),Km,bm,Wm,Gm,xm,Mm,Sm,Cm,wm,Tm,Om,km,Am,jm,Pm,zm,Bm,Vm,Hm);Z.union(qm,Nm);var Jm=Z.object({changes:Z.array(Z.object({path:Z.string(),operation:Z.union(Z.literal(`created`),Z.literal(`updated`),Z.literal(`deleted`),Z.literal(`renamed`),Z.literal(`copied`))}))}),Ym=Z.object({command:Z.string(),cwd:Z.string(),output:Z.string(),sessionId:Z.optional(Z.string()),exitCode:Z.optional(Z.number()),success:Z.boolean(),running:Z.boolean(),timedOut:Z.boolean(),truncated:Z.boolean(),error:Z.optional(Z.string())}),Xm=Z.object({url:Z.string(),markdown:Z.string(),truncated:Z.optional(Z.boolean()),summary:Z.optional(Z.string()),images:Z.optional(Z.array(Z.string()))});Z.union(Z.object({url:Z.string(),markdown:Z.string(),summary:Z.string(),images:Z.array(Z.string())}),Z.object({url:Z.string(),summary:Z.string(),scrapeUrl:Z.string()})),Z.object({url:Z.string(),screenshotUrl:Z.string()});var Zm=Z.object({outputType:Z.literal(`image`),url:Z.string(),path:Z.string(),mediaType:Z.string(),byteSize:Z.number(),width:Z.number(),height:Z.number()}),Qm=Z.object({results:Z.array(Z.object({title:Z.optional(Z.string()),url:Z.string(),publishedDate:Z.optional(Z.string()),author:Z.optional(Z.string()),text:Z.optional(Z.string())}))}),$m=Z.object({mandateId:Z.id(`mandates`),approvalUrl:Z.string(),expiresAt:Z.string()}),eh=Z.object({mandateId:Z.id(`mandates`),pravaMandateId:Z.optional(Z.string()),status:Lm,description:Z.optional(Z.string()),merchantName:Z.optional(Z.string()),amountCap:Z.string(),remaining:Z.optional(Z.string()),currency:Z.string(),frequency:Fm,scope:Im,approvalUrl:Z.optional(Z.string()),validUntil:Z.optional(Z.string()),renewsAt:Z.optional(Z.string())}),th=Z.object({mandates:Z.array(Z.object({mandateId:Z.optional(Z.id(`mandates`)),pravaMandateId:Z.string(),status:Z.string(),description:Z.optional(Z.string()),merchantName:Z.optional(Z.string()),approvedAmount:Z.string(),remaining:Z.optional(Z.string()),currency:Z.string(),validUntil:Z.optional(Z.string()),renewsAt:Z.optional(Z.string())}))}),nh=Z.object({chargeId:Z.id(`mandateCharges`),transactionId:Z.string(),token:Z.optional(Z.string()),dynamicCvv:Z.optional(Z.string()),expiryMonth:Z.optional(Z.string()),expiryYear:Z.optional(Z.string())}),rh=Z.object({reported:Z.boolean(),alreadyReported:Z.optional(Z.boolean()),inFlight:Z.optional(Z.boolean())}),ih=Z.object({text:Z.string(),truncated:Z.boolean()}),ah=Z.object({mediaType:Z.literal(`image/png`),dataBase64:Z.string(),byteLength:Z.number(),truncated:Z.boolean(),url:Z.optional(Z.string())}),oh=Zm.omit(`url`).extend({mediaType:Z.literal(`image/png`)}),sh=Z.object({selector:Z.string(),description:Z.string(),method:Z.optional(Z.string()),arguments:Z.optional(Z.array(Z.string()))}),ch=Z.object({actions:Z.array(sh),text:Z.string(),truncated:Z.boolean()}),lh=Z.object({name:Z.string(),description:Z.string(),content:Z.string(),dir:Z.optional(Z.string()),truncated:Z.optional(Z.boolean())}),uh=Z.object({optionId:Z.optional(Z.string()),optionLabel:Z.optional(Z.string()),text:Z.optional(Z.string())}),dh=Z.object({questionId:Z.id(`agentQuestions`),question:Z.string(),options:Z.array(Um),pending:Z.boolean(),timedOut:Z.boolean(),answer:Z.optional(uh)}),fh=Z.object({artifactId:Z.string(),revision:Z.optional(Z.number()),scope:Z.optional(Dm),title:Z.optional(Z.string()),contentType:Z.optional(Em),version:Z.optional(Z.number())}),ph=Z.object({artifacts:Z.array(Z.object({artifactId:Z.string(),scope:Dm,repositoryKey:Z.string(),threadId:Z.optional(Z.id(`threadRecords`)),type:Em,title:Z.string(),revision:Z.number(),createdAt:Z.number(),updatedAt:Z.number()}))}),mh=Z.union(Z.object({type:Z.literal(`path`),path:Z.string()}),Z.object({type:Z.literal(`url`),url:Z.string()})),hh=Z.union(Z.object({outputType:Z.literal(`image`),mediaType:Z.string(),path:Z.string(),source:mh,byteSize:Z.number(),width:Z.number(),height:Z.number()}),Z.object({outputType:Z.literal(`text`),path:Z.string(),source:mh,format:Z.string(),charCount:Z.number(),preview:Z.string(),truncated:Z.boolean()}));Z.union(Z.string(),hh,Z.array(ym),Jm,dh,Ym,lh,Xm,Zm,Qm,fh,ph,ih,ah,oh,ch,$m,eh,th,nh,rh),Z.union(Z.literal(`queued`),Z.literal(`running`),Z.literal(`awaiting_executor`),Z.literal(`completed`),Z.literal(`failed`),Z.literal(`cancelled`));var gh=[`cancelled`,`completed`,`failed`];Z.union(...vm(gh));function _h(e){return gh.some(t=>t===e)}var vh=Z.union(Z.literal(`apply_patch`),Z.literal(`ask_question`),Z.literal(`await_question`),Z.literal(`browser_interact`),Z.literal(`browser_screenshot`),Z.literal(`exec_command`),Z.literal(`get_workspace_instructions`),Z.literal(`mandate_setup`),Z.literal(`mandate_status`),Z.literal(`mandate_list`),Z.literal(`mandate_charge`),Z.literal(`mandate_report`),Z.literal(`read_skill`),Z.literal(`parse_file`),Z.literal(`scrape_url`),Z.literal(`screenshot_url`),Z.literal(`web_search`),Z.literal(`write_stdin`),Z.literal(`add_artifact`),Z.literal(`list_artifacts`),Z.literal(`edit_artifact`),Z.literal(`save_artifact`)),yh=Z.union(vh,Z.literal(`browser_observe`),Z.literal(`browser_act`),Z.literal(`browser_extract`));Z.union(yh,Z.literal(`create_artifact`),Z.literal(`update_artifact`)),Z.union(Z.literal(`pending`),Z.literal(`answered`),Z.literal(`timedOut`),Z.literal(`cancelled`)),Z.union(Z.literal(`pending`),Z.literal(`claimed`),Z.literal(`completed`),Z.literal(`failed`),Z.literal(`cancelled`));var bh=Z.optional(Z.union(Z.number(),Z.null())),xh=Z.object({type:Z.literal(`text`),id:Z.string(),text:Z.string(),startedAt:bh,completedAt:bh,turnId:Z.optional(Z.string()),providerMetadata:Z.optional(ls)}),Sh=Z.object({type:Z.literal(`reasoning`),id:Z.string(),text:Z.string(),startedAt:bh,completedAt:bh,turnId:Z.optional(Z.string()),providerMetadata:Z.optional(ls)}),Ch=Z.object({type:Z.literal(`tool-call`),partId:Z.optional(Z.string()),callId:Z.string(),name:Z.string(),input:ls,turnId:Z.optional(Z.string()),startedAt:bh,completedAt:bh,providerMetadata:Z.optional(ls)}),wh=Z.union(...vm([`cancelled`,`failed`]));Z.object({error:Z.string(),status:wh});var Th=Z.object({type:Z.literal(`tool-result`),callId:Z.string(),name:Z.optional(Z.string()),completedAt:bh,output:ls});Z.union(xh,Sh,Ch,Th),Z.union(Z.literal(`prompt`),Z.literal(`completion`),Z.literal(`tool`));var Eh=Z.object({imageUploadId:Z.optional(Z.id(`imageUploads`)),name:Z.string(),mediaType:Z.string(),size:Z.number(),storageId:Z.id(`_storage`),url:Z.optional(Z.string())}),Dh=Z.union(xh,Sh,Ch);Z.object({text:Z.string(),imageUploads:Z.array(Eh)}),Z.object({streamId:Z.optional(Z.string()),items:Z.array(Dh)});var Oh=Z.union(Z.literal(`started`),Z.literal(`completed`),Z.literal(`failed`),Z.literal(`cancelled`));Z.object({jobId:Z.optional(Z.id(`executorJobs`)),toolInvocationId:Z.optional(Z.string()),callId:Z.string(),name:Z.string(),output:Z.optional(ls),status:Oh});var kh=Z.union(Z.literal(`system`),Z.literal(`user`),Z.literal(`assistant`)),Ah=Z.union(Z.object({type:Z.literal(`text`),text:Z.string()}),Z.object({type:Z.literal(`image`),imageJson:Z.string()})),jh=Z.union(Z.object({type:Z.literal(`text`),text:Z.string(),additionalParamsJson:Z.optional(Z.string())}),Z.object({type:Z.literal(`reasoning`),id:Z.optional(Z.string()),blocksJson:Z.string()}),Z.object({type:Z.literal(`toolCall`),id:Z.string(),callId:Z.optional(Z.string()),name:Z.string(),argumentsJson:Z.string(),signature:Z.optional(Z.string()),additionalParamsJson:Z.optional(Z.string())}),Z.object({type:Z.literal(`toolResult`),id:Z.string(),callId:Z.optional(Z.string()),items:Z.array(Ah)}),Z.object({type:Z.literal(`image`),imageJson:Z.string()}),Z.object({type:Z.literal(`audio`),audioJson:Z.string()}),Z.object({type:Z.literal(`video`),videoJson:Z.string()}),Z.object({type:Z.literal(`document`),documentJson:Z.string()}));Z.object({role:kh,assistantId:Z.optional(Z.string()),contents:Z.array(jh)});function Mh(e){return{repositoryKey:e.repositoryKey,displayName:e.displayName,workspacePath:e.workspacePath,localAttachmentAvailability:e.availability,localAttachmentError:e.unavailableReason}}function Nh(e){let t=e.recoveredSubmission,n=e.latestRun;return(n===null||n.runId!==void 0&&n.runId===t?.continuationOfRunId||n.submissionId===t?.submissionId&&!_h(n.status))&&t?.prompt===e.prompt&&t.selectedModel===e.selectedModel&&t.reasoningEffort===e.reasoningEffort&&t.fastMode===e.fastMode&&t.continuationOfRunId===e.continuationOfRunId&&Zi(t.storageIds,e.storageIds)?t.submissionId:e.newSubmissionId}function Ph(e,t){return e===`cancelled`?`cancelled`:e===`failed`?t===`The local agent stopped responding before this run finished.`?`crash`:`failed`:null}function Fh(e){let t={userId:e.userId,prompt:e.prompt,storageIds:e.storageIds,selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,fastMode:e.fastMode,submissionId:e.submissionId,workspacePath:e.workspacePath};return e.threadId&&(t.threadId=e.threadId),e.repositoryKey&&(t.repositoryKey=e.repositoryKey),e.continuationOfRunId&&(t.continuationOfRunId=e.continuationOfRunId),e.desktopApi.runAgent(t).then(({runId:t,threadId:n})=>{e.onStarted(t,n)}).catch(t=>{let n=t instanceof Error?t:Error(String(t));console.error(`Failed to run agent`,n),e.onError(n)})}function Ih(e){return Object.fromEntries(e.map(e=>[e.workspacePath,e]))}async function Lh(e){return e?Ih(await e.listProjectAttachments()):{}}async function Rh(e){let t={workspacePath:e.workspacePath};return e.replaceWorkspacePath&&(t.replaceWorkspacePath=e.replaceWorkspacePath),await e.desktopApi.attachProject(t)}async function zh(e){if(e.desktopApi)try{let t=(await e.desktopApi.listProjectAttachments()).find(t=>t.workspacePath===e.workspacePath);if(!t||t.availability!==`available`)throw Error(t?.unavailableReason??`Workspace path is unavailable.`);await e.refreshDesktopProjectAttachments()}catch(t){throw await e.refreshDesktopProjectAttachments(),t}}var Bh=Z.union(Z.literal(`idle`),Z.literal(`queued`),Z.literal(`running`),Z.literal(`waiting_for_input`),Z.literal(`cancellation_requested`),Z.literal(`completed`),Z.literal(`failed`),Z.literal(`cancelled`)),Vh=Z.object({runId:Z.id(`runs`),startedAt:Z.number(),completedAt:Z.optional(Z.number()),lastError:Z.optional(Z.string()),executorFriendlyName:Z.optional(Z.string())});Z.object({threadId:Z.id(`threadRecords`),phase:Bh,run:Z.union(Vh,Z.null())});var Hh=new Set([`queued`,`running`,`waiting_for_input`,`cancellation_requested`]);function Uh(e){return Hh.has(e)}function Wh(e){return e.type===`tool-call`||e.type===`tool-result`?`${e.type}:${e.callId}`:`${e.type}:${e.turnId??``}:${e.id}`}function Gh(e){let t=new Map;for(let n of e){let e=t.get(n.runId)?.parts??new Map;for(let t of n.parts)e.set(Wh(t),t);t.set(n.runId,{live:n,parts:e})}return[...t.values()].map(({live:e,parts:t})=>{let n=[...t.values()];return{kind:`live`,id:`response:${e.runId}`,threadId:e.threadId,runId:e.runId,runStatus:e.runStatus,runStartedAt:e.runStartedAt,text:ds(n),parts:n}})}function Kh(e){return`${e.runId}:${e.streamId}`}function qh(e,t){let n=new Set(t.map(e=>e.runId));return e.filter(e=>!e.provisional||!n.has(e.runId))}var Jh=class{fetchPage;changed;messages=[];nextBefore;loading=!0;loadingOlder=!1;windowVersion=0;stale=!1;error=null;stopped=!1;refreshing=!1;refreshPending=!1;olderPending=!1;retry;rows=new Map;persistedStreams=new Set;checkedStreams=new Set;overlays=[];revision=0;replicaId;changesCursor;constructor(e,t){this.fetchPage=e,this.changed=t}stop(){this.stopped=!0,clearTimeout(this.retry)}unpersisted(e){return e.filter(e=>!this.persistedStreams.has(Kh(e)))}visibleOverlays(e){return this.unpersisted(e).filter(e=>this.checkedStreams.has(Kh(e)))}setOverlays(e){let t=new Set(this.overlays.map(Kh));this.overlays=e;let n=new Set(e.map(Kh));for(let e of this.checkedStreams)n.has(e)||this.checkedStreams.delete(e);e.some(e=>!t.has(Kh(e)))&&this.refresh()}streamRequest(){let e=new Map;for(let t of this.unpersisted(this.overlays))if(e.set(Kh(t),{runId:t.runId,streamId:t.streamId}),e.size===64)break;let t=[...e.values()];return t.length?{streams:t}:{}}async refresh(){if(this.stopped)return;if(this.refreshing){this.refreshPending=!0;return}this.refreshing=!0;let e=!1;clearTimeout(this.retry);try{do{this.refreshPending=!1;let t=this.streamRequest(),n=await this.fetchPage({limit:12,changesAfter:this.changesCursor,...t});if(this.stopped)return;if(this.replicaId!==n.replicaId&&(this.replicaId!==void 0&&(this.windowVersion+=1),this.rows.clear(),this.messages=[],this.persistedStreams.clear(),this.checkedStreams.clear(),this.changesCursor=void 0,this.nextBefore=void 0,this.revision=0,this.replicaId=n.replicaId,this.loading=!0,this.changed()),n.indexing){this.stale=n.stale,this.changed(),this.retry=setTimeout(()=>void this.refresh(),500);break}if(n.stale&&(this.retry=setTimeout(()=>void this.refresh(),2e3)),n.revision<this.revision){this.stale=n.stale,this.changed();break}let r=n.nextBefore??0,i=this.messages.at(-1)?.sequence;i!==void 0&&i<r&&(this.rows.clear(),this.windowVersion+=1),(!this.rows.size||r===0||r<=(this.messages[0]?.sequence??0))&&(this.nextBefore=n.nextBefore);for(let e of this.rows.keys())e>=r&&this.rows.delete(e);this.commit(n);for(let e of t.streams??[])this.checkedStreams.add(Kh(e));this.changesCursor=n.changesCursor,this.refreshPending||=n.moreChanges,this.refreshPending||=n.persistedStreams.length>0&&this.unpersisted(this.overlays).some(e=>!this.checkedStreams.has(Kh(e))),e=!0,this.loading=!1,this.error=null,this.changed()}while(this.refreshPending&&!this.stopped)}catch{this.stopped||(this.stale=!0,this.loading=!1,this.error=this.messages.length?null:`Could not load conversation history.`,this.changed(),this.retry=setTimeout(()=>void this.refresh(),2e3))}finally{this.refreshing=!1,e&&this.olderPending&&!this.stopped&&(this.olderPending=!1,this.loadOlder())}}async loadOlder(){if(this.stopped||this.loadingOlder)return;if(this.refreshing){this.olderPending=!0;return}if(this.nextBefore===void 0)return;let e=this.nextBefore,t=this.windowVersion;this.loadingOlder=!0,this.changed();try{let n=await this.fetchPage({before:e,limit:40,...this.streamRequest()});if(this.stopped||t!==this.windowVersion)return;if(this.replicaId!==n.replicaId){this.refresh();return}if(n.indexing){this.olderPending=!0,this.refresh();return}if(n.revision<this.revision){this.stale=!0;return}if(n.persistedStreams.some(e=>!this.persistedStreams.has(Kh(e)))){this.olderPending=!0,this.refresh();return}if(n.nextBefore!==void 0&&n.nextBefore>=e)throw Error(`History cursor did not advance.`);this.commit(n),this.nextBefore=n.nextBefore}catch{!this.stopped&&t===this.windowVersion&&(this.stale=!0)}finally{this.loadingOlder=!1,this.stopped||this.changed()}}commit(e){let t=new Map(this.messages.map(e=>[e.id,e])),n=this.rows.size?this.messages[0]?.sequence:void 0;for(let r of e.changes){let e=t.get(r.id);if(!e){r.row&&n!==void 0&&r.row.sequence>=n&&this.rows.set(r.row.sequence,r.row);continue}r.row?r.row.revision>e.revision&&this.rows.set(r.row.sequence,r.row):this.rows.delete(e.sequence)}for(let n of e.rows){let e=this.rows.get(n.sequence)??t.get(n.id);this.rows.set(n.sequence,e&&e.revision>=n.revision?e:n)}let r=[...this.rows.entries()].sort(([e],[t])=>e-t).map(([,e])=>e);(r.length!==this.messages.length||r.some((e,t)=>e!==this.messages[t]))&&(this.messages=r),this.stale=e.stale,this.revision=Math.max(this.revision,e.revision);for(let t of e.persistedStreams)this.persistedStreams.add(`${t.runId}:${t.streamId}`);for(;this.persistedStreams.size>256;){let e=this.persistedStreams.values().next().value;if(e===void 0)break;this.persistedStreams.delete(e)}}},Yh=R(`<div class="bg-background h-screen overflow-hidden"><!> <!></div>`),Xh=R(`<button type="button" class="text-muted-foreground hover:text-foreground hover:bg-muted absolute top-3 right-3 z-100 inline-flex items-center justify-center rounded-md p-2 transition" aria-label="Open side panel"><!></button>`),Zh=R(`<div role="alert" class="text-destructive mb-3 flex items-center justify-between gap-3 rounded-md border border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"><span> </span> <!></div>`),Qh=R(`<div class="text-muted-foreground mb-3 text-sm">Loading models…</div>`),$h=R(`<!> <!> <!>`,1),eg=R(`<div><!></div>`),tg=R(`<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 ng(t,r){z(r,!0);let d=()=>oe(he,`$convexAuthUserId`,v),f=()=>oe(Ce,`$convexAuthRetryPending`,v),h=()=>oe(Se,`$authState`,v),[v,w]=ie(),T=ze(),D=Le(),O=g(!1),k=e(d),A=e(()=>!!o(k)),M=e(f),N=e(()=>h().nativeSession===`loading`),ee=e(()=>h().nativeSession===`missing`||h().nativeSession===`mismatch`||h().nativeSession===`unavailable`),P=e(()=>h().nativeSession===`missing`||h().nativeSession===`mismatch`),L=e(()=>h().isReady&&!h().isLoading&&o(A)&&(h().nativeSession===`notRequired`||h().nativeSession===`ready`)&&!T.isLoading&&T.isAuthenticated),R=e(()=>o(A)&&h().isReady&&!h().isLoading&&!o(M)&&!T.isLoading&&!T.isAuthenticated),ne=e(()=>o(R)||o(ee));c(()=>{let e=Ee({retryPending:o(M),isAuthenticated:T.isAuthenticated,isLoading:T.isLoading,sawLoadingDuringRetry:o(O)});o(O)!==e.sawLoadingDuringRetry&&C(O,e.sawLoadingDuringRetry,!0),e.clearPending&&Ce.set(!1)});let H=Ve(ve.threads.setSelectedModel),ae=Ve(ve.agentQuestions.answer),W=Ve(ve.uiPreferences.setTheme),se=Ve(ve.billing.ensureMySubscription),ce=g(void 0),le=g(null),ue=g(!0);async function fe(){C(ue,!0);try{let e=We.data.env.PUBLIC_MODEL_GATEWAY_URL?.trim()??``;C(ce,await ji(e),!0),C(le,null)}catch{C(le,xi,!0),C(ce,void 0)}finally{C(ue,!1)}}let pe=null;c(()=>{if(!o(L))return;let e=$();!e||pe===e||(pe=e,se({}).catch(()=>{}))});let G=`Connect to a running Sprocket server to use this project.`,K=3e4,q=g(null),De=g(!1),ke=g(null),Ae=g(null),J=g(null),je=g(null),Ne=g(l(vi)),Fe=g(l(yi)),Ie=g(!1),Re=g(``),Be=g(null),He=g(!1),Y=g(null),Ge=g(!1),Ye=g(l([])),X=g(null),Xe=new vt,Ze=new vt,Qe=new vt,$e=new vt,et=g(l({})),tt=0,nt=0,rt=g(!1),it=g(null),at=null,ot=g(0),st=g(null),ct=g(l({})),lt=g(!1),ut=0,dt=g(!1),ft=g(`loading`),pt=g(l([])),Z=0,mt=0,ht=g(null),gt=g(!1),yt=g(`add`),St=g(void 0),Ct=g(null),wt=g(!1),Tt=g(`account`),Et=g(l([])),Dt=g(!1),Q=g(!1),Ot=new vt,kt=g(null);function $(){return o(k)}function At(e,t){return o(Ye).find(t=>t.localId===e)?(C(Ye,o(Ye).map(n=>n.localId===e?{...n,...t}:n),!0),!0):!1}function jt(e){try{let t=e.api??o(q),n=e.userId??$();if(!t||!n)return;t.discardTranscriptAttachment({userId:n,storageId:e.storageId,threadId:e.threadId??void 0}).catch(()=>{})}catch{return}}async function Mt(e,t,n){let r=o(q),i=$(),a=o(J);try{if(!r)throw Error(G);if(!i)throw Error(`Sign in to attach files.`);let s=await r.uploadTranscriptAttachment({userId:i,name:n,file:t,threadId:a??void 0});if(`error`in s)throw Error(s.error);ra(o(Ye).find(t=>t.localId===e)?.previewUrl),At(e,{status:`ready`,storageId:s.storageId,name:s.name,mediaType:s.mediaType,size:s.size,previewUrl:$i(s.mediaType)?s.url:void 0})||jt({api:r,userId:i,threadId:a,storageId:s.storageId})}catch(t){let n=t instanceof Error?t.message:`Upload failed.`;At(e,{status:`error`,error:n}),C(X,n,!0)}}function Nt(e){for(let t of e){let e=crypto.randomUUID(),n=ta(t),r=ea(t.type);C(Ye,[...o(Ye),{localId:e,name:n,mediaType:r,size:t.size,previewUrl:$i(r)?URL.createObjectURL(t):void 0,status:`uploading`}],!0),Mt(e,t,n)}}function Pt(e){let t=o(Ye).find(t=>t.localId===e);t&&(ra(t.previewUrl),C(Ye,o(Ye).filter(t=>t.localId!==e),!0),t.storageId&&jt({storageId:t.storageId,userId:$(),threadId:o(J)}))}function Ft(e){let t=e.userId===void 0?$():e.userId,n=e.threadId===void 0?o(J):e.threadId;for(let r of o(Ye))ra(r.previewUrl),e.discard&&r.storageId&&jt({userId:t,threadId:n,storageId:r.storageId});C(Ye,[],!0)}function It(e,t){return e?`thread:${e}`:t?`draft:${t}`:null}function Lt(e,t){Xe.get(e)===t&&Xe.delete(e)}function Rt(e,t){return`${e}\0${t}`}function zt(e,t,n){Ze.set(Rt(e,t),n)}function Bt(e,t){let n=Rt(e,t);Ze.delete(n),Qe.delete(n)}function Vt(){return o(k)&&T.isAuthenticated&&!T.isLoading?{}:`skip`}let Ht=Ue(ve.uiPreferences.getMine,Vt),Ut=g(l(qe(null))),Wt=!1,Gt,Kt=null,qt=0;c(()=>{if(!o(L)){Wt=!1,Gt=void 0,Kt=null,qt=0;return}let e=Ht.data;if(e===void 0||Kt!==null)return;let t=e?.theme;if(Wt&&t===Gt)return;Wt=!0,Gt=t;let n=qe(t);C(Ut,n,!0),Ke(n)});async function Jt(e){let t=o(Ut),n=++qt;Kt=e,C(Ut,e,!0),Ke(e);try{if(await W({theme:e}),n!==qt)return;Gt=e}catch(e){if(n!==qt)return;C(Ut,t,!0),Ke(t),C(X,e instanceof Error?e.message:`Failed to save theme preference.`,!0)}finally{n===qt&&(Kt=null)}}let Yt=()=>o(J)&&Vt()!==`skip`?{threadId:o(J)}:`skip`,Xt=Ue(ve.threads.getByThreadId,Yt),Zt=Ue(ve.chat.selectedThreadLifecycle,Yt),Qt=Ue(ve.browserSessions.liveViewForThread,Yt),$t=Ue(ve.agentQuestions.headPendingForThread,Yt),en=e(()=>{for(let e of[Ht,Xt,Zt,Qt,$t])if(e.error)return e.error;return null}),tn=e(()=>Object.values(o(ct)).sort((e,t)=>t.lastUsedAt-e.lastUsedAt).map(Mh)),nn=e(()=>o(pt).map(Za)),rn=e(()=>co(Xt.data,o(J))),an=e(()=>{let e=o(ce)?Si(o(ce),o(Ne))??Si(o(ce),o(ce).defaultModelId):void 0;return{inputTokens:o(rn)?.contextTokens??0,totalTokensProcessed:o(rn)?o(rn).totalTokensProcessed:0,contextWindowTokens:e?.contextWindowTokens??0,autoHandoffTokenLimit:e?.autoHandoffTokenLimit??0}}),on=e(()=>co(Zt.data,o(J))),sn=e(()=>co($t.data,o(J))),cn=g([]),ln=g(null),un=g(0),dn=g(!1),fn=g(null),pn=g(!1),mn=g(null),hn=0,gn=g(null),_n=null,vn=g(!1),yn=g(null),bn=g([]);function xn(e){hn+=1,_n?.abort(),_n=null,o(gn)?.stop(),C(gn,null),C(vn,!1),C(fn,e,!0),C(yn,null),C(bn,[]),C(mn,null),C(cn,[]),C(ln,null),C(un,0),C(dn,!1),C(pn,e!==null)}b(()=>{let e=o(J);o(fn)!==e&&_(()=>xn(e))}),c(()=>{let e=o(J),t=o(q);if(!e||!t||!o(A))return;let n=_(()=>$());if(!n)return;let r=new AbortController,i=e;_n=r;let a=hn,s=new Jh(e=>t.fetchTranscriptDisplay({userId:n,threadId:i,...e},r.signal),()=>{if(r.signal.aborted||hn!==a)return;C(cn,s.messages),C(ln,s.nextBefore??null,!0),C(un,s.windowVersion,!0),C(dn,s.stale,!0),C(pn,s.loading,!0),C(vn,s.loadingOlder,!0),C(mn,s.error,!0);let e=o(bn).length;C(bn,s.unpersisted([...o(bn),...o(yn)?[o(yn)]:[]]).filter(e=>e!==o(yn))),o(bn).length>0&&o(bn).length<e&&s.refresh()});return C(gn,s),s.refresh(),(async()=>{for(;!r.signal.aborted;){try{await t.watchTranscript({userId:n,threadId:i},{signal:r.signal,onEvent:e=>{r.signal.aborted||o(J)!==i||(C(dn,e.stale,!0),s.refresh())}})}catch{r.signal.aborted||C(dn,!0)}r.signal.aborted||await new Promise(e=>setTimeout(e,1e3))}})(),()=>{r.abort(),s.stop()}}),c(()=>{let e=o(J),t=o(q);if(!e||!t||!o(A))return;let n=_(()=>$());if(!n)return;let r=new AbortController,i=e;return(async()=>{for(;!r.signal.aborted;){try{await t.watchLiveCompletion({userId:n,threadId:i},{signal:r.signal,onEvent:e=>{r.signal.aborted||o(J)!==i||(o(yn)&&(e.eventType===`cleared`||e.live.streamId!==o(yn).streamId)&&(o(gn)?.unpersisted([o(yn)]).length&&C(bn,[...o(bn),o(yn)]),o(gn)?.refresh()),e.eventType===`updated`?C(yn,e.live):C(yn,null))}})}catch{if(r.signal.aborted)return}if(r.signal.aborted)return;await new Promise(e=>{let t=setTimeout(e,400);r.signal.addEventListener(`abort`,()=>{clearTimeout(t),e()},{once:!0})})}})(),()=>{r.abort()}}),c(()=>{let e=[...o(bn),...o(yn)?[o(yn)]:[]],t=o(gn);_(()=>t?.setOverlays(e))});let Sn=e(()=>{let e=$();if(!o(J)||!e||o(fn)!==o(J))return[];let t=o(gn)?.visibleOverlays([...o(bn),...o(yn)?[o(yn)]:[]])??[],n=Gh(t.filter(e=>e.threadId===o(J)));return[...qh(o(cn),t),...n.map(e=>e.runId===o(Dn)?.runId?{...e,runStartedAt:o(Dn).startedAt,runCompletedAt:o(Dn).completedAt}:e)]}),Cn=e(()=>o(ke)?$a(o(tn),o(ke)):o(Ae)?Qa(o(tn),o(Ae)):null),wn=e(()=>o(Cn)?.workspacePath??o(ke)),Tn=e(()=>{let e=o(Cn)?.workspacePath??null,t=o(q);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}}}),En=e(()=>o(Cn)?.repositoryKey?o(nn).filter(e=>e.repositoryKey===o(Cn).repositoryKey&&eo(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt):[]),Dn=e(()=>o(on)?.run??null),On=[],kn=0,An=g(l({...hp})),jn=g(!1),Mn=g(null),Nn=e(()=>o(An).artifacts.map(vp)),Pn=new vt,Fn=g(l({...Tp})),In=null,Ln=null,Rn=null;c(()=>{let e=o(J),t=o(Ae),n=o(ke),r=o(k),i=r&&t?gp({userId:r,repositoryKey:t,workspacePath:n??``,threadId:e}):null;i!==In&&(In&&Pn.set(In,o(Fn)),In=i,C(kt,null),C(Fn,{...i&&Pn.get(i)||Tp},!0))}),c(()=>{let e=o(q),t=o(Ae),n=o(ke),r=o(J),i=o(k),a=T.isAuthenticated&&!T.isLoading,s=++kn;if(C(jn,!1),C(An,{...hp},!0),Ln=null,!t||!i){C(Mn,null);return}let c={userId:i,repositoryKey:t,workspacePath:n??``,threadId:r},l=gp(c);C(Mn,l,!0);let u=new AbortController,d=_p(c),f={artifacts:[],stale:!0,error:null},p=null,m=()=>{u.signal.aborted||s!==kn||(C(An,wp(f,p),!0),(!o(An).stale||o(An).artifacts.length>0)&&C(jn,!0))},h={userId:i,repositoryKey:t};r&&(h.threadId=r);let g=a?Or(D,h,e=>{f=e,m()}):()=>{};return(async()=>{for(;e&&n&&!u.signal.aborted;)await e.watchArtifacts(d,{signal:u.signal,onEvent:e=>{Sp({aborted:u.signal.aborted,generation:s,currentGeneration:kn,eventScopeKey:l,currentScopeKey:o(Mn)})&&(p=Cp(e),m())}}).catch(()=>void 0),!u.signal.aborted&&s===kn&&o(Mn)===l&&(p=null,m()),u.signal.aborted||await new Promise(e=>setTimeout(e,1e3))})(),()=>{u.abort(),g()}}),c(()=>{let e=o(Mn),t=o(jn),n=o(An).artifacts;if(!e||!t){Ln&&Ln.scopeKey!==e&&(Ln=null);return}Ln&&Ln.scopeKey!==e&&(Ln=null);let r=n.map(yp),{revisions:i,changedId:a}=xp(Ln?.revisions??null,r);if(Ln={scopeKey:e,revisions:i},!a)return;let s=_(()=>o(Fn));C(Fn,{...s,open:!0,tab:s.open?s.tab:`artifacts`,selectedKey:!s.open||s.selectedKey===null?a:s.selectedKey},!0)}),c(()=>{let e=o(J),t=Qt.data,n=o(Wn)?o(Dn)?.runId??null:null;if(!e){Rn=null;return}if(Rn&&Rn.threadId!==e&&(Rn=null),t===void 0)return;let r=t?.lastUsedRunId??null,i=Rn;if(Rn={threadId:e,runId:r},r===null||r!==n||i&&i.runId===r)return;let a=_(()=>o(Fn));a.open&&a.tab===`live`||C(Fn,{...a,open:!0,tab:`live`},!0)});let zn=e(()=>o(Nn).find(e=>e.key===o(kt))??null),Bn=e(()=>It(o(J),o(wn))),Vn=e(()=>{let e=$();if(!(!e||!o(Bn)))return Qe.get(Rt(e,o(Bn)))}),Hn=e(()=>o(on)?.phase===`queued`&&o(Vn)!=null),Un=e(()=>o(on)!=null&&Uh(o(on).phase)&&!o(Hn)),Wn=e(()=>o(Un)&&o(on)?.phase!==`cancellation_requested`),Gn=e(()=>o(Un)?xt(o(Dn)?.startedAt,bt()):void 0),Kn=e(()=>no(o(tn),o(nn))),Jn=e(()=>fo(o(et),o(J))),Yn=e(()=>o(Jn)||o(Un)?null:Ph(o(on)?.phase??`idle`,o(on)?.run?.lastError)),Xn=e(()=>uo({threadId:o(J),pendingCreatedThreadId:o(st),hasLatestRunData:!!o(on)})),Zn=e(()=>!!(o(Bn)&&Xe.has(o(Bn)))),Qn=e(()=>!!(o(wn)&&o(Cn)?.localAttachmentAvailability===`available`&&!o(Zn)&&!o(He)&&!o(Jn)&&(!o(Un)&&o(Xn)||o(sn)))),$n=e(()=>{let e=new _t,t=[];for(let n of Object.values(o(ct))){if(n.availability!==`available`||e.has(n.workspacePath))continue;e.add(n.workspacePath);let r=n.workspacePath.split(/[/\\]/).filter(Boolean).at(-1)??n.workspacePath;t.push({workspacePath:n.workspacePath,displayName:r})}return t.sort((e,t)=>t.displayName.localeCompare(e.displayName))});async function er(){let e=++ut,t=await Lh(o(q));e===ut&&(C(ct,t,!0),C(lt,!0),await tr(t),await sr())}async function tr(e){if(Vt()!==`skip`)for(let t of Object.values(e)){let n=t.previousRepositoryKey;!n||n===t.repositoryKey||(!Object.values(e).some(e=>e.workspacePath!==t.workspacePath&&e.repositoryKey===n)&&Vt()!==`skip`&&await ir(n,t.repositoryKey),o(ke)===t.workspacePath&&C(Ae,t.repositoryKey,!0),await ur(t.workspacePath))}}function nr(){let e=o(q),t=$();if(!e||!t)throw Error(`The local Sprocket service is not ready.`);return{api:e,userId:t}}async function rr(){let e=o(q),t=$();e&&t&&await e.endAccountSession({userId:t}).catch(()=>{}),await xe()}async function ir(e,t){let{api:n,userId:r}=nr();await n.rekeyRepository({userId:r,from:e,to:t}),await or(r)}function ar(e){C(ft,e.status,!0),e.status!==`loading`&&C(dt,!0)}async function or(e){let t=o(q);if(!t)return;let n=++mt,r=await t.fetchThreadSnapshot({userId:e});n===mt&&$()===e&&(C(pt,r.threads,!0),ar(r))}async function sr(e=o(J)){let t=o(q),n=$();if(!t||!n||$()!==n)return;let r={userId:n};e&&(r.selectedThreadId=e);let i=await t.registerThreadCache(r);$()===n&&(ar(i),await or(n))}c(()=>{let e=o(q),t=o(k);if(!e||!t||!o(L))return;let n=++Z,r=new AbortController;return(async()=>{try{try{await sr()}catch{await or(t)}if(n!==Z||r.signal.aborted)return;await e.watchThreadCache({userId:t},{signal:r.signal,onEvent:e=>{n===Z&&$()===t&&(ar(e),(e.status===`live`||e.status===`reconnecting`)&&or(t))}})}catch(e){if(n!==Z||$()!==t)return;C(ft,`error`),C(dt,!0),C(X,e instanceof Error?e.message:`Could not sync threads.`,!0)}})(),()=>{r.abort()}}),c(()=>{let e=o(q),t=o(k),n=o(J);!e||!t||!o(L)||sr(n).catch(()=>{})});function cr(e,t=null,n=!1){let r=$a(o(tn),e);C(ke,e,!0),C(Ae,r?.repositoryKey??null,!0),C(J,t,!0),C(je,n?e:null,!0),t!==o(st)&&C(st,null)}function lr(e,t=null,n=!1,r=!1){C(ot,o(ot)+1),r||C(X,null),cr(e,t,n)}async function ur(e,t){if(!o(q))throw Error(G);let n=await Rh({desktopApi:o(q),workspacePath:e,replaceWorkspacePath:t});ut+=1;let r={...o(ct),[n.workspacePath]:n};return t&&t!==n.workspacePath&&delete r[t],C(ct,r,!0),C(lt,!0),n}function dr(e,t={}){let n=$a(o(tn),e);if(!n){C(X,`Choose a project first.`);return}lr(e,t.threadId,t.draft);let r=o(ot);yr(n.workspacePath).catch(e=>{r===o(ot)&&C(X,e instanceof Error?e.message:`Failed to attach project.`,!0)})}function fr(e=`add`,t=null){if(!o(q)){C(X,G);return}C(yt,e,!0),C(Ct,t,!0);let n=e===`reconnect`&&t?$a(o(tn),t):void 0;C(St,n?.displayName,!0),C(gt,!0),C(X,null)}async function pr(e){if(!o(q)){C(X,G);return}let t=$();if(!t){C(X,`User session is not ready.`);return}try{if(o(yt)===`reconnect`&&o(Ct)){await hr(e,o(Ct),t);return}await mr(e,t)}catch(e){if($()!==t)return;throw C(X,e instanceof Error?e.message:`Failed to attach project.`,!0),e}}async function mr(e,t){await ur(e.workspacePath),$()===t&&(lr(e.workspacePath,null,!0),C(X,null))}async function hr(e,t,n){let r=$a(o(tn),t);if(await ur(e.workspacePath,t===e.workspacePath?void 0:t),$()!==n)return;r&&r.repositoryKey!==e.repositoryKey&&Vt()!==`skip`&&!o(tn).some(t=>t.workspacePath!==e.workspacePath&&t.repositoryKey===r.repositoryKey)&&await ir(r.repositoryKey,e.repositoryKey);let i=r?.repositoryKey===e.repositoryKey?o(J):null;lr(e.workspacePath,i),C(X,null)}function gr(e){let t=e?.trim();t&&C(Et,[...o(Et),t],!0)}async function _r(){let e=window.sprocketDesktopBridge;if(e?.takeWorkspaceLaunch)for(;;){let t=await e.takeWorkspaceLaunch();if(!t)return;gr(t)}}async function vr(e,t,n){let r=await t.resolveWorkspacePath({workspacePath:e});$()===n&&await mr(r,n)}async function yr(e){await zh({desktopApi:o(q),refreshDesktopProjectAttachments:er,workspacePath:e})}function br(e){fr(`reconnect`,e)}async function xr(e){let t=o(J),n=$();if(!(!t||!n))try{await H({threadId:t,selectedModel:e}),$()===n&&or(n)}catch(e){o(J)===t&&$()===n&&C(X,e instanceof Error?e.message:`Failed to save the selected model.`,!0)}}function Sr(e){dr(e,{draft:!0})}function Cr(e,t){dr(t,{threadId:e.threadId})}async function wr(e,t){try{let{api:n,userId:r}=nr();await n.renameThread({userId:r,threadId:e,title:t})||C(ft,`reconnecting`),await or(r)}catch(e){C(X,e instanceof Error?e.message:`Failed to rename thread.`,!0)}}async function Tr(){await o(gn)?.loadOlder()}async function Er(e){let t=o(q),n=o(J),r=$();if(!t||!n||!r)return null;let i=await t.fetchTranscriptAttachment({userId:r,threadId:n,storageId:e});return i?URL.createObjectURL(i):null}async function Dr(e,t,n){let r=o(q),i=o(J),a=$();if(!r||!i||!a||e.threadId!==i)throw Error(`Thread is no longer selected.`);return await r.fetchTranscriptDisplayDetails({userId:a,threadId:i,rowId:e.id,...t},n)}async function kr(e){let t=$();try{let{api:n,userId:r}=nr();if(await n.archiveThread({userId:r,threadId:e})||C(ft,`reconnecting`),await or(r),t){Bt(t,`thread:${e}`);let n=o(q);n&&await n.clearTranscriptReplica({userId:t,threadId:e})}$()===t&&(o(J)===e&&(C(J,null),C(ot,o(ot)+1)),C(X,null))}catch(e){if($()!==t)return;C(X,e instanceof Error?e.message:`Failed to archive thread.`,!0)}}async function Ar(e){try{let{api:t,userId:n}=nr();await t.restoreThread({userId:n,threadId:e})||C(ft,`reconnecting`),await or(n)}catch(e){C(X,e instanceof Error?e.message:`Failed to restore thread.`,!0)}}async function Mr(){let e=o(sn),t=o(J),n=$();if(!e||!t||!n||o(He)||!o(Be)&&!o(Re).trim())return;C(He,!0),C(X,null);let r=o(Re),i=o(Be),a=r.trim(),s=o(Ye).map(e=>({...e})),c=s.flatMap(e=>e.storageId?[e.storageId]:[]),l=o(Ne),u=o(Fe),d=o(Ie),f=null,p;C(Re,``),C(Be,null);try{let n={threadId:t,questionId:e.questionId,optionId:i??void 0,text:a||void 0},r=await ae(n);r.continuation&&(f=r.continuation.prompt,p=r.continuation.runId)}catch(n){o(J)===t&&o(sn)?.questionId===e.questionId&&(C(Re,r,!0),C(Be,i,!0),C(X,n instanceof Error?n.message:String(n),!0))}finally{C(He,!1)}if(f!==null&&o(J)!==t){zt(n,`thread:${t}`,{message:`Continuing from your answer when you return to this thread.`,prompt:f,attachments:s,storageIds:c,reasoningEffort:u,fastMode:d,selectedModel:l,continuationOfRunId:p,autoSubmit:!0});return}f!==null&&(C(Y,p??null,!0),C(Re,f,!0),await Nr({answeredQuestionId:e.questionId,continuationOfRunId:p}))}async function Nr(e){if(o(sn)){if(e?.answeredQuestionId&&o(sn).questionId!==e.answeredQuestionId){C(X,`Answer the new agent question before continuing.`);return}if(!e?.answeredQuestionId){await Mr();return}}if(o(Zn)||!o(Re).trim()&&o(Ye).length===0)return;if(o(Ye).some(e=>e.status!==`ready`)){C(X,`Wait for file uploads to finish, or remove failed files before sending.`);return}let t=o(wn);if(!t){C(X,`Choose a project first.`);return}if(!o(q)){C(X,G);return}if(o(J)&&!o(Xn)){C(X,`Loading thread state before sending.`);return}if(!o(Qn)){C(X,o(Un)||o(Jn)||o(Zn)?`Wait for the current agent launch or run to finish.`:o(Cn)?.localAttachmentAvailability===`available`?`You need an active project before sending.`:`This project needs to be attached before sending.`,!0);return}let n=o(J),r=o(Ae);if(!r){C(X,`Choose a project first.`);return}let i=!1,a=$();if(!a){C(X,`User session is not ready.`);return}let s=()=>$()===a,c=o(Re).trim(),l=o(Ye).map(e=>({...e})),u=l.flatMap(e=>e.storageId?[e.storageId]:[]),d=o(Ne),f=o(Fe),p=o(Ie),m=e?.continuationOfRunId??o(Y)??void 0,h=n?o(Dn)?.runId??null:null,g=n?`thread:${n}`:`draft:${t}`,_=g,v=_,y=Rt(a,_),b=Qe.get(y),x=crypto.randomUUID(),S=Nh({latestRun:!n||!o(on)||o(on).phase===`idle`?null:{runId:o(Dn)?.runId,status:Uh(o(on).phase)?`queued`:`completed`,submissionId:o(Vn)?.submissionId??``},newSubmissionId:x,prompt:c,storageIds:u,reasoningEffort:f,fastMode:p,continuationOfRunId:m,recoveredSubmission:b?{...b,selectedModel:b.selectedModel}:void 0,selectedModel:d}),w=S;Bt(a,_);let T=null,E=null,D=++nt,O=Rt(a,_);$e.set(O,D);let k=()=>$e.get(O)===D,A=`Your session changed before the agent started. Return to this account and send the prompt again.`,j=`This request is still preparing. Wait for it to finish before trying again.`,M=e=>{zt(a,v,{message:e,prompt:c,attachments:l,storageIds:u,reasoningEffort:f,fastMode:p,selectedModel:d,continuationOfRunId:m,autoSubmit:!1,submissionId:!n&&v===_?S:w})},N=()=>{Bt(a,v),s()&&o(X)===j&&C(X,null)},ee=window.setTimeout(()=>{$e.get(O)===D&&(M(j),Lt(g,D),$e.delete(O))},K);C(Re,``),C(X,null),Xe.set(g,D);try{if(!n){let e=await o(q).resolveWorkspacePath({workspacePath:t});if(!k())return;if(e.repositoryKey!==r){if(await ur(e.workspacePath),!k()||(!o(tn).some(t=>t.workspacePath!==e.workspacePath&&t.repositoryKey===r)&&Vt()!==`skip`&&await ir(r,e.repositoryKey),!k()))return;r=e.repositoryKey,C(Ae,e.repositoryKey,!0),i=!0}}let e=n;if(!k())return;if(!s()){M(A);return}if(T=e,!k())return;if(!s()){M(A);return}N();let l=++tt;E=l;let g={expiresAt:Date.now()+K,launchId:l,previousRunId:h};o(Dn)?.startedAt&&(g.previousStartedAt=o(Dn).startedAt),e&&C(et,po(o(et),e,g),!0),e&&window.setTimeout(()=>{let t=o(J)===e?o(Dn)?.runId??null:null,n=o(J)===e&&o(Dn)?.runId===t?o(Dn)?.startedAt:void 0,r=_o(o(et),e,l,Date.now(),t,void 0,n);r.pendingLaunches!==o(et)&&(C(et,r.pendingLaunches,!0),r.shouldRecover&&M(`The local agent did not start. Please try again.`))},K),await Fh({userId:a,desktopApi:o(q),onError:t=>{if(!(!k()||!s())){if(e){let t=mo(o(et),e,l);t!==o(et)&&C(et,t,!0)}M(t instanceof Error?t.message:`Failed to start the local agent run.`)}},onStarted:(e,t)=>{!k()||!s()||(n||(T=t,C(st,t,!0),C(ot,o(ot)+1),C(J,t,!0),C(je,null),or(a),i&&Ot.set(t,`This directory’s git remote changed. Existing threads now follow the new repository.`)),Ft({discard:!1}),o(Y)===m&&(C(Y,null),C(Ge,!1)))},threadId:e??void 0,repositoryKey:e?void 0:r,prompt:c,storageIds:u,selectedModel:d,submissionId:w,reasoningEffort:f,fastMode:p,workspacePath:t,continuationOfRunId:m})}catch(e){if(T&&E!==null&&C(et,mo(o(et),T,E),!0),!k())return;if(!s()){M(A);return}M(e instanceof Error?e.message:`Failed to send prompt.`),er().catch(()=>{})}finally{window.clearTimeout(ee),Lt(g,D),E===null&&$e.get(O)===D&&$e.delete(O)}}async function Pr(){if(!(!o(Dn)?.runId||!o(Un)))try{let{api:e,userId:t}=nr();await e.requestRunCancellation({userId:t,runId:o(Dn).runId})}catch(e){C(X,e instanceof Error?e.message:`Failed to cancel run.`,!0)}}async function Fr(){if(!o(Yn)||!o(Dn)||!o(J)||!o(wn)||o(Jn)||o(Zn))return;if(!o(q)){C(X,G);return}let e=o(J),t=o(wn),n=$();if(!t||!n)return;let r=o(Dn).runId,i=o(Dn).startedAt,a=++tt,s={expiresAt:Date.now()+K,launchId:a,previousRunId:r,previousStartedAt:i};C(et,po(o(et),e,s),!0);try{if($()!==n)throw Error(`User session is not ready.`);await Fh({userId:n,desktopApi:o(q),onError:t=>{C(et,mo(o(et),e,a),!0),C(X,t.message,!0)},onStarted:()=>{},threadId:e,prompt:``,storageIds:[],selectedModel:o(Ne),reasoningEffort:o(Fe),fastMode:o(Ie),submissionId:crypto.randomUUID(),workspacePath:t,continuationOfRunId:r})}catch(t){C(et,mo(o(et),e,a),!0),C(X,t instanceof Error?t.message:`Failed to continue the run.`,!0)}}c(()=>{let e=$();if(o(ht)===e)return;let t=o(ht),n=o(J);C(ht,e,!0),C(rt,!1),C(ke,null),C(Ae,null),C(J,null),C(je,null),C(st,null),C(et,{},!0),C(it,null),pe=null,at=null,C(dt,!1),C(ft,`loading`),C(pt,[],!0),mt+=1,C(ot,o(ot)+1),C(Re,``),C(Y,null),C(Ge,!1),Ft({discard:!0,userId:t,threadId:n}),C(X,null),C(Ne,o(ce)?.defaultModelId??`gpt-5.6-sol`,!0),C(Fe,o(ce)?.defaultReasoningEffort??`high`,!0),C(Ie,!1),C(gt,!1),C(Ct,null),C(St,void 0),Pn.clear(),In=null,C(Fn,{...Tp},!0),C(kt,null),Ln=null}),c(()=>{if(!o(st))return;let e=lo({pendingCreatedThreadId:o(st),threads:o(pt).map(Za)});e!==o(st)&&C(st,e,!0)}),c(()=>{let e=o(Et)[0],t=o(q),n=$();!e||o(Dt)||!o(L)||!t||!n||!o(lt)||(C(Et,o(Et).slice(1),!0),C(Dt,!0),C(rt,!0),C(it,null),C(gt,!1),C(wt,!1),C(X,null),vr(e,t,n).catch(e=>{$()===n&&(C(rt,!1),C(X,e instanceof Error?e.message:`Failed to open the requested project.`,!0))}).finally(()=>{C(Dt,!1)}))}),c(()=>{let e=o(rn),t=e?._id??null;t!==at&&(at=t,C(Y,null),C(Ge,!1),e&&(C(Ne,e.selectedModel,!0),C(Fe,e.reasoningEffort,!0),C(Ie,e.fastMode??!1,!0)))}),c(()=>{let e=$(),t=It(o(J),o(wn));if(!e||!t)return;let n=Rt(e,t),r=Ze.get(n);if(!r||r.autoSubmit&&o(Re)!==``&&o(Re)!==r.prompt)return;Ze.delete(n);let i=o(Re)===``;i&&C(Re,r.prompt,!0),o(Ye).length===0&&r.attachments?.length&&(i||o(Re)===r.prompt)&&C(Ye,r.attachments.map(e=>({...e})),!0),o(Re)===r.prompt&&(C(Y,r.continuationOfRunId??null,!0),C(Ge,r.autoSubmit===!0&&r.continuationOfRunId!==void 0,!0),r.submissionId&&(r.prompt||r.storageIds?.length)&&r.reasoningEffort&&r.selectedModel&&Qe.set(n,{prompt:r.prompt,storageIds:r.storageIds??[],reasoningEffort:r.reasoningEffort,fastMode:r.fastMode??!1,selectedModel:r.selectedModel,submissionId:r.submissionId,continuationOfRunId:r.continuationOfRunId})),C(X,r.message,!0)}),c(()=>{!o(Ge)||!o(Y)||!o(Qn)||o(sn)||!o(q)||!o(Re).trim()||o(Ye).some(e=>e.status!==`ready`)||(C(Ge,!1),Nr())}),c(()=>{if(o(rt)||!o(Q)||o(Et).length>0||o(Dt)||!o(lt)||!o(dt))return;C(rt,!0);let e=new Set(o(tn).map(e=>e.repositoryKey)),t=so(o(nn).filter(t=>e.has(t.repositoryKey)));if(t){let e=Qa(o(tn),t.repositoryKey);if(e){lr(e.workspacePath,t.threadId,!1,!0),C(it,e.workspacePath,!0);return}}o(tn)[0]&&(lr(o(tn)[0].workspacePath,null,!1,!0),C(it,o(tn)[0].workspacePath,!0))}),c(()=>{let e=o(it);if(!e||!o(q)||!o(lt))return;if(!$a(o(tn),e)){C(it,null);return}C(it,null);let t=o(ot);yr(e).catch(e=>{t===o(ot)&&C(X,e instanceof Error?e.message:`Failed to attach project.`,!0)})}),c(()=>{let e=o(J)?oo(o(nn),o(J)):null,t=o(Cn)?.repositoryKey===e?.repositoryKey?o(Cn):Qa(o(tn),e?.repositoryKey);t&&t.workspacePath!==o(ke)&&lr(t.workspacePath,o(J),o(je)===t.workspacePath)}),c(()=>{let e=o(En);if(!o(rt)||!o(ke))return;let t=vo({threads:e,currentThreadId:o(J),currentWorkspacePath:o(ke),draftWorkspacePath:o(je)});t!==o(J)&&lr(o(ke),t,o(je)===o(ke),!0)}),c(()=>{let e=o(et);o(J)&&o(Dn)?.runId&&(e=go(e,o(J),o(Dn).runId,void 0,o(Dn).startedAt)),e!==o(et)&&C(et,e,!0)}),re(()=>{fe();let e=window.sprocketDesktopBridge,t=e?.onWorkspaceLaunch?e.onWorkspaceLaunch(()=>{_r()}):void 0,n=Pe();return n&&(gr(n),Me()),e?.takeWorkspaceLaunch?_r().finally(()=>{C(Q,!0)}):C(Q,!0),Oe().then(async e=>{C(q,e,!0),await ge(),C(De,!0),er().catch(e=>{C(X,e instanceof Error?e.message:`Failed to load local project attachments.`,!0)})}).catch(e=>{C(X,e instanceof Error?e.message:`Failed to connect to the Sprocket server.`,!0),C(De,!0)}),()=>t?.()});var Lr=m();E(`1uha8ag`,e=>{n(()=>{S.title=`Sprocket`})});var Rr=u(Lr),zr=e=>{Je(e,{title:`Connecting to Sprocket…`,description:`Looking for a running Sprocket server on this machine.`,busy:!0})},Br=t=>{{let n=t=>{{let n=e(()=>me(`/pair`));jr(t,{get href(){return o(n)},children:(e,t)=>{V();var n=te(`Open pairing`);i(e,n)},$$slots:{default:!0}})}},r=e(()=>o(X)??`Connect to your Sprocket server to continue.`);Je(t,{title:`Connect to Sprocket`,get description(){return o(r)},actions:n,$$slots:{actions:!0}})}},Vr=t=>{var n=Yh(),r=s(n);{let t=e(()=>({isLoading:!h().isReady||h().isLoading||o(N)||o(M)||o(A)&&T.isLoading,isConfigured:h().isConfigured,isAuthenticated:o(A),connectionFailed:o(ne),error:h().error})),n=e(()=>o(P)?`Finish sign-in`:`Retry`);Ir(r,{get authState(){return o(t)},get overlayOpen(){return h().isWaitingForBrowserSignIn},onSignIn:()=>void we(),onSignOut:()=>void rr(),onRetry:()=>void(o(P)?we():_e()),get retryLabel(){return o(n)},onSignUp:()=>void ye()})}qr(U(r,2),{get open(){return h().isWaitingForBrowserSignIn},get signInUrl(){return h().browserSignInUrl},get error(){return h().error},get onCancel(){return Te},get onClearOpenError(){return be}}),I(n),i(t,n)},Hr=t=>{var n=tg(),r=s(n),c=s(r),l=e=>{Ho(e,{get activePage(){return o(Tt)},get theme(){return o(Ut)},onThemeChange:e=>void Jt(e),onBack:()=>{C(wt,!1),C(Tt,`account`)},onNavigate:e=>{C(Tt,e,!0)}})},d=e=>{_m(e,{get currentWorkspacePath(){return o(ke)},get currentThreadId(){return o(J)},get groups(){return o(Kn)},get pendingAgentLaunches(){return o(et)},get theme(){return o(Ut)},onThemeChange:e=>void Jt(e),onAddProject:()=>{fr(`add`)},onReconnectProject:e=>{br(e)},onOpenSettings:()=>{C(Tt,`account`),C(wt,!0)},onStartThreadDraft:Sr,onSelectThread:Cr,onSelectProject:e=>{dr(e)},onRenameThread:(e,t)=>{wr(e,t)},onArchiveThread:e=>{kr(e)}})};y(c,e=>{o(wt)?e(l):e(d,-1)});var f=U(c,2),g=s(f),_=e=>{var t=Xh();qn(s(t),{class:`size-4`,"aria-hidden":`true`}),I(t),p(`click`,t,()=>{C(Fn,{...o(Fn),open:!0},!0)}),i(e,t)};y(g,e=>{!o(wt)&&!o(Fn).open&&e(_)});var v=U(g,2),b=e=>{var t=m(),n=u(t),r=e=>{Co(e,{get threads(){return o(nn)},get projects(){return o(tn)},onRestore:e=>{Ar(e)}})},a=e=>{ns(e,{})},s=e=>{Ya(e,{})},c=e=>{Lo(e,{})},l=e=>{Ba(e,{get user(){return h().user},onSignOut:()=>void rr()})};y(n,e=>{o(Tt)===`archived`?e(r):o(Tt)===`usage`?e(a,1):o(Tt)===`browser`?e(s,2):o(Tt)===`payments`?e(c,3):e(l,-1)}),i(e,t)},S=t=>{var n=$h(),r=u(n);de(r,()=>`${o(J)}:${o(un)}`,t=>{{let n=e(()=>o(mn)??o(X)??h().error??(o(en)instanceof Error?Wa(o(en)):null)??(o(ft)===`error`?`Could not sync threads.`:null)??(o(ft)===`offline`?`Thread sync is offline.`:null)??null),r=e(()=>o(Yn)?null:o(Dn)?.lastError??null),i=e(()=>o(Un)?o(Dn)?.runId??null:null),a=e(()=>o(J)?Ot.get(o(J))??null:null),s=e(()=>o(ln)??void 0),c=e(()=>o(J)&&(o(pn)||o(fn)!==o(J))?``:o(Cn)?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`);_f(t,{get currentError(){return o(n)},get runError(){return o(r)},get messages(){return o(Sn)},get actions(){return On},get activeRunId(){return o(i)},get project(){return o(Cn)},get remoteChangeNotice(){return o(a)},onDismissRemoteChangeNotice:()=>{o(J)&&Ot.delete(o(J))},get stale(){return o(dn)},get loadingOlder(){return o(vn)},get nextBefore(){return o(s)},get emptyStateMessage(){return o(c)},onLoadOlder:()=>{Tr()},loadAttachment:Er,loadSectionDetails:Dr})}});var c=U(r,2),l=e=>{var t=Zh(),n=s(t),r=s(n,!0);I(n),jr(U(n,2),{variant:`outline`,className:`h-8 px-3`,get disabled(){return o(ue)},onclick:()=>{fe()},children:(e,t)=>{V();var n=te();x(()=>a(n,o(ue)?`Retrying…`:`Retry`)),i(e,n)},$$slots:{default:!0}}),I(t),x(()=>a(r,xi)),i(e,t)},d=e=>{var t=Qh();i(e,t)};y(c,e=>{o(le)?e(l):o(ue)&&!o(ce)&&e(d,1)});var f=U(c,2);{let t=e(()=>o(Yn)!=null),n=e(()=>o(Zn)||o(Jn)||o(He)),r=e(()=>o(Gn)===void 0?null:Ki(o(Gn)));Da(f,{get attachments(){return o(Ye)},onAttachFiles:Nt,onRemoveAttachment:Pt,get modelCatalog(){return o(ce)},onModelChange:e=>{xr(e)},get pendingQuestion(){return o(sn)},get showContinueWorking(){return o(t)},onContinueWorking:()=>{Fr()},get canSend(){return o(Qn)},get isSubmitting(){return o(n)},get isStarting(){return o(Jn)},get isRunning(){return o(Wn)},get elapsedLabel(){return o(r)},get contextUsage(){return o(an)},get projectSkills(){return o(Tn)},onSubmit:()=>{Nr()},onCancel:()=>{Pr()},get prompt(){return o(Re)},set prompt(e){C(Re,e,!0)},get selectedModel(){return o(Ne)},set selectedModel(e){C(Ne,e,!0)},get selectedReasoningEffort(){return o(Fe)},set selectedReasoningEffort(e){C(Fe,e,!0)},get fastMode(){return o(Ie)},set fastMode(e){C(Ie,e,!0)},get selectedQuestionOptionId(){return o(Be)},set selectedQuestionOptionId(e){C(Be,e,!0)}})}i(t,n)};y(v,e=>{o(wt)?e(b):e(S,-1)}),I(f),I(r);var w=U(r,2),T=t=>{var n=eg(),r=s(n);{let t=e(()=>o(J)?Qt.data:null),n=e(()=>o(Wn)&&Qt.data?.lastUsedRunId===o(Dn)?.runId);lp(r,{get artifacts(){return o(Nn)},get selectedKey(){return o(Fn).selectedKey},get tab(){return o(Fn).tab},get liveView(){return o(t)},get liveActive(){return o(n)},get expanded(){return o(Fn).expanded},get stale(){return o(An).stale},get error(){return o(An).error},onSelect:e=>{C(Fn,{...o(Fn),selectedKey:e},!0)},onBack:()=>{C(Fn,{...o(Fn),selectedKey:null},!0)},onTabChange:e=>{C(Fn,{...o(Fn),tab:e},!0)},onOpenFullscreen:e=>{C(kt,e,!0),document.fullscreenElement||document.documentElement.requestFullscreen?.().catch(()=>{})},onToggleExpanded:()=>{C(Fn,{...o(Fn),expanded:!o(Fn).expanded},!0)},onClose:()=>{C(Fn,{...o(Fn),open:!1,expanded:!1},!0)}})}I(n),x(()=>{B(n,1,F(o(Fn).expanded?`bg-background fixed inset-0 z-50`:`absolute inset-y-0 right-0 z-40 w-[20rem]`)),n.inert=o(zn)?!0:void 0}),i(t,n)};y(w,e=>{!o(wt)&&o(Fn).open&&e(T)});var E=U(w,2),D=e=>{mp(e,{get artifact(){return o(zn)},onClose:()=>{C(kt,null)}})};y(E,e=>{o(zn)&&e(D)});var O=U(E,2),k=e=>{Wp(e,{get open(){return o(gt)},get desktopApi(){return o(q)},get mode(){return o(yt)},get expectedDisplayName(){return o(St)},get recentProjectPaths(){return o($n)},onClose:()=>{C(gt,!1),C(Ct,null),C(St,void 0)},onSelect:async e=>{try{await pr(e)}catch{await er()}}})};y(O,e=>{o(q)&&o(gt)&&e(k)}),I(n),x(()=>{B(r,1,`app-workspace-shell grid h-screen grid-cols-[292px_minmax(0,1fr)] overflow-hidden ${!o(wt)&&o(Fn).open&&!o(Fn).expanded?`pr-[20rem]`:``}`),r.inert=o(zn)||o(Fn).open&&o(Fn).expanded?!0:void 0}),i(t,n)};y(Rr,e=>{o(De)?o(q)?o(L)?e(Hr,-1):e(Vr,2):e(Br,1):e(zr)}),i(t,Lr),j(),w()}f([`click`]);export{ng as component};
|