@spikonado/sprocket 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/launcher.js +6 -8
- package/package.json +7 -6
- package/targets.json +39 -0
- package/web/_app/immutable/assets/0.CA8CRw5u.css +2 -0
- package/web/_app/immutable/chunks/{CmkNNjW7.js → B2QV2lSm.js} +1 -1
- package/web/_app/immutable/chunks/DxoYRmC6.js +1 -0
- package/web/_app/immutable/chunks/oeLdRRxz.js +1 -0
- package/web/_app/immutable/entry/{app.BJmv_AaP.js → app.Db38mZEd.js} +2 -2
- package/web/_app/immutable/entry/start.Bgl6O8TM.js +1 -0
- package/web/_app/immutable/nodes/{1.CkxhS6LO.js → 1.BjRhqcf3.js} +1 -1
- package/web/_app/immutable/nodes/2.D9M51kgP.js +71 -0
- package/web/_app/immutable/nodes/{3.uTidpAAX.js → 3.CXSe3vNq.js} +1 -1
- package/web/_app/immutable/nodes/{4.CDpZMtIP.js → 4.DUhF2sk4.js} +1 -1
- package/web/_app/version.json +1 -1
- package/web/callback.html +10 -10
- package/web/index.html +8 -8
- package/web/pair.html +11 -11
- package/web/_app/immutable/assets/0.D5NQ5DrL.css +0 -2
- package/web/_app/immutable/chunks/CCtE5nm3.js +0 -1
- package/web/_app/immutable/chunks/D6ODpZq_.js +0 -1
- package/web/_app/immutable/entry/start.DZrTeHLY.js +0 -1
- package/web/_app/immutable/nodes/2.BSIOEuUT.js +0 -71
- /package/web/_app/immutable/nodes/{0.MeCRA8_o.js → 0.j0F6hNbB.js} +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,J as l,K as u,L as d,M as f,N as p,O as m,Q as h,R as g,S as _,T as v,U as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,at as E,b as D,c as ee,d as O,dt as k,et as A,f as j,ft as te,g as ne,i as M,it as N,j as P,k as re,l as ie,m as F,n as ae,o as I,p as L,pt as oe,q as se,rt as R,s as ce,u as z,ut as le,v as B,w as V,x as ue,y as H,z as U}from"../chunks/BrZMY0Kx.js";import{c as de}from"../chunks/oeLdRRxz.js";import"../chunks/xihTtKlq.js";import{a as fe,d as pe,f as me,i as he,l as ge,n as _e,p as W,r as ve,s as ye,t as be,u as xe}from"../chunks/tqyHaQv_.js";import{a as Se,i as Ce,o as we,r as Te}from"../chunks/YGmybFhl.js";import{a as Ee,i as De,n as Oe,r as ke,t as Ae}from"../chunks/CBOYsvSw.js";import{a as je,n as Me,o as Ne}from"../chunks/B2QV2lSm.js";var G=Object.defineProperty,Pe=(e,t,n)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t,n)=>Pe(e,typeof t==`symbol`?t:t+``,n),Fe=`https://docs.convex.dev/error#undefined-validator`;function Ie(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${Fe} for details.`)}var q=class{constructor({isOptional:e}){K(this,`type`),K(this,`fieldPaths`),K(this,`isOptional`),K(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},Le=class e extends q{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),K(this,`tableName`),K(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},Re=class e extends q{constructor(){super(...arguments),K(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},ze=class e extends q{constructor(){super(...arguments),K(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},J=class e extends q{constructor(){super(...arguments),K(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Be=class e extends q{constructor(){super(...arguments),K(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Ve=class e extends q{constructor(){super(...arguments),K(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},He=class e extends q{constructor(){super(...arguments),K(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Ue=class e extends q{constructor(){super(...arguments),K(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},We=class e extends q{constructor({isOptional:e,fields:t}){super({isOptional:e}),K(this,`fields`),K(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&Ie(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},Y=class e extends q{constructor({isOptional:e,value:t}){if(super({isOptional:e}),K(this,`value`),K(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:we(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},Ge=class e extends q{constructor({isOptional:e,element:t}){super({isOptional:e}),K(this,`element`),K(this,`kind`,`array`),t===void 0&&Ie(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},Ke=class e extends q{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),K(this,`key`),K(this,`value`),K(this,`kind`,`record`),t===void 0&&Ie(`v.record()`,`key`),n===void 0&&Ie(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},qe=class e extends q{constructor({isOptional:e,members:t}){super({isOptional:e}),K(this,`members`),K(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&Ie(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},X={id:e=>new Le({isOptional:`required`,tableName:e}),null:()=>new He({isOptional:`required`}),number:()=>new Re({isOptional:`required`}),float64:()=>new Re({isOptional:`required`}),bigint:()=>new ze({isOptional:`required`}),int64:()=>new ze({isOptional:`required`}),boolean:()=>new J({isOptional:`required`}),string:()=>new Ve({isOptional:`required`}),bytes:()=>new Be({isOptional:`required`}),literal:e=>new Y({isOptional:`required`,value:e}),array:e=>new Ge({isOptional:`required`,element:e}),object:e=>new We({isOptional:`required`,fields:e}),record:(e,t)=>new Ke({isOptional:`required`,key:e,value:t}),union:(...e)=>new qe({isOptional:`required`,members:e}),any:()=>new Ue({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>X.union(e,X.null())},Je=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],Ye=[`difference`,`intersection`,`symmetricDifference`,`union`],Xe=!1,Ze=class e extends Set{#e=new Map;#t=x(0);#n=x(0);#r=d||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}Xe||this.#a()}#i(e){return d===this.#r?x(e):S(e)}#a(){Xe=!0;var t=e.prototype,n=Set.prototype;for(let e of Je)t[e]=function(...t){return p(this.#t),n[e].apply(this,t)};for(let r of Ye)t[r]=function(...t){p(this.#t);var i=n[r].apply(this,t);return new e(i)}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return p(this.#t),!1;r=this.#i(!0),n.set(e,r)}return p(r),t}add(e){return super.has(e)||(super.add(e),l(this.#n,super.size),se(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),l(r,!1)),t&&(l(this.#n,super.size),se(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())l(t,!1);e.clear(),l(this.#n,0),se(this.#t)}}keys(){return this.values()}values(){return p(this.#t),super.values()}entries(){return p(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return p(this.#n)}},Qe=class extends Map{#e=new Map;#t=x(0);#n=x(0);#r=d||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return d===this.#r?x(e):S(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return p(this.#t),!1;return p(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{p(this.#t);return}return p(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),l(this.#n,super.size),se(o);else if(i!==t){se(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&se(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),l(n,-1)),r&&(l(this.#n,super.size),se(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;l(this.#n,0);for(var t of e.values())l(t,-1);se(this.#t),e.clear()}}#a(){p(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)p(n)}keys(){return p(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return p(this.#n),super.size}},$e=2e4,et={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`},tt=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},nt=Symbol(`lucide-context`),rt=()=>R(nt),it=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),at=m(`<svg><!><!></svg>`);function Z(e,t){E(t,!0);let n=rt()??{},r=M(t,`color`,19,()=>n.color??`currentColor`),i=M(t,`size`,19,()=>n.size??24),o=M(t,`strokeWidth`,19,()=>n.strokeWidth??2),c=M(t,`absoluteStrokeWidth`,19,()=>n.absoluteStrokeWidth??!1),l=M(t,`iconNode`,19,()=>[]),u=T(t,it),d=C(()=>c()?Number(o())*24/Number(i()):o());var f=at();ie(f,e=>({...et,...e,...u,width:i(),height:i(),stroke:r(),"stroke-width":p(d),class:[`lucide-icon lucide`,n.class,t.name&&`lucide-${t.name}`,t.class]}),[()=>!t.children&&!tt(u)&&{"aria-hidden":`true`}]);var m=y(f);ue(m,17,l,_,(e,t)=>{var n=C(()=>oe(p(t),2));let r=()=>p(n)[0],i=()=>p(n)[1];var o=a();w(b(o),r,!0,(e,t)=>{ie(e,()=>({...i()}))}),v(e,o)}),H(s(m),()=>t.children??te),k(f),v(e,f),N()}var ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function st(e,t){let n=T(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`}]];Z(e,I({name:`archive`},()=>n,{get iconNode(){return r}}))}var ct=new Set([`$$slots`,`$$events`,`$$legacy`]);function lt(e,t){let n=T(t,ct),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];Z(e,I({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var ut=new Set([`$$slots`,`$$events`,`$$legacy`]);function dt(e,t){let n=T(t,ut),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];Z(e,I({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var ft=new Set([`$$slots`,`$$events`,`$$legacy`]);function pt(e,t){let n=T(t,ft),r=[[`path`,{d:`M12 5v16`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`}]];Z(e,I({name:`book-open`},()=>n,{get iconNode(){return r}}))}var mt=new Set([`$$slots`,`$$events`,`$$legacy`]);function ht(e,t){let n=T(t,mt),r=[[`path`,{d:`M12 18V5`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`}]];Z(e,I({name:`brain`},()=>n,{get iconNode(){return r}}))}var gt=new Set([`$$slots`,`$$events`,`$$legacy`]);function _t(e,t){let n=T(t,gt),r=[[`path`,{d:`M5 21v-6`}],[`path`,{d:`M12 21V3`}],[`path`,{d:`M19 21V9`}]];Z(e,I({name:`chart-no-axes-column`},()=>n,{get iconNode(){return r}}))}var vt=new Set([`$$slots`,`$$events`,`$$legacy`]);function yt(e,t){let n=T(t,vt),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];Z(e,I({name:`check`},()=>n,{get iconNode(){return r}}))}var bt=new Set([`$$slots`,`$$events`,`$$legacy`]);function xt(e,t){let n=T(t,bt),r=[[`path`,{d:`m6 9 6 6 6-6`}]];Z(e,I({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var St=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ct(e,t){let n=T(t,St),r=[[`path`,{d:`m9 18 6-6-6-6`}]];Z(e,I({name:`chevron-right`},()=>n,{get iconNode(){return r}}))}var wt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tt(e,t){let n=T(t,wt),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]];Z(e,I({name:`circle-question-mark`},()=>n,{get iconNode(){return r}}))}var Et=new Set([`$$slots`,`$$events`,`$$legacy`]);function Dt(e,t){let n=T(t,Et),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];Z(e,I({name:`copy`},()=>n,{get iconNode(){return r}}))}var Ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function kt(e,t){let n=T(t,Ot),r=[[`path`,{d:`M14 9 9 4 4 9`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`}]];Z(e,I({name:`corner-left-up`},()=>n,{get iconNode(){return r}}))}var At=new Set([`$$slots`,`$$events`,`$$legacy`]);function jt(e,t){let n=T(t,At),r=[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]];Z(e,I({name:`download`},()=>n,{get iconNode(){return r}}))}var Mt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Nt(e,t){let n=T(t,Mt),r=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`M10 14 21 3`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}]];Z(e,I({name:`external-link`},()=>n,{get iconNode(){return r}}))}var Pt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ft(e,t){let n=T(t,Pt),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M9 10h6`}],[`path`,{d:`M12 13V7`}],[`path`,{d:`M9 17h6`}]];Z(e,I({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var It=new Set([`$$slots`,`$$events`,`$$legacy`]);function Lt(e,t){let n=T(t,It),r=[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}]];Z(e,I({name:`folder-open`},()=>n,{get iconNode(){return r}}))}var Rt=new Set([`$$slots`,`$$events`,`$$legacy`]);function zt(e,t){let n=T(t,Rt),r=[[`path`,{d:`M12 10v6`}],[`path`,{d:`M9 13h6`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];Z(e,I({name:`folder-plus`},()=>n,{get iconNode(){return r}}))}var Bt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Vt(e,t){let n=T(t,Bt),r=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];Z(e,I({name:`folder`},()=>n,{get iconNode(){return r}}))}var Ht=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ut(e,t){let n=T(t,Ht),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}],[`path`,{d:`M2 12h20`}]];Z(e,I({name:`globe`},()=>n,{get iconNode(){return r}}))}var Wt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Gt(e,t){let n=T(t,Wt),r=[[`path`,{d:`M5 22h14`}],[`path`,{d:`M5 2h14`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`}]];Z(e,I({name:`hourglass`},()=>n,{get iconNode(){return r}}))}var Kt=new Set([`$$slots`,`$$events`,`$$legacy`]);function qt(e,t){let n=T(t,Kt),r=[[`path`,{d:`M16 5h6`}],[`path`,{d:`M19 2v6`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}]];Z(e,I({name:`image-plus`},()=>n,{get iconNode(){return r}}))}var Jt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Yt(e,t){let n=T(t,Jt),r=[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]];Z(e,I({name:`loader-circle`},()=>n,{get iconNode(){return r}}))}var Xt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Zt(e,t){let n=T(t,Xt),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];Z(e,I({name:`lock`},()=>n,{get iconNode(){return r}}))}var Qt=new Set([`$$slots`,`$$events`,`$$legacy`]);function $t(e,t){let n=T(t,Qt),r=[[`path`,{d:`m16 17 5-5-5-5`}],[`path`,{d:`M21 12H9`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}]];Z(e,I({name:`log-out`},()=>n,{get iconNode(){return r}}))}var en=new Set([`$$slots`,`$$events`,`$$legacy`]);function tn(e,t){let n=T(t,en),r=[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]];Z(e,I({name:`moon`},()=>n,{get iconNode(){return r}}))}var nn=new Set([`$$slots`,`$$events`,`$$legacy`]);function rn(e,t){let n=T(t,nn),r=[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`}],[`path`,{d:`M2 6h4`}],[`path`,{d:`M2 10h4`}],[`path`,{d:`M2 14h4`}],[`path`,{d:`M2 18h4`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`}]];Z(e,I({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var an=new Set([`$$slots`,`$$events`,`$$legacy`]);function on(e,t){let n=T(t,an),r=[[`path`,{d:`M15 12h-5`}],[`path`,{d:`M15 8h-5`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`}]];Z(e,I({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var sn=new Set([`$$slots`,`$$events`,`$$legacy`]);function cn(e,t){let n=T(t,sn),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];Z(e,I({name:`search`},()=>n,{get iconNode(){return r}}))}var ln=new Set([`$$slots`,`$$events`,`$$legacy`]);function un(e,t){let n=T(t,ln),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];Z(e,I({name:`settings`},()=>n,{get iconNode(){return r}}))}var dn=new Set([`$$slots`,`$$events`,`$$legacy`]);function fn(e,t){let n=T(t,dn),r=[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`}]];Z(e,I({name:`square-pen`},()=>n,{get iconNode(){return r}}))}var pn=new Set([`$$slots`,`$$events`,`$$legacy`]);function mn(e,t){let n=T(t,pn),r=[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]];Z(e,I({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var hn=new Set([`$$slots`,`$$events`,`$$legacy`]);function gn(e,t){let n=T(t,hn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];Z(e,I({name:`square`},()=>n,{get iconNode(){return r}}))}var _n=new Set([`$$slots`,`$$events`,`$$legacy`]);function vn(e,t){let n=T(t,_n),r=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]];Z(e,I({name:`sun`},()=>n,{get iconNode(){return r}}))}var yn=new Set([`$$slots`,`$$events`,`$$legacy`]);function bn(e,t){let n=T(t,yn),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];Z(e,I({name:`terminal`},()=>n,{get iconNode(){return r}}))}var xn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Sn(e,t){let n=T(t,xn),r=[[`circle`,{cx:`12`,cy:`8`,r:`5`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`}]];Z(e,I({name:`user-round`},()=>n,{get iconNode(){return r}}))}var Cn=new Set([`$$slots`,`$$events`,`$$legacy`]);function wn(e,t){let n=T(t,Cn),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];Z(e,I({name:`wrench`},()=>n,{get iconNode(){return r}}))}var Tn=new Set([`$$slots`,`$$events`,`$$legacy`]);function En(e,t){let n=T(t,Tn),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];Z(e,I({name:`x`},()=>n,{get iconNode(){return r}}))}var Dn=new Set([`$$slots`,`$$events`,`$$legacy`]);function On(e,t){let n=T(t,Dn),r=[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`}]];Z(e,I({name:`zap`},()=>n,{get iconNode(){return r}}))}var kn=i(`<a><!></a>`),An=i(`<button><!></button>`);function jn(e,t){E(t,!0);let n=M(t,`type`,3,`button`),i=M(t,`variant`,3,`default`),o=M(t,`className`,3,``),s=M(t,`disabled`,3,!1),c=C(()=>i()===`outline`?`border-border bg-surface/80 text-foreground hover:bg-hover-fill`:`bg-primary text-primary-foreground hover:opacity-90`),l=C(()=>Ee(`focus-visible:ring-ring/50 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-transparent px-5 py-2 text-sm font-medium transition-opacity focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50`,p(c),o()));var u=a(),d=b(u),f=e=>{var n=kn();H(y(n),()=>t.children??te),k(n),U(()=>{O(n,`href`,t.href),L(n,1,F(p(l)))}),P(`click`,n,function(...e){t.onclick?.apply(this,e)}),v(e,n)},m=e=>{var r=An();H(y(r),()=>t.children??te),k(r),U(()=>{O(r,`type`,n()),r.disabled=s(),L(r,1,F(p(l)))}),P(`click`,r,function(...e){t.onclick?.apply(this,e)}),v(e,r)};r(d,e=>{t.href&&!s()?e(f):e(m,-1)}),v(e,u),N()}t([`click`]);var Mn=i(`<!> <!>`,1),Nn=i(`<p class="text-destructive text-center text-sm" role="alert"> </p>`),Pn=i(`<div class="text-muted-foreground flex items-center justify-center gap-2 text-sm" aria-live="polite" aria-busy="true"><!> <span> </span></div>`),Fn=i(`<div><!></div>`);function In(e,t){E(t,!0);let n=M(t,`overlayOpen`,3,!1),i=C(()=>t.authState.isAuthenticated&&(t.authState.isLoading||!t.authState.connectionFailed)),o=C(()=>!t.authState.isAuthenticated&&t.authState.isLoading),c=C(()=>t.authState.isConfigured?p(i)?`Confirming your session`:t.authState.connectionFailed?`Couldn’t connect your account`:p(o)?`Preparing sign-in`:`Sign in to continue`:`Sign-in unavailable`),l=C(()=>t.authState.isConfigured?p(i)?`Verifying your secure connection before opening your projects.`:t.authState.connectionFailed?`You’re signed in, but the secure connection could not be confirmed. Retry or sign out and sign in again.`:p(o)?`Getting account sign-in ready. This usually takes a moment.`:`Sign in to sync your coding threads, streaming responses, and projects.`:`Account sign-in is not configured on this deployment, so account actions are disabled.`),u=C(()=>t.authState.isAuthenticated?`Almost there`:`One moment`),d=C(()=>!!(t.authState.isConfigured&&t.authState.error&&!n()));var f=Fn();Ae(y(f),{get title(){return p(c)},get description(){return p(l)},actions:e=>{var n=a(),i=b(n),o=e=>{var n=Mn(),i=b(n),a=e=>{jn(e,{get onclick(){return t.onRetry},get disabled(){return t.authState.isLoading},children:(e,t)=>{le(),v(e,re(`Retry`))},$$slots:{default:!0}})};r(i,e=>{t.authState.connectionFailed&&e(a)}),jn(s(i,2),{variant:`outline`,get onclick(){return t.onSignOut},children:(e,t)=>{le(),v(e,re(`Sign Out`))},$$slots:{default:!0}}),v(e,n)},c=e=>{var n=Mn(),r=b(n);jn(r,{get onclick(){return t.onSignIn},get disabled(){return t.authState.isLoading},children:(e,t)=>{le(),v(e,re(`Sign In`))},$$slots:{default:!0}}),jn(s(r,2),{variant:`outline`,get onclick(){return t.onSignUp},get disabled(){return t.authState.isLoading},children:(e,t)=>{le(),v(e,re(`Create Account`))},$$slots:{default:!0}}),v(e,n)};r(i,e=>{t.authState.isAuthenticated?e(o):t.authState.isConfigured&&e(c,1)}),v(e,n)},children:(e,n)=>{var i=Mn(),a=b(i),o=e=>{var n=Nn(),r=y(n,!0);k(n),U(()=>V(r,t.authState.error)),v(e,n)};r(a,e=>{p(d)&&e(o)});var c=s(a,2),l=e=>{var t=Pn(),n=y(t);Yt(n,{class:`size-3.5 animate-spin`,"aria-hidden":`true`});var r=s(n,2),i=y(r,!0);k(r),k(t),U(()=>V(i,p(u))),v(e,t)};r(c,e=>{t.authState.isLoading&&e(l)}),v(e,i)},$$slots:{actions:!0,default:!0}}),k(f),U(()=>{f.inert=n(),O(f,`aria-hidden`,n()?!0:void 0)}),v(e,f),N()}var Ln=i(`<div class="text-muted-foreground mb-4 flex justify-center" aria-hidden="true"><!></div>`),Rn=i(`<p class="text-muted-foreground mt-6 max-h-24 overflow-y-auto font-mono text-[11px] leading-5 break-all select-all"> </p>`),zn=i(`<p class="text-destructive mt-4 text-sm" role="alert"> </p>`),Bn=i(`<p class="mt-4 text-sm text-amber-700" role="alert"> </p>`),Vn=i(`<!> Open browser`,1),Hn=i(`<!> Copied`,1),Un=i(`<!> Copy link`,1),Wn=i(`<!> <!>`,1),Gn=i(`<span class="text-muted-foreground border-border inline-flex h-10 items-center justify-center gap-2 rounded-full border px-4 text-sm">Preparing link…</span>`),Kn=i(`<div class="app-entry-shell fixed inset-0 z-50 flex items-center justify-center px-6" role="presentation"><div class="border-border/70 bg-surface relative z-10 w-full max-w-md rounded-2xl border p-8 text-center shadow-[0_18px_50px_-28px_oklch(0.2_0.02_260/0.45)] outline-none" role="dialog" aria-modal="true" aria-labelledby="browser-signin-title" aria-describedby="browser-signin-desc" tabindex="-1"><!> <h2 id="browser-signin-title" class="font-brand text-foreground text-[1.35rem] font-semibold tracking-tight"> </h2> <p id="browser-signin-desc" class="text-muted-foreground mt-3 text-sm leading-[1.55]"> </p> <!> <!> <!> <div class="mt-6 flex flex-wrap items-center justify-center gap-3"><!></div> <div class="mt-6"><button type="button" class="text-muted-foreground hover:text-foreground decoration-foreground/30 hover:decoration-foreground text-[13px] underline underline-offset-4 transition-colors">Cancel</button></div></div></div>`);function qn(e,t){E(t,!0);let i=M(t,`error`,3,null),c=x(!1),u=x(null),d=x(null),f=null;n(()=>{if(!t.open){l(c,!1),l(u,null);return}let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=!1;o().then(()=>{n||p(d)?.focus()});function r(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onCancel();return}if(e.key!==`Tab`||!p(d))return;let n=Array.from(p(d).querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`)&&e.offsetParent!==null);if(n.length===0){e.preventDefault(),p(d).focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===p(d)||a===r||!p(d).contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===p(d)||a===i||!p(d).contains(a))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,r,!0),()=>{n=!0,window.removeEventListener(`keydown`,r,!0),f!==null&&(window.clearTimeout(f),f=null),e?.isConnected&&e.focus()}});async function m(){if(t.signInUrl)try{await navigator.clipboard.writeText(t.signInUrl),l(c,!0),l(u,null),f!==null&&window.clearTimeout(f),f=window.setTimeout(()=>{l(c,!1),f=null},2e3)}catch{l(c,!1),l(u,`Could not copy the sign-in link. Select it above and copy manually.`)}}function h(){if(!t.signInUrl)return;let e=window.open(t.signInUrl,`_blank`);if(e){try{e.opener=null}catch{}t.onClearOpenError?.()}}let g=C(()=>t.signInUrl?i()?{title:`Open the sign-in link`,description:`Your browser didn’t open automatically. Continue with the options below.`}:{title:`Finish signing in`,description:`We opened your browser to complete sign-in. Waiting for you to finish there.`}:{title:`Preparing sign-in`,description:`Preparing a secure sign-in link. This usually takes a moment.`});var _=a(),S=b(_),w=e=>{var n=Kn(),o=y(n),f=y(o),_=e=>{var t=Ln();Yt(y(t),{class:`size-5 animate-spin`}),k(t),v(e,t)};r(f,e=>{t.signInUrl||e(_)});var x=s(f,2),S=y(x,!0);k(x);var C=s(x,2),w=y(C,!0);k(C);var T=s(C,2),E=e=>{var n=Rn(),r=y(n,!0);k(n),U(()=>{O(n,`title`,t.signInUrl),V(r,t.signInUrl)}),v(e,n)};r(T,e=>{t.signInUrl&&e(E)});var D=s(T,2),ee=e=>{var t=zn(),n=y(t,!0);k(t),U(()=>V(n,i())),v(e,t)};r(D,e=>{i()&&e(ee)});var A=s(D,2),j=e=>{var t=Bn(),n=y(t,!0);k(t),U(()=>V(n,p(u))),v(e,t)};r(A,e=>{p(u)&&e(j)});var te=s(A,2),ne=y(te),M=e=>{var t=Wn(),n=b(t);jn(n,{onclick:h,children:(e,t)=>{var n=Vn();Nt(b(n),{class:`size-4`,"aria-hidden":`true`}),le(),v(e,n)},$$slots:{default:!0}}),jn(s(n,2),{variant:`outline`,onclick:()=>void m(),children:(e,t)=>{var n=a(),i=b(n),o=e=>{var t=Hn();yt(b(t),{class:`size-4`,"aria-hidden":`true`}),le(),v(e,t)},s=e=>{var t=Un();Dt(b(t),{class:`size-4`,"aria-hidden":`true`}),le(),v(e,t)};r(i,e=>{p(c)?e(o):e(s,-1)}),v(e,n)},$$slots:{default:!0}}),v(e,t)},N=e=>{v(e,Gn())};r(ne,e=>{t.signInUrl?e(M):e(N,-1)}),k(te);var re=s(te,2),ie=y(re);k(re),k(o),ce(o,e=>l(d,e),()=>p(d)),k(n),U(()=>{V(S,p(g).title),V(w,p(g).description)}),P(`click`,n,e=>{e.target===e.currentTarget&&t.onCancel()}),P(`click`,ie,function(...e){t.onCancel?.apply(this,e)}),v(e,n)};r(S,e=>{t.open&&e(w)}),v(e,_),N()}t([`click`]);function Jn(){let e=x(null),t=x(!1),r=null;function i(){r&&=(clearTimeout(r),null)}function a(n,a,o=!1){let s=n.currentTarget;if(!(s instanceof HTMLElement))return;let c=s.getBoundingClientRect();i(),l(t,o,!0),l(e,{top:c.top-8,left:c.left+c.width/2,label:a},!0),o&&(r=setTimeout(()=>{l(t,!1),r=null,l(e,null)},2500))}function o(n=!1){p(t)&&!n||(i(),l(t,!1),l(e,null))}return n(()=>i),{get lockTooltip(){return p(e)},showLockTooltip:a,hideLockTooltip:o}}function Yn(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 Xn=i(`<div class="text-tooltip-foreground bg-tooltip ring-border pointer-events-none fixed z-100 -translate-x-1/2 -translate-y-full rounded-md px-2.5 py-1.5 text-[12px] leading-4 whitespace-nowrap shadow-lg ring-1" role="tooltip"> </div>`);function Zn(e,t){E(t,!0);var n=a(),i=b(n),o=e=>{var n=Xn(),r=y(n,!0);k(n),U(()=>{j(n,`top: ${t.tooltip.top}px; left: ${t.tooltip.left}px;`),V(r,t.tooltip.label)}),v(e,n)};r(i,e=>{t.tooltip&&e(o)}),v(e,n),N()}var Qn=i(`<label class="text-muted-foreground flex h-10 items-center gap-2 border-b border-[var(--hairline)] px-2"><!> <span class="sr-only"> </span> <input class="text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none"/></label>`),$n=i(`<p class="text-muted-foreground px-3 pt-1 pb-2 text-[11px] font-medium"> </p>`),er=i(`<span><!></span>`),tr=i(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),nr=i(`<button type="button"><!> <span> </span> <!></button>`),rr=i(`<p class="text-muted-foreground px-3 py-5 text-center text-sm">No matches found</p>`),ir=i(`<div class="bg-popover/96 absolute bottom-[calc(100%+0.75rem)] left-0 z-50 min-w-[19rem] rounded-[18px] border border-[var(--hairline)] p-2 shadow-[var(--composer-shadow)] backdrop-blur-xl" role="dialog"><!> <div><!> <!></div></div>`),ar=i(`<div><button type="button" aria-haspopup="dialog"><!> <span class="truncate"> </span> <!></button> <!></div> <!>`,1);function or(e,t){E(t,!0);let i=M(t,`value`,15,``),o=M(t,`disabled`,3,!1),c=M(t,`className`,3,``),u=M(t,`triggerClassName`,3,``),d=M(t,`searchable`,3,!1),m=x(!1),h=x(``),g=x(null),_=x(null),S=x(null),w=Jn(),T=C(()=>{let e=t.options.find(e=>e.id===i());return e&&!e.locked?e:t.options.find(e=>!e.locked)??e??t.options[0]??null}),D=C(()=>d()&&p(h).trim()?t.options.filter(e=>e.label.toLocaleLowerCase().includes(p(h).trim().toLocaleLowerCase())):t.options),A=C(()=>p(D).filter(e=>!e.locked));function j(){o()||(l(m,!p(m)),p(m)&&d()?queueMicrotask(()=>p(S)?.focus()):l(h,``))}function te(e,n){let r=t.options.find(t=>t.id===e);if(r){if(r.locked){n&&r.lockTooltip&&w.showLockTooltip(n,r.lockTooltip,!0);return}e!==i()&&(i(e),t.onValueChange?.(e)),l(m,!1),l(h,``),w.hideLockTooltip(!0),p(_)?.focus()}}function ne(e){e.key!==`Enter`||p(A).length===0||(e.preventDefault(),te(p(A)[0].id))}n(()=>{if(!p(m)){l(h,``),w.hideLockTooltip();return}return Yn({getRoot:()=>p(g),onOutside:()=>{l(m,!1)},onEscape:()=>{l(m,!1),p(_)?.focus()}})}),n(()=>{o()&&l(m,!1)});var re=ar(),ie=b(re),ae=y(ie),I=y(ae),oe=e=>{var n=a();H(b(n),()=>t.optionIcon,()=>p(T)),v(e,n)};r(I,e=>{t.optionIcon&&p(T)&&e(oe)});var se=s(I,2),R=y(se,!0);k(se);var le=s(se,2);{let e=C(()=>Ee(`text-muted-foreground size-3 shrink-0 transition-transform`,p(m)&&`rotate-180`));xt(le,{get class(){return p(e)}})}k(ae),ce(ae,e=>l(_,e),()=>p(_));var B=s(ae,2),de=e=>{var n=ir(),a=y(n),o=e=>{var n=Qn(),r=y(n);cn(r,{class:`size-4 shrink-0`});var i=s(r,2),a=y(i);k(i);var o=s(i,2);z(o),ce(o,e=>l(S,e),()=>p(S)),k(n),U((e,t)=>{V(a,`Search ${e??``}`),O(o,`placeholder`,t)},[()=>t.menuTitle.toLocaleLowerCase(),()=>`Search ${t.menuTitle.toLocaleLowerCase()}…`]),P(`keydown`,o,ne),ee(o,()=>p(h),e=>l(h,e)),v(e,n)},c=e=>{var n=$n(),r=y(n,!0);k(n),U(()=>V(r,t.menuTitle)),v(e,n)};r(a,e=>{d()?e(o):e(c,-1)});var u=s(a,2),m=y(u);ue(m,17,()=>p(D),e=>e.id,(e,n)=>{let a=C(()=>!!p(n).locked);var o=nr(),c=y(o),l=e=>{var r=er();H(y(r),()=>t.optionIcon,()=>p(n)),k(r),U(e=>L(r,1,e),[()=>F(Ee(`flex size-7 shrink-0 items-center justify-center`,(p(a),`text-muted-foreground`)))]),v(e,r)};r(c,e=>{t.optionIcon&&e(l)});var u=s(c,2),d=y(u,!0);k(u);var m=s(u,2),h=e=>{var t=tr();Zt(y(t),{class:`size-3.5`}),k(t),v(e,t)},g=e=>{{let t=C(()=>Ee(`text-accent-strong size-4 shrink-0 transition-opacity`,p(n).id===i()?`opacity-100`:`opacity-0`));yt(e,{get class(){return p(t)}})}};r(m,e=>{p(a)?e(h):e(g,-1)}),k(o),U((e,t)=>{L(o,1,e),O(o,`aria-pressed`,!p(a)&&p(n).id===i()),O(o,`aria-disabled`,p(a)),O(o,`aria-label`,p(a)&&p(n).lockTooltip?`${p(n).label}. ${p(n).lockTooltip}`:void 0),L(u,1,t),V(d,p(n).label)},[()=>F(Ee(`focus-visible:ring-ring/60 flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left outline-none focus-visible:ring-2`,p(a)?`cursor-not-allowed opacity-45`:`hover:bg-hover-fill`,!p(a)&&p(n).id===i()&&`bg-hover-fill`)),()=>F(Ee(`min-w-0 flex-1 truncate text-sm font-medium`,p(a)?`text-muted-foreground`:`text-foreground`))]),f(`mouseenter`,o,e=>{p(a)&&p(n).lockTooltip&&w.showLockTooltip(e,p(n).lockTooltip)}),f(`mouseleave`,o,()=>w.hideLockTooltip()),f(`focus`,o,e=>{p(a)&&p(n).lockTooltip&&w.showLockTooltip(e,p(n).lockTooltip)}),f(`blur`,o,()=>w.hideLockTooltip()),P(`click`,o,e=>{te(p(n).id,e)}),v(e,o)});var g=s(m,2),_=e=>{v(e,rr())};r(g,e=>{p(D).length===0&&e(_)}),k(u),k(n),U(e=>{O(n,`aria-label`,t.menuTitle),L(u,1,e)},[()=>F(Ee(`space-y-0.5`,d()&&`pt-1.5`))]),v(e,n)};r(B,e=>{p(m)&&e(de)}),k(ie),ce(ie,e=>l(g,e),()=>p(g)),Zn(s(ie,2),{get tooltip(){return w.lockTooltip}}),U((e,n)=>{L(ie,1,e),L(ae,1,n),O(ae,`aria-expanded`,p(m)),O(ae,`aria-label`,t.ariaLabel),ae.disabled=o(),V(R,p(T)?.triggerLabel??p(T)?.label??i())},[()=>F(Ee(`relative`,c())),()=>F(Ee(`focus-visible:ring-ring/60 text-muted-foreground hover:bg-hover-fill inline-flex h-8 shrink-0 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-sm font-medium transition outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50`,!t.optionIcon&&`gap-1`,u()))]),P(`click`,ae,j),v(e,re),N()}t([`click`,`keydown`]);var sr=m(`<title> </title>`),cr=m(`<svg viewBox="146.694 227.042 267.198 264.812" xmlns="http://www.w3.org/2000/svg" role="img" fill="none"><!><path d="M249.176 323.434V298.276C249.176 296.158 249.971 294.569 251.825 293.509L302.406 264.381C309.29 260.409 317.5 258.555 325.973 258.555C357.75 258.555 377.877 283.185 377.877 309.399C377.877 311.253 377.877 313.371 377.611 315.49L325.178 284.771C322.001 282.919 318.822 282.919 315.645 284.771L249.176 323.434ZM367.283 421.415V361.301C367.283 357.592 365.694 354.945 362.516 353.092L296.048 314.43L317.763 301.982C319.617 300.925 321.206 300.925 323.058 301.982L373.639 331.112C388.205 339.586 398.003 357.592 398.003 375.069C398.003 395.195 386.087 413.733 367.283 421.412V421.415ZM233.553 368.452L211.838 355.742C209.986 354.684 209.19 353.095 209.19 350.975V292.718C209.19 264.383 230.905 242.932 260.301 242.932C271.423 242.932 281.748 246.641 290.49 253.26L238.321 283.449C235.146 285.303 233.555 287.951 233.555 291.659V368.455L233.553 368.452ZM280.292 395.462L249.176 377.985V340.913L280.292 323.436L311.407 340.913V377.985L280.292 395.462ZM300.286 475.968C289.163 475.968 278.837 472.259 270.097 465.64L322.264 435.449C325.441 433.597 327.03 430.949 327.03 427.239V350.445L349.011 363.155C350.865 364.213 351.66 365.802 351.66 367.922V426.179C351.66 454.514 329.679 475.965 300.286 475.965V475.968ZM237.525 416.915L186.944 387.785C172.378 379.31 162.582 361.305 162.582 343.827C162.582 323.436 174.763 305.164 193.563 297.485V357.861C193.563 361.571 195.154 364.217 198.33 366.071L264.535 404.467L242.82 416.915C240.967 417.972 239.377 417.972 237.525 416.915ZM234.614 460.343C204.689 460.343 182.71 437.833 182.71 410.028C182.71 407.91 182.976 405.792 183.238 403.672L235.405 433.863C238.582 435.715 241.763 435.715 244.938 433.863L311.407 395.466V420.622C311.407 422.742 310.612 424.331 308.758 425.389L258.179 454.519C251.293 458.491 243.083 460.343 234.611 460.343H234.614ZM300.286 491.854C332.329 491.854 359.073 469.082 365.167 438.892C394.825 431.211 413.892 403.406 413.892 375.073C413.892 356.535 405.948 338.529 391.648 325.552C392.972 319.991 393.766 314.43 393.766 308.87C393.766 271.003 363.048 242.666 327.562 242.666C320.413 242.666 313.528 243.723 306.644 246.109C294.725 234.457 278.307 227.042 260.301 227.042C228.258 227.042 201.513 249.815 195.42 280.004C165.761 287.685 146.694 315.49 146.694 343.824C146.694 362.362 154.638 380.368 168.938 393.344C167.613 398.906 166.819 404.467 166.819 410.027C166.819 447.894 197.538 476.231 233.024 476.231C240.172 476.231 247.058 475.173 253.943 472.788C265.859 484.441 282.278 491.854 300.286 491.854Z" fill="currentColor"></path></svg>`);function lr(e,t){E(t,!0);let n=M(t,`className`,3,``),i=M(t,`title`,3,`OpenAI`);var a=cr(),o=y(a),s=e=>{var t=sr(),n=y(t,!0);k(t),U(()=>V(n,i())),v(e,t)};r(o,e=>{i()&&e(s)}),le(),k(a),U(e=>{L(a,0,e),O(a,`aria-hidden`,!i()||void 0)},[()=>F(Ee(`size-4`,n()))]),v(e,a),N()}var ur=m(`<svg viewBox="0 0 24 24" role="img" aria-label="Anthropic" fill="currentColor"><path d="M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223 2.291-5.945 2.292 5.945Z"></path></svg>`),dr=m(`<svg viewBox="0 0 24 24" role="img" aria-label="xAI" fill="currentColor"><path d="M6.469 8.776 16.512 23h-4.464L2.005 8.776H6.47Zm-.004 7.9 2.233 3.164L6.467 23H2l4.465-6.324ZM22 2.582V23h-3.659V7.764L22 2.582ZM22 1l-9.952 14.095-2.233-3.163L17.533 1H22Z"></path></svg>`),fr=m(`<svg viewBox="0 0 24 24" role="img" aria-label="Moonshot" fill="currentColor" fill-rule="evenodd"><path d="M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"></path></svg>`),pr=m(`<svg viewBox="0 0 24 24" role="img" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="9"></circle><path d="M12 8v4l2.5 1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);function mr(e,t){E(t,!0);let n=M(t,`className`,3,``);var i=a(),o=b(i),s=e=>{{let t=C(()=>Ee(`size-4 text-foreground`,n()));lr(e,{get className(){return p(t)}})}},c=e=>{var t=ur();U(e=>L(t,0,e),[()=>F(Ee(`size-4 text-[#D97757]`,n()))]),v(e,t)},l=e=>{var t=dr();U(e=>L(t,0,e),[()=>F(Ee(`text-foreground size-4`,n()))]),v(e,t)},u=e=>{var t=fr();U(e=>L(t,0,e),[()=>F(Ee(`text-foreground size-4`,n()))]),v(e,t)},d=e=>{var r=pr();U(e=>{L(r,0,e),O(r,`aria-label`,t.provider||`Unknown provider`)},[()=>F(Ee(`text-muted-foreground size-4`,n()))]),v(e,r)};r(o,e=>{t.provider===`openai`?e(s):t.provider===`anthropic`?e(c,1):t.provider===`xai`?e(l,2):t.provider===`fireworks`?e(u,3):e(d,-1)}),v(e,i),N()}var hr=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],gr=[`standard`,`fast`],_r=[`gpt-5.6-sol`,`gpt-5.6-terra`,`gpt-5.6-luna`,`claude-opus-5`,`claude-fable-5`,`grok-4.5`,`kimi-k3`],vr=[{id:`gpt-5.6-sol`,label:`GPT-5.6 Sol`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:hr,defaultReasoningEffort:`medium`,serviceTiers:gr,usageWeights:{input:.005,cacheRead:5e-4,cacheWrite:.00625,output:.03,fastMultiplier:2}},{id:`gpt-5.6-terra`,label:`GPT-5.6 Terra`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:hr,defaultReasoningEffort:`medium`,serviceTiers:gr,usageWeights:{input:.0025,cacheRead:25e-5,cacheWrite:.003125,output:.015,fastMultiplier:2}},{id:`gpt-5.6-luna`,label:`GPT-5.6 Luna`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:hr,defaultReasoningEffort:`medium`,serviceTiers:gr,usageWeights:{input:.001,cacheRead:1e-4,cacheWrite:.00125,output:.006,fastMultiplier:2}},{id:`claude-opus-5`,label:`Claude Opus 5`,provider:`anthropic`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`medium`,`high`,`xhigh`,`max`],defaultReasoningEffort:`high`,serviceTiers:gr,usageWeights:{input:.005,cacheRead:5e-4,cacheWrite:.00625,output:.025,fastMultiplier:2}},{id:`claude-fable-5`,label:`Claude Fable 5`,provider:`anthropic`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`medium`,`high`,`xhigh`,`max`],defaultReasoningEffort:`high`,serviceTiers:gr,usageWeights:{input:.01,cacheRead:.001,cacheWrite:.0125,output:.05,fastMultiplier:1}},{id:`grok-4.5`,label:`Grok 4.5`,provider:`xai`,contextWindowTokens:5e5,autoCompactTokenLimit:4e5,reasoningEfforts:[`low`,`medium`,`high`],defaultReasoningEffort:`high`,serviceTiers:gr,usageWeights:{input:.002,cacheRead:5e-4,cacheWrite:.002,output:.006,fastMultiplier:2}},{id:`kimi-k3`,label:`Kimi K3`,provider:`fireworks`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`high`,`max`],defaultReasoningEffort:`max`,serviceTiers:gr,usageWeights:{input:.003,cacheRead:3e-4,cacheWrite:.003,output:.015,fastMultiplier:1.5}}],yr=`gpt-5.6-sol`,br=Sr(yr).defaultReasoningEffort,xr=`standard`;function Sr(e){let t=vr.find(t=>t.id===e);if(!t)throw Error(`Unsupported model: ${e}`);return t}function Cr(e){return e}function wr(e,t){return e.models.find(e=>e.id===t)}function Tr(e,t,n){return(e.tierAllowedModels[t]??[]).includes(n)}function Er(e,t,n){return Tr(e,t,n)?n:e.tierAllowedModels[t]?.[0]??e.defaultModelId}function Dr(e,t,n){return(e.tierAllowedServiceTiers[t]??[]).includes(n)}function Or(e,t,n){return n.serviceTiers.filter(n=>Dr(e,t,n))}function kr(e,t,n){return n.serviceTiers.map(n=>{let r={id:n,label:Pr(n)};return Dr(e,t,n)?r:{...r,locked:!0,lockTooltip:e.serviceTierLockUpgradeMessage}})}function Ar(e,t){let n=[],r=[];for(let i of e.models){let a={id:i.id,label:i.label,provider:i.provider};Tr(e,t,i.id)?n.push(a):r.push({...a,locked:!0,lockTooltip:e.modelLockUpgradeMessage})}return[...n,...r]}var jr={none:`None`,low:`Low`,medium:`Medium`,high:`High`,xhigh:`Extra High`,max:`Max`},Mr={standard:`Standard`,fast:`Fast`};function Nr(e){return jr[e]??e}function Pr(e){return Mr[e]??e}var Fr=i(`<span class="text-muted-foreground ml-auto text-xs">Default</span>`),Ir=i(`<button type="button" class="focus-visible:ring-ring/60 text-foreground hover:bg-hover-fill flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm outline-none focus-visible:ring-2"><!> <span> </span> <!></button>`),Lr=i(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Rr=i(`<button type="button"><!> <!> <span> </span> <!></button>`),zr=i(`<div class="bg-popover/96 absolute bottom-[calc(100%+0.75rem)] left-0 z-50 min-w-[15rem] rounded-[18px] border border-[var(--hairline)] p-2 shadow-[var(--composer-shadow)] backdrop-blur-xl" role="dialog" aria-label="Reasoning and service tier"><p class="text-muted-foreground px-3 pt-1 pb-1.5 text-[11px] font-medium">Reasoning</p> <div class="space-y-0.5"></div> <div class="mx-2 my-2 h-px bg-[var(--hairline)]"></div> <p class="text-muted-foreground px-3 pb-1.5 text-[11px] font-medium">Service tier</p> <div class="space-y-0.5"></div></div>`),Br=i(`<div><button type="button" class="focus-visible:ring-ring/60 text-muted-foreground hover:bg-hover-fill inline-flex h-9 shrink-0 items-center gap-1 rounded-lg px-2 text-[15px] transition outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50" aria-haspopup="dialog" aria-label="Select reasoning effort and service tier"><span> </span> <!></button> <!></div> <!>`,1);function Vr(e,t){E(t,!0);let i=M(t,`reasoningEffort`,31,()=>u(br)),a=M(t,`serviceTier`,31,()=>u(xr)),o=M(t,`disabled`,3,!1),c=M(t,`className`,3,``),d=C(()=>t.serviceTierOptions?t.serviceTierOptions:t.model.serviceTiers.map(e=>({id:e,label:Pr(e)}))),m=C(()=>p(d).filter(e=>!e.locked).map(e=>e.id)),h=x(!1),g=x(null),_=x(null),S=Jn();function w(e){i(e)}function T(e,t){let n=p(d).find(t=>t.id===e);if(n){if(n.locked){t&&n.lockTooltip&&S.showLockTooltip(t,n.lockTooltip,!0);return}a(e)}}n(()=>{t.model.reasoningEfforts.includes(i())||i(t.model.defaultReasoningEffort),p(m).includes(a())||a(p(m)[0]??`standard`)}),n(()=>{if(!p(h)){S.hideLockTooltip();return}return Yn({getRoot:()=>p(g),onOutside:()=>{l(h,!1)},onEscape:()=>{l(h,!1),p(_)?.focus()}})}),n(()=>{o()&&l(h,!1)});var D=Br(),ee=b(D),A=y(ee),j=y(A),te=y(j);k(j);var ne=s(j,2);{let e=C(()=>Ee(`text-muted-foreground size-3 shrink-0 transition-transform`,p(h)&&`rotate-180`));xt(ne,{get class(){return p(e)}})}k(A),ce(A,e=>l(_,e),()=>p(_));var re=s(A,2),ie=e=>{var n=zr(),o=s(y(n),2);ue(o,20,()=>t.model.reasoningEfforts,e=>e,(e,n)=>{var a=Ir(),o=y(a);{let e=C(()=>Ee(`size-4 shrink-0 transition-opacity`,n===i()?`opacity-100`:`opacity-0`));yt(o,{get class(){return p(e)}})}var c=s(o,2),l=y(c,!0);k(c);var u=s(c,2),d=e=>{v(e,Fr())};r(u,e=>{n===t.model.defaultReasoningEffort&&e(d)}),k(a),U(e=>{O(a,`aria-pressed`,n===i()),V(l,e)},[()=>Nr(n)]),P(`click`,a,()=>w(n)),v(e,a)}),k(o);var c=s(o,6);ue(c,21,()=>p(d),e=>e.id,(e,t)=>{let n=C(()=>!!p(t).locked);var i=Rr(),o=y(i),c=e=>{var t=Lr();Zt(y(t),{class:`size-3.5`}),k(t),v(e,t)},l=e=>{{let n=C(()=>Ee(`size-4 shrink-0 transition-opacity`,p(t).id===a()?`opacity-100`:`opacity-0`));yt(e,{get class(){return p(n)}})}};r(o,e=>{p(n)?e(c):e(l,-1)});var u=s(o,2),d=e=>{On(e,{class:`size-3.5 shrink-0 text-amber-400`})};r(u,e=>{p(t).id===`fast`&&e(d)});var h=s(u,2),g=y(h,!0);k(h);var _=s(h,2),b=e=>{v(e,Fr())};r(_,e=>{!p(n)&&p(t).id===p(m)[0]&&e(b)}),k(i),U((e,r)=>{L(i,1,e),O(i,`aria-pressed`,!p(n)&&p(t).id===a()),O(i,`aria-disabled`,p(n)),O(i,`aria-label`,p(n)&&p(t).lockTooltip?`${p(t).label}. ${p(t).lockTooltip}`:void 0),L(h,1,r),V(g,p(t).label)},[()=>F(Ee(`focus-visible:ring-ring/60 flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm outline-none focus-visible:ring-2`,p(n)?`cursor-not-allowed opacity-45`:`text-foreground hover:bg-hover-fill`)),()=>F(Ee(p(n)&&`text-muted-foreground`))]),f(`mouseenter`,i,e=>{p(n)&&p(t).lockTooltip&&S.showLockTooltip(e,p(t).lockTooltip)}),f(`mouseleave`,i,()=>S.hideLockTooltip()),f(`focus`,i,e=>{p(n)&&p(t).lockTooltip&&S.showLockTooltip(e,p(t).lockTooltip)}),f(`blur`,i,()=>S.hideLockTooltip()),P(`click`,i,e=>T(p(t).id,e)),v(e,i)}),k(c),k(n),v(e,n)};r(re,e=>{p(h)&&e(ie)}),k(ee),ce(ee,e=>l(g,e),()=>p(g)),Zn(s(ee,2),{get tooltip(){return S.lockTooltip}}),U((e,t,n)=>{L(ee,1,e),O(A,`aria-expanded`,p(h)),A.disabled=o(),V(te,`${t??``} · ${n??``}`)},[()=>F(Ee(`relative`,c())),()=>Nr(i()),()=>Pr(a())]),P(`click`,A,()=>{l(h,!p(h))}),v(e,D),N()}t([`click`]);function Hr(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}var Ur=/(^|\s)\$([a-z0-9-]*)$/i;function Wr(e,t){if(t<0||t>e.length)return null;let n=e.slice(0,t).match(Ur);return!n||n.index===void 0?null:{query:n[2].toLowerCase(),tokenStart:n.index+n[1].length}}function Gr(e,t){return Wr(e,t)?.query??null}function Kr(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 qr(e,t,n){let r=Wr(e,t);if(!r)return null;let i=t;for(;i<e.length&&/[a-z0-9-]/i.test(e[i]??``);)i+=1;e[i]===` `&&(i+=1);let a=`$${n} `;return{text:`${e.slice(0,r.tokenStart)}${a}${e.slice(i)}`,caret:r.tokenStart+a.length}}var Jr=`agent_decide`;function Yr(e){return!!e.selectedOptionId?.trim()||!!e.text.trim()}function Xr(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}var Zr=X.union(X.string(),X.number(),X.boolean(),X.null()),Qr=8;function $r(e){return e===0?Zr:X.union(Zr,X.array($r(e-1)),X.record(X.string(),$r(e-1)))}var ei=$r(Qr),ti=[`free`,`pro`,`admin`],ni={free:`Free`,pro:`Pro`,admin:`Admin`},ri={modelUsage:{weekly:5e3,monthly:15e3},webTools:{weekly:500,monthly:1500}};ri.modelUsage.weekly*5,ri.modelUsage.monthly*5,ri.webTools.weekly*5,ri.webTools.monthly*5;function ii(e){return e.map(e=>X.literal(e))}X.union(...ii(hr)),X.union(...ii(gr)),X.union(...ii(_r)),X.union(...ii(ti)),X.union(X.literal(`active`),X.literal(`on_hold`),X.literal(`cancelled`),X.literal(`expired`),X.literal(`failed`));var ai=X.object({path:X.string(),directory:X.string(),contents:X.string(),truncated:X.boolean()}),oi=X.object({patch:X.string()}),si=X.object({cmd:X.string(),workdir:X.optional(X.string()),shell:X.optional(X.string()),timeoutMs:X.optional(X.number()),yieldTimeMs:X.optional(X.number()),maxOutputChars:X.optional(X.number())}),ci=X.object({url:X.string()}),li=X.object({query:X.string(),numResults:X.optional(X.number())}),ui=X.object({sessionId:X.string(),chars:X.optional(X.string()),terminate:X.optional(X.boolean()),yieldTimeMs:X.optional(X.number())}),di=X.object({name:X.string()}),fi=X.object({id:X.string(),label:X.string()}),pi=X.object({question:X.string(),options:X.array(fi),yieldTimeMs:X.optional(X.number()),timeoutMs:X.optional(X.number())}),mi=X.object({questionId:X.id(`agentQuestions`),yieldTimeMs:X.optional(X.number())});X.union(X.object({}),oi,pi,mi,si,di,ci,li,ui);var hi=X.object({changes:X.array(X.object({path:X.string(),operation:X.union(X.literal(`created`),X.literal(`updated`),X.literal(`deleted`),X.literal(`renamed`),X.literal(`copied`))}))}),gi=X.object({command:X.string(),cwd:X.string(),sessionId:X.optional(X.string()),exitCode:X.optional(X.number()),success:X.boolean(),running:X.boolean(),timedOut:X.boolean(),stdout:X.string(),stderr:X.string(),output:X.string(),truncated:X.boolean(),error:X.optional(X.string())}),_i=X.object({url:X.string(),markdown:X.string(),truncated:X.boolean()}),vi=X.object({results:X.array(X.object({title:X.optional(X.string()),url:X.string(),publishedDate:X.optional(X.string()),author:X.optional(X.string()),text:X.optional(X.string())}))}),yi=X.object({name:X.string(),description:X.string(),content:X.string(),dir:X.optional(X.string()),truncated:X.optional(X.boolean())}),bi=X.object({optionId:X.optional(X.string()),optionLabel:X.optional(X.string()),text:X.optional(X.string())}),xi=X.object({questionId:X.id(`agentQuestions`),question:X.string(),options:X.array(fi),pending:X.boolean(),timedOut:X.boolean(),answer:X.optional(bi)});X.union(X.string(),X.array(ai),hi,xi,gi,yi,_i,vi),X.union(X.literal(`disconnected`),X.literal(`connected`)),X.union(X.literal(`queued`),X.literal(`running`),X.literal(`awaiting_executor`),X.literal(`completed`),X.literal(`failed`),X.literal(`cancelled`));var Si=[`cancelled`,`completed`,`failed`];X.union(...ii(Si));function Ci(e){return Si.includes(e)}X.union(X.literal(`apply_patch`),X.literal(`ask_question`),X.literal(`await_question`),X.literal(`exec_command`),X.literal(`get_workspace_instructions`),X.literal(`read_skill`),X.literal(`scrape_url`),X.literal(`web_search`),X.literal(`write_stdin`)),X.union(X.literal(`pending`),X.literal(`answered`),X.literal(`timedOut`),X.literal(`cancelled`)),X.union(X.literal(`pending`),X.literal(`claimed`),X.literal(`completed`),X.literal(`failed`),X.literal(`cancelled`)),X.union(X.literal(`prompt`),X.literal(`response`));var wi=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`],Ti=`10 MiB`,Ei=X.object({type:X.literal(`text`),id:X.string(),text:X.string(),turnId:X.optional(X.string()),providerMetadata:X.optional(ei)}),Di=X.object({type:X.literal(`reasoning`),id:X.string(),text:X.string(),turnId:X.optional(X.string()),providerMetadata:X.optional(ei)}),Oi=X.object({type:X.literal(`tool-call`),partId:X.optional(X.string()),callId:X.string(),name:X.string(),input:ei,turnId:X.optional(X.string()),providerMetadata:X.optional(ei)}),ki=X.union(...ii([`cancelled`,`failed`]));X.object({error:X.string(),status:ki});var Ai=X.object({type:X.literal(`tool-result`),callId:X.string(),name:X.optional(X.string()),output:ei});X.union(Ei,Di,Oi,Ai);var ji=X.union(X.literal(`system`),X.literal(`user`),X.literal(`assistant`)),Mi=X.union(X.object({type:X.literal(`text`),text:X.string()}),X.object({type:X.literal(`image`),imageJson:X.string()})),Ni=X.union(X.object({type:X.literal(`text`),text:X.string(),additionalParamsJson:X.optional(X.string())}),X.object({type:X.literal(`reasoning`),id:X.optional(X.string()),blocksJson:X.string()}),X.object({type:X.literal(`toolCall`),id:X.string(),callId:X.optional(X.string()),name:X.string(),argumentsJson:X.string(),signature:X.optional(X.string()),additionalParamsJson:X.optional(X.string())}),X.object({type:X.literal(`toolResult`),id:X.string(),callId:X.optional(X.string()),items:X.array(Mi)}),X.object({type:X.literal(`image`),imageJson:X.string()}),X.object({type:X.literal(`audio`),audioJson:X.string()}),X.object({type:X.literal(`video`),videoJson:X.string()}),X.object({type:X.literal(`document`),documentJson:X.string()}));X.object({role:ji,assistantId:X.optional(X.string()),contents:X.array(Ni)});function Pi(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>e===r[t])}var Fi=wi;function Ii(e){return Fi.includes(e)}function Li(e,t){return e>=4?`You can attach up to 4 images.`:Ii(t.type)?t.size>10485760?`${t.name||`This image`} is larger than ${Ti}.`:null:`${t.name||`This file`} is not a supported image. Use JPEG, PNG, GIF, or WebP.`}var Ri=i(`<div class="text-muted-foreground mb-3 flex items-center gap-2 px-4 text-[11px]"><span class="inline-flex items-center gap-0.75"><span class="bg-foreground/28 size-1 animate-pulse rounded-full"></span> <span class="bg-foreground/28 size-1 animate-pulse rounded-full [animation-delay:200ms]"></span> <span class="bg-foreground/28 size-1 animate-pulse rounded-full [animation-delay:400ms]"></span></span> <span> </span></div>`),zi=i(`<div class="text-muted-foreground mb-3 flex items-center gap-2 px-4 text-[11px]" role="status" aria-live="polite"><span class="bg-foreground/28 size-1.5 animate-pulse rounded-full"></span> <span> </span></div>`),Bi=i(`<li><button type="button"> </button></li>`),Vi=i(`<div class="mb-3" role="group" aria-label="Agent question"><p class="text-foreground text-[14px] leading-6 font-medium"> </p> <ul class="mt-2 flex flex-col gap-1.5" aria-label="Answer options"></ul></div>`),Hi=i(`<span class="absolute inset-0 flex items-center justify-center" role="status"><span class="border-border border-t-foreground/80 size-3.5 animate-spin rounded-full border-2"></span></span>`),Ui=i(`<span class="text-destructive absolute inset-x-0 bottom-0 bg-rose-950/80 px-1 py-0.5 text-center text-[9px] leading-3" role="alert">Failed</span>`),Wi=i(`<li><img/> <!> <button type="button" class="bg-foreground/70 text-background hover:bg-foreground/90 absolute top-1 right-1 flex size-4.5 cursor-pointer items-center justify-center rounded-full transition disabled:cursor-not-allowed disabled:opacity-40"><!></button></li>`),Gi=i(`<ul class="mb-3 flex flex-wrap items-center gap-2" aria-label="Attached images"></ul>`),Ki=i(`<p class="text-muted-foreground px-3 py-2 text-sm">Loading skills…</p>`),qi=i(`<div class="flex items-center justify-between gap-3 px-3 py-2"><p class="text-muted-foreground text-sm">Couldn’t load skills</p> <button type="button" class="text-muted-foreground hover:text-foreground text-sm underline-offset-2 hover:underline">Retry</button></div>`),Ji=i(`<p class="text-muted-foreground px-3 py-2 text-sm">No matching skills</p>`),Yi=i(`<button type="button" role="option"><span class="text-sm font-medium"> </span> <span class="text-muted-foreground line-clamp-2 text-[12px]"> </span></button>`),Xi=i(`<div class="border-border bg-popover absolute inset-x-0 bottom-full z-30 mb-2 max-h-56 overflow-y-auto rounded-xl border py-1 shadow-2xl" id="composer-skills-listbox" aria-label="Available skills"><!></div>`),Zi=i(`<button type="button" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-full bg-rose-500/90 text-white transition-all duration-150 hover:scale-105 hover:bg-rose-500 disabled:pointer-events-none disabled:opacity-60 disabled:hover:scale-100" aria-label="Stop generation" title="Stop"><!></button>`),Qi=i(`<button type="button" class="bg-primary/90 text-primary-foreground hover:bg-primary flex h-10 w-10 items-center justify-center rounded-full transition-all duration-150 hover:scale-105 enabled:cursor-pointer disabled:pointer-events-none disabled:opacity-30 disabled:hover:scale-100"><!></button>`),$i=i(`<div class="bg-tooltip text-tooltip-foreground ring-border pointer-events-none fixed z-100 -translate-x-1/2 -translate-y-full rounded-md px-2.5 py-1.5 text-[12px] leading-4 whitespace-nowrap shadow-lg ring-1" role="tooltip"> </div>`),ea=i(`<footer class="shrink-0 px-6 py-4"><div class="mx-auto max-w-336"><!> <div><div><div class="relative flex min-h-33 flex-col px-4 pt-4 pb-2.5"><!> <!> <div class="relative min-h-0 flex-1"><!> <textarea rows="1" class="text-foreground placeholder:text-muted-foreground field-sizing-content max-h-40 min-h-17 w-full resize-none overflow-y-auto border-0 bg-transparent px-0 py-0 text-[14px] leading-6 outline-none" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" autocomplete="off"></textarea></div> <div class="flex min-w-0 flex-nowrap items-center justify-between gap-3 overflow-visible px-0 pt-2.5 pb-0"><div class="-m-1 flex min-w-0 flex-1 items-center gap-1 overflow-visible p-1"><input type="file" class="hidden" multiple=""/> <button type="button" class="text-muted-foreground enabled:hover:text-foreground flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition enabled:cursor-pointer disabled:opacity-40"><!></button> <div class="bg-hover-fill-strong mx-1 hidden h-4 w-px shrink-0 sm:block"></div> <!> <div class="bg-hover-fill-strong mx-1 hidden h-4 w-px shrink-0 sm:block"></div> <!></div> <div class="flex shrink-0 flex-nowrap items-center justify-end gap-2.5"><div class="group/context relative"><button type="button" class="focus-visible:ring-ring/60 relative flex size-8 cursor-help items-center justify-center rounded-full focus-visible:ring-2 focus-visible:outline-none" aria-describedby="context-window-details"><span class="bg-muted size-5.5 rounded-full"></span></button> <div id="context-window-details" class="border-border bg-popover invisible absolute right-0 bottom-full z-50 mb-3 w-76 translate-y-1 rounded-xl border p-4 opacity-0 shadow-(--composer-shadow) transition duration-150 group-focus-within/context:visible group-focus-within/context:translate-y-0 group-focus-within/context:opacity-100 group-hover/context:visible group-hover/context:translate-y-0 group-hover/context:opacity-100" role="tooltip"><div class="flex items-center justify-between gap-4 text-[13px]"><span class="text-foreground font-medium">Context window</span> <span class="text-muted-foreground"> </span></div> <div class="bg-hover-fill mt-3 h-1.5 overflow-hidden rounded-full"><div class="bg-accent h-full rounded-full transition-[width] duration-300"></div></div> <div class="text-muted-foreground mt-3 flex items-center justify-between text-[12px]"><span>Total processed</span> <span> </span></div> <p class="text-muted-foreground mt-4 text-[12px] leading-5"> </p></div></div> <!> <!></div></div></div></div></div></div></footer> <!>`,1);function ta(e,t){E(t,!0);let i=M(t,`prompt`,15,``),o=M(t,`selectedModel`,31,()=>u(yr)),c=M(t,`selectedReasoningEffort`,31,()=>u(br)),d=M(t,`selectedServiceTier`,31,()=>u(xr)),m=M(t,`pendingQuestion`,3,null),g=M(t,`selectedQuestionOptionId`,15,null),_=M(t,`projectSkills`,3,null),S=Te(),w=Se(W.billing.getMySubscription,()=>S.isAuthenticated&&!S.isLoading?{}:`skip`),T=C(()=>w.data?.tier),D=C(()=>!!w.error),A=C(()=>t.modelCatalog?Ar(t.modelCatalog,p(T)??`free`):[]),ne=C(()=>t.modelCatalog?wr(t.modelCatalog,o()):void 0),re=C(()=>t.modelCatalog&&p(ne)?kr(t.modelCatalog,p(T)??`free`,p(ne)):void 0),ie=C(()=>p(ne)!==void 0&&(p(D)||p(T)!==void 0&&t.modelCatalog!==void 0&&Tr(t.modelCatalog,p(T),o()))),ae=x(null),I=x(null),oe=x(null),se=x(u([])),R=x(`idle`),z=x(!1),le=x(0),B=x(0),H=0,de,fe=u([]),pe=C(()=>m()!=null),me=C(()=>t.isRunning&&!p(pe)||t.isSubmitting),he=C(()=>!!i().trim()||t.attachments.length>0),ge=C(()=>Yr({selectedOptionId:g(),text:i()})),_e=C(()=>p(pe)?p(ge):p(he)),ve=C(()=>t.attachments.some(e=>e.status!==`ready`)),ye=C(()=>t.attachments.length<4&&!p(me)&&!p(pe)),be=x(null);n(()=>{let e=m()?.questionId??null;e!==p(be)&&(l(be,e,!0),g(null),i().trim()&&i(``))});let xe=`Attach images (up to 4)`,Ce=typeof CSS<`u`&&CSS.supports(`field-sizing`,`content`),we=C(()=>t.contextUsage.contextWindowTokens>0?Math.min(100,Math.round(t.contextUsage.inputTokens/t.contextUsage.contextWindowTokens*100)):0),Ee=C(()=>t.contextUsage.contextWindowTokens>0?Math.round(t.contextUsage.autoCompactTokenLimit/t.contextUsage.contextWindowTokens*100):0),De=C(()=>Gr(i(),p(B))),Oe=C(()=>p(De)!==null&&!p(z)&&!p(pe)),ke=C(()=>p(De)===null?[]:Kr(p(se),p(De))),Ae=C(()=>p(Oe)&&p(ke).length>0?`composer-skill-option-${p(le)}`:void 0);function je(){l(B,p(ae)?.selectionStart??i().length,!0)}function Me(){l(se,[],!0),l(R,`idle`),l(z,!1),l(le,0),H+=1}async function Ne(e=!1){if(p(R)===`loading`||(p(R)===`ready`||p(R)===`error`)&&!e)return;if(!_()?.load){l(se,[],!0),l(R,`ready`);return}let t=++H;l(R,`loading`);try{let e=await _().load();if(t!==H)return;l(se,e,!0),l(R,`ready`)}catch{if(t!==H)return;l(se,[],!0),l(R,`error`)}}function G(e){let t=qr(i(),p(B),e.name);t&&(i(t.text),l(B,t.caret,!0),l(z,!0),queueMicrotask(()=>{p(ae)&&(p(ae).focus(),p(ae).setSelectionRange(t.caret,t.caret),q())}))}function Pe(e){let n=e.currentTarget,r=Array.from(n.files??[]);n.value=``,r.length>0&&t.onAttachFiles(r)}function K(e){let n=Array.from(e.clipboardData?.files??[]).filter(e=>e.type.startsWith(`image/`));n.length===0||t.isRunning||t.isSubmitting||p(pe)||(e.preventDefault(),t.onAttachFiles(n))}function Fe(e){let t=e.currentTarget;if(!(t instanceof HTMLButtonElement)||t.disabled)return;let n=t.getBoundingClientRect();l(oe,{top:n.top-8,left:n.left+n.width/2},!0)}function Ie(){l(oe,null)}function q(){if(!p(ae)||Ce)return;let e=p(ae);e.style.height=`68px`;let t=Math.min(Math.max(e.scrollHeight,68),160);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`}function Le(e){if(p(Oe)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),p(ke).length===0)return;let t=e.key===`ArrowDown`?1:-1;l(le,(p(le)+t+p(ke).length)%p(ke).length);return}if(e.key===`Escape`){e.preventDefault(),l(z,!0);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){e.preventDefault();let t=p(ke)[p(le)];t&&G(t);return}}!t.canSend||!p(pe)&&!p(ie)||t.isSubmitting||p(me)||!p(_e)||!p(pe)&&p(ve)||Hr(e)&&(e.preventDefault(),t.onSubmit())}function Re(e){g(g()===e?null:e)}function ze(e){if(!t.modelCatalog)return;let n=wr(t.modelCatalog,e);n&&c(n.defaultReasoningEffort)}function J(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1).replace(/\.0$/,``)}m`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}n(()=>{t.modelCatalog&&(!o()||!wr(t.modelCatalog,o()))&&(o(t.modelCatalog.defaultModelId),c(t.modelCatalog.defaultReasoningEffort),d(t.modelCatalog.defaultServiceTier))}),n(()=>{if(!t.modelCatalog||!p(T))return;let e=Er(t.modelCatalog,p(T),o());e!==o()&&(o(e),c(wr(t.modelCatalog,e)?.defaultReasoningEffort??t.modelCatalog.defaultReasoningEffort));let n=wr(t.modelCatalog,e);if(!n)return;let r=Or(t.modelCatalog,p(T),n);r.includes(d())||d(r[0]??t.modelCatalog.defaultServiceTier)}),n(()=>{i(),q()}),n(()=>{let e=_()?.workspacePath??null;if(de!==e&&(de=e,Me()),p(De)===null){l(z,!1);return}p(z)||Ne()}),n(()=>{p(ke),l(le,0)}),n(()=>{!p(Oe)||p(ke).length===0||fe[p(le)]?.scrollIntoView({block:`nearest`})});var Be=ea(),Ve=b(Be),He=y(Ve),Ue=y(He),We=e=>{var n=Ri(),r=s(y(n),2),i=y(r);k(r),k(n),U(()=>V(i,`Working for ${t.elapsedLabel??``}`)),v(e,n)},Y=e=>{var n=zi(),r=s(y(n),2),i=y(r,!0);k(r),k(n),U(()=>V(i,t.isStarting?`Starting agent…`:`Sending request…`)),v(e,n)};r(Ue,e=>{t.elapsedLabel?e(We):t.isSubmitting&&e(Y,1)});var Ge=s(Ue,2);L(Ge,1,F(`composer-shell mx-auto w-full max-w-[48rem] rounded-[28px] p-px transition-colors duration-200`));var Ke=y(Ge);L(Ke,1,F(`composer-inner rounded-[27px] border border-[var(--hairline)] transition-colors duration-200`));var qe=y(Ke),X=y(qe),Je=e=>{var t=Vi(),n=y(t),r=y(n,!0);k(n);var i=s(n,2);ue(i,21,()=>m().options,e=>e.id,(e,t)=>{let n=C(()=>p(t).id===Jr),r=C(()=>g()===p(t).id);var i=Bi(),a=y(i),o=y(a,!0);k(a),k(i),U(()=>{L(a,1,`w-full rounded-lg border px-3 py-2 text-left text-[13px] leading-5 transition ${p(r)?`border-foreground/40 bg-hover-fill-strong text-foreground`:p(n)?`border-border/70 text-muted-foreground/80 hover:text-muted-foreground hover:bg-hover-fill`:`border-border text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),O(a,`aria-pressed`,p(r)),V(o,p(t).label)}),P(`click`,a,()=>{Re(p(t).id)}),v(e,i)}),k(i),k(t),U(()=>V(r,m().question)),v(e,t)};r(X,e=>{m()&&e(Je)});var Ye=s(X,2),Xe=e=>{var n=Gi();ue(n,21,()=>t.attachments,e=>e.localId,(e,n)=>{var i=Wi(),a=y(i),o=s(a,2),c=e=>{var t=Hi();U(()=>O(t,`aria-label`,`Uploading ${p(n).name??``}`)),v(e,t)},l=e=>{v(e,Ui())};r(o,e=>{p(n).status===`uploading`?e(c):p(n).status===`error`&&e(l,1)});var u=s(o,2);En(y(u),{class:`size-3`,"aria-hidden":`true`}),k(u),k(i),U(()=>{L(i,1,`group relative size-14 overflow-hidden rounded-xl border ${p(n).status===`error`?`border-rose-500/60`:`border-border`}`),O(i,`title`,p(n).error??p(n).name),O(a,`src`,p(n).previewUrl),O(a,`alt`,p(n).name),L(a,1,`size-full object-cover ${p(n).status===`uploading`?`opacity-50`:``}`),O(u,`aria-label`,`Remove ${p(n).name??``}`),u.disabled=p(me)}),P(`click`,u,()=>t.onRemoveAttachment(p(n).localId)),v(e,i)}),k(n),v(e,n)};r(Ye,e=>{t.attachments.length>0&&!p(pe)&&e(Xe)});var Ze=s(Ye,2),Qe=y(Ze),$e=e=>{var t=Xi(),n=y(t),i=e=>{v(e,Ki())},o=e=>{var t=qi(),n=s(y(t),2);k(t),P(`click`,n,()=>{Ne(!0)}),v(e,t)},c=e=>{v(e,Ji())},u=e=>{var t=a();ue(b(t),19,()=>p(ke),e=>e.name,(e,t,n)=>{var r=Yi(),i=y(r),a=y(i);k(i);var o=s(i,2),c=y(o,!0);k(o),k(r),ce(r,(e,t)=>fe[t]=e,e=>fe?.[e],()=>[p(n)]),U(()=>{O(r,`id`,`composer-skill-option-${p(n)??``}`),L(r,1,`flex w-full flex-col gap-0.5 px-3 py-2 text-left transition ${p(le)===p(n)?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),O(r,`aria-selected`,p(le)===p(n)),V(a,`$${p(t).name??``}`),V(c,p(t).description)}),f(`pointerenter`,r,()=>{l(le,p(n),!0)}),P(`click`,r,()=>{G(p(t))}),v(e,r)}),v(e,t)};r(n,e=>{p(R)===`loading`?e(i):p(R)===`error`?e(o,1):p(ke).length===0?e(c,2):e(u,-1)}),k(t),U(()=>O(t,`role`,p(R)===`ready`&&p(ke).length>0?`listbox`:`status`)),v(e,t)};r(Qe,e=>{p(Oe)&&e($e)});var et=s(Qe,2);h(et),ce(et,e=>l(ae,e),()=>p(ae)),k(Ze);var tt=s(Ze,2),nt=y(tt),rt=y(nt);ce(rt,e=>l(I,e),()=>p(I));var it=s(rt,2);qt(y(it),{class:`size-4`,"aria-hidden":`true`}),k(it);var at=s(it,4);{let e=(e,t=te)=>{mr(e,{get provider(){return t().provider},className:`size-4 shrink-0`})},n=C(()=>p(me)||p(pe)||t.modelCatalog===void 0);or(at,{get options(){return p(A)},ariaLabel:`Select model`,menuTitle:`Model`,get disabled(){return p(n)},searchable:!0,onValueChange:ze,className:`z-20 shrink-0`,triggerClassName:`h-9 border-0 bg-transparent px-2 text-[15px] text-foreground shadow-none hover:bg-transparent focus-visible:ring-0`,get value(){return o()},set value(e){o(e)},optionIcon:e,$$slots:{optionIcon:!0}})}var Z=s(at,4),ot=e=>{{let t=C(()=>p(me)||p(pe));Vr(e,{get model(){return p(ne)},get serviceTierOptions(){return p(re)},get disabled(){return p(t)},className:`z-20 shrink-0`,get reasoningEffort(){return c()},set reasoningEffort(e){c(e)},get serviceTier(){return d()},set serviceTier(e){d(e)}})}};r(Z,e=>{p(ne)&&e(ot)}),k(nt);var st=s(nt,2),ct=y(st),lt=y(ct),ut=s(lt,2),ft=y(ut),pt=s(y(ft),2),mt=y(pt);k(pt),k(ft);var ht=s(ft,2),gt=y(ht);k(ht);var _t=s(ht,2),vt=s(y(_t),2),yt=y(vt,!0);k(vt),k(_t);var bt=s(_t,2),xt=y(bt);k(bt),k(ut),k(ct);var St=s(ct,2),Ct=e=>{var n=Zi();gn(y(n),{class:`size-3.5 fill-current`}),k(n),P(`click`,n,function(...e){t.onCancel?.apply(this,e)}),v(e,n)};r(St,e=>{t.isRunning&&e(Ct)});var wt=s(St,2),Tt=e=>{var n=Qi();dt(y(n),{class:`size-4`}),k(n),U(()=>{n.disabled=!t.canSend||!p(pe)&&!p(ie)||t.isSubmitting||!p(_e)||!p(pe)&&p(ve),O(n,`aria-label`,p(pe)?`Submit answer`:`Send message`)}),P(`click`,n,function(...e){t.onSubmit?.apply(this,e)}),v(e,n)};r(wt,e=>{(p(pe)||!t.isRunning)&&e(Tt)}),k(st),k(tt),k(qe),k(Ke),k(Ge),k(He),k(Ve);var Et=s(Ve,2),Dt=e=>{var t=$i(),n=y(t,!0);k(t),U(()=>{j(t,`top: ${p(oe).top}px; left: ${p(oe).left}px;`),V(n,xe)}),v(e,t)};r(Et,e=>{p(oe)&&e(Dt)}),U((e,t,n,r)=>{O(et,`placeholder`,p(pe)?`Add detail, or type a custom answer`:`Ask anything, @tag files/directories, or use $ to show available skills`),et.disabled=p(me),O(et,`aria-expanded`,p(Oe)),O(et,`aria-controls`,p(Oe)?`composer-skills-listbox`:void 0),O(et,`aria-activedescendant`,p(Ae)),O(rt,`accept`,e),O(it,`aria-label`,xe),it.disabled=!p(ye),O(lt,`aria-label`,`Context window ${p(we)}% full`),j(lt,`background: conic-gradient(var(--accent) ${p(we)*3.6}deg, var(--hover-fill-strong) 0deg);`),V(mt,`${p(we)??``}% · ${t??``}/${n??``}`),j(gt,`width: ${p(we)}%`),V(yt,r),V(xt,`Sprocket automatically compacts context at about ${p(Ee)??``}% so
|
|
2
|
+
long-running work can continue.`)},[()=>Fi.join(`,`),()=>J(t.contextUsage.inputTokens),()=>J(t.contextUsage.contextWindowTokens),()=>J(t.contextUsage.totalTokensProcessed)]),P(`keydown`,et,Le),f(`paste`,et,K),f(`focus`,et,je),P(`input`,et,()=>{je(),q()}),P(`keyup`,et,je),P(`click`,et,je),f(`select`,et,je),ee(et,i),P(`change`,rt,Pe),f(`mouseenter`,it,Fe),f(`mouseleave`,it,Ie),f(`focus`,it,Fe),f(`blur`,it,Ie),P(`click`,it,()=>{Ie(),p(I)?.click()}),P(`keydown`,lt,e=>{e.key===`Escape`&&e.currentTarget.blur()}),v(e,Be),N()}t([`click`,`keydown`,`input`,`keyup`,`change`]);var na=i(`<p class="text-foreground text-[15px]"> </p>`),ra=i(`<button type="button" class="text-muted-foreground hover:text-foreground block text-left text-sm transition"><span> </span></button>`),ia=i(`<div class="mt-3 space-y-1"><!> <!></div>`),aa=i(`<p class="text-muted-foreground mt-3 text-sm">You’re signed in to Sprocket.</p>`),oa=i(`<p class="text-foreground mt-3 text-[15px]"> </p>`),sa=i(`<p class="text-muted-foreground mt-3 text-sm">Couldn’t load your subscription right now.</p>`),ca=i(`<div class="bg-hover-fill mt-3.5 h-4 w-16 animate-pulse rounded" aria-hidden="true"></div>`),la=i(`<!> Sign Out`,1),ua=i(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Account</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Profile</p> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Spikonado Subscription Tier</p> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Session</p> <p class="text-muted-foreground mt-2 text-sm leading-6">Sign out of this device. You’ll need to authenticate again to open your projects.</p> <div class="mt-4"><!></div></div></div></div></section>`);function da(e,t){E(t,!0);let n=x(!1),i=Te(),a=Se(W.billing.getMySubscription,()=>i.isAuthenticated&&!i.isLoading?{}:`skip`),o=C(()=>[t.user?.firstName,t.user?.lastName].filter(Boolean).join(` `).trim()||null);var c=ua(),u=s(y(c),2),d=y(u),f=y(d),m=s(y(f),2),h=e=>{var i=ia(),a=y(i),c=e=>{var t=na(),n=y(t,!0);k(t),U(()=>V(n,p(o))),v(e,t)};r(a,e=>{p(o)&&e(c)});var u=s(a,2),d=e=>{var r=ra(),i=y(r),a=y(i,!0);k(i),k(r),U(()=>{O(r,`aria-pressed`,p(n)),O(r,`aria-label`,p(n)?`Hide email address`:`Show email address`),L(i,1,F(p(n)?void 0:`blur-[5px] select-none`)),V(a,t.user.email)}),P(`click`,r,()=>{l(n,!p(n))}),v(e,r)};r(u,e=>{t.user?.email&&e(d)}),k(i),v(e,i)},g=e=>{v(e,aa())};r(m,e=>{p(o)||t.user?.email?e(h):e(g,-1)}),k(f);var _=s(f,2),S=s(y(_),2),w=e=>{var t=oa(),n=y(t,!0);k(t),U(()=>V(n,ni[a.data.tier])),v(e,t)},T=e=>{v(e,sa())},D=e=>{v(e,ca())};r(S,e=>{a.data?e(w):a.error?e(T,1):e(D,-1)}),k(_);var ee=s(_,2),A=s(y(ee),4);jn(y(A),{variant:`outline`,get onclick(){return t.onSignOut},children:(e,t)=>{var n=la();$t(b(n),{class:`mr-2 size-4`,"aria-hidden":`true`}),le(),v(e,n)},$$slots:{default:!0}}),k(A),k(ee),k(d),k(u),k(c),v(e,c),N()}t([`click`]);function fa(e,t){return e.find(e=>e.repositoryKey===t)??null}function pa(e,t){return t?e.find(e=>e._id===t)??null:null}function ma(e,t){return e.trim().length>0&&t.trim().length>0&&e!==t}function ha(e){return e.threadStatus!==`archived`}function ga(e){return{_id:e,userId:``,repositoryKey:`unknown`,displayName:`Unknown project`,executorStatus:`disconnected`,lastSeenAt:0,localAttachmentAvailability:`unlinked`}}function _a(e,t){let n=ya(t);return{project:e,threads:n,latestThreadAt:n.reduce((e,t)=>Math.max(e,t.lastMessageAt),0),activeThreadCount:ba(n)}}function va(e,t){let n=new Map;for(let e of t.filter(ha)){let t=n.get(e.projectId);if(t){t.push(e);continue}n.set(e.projectId,[e])}let r=[];for(let t of e)r.push(_a(t,n.get(t._id)??[])),n.delete(t._id);for(let[e,t]of n)r.push(_a(ga(e),t));return r.sort((e,t)=>{let n=e.latestThreadAt||e.project.lastSeenAt,r=t.latestThreadAt||t.project.lastSeenAt;return r===n?e.project.displayName.localeCompare(t.project.displayName):r-n})}function ya(e){return[...e].sort((e,t)=>e.hasActiveRun===t.hasActiveRun?t.lastMessageAt-e.lastMessageAt:Number(t.hasActiveRun)-Number(e.hasActiveRun))}function ba(e){return e.filter(e=>e.hasActiveRun).length}function xa(e,t){return t?e.find(e=>e.threadId===t)??null:null}function Sa(e,t){return t&&(e?.threadId??e?._id)===t?e:null}function Ca(e){let{pendingCreatedThreadId:t,threads:n}=e;return!t||n.some(e=>e.threadId===t)?null:t}function wa(e){return!e.threadId||e.threadId===e.pendingCreatedThreadId||e.hasLatestRunData}function Ta(e,t){return!!(t&&e[t])}function Ea(e,t,n){return{...e,[t]:n}}function Da(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 Oa(e,t,n){return!!(t&&(t!==e.previousRunId||n!==e.previousClaimExpiresAt))}function ka(e,t,n,r){let i=e[t];return!i||!Oa(i,n,r)?e:Da(e,t,i.launchId)}function Aa(e,t){let n=e;for(let e of t)n=ka(n,e.threadId,e.latestRunId,e.latestRunClaimExpiresAt);return n}function ja(e,t,n,r,i,a){let o=e[t];return!o||o.launchId!==n||o.expiresAt>r?{pendingLaunches:e,shouldRecover:!1}:{pendingLaunches:Da(e,t,n),shouldRecover:!Oa(o,i,a)}}function Ma(e){let{threads:t,currentThreadId:n,currentRepositoryKey:r,draftRepositoryKey:i,pendingCreatedThreadId:a=null}=e;return r&&i===r?null:n&&(t.some(e=>e.threadId===n)||a&&n===a)?n:t[0]?.threadId??null}var Na=i(`<p class="text-muted-foreground max-w-xl text-sm leading-6">No archived threads.</p>`),Pa=i(`<li class="group flex items-center gap-3 py-2"><div class="min-w-0 flex-1"><p class="text-foreground truncate text-[14px]"> </p> <p class="text-muted-foreground truncate text-[12px]"> </p></div> <button type="button" class="text-muted-foreground hover:text-muted-foreground shrink-0 px-1 text-[12px] opacity-0 transition group-hover:opacity-100 focus-visible:opacity-100">Restore</button></li>`),Fa=i(`<ul class="max-w-xl space-y-1"></ul>`),Ia=i(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Archived Threads</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><p class="text-muted-foreground mb-6 max-w-xl text-sm leading-6">We may permanently delete archived threads from our database at any time.</p> <!></div></section>`);function La(e,t){E(t,!0);let n=C(()=>[...t.threads].filter(e=>!ha(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt));var i=Ia(),a=s(y(i),2),o=s(y(a),2),c=e=>{v(e,Na())},l=e=>{var r=Fa();ue(r,21,()=>p(n),e=>e.threadId,(e,n)=>{let r=C(()=>pa(t.projects,p(n).projectId));var i=Pa(),a=y(i),o=y(a),c=y(o,!0);k(o);var l=s(o,2),u=y(l,!0);k(l),k(a);var d=s(a,2);k(i),U(()=>{V(c,p(n).title),V(u,p(r)?.displayName??`Unknown project`)}),P(`click`,d,()=>{t.onRestore(p(n).threadId)}),v(e,i)}),k(r),v(e,r)};r(o,e=>{p(n).length===0?e(c):e(l,-1)}),k(a),k(i),v(e,i),N()}t([`click`]);var Ra=i(`<button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill inline-flex size-7 shrink-0 items-center justify-center rounded-md transition"><!></button>`);function za(e,t){E(t,!0);var n=Ra(),i=y(n),a=e=>{vn(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{tn(e,{class:`size-3.5`,"aria-hidden":`true`})};r(i,e=>{t.theme===`dark`?e(a):e(o,-1)}),k(n),U(()=>{O(n,`aria-label`,t.theme===`dark`?`Switch to light mode`:`Switch to dark mode`),O(n,`title`,t.theme===`dark`?`Light mode`:`Dark mode`)}),P(`click`,n,()=>t.onThemeChange(t.theme===`dark`?`light`:`dark`)),v(e,n),N()}t([`click`]);var Ba=i(`<button type="button"><!> <span class="truncate"> </span></button>`),Va=i(`<aside class="app-sidebar-panel"><div class="flex h-full min-h-0 flex-col overflow-hidden"><div class="flex items-center justify-between gap-2 px-3.5 pt-3 pb-3"><button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill inline-flex h-8 items-center gap-2 rounded-lg px-2 text-[13px] transition"><!> Back</button> <!></div> <nav class="hide-scrollbar min-h-0 flex-1 space-y-0.5 overflow-y-auto px-2.5 pb-4" aria-label="Settings"></nav></div></aside>`);function Ha(e,t){E(t,!0);let n=[{id:`account`,label:`Account`,icon:Sn},{id:`usage`,label:`Usage`,icon:_t},{id:`archived`,label:`Archived Threads`,icon:st}];var r=Va(),i=y(r),a=y(i),o=y(a);lt(y(o),{class:`size-3.5`,"aria-hidden":`true`}),le(),k(o),za(s(o,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),k(a);var c=s(a,2);ue(c,21,()=>n,e=>e.id,(e,n)=>{var r=Ba(),i=y(r);B(i,()=>p(n).icon,(e,t)=>{t(e,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`})});var a=s(i,2),o=y(a,!0);k(a),k(r),U(()=>{L(r,1,`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-[13px] transition ${t.activePage===p(n).id?`bg-hover-fill-strong text-foreground`:`text-muted-foreground hover:bg-hover-fill hover:text-foreground`}`),O(r,`aria-current`,t.activePage===p(n).id?`page`:void 0),V(o,p(n).label)}),P(`click`,r,()=>{t.onNavigate(p(n).id)}),v(e,r)}),k(c),k(i),k(r),P(`click`,o,function(...e){t.onBack?.apply(this,e)}),v(e,r),N()}t([`click`]);var Ua=[{id:`modelUsage`,label:`Model usage`,noun:`model usage`,description:`More expensive models use up more usage.`},{id:`webTools`,label:`Web tools`,noun:`web tools`,description:`Web search and URL scrape share this quota.`}],Wa=[`weekly`,`monthly`],Ga=i(`<p class="text-muted-foreground text-sm leading-6">Couldn’t load your usage right now. Try again in a moment.</p>`),Ka=i(`<div class="space-y-2"><div class="bg-hover-fill h-3.5 w-full rounded"></div> <div class="bg-hover-fill h-1.5 w-full rounded-full"></div></div>`),qa=i(`<div class="space-y-5"><div class="bg-hover-fill h-3 w-28 rounded"></div> <!></div>`),Ja=i(`<div class="animate-pulse space-y-10" aria-hidden="true"><div class="bg-hover-fill h-4 w-24 rounded"></div> <!></div>`),Ya=i(`<p class="text-muted-foreground mt-1 text-[12px]"> </p>`),Xa=i(`<p> </p>`),Za=i(`<p class="text-muted-foreground mt-1.5 text-[12px]"> </p>`),Qa=i(`<div><div class="flex items-baseline justify-between gap-3"><p class="text-muted-foreground text-[13px]"> </p> <!></div> <p class="text-muted-foreground mt-0.5 text-[12px]"> </p> <div class="bg-hover-fill mt-2 h-1.5 overflow-hidden rounded-full" role="progressbar"><div></div></div> <!></div>`),$a=i(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase"> </p> <!> <div class="mt-4 space-y-6"></div></div>`),eo=i(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase">Subscription Tier</p> <p class="text-foreground mt-3 text-[15px]"> </p></div> <!>`,1),to=i(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Usage</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><!></div></div></section>`);function no(e,t){E(t,!0);let i=Te(),a=Se(W.usage.getMyUsage,()=>i.isAuthenticated&&!i.isLoading?{}:`skip`),o=x(u(Date.now()));n(()=>{let e=setInterval(()=>{l(o,Date.now(),!0)},6e4);return()=>{clearInterval(e)}});let c=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),d={weekly:`Weekly`,monthly:`Monthly`};function f(e){let t=Math.max(0,e-p(o)),n=Math.ceil(t/36e5);if(n>=24){let e=Math.floor(n/24),t=n%24;return t>0?`${e}d ${t}h`:`${e}d`}return t>=36e5?`${n}h`:`${Math.max(1,Math.ceil(t/6e4))}m`}function m(e,t){return e?`bg-rose-400/90`:t?`bg-amber-400/90`:`bg-foreground/25`}var h=to(),g=s(y(h),2),_=y(g),S=y(_),w=e=>{v(e,Ga())},T=e=>{var t=Ja();ue(s(y(t),2),17,()=>Ua,e=>e.id,(e,t)=>{var n=qa();ue(s(y(n),2),16,()=>Wa,e=>e,(e,t)=>{v(e,Ka())}),k(n),v(e,n)}),k(t),v(e,t)},D=e=>{var t=eo(),n=b(t),i=s(y(n),2),o=y(i,!0);k(i),k(n),ue(s(n,2),17,()=>a.data.meters,e=>e.id,(e,t)=>{var n=$a(),i=y(n),a=y(i,!0);k(i);var o=s(i,2),l=e=>{var n=Ya(),r=y(n,!0);k(n),U(()=>V(r,p(t).description)),v(e,n)};r(o,e=>{p(t).description&&e(l)});var u=s(o,2);ue(u,21,()=>p(t).windows,e=>e.period,(e,n)=>{let i=C(()=>p(n).limit>0),a=C(()=>p(i)?Math.round(p(n).used/p(n).limit*100):0),o=C(()=>p(i)&&p(n).used>=p(n).limit),l=C(()=>p(i)&&p(n).used>=p(n).limit*.9);var u=Qa(),h=y(u),g=y(h),_=y(g,!0);k(g);var b=s(g,2),x=e=>{var t=Xa(),n=y(t);k(t),U(()=>{L(t,1,`text-[12px] ${p(o)?`text-destructive`:p(l)?`text-amber-800 dark:text-amber-300`:`text-muted-foreground`}`),V(n,`${p(a)??``}% used`)}),v(e,t)};r(b,e=>{p(i)&&e(x)}),k(h);var S=s(h,2),w=y(S);k(S);var T=s(S,2);O(T,`aria-valuemin`,0);var E=y(T);k(T);var D=s(T,2),ee=e=>{var t=Za(),r=y(t);k(t),U(e=>V(r,`Resets in ${e??``}`),[()=>f(p(n).resetsAt)]),v(e,t)};r(D,e=>{p(n).resetsAt!==null&&e(ee)}),k(u),U((e,r,o,s,c)=>{V(_,d[p(n).period]),V(w,`${e??``} / ${r??``}`),O(T,`aria-label`,`${p(t).label} — ${d[p(n).period]}`),O(T,`aria-valuemax`,p(i)?p(n).limit:0),O(T,`aria-valuenow`,o),O(T,`aria-valuetext`,p(i)?`${p(a)}% used`:`0 / 0`),L(E,1,s),j(E,c)},[()=>c.format(p(i)?p(n).used:0),()=>c.format(p(i)?p(n).limit:0),()=>p(i)?Math.min(p(n).used,p(n).limit):0,()=>`h-full rounded-full transition-[width] duration-300 ${m(p(o),p(l))}`,()=>`width: ${p(i)?Math.min(100,Math.max(0,p(a))):0}%`]),v(e,u)}),k(u),k(n),U(()=>V(a,p(t).label)),v(e,n)}),U(()=>V(o,ni[a.data.tier])),v(e,t)};r(S,e=>{a.error?e(w):a.isLoading||a.data===void 0?e(T,1):e(D,-1)}),k(_),k(g),k(h),v(e,h),N()}function ro(e){if(!(!Xr(e)||typeof e.error!=`string`)&&!(e.status!==`cancelled`&&e.status!==`failed`))return{error:e.error,status:e.status}}function io(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&&ao(e.input,t.payload)),a((e,t)=>e.name===t.kind),n}function ao(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)=>ao(e,t[n]));if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&ao(e[n],t[n]))}function oo(e){return e.name||e.job?.kind||`tool`}function so(e){let t=[];for(let n of e){if(n.type===`text`||n.type===`reasoning`){t.push(n);continue}let e=oo(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 co(e){return e.type===`reasoning`?e.id:e.tools[0]?.callId??e.toolKey}function lo(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:co(n),blocks:[n]})}return t}function uo(e,t){for(let n of e)if(n.type===`tool-group`)for(let e of n.tools)e.job&&t(e.job)}function fo(e){let t;return uo(e,e=>{let n=e.claimedAt??e.enqueuedAt;t=t===void 0?n:Math.min(t,n)}),t}function po(e){let t;return uo(e,e=>{e.completedAt!==void 0&&(t=t===void 0?e.completedAt:Math.max(t,e.completedAt))}),t}function mo(e){let t=[],n=[],r=0,i;for(let a of e){if(a.type!==`work`){t.push(void 0);continue}t.push(r),n.push(i);let e=po(a.blocks);e!==void 0&&(i=i===void 0?e:Math.max(i,e)),r+=1}return{workIndexBySectionIndex:t,priorCompletedAtByWorkIndex:n}}function ho(e,t){let n=fo(e.blocks),r=t.workSectionIndex===0?t.runStartedAt:n??t.priorWorkCompletedAtMs??t.runStartedAt;return t.inProgress?{startedAtMs:r}:{startedAtMs:r,completedAtMs:po(e.blocks)??t.runCompletedAt??r}}function go(e){return e.output===void 0?!e.job||e.job.status===`pending`||e.job.status===`claimed`:!1}function _o(e,t){return t&&go(e)}function vo(e,t){return Xr(e)&&typeof e[t]==`string`?e[t]:void 0}function yo(e){return vo(e.output,`sessionId`)??vo(e.input,`sessionId`)??vo(e.job?.payload,`sessionId`)}function bo(e){let t=new Map;for(let n of e){let e=yo(n);if(!e)continue;let r=vo(n.output,`command`)??(oo(n)===`exec_command`?vo(n.input,`cmd`)??vo(n.job?.payload,`cmd`):void 0);r&&t.set(e,r)}return t}function xo(e,t){let n=yo(e);return vo(e.output,`command`)??(n?t.get(n):void 0)}function So(e,t){if(!t)return new Set;let n=new Map,r=new Set;for(let t of e){let e=yo(t);e&&(oo(t)===`exec_command`&&r.add(e),Xr(t.output)&&typeof t.output.running==`boolean`&&n.set(e,t.output.running))}return new Set([...r].filter(e=>n.get(e)===!0))}function Co(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=oo(r),o=yo(r),s=o!==void 0&&n.has(o),c=_o(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 wo(e,t){return!t&&go(e)?`interrupted`:e.job?.status===`cancelled`||e.job?.status===`failed`?e.job.status:ro(e.output)?.status}function To(e,t){if(!t&&go(e))return`The agent stopped before this tool call finished.`;let n=ro(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 Eo(e,t){let n=new Map(e.filter(e=>e.type===`tool-result`).map(e=>[e.callId,e])),r=io(e.filter(e=>e.type===`tool-call`),t.map(e=>({id:e._id,kind:e.kind,...e.callId?{callId:e.callId}:{},payload:e.payload}))),i=new Map;for(let e of t){let t=r.get(e._id);t&&i.set(t,e)}let a=[],o=new Set;for(let t of e){if(t.type===`tool-result`)continue;if(t.type===`text`||t.type===`reasoning`){t.text.trim().length>0&&a.push(t);continue}let e=n.get(t.callId),r=i.get(t.callId);r&&o.add(r._id),a.push({type:`tool`,callId:t.callId,name:t.name,input:t.input,...e?{output:e.output}:r?.result===void 0?{}:{output:r.result},...r?{job:r}:{}})}for(let e of t)o.has(e._id)||a.push({type:`tool`,callId:e.callId??`executor-job:${e._id}`,name:e.kind,input:e.payload,...e.result===void 0?{}:{output:e.result},job:e});return a}var Do={apply_patch:Ft,ask_question:Tt,await_question:Gt,check_docs:pt,exec_command:bn,get_workspace_instructions:on,read_skill:rn,scrape_url:Ut,web_search:cn,write_stdin:mn};function Oo(e){return Do[e]??wn}function ko(e){return Oo(e.job?.kind??e.name)}function Ao(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function jo(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`exec_command`:return`Ran Commands`;case`get_workspace_instructions`:return`Read Instructions`;case`read_skill`:return`Read Skill`;case`scrape_url`:return`Read Pages`;case`web_search`:return`Searched Web`;case`write_stdin`:return`Monitored Commands`;default:return Ao(e)}}function Mo(e){if(!Xr(e))return``;let t=[];return typeof e.workdir==`string`&&e.workdir.trim().length>0&&e.workdir!==`.`&&t.push(`cwd ${e.workdir}`),t.length>0?` (${t.join(`, `)})`:``}function No(e,t){let n=Xr(t)?t:void 0;switch(e){case`apply_patch`:return Ro(t)??`Patch`;case`ask_question`:return typeof n?.question==`string`?n.question:`Question`;case`await_question`:return`Waiting for answer`;case`check_docs`:return typeof n?.query==`string`?n.query:typeof n?.path==`string`?n.path:`Docs`;case`exec_command`:return typeof n?.cmd==`string`?`${n.cmd}${Mo(t)}`:`Command`;case`get_workspace_instructions`:return`Workspace instructions`;case`read_skill`:return typeof n?.name==`string`?`$${n.name}`:`Skill`;case`scrape_url`:return typeof n?.url==`string`?n.url:`Web page`;case`web_search`:return typeof n?.query==`string`?n.query:`Web search`;case`write_stdin`:return typeof n?.sessionId==`string`?`Session ${n.sessionId}`:`Command session`;default:return Ao(e)}}function Po(e){return(e.job?.kind??e.name)===`apply_patch`?`whitespace-pre-wrap [overflow-wrap:anywhere]`:`truncate`}var Fo=[`*** Add File: `,`*** Copy File: `,`*** Delete File: `,`*** Update File: `],Io=[`*** Copy to: `,`*** Move to: `];function Lo(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 Ro(e){if(!Xr(e)||typeof e.patch!=`string`)return null;let t=[];for(let n of e.patch.split(`
|
|
3
|
+
`)){if(n.startsWith(`diff --git `)){let e=Lo(n);e!==null&&t.push(e);continue}let e=Fo.find(e=>n.startsWith(e));if(e){t.push(n.slice(e.length).trim());continue}let r=Io.find(e=>n.startsWith(e));r&&t.length>0&&(t[t.length-1]=n.slice(r.length).trim())}let n=[...new Set(t)];return n.length>0?n.join(`
|
|
4
|
+
`):null}function zo(e){if(!Xr(e)||!Array.isArray(e.changes))return null;let t=e.changes.flatMap(e=>Xr(e)&&typeof e.path==`string`?[e.path]:[]);return t.length===0?null:[...new Set(t)].join(`
|
|
5
|
+
`)}function Bo(e){return e.job?.kind===`apply_patch`?zo(e.job.result)??Ro(e.job.payload):e.name===`apply_patch`?Ro(e.input):null}function Vo(e){return new Set(e.flatMap(e=>Bo(e)?.split(`
|
|
6
|
+
`)??[])).size}function Ho(e,t){if(e===`web_search`&&Xr(t)&&Array.isArray(t.results)){let e=t.results.length;return` (${e} result${e===1?``:`s`})`}return e===`scrape_url`&&Xr(t)&&t.truncated===!0?` (truncated)`:``}function Uo(e,t){return(e.job?.kind??e.name)===`write_stdin`?xo(e,t)??No(`write_stdin`,e.job?.payload??e.input):e.job?Bo(e)||No(e.job.kind,e.job.payload)+Ho(e.job.kind,e.job.result):No(e.name,e.input)}function Wo(e,t,n){let r=Uo(e,n);if(_o(e,t))return`${r} (running)`;let i=To(e,t);return i?`${r} (${i})`:r}function Go(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 Ko(e){if(Array.isArray(e))return e}function qo(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 Jo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yo(e,t){return Ko(e)||qo(e,t)||Xo(e,t)||Jo()}function Xo(e,t){if(e){if(typeof e==`string`)return Go(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)?Go(e,t):void 0}}var Zo=Object.entries,Qo=Object.setPrototypeOf,$o=Object.isFrozen,es=Object.getPrototypeOf,ts=Object.getOwnPropertyDescriptor,ns=Object.freeze,rs=Object.seal,is=Object.create,as=typeof Reflect<`u`&&Reflect,os=as.apply,ss=as.construct;ns||=function(e){return e},rs||=function(e){return e},os||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ss||=function(e){return new e(...[...arguments].slice(1))};var cs=Os(Array.prototype.forEach),ls=Os(Array.prototype.lastIndexOf),us=Os(Array.prototype.pop),ds=Os(Array.prototype.push),fs=Os(Array.prototype.splice),ps=Array.isArray,ms=Os(String.prototype.toLowerCase),hs=Os(String.prototype.toString),gs=Os(String.prototype.match),_s=Os(String.prototype.replace),vs=Os(String.prototype.indexOf),ys=Os(String.prototype.trim),bs=Os(Number.prototype.toString),xs=Os(Boolean.prototype.toString),Ss=typeof BigInt>`u`?null:Os(BigInt.prototype.toString),Cs=typeof Symbol>`u`?null:Os(Symbol.prototype.toString),ws=Os(Object.prototype.hasOwnProperty),Ts=Os(Object.prototype.toString),Es=Os(RegExp.prototype.test),Ds=ks(TypeError);function Os(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return os(e,t,n)}}function ks(e){return function(){return ss(e,[...arguments])}}function Q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ms;if(Qo&&Qo(e,null),!ps(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&($o(t)||(t[r]=e),i=e)}e[i]=!0}return e}function As(e){for(let t=0;t<e.length;t++)ws(e,t)||(e[t]=null);return e}function js(e){let t=is(null);for(let r of Zo(e)){var n=Yo(r,2);let i=n[0],a=n[1];ws(e,i)&&(ps(a)?t[i]=As(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=js(a):t[i]=a)}return t}function Ms(e){switch(typeof e){case`string`:return e;case`number`:return bs(e);case`boolean`:return xs(e);case`bigint`:return Ss?Ss(e):`0`;case`symbol`:return Cs?Cs(e):`Symbol()`;case`undefined`:return Ts(e);case`function`:case`object`:{if(e===null)return Ts(e);let t=e,n=Ns(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Ts(e)}return Ts(e)}default:return Ts(e)}}function Ns(e,t){for(;e!==null;){let n=ts(e,t);if(n){if(n.get)return Os(n.get);if(typeof n.value==`function`)return Os(n.value)}e=es(e)}function n(){return null}return n}function Ps(e){try{return Es(e,``),!0}catch{return!1}}var Fs=ns(`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(`.`)),Is=ns(`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(`.`)),Ls=ns([`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`]),Rs=ns([`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`]),zs=ns(`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(`.`)),Bs=ns([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Vs=ns([`#text`]),Hs=ns(`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(`.`)),Us=ns(`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(`.`)),Ws=ns(`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(`.`)),Gs=ns([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Ks=rs(/{{[\w\W]*|^[\w\W]*}}/g),qs=rs(/<%[\w\W]*|^[\w\W]*%>/g),Js=rs(/\${[\w\W]*/g),Ys=rs(/^data-[\-\w.\u00B7-\uFFFF]+$/),Xs=rs(/^aria-[\-\w]+$/),Zs=rs(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Qs=rs(/^(?:\w+script|data):/i),$s=rs(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ec=rs(/^html$/i),tc=rs(/^[a-z][.\w]*(-[.\w]+)+$/i),nc=rs(/<[/\w!]/g),rc=rs(/<[/\w]/g),ic=rs(/<\/no(script|embed|frames)/i),ac=rs(/\/>/i),oc={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},sc=function(){return typeof window>`u`?null:window},cc=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}},lc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},uc=function(e,t,n,r){return ws(e,t)&&ps(e[t])?Q(r.base?js(r.base):{},e[t],r.transform):n};function dc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sc(),t=e=>dc(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==oc.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=Ns(d,`cloneNode`),p=Ns(d,`remove`),m=Ns(d,`nextSibling`),h=Ns(d,`childNodes`),g=Ns(d,`parentNode`),_=Ns(d,`shadowRoot`),v=Ns(d,`attributes`),y=o&&o.prototype?Ns(o.prototype,`nodeType`):null,b=o&&o.prototype?Ns(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw Ds(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},D=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},ee=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},O=function(){return w||=(C=cc(u,i),!0),C},k=n,A=k.implementation,j=k.createNodeIterator,te=k.createDocumentFragment,ne=k.getElementsByTagName,M=r.importNode,N=lc();t.isSupported=typeof Zo==`function`&&typeof g==`function`&&A&&A.createHTMLDocument!==void 0;let P=Ks,re=qs,ie=Js,F=Ys,ae=Xs,I=Qs,L=$s,oe=tc,se=Zs,R=null,ce=Q({},[...Fs,...Is,...Ls,...zs,...Vs]),z=null,le=Q({},[...Hs,...Us,...Ws,...Gs]),B=Object.seal(is(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),V=null,ue=null,H=Object.seal(is(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),U=!0,de=!0,fe=!1,pe=!0,me=!1,he=!0,ge=!1,_e=!1,W=null,ve=null,ye=!1,be=!1,xe=!1,Se=!1,Ce=!0,we=!1,Te=`user-content-`,Ee=!0,De=!1,Oe={},ke=null,Ae=Q({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),je=null,Me=Q({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ne=null,G=Q({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Pe=`http://www.w3.org/1998/Math/MathML`,K=`http://www.w3.org/2000/svg`,Fe=`http://www.w3.org/1999/xhtml`,Ie=Fe,q=!1,Le=null,Re=Q({},[Pe,K,Fe],hs),ze=ns([`mi`,`mo`,`mn`,`ms`,`mtext`]),J=Q({},ze),Be=ns([`annotation-xml`]),Ve=Q({},Be),He=Q({},[`title`,`style`,`font`,`a`,`script`]),Ue=null,We=[`application/xhtml+xml`,`text/html`],Y=null,Ge=null,Ke=n.createElement(`form`),qe=function(e){return e instanceof RegExp||e instanceof Function},X=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ge&&Ge===e)return;(!e||typeof e!=`object`)&&(e={}),e=js(e),Ue=We.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=Ue===`application/xhtml+xml`?hs:ms,R=uc(e,`ALLOWED_TAGS`,ce,{transform:Y}),z=uc(e,`ALLOWED_ATTR`,le,{transform:Y}),Le=uc(e,`ALLOWED_NAMESPACES`,Re,{transform:hs}),Ne=uc(e,`ADD_URI_SAFE_ATTR`,G,{transform:Y,base:G}),je=uc(e,`ADD_DATA_URI_TAGS`,Me,{transform:Y,base:Me}),ke=uc(e,`FORBID_CONTENTS`,Ae,{transform:Y}),V=uc(e,`FORBID_TAGS`,js({}),{transform:Y}),ue=uc(e,`FORBID_ATTR`,js({}),{transform:Y}),Oe=ws(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?js(e.USE_PROFILES):e.USE_PROFILES:!1,U=e.ALLOW_ARIA_ATTR!==!1,de=e.ALLOW_DATA_ATTR!==!1,fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,me=e.SAFE_FOR_TEMPLATES||!1,he=e.SAFE_FOR_XML!==!1,ge=e.WHOLE_DOCUMENT||!1,be=e.RETURN_DOM||!1,xe=e.RETURN_DOM_FRAGMENT||!1,Se=e.RETURN_TRUSTED_TYPE||!1,ye=e.FORCE_BODY||!1,Ce=e.SANITIZE_DOM!==!1,we=e.SANITIZE_NAMED_PROPS||!1,Ee=e.KEEP_CONTENT!==!1,De=e.IN_PLACE||!1,se=Ps(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Zs,Ie=typeof e.NAMESPACE==`string`?e.NAMESPACE:Fe,J=ws(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?js(e.MATHML_TEXT_INTEGRATION_POINTS):Q({},ze),Ve=ws(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?js(e.HTML_INTEGRATION_POINTS):Q({},Be);let t=ws(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?js(e.CUSTOM_ELEMENT_HANDLING):is(null);if(B=is(null),ws(t,`tagNameCheck`)&&qe(t.tagNameCheck)&&(B.tagNameCheck=t.tagNameCheck),ws(t,`attributeNameCheck`)&&qe(t.attributeNameCheck)&&(B.attributeNameCheck=t.attributeNameCheck),ws(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(B.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),rs(B),me&&(de=!1),xe&&(be=!0),Oe&&(R=Q({},Vs),z=is(null),Oe.html===!0&&(Q(R,Fs),Q(z,Hs)),Oe.svg===!0&&(Q(R,Is),Q(z,Us),Q(z,Gs)),Oe.svgFilters===!0&&(Q(R,Ls),Q(z,Us),Q(z,Gs)),Oe.mathMl===!0&&(Q(R,zs),Q(z,Ws),Q(z,Gs))),H.tagCheck=null,H.attributeCheck=null,ws(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?H.tagCheck=e.ADD_TAGS:ps(e.ADD_TAGS)&&(R===ce&&(R=js(R)),Q(R,e.ADD_TAGS,Y))),ws(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?H.attributeCheck=e.ADD_ATTR:ps(e.ADD_ATTR)&&(z===le&&(z=js(z)),Q(z,e.ADD_ATTR,Y))),ws(e,`ADD_URI_SAFE_ATTR`)&&ps(e.ADD_URI_SAFE_ATTR)&&Q(Ne,e.ADD_URI_SAFE_ATTR,Y),ws(e,`FORBID_CONTENTS`)&&ps(e.FORBID_CONTENTS)&&(ke===Ae&&(ke=js(ke)),Q(ke,e.FORBID_CONTENTS,Y)),ws(e,`ADD_FORBID_CONTENTS`)&&ps(e.ADD_FORBID_CONTENTS)&&(ke===Ae&&(ke=js(ke)),Q(ke,e.ADD_FORBID_CONTENTS,Y)),Ee&&(R[`#text`]=!0),ge&&Q(R,[`html`,`head`,`body`]),R.table&&(Q(R,[`tbody`]),delete V.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Ds(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Ds(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=D(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=O()),x&&typeof S==`string`&&(S=D(``)));ns&&ns(e),Ge=e},Je=Q({},[...Is,...Ls,...Rs]),Ye=Q({},[...zs,...Bs]),Xe=function(e,t,n){return t.namespaceURI===Fe?e===`svg`:t.namespaceURI===Pe?e===`svg`&&(n===`annotation-xml`||J[n]):!!Je[e]},Ze=function(e,t,n){return t.namespaceURI===Fe?e===`math`:t.namespaceURI===K?e===`math`&&Ve[n]:!!Ye[e]},Qe=function(e,t,n){return t.namespaceURI===K&&!Ve[n]||t.namespaceURI===Pe&&!J[n]?!1:!Ye[e]&&(He[e]||!Je[e])},$e=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ie,tagName:`template`});let n=ms(e.tagName),r=ms(t.tagName);return Le[e.namespaceURI]?e.namespaceURI===K?Xe(n,t,r):e.namespaceURI===Pe?Ze(n,t,r):e.namespaceURI===Fe?Qe(n,t,r):!!(Ue===`application/xhtml+xml`&&Le[e.namespaceURI]):!1},et=function(e){ds(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Ds(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},tt=function(e){it(e);let t=h(e);if(t){let e=[];cs(t,t=>{ds(e,t)}),cs(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{}}},nt=function(e,n){try{ds(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{ds(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(be||xe)try{et(n)}catch{}else try{n.setAttribute(e,``)}catch{}},rt=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`||z[Y(i)]))try{e.removeAttribute(i)}catch{}}},it=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===oc.element&&rt(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},at=function(e){if(!he)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===oc.processingInstruction||n===oc.comment&&Es(rc,e.data)){try{p(e)}catch{}continue}if(n===oc.element){let t=e,n=Y(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Z=function(e){let t=null,r=null;if(ye)e=`<remove></remove>`+e;else{let t=gs(e,/^[\r\n\t ]+/);r=t&&t[0]}Ue===`application/xhtml+xml`&&Ie===Fe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Ie===Fe)try{t=new l().parseFromString(i,Ue)}catch{}if(!t||!t.documentElement){t=A.createDocument(Ie,`template`,null);try{t.documentElement.innerHTML=q?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ie===Fe?ne.call(t,ge?`html`:`body`)[0]:ge?t.documentElement:a},ot=function(e){return j.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},st=function(e){return e=_s(e,P,` `),e=_s(e,re,` `),e=_s(e,ie,` `),e},ct=function(e){e.normalize();let t=j.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=st(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&cs(r,e=>{ut(e.content)&&ct(e.content)})},lt=function(e){let t=b?b(e):null;return typeof t!=`string`||Y(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},ut=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===oc.documentFragment}catch{return!1}},dt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function ft(e,n,r){e.length!==0&&cs(e,e=>{e.call(t,n,r,Ge)})}let pt=function(e,t){return!!(he&&e.hasChildNodes()&&!dt(e.firstElementChild)&&Es(nc,e.textContent)&&Es(nc,e.innerHTML)||he&&e.namespaceURI===Fe&&t===`style`&&dt(e.firstElementChild)||e.nodeType===oc.processingInstruction||he&&e.nodeType===oc.comment&&Es(rc,e.data))},mt=function(e,t){if(!V[t]&&vt(t)&&(B.tagNameCheck instanceof RegExp&&Es(B.tagNameCheck,t)||B.tagNameCheck instanceof Function&&B.tagNameCheck(t)))return!1;if(Ee&&!ke[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=De?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return et(e),!0},ht=function(e,n){if(ft(N.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(lt(e))return et(e),!0;let r=Y(b?b(e):e.nodeName);if(ft(N.uponSanitizeElement,e,{tagName:r,allowedTags:R}),e!==n&&g(e)===null)return!0;if(pt(e,r))return et(e),!0;if(V[r]||!(H.tagCheck instanceof Function&&H.tagCheck(r))&&!R[r]){let t=mt(e,r);return t===!1&&ft(N.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===oc.element&&!$e(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Es(ic,e.innerHTML))return et(e),!0;if(me&&e.nodeType===oc.text){let n=st(e.textContent);e.textContent!==n&&(ds(t.removed,{element:e.cloneNode()}),e.textContent=n)}return ft(N.afterSanitizeElements,e,null),!1},gt=function(e,t,r){if(ue[t]||he&&t===`patchsrc`||he&&t===`for`&&e!==`label`&&e!==`output`||Ce&&(t===`id`||t===`name`)&&(r in n||r in Ke))return!1;let i=z[t]||H.attributeCheck instanceof Function&&H.attributeCheck(t,e);if(!(de&&Es(F,t))&&!(U&&Es(ae,t))){if(!i){if(!(vt(e)&&(B.tagNameCheck instanceof RegExp&&Es(B.tagNameCheck,e)||B.tagNameCheck instanceof Function&&B.tagNameCheck(e))&&(B.attributeNameCheck instanceof RegExp&&Es(B.attributeNameCheck,t)||B.attributeNameCheck instanceof Function&&B.attributeNameCheck(t,e))||t===`is`&&B.allowCustomizedBuiltInElements&&(B.tagNameCheck instanceof RegExp&&Es(B.tagNameCheck,r)||B.tagNameCheck instanceof Function&&B.tagNameCheck(r))))return!1}else if(!Ne[t]&&!Es(se,_s(r,L,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&vs(r,`data:`)===0&&je[e])&&!(fe&&!Es(I,_s(r,L,``)))&&r)return!1}return!0},_t=Q({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),vt=function(e){return!_t[ms(e)]&&Es(oe,e)},yt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return ee(r)}return r},bt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),lt(e)?et(e):us(t.removed)}catch{nt(n,e)}},xt=function(e){ft(N.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||lt(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0},r=t.length,i=Y(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=Y(o),u=c,d=o===`value`?u:ys(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,ft(N.uponSanitizeAttribute,e,n),d=n.attrValue,we&&(l===`id`||l===`name`)&&vs(d,Te)!==0&&(nt(o,e),d=Te+d),he&&Es(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){nt(o,e);continue}if(l===`attributename`&&gs(d,`href`)){nt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){nt(o,e);continue}if(!pe&&Es(ac,d)){nt(o,e);continue}if(me&&(d=st(d)),!gt(i,l,d)){nt(o,e);continue}d=yt(i,l,s,d),d!==u&&bt(e,o,s,d)}}ft(N.afterSanitizeAttributes,e,null)},St=function(e){let t=null,n=ot(e);for(ft(N.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(ft(N.uponSanitizeShadowNode,t,null),ht(t,e),xt(t),ut(t.content)&&St(t.content),(y?y(t):t.nodeType)===oc.element){let e=_(t);ut(e)&&(Ct(e),St(e))}ft(N.afterSanitizeShadowDOM,e,null)},Ct=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){St(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===oc.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Y(e)===`template`){let e=n.content;ut(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);ut(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(q=!e,q&&(e=`<!-->`),typeof e!=`string`&&!dt(e)&&(e=Ms(e),typeof e!=`string`))throw Ds(`dirty is not a string, aborting`);if(!t.isSupported)return e;_e?(R=W,z=ve):X(n),(N.uponSanitizeElement.length>0||N.uponSanitizeAttribute.length>0)&&(R=js(R)),N.uponSanitizeAttribute.length>0&&(z=js(z)),t.removed=[];let c=De&&typeof e!=`string`&&dt(e);if(c){at(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=Y(t);if(!R[n]||V[n])throw tt(e),Ds(`root node is forbidden and cannot be sanitized in-place`)}if(lt(e))throw tt(e),Ds(`root node is clobbered and cannot be sanitized in-place`);try{Ct(e)}catch(t){throw tt(e),t}}else if(dt(e))i=Z(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===oc.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Ct(a);else{if(!be&&!me&&!ge&&e.indexOf(`<`)===-1)return x&&Se?D(e):e;if(i=Z(e),!i)return be?null:Se?S:``}i&&ye&&et(i.firstChild);let l=c?e:i,u=ot(l);try{for(;o=u.nextNode();)ht(o,l),xt(o),ut(o.content)&&St(o.content)}catch(n){throw c&&(tt(e),cs(t.removed,e=>{e.element&&it(e.element)})),n}if(c)return cs(t.removed,e=>{e.element&&it(e.element)}),me&&ct(e),e;if(be){if(me&&ct(i),xe)for(s=te.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(z.shadowroot||z.shadowrootmode)&&(s=M.call(r,s,!0)),s}let d=ge?i.outerHTML:i.innerHTML;return ge&&R[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Es(ec,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
8
|
+
`+d),me&&(d=st(d)),x&&Se?D(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};X(e),_e=!0,W=R,ve=z},t.clearConfig=function(){Ge=null,_e=!1,W=null,ve=null,x=C,S=``},t.isValidAttribute=function(e,t,n){Ge||X({});let r=Y(e),i=Y(t);return gt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&ws(N,e)&&ds(N[e],t)},t.removeHook=function(e,t){if(ws(N,e)){if(t!==void 0){let n=ls(N[e],t);return n===-1?void 0:fs(N[e],n,1)[0]}return us(N[e])}},t.removeHooks=function(e){ws(N,e)&&(N[e]=[])},t.removeAllHooks=function(){N=lc()},t}var fc=dc(),pc=fc;fc.sanitize.bind(fc),fc.isSupported,fc.addHook.bind(fc),fc.removeHook.bind(fc),fc.removeHooks.bind(fc),fc.removeAllHooks.bind(fc),fc.setConfig.bind(fc),fc.clearConfig.bind(fc),fc.isValidAttribute.bind(fc),fc.version,fc.removed;function mc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var hc=mc();function gc(e){hc=e}var _c={exec:()=>null};function vc(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function $(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(bc.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var yc=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),bc={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:vc(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:vc(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:vc(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:vc(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:vc(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:vc(e=>RegExp(`^ {0,${e}}>`))},xc=/^(?:[ \t]*(?:\n|$))+/,Sc=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Cc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wc=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Tc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ec=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Dc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Oc=$(Dc).replace(/bull/g,Ec).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(),kc=$(Dc).replace(/bull/g,Ec).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(),Ac=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,jc=/^[^\n]+/,Mc=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Nc=$(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Mc).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Pc=$(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ec).getRegex(),Fc=`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`,Ic=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Lc=$(`^ {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`,Ic).replace(`tag`,Fc).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Rc=e=>$(Ac).replace(`hr`,wc).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`,Fc).getRegex(),zc=Rc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Bc=Rc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Vc={blockquote:$(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Bc).getRegex(),code:Sc,def:Nc,fences:Cc,heading:Tc,hr:wc,html:Lc,lheading:Oc,list:Pc,newline:xc,paragraph:zc,table:_c,text:jc},Hc=$(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,wc).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`,Fc).getRegex(),Uc={...Vc,lheading:kc,table:Hc,paragraph:$(Ac).replace(`hr`,wc).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Hc).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`,Fc).getRegex()},Wc={...Vc,html:$(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ic).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:_c,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$(Ac).replace(`hr`,wc).replace(`heading`,` *#{1,6} *[^
|
|
9
|
+
]`).replace(`lheading`,Oc).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Gc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Kc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qc=/^( {2,}|\\)\n(?!\s*$)/,Jc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yc=/[\p{P}\p{S}]/u,Xc=/[\s\p{P}\p{S}]/u,Zc=/[^\s\p{P}\p{S}]/u,Qc=$(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Xc).getRegex(),$c=/(?!~)[\p{P}\p{S}]/u,el=/(?!~)[\s\p{P}\p{S}]/u,tl=/(?:[^\s\p{P}\p{S}]|~)/u,nl=$(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,yc?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),rl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,il=$(rl,`u`).replace(/punct/g,Yc).getRegex(),al=$(rl,`u`).replace(/punct/g,$c).getRegex(),ol=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,sl=$(ol,`gu`).replace(/notPunctSpace/g,Zc).replace(/punctSpace/g,Xc).replace(/punct/g,Yc).getRegex(),cl=$(ol,`gu`).replace(/notPunctSpace/g,tl).replace(/punctSpace/g,el).replace(/punct/g,$c).getRegex(),ll=$(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Zc).replace(/punctSpace/g,Xc).replace(/punct/g,Yc).getRegex(),ul=$(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Yc).getRegex(),dl=$(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Zc).replace(/punctSpace/g,Xc).replace(/punct/g,Yc).getRegex(),fl=$(/\\(punct)/,`gu`).replace(/punct/g,Yc).getRegex(),pl=$(/^<(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(),ml=$(Ic).replace(`(?:-->|$)`,`-->`).getRegex(),hl=$(`^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`,ml).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),gl=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,_l=$(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,gl).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vl=$(/^!?\[(label)\]\[(ref)\]/).replace(`label`,gl).replace(`ref`,Mc).getRegex(),yl=$(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Mc).getRegex(),bl=$(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,vl).replace(`nolink`,yl).getRegex(),xl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Sl={_backpedal:_c,anyPunctuation:fl,autolink:pl,blockSkip:nl,br:qc,code:Kc,del:_c,delLDelim:_c,delRDelim:_c,emStrongLDelim:il,emStrongRDelimAst:sl,emStrongRDelimUnd:ll,escape:Gc,link:_l,nolink:yl,punctuation:Qc,reflink:vl,reflinkSearch:bl,tag:hl,text:Jc,url:_c},Cl={...Sl,link:$(/^!?\[(label)\]\((.*?)\)/).replace(`label`,gl).getRegex(),reflink:$(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,gl).getRegex()},wl={...Sl,emStrongRDelimAst:cl,emStrongLDelim:al,delLDelim:ul,delRDelim:dl,url:$(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,xl).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,xl).getRegex()},Tl={...wl,br:$(qc).replace(`{2,}`,`*`).getRegex(),text:$(wl.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},El={normal:Vc,gfm:Uc,pedantic:Wc},Dl={normal:Sl,gfm:wl,breaks:Tl,pedantic:Cl},Ol={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},kl=e=>Ol[e];function Al(e,t){if(t){if(bc.escapeTest.test(e))return e.replace(bc.escapeReplace,kl)}else if(bc.escapeTestNoEncode.test(e))return e.replace(bc.escapeReplaceNoEncode,kl);return e}function jl(e){try{e=encodeURI(e).replace(bc.percentDecode,`%`)}catch{return null}return e}function Ml(e,t){let n=e.replace(bc.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(bc.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(bc.slashPipe,`|`);return n}function Nl(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 Pl(e){let t=e.split(`
|
|
10
|
+
`),n=t.length-1;for(;n>=0&&bc.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
11
|
+
`)}function Fl(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 Il(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 Ll(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 Rl(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
12
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
13
|
+
`)}var zl=class{options;rules;lexer;constructor(e){this.options=e||hc}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]:Pl(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=Rl(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=Nl(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Nl(t[0],`
|
|
14
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:Nl(t[0],`
|
|
15
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Nl(t[0],`
|
|
16
|
+
`).split(`
|
|
17
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
18
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
19
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
20
|
+
${s}`:s,r=r?`${r}
|
|
21
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
22
|
+
`+e.join(`
|
|
23
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
24
|
+
`+e.join(`
|
|
25
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
26
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=Il(t[2].split(`
|
|
27
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
28
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
29
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
30
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
31
|
+
`+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
32
|
+
`+l}u=!l.trim(),r+=p+`
|
|
33
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1;if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Pl(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:Nl(t[0],`
|
|
34
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ml(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
35
|
+
`):[],a={type:`table`,raw:Nl(t[0],`
|
|
36
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ml(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:Nl(t[0],`
|
|
37
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
38
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Nl(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Fl(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)),Ll(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 Ll(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Bl=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||hc,this.options.tokenizer=this.options.tokenizer||new zl,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:bc,block:El.normal,inline:Dl.normal};this.options.pedantic?(t.block=El.pedantic,t.inline=Dl.pedantic):this.options.gfm&&(t.block=El.gfm,this.options.breaks?t.inline=Dl.breaks:t.inline=Dl.gfm),this.tokenizer.rules=t}static get rules(){return{block:El,inline:Dl}}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(bc.carriageReturn,`
|
|
39
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(bc.tabCharGlobal,` `).replace(bc.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
40
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
41
|
+
`)?``:`
|
|
42
|
+
`)+i.raw,n.text+=`
|
|
43
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
44
|
+
`)?``:`
|
|
45
|
+
`)+i.raw,n.text+=`
|
|
46
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
47
|
+
`)?``:`
|
|
48
|
+
`)+i.raw,r.text+=`
|
|
49
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
50
|
+
`)?``:`
|
|
51
|
+
`)+i.raw,n.text+=`
|
|
52
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,`++`),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Vl=class{options;parser;constructor(e){this.options=e||hc}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(bc.notSpaceStart)?.[0],i=e.replace(bc.endingNewline,``)+`
|
|
53
|
+
`;return r?`<pre><code class="language-`+Al(r)+`">`+(n?i:Al(i,!0))+`</code></pre>
|
|
54
|
+
`:`<pre><code>`+(n?i:Al(i,!0))+`</code></pre>
|
|
55
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
56
|
+
${this.parser.parse(e)}</blockquote>
|
|
57
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
58
|
+
`}hr(e){return`<hr>
|
|
59
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
60
|
+
`+r+`</`+i+`>
|
|
61
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
62
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
63
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
64
|
+
<thead>
|
|
65
|
+
`+t+`</thead>
|
|
66
|
+
`+r+`</table>
|
|
67
|
+
`}tablerow({text:e}){return`<tr>
|
|
68
|
+
${e}</tr>
|
|
69
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
70
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Al(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=jl(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Al(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=jl(e);if(i===null)return Al(n);e=i;let a=`<img src="${e}" alt="${Al(n)}"`;return t&&(a+=` title="${Al(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Al(e.text)}},Hl=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}},Ul=class e{options;renderer;textRenderer;constructor(e){this.options=e||hc,this.options.renderer=this.options.renderer||new Vl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Hl}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Wl=class{options;block;constructor(e){this.options=e||hc}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?Bl.lex:Bl.lexInline}provideParser(e=this.block){return e?Ul.parse:Ul.parseInline}},Gl=new class{defaults=mc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Ul;Renderer=Vl;TextRenderer=Hl;Lexer=Bl;Tokenizer=zl;Hooks=Wl;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 Vl(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 zl(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 Wl;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];Wl.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Wl.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Bl.lex(e,t??this.defaults)}parser(e,t){return Ul.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?Bl.lex:Bl.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?Ul.parse:Ul.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?Bl.lex:Bl.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?Ul.parse:Ul.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
71
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Al(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Kl(e,t){return Gl.parse(e,t)}Kl.options=Kl.setOptions=function(e){return Gl.setOptions(e),Kl.defaults=Gl.defaults,gc(Kl.defaults),Kl},Kl.getDefaults=mc,Kl.defaults=hc,Kl.use=function(...e){return Gl.use(...e),Kl.defaults=Gl.defaults,gc(Kl.defaults),Kl},Kl.walkTokens=function(e,t){return Gl.walkTokens(e,t)},Kl.parseInline=Gl.parseInline,Kl.Parser=Ul,Kl.parser=Ul.parse,Kl.Renderer=Vl,Kl.TextRenderer=Hl,Kl.Lexer=Bl,Kl.lexer=Bl.lex,Kl.Tokenizer=zl,Kl.Hooks=Wl,Kl.parse=Kl,Kl.options,Kl.setOptions,Kl.use,Kl.walkTokens,Kl.parseInline,Ul.parse,Bl.lex,Kl.setOptions({gfm:!0,breaks:!0});function ql(e){let t=Kl.parse(e,{async:!1});return pc.sanitize(t,{ADD_ATTR:[`target`,`rel`]})}var Jl=i(`<div></div>`);function Yl(e,t){E(t,!0);let n=M(t,`className`,3,``),r=C(()=>ql(t.content));var i=Jl();D(i,()=>p(r),!0),k(i),U(e=>L(i,1,e),[()=>F(Ee(`chat-markdown`,n()))]),v(e,i),N()}var Xl=i(`<p class="border-border absolute right-3 bottom-14 max-w-[min(20rem,calc(100%-1.5rem))] rounded-lg border bg-black/80 px-3 py-2 text-xs text-amber-100 shadow-lg backdrop-blur-sm" role="alert"> </p>`),Zl=i(`<div class="bg-background/92 fixed inset-0 z-50 flex items-center justify-center px-3 py-4 sm:px-6 sm:py-12" role="presentation"><div class="relative inline-flex max-h-full max-w-full outline-none" role="dialog" aria-modal="true" tabindex="-1"><img class="border-border block max-h-[calc(100dvh-2rem)] max-w-full rounded-2xl border object-contain sm:max-h-[calc(100dvh-6rem)]"/> <div class="absolute right-3 bottom-3 flex items-center gap-2"><button type="button"><!></button> <button type="button"><!></button></div> <span class="sr-only" aria-live="polite"> </span> <!></div></div>`);function Ql(e,t){E(t,!0);let i=x(null),c=x(!1),u=x(!1),d=x(!1),f=x(null),m=x(null),h=null,g=0,_={"image/jpeg":`jpg`,"image/png":`png`,"image/gif":`gif`,"image/webp":`webp`};function S(e){let t=e.name.trim()||`image`,n=_[e.mediaType];if(!n)return t;let r=t.match(/\.([a-z0-9]{2,5})$/i);return r?(e.mediaType===`image/jpeg`?[`jpg`,`jpeg`]:[n]).includes(r[1].toLowerCase())?t:`${t.slice(0,-r[0].length)}.${n}`:`${t}.${n}`}n(()=>{if(g+=1,!t.image)return;l(c,!1),l(u,!1),l(d,!1),l(f,null),l(m,null);let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=!1;o().then(()=>{n||p(i)?.focus()});let r=document.body.style.overflow;document.body.style.overflow=`hidden`;function a(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onClose();return}if(e.key!==`Tab`||!p(i))return;let n=Array.from(p(i).querySelectorAll(`button:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`));if(n.length===0){e.preventDefault(),p(i).focus();return}let r=n[0],a=n[n.length-1],o=document.activeElement;e.shiftKey&&(o===p(i)||o===r||!p(i).contains(o))?(e.preventDefault(),a.focus()):!e.shiftKey&&(o===p(i)||o===a||!p(i).contains(o))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,a,!0),()=>{n=!0,window.removeEventListener(`keydown`,a,!0),document.body.style.overflow=r,h!==null&&(window.clearTimeout(h),h=null),e?.isConnected&&e.focus()}});async function w(e){let t=await fetch(e.url);if(!t.ok)throw Error(`Fetch failed with status ${t.status}`);return t.blob()}async function T(e){if(e.type===`image/png`)return e;let t=await createImageBitmap(e);try{let e=document.createElement(`canvas`);e.width=t.width,e.height=t.height;let n=e.getContext(`2d`);if(!n)throw Error(`Canvas 2D context unavailable`);return n.drawImage(t,0,0),await new Promise((t,n)=>{e.toBlob(e=>e?t(e):n(Error(`PNG encoding failed`)),`image/png`)})}finally{t.close()}}async function D(e){if(p(u))return;let t=g;l(u,!0),l(f,null),l(m,null);try{if(typeof ClipboardItem>`u`)throw Error(`Clipboard images unsupported`);let n=w(e).then(T);if(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),t!==g)return;l(c,!0),h!==null&&window.clearTimeout(h),h=window.setTimeout(()=>{l(c,!1),h=null},2e3)}catch{t===g&&(l(c,!1),l(f,`Could not copy the image to the clipboard.`))}finally{t===g&&l(u,!1)}}async function ee(e){if(p(d))return;let t=g;l(d,!0),l(f,null),l(m,null);try{let n=await w(e);if(t!==g)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=S(e),document.body.append(i);try{i.click()}finally{i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e4)}}catch{t===g&&l(m,`Could not download the image.`)}finally{t===g&&l(d,!1)}}let 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 j=a(),te=b(j),ne=e=>{let n=C(()=>t.image);var a=Zl(),o=y(a),h=y(o),g=s(h,2),_=y(g);L(_,1,F(A));var b=y(_),x=e=>{Yt(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},S=e=>{yt(e,{class:`size-4`,"aria-hidden":`true`})},w=e=>{Dt(e,{class:`size-4`,"aria-hidden":`true`})};r(b,e=>{p(u)?e(x):p(c)?e(S,1):e(w,-1)}),k(_);var T=s(_,2);L(T,1,F(A));var E=y(T),j=e=>{Yt(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},te=e=>{jt(e,{class:`size-4`,"aria-hidden":`true`})};r(E,e=>{p(d)?e(j):e(te,-1)}),k(T),k(g);var ne=s(g,2),M=y(ne,!0);k(ne);var N=s(ne,2),re=e=>{var t=Xl(),n=y(t,!0);k(t),U(()=>V(n,p(f)??p(m))),v(e,t)};r(N,e=>{(p(f)||p(m))&&e(re)}),k(o),ce(o,e=>l(i,e),()=>p(i)),k(a),U(()=>{O(o,`aria-label`,`Image preview: ${p(n).name??``}`),O(h,`src`,p(n).url),O(h,`alt`,p(n).name),O(_,`aria-disabled`,p(u)),O(_,`aria-label`,p(u)?`Copying image`:p(c)?`Image copied`:`Copy image`),O(_,`title`,p(u)?`Copying image`:p(c)?`Image copied`:`Copy image`),O(T,`aria-disabled`,p(d)),O(T,`aria-label`,p(d)?`Downloading image`:`Download image`),O(T,`title`,p(d)?`Downloading image`:`Download image`),V(M,p(u)?`Copying image`:p(c)?`Image copied`:p(d)?`Downloading image`:``)}),P(`click`,a,e=>{e.target===e.currentTarget&&t.onClose()}),P(`click`,_,()=>void D(p(n))),P(`click`,T,()=>void ee(p(n))),v(e,a)};r(te,e=>{t.image&&e(ne)}),v(e,j),N()}t([`click`]);function $l(e){let t=x(!1),r=x(!1);n(()=>{e()?l(r,!1):l(t,!1)});let i=C(()=>e()?!p(r):p(t));function a(){e()?l(r,!p(r)):l(t,!p(t))}return{get expanded(){return p(i)},toggle:a}}var eu=i(`<div class="text-muted-foreground mt-1.5 text-[13px] leading-6 whitespace-pre-wrap"> </div>`),tu=i(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1.5 transition"><!> <span> </span> <!></button> <!></div>`);function nu(e,t){E(t,!0);let n=$l(()=>t.inProgress),i=C(()=>t.inProgress?`Reasoning`:`Reasoned`);var a=tu(),o=y(a),c=y(o);ht(c,{class:`size-3.5 shrink-0`,"aria-hidden":`true`});var l=s(c,2),u=y(l,!0);k(l);var d=s(l,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${n.expanded?`rotate-90`:``}`);Ct(d,{get class(){return p(e)},"aria-hidden":`true`})}k(o);var f=s(o,2),m=e=>{var n=eu(),r=y(n,!0);k(n),U(()=>V(r,t.text)),v(e,n)};r(f,e=>{n.expanded&&e(m)}),k(a),U(()=>{O(o,`aria-expanded`,n.expanded),V(u,p(i))}),P(`click`,o,function(...e){n.toggle?.apply(this,e)}),v(e,a),N()}t([`click`]);var ru=i(`<div class="text-muted-foreground mt-1.5 space-y-1.5 text-[13px] leading-6"></div>`),iu=i(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1.5 transition"><!> <span> </span> <!></button> <!></div>`);function au(e,t){E(t,!0);let n=x(null),i=C(()=>p(n)??t.defaultExpanded??t.tools.length<=2);function o(){l(n,!p(i))}var c=iu(),u=y(c),d=y(u);{let e=C(()=>`size-3.5 shrink-0 ${t.iconClass??``}`);B(d,()=>t.icon,(t,n)=>{n(t,{get class(){return p(e)},"aria-hidden":`true`})})}var f=s(d,2),m=y(f,!0);k(f);var h=s(f,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${p(i)?`rotate-90`:``}`);Ct(h,{get class(){return p(e)},"aria-hidden":`true`})}k(u);var g=s(u,2),_=e=>{var n=ru();ue(n,21,()=>t.tools,e=>e.callId,(e,n)=>{var r=a();H(b(r),()=>t.toolRow,()=>p(n)),v(e,r)}),k(n),v(e,n)};r(g,e=>{p(i)&&e(_)}),k(c),U(()=>{O(u,`aria-expanded`,p(i)),V(m,t.label)}),P(`click`,u,o),v(e,c),N()}t([`click`]);function ou(e){let t=Math.floor(e/60),n=e%60;return t===0?`${n}s`:`${t}m ${n}s`}var su=i(`<div class="mt-1.5 space-y-2"><!></div>`),cu=i(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1 transition"><span> </span> <!></button> <!></div>`);function lu(e,t){E(t,!0);let i=x(0),a=$l(()=>t.inProgress);n(()=>{let e=t.startedAtMs;if(t.inProgress){let t=()=>{l(i,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}let n=t.completedAtMs??Date.now();l(i,Math.max(0,Math.floor((n-e)/1e3)),!0)});let o=C(()=>t.inProgress?`Working for ${ou(p(i))}`:`Worked for ${ou(p(i))}`);var c=cu(),u=y(c),d=y(u),f=y(d,!0);k(d);var m=s(d,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${a.expanded?`rotate-90`:``}`);Ct(m,{get class(){return p(e)},"aria-hidden":`true`})}k(u);var h=s(u,2),g=e=>{var n=su();H(y(n),()=>t.children),k(n),v(e,n)};r(h,e=>{a.expanded&&e(g)}),k(c),U(()=>{O(u,`aria-expanded`,a.expanded),V(f,p(o))}),P(`click`,u,function(...e){a.toggle?.apply(this,e)}),v(e,c),N()}t([`click`]);var uu=i(`<div role="alert" class="text-destructive mb-6 rounded-2xl border border-rose-500/20 bg-rose-500/10 px-4 py-3 text-sm"> </div>`),du=i(`<div role="alert" class="mb-6 rounded-2xl border border-amber-500/25 bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200"> </div>`),fu=i(`<div class="flex flex-1 items-center justify-center"><div class="max-w-2xl text-center"><p class="text-muted-foreground text-sm leading-7"> </p></div></div>`),pu=i(`<button type="button" class="border-border hover:border-border focus-visible:ring-ring/40 block size-14 cursor-zoom-in overflow-hidden rounded-xl border transition focus-visible:ring-2 focus-visible:outline-none"><img alt="" loading="lazy" class="size-full object-cover"/></button>`),mu=i(`<span class="text-muted-foreground border-hairline bg-hover-fill inline-flex items-center rounded-xl border px-3 py-2 text-xs"> </span>`),hu=i(`<li><!></li>`),gu=i(`<ul class="flex max-w-132 flex-wrap justify-end gap-2" aria-label="Attached images"></ul>`),_u=i(`<div><!></div>`),vu=i(`<button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex size-6 items-center justify-center rounded-md transition"><!></button>`),yu=i(`<button type="button" class="shrink-0 text-xs font-medium tracking-[-0.01em] text-amber-800/80 underline-offset-2 hover:text-amber-900 hover:underline dark:text-amber-200/80 dark:hover:text-amber-100">Dismiss</button>`),bu=i(`<div role="status" class="w-full max-w-132 rounded-2xl border border-amber-500/25 bg-amber-500/10 px-4 py-3 text-left text-sm text-amber-800 dark:text-amber-200"><div class="flex items-start justify-between gap-3"><p class="min-w-0 flex-1 leading-6"> </p> <!></div></div>`),xu=i(`<div class="flex flex-col items-end gap-1.5"><!> <!> <!> <!></div>`),Su=i(`<details class="min-w-0"><summary class="min-w-0 cursor-pointer text-left"><span> </span> <span> </span></summary> <p role="status"> </p></details>`),Cu=i(`<p> </p>`),wu=i(`<p class="flex min-w-0 items-start gap-1.5"><!> <span> </span></p>`),Tu=i(`<!> <!>`,1),Eu=i(`<p class="text-muted-foreground text-sm"> </p>`),Du=i(`<div class="w-full min-w-0" aria-atomic="false" aria-relevant="additions text"><div class="space-y-3"><!> <!> <!></div></div>`),Ou=i(`<div class="space-y-8 pb-14"></div>`),ku=i(`<div class="relative min-h-0 flex-1"><div class="hide-scrollbar h-full overflow-auto [overflow-anchor:none]"><div class="mx-auto flex min-h-full w-full max-w-5xl flex-col px-4 py-8"><!> <!> <!></div></div> <div class="transcript-fade pointer-events-none absolute inset-x-0 bottom-0 h-16"></div></div> <!>`,1);function Au(e,t){E(t,!0);let i=M(t,`remoteChangeNotice`,3,null),c=M(t,`emptyStateMessage`,19,()=>t.project?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`),u=C(()=>t.messages.find(e=>e.type===`prompt`)?._id),d=x(null),m=x(!0);function h(){let e=p(d);if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;l(m,t<=28)}let g=x(null),_=x(null),S=null;async function w(e,t){try{await navigator.clipboard.writeText(t),l(_,e,!0),S!==null&&clearTimeout(S),S=setTimeout(()=>{p(_)===e&&l(_,null),S=null},1500)}catch{l(_,null)}}n(()=>()=>{S!==null&&clearTimeout(S)});function T(){let e=p(d);!e||!p(m)||(e.scrollTop=e.scrollHeight)}n(()=>{t.messages,t.actions,p(m)&&o().then(T)}),n(()=>{let e=p(d);if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{T()});return t.observe(e),()=>{t.disconnect()}});var D=ku(),ee=b(D),A=y(ee),j=y(A),ne=y(j),re=e=>{var n=uu(),r=y(n,!0);k(n),U(()=>V(r,t.currentError)),v(e,n)};r(ne,e=>{t.currentError&&e(re)});var ie=s(ne,2),ae=e=>{var n=du(),r=y(n,!0);k(n),U(()=>V(r,t.runError)),v(e,n)};r(ie,e=>{t.runError&&e(ae)});var I=s(ie,2),oe=e=>{var t=fu(),n=y(t),r=y(n),i=y(r,!0);k(r),k(n),k(t),U(()=>V(i,c())),v(e,t)},se=e=>{var n=Ou();ue(n,21,()=>t.messages,e=>e._id,(e,n)=>{var o=a(),c=b(o),d=e=>{var a=xu(),o=y(a),c=e=>{var t=gu();ue(t,21,()=>p(n).attachments,e=>e.imageUploadId,(e,t)=>{var n=hu(),i=y(n),a=e=>{let n=C(()=>p(t).url);var r=pu(),i=y(r);k(r),U(()=>{O(r,`aria-label`,`View ${p(t).name??``}`),O(r,`title`,p(t).name),O(i,`src`,p(n))}),P(`click`,r,()=>{l(g,{url:p(n),name:p(t).name,mediaType:p(t).mediaType},!0)}),v(e,r)},o=e=>{var n=mu(),r=y(n);k(n),U(()=>V(r,`${p(t).name??``} (unavailable)`)),v(e,n)};r(i,e=>{p(t).url?e(a):e(o,-1)}),k(n),v(e,n)}),k(t),v(e,t)};r(o,e=>{p(n).attachments.length&&e(c)});var d=s(o,2),f=e=>{var t=_u();L(t,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=y(t);{let e=C(()=>p(n).text||` `);Yl(r,{get content(){return p(e)},className:`text-foreground`})}k(t),v(e,t)};r(d,e=>{(p(n).text||!p(n).attachments.length)&&e(f)});var m=s(d,2),h=e=>{var t=vu(),i=y(t),a=e=>{yt(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{Dt(e,{class:`size-3.5`,"aria-hidden":`true`})};r(i,e=>{p(_)===p(n)._id?e(a):e(o,-1)}),k(t),U(()=>O(t,`aria-label`,p(_)===p(n)._id?`Copied`:`Copy message`)),P(`click`,t,()=>{w(p(n)._id,p(n).text)}),v(e,t)};r(m,e=>{p(n).text&&e(h)});var b=s(m,2),x=e=>{var n=bu(),a=y(n),o=y(a),c=y(o,!0);k(o);var l=s(o,2),u=e=>{var n=yu();P(`click`,n,function(...e){t.onDismissRemoteChangeNotice?.apply(this,e)}),v(e,n)};r(l,e=>{t.onDismissRemoteChangeNotice&&e(u)}),k(a),k(n),U(()=>V(c,i())),v(e,n)};r(b,e=>{i()&&p(n)._id===p(u)&&e(x)}),k(a),v(e,a)},f=e=>{let i=C(()=>t.actions.filter(e=>e.runId===p(n).runId)),o=C(()=>Eo(p(n).parts,p(i))),c=C(()=>p(o).filter(e=>e.type===`tool`)),l=C(()=>bo(p(c))),u=C(()=>so(p(o))),d=C(()=>lo(p(u))),f=C(()=>{let{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}=mo(p(d));return{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}}),m=C(()=>p(n).runId===t.activeRunId&&p(n).runStatus!==`completed`&&p(n).runStatus!==`failed`&&p(n).runStatus!==`cancelled`),h=C(()=>So(p(c),p(m))),g=C(()=>p(o).some(e=>e.type===`text`||e.type===`reasoning`));var _=Du(),x=y(_),S=y(x),w=e=>{{let t=C(()=>p(n).text||`...`);Yl(e,{get content(){return p(t)},className:`text-foreground`})}};r(S,e=>{!p(g)&&(p(n).text||p(m)&&p(o).length===0)&&e(w)});var T=s(S,2);ue(T,19,()=>p(d),(e,t)=>`${e.type}-${e.type===`work`?e.key:e.id}-${t}`,(e,t,i)=>{var o=a(),c=b(o),u=e=>{{let n=C(()=>p(t).text||` `);Yl(e,{get content(){return p(n)},className:`text-foreground`})}},g=e=>{let o=C(()=>{let{settledBlocks:e,runningTools:n}=Co(p(t).blocks,p(m),p(h));return{settledBlocks:e,runningTools:n}}),c=C(()=>p(m)&&(p(i)===p(d).length-1||p(o).runningTools.length>0)),u=C(()=>p(f).workIndexBySectionIndex[p(i)]??0),g=C(()=>ho(p(t),{inProgress:p(c),workSectionIndex:p(u),runStartedAt:p(n).runStartedAt,runCompletedAt:p(n).runCompletedAt,priorWorkCompletedAtMs:p(f).priorCompletedAtByWorkIndex[p(u)]}));var _=Tu(),x=b(_),S=e=>{lu(e,{get inProgress(){return p(c)},get startedAtMs(){return p(g).startedAtMs},get completedAtMs(){return p(g).completedAtMs},children:(e,t)=>{var n=a();ue(b(n),19,()=>p(o).settledBlocks,(e,t)=>`${e.type}-${e.type===`tool-group`?e.tools.map(e=>e.callId).join(`,`):e.id}-${t}`,(e,t,n)=>{var i=a(),u=b(i),d=e=>{let r=C(()=>p(c)&&p(o).runningTools.length===0&&p(n)===p(o).settledBlocks.length-1);nu(e,{get text(){return p(t).text},get inProgress(){return p(r)}})},f=e=>{{let n=(e,t=te)=>{let n=C(()=>To(t(),p(m))),i=C(()=>wo(t(),p(m))),o=C(()=>Uo(t(),p(l)));var c=a(),u=b(c),d=e=>{var r=Su(),a=y(r),c=y(a),u=y(c,!0);k(c);var d=s(c,2),f=y(d);k(d),k(a);var h=s(a,2),g=y(h,!0);k(h),k(r),U((e,t)=>{O(a,`title`,e),L(c,1,t),V(u,p(o)),L(d,1,F(p(i)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`)),V(f,`(${p(i)??``})`),L(h,1,`mt-1.5 text-xs leading-5 wrap-break-word whitespace-pre-wrap ${p(i)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`}`),V(g,p(n))},[()=>Wo(t(),p(m),p(l)),()=>F(Po(t()))]),v(e,r)},f=e=>{var n=Cu(),r=y(n,!0);k(n),U((e,t)=>{L(n,1,e),O(n,`title`,t),V(r,p(o))},[()=>`min-w-0 ${Po(t())}`,()=>Wo(t(),p(m),p(l))]),v(e,n)};r(u,e=>{p(n)&&p(i)?e(d):e(f,-1)}),v(e,c)},i=C(()=>jo(p(t).toolKey)),o=C(()=>Oo(p(t).toolKey)),c=C(()=>p(t).toolKey===`apply_patch`?Vo(p(t).tools)<=2:void 0);au(e,{get label(){return p(i)},get icon(){return p(o)},get tools(){return p(t).tools},get defaultExpanded(){return p(c)},toolRow:n,$$slots:{toolRow:!0}})}};r(u,e=>{p(t).type===`reasoning`?e(d):e(f,-1)}),v(e,i)}),v(e,n)},$$slots:{default:!0}})};r(x,e=>{(p(o).settledBlocks.length>0||p(c)||p(o).runningTools.length>0)&&e(S)});var w=s(x,2),T=e=>{au(e,{label:`Running`,get icon(){return Yt},iconClass:`animate-spin`,get tools(){return p(o).runningTools},defaultExpanded:!0,toolRow:(e,t=te)=>{let n=C(()=>ko(t())),r=C(()=>Uo(t(),p(l)));var i=wu(),a=y(i);B(a,()=>p(n),(e,t)=>{t(e,{class:`text-muted-foreground mt-1.5 size-3 shrink-0`,"aria-hidden":`true`})});var o=s(a,2),c=y(o,!0);k(o),k(i),U(e=>{O(i,`title`,`${p(r)} (running)`),L(o,1,e),V(c,p(r))},[()=>F(Po(t()))]),v(e,i)},$$slots:{toolRow:!0}})};r(w,e=>{p(o).runningTools.length>0&&e(T)}),v(e,_)};r(c,e=>{p(t).type===`text`?e(u):e(g,-1)}),v(e,o)});var E=s(T,2),D=e=>{var t=Eu(),r=y(t);k(t),U(e=>V(r,`Worked for ${e??``}`),[()=>ou(Math.max(0,Math.floor((p(n).runCompletedAt-p(n).runStartedAt)/1e3)))]),v(e,t)};r(E,e=>{!p(m)&&p(n).runCompletedAt!==void 0&&e(D)}),k(x),k(_),U(()=>{O(_,`role`,p(m)?`log`:void 0),O(_,`aria-live`,p(m)?`polite`:void 0)}),v(e,_)};r(c,e=>{p(n).type===`prompt`?e(d):e(f,-1)}),v(e,o)}),k(n),v(e,n)};r(I,e=>{t.messages.length===0?e(oe):e(se,-1)}),k(j),k(A),ce(A,e=>l(d,e),()=>p(d)),le(2),k(ee),Ql(s(ee,2),{get image(){return p(g)},onClose:()=>{l(g,null)}}),f(`scroll`,A,h),v(e,D),N()}t([`click`]);function ju(e){return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`.\\`)||e.startsWith(`..\\`)||e.startsWith(`/`)||e.startsWith(`~/`)||e===`~`||/^[a-zA-Z]:[\\/]/.test(e)}function Mu(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 Nu(e){let t=Mu(e);return e.slice(t.length)}function Pu(e,t){let n=e.includes(`\\`)?`\\`:`/`;return`${Mu(e)}${t}${n}`}function Fu(e){return/[\\/]$/.test(e)}function Iu(e){return e.replace(/[\\/]+$/,``)}function Lu(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 Ru(e){let t=e.query.trim();return t?Fu(t)?e.browseParentPath||Iu(t):Lu({leaf:Nu(t),browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})??t:``}function zu(e){let t=e.query.trim();if(!t||Fu(t))return!1;let n=Nu(t);return n?Lu({leaf:n,browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})===void 0:!1}var Bu=i(`<p class="text-muted-foreground px-2 pb-1 text-[11px]">Reconnect <span class="text-muted-foreground"> </span> to a local directory</p>`),Vu=i(`<button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill rounded-md px-2 py-0.5 text-[11px] transition"> </button>`),Hu=i(`<div class="border-hairline flex flex-wrap gap-1.5 border-b px-3 py-2"></div>`),Uu=i(`<p class="text-muted-foreground px-3 py-8 text-center text-sm"> </p>`),Wu=i(`<button type="button" role="option"><!> <span class="truncate"> </span></button>`),Gu=i(`<p class="text-destructive border-t border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"> </p>`),Ku=i(`<div class="bg-overlay fixed inset-0 z-50 flex items-start justify-center px-4 pt-[10vh] backdrop-blur-[2px]" role="presentation"><div class="border-border bg-popover text-foreground flex max-h-[min(32rem,70vh)] w-full max-w-xl min-w-0 flex-col overflow-hidden rounded-2xl border shadow-2xl" role="dialog" aria-modal="true" aria-labelledby="project-picker-title" tabindex="-1"><div class="border-hairline border-b px-2.5 py-1.5"><div class="relative flex items-center"><div class="text-muted-foreground pointer-events-none flex items-center ps-2"><!></div> <input id="project-picker-title" class="text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent py-2 ps-2 pe-28 text-sm outline-none" placeholder="Enter project path (e.g. ~/projects/my-robot)" autocomplete="off"/> <!> <button type="button" class="border-border text-foreground bg-hover-fill hover:bg-hover-fill-strong absolute inset-e-2 top-1/2 -translate-y-1/2 rounded-md border px-2 py-1 text-[12px] transition disabled:cursor-not-allowed disabled:opacity-40"> </button></div> <!></div> <!> <div class="min-h-0 flex-1 overflow-y-auto py-1" role="listbox" aria-label="Directories"><!></div> <!> <footer class="text-muted-foreground border-hairline flex items-center justify-between gap-3 border-t px-3 py-2 text-[11px]"><div class="flex flex-wrap items-center gap-3"><span>↑↓ Navigate</span> <span> </span> <span>Esc Close</span></div> <button type="button" class="text-muted-foreground hover:text-foreground transition">Cancel</button></footer></div></div>`);function qu(e,t){E(t,!0);let i=M(t,`mode`,3,`add`),o=M(t,`recentProjectPaths`,19,()=>[]),c=x(`~/`),d=x(u([])),f=x(``),m=x(null),h=x(!1),g=x(!1),_=x(null),S=0,w=x(!1),T=C(()=>Nu(p(c)).toLowerCase()),D=C(()=>{let e=p(T).startsWith(`.`);return p(d).filter(t=>t.name.toLowerCase().startsWith(p(T))&&(e||!t.name.startsWith(`.`)))}),A=C(()=>p(c).trim()),j=C(()=>Ru({query:p(c),browseParentPath:p(f),browseEntries:p(d)})),te=C(()=>zu({query:p(c),browseParentPath:p(f),browseEntries:p(d)})),ne=C(()=>p(j).length>0&&(ju(p(A))||p(f).length>0)),re=C(()=>i()===`reconnect`?`Reconnect`:p(te)?`Create & add`:`Add`),ie=C(()=>{if(p(D).length>0)return p(D);let e=Nu(p(c)).replace(/[\\/]+$/,``);if(!e||p(T).length===0)return p(D);let t=p(f).split(/[/\\]/).filter(Boolean).at(-1);return t&&t.toLowerCase()===e.toLowerCase()?[{name:t,fullPath:p(f)}]:p(D)}),F=C(()=>p(h)?`Loading directories…`:p(j).length>0&&!p(te)?i()===`reconnect`?`Press Enter to reconnect this directory.`:`Press Enter to add this directory.`:p(te)?i()===`reconnect`?`Press Enter to create and reconnect this directory.`:`Press Enter to create and add this directory.`:`No matching directories in this path.`);n(()=>{if(!t.open){l(w,!1);return}p(w)||(l(w,!0),l(c,`~/`),l(m,null),l(_,null),ae(p(c)))}),n(()=>{if(!t.open||!p(w))return;let e=p(c),n=window.setTimeout(()=>{ae(e)},180);return()=>{window.clearTimeout(n)}});async function ae(e){let n=++S;l(h,!0);try{let r=await t.desktopApi.browseFilesystem({partialPath:e.trim().length>0?e:`~/`});if(n!==S)return;l(f,r.parentPath,!0),l(d,r.entries,!0),l(_,null)}catch(e){if(n!==S)return;l(_,e instanceof Error?e.message:`Failed to browse directories.`,!0)}finally{n===S&&l(h,!1)}}function I(e){if(e.name===`..`){l(c,`${e.fullPath}/`),l(m,e.fullPath,!0);return}l(c,Pu(p(f).endsWith(`/`)||p(f).endsWith(`\\`)?p(f):`${p(f)}/`,e.name),!0),l(m,e.fullPath,!0)}function oe(e){l(c,`${e.workspacePath}/`),l(m,e.workspacePath,!0)}async function se(){let e=p(j);if(!e){l(_,`Enter a project directory path.`);return}l(g,!0),l(_,null);try{let n=await t.desktopApi.resolveWorkspacePath({workspacePath:e,createIfMissing:p(te)});await t.onSelect({workspacePath:n.workspacePath,displayName:n.displayName,repositoryKey:n.repositoryKey}),t.onClose()}catch(e){l(_,e instanceof Error?e.message:`Failed to open the selected project.`,!0)}finally{l(g,!1)}}function R(e){if(e.key===`Escape`){e.preventDefault(),t.onClose();return}e.key===`Enter`&&!e.shiftKey&&p(ne)&&!p(g)&&(e.preventDefault(),se())}var ce=a(),B=b(ce),H=e=>{var n=Ku(),u=y(n),d=y(u),f=y(d),x=y(f);zt(y(x),{class:`size-4`}),k(x);var S=s(x,2);z(S),O(S,`spellcheck`,!1);var C=s(S,2),w=e=>{Yt(e,{class:`text-muted-foreground pointer-events-none absolute inset-e-24 top-1/2 size-4 -translate-y-1/2 animate-spin`})};r(C,e=>{p(h)&&e(w)});var T=s(C,2),E=y(T,!0);k(T),k(f);var D=s(f,2),A=e=>{var n=Bu(),r=s(y(n)),i=y(r,!0);k(r),le(),k(n),U(()=>V(i,t.expectedDisplayName)),v(e,n)};r(D,e=>{i()===`reconnect`&&t.expectedDisplayName&&e(A)}),k(d);var j=s(d,2),te=e=>{var t=Hu();ue(t,21,o,e=>e.workspacePath,(e,t)=>{var n=Vu(),r=y(n,!0);k(n),U(()=>V(r,p(t).displayName)),P(`click`,n,()=>{oe(p(t))}),v(e,n)}),k(t),v(e,t)};r(j,e=>{o().length>0&&e(te)});var M=s(j,2),N=y(M),ae=e=>{var t=Uu(),n=y(t,!0);k(t),U(()=>V(n,p(F))),v(e,t)},ce=e=>{var t=a();ue(b(t),17,()=>p(ie),e=>e.fullPath,(e,t)=>{var n=Wu(),i=y(n),a=e=>{kt(e,{class:`text-muted-foreground size-4 shrink-0`})},o=e=>{Vt(e,{class:`text-muted-foreground size-4 shrink-0`})};r(i,e=>{p(t).name===`..`?e(a):e(o,-1)});var c=s(i,2),l=y(c,!0);k(c),k(n),U(()=>{L(n,1,`flex min-h-8 w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition ${p(m)===p(t).fullPath?`text-foreground bg-hover-fill-strong`:`text-muted-foreground hover:text-foreground hover:bg-hover-fill`}`),O(n,`aria-selected`,p(m)===p(t).fullPath),V(l,p(t).name)}),P(`click`,n,()=>{I(p(t))}),v(e,n)}),v(e,t)};r(N,e=>{p(ie).length===0?e(ae):e(ce,-1)}),k(M);var B=s(M,2),H=e=>{var t=Gu(),n=y(t,!0);k(t),U(()=>V(n,p(_))),v(e,t)};r(B,e=>{p(_)&&e(H)});var de=s(B,2),fe=y(de),pe=s(y(fe),2),me=y(pe);k(pe),le(2),k(fe);var he=s(fe,2);k(de),k(u),k(n),U(()=>{T.disabled=!p(ne)||p(g),V(E,p(g)?`Working…`:p(re)),V(me,`Enter ${p(re)??``}`),he.disabled=p(g)}),P(`click`,n,e=>{e.target===e.currentTarget&&t.onClose()}),P(`keydown`,u,R),ee(S,()=>p(c),e=>l(c,e)),P(`click`,T,()=>{se()}),P(`click`,he,function(...e){t.onClose?.apply(this,e)}),v(e,n)};r(B,e=>{t.open&&e(H)}),v(e,ce),N()}t([`click`,`keydown`]);var Ju=i(`<div class="text-muted-foreground bg-hover-fill rounded-3xl border border-dashed border-[var(--hairline)] px-4 py-4 text-sm leading-6">Choose a project to start organizing threads.</div>`),Yu=i(`<p class="text-muted-foreground truncate text-[10px] tracking-[-0.01em]"> </p>`),Xu=i(`<span> </span>`),Zu=i(`<span class="rounded-full border border-emerald-500/25 bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-800 dark:text-emerald-200"> </span>`),Qu=i(`<p class="text-muted-foreground pb-2 text-[12px] leading-5"> </p>`),$u=i(`<p class="text-muted-foreground py-1.5 text-[12px]">No threads yet</p>`),ed=i(`<form class="px-1"><input class="border-border text-foreground focus:border-ring bg-hover-fill h-9 w-full rounded-lg border px-2 text-[13px] outline-none" aria-label="Rename thread"/></form>`),td=i(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-amber-300" aria-label="Starting agent"></span>`),nd=i(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-emerald-400" aria-label="Thread has an active run"></span>`),rd=i(`<div class="group/thread relative"><button type="button"><!> <span class="truncate"> </span></button> <button type="button"><!></button></div>`),id=i(`<button type="button" class="text-muted-foreground hover:text-muted-foreground px-2 py-1 text-[12px] transition"> </button>`),ad=i(`<div class="space-y-0.5"><!> <!></div>`),od=i(`<div class="ml-5 border-l border-[var(--hairline)] pl-3"><!> <!></div>`),sd=i(`<section class="space-y-1.5"><div class="group relative flex items-center px-2"><button type="button"><!> <!> <div class="min-w-0 flex-1"><p class="truncate text-[0.88rem] font-medium tracking-[-0.02em]"> </p> <!></div> <!> <!></button> <button type="button" class="text-muted-foreground hover:text-foreground hover:bg-hover-fill absolute top-0.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md opacity-0 transition group-hover:opacity-100 focus-visible:opacity-100 disabled:cursor-not-allowed disabled:opacity-40"><!></button></div> <!></section>`),cd=i(`<div class="space-y-4"></div>`),ld=i(`<div class="bg-tooltip text-tooltip-foreground ring-border pointer-events-none fixed z-100 max-w-64 -translate-y-1/2 rounded-md px-2.5 py-1.5 text-[12px] leading-4 shadow-lg ring-1" role="tooltip"> </div>`),ud=i(`<div data-thread-context-menu="" class="bg-popover text-popover-foreground fixed z-110 min-w-36 rounded-lg border border-[var(--hairline)] py-1 shadow-xl" role="menu"><button type="button" class="text-foreground hover:text-foreground hover:bg-hover-fill flex w-full px-3 py-1.5 text-left text-[13px] transition" role="menuitem">Rename</button></div>`),dd=i(`<aside class="app-sidebar-panel"><div class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex items-center justify-between gap-2 px-3.5 pt-3 pb-4"><!> <!></header> <div class="px-3.5 pb-1"><button type="button"><!> <span class="truncate">Add project</span></button></div> <div class="hide-scrollbar min-h-0 flex-1 overflow-y-auto px-2.5 py-3"><div class="mb-3 px-2"><p class="text-muted-foreground text-[10px] tracking-[0.24em] uppercase">Projects</p></div> <!></div> <div class="px-3.5 pt-2 pb-4"><button type="button"><!> Settings</button></div></div></aside> <!> <!>`,1);function fd(e,t){E(t,!0);let i=M(t,`pendingAgentLaunches`,19,()=>({})),o=`flex h-9 w-full min-w-0 items-center gap-2.5 rounded-lg px-2 text-[13px] font-medium tracking-[-0.02em] text-foreground transition hover:bg-hover-fill hover:text-foreground`,c=`size-4 shrink-0 text-muted-foreground`,d=x(u({})),m=x(u({})),h=x(null),g=x(null),_=x(null),S=x(``),w=x(``),T=x(null),D=x(null);n(()=>{!p(_)||!p(T)||(p(T).focus(),p(T).select())}),n(()=>{if(!p(D))return;function e(e){let t=e.target;t instanceof Element&&t.closest(`[data-thread-context-menu]`)||l(D,null)}function t(e){e.key===`Escape`&&l(D,null)}return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t,!0)}});function A(e,t){if(p(_))return;let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let r=n.getBoundingClientRect();l(h,t,!0),l(g,{top:r.top+r.height/2,left:r.right+8},!0)}function te(){l(h,null),l(g,null)}function ne(e){return p(d)[e]??!1}function re(e){l(d,{...p(d),[e]:!ne(e)},!0)}function ie(e){return p(m)[e]??!1}function ae(e){l(m,{...p(m),[e]:!ie(e)},!0)}function I(e){return e.project.localAttachmentAvailability===`unavailable`?`Missing`:e.project.localAttachmentAvailability===`unlinked`?`Link`:null}function oe(e,t){l(D,null),te(),l(_,e,!0),l(S,t,!0),l(w,t,!0)}function se(){l(_,null),l(S,``),l(w,``)}function R(){let e=p(_);if(!e)return;let n=p(S).trim();l(_,null),l(S,``);let r=p(w);l(w,``),!(n.length===0||n===r)&&t.onRenameThread(e,n)}function B(e,t){e.preventDefault(),te(),l(D,{threadId:t.threadId,title:t.title,x:e.clientX,y:e.clientY},!0)}var H=dd(),de=b(H),fe=y(de),pe=y(fe),me=y(pe);De(me,{size:`sm`,class:`min-w-0`}),za(s(me,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),k(pe);var he=s(pe,2),ge=y(he);L(ge,1,F(o)),Lt(y(ge),{class:c,"aria-hidden":`true`}),le(2),k(ge),k(he);var _e=s(he,2),W=s(y(_e),2),ve=e=>{v(e,Ju())},ye=e=>{var n=cd();ue(n,21,()=>t.groups,e=>e.project._id,(e,n)=>{let c=C(()=>p(n).project),u=C(()=>I(p(n)));var d=sd(),m=y(d),h=y(m),g=y(h);{let e=C(()=>`text-muted-foreground size-3 shrink-0 transition-transform ${ie(p(c).repositoryKey)?``:`rotate-90`}`);Ct(g,{get class(){return p(e)}})}var x=s(g,2);Vt(x,{class:`text-muted-foreground size-4 shrink-0`});var w=s(x,2),E=y(w),D=y(E,!0);k(E);var j=s(E,2),M=e=>{var t=Yu(),n=y(t,!0);k(t),U(()=>V(n,p(c).workspacePath??p(c).repositoryKey)),v(e,t)};r(j,e=>{p(c).repositoryKey!==p(c).displayName&&e(M)}),k(w);var N=s(w,2),F=e=>{var t=Xu(),n=y(t,!0);k(t),U(()=>{L(t,1,`rounded-full px-1.5 py-0.5 text-[10px] ${p(c).localAttachmentAvailability===`unavailable`?`border border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200`:`border border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200`}`),V(n,p(u))}),v(e,t)};r(N,e=>{p(u)&&e(F)});var oe=s(N,2),le=e=>{var t=Zu(),r=y(t,!0);k(t),U(()=>V(r,p(n).activeThreadCount)),v(e,t)};r(oe,e=>{p(n).activeThreadCount>0&&e(le)}),k(h);var H=s(h,2),de=y(H),fe=e=>{fn(e,{class:`size-4`})},pe=e=>{Lt(e,{class:`size-4`})};r(de,e=>{p(c).localAttachmentAvailability===`available`?e(fe):e(pe,-1)}),k(H),k(m);var me=s(m,2),he=e=>{var u=od(),d=y(u),m=e=>{var t=Qu(),n=y(t,!0);k(t),U(()=>V(n,p(c).localAttachmentError??(p(c).localAttachmentAvailability===`unlinked`?`This project needs a local directory attached before you can use it.`:`This project needs to be reconnected.`))),v(e,t)};r(d,e=>{(p(c).localAttachmentAvailability===`unavailable`||p(c).localAttachmentAvailability===`unlinked`)&&e(m)});var h=s(d,2),g=e=>{v(e,$u())},x=e=>{let u=C(()=>ne(p(c).repositoryKey)),d=C(()=>p(u)?p(n).threads:p(n).threads.slice(0,3)),m=C(()=>p(n).threads.length>3);var h=ad(),g=y(h);ue(g,17,()=>p(d),e=>e.threadId,(e,n)=>{let c=C(()=>Ta(i(),p(n).threadId)),u=C(()=>p(n).threadId===t.currentThreadId),d=C(()=>p(_)===p(n).threadId);var m=a(),h=b(m),g=e=>{var t=ed(),n=y(t);z(n),ce(n,e=>l(T,e),()=>p(T)),k(t),f(`submit`,t,e=>{e.preventDefault(),R()}),P(`keydown`,n,e=>{e.key===`Escape`&&(e.preventDefault(),se())}),f(`blur`,n,()=>{R()}),ee(n,()=>p(S),e=>l(S,e)),v(e,t)},x=e=>{var i=rd(),a=y(i),l=y(a),d=e=>{v(e,td())},m=e=>{v(e,nd())};r(l,e=>{p(c)?e(d):p(n).hasActiveRun&&e(m,1)});var h=s(l,2),g=y(h,!0);k(h),k(a);var _=s(a,2);st(y(_),{class:`size-3.5`,"aria-hidden":`true`}),k(_),k(i),U(()=>{L(a,1,`${o} pr-8 ${p(u)?`text-foreground bg-hover-fill`:`text-muted-foreground`}`),O(a,`aria-current`,p(u)?`page`:void 0),V(g,p(n).title),L(_,1,`text-muted-foreground hover:text-foreground hover:bg-hover-fill absolute top-1.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md transition focus-visible:opacity-100 ${p(u)?`opacity-100`:`opacity-0 group-focus-within/thread:opacity-100 group-hover/thread:opacity-100`}`),O(_,`aria-label`,`Archive ${p(n).title}`)}),f(`mouseenter`,a,e=>{A(e,p(n).title)}),f(`mouseleave`,a,te),f(`focus`,a,e=>{A(e,p(n).title)}),f(`blur`,a,te),P(`contextmenu`,a,e=>{B(e,p(n))}),P(`click`,a,()=>{t.onSelectThread(p(n))}),P(`click`,_,e=>{e.stopPropagation(),te(),t.onArchiveThread(p(n).threadId)}),v(e,i)};r(h,e=>{p(d)?e(g):e(x,-1)}),v(e,m)});var x=s(g,2),w=e=>{var t=id(),n=y(t,!0);k(t),U(()=>V(n,p(u)?`Show less`:`Show more`)),P(`click`,t,()=>{re(p(c).repositoryKey)}),v(e,t)};r(x,e=>{p(m)&&e(w)}),k(h),v(e,h)};r(h,e=>{p(n).threads.length===0?e(g):e(x,-1)}),k(u),v(e,u)},ge=C(()=>!ie(p(c).repositoryKey));r(me,e=>{p(ge)&&e(he)}),k(d),U(e=>{L(h,1,`flex min-w-0 flex-1 items-center gap-2 rounded-xl px-2 py-1 pr-8 text-left transition ${p(c).repositoryKey===t.currentRepositoryKey?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),O(h,`aria-label`,e),V(D,p(c).displayName),O(H,`aria-label`,p(c).localAttachmentAvailability===`available`?`Create thread in ${p(c).displayName}`:`Reconnect ${p(c).displayName}`)},[()=>ie(p(c).repositoryKey)?`Expand ${p(c).displayName} threads`:`Collapse ${p(c).displayName} threads`]),P(`click`,h,()=>{ae(p(c).repositoryKey)}),P(`click`,H,()=>{if(p(c).localAttachmentAvailability===`available`){t.onStartThreadDraft(p(c).repositoryKey);return}t.onReconnectProject(p(c)._id)}),v(e,d)}),k(n),v(e,n)};r(W,e=>{t.groups.length===0?e(ve):e(ye,-1)}),k(_e);var be=s(_e,2),xe=y(be);L(xe,1,F(o)),un(y(xe),{class:c,"aria-hidden":`true`}),le(),k(xe),k(be),k(fe),k(de);var Se=s(de,2),Ce=e=>{var t=ld(),n=y(t,!0);k(t),U(()=>{j(t,`top: ${p(g).top}px; left: ${p(g).left}px;`),V(n,p(h))}),v(e,t)};r(Se,e=>{p(h)&&p(g)&&!p(D)&&!p(_)&&e(Ce)});var we=s(Se,2),Te=e=>{var t=ud(),n=y(t);k(t),U(()=>j(t,`top: ${p(D).y}px; left: ${p(D).x}px;`)),P(`click`,n,()=>{oe(p(D).threadId,p(D).title)}),v(e,t)};r(we,e=>{p(D)&&e(Te)}),P(`click`,ge,function(...e){t.onAddProject?.apply(this,e)}),P(`click`,xe,function(...e){t.onOpenSettings?.apply(this,e)}),v(e,H),N()}t([`click`,`keydown`,`contextmenu`]);function pd(e){return e===`running`||e===`awaiting_executor`}function md(e,t){return pd(e.status)?e.claimExpiresAt!==void 0&&e.claimExpiresAt>t:!1}function hd(e){let t=e.recoveredSubmission,n=e.latestRun;return(n===null||n.submissionId===t?.submissionId&&!Ci(n.status))&&t?.prompt===e.prompt&&t.selectedModel===e.selectedModel&&t.reasoningEffort===e.reasoningEffort&&t.serviceTier===e.serviceTier&&Pi(t.imageUploadIds,e.imageUploadIds)?t.submissionId:e.newSubmissionId}function gd(e){return e.submissionRunStatus&&Ci(e.submissionRunStatus)?e.freshSubmissionId:e.threadSubmissionId}function _d(e,t){return e?e.status===`queued`||md(e,t):!1}function vd(e){e.desktopApi.runAgent({authToken:e.authToken,threadId:e.threadId,prompt:e.prompt,imageUploadIds:e.imageUploadIds,selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,submissionId:e.submissionId,projectId:e.projectId}).then(({runId:t})=>{e.onStarted(t)}).catch(t=>{console.error(`Failed to run agent`,t),e.onError(t)})}function yd(e){return Object.fromEntries(e.map(e=>[e.projectId,e]))}async function bd(e){return e?yd(await e.listProjectAttachments()):{}}async function xd(e){return await e.desktopApi.attachProject({projectId:e.projectId,workspacePath:e.workspacePath})}function Sd(e,t){let n=new Set(t);return e.filter(e=>e.availability===`available`&&n.has(e.projectId)).map(e=>e.projectId)}var Cd=class extends Error{constructor(){super(`Pending task was canceled.`),this.name=`LatestTaskQueueCancelledError`}};function wd(e){let t=null,n=!1;async function r(){if(!n){n=!0;try{for(;t;){let n=t;t=null;try{await e(n.value),n.resolve()}catch(e){n.reject(e)}}}finally{n=!1,t&&r()}}}return{enqueue(e){if(t)return t.value=e,t.promise;let n,i,a=new Promise((e,t)=>{n=e,i=t});return t={value:e,promise:a,resolve:n,reject:i},r(),a},cancelPending(){if(!t)return;let e=t;t=null,e.reject(new Cd)}}}async function Td(e){if(e.desktopApi)try{let t=(await e.desktopApi.listProjectAttachments()).find(t=>t.projectId===e.projectId);if(!t||t.availability!==`available`)throw Error(t?.unavailableReason??`Workspace path is unavailable.`);await e.refreshDesktopProjectAttachments()}catch(t){throw await e.refreshDesktopProjectAttachments(),t}}var Ed=40;function Dd(e,t){if(e.runStartedAt!==t.runStartedAt)return e.runStartedAt-t.runStartedAt;let n=e._creationTime??0,r=t._creationTime??0;return n===r?e.type===t.type?e._id.localeCompare(t._id):e.type===`prompt`?-1:1:n-r}function Od(e,t=Ed){if(e.length<=t)return e;let n=0;for(;e.length-n>t;){let t=e[n]?.runId;if(!t){n+=1;continue}for(;n<e.length&&e[n]?.runId===t;)n+=1}let r=e.slice(n);return r.length>t?r.slice(-t):r}function kd(e){let t=new Map;for(let n of e.historyMessages??[])t.set(n._id,n);for(let n of e.liveMessages??[])t.set(n._id,n);return Od([...t.values()].sort(Dd))}var Ad=i(`<div class="bg-background h-screen overflow-hidden"><!> <!></div>`),jd=i(`<!> <!>`,1),Md=i(`<div class="h-screen overflow-hidden"><div class="app-workspace-shell grid h-screen grid-cols-[292px_minmax(0,1fr)] overflow-hidden"><!> <main class="flex h-screen min-h-0 min-w-0 flex-col overflow-hidden"><!></main></div> <!></div>`);function Nd(t,i){E(i,!0);let o=()=>A(_e,`$authState`,f),d=()=>A(fe,`$convexAuthRetryPending`,f),[f,m]=e(),h=Te(),_=x(!1),S=C(()=>!!o().user),w=C(d),T=C(()=>o().isReady&&!o().isLoading&&p(S)&&!h.isLoading&&h.isAuthenticated),D=C(()=>p(S)&&o().isReady&&!o().isLoading&&!p(w)&&!h.isLoading&&!h.isAuthenticated);n(()=>{let e=be({retryPending:p(w),isAuthenticated:h.isAuthenticated,isLoading:h.isLoading,sawLoadingDuringRetry:p(_)});p(_)!==e.sawLoadingDuringRetry&&l(_,e.sawLoadingDuringRetry,!0),e.clearPending&&fe.set(!1)});let ee=Ce(W.projects.upsertSelected),O=Ce(W.threads.create),j=Ce(W.threads.rename),te=Ce(W.threads.archive),M=Ce(W.threads.restore),P=Ce(W.agentRuntime.finalizeRun),ie=Ce(W.agentQuestions.answer),F=Ce(W.uiPreferences.setLastThread),I=Ce(W.uiPreferences.setTheme),L=Ce(W.imageUploads.generateUploadUrl),oe=Ce(W.imageUploads.register),se=Ce(W.imageUploads.discard),R=Ce(W.projects.heartbeatAttached),ce=Ce(W.billing.ensureMySubscription),z=Se(W.modelCatalog.get,()=>({})),B=C(()=>z.data),V=null;n(()=>{if(!p(T))return;let e=vt();!e||V===e||(V=e,ce({}).catch(()=>{}))});let ue=`Connect to a running Sprocket server to use this project.`,H=3e4,U=wd(async e=>{await R({clientId:e.clientId,projectIds:e.projectIds})}),we=x(null),Ee=x(!1),De=x(null),G=x(null),Pe=x(null),K=x(u(yr)),Fe=x(u(br)),Ie=x(u(xr)),q=x(``),Le=x(null),Re=x(!1),ze=x(u([])),J=x(null),Be=x(null),Ve=x(0),He=new Qe,Ue=new Qe,We=new Qe,Y=new Qe,Ge=new Ze,Ke=x(u({})),qe=x(0),X=x(null),Je=0,Ye=0,Xe=x(!1),et=x(null),tt=x(null),nt=null,rt=x(0),it=x(null),at=x(u({})),Z=x(!1),ot=0,st=x(null),ct=x(!1),lt=x(`add`),ut=x(void 0),dt=x(null),ft=x(!1),pt=x(`account`),mt=x(u([])),ht=x(!1),gt=x(!1),_t=new Qe;function vt(){return o().user?.id??null}function yt(e,t){return p(ze).find(t=>t.localId===e)?(l(ze,p(ze).map(n=>n.localId===e?{...n,...t}:n),!0),!0):!1}async function bt(e,t,n){try{let r=await L({}),i=await fetch(r,{method:`POST`,headers:{"Content-Type":t.type},body:t});if(!i.ok)throw Error(`Upload failed (${i.status}).`);let{storageId:a}=await i.json(),o=await oe({storageId:a,name:n});if(`error`in o)throw Error(o.error);let s=p(ze).find(t=>t.localId===e);s&&URL.revokeObjectURL(s.previewUrl),yt(e,{status:`ready`,imageUploadId:o.imageUploadId,previewUrl:o.url})||se({imageUploadId:o.imageUploadId}).catch(()=>{})}catch(t){let n=t instanceof Error?t.message:`Upload failed.`;yt(e,{status:`error`,error:n}),l(J,n,!0)}}function xt(e){for(let t of e){let e=Li(p(ze).length,t);if(e){l(J,e,!0);continue}let n=crypto.randomUUID(),r=t.name||`Pasted image`;l(ze,[...p(ze),{localId:n,name:r,mediaType:t.type,size:t.size,previewUrl:URL.createObjectURL(t),status:`uploading`}],!0),bt(n,t,r)}}function St(e){let t=p(ze).find(t=>t.localId===e);t&&(URL.revokeObjectURL(t.previewUrl),l(ze,p(ze).filter(t=>t.localId!==e),!0),t.imageUploadId&&se({imageUploadId:t.imageUploadId}).catch(()=>{}))}function Ct(e){for(let t of p(ze))URL.revokeObjectURL(t.previewUrl),e.discard&&t.imageUploadId&&se({imageUploadId:t.imageUploadId}).catch(()=>{});l(ze,[],!0)}function wt(e,t){return e?`thread:${e}`:t?`draft:${t}`:null}function Tt(e,t){He.get(e)===t&&He.delete(e)}function Et(e,t){return`${e}\0${t}`}function Dt(e,t,n){Ue.set(Et(e,t),n)}function Ot(e,t){let n=Et(e,t);Ue.delete(n),We.delete(n)}function kt(){return o().user&&h.isAuthenticated&&!h.isLoading?{}:`skip`}let At=Se(W.projects.listMine,kt),jt=Se(W.threads.listMine,kt),Mt=Se(W.uiPreferences.getMine,kt),Nt=x(u(ke(null))),Pt=!1,Ft,It=null,Lt=0;n(()=>{if(!p(T)){Pt=!1,Ft=void 0,It=null,Lt=0;return}let e=Mt.data;if(e===void 0||It!==null)return;let t=e?.theme;if(Pt&&t===Ft)return;Pt=!0,Ft=t;let n=ke(t);l(Nt,n,!0),Oe(n)});async function Rt(e){let t=p(Nt),n=++Lt;It=e,l(Nt,e,!0),Oe(e);try{if(await I({theme:e}),n!==Lt)return;Ft=e}catch(e){if(n!==Lt)return;l(Nt,t,!0),Oe(t),l(J,e instanceof Error?e.message:`Failed to save theme preference.`,!0)}finally{n===Lt&&(It=null)}}let zt=()=>p(G)&&kt()!==`skip`?{threadId:p(G)}:`skip`,Bt=Se(W.threads.getByThreadId,zt),Vt=Se(W.messages.listHistoryForThread,zt),Ht=Se(W.messages.listLiveForThread,zt),Ut=Se(W.chat.latestRunForThread,zt),Wt=Se(W.agentQuestions.headPendingForThread,zt),Gt=C(()=>{for(let e of[z,At,jt,Mt,Bt,Vt,Ht,Ut,Wt])if(e.error)return e.error;return null}),Kt=C(()=>(At.data??[]).map(e=>{let t=p(at)[e._id];return{...e,workspacePath:t?.workspacePath,localAttachmentAvailability:t?t.availability:`unlinked`,localAttachmentError:t?.unavailableReason}})),qt=C(()=>jt.data??[]),Jt=C(()=>Sa(Bt.data,p(G))),Yt=C(()=>{let e=p(B)?wr(p(B),p(K))??wr(p(B),p(B).defaultModelId):void 0;return{inputTokens:p(Jt)?.contextTokens??0,totalTokensProcessed:p(Jt)?p(Jt).totalTokensProcessed:0,contextWindowTokens:e?.contextWindowTokens??0,autoCompactTokenLimit:e?.autoCompactTokenLimit??0}}),Xt=C(()=>Sa(Ut.data,p(G))),Zt=C(()=>Sa(Wt.data,p(G))),Qt=C(()=>Sa(Vt.data,p(G))),$t=C(()=>Sa(Ht.data,p(G))),en=C(()=>!p(Qt)||!p($t)?[]:kd({historyMessages:p(Qt).messages,liveMessages:p($t).messages})),tn=C(()=>p(De)?fa(p(Kt),p(De)):null),nn=C(()=>p(tn)?._id??null),rn=C(()=>{let e=p(tn)?.workspacePath??null,t=p(we);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}}}),an=C(()=>p(nn)?p(qt).filter(e=>e.projectId===p(nn)&&ha(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt):[]),on=C(()=>va(p(Kt),p(qt))),sn=C(()=>p(Xt)?.run??null),cn=C(()=>(p(Xt)?.jobs??[]).slice(-60)),ln=C(()=>wt(p(G),p(nn))),un=C(()=>p(X)&&p(X).runId===(p(sn)?._id??null)?p(X).serverNow+Math.max(0,p(qe)-p(X).localObservedAt):p(Xt)?.serverNow??Date.now()),dn=C(()=>{let e=vt();if(!(!e||!p(ln)))return We.get(Et(e,p(ln)))}),fn=C(()=>p(sn)?.status===`queued`&&p(dn)?.submissionId===p(sn).submissionId),pn=C(()=>_d(p(sn),p(un))&&!p(fn)),mn=C(()=>Ta(p(Ke),p(G))),hn=C(()=>wa({threadId:p(G),pendingCreatedThreadId:p(it),hasLatestRunData:!!p(Xt)})),gn=C(()=>!!(p(ln)&&He.has(p(ln)))),_n=C(()=>!!(p(nn)&&p(tn)?.localAttachmentAvailability===`available`&&!p(gn)&&!p(Re)&&!p(mn)&&(!p(pn)&&p(hn)||p(Zt)))),vn=C(()=>Sd(Object.values(p(at)),p(Kt).map(e=>e._id))),yn=C(()=>[...p(vn)].sort().join(`\0`)),bn=C(()=>{let e=new Ze,t=[];for(let n of Object.values(p(at))){if(n.availability!==`available`||e.has(n.workspacePath))continue;e.add(n.workspacePath);let r=n.workspacePath.split(/[/\\]/).filter(Boolean).at(-1)??n.workspacePath;t.push({workspacePath:n.workspacePath,displayName:r})}return t.sort((e,t)=>t.displayName.localeCompare(e.displayName))});async function xn(){let e=++ot,t=await bd(p(we));e===ot&&(l(at,t,!0),l(Z,!0))}function Sn(e,t=null,n=!1){l(De,e,!0),l(G,t,!0),l(Pe,n?e:null,!0),t!==p(it)&&l(it,null)}function Cn(e,t=null,n=!1,r=!1){l(rt,p(rt)+1),r||l(J,null),Sn(e,t,n)}async function wn(e,t){if(!p(we))throw Error(ue);let n=await xd({desktopApi:p(we),projectId:e,workspacePath:t});return ot+=1,l(at,{...p(at),[n.projectId]:n},!0),l(Z,!0),n}function Tn(e,t={}){let n=fa(p(Kt),e);if(!n){l(J,`Choose a project first.`);return}Cn(e,t.threadId,t.draft);let r=p(rt);Fn(n._id).catch(e=>{r===p(rt)&&l(J,e instanceof Error?e.message:`Failed to attach project.`,!0)})}function En(e=`add`,t=null){if(!p(we)||!p(Be)){l(J,ue);return}l(lt,e,!0),l(dt,t,!0);let n=e===`reconnect`&&t?p(Kt).find(e=>e._id===t):void 0;l(ut,n?.displayName,!0),l(ct,!0),l(J,null)}async function Dn(e){if(!p(we)||!p(Be)){l(J,ue);return}let t=vt(),n=p(Be);if(!t){l(J,`User session is not ready.`);return}try{if(p(lt)===`reconnect`&&p(dt)){await An(e,p(dt),t,n);return}await kn(e,t,n)}catch(e){if(vt()!==t)return;throw l(J,e instanceof Error?e.message:`Failed to attach project.`,!0),e}}async function On(e,t){let n=await ee({repositoryKey:e.repositoryKey,displayName:e.displayName,connectedClientId:t});if(!n)throw Error(`Failed to create or update the project.`);return n}async function kn(e,t,n){let r=await On(e,n);vt()===t&&(await wn(r._id,e.workspacePath),vt()===t&&(Cn(e.repositoryKey,null,!0),l(J,null)))}async function An(e,t,n,r){let i=p(Kt).find(e=>e._id===t),a=await On(e,r);if(vt()!==n||(await wn(a._id,e.workspacePath),vt()!==n))return;let o=i?.repositoryKey===e.repositoryKey?p(G):null;Cn(e.repositoryKey,o),l(J,null)}function Mn(e){let t=e?.trim();t&&l(mt,[...p(mt),t],!0)}async function Nn(){let e=window.sprocketDesktopBridge;if(e?.takeWorkspaceLaunch)for(;;){let t=await e.takeWorkspaceLaunch();if(!t)return;Mn(t)}}async function Pn(e,t,n,r){let i=await t.resolveWorkspacePath({workspacePath:e});vt()===n&&await kn(i,n,r)}async function Fn(e){await Td({desktopApi:p(we),refreshDesktopProjectAttachments:xn,projectId:e})}function Ln(e){En(`reconnect`,e)}function Rn(e){window.setTimeout(()=>{if(vt()!==e.userId||p(it)!==e.threadId||p(G)!==e.threadId||p(De)!==e.repositoryKey||p(qt).some(t=>t.threadId===e.threadId))return;l(it,null),Cn(e.repositoryKey,null,!0);let t=wt(null,e.projectId);t&&Dt(e.userId,t,{message:`The new thread did not appear. Review your prompt and try sending it again.`,prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,selectedModel:e.selectedModel,submissionId:e.submissionId})},H)}async function zn(e){let t=await O({submissionId:e.submissionId,projectId:e.projectId,selectedModel:Cr(e.selectedModel),reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier});return e.isSubmissionCurrent()?(e.userId===vt()&&e.selectionGeneration===p(rt)&&(l(it,t.threadId,!0),l(rt,p(rt)+1),l(G,t.threadId,!0),l(Pe,null),Rn({prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier,selectedModel:e.selectedModel,submissionId:e.submissionId,threadId:t.threadId,userId:e.userId,repositoryKey:e.repositoryKey,projectId:e.projectId})),t):null}function Bn(e){Tn(e,{draft:!0})}function Vn(e){let t=pa(p(Kt),e.projectId);if(!t){l(J,`Choose a project first.`);return}Tn(t.repositoryKey,{threadId:e.threadId})}async function Hn(e,t){try{await j({threadId:e,title:t})}catch(e){l(J,e instanceof Error?e.message:`Failed to rename thread.`,!0)}}async function Un(e){let t=vt();try{await te({threadId:e}),t&&Ot(t,`thread:${e}`),vt()===t&&(p(G)===e&&(l(G,null),l(it,null),l(rt,p(rt)+1)),p(tt)===e&&l(tt,null),l(J,null))}catch(e){if(vt()!==t)return;l(J,e instanceof Error?e.message:`Failed to archive thread.`,!0)}}async function Wn(e){try{await M({threadId:e})}catch(e){l(J,e instanceof Error?e.message:`Failed to restore thread.`,!0)}}async function Gn(){let e=p(Zt),t=p(G);if(!e||!t||p(Re)||!p(Le)&&!p(q).trim())return;l(Re,!0),l(J,null);let n=p(q),r=p(Le),i=n.trim();l(q,``),l(Le,null);try{await ie({threadId:t,questionId:e.questionId,...r?{optionId:r}:{},...i?{text:i}:{}})}catch(i){p(G)===t&&p(Zt)?.questionId===e.questionId&&(l(q,n,!0),l(Le,r,!0),l(J,i instanceof Error?i.message:String(i),!0))}finally{l(Re,!1)}}async function Kn(){if(p(Zt)){await Gn();return}if(p(gn)||!p(q).trim()&&p(ze).length===0)return;if(p(ze).some(e=>e.status!==`ready`)){l(J,`Wait for image uploads to finish, or remove failed images before sending.`);return}let e=p(nn);if(!e){l(J,`Choose a project first.`);return}if(!p(we)){l(J,ue);return}if(p(G)&&!p(hn)){l(J,`Loading thread state before sending.`);return}if(!p(_n)){l(J,p(pn)||p(mn)||p(gn)?`Wait for the current agent launch or run to finish.`:p(tn)?.localAttachmentAvailability===`available`?`You need an active project before sending.`:`This project needs to be attached before sending.`,!0);return}l(Ve,0);let t=p(rt),n=p(G),r=p(De);if(!r){l(J,`Choose a project first.`);return}let i=e,a=!1,o=vt();if(!o){l(J,`User session is not ready.`);return}let s=()=>vt()===o,c=p(q).trim(),u=p(ze).map(e=>({...e})),d=u.flatMap(e=>e.imageUploadId?[e.imageUploadId]:[]),f=p(K),m=p(Fe),h=p(Ie),g=n?p(sn)?._id??null:null,_=n?`thread:${n}`:`draft:${e}`,v=_,y=v,b=Et(o,v),x=We.get(b),S=crypto.randomUUID(),C=hd({latestRun:n?p(sn):null,newSubmissionId:S,prompt:c,imageUploadIds:d,reasoningEffort:m,serviceTier:h,recoveredSubmission:x?{...x,selectedModel:Cr(x.selectedModel)}:void 0,selectedModel:Cr(f)}),w=C;Ot(o,v);let T=null,E=null,D=++Ye,ee=Et(o,v);Y.set(ee,D);let O=()=>Y.get(ee)===D,k=`Your session changed before the agent started. Return to this account and send the prompt again.`,A=`This request is still preparing. Wait for it to finish before trying again.`,j=e=>{Dt(o,y,{message:e,prompt:c,attachments:u,imageUploadIds:d,reasoningEffort:m,serviceTier:h,selectedModel:f,submissionId:!n&&y===v?C:w})},te=()=>{Ot(o,y),s()&&p(J)===A&&l(J,null)},ne=window.setTimeout(()=>{Y.get(ee)===D&&Dt(o,y,{message:A,prompt:``})},H);l(q,``),l(J,null),He.set(_,D);try{if(!n){let e=p(tn)?.workspacePath;if(!e)throw Error(`This project needs to be attached before sending.`);let t=await p(we).resolveWorkspacePath({workspacePath:e});if(!O())return;if(ma(r,t.repositoryKey)){if(!p(Be))throw Error(ue);let e=await On({workspacePath:t.workspacePath,displayName:t.displayName,repositoryKey:t.repositoryKey},p(Be));if(!O()||(await wn(e._id,t.workspacePath),!O()))return;i=e._id,r=t.repositoryKey,a=!0,Tt(_,D),_=`draft:${i}`,He.set(_,D)}}let e=n?null:await zn({isSubmissionCurrent:O,prompt:c,attachments:u,imageUploadIds:d,selectionGeneration:t,selectedModel:f,selectedReasoningEffort:m,selectedServiceTier:h,submissionId:C,userId:o,repositoryKey:r,projectId:i}),v=n??e?.threadId??null;if(!v||!O())return;if(e&&(w=gd({freshSubmissionId:S,submissionRunStatus:e.submissionRunStatus,threadSubmissionId:C})),!s()){j(k);return}T=v,n||(Tt(_,D),_=`thread:${v}`,He.set(_,D),te(),Y.get(ee)===D&&Y.delete(ee),y=`thread:${v}`,ee=Et(o,y),Y.set(ee,D),a&&(Cn(r,v),_t.set(v,`A new project was created because this directory’s git remote changed. Earlier threads stay on the previous project.`)));let b=await ye({forceRefreshToken:!0});if(!b){j(`Your session ended before the agent started. Sign in again.`);return}if(!O())return;if(!s()){j(k);return}te();let x=++Je;E=x,l(Ke,Ea(p(Ke),v,{expiresAt:Date.now()+H,launchId:x,...p(sn)?.claimExpiresAt?{previousClaimExpiresAt:p(sn).claimExpiresAt}:{},previousRunId:g}),!0),window.setTimeout(()=>{let e=p(qt).find(e=>e.threadId===v)?.latestRunId??null,t=p(G)===v?p(sn)?._id??null:null,n=[e,t].find(e=>e&&e!==g)??e??t,r=p(G)===v&&p(sn)?._id===n?p(sn).claimExpiresAt:p(qt).find(e=>e.threadId===v)?.latestRunClaimExpiresAt,i=ja(p(Ke),v,x,Date.now(),n,r);i.pendingLaunches!==p(Ke)&&(l(Ke,i.pendingLaunches,!0),i.shouldRecover&&j(`The local agent did not start. Please try again.`))},H),vd({authToken:b,desktopApi:p(we),onError:e=>{if(!O()||!s())return;let t=Da(p(Ke),v,x);t!==p(Ke)&&l(Ke,t,!0),j(e instanceof Error?e.message:`Failed to start the local agent run.`)},onStarted:e=>{!O()||!s()||(l(Ke,ka(p(Ke),v,e),!0),Ct({discard:!1}))},threadId:v,prompt:c,imageUploadIds:d,selectedModel:Cr(f),submissionId:w,reasoningEffort:m,serviceTier:h,projectId:i})}catch(e){if(T&&E!==null&&l(Ke,Da(p(Ke),T,E),!0),!O())return;if(!s()){j(k);return}j(e instanceof Error?e.message:`Failed to send prompt.`),xn().catch(()=>{})}finally{window.clearTimeout(ne),Tt(_,D),E===null&&Y.get(ee)===D&&Y.delete(ee)}}async function Jn(){if(!(!p(sn)?._id||!p(pn)))try{await P({runId:p(sn)._id,text:``,status:`cancelled`})}catch(e){l(J,e instanceof Error?e.message:`Failed to cancel run.`,!0)}}n(()=>{let e=p(Xt);if(!e){l(X,null);return}p(X)?.serverNow===e.serverNow&&p(X).runId===(e.run?._id??null)||l(X,{localObservedAt:window.performance.now(),runId:e.run?._id??null,serverNow:e.serverNow},!0)}),n(()=>{if(!p(sn)||!pd(p(sn).status))return;let e=()=>{l(qe,window.performance.now(),!0)};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)}),n(()=>{let e=vt(),t=wt(p(G),p(nn)),n=p(sn);if(!e||!t||!n||!pd(n.status)||p(pn)||p(gn)||p(mn)||p(q)!==``||p(ze).length>0||!p(Xt)||!p(Xt).prompt&&!p(Xt).imageUploadIds?.length)return;let r=p(Xt).imageUploadIds??[],i=p(Xt).prompt??``,a=p(en).find(e=>e.runId===n._id&&e.type===`prompt`),o=r.flatMap(e=>{let t=a?.attachments.find(t=>t.imageUploadId===e);return t?.url?[t]:[]}),s=r.length-o.length,c=`${e}\0${n._id}\0${n.claimExpiresAt??`none`}`;if(Ge.has(c))return;Ge.add(c);let l=o.map(e=>({localId:e.imageUploadId,name:e.name,mediaType:e.mediaType,size:e.size,previewUrl:e.url,status:`ready`,imageUploadId:e.imageUploadId}));Dt(e,t,{message:s>0?`The previous agent stopped responding. ${s} image attachment${s===1?` is`:`s are`} unavailable; review and retry this submission.`:`The previous agent stopped responding. Retry to continue this submission.`,prompt:i,attachments:l,imageUploadIds:r,reasoningEffort:n.reasoningEffort,serviceTier:n.serviceTier,selectedModel:n.selectedModel,submissionId:n.submissionId})}),n(()=>{let e=vt();p(st)!==e&&(l(st,e,!0),l(Xe,!1),l(De,null),l(G,null),l(Pe,null),l(it,null),l(Ke,{},!0),l(et,null),l(tt,null),V=null,nt=null,l(rt,p(rt)+1),l(q,``),Ct({discard:!0}),l(J,null),l(Ve,0),l(K,p(B)?.defaultModelId??`gpt-5.6-sol`,!0),l(Fe,p(B)?.defaultReasoningEffort??br,!0),l(Ie,p(B)?.defaultServiceTier??`standard`,!0),l(ct,!1),l(dt,null),l(ut,void 0))}),n(()=>{let e=p(mt)[0],t=p(we),n=vt(),r=p(Be);!e||p(ht)||!p(T)||!t||!n||!r||At.data===void 0||(l(mt,p(mt).slice(1),!0),l(ht,!0),l(Xe,!0),l(et,null),l(ct,!1),l(ft,!1),l(J,null),Pn(e,t,n,r).catch(e=>{vt()===n&&(l(Xe,!1),l(J,e instanceof Error?e.message:`Failed to open the requested project.`,!0))}).finally(()=>{l(ht,!1)}))}),n(()=>{let e=p(Jt),t=e?._id??null;t!==nt&&(nt=t,e&&(l(K,e.selectedModel,!0),l(Fe,e.reasoningEffort,!0),l(Ie,e.serviceTier,!0)))}),n(()=>{let e=vt(),t=wt(p(G),p(nn));if(!e||!t)return;let n=Et(e,t),r=Ue.get(n);if(!r)return;Ue.delete(n);let i=p(q)===``;i&&l(q,r.prompt,!0),p(ze).length===0&&r.attachments?.length&&(i||p(q)===r.prompt)&&l(ze,r.attachments.map(e=>({...e})),!0),p(q)===r.prompt&&r.submissionId&&(r.prompt||r.imageUploadIds?.length)&&r.reasoningEffort&&r.selectedModel&&We.set(n,{prompt:r.prompt,imageUploadIds:r.imageUploadIds??[],reasoningEffort:r.reasoningEffort,serviceTier:r.serviceTier??p(B)?.defaultServiceTier??`standard`,selectedModel:r.selectedModel,submissionId:r.submissionId}),l(J,r.message,!0)}),n(()=>{if(!p(it))return;let e=Ca({pendingCreatedThreadId:p(it),threads:p(qt)});e!==p(it)&&l(it,e,!0)}),n(()=>{let e=Mt.data;if(p(Xe)||!p(gt)||p(mt).length>0||p(ht)||!At.data||!jt.data||e===void 0)return;l(Xe,!0);let t=xa(p(qt),e?.lastThreadId??null);if(t&&ha(t)){let e=pa(p(Kt),t.projectId);if(e){Cn(e.repositoryKey,t.threadId,!1,!0),l(et,e._id,!0),l(tt,t.threadId,!0);return}}p(Kt)[0]&&(Cn(p(Kt)[0].repositoryKey,null,!1,!0),l(et,p(Kt)[0]._id,!0))}),n(()=>{let e=p(et);if(!e||!p(we)||!p(Z))return;if(!p(Kt).find(t=>t._id===e)){l(et,null);return}l(et,null);let t=p(rt);Fn(e).catch(e=>{t===p(rt)&&l(J,e instanceof Error?e.message:`Failed to attach project.`,!0)})}),n(()=>{let e=p(G)?xa(p(qt),p(G)):null,t=pa(p(Kt),e?.projectId);t&&t.repositoryKey!==p(De)&&Cn(t.repositoryKey,p(G),p(Pe)===t.repositoryKey)}),n(()=>{let e=p(an);if(!p(Xe)||!p(De))return;let t=Ma({threads:e,currentThreadId:p(G),currentRepositoryKey:p(De),draftRepositoryKey:p(Pe),pendingCreatedThreadId:p(it)});t!==p(G)&&Cn(p(De),t,p(Pe)===p(De),!0)}),n(()=>{!p(Xe)||!p(G)||p(G)!==p(tt)&&(l(tt,p(G),!0),F({threadId:p(G)}))}),n(()=>{let e=Aa(p(Ke),p(qt));p(G)&&p(sn)?._id&&(e=ka(e,p(G),p(sn)._id,p(sn).claimExpiresAt)),e!==p(Ke)&&l(Ke,e,!0)}),n(()=>{let e=p(sn)?.startedAt;if(!p(pn)||!e){l(Ve,0);return}let t=()=>{l(Ve,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}),n(()=>{let e=p(Be),t=p(yn);if(!e||!p(we)||!p(Z)||At.data===void 0||kt()===`skip`)return;let n={clientId:e,projectIds:t?t.split(`\0`):[]};U.enqueue(n).catch(()=>{});let r=window.setInterval(()=>{U.enqueue(n).catch(()=>{})},$e);return()=>{window.clearInterval(r),U.cancelPending()}}),ae(()=>{l(Be,crypto.randomUUID(),!0);let e=window.sprocketDesktopBridge,t=e?.onWorkspaceLaunch?e.onWorkspaceLaunch(()=>{Nn()}):void 0,n=je();return n&&(Mn(n),Me()),e?.takeWorkspaceLaunch?Nn().finally(()=>{l(gt,!0)}):l(gt,!0),Ne().then(e=>{l(we,e,!0),l(Ee,!0),xn().catch(e=>{l(J,e instanceof Error?e.message:`Failed to load local project attachments.`,!0)})}).catch(e=>{l(J,e instanceof Error?e.message:`Failed to connect to the Sprocket server.`,!0),l(Ee,!0)}),()=>t?.()});var Yn=a();ne(`1uha8ag`,e=>{g(()=>{c.title=`Sprocket`})});var Xn=b(Yn),Zn=e=>{Ae(e,{title:`Connecting to Sprocket…`,description:`Looking for a running Sprocket server on this machine.`,busy:!0})},Qn=e=>{{let t=e=>{{let t=C(()=>de(`/pair`));jn(e,{get href(){return p(t)},children:(e,t)=>{le(),v(e,re(`Open pairing`))},$$slots:{default:!0}})}},n=C(()=>p(J)??`Connect to your Sprocket server to continue.`);Ae(e,{title:`Connect to Sprocket`,get description(){return p(n)},actions:t,$$slots:{actions:!0}})}},$n=e=>{var t=Ad(),n=y(t);{let e=C(()=>({isLoading:!o().isReady||o().isLoading||p(w)||p(S)&&h.isLoading,isConfigured:o().isConfigured,isAuthenticated:p(S),connectionFailed:p(D),error:o().error}));In(n,{get authState(){return p(e)},get overlayOpen(){return o().isWaitingForBrowserSignIn},onSignIn:()=>void xe(),onSignOut:()=>void pe(),onRetry:()=>void ge(),onSignUp:()=>void me()})}qn(s(n,2),{get open(){return o().isWaitingForBrowserSignIn},get signInUrl(){return o().browserSignInUrl},get error(){return o().error},get onCancel(){return ve},get onClearOpenError(){return he}}),k(t),v(e,t)},er=e=>{var t=Md(),n=y(t),i=y(n),c=e=>{Ha(e,{get activePage(){return p(pt)},get theme(){return p(Nt)},onThemeChange:e=>void Rt(e),onBack:()=>{l(ft,!1),l(pt,`account`)},onNavigate:e=>{l(pt,e,!0)}})},u=e=>{fd(e,{get currentRepositoryKey(){return p(De)},get currentThreadId(){return p(G)},get groups(){return p(on)},get pendingAgentLaunches(){return p(Ke)},get theme(){return p(Nt)},onThemeChange:e=>void Rt(e),onAddProject:()=>{En(`add`)},onReconnectProject:e=>{Ln(e)},onOpenSettings:()=>{l(pt,`account`),l(ft,!0)},onStartThreadDraft:Bn,onSelectThread:Vn,onRenameThread:(e,t)=>{Hn(e,t)},onArchiveThread:e=>{Un(e)}})};r(i,e=>{p(ft)?e(c):e(u,-1)});var d=s(i,2),f=y(d),m=e=>{var t=a(),n=b(t),i=e=>{La(e,{get threads(){return p(qt)},get projects(){return p(Kt)},onRestore:e=>{Wn(e)}})},s=e=>{no(e,{})},c=e=>{da(e,{get user(){return o().user},onSignOut:()=>void pe()})};r(n,e=>{p(pt)===`archived`?e(i):p(pt)===`usage`?e(s,1):e(c,-1)}),v(e,t)},h=e=>{var t=jd(),n=b(t);{let e=C(()=>p(J)??o().error??p(Gt)?.message??null),t=C(()=>p(sn)?.lastError??null),r=C(()=>p(pn)?p(sn)?._id??null:null),i=C(()=>p(G)?_t.get(p(G))??null:null);Au(n,{get currentError(){return p(e)},get runError(){return p(t)},get messages(){return p(en)},get actions(){return p(cn)},get activeRunId(){return p(r)},get project(){return p(tn)},get remoteChangeNotice(){return p(i)},onDismissRemoteChangeNotice:()=>{p(G)&&_t.delete(p(G))}})}var r=s(n,2);{let e=C(()=>p(gn)||p(mn)||p(Re)),t=C(()=>p(pn)?ou(p(Ve)):null);ta(r,{get attachments(){return p(ze)},onAttachFiles:xt,onRemoveAttachment:St,get modelCatalog(){return p(B)},get pendingQuestion(){return p(Zt)},get canSend(){return p(_n)},get isSubmitting(){return p(e)},get isStarting(){return p(mn)},get isRunning(){return p(pn)},get elapsedLabel(){return p(t)},get contextUsage(){return p(Yt)},get projectSkills(){return p(rn)},onSubmit:()=>{Kn()},onCancel:()=>{Jn()},get prompt(){return p(q)},set prompt(e){l(q,e,!0)},get selectedModel(){return p(K)},set selectedModel(e){l(K,e,!0)},get selectedReasoningEffort(){return p(Fe)},set selectedReasoningEffort(e){l(Fe,e,!0)},get selectedServiceTier(){return p(Ie)},set selectedServiceTier(e){l(Ie,e,!0)},get selectedQuestionOptionId(){return p(Le)},set selectedQuestionOptionId(e){l(Le,e,!0)}})}v(e,t)};r(f,e=>{p(ft)?e(m):e(h,-1)}),k(d),k(n);var g=s(n,2),_=e=>{qu(e,{get open(){return p(ct)},get desktopApi(){return p(we)},get mode(){return p(lt)},get expectedDisplayName(){return p(ut)},get recentProjectPaths(){return p(bn)},onClose:()=>{l(ct,!1),l(dt,null),l(ut,void 0)},onSelect:async e=>{try{await Dn(e)}catch{await xn()}}})};r(g,e=>{p(we)&&p(ct)&&e(_)}),k(t),v(e,t)};r(Xn,e=>{p(Ee)?p(we)?p(T)?e(er,-1):e($n,2):e(Qn,1):e(Zn)}),v(t,Yn),N(),m()}export{Nd as component};
|